diff --git a/DiscImageChef.CommonTypes.csproj b/DiscImageChef.CommonTypes.csproj index 089cf06cc..03d3dafbf 100644 --- a/DiscImageChef.CommonTypes.csproj +++ b/DiscImageChef.CommonTypes.csproj @@ -69,11 +69,14 @@ + + + diff --git a/Interfaces/IMediaImage.cs b/Interfaces/IMediaImage.cs index abf87ee4f..16ff53c39 100644 --- a/Interfaces/IMediaImage.cs +++ b/Interfaces/IMediaImage.cs @@ -9,7 +9,8 @@ // // --[ Description ] ---------------------------------------------------------- // -// Defines interface to be implemented by disc image plugins. +// Defines interface to be implemented by block addressable disk image +// plugins. // // --[ License ] -------------------------------------------------------------- // @@ -62,23 +63,6 @@ namespace DiscImageChef.CommonTypes.Interfaces /// /// The image format. string Format { get; } - /// - /// Gets an array partitions. Typically only useful for optical disc - /// images where each track and index means a different partition, as - /// reads can be relative to them. - /// - /// The partitions. - List Partitions { get; } - /// - /// Gets the disc track extents (start, length). - /// - /// The track extents. - List Tracks { get; } - /// - /// Gets the sessions (optical discs only). - /// - /// The sessions. - List Sessions { get; } /// List of dump hardware used to create the image from real media List DumpHardware { get; } /// Gets the CICM XML metadata for the image @@ -120,23 +104,6 @@ namespace DiscImageChef.CommonTypes.Interfaces /// Tag type. byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag); - /// - /// Reads a sector's user data, relative to track. - /// - /// The sector's user data. - /// Sector address (relative LBA). - /// Track. - byte[] ReadSector(ulong sectorAddress, uint track); - - /// - /// Reads a sector's tag, relative to track. - /// - /// The sector's tag. - /// Sector address (relative LBA). - /// Track. - /// Tag type. - byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag); - /// /// Reads user data from several sectors. /// @@ -154,25 +121,6 @@ namespace DiscImageChef.CommonTypes.Interfaces /// Tag type. byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag); - /// - /// Reads user data from several sectors, relative to track. - /// - /// The sectors user data. - /// Starting sector address (relative LBA). - /// How many sectors to read. - /// Track. - byte[] ReadSectors(ulong sectorAddress, uint length, uint track); - - /// - /// Reads tag from several sectors, relative to track. - /// - /// The sectors tag. - /// Starting sector address (relative LBA). - /// How many sectors to read. - /// Track. - /// Tag type. - byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag); - /// /// Reads a complete sector (user data + all tags). /// @@ -180,14 +128,6 @@ namespace DiscImageChef.CommonTypes.Interfaces /// Sector address (LBA). byte[] ReadSectorLong(ulong sectorAddress); - /// - /// Reads a complete sector (user data + all tags), relative to track. - /// - /// The complete sector. Format depends on disk type. - /// Sector address (relative LBA). - /// Track. - byte[] ReadSectorLong(ulong sectorAddress, uint track); - /// /// Reads several complete sector (user data + all tags). /// @@ -196,29 +136,6 @@ namespace DiscImageChef.CommonTypes.Interfaces /// How many sectors to read. byte[] ReadSectorsLong(ulong sectorAddress, uint length); - /// - /// Reads several complete sector (user data + all tags), relative to track. - /// - /// The complete sectors. Format depends on disk type. - /// Starting sector address (relative LBA). - /// How many sectors to read. - /// Track. - byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track); - - /// - /// Gets the disc track extents for a specified session. - /// - /// The track exents for that session. - /// Session. - List GetSessionTracks(Session session); - - /// - /// Gets the disc track extents for a specified session. - /// - /// The track exents for that session. - /// Session. - List GetSessionTracks(ushort session); - /// /// Verifies a sector. /// @@ -226,14 +143,6 @@ namespace DiscImageChef.CommonTypes.Interfaces /// Sector address (LBA). bool? VerifySector(ulong sectorAddress); - /// - /// Verifies a sector, relative to track. - /// - /// True if correct, false if incorrect, null if uncheckable. - /// Sector address (relative LBA). - /// Track. - bool? VerifySector(ulong sectorAddress, uint track); - /// /// Verifies several sectors. /// @@ -244,18 +153,6 @@ namespace DiscImageChef.CommonTypes.Interfaces /// List of uncheckable sectors bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, out List unknownLbas); - /// - /// Verifies several sectors, relative to track. - /// - /// True if all are correct, false if any is incorrect, null if any is uncheckable. - /// Starting sector address (relative LBA). - /// How many sectors to read. - /// Track. - /// List of incorrect sectors - /// List of uncheckable sectors - bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas); - /// /// Verifies media image internal checksum. /// diff --git a/Interfaces/IOpticalMediaImage.cs b/Interfaces/IOpticalMediaImage.cs new file mode 100644 index 000000000..a99beab79 --- /dev/null +++ b/Interfaces/IOpticalMediaImage.cs @@ -0,0 +1,140 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : IOpticalMediaImage.cs +// Author(s) : Natalia Portillo +// +// Component : Disc image plugins. +// +// --[ Description ] ---------------------------------------------------------- +// +// Defines interface to be implemented by optical disc image plugins. +// +// --[ 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; +using DiscImageChef.CommonTypes.Enums; +using DiscImageChef.CommonTypes.Structs; + +namespace DiscImageChef.CommonTypes.Interfaces +{ + /// + /// Abstract class to implement disk image reading plugins. + /// + public interface IOpticalMediaImage : IMediaImage, IPartitionableMediaImage + { + /// + /// Gets the disc track extents (start, length). + /// + /// The track extents. + List Tracks { get; } + /// + /// Gets the sessions (optical discs only). + /// + /// The sessions. + List Sessions { get; } + + /// + /// Reads a sector's user data, relative to track. + /// + /// The sector's user data. + /// Sector address (relative LBA). + /// Track. + byte[] ReadSector(ulong sectorAddress, uint track); + + /// + /// Reads a sector's tag, relative to track. + /// + /// The sector's tag. + /// Sector address (relative LBA). + /// Track. + /// Tag type. + byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag); + + /// + /// Reads user data from several sectors, relative to track. + /// + /// The sectors user data. + /// Starting sector address (relative LBA). + /// How many sectors to read. + /// Track. + byte[] ReadSectors(ulong sectorAddress, uint length, uint track); + + /// + /// Reads tag from several sectors, relative to track. + /// + /// The sectors tag. + /// Starting sector address (relative LBA). + /// How many sectors to read. + /// Track. + /// Tag type. + byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag); + + /// + /// Reads a complete sector (user data + all tags), relative to track. + /// + /// The complete sector. Format depends on disk type. + /// Sector address (relative LBA). + /// Track. + byte[] ReadSectorLong(ulong sectorAddress, uint track); + + /// + /// Reads several complete sector (user data + all tags), relative to track. + /// + /// The complete sectors. Format depends on disk type. + /// Starting sector address (relative LBA). + /// How many sectors to read. + /// Track. + byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track); + + /// + /// Gets the disc track extents for a specified session. + /// + /// The track exents for that session. + /// Session. + List GetSessionTracks(Session session); + + /// + /// Gets the disc track extents for a specified session. + /// + /// The track exents for that session. + /// Session. + List GetSessionTracks(ushort session); + + /// + /// Verifies several sectors, relative to track. + /// + /// True if all are correct, false if any is incorrect, null if any is uncheckable. + /// Starting sector address (relative LBA). + /// How many sectors to read. + /// Track. + /// List of incorrect sectors + /// List of uncheckable sectors + bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas); + } +} \ No newline at end of file diff --git a/Interfaces/IPartitionableMediaImage.cs b/Interfaces/IPartitionableMediaImage.cs new file mode 100644 index 000000000..f342e339d --- /dev/null +++ b/Interfaces/IPartitionableMediaImage.cs @@ -0,0 +1,54 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : IPartitionableMediaImage.cs +// Author(s) : Natalia Portillo +// +// Component : Media image plugins. +// +// --[ Description ] ---------------------------------------------------------- +// +// Defines interface to be implemented by image plugins that can contain +// partitioned medias, usually optical discs and some newer tapes. +// +// --[ 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 IPartitionableMediaImage + { + /// + /// Gets an array partitions. Typically only useful for optical disc + /// images where each track and index means a different partition, as + /// reads can be relative to them. + /// + /// The partitions. + List Partitions { get; } + } +} \ No newline at end of file diff --git a/Interfaces/IWritableImage.cs b/Interfaces/IWritableImage.cs index 14477b2e9..d7777de1a 100644 --- a/Interfaces/IWritableImage.cs +++ b/Interfaces/IWritableImage.cs @@ -131,13 +131,6 @@ namespace DiscImageChef.CommonTypes.Interfaces /// true if operating completed successfully, false otherwise bool WriteSectorsLong(byte[] data, ulong sectorAddress, uint length); - /// - /// Sets tracks for optical media - /// - /// List of tracks - /// true if operating completed successfully, false otherwise - bool SetTracks(List tracks); - /// /// Closes and flushes to disk the image /// diff --git a/Interfaces/IWritableOpticalImage.cs b/Interfaces/IWritableOpticalImage.cs new file mode 100644 index 000000000..072815c7f --- /dev/null +++ b/Interfaces/IWritableOpticalImage.cs @@ -0,0 +1,53 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : IWritableOpticalImage.cs +// Author(s) : Natalia Portillo +// +// Component : Disc image plugins. +// +// --[ Description ] ---------------------------------------------------------- +// +// Defines interface to be implemented by writable image plugins. +// +// --[ 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; +using DiscImageChef.CommonTypes.Structs; + +namespace DiscImageChef.CommonTypes.Interfaces +{ + public interface IWritableOpticalImage : IWritableImage, IOpticalMediaImage + { + /// + /// Sets tracks for optical media + /// + /// List of tracks + /// true if operating completed successfully, false otherwise + bool SetTracks(List tracks); + } +} \ No newline at end of file