diff --git a/.gitmodules b/.gitmodules
index 1cf09b6d6..267806b63 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,6 @@
[submodule "cuetoolsnet"]
path = cuetoolsnet
url = https://github.com/claunia/cuetoolsnet.git
+[submodule "DiscImageChef.CommonTypes"]
+ path = DiscImageChef.CommonTypes
+ url = git@github.com:discimagechef/DiscImageChef.CommonTypes.git
diff --git a/.idea/.idea.DiscImageChef/.idea/contentModel.xml b/.idea/.idea.DiscImageChef/.idea/contentModel.xml
index ffbdd549d..23880ffaa 100644
--- a/.idea/.idea.DiscImageChef/.idea/contentModel.xml
+++ b/.idea/.idea.DiscImageChef/.idea/contentModel.xml
@@ -97,6 +97,7 @@
+
@@ -165,19 +166,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1926,7 +1915,6 @@
-
diff --git a/DiscImageChef.CommonTypes b/DiscImageChef.CommonTypes
new file mode 160000
index 000000000..d8c8c7810
--- /dev/null
+++ b/DiscImageChef.CommonTypes
@@ -0,0 +1 @@
+Subproject commit d8c8c781015c55bcbf5fbc7a9d5fff6c27808829
diff --git a/DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj b/DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj
deleted file mode 100644
index 2e2a241a3..000000000
--- a/DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 2.0
- {F2B84194-26EB-4227-B1C5-6602517E85AE}
- Library
- DiscImageChef.CommonTypes
- DiscImageChef.CommonTypes
- $(Version)
- false
- true
- 4.5.99.1693
- Claunia.com
- Copyright © 2011-2019 Natalia Portillo
- The Disc Image Chef
- DiscImageChef.CommonTypes
- $(Version)
- net461;netstandard2.0;netcoreapp2.0
-
-
- $(Version)-{chash:8} built by {mname} in $(Configuration){!:, modified}
- true
- true
-
-
- true
- full
- false
- bin\Debug
- DEBUG;
- prompt
- 4
- false
-
-
- full
- true
- bin\Release
- prompt
- 4
- false
-
-
-
-
-
-
- Metadata/cicm.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- LICENSE.MIT
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /Library/Frameworks/Mono.framework/Versions/Current/lib/mono
- /usr/lib/mono
- /usr/local/lib/mono
-
- $(BaseFrameworkPathOverrideForMono)/4.0-api
- $(BaseFrameworkPathOverrideForMono)/4.5-api
- $(BaseFrameworkPathOverrideForMono)/4.5.1-api
- $(BaseFrameworkPathOverrideForMono)/4.5.2-api
- $(BaseFrameworkPathOverrideForMono)/4.6-api
- $(BaseFrameworkPathOverrideForMono)/4.6.1-api
- $(BaseFrameworkPathOverrideForMono)/4.6.2-api
- $(BaseFrameworkPathOverrideForMono)/4.7-api
- $(BaseFrameworkPathOverrideForMono)/4.7.1-api
- true
-
- $(FrameworkPathOverride)/Facades;$(AssemblySearchPaths)
-
-
diff --git a/DiscImageChef.CommonTypes/Enums/DeviceType.cs b/DiscImageChef.CommonTypes/Enums/DeviceType.cs
deleted file mode 100644
index 368d32f4b..000000000
--- a/DiscImageChef.CommonTypes/Enums/DeviceType.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : DeviceType.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Disc image plugins.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Defines enumerations of devce types.
-//
-// --[ 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.Enums
-{
- public enum DeviceType
- {
- Unknown = -1,
- ATA = 1,
- ATAPI = 2,
- SCSI = 3,
- SecureDigital = 4,
- MMC = 5,
- NVMe = 6
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Enums/ErrorNumber.cs b/DiscImageChef.CommonTypes/Enums/ErrorNumber.cs
deleted file mode 100644
index 29d8d0016..000000000
--- a/DiscImageChef.CommonTypes/Enums/ErrorNumber.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : ErrorNumber.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Common types.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Defines enumerations of error numbers.
-//
-// --[ 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.Enums
-{
- ///
- /// Enumerates error codes. Positive for warnings or informative codes, negative for errors.
- ///
- public enum ErrorNumber
- {
- /// No error
- NoError = 0,
- /// User requested help to be shown
- HelpRequested = 1,
- /// Command found nothing
- NothingFound = 2,
- /// Media has been already dumped completely
- AlreadyDumped = 3,
- /// Image and its sectors cannot be verified
- NotVerificable = 4,
- /// There are bad sectors and image cannot be verified
- BadSectorsImageNotVerified = 5,
- /// All sectors are good and image cannot be verified
- CorrectSectorsImageNotVerified = 6,
- /// Image is bad and sectors cannot be verified
- BadImageSectorsNotVerified = 7,
- /// Image is bad and there are bad sectors
- BadImageBadSectors = 8,
- /// All sectors are good and image is bad
- CorrectSectorsBadImage = 9,
- /// Image is good and sectors cannot be verified
- CorrectImageSectorsNotVerified = 10,
- /// Image is good and there are bad sectors
- CorrectImageBadSectors = 11,
- /// Exception has been raised
- UnexpectedException = -1,
- /// The number of arguments is not as expected
- UnexpectedArgumentCount = -2,
- /// A required argument is not present
- MissingArgument = -3,
- /// A specified argument contains an invalid value
- InvalidArgument = -4,
- /// The specified file cannot be found
- FileNotFound = -5,
- /// The specified file cannot be opened
- CannotOpenFile = -6,
- /// The specified encoding cannot be found
- EncodingUnknown = -7,
- /// The image format has not been recognized
- UnrecognizedFormat = -8,
- /// The image format failed to open
- CannotOpenFormat = -9,
- /// The specified metadata sidecar does not have the correct format
- InvalidSidecar = -10,
- /// The specified resume map does not have the correct format
- InvalidResume = -11,
- /// The specified destination file/folder already exists
- DestinationExists = -12,
- /// The specified image format cannot be found
- FormatNotFound = -13,
- /// More than one format found for the specified search criteria
- TooManyFormats = -14,
- /// The specified format does not support the specified media
- UnsupportedMedia = -15,
- /// Data will be lost writing the specified format
- DataWillBeLost = -16,
- /// Cannot create destination format
- CannotCreateFormat = -17,
- /// Error writing data
- WriteError = -18,
- /// Argument expected a directory, but found a file
- ExpectedDirectory = -19,
- /// Argument expected a file, but found a directory
- ExpectedFile = -20,
- /// Cannot open device
- CannotOpenDevice = -21,
- /// The specified operation requires administrative privileges
- NotEnoughPermissions = -22
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Enums/Images.cs b/DiscImageChef.CommonTypes/Enums/Images.cs
deleted file mode 100644
index 478e42353..000000000
--- a/DiscImageChef.CommonTypes/Enums/Images.cs
+++ /dev/null
@@ -1,364 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : Images.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Disc image plugins.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Defines enumerations to be used by 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;
-
-namespace DiscImageChef.CommonTypes.Enums
-{
- ///
- /// Track (as partitioning element) types.
- ///
- public enum TrackType : byte
- {
- /// Audio track
- Audio = 0,
- /// Data track (not any of the below defined ones)
- Data = 1,
- /// Data track, compact disc mode 1
- CdMode1 = 2,
- /// Data track, compact disc mode 2, formless
- CdMode2Formless = 3,
- /// Data track, compact disc mode 2, form 1
- CdMode2Form1 = 4,
- /// Data track, compact disc mode 2, form 2
- CdMode2Form2 = 5
- }
-
- ///
- /// Type of subchannel in track
- ///
- public enum TrackSubchannelType : byte
- {
- ///
- /// Track does not has subchannel dumped, or it's not a CD
- ///
- None = 0,
- ///
- /// Subchannel is packed and error corrected
- ///
- Packed = 1,
- ///
- /// Subchannel is interleaved
- ///
- Raw = 2,
- ///
- /// Subchannel is packed and comes interleaved with main channel in same file
- ///
- PackedInterleaved = 3,
- ///
- /// Subchannel is interleaved and comes interleaved with main channel in same file
- ///
- RawInterleaved = 4,
- ///
- /// Only Q subchannel is stored as 16 bytes
- ///
- Q16 = 5,
- ///
- /// Only Q subchannel is stored as 16 bytes and comes interleaved with main channel in same file
- ///
- Q16Interleaved = 6
- }
-
- ///
- /// Metadata present for each sector (aka, "tag").
- ///
- public enum SectorTagType
- {
- /// Apple's GCR sector tags, 12 bytes
- AppleSectorTag = 0,
- /// Sync frame from CD sector, 12 bytes
- CdSectorSync = 1,
- /// CD sector header, 4 bytes
- CdSectorHeader = 2,
- /// CD mode 2 sector subheader
- CdSectorSubHeader = 3,
- /// CD sector EDC, 4 bytes
- CdSectorEdc = 4,
- /// CD sector ECC P, 172 bytes
- CdSectorEccP = 5,
- /// CD sector ECC Q, 104 bytes
- CdSectorEccQ = 6,
- /// CD sector ECC (P and Q), 276 bytes
- CdSectorEcc = 7,
- /// CD sector subchannel, 96 bytes
- CdSectorSubchannel = 8,
- /// CD track ISRC, string, 12 bytes
- CdTrackIsrc = 9,
- /// CD track text, string, 13 bytes
- CdTrackText = 10,
- /// CD track flags, 1 byte
- CdTrackFlags = 11,
- /// DVD sector copyright information
- DvdCmi = 12,
- /// Floppy address mark (contents depend on underlying floppy format)
- FloppyAddressMark = 13
- }
-
- ///
- /// Metadata present for each media.
- ///
- public enum MediaTagType
- {
- /// CD table of contents
- CD_TOC = 0,
- /// CD session information
- CD_SessionInfo = 1,
- /// CD full table of contents
- CD_FullTOC = 2,
- /// CD PMA
- CD_PMA = 3,
- /// CD Adress-Time-In-Pregroove
- CD_ATIP = 4,
- /// CD-Text
- CD_TEXT = 5,
- /// CD Media Catalogue Number
- CD_MCN = 6,
- /// DVD/HD DVD Physical Format Information
- DVD_PFI = 7,
- /// DVD Lead-in Copyright Management Information
- DVD_CMI = 8,
- /// DVD disc key
- DVD_DiscKey = 9,
- /// DVD/HD DVD Burst Cutting Area
- DVD_BCA = 10,
- /// DVD/HD DVD Lead-in Disc Manufacturer Information
- DVD_DMI = 11,
- /// Media identifier
- DVD_MediaIdentifier = 12,
- /// Media key block
- DVD_MKB = 13,
- /// DVD-RAM/HD DVD-RAM DDS information
- DVDRAM_DDS = 14,
- /// DVD-RAM/HD DVD-RAM Medium status
- DVDRAM_MediumStatus = 15,
- /// DVD-RAM/HD DVD-RAM Spare area information
- DVDRAM_SpareArea = 16,
- /// DVD-R/-RW/HD DVD-R RMD in last border-out
- DVDR_RMD = 17,
- /// Pre-recorded information from DVD-R/-RW lead-in
- DVDR_PreRecordedInfo = 18,
- /// DVD-R/-RW/HD DVD-R media identifier
- DVDR_MediaIdentifier = 19,
- /// DVD-R/-RW/HD DVD-R physical format information
- DVDR_PFI = 20,
- /// ADIP information
- DVD_ADIP = 21,
- /// HD DVD Lead-in copyright protection information
- HDDVD_CPI = 22,
- /// HD DVD-R Medium Status
- HDDVD_MediumStatus = 23,
- /// DVD+/-R DL Layer capacity
- DVDDL_LayerCapacity = 24,
- /// DVD-R DL Middle Zone start address
- DVDDL_MiddleZoneAddress = 25,
- /// DVD-R DL Jump Interval Size
- DVDDL_JumpIntervalSize = 26,
- /// DVD-R DL Start LBA of the manual layer jump
- DVDDL_ManualLayerJumpLBA = 27,
- /// Blu-ray Disc Information
- BD_DI = 28,
- /// Blu-ray Burst Cutting Area
- BD_BCA = 29,
- /// Blu-ray Disc Definition Structure
- BD_DDS = 30,
- /// Blu-ray Cartridge Status
- BD_CartridgeStatus = 31,
- /// Blu-ray Status of Spare Area
- BD_SpareArea = 32,
- /// AACS volume identifier
- AACS_VolumeIdentifier = 33,
- /// AACS pre-recorded media serial number
- AACS_SerialNumber = 34,
- /// AACS media identifier
- AACS_MediaIdentifier = 35,
- /// Lead-in AACS media key block
- AACS_MKB = 36,
- /// AACS data keys
- AACS_DataKeys = 37,
- /// LBA extents flagged for bus encryption by AACS
- AACS_LBAExtents = 38,
- /// CPRM media key block in Lead-in
- AACS_CPRM_MKB = 39,
- /// Recognized layer formats in hybrid discs
- Hybrid_RecognizedLayers = 40,
- /// Disc write protection status
- MMC_WriteProtection = 41,
- /// Disc standard information
- MMC_DiscInformation = 42,
- /// Disc track resources information
- MMC_TrackResourcesInformation = 43,
- /// BD-R Pseudo-overwrite information
- MMC_POWResourcesInformation = 44,
- /// SCSI INQUIRY response
- SCSI_INQUIRY = 45,
- /// SCSI MODE PAGE 2Ah
- SCSI_MODEPAGE_2A = 46,
- /// ATA IDENTIFY DEVICE response
- ATA_IDENTIFY = 47,
- /// ATA IDENTIFY PACKET DEVICE response
- ATAPI_IDENTIFY = 48,
- /// PCMCIA/CardBus Card Information Structure
- PCMCIA_CIS = 49,
- /// SecureDigital CID
- SD_CID = 50,
- /// SecureDigital CSD
- SD_CSD = 51,
- /// SecureDigital SCR
- SD_SCR = 52,
- /// SecureDigital OCR
- SD_OCR = 53,
- /// MultiMediaCard CID
- MMC_CID = 54,
- /// MultiMediaCard CSD
- MMC_CSD = 55,
- /// MultiMediaCard OCR
- MMC_OCR = 56,
- /// MultiMediaCard Extended CSD
- MMC_ExtendedCSD = 57,
- /// Xbox Security Sector
- Xbox_SecuritySector = 58,
- ///
- /// On floppy disks, data in last cylinder usually in a different format that contains duplication or
- /// manufacturing information
- ///
- Floppy_LeadOut = 59,
- /// DVD Disc Control Blocks
- DCB = 60,
- /// Compact Disc First Track Pregap
- CD_FirstTrackPregap = 61,
- /// Compact Disc Lead-out
- CD_LeadOut = 62,
- /// SCSI MODE SENSE (6)
- SCSI_MODESENSE_6 = 63,
- /// SCSI MODE SENSE (10)
- SCSI_MODESENSE_10 = 64,
- /// USB descriptors
- USB_Descriptors = 65,
- /// XGD unlocked DMI
- Xbox_DMI = 66,
- /// XDG unlocked PFI
- Xbox_PFI = 67,
- /// Compact Disc Lead-in
- CD_LeadIn = 68
- }
-
- ///
- /// Enumeration of media types defined in CICM metadata
- ///
- public enum XmlMediaType : byte
- {
- ///
- /// Purely optical discs
- ///
- OpticalDisc = 0,
- ///
- /// Media that is physically block-based or abstracted like that
- ///
- BlockMedia = 1,
- ///
- /// Media that can be accessed by-byte or by-bit, like chips
- ///
- LinearMedia = 2,
- ///
- /// Media that can only store data when it is modulated to audio
- ///
- AudioMedia = 3
- }
-
- /// CD flags bitmask
- [Flags]
- public enum CdFlags : byte
- {
- /// Track is quadraphonic.
- FourChannel = 0x08,
- /// Track is non-audio (data).
- DataTrack = 0x04,
- /// Track is copy protected.
- CopyPermitted = 0x02,
- /// Track has pre-emphasis.
- PreEmphasis = 0x01
- }
-
- /// Status of a requested floppy sector
- [Flags]
- public enum FloppySectorStatus : byte
- {
- /// Both address mark and data checksums are correct.
- Correct = 0x01,
- /// Data checksum is incorrect.
- DataError = 0x02,
- /// Addres mark checksum is incorrect.
- AddressMarkError = 0x04,
- /// There is another sector in the same track/head with same sector id.
- Duplicated = 0x08,
- /// Sector data section is not magnetized.
- Demagnetized = 0x10,
- /// Sector data section has a physically visible hole.
- Hole = 0x20,
- /// There is no address mark containing the requested sector id in the track/head.
- NotFound = 0x40
- }
-
- public enum FloppyTypes : byte
- {
- /// 8" floppy
- Floppy,
- /// 5.25" floppy
- MiniFloppy,
- /// 3.5" floppy
- MicroFloppy,
- /// 3" floppy
- CompactFloppy,
- /// 5.25" twiggy
- FileWare,
- /// 2.5" quickdisk
- QuickDisk
- }
-
- public enum FloppyDensities : byte
- {
- /// Standard coercitivity (about 300Oe as found in 8" and 5.25"-double-density disks).
- Standard,
- /// Double density coercitivity (about 600Oe as found in 5.25" HD and 3.5" DD disks).
- Double,
- /// High density coercitivity (about 700Oe as found in 3.5" HD disks).
- High,
- /// Extended density coercitivity (about 750Oe as found in 3.5" ED disks).
- Extended
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Exceptions/Images.cs b/DiscImageChef.CommonTypes/Exceptions/Images.cs
deleted file mode 100644
index f684a17c5..000000000
--- a/DiscImageChef.CommonTypes/Exceptions/Images.cs
+++ /dev/null
@@ -1,194 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : Images.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Disc image plugins.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Defines exceptions to be thrown by 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;
-using System.Runtime.Serialization;
-
-namespace DiscImageChef.CommonTypes.Exceptions
-{
- ///
- /// Feature is supported by image but not implemented yet.
- ///
- [Serializable]
- public class FeatureSupportedButNotImplementedImageException : Exception
- {
- ///
- /// Feature is supported by image but not implemented yet.
- ///
- /// Message.
- /// Inner.
- public FeatureSupportedButNotImplementedImageException(string message, Exception inner) :
- base(message, inner) { }
-
- ///
- /// Feature is supported by image but not implemented yet.
- ///
- /// Message.
- public FeatureSupportedButNotImplementedImageException(string message) : base(message) { }
-
- ///
- /// Feature is supported by image but not implemented yet.
- ///
- /// Info.
- /// Context.
- protected FeatureSupportedButNotImplementedImageException(SerializationInfo info, StreamingContext context)
- {
- if(info == null) throw new ArgumentNullException(nameof(info));
- }
- }
-
- ///
- /// Feature is not supported by image.
- ///
- [Serializable]
- public class FeatureUnsupportedImageException : Exception
- {
- ///
- /// Feature is not supported by image.
- ///
- /// Message.
- /// Inner.
- public FeatureUnsupportedImageException(string message, Exception inner) : base(message, inner) { }
-
- ///
- /// Feature is not supported by image.
- ///
- /// Message.
- public FeatureUnsupportedImageException(string message) : base(message) { }
-
- ///
- /// Feature is not supported by image.
- ///
- /// Info.
- /// Context.
- protected FeatureUnsupportedImageException(SerializationInfo info, StreamingContext context)
- {
- if(info == null) throw new ArgumentNullException(nameof(info));
- }
- }
-
- ///
- /// Feature is supported by image but not present on it.
- ///
- [Serializable]
- public class FeatureNotPresentImageException : Exception
- {
- ///
- /// Feature is supported by image but not present on it.
- ///
- /// Message.
- /// Inner.
- public FeatureNotPresentImageException(string message, Exception inner) : base(message, inner) { }
-
- ///
- /// Feature is supported by image but not present on it.
- ///
- /// Message.
- public FeatureNotPresentImageException(string message) : base(message) { }
-
- ///
- /// Feature is supported by image but not present on it.
- ///
- /// Info.
- /// Context.
- protected FeatureNotPresentImageException(SerializationInfo info, StreamingContext context)
- {
- if(info == null) throw new ArgumentNullException(nameof(info));
- }
- }
-
- ///
- /// Feature is supported by image but not by the disc it represents.
- ///
- [Serializable]
- public class FeaturedNotSupportedByDiscImageException : Exception
- {
- ///
- /// Feature is supported by image but not by the disc it represents.
- ///
- /// Message.
- /// Inner.
- public FeaturedNotSupportedByDiscImageException(string message, Exception inner) : base(message, inner) { }
-
- ///
- /// Feature is supported by image but not by the disc it represents.
- ///
- /// Message.
- public FeaturedNotSupportedByDiscImageException(string message) : base(message) { }
-
- ///
- /// Feature is supported by image but not by the disc it represents.
- ///
- /// Info.
- /// Context.
- protected FeaturedNotSupportedByDiscImageException(SerializationInfo info, StreamingContext context)
- {
- if(info == null) throw new ArgumentNullException(nameof(info));
- }
- }
-
- ///
- /// Corrupt, incorrect or unhandled feature found on image
- ///
- [Serializable]
- public class ImageNotSupportedException : Exception
- {
- ///
- /// Corrupt, incorrect or unhandled feature found on image
- ///
- /// Message.
- /// Inner.
- public ImageNotSupportedException(string message, Exception inner) : base(message, inner) { }
-
- ///
- /// Corrupt, incorrect or unhandled feature found on image
- ///
- /// Message.
- public ImageNotSupportedException(string message) : base(message) { }
-
- ///
- /// Corrupt, incorrect or unhandled feature found on image
- ///
- /// Info.
- /// Context.
- protected ImageNotSupportedException(SerializationInfo info, StreamingContext context)
- {
- if(info == null) throw new ArgumentNullException(nameof(info));
- }
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Extents/ExtentsByte.cs b/DiscImageChef.CommonTypes/Extents/ExtentsByte.cs
deleted file mode 100644
index 6227129d9..000000000
--- a/DiscImageChef.CommonTypes/Extents/ExtentsByte.cs
+++ /dev/null
@@ -1,251 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : ExtentsByte.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Extent helpers.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Provides extents for byte types.
-//
-// --[ 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;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace DiscImageChef.CommonTypes.Extents
-{
- ///
- /// Implements extents for
- ///
- public class ExtentsByte
- {
- List> backend;
-
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsByte()
- {
- backend = new List>();
- }
-
- ///
- /// Initializes extents with an specific list
- ///
- /// List of extents as tuples "start, end"
- public ExtentsByte(IEnumerable> list)
- {
- backend = list.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Gets a count of how many extents are stored
- ///
- public int Count => backend.Count;
-
- ///
- /// Adds the specified number to the corresponding extent, or creates a new one
- ///
- ///
- public void Add(byte item)
- {
- Tuple removeOne = null;
- Tuple removeTwo = null;
- Tuple itemToAdd = null;
-
- for(int i = 0; i < backend.Count; i++)
- {
- // Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
-
- // Expands existing extent start
- if(item == backend[i].Item1 - 1)
- {
- removeOne = backend[i];
-
- if(i > 0 && item == backend[i - 1].Item2 + 1)
- {
- removeTwo = backend[i - 1];
- itemToAdd = new Tuple(backend[i - 1].Item1, backend[i].Item2);
- }
- else itemToAdd = new Tuple(item, backend[i].Item2);
-
- break;
- }
-
- // Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
-
- removeOne = backend[i];
-
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
- {
- removeTwo = backend[i + 1];
- itemToAdd = new Tuple(backend[i].Item1, backend[i + 1].Item2);
- }
- else itemToAdd = new Tuple(backend[i].Item1, item);
-
- break;
- }
-
- if(itemToAdd != null)
- {
- backend.Remove(removeOne);
- backend.Remove(removeTwo);
- backend.Add(itemToAdd);
- }
- else backend.Add(new Tuple(item, item));
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Adds a new extent
- ///
- /// First element of the extent
- ///
- /// Last element of the extent or if is true how many elements the extent runs
- /// for
- ///
- /// If set to true, indicates how many elements the extent runs for
- public void Add(byte start, byte end, bool run = false)
- {
- byte realEnd;
- if(run) realEnd = (byte)(start + end - 1);
- else realEnd = end;
-
- // TODO: Optimize this
- for(byte t = start; t <= realEnd; t++) Add(t);
- }
-
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
- /// Item to seach for
- /// true if any of the extents on this instance contains the item
- public bool Contains(byte item)
- {
- return backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- }
-
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
-
- ///
- /// Removes an item from the extents in this instance
- ///
- /// Item to remove
- /// true if the item was contained in a known extent and removed, false otherwise
- public bool Remove(byte item)
- {
- Tuple toRemove = null;
- Tuple toAddOne = null;
- Tuple toAddTwo = null;
-
- foreach(Tuple extent in backend)
- {
- // Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, (byte)(item - 1));
- toAddTwo = new Tuple((byte)(item + 1), extent.Item2);
- break;
- }
-
- // Extent is left border, but not only element
- if(item == extent.Item1 && item != extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple((byte)(item + 1), extent.Item2);
- break;
- }
-
- // Extent is right border, but not only element
- if(item != extent.Item1 && item == extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, (byte)(item - 1));
- break;
- }
-
- // Extent is only element
- if(item != extent.Item1 || item != extent.Item2) continue;
-
- toRemove = extent;
- break;
- }
-
- // Item not found
- if(toRemove == null) return false;
-
- backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
-
- return true;
- }
-
- ///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
- ///
- /// Array of
- public Tuple[] ToArray() => backend.ToArray();
-
- ///
- /// Gets the first element of the extent that contains the specified item
- ///
- /// Item
- /// First element of extent
- /// true if item was found in an extent, false otherwise
- public bool GetStart(byte item, out byte start)
- {
- start = 0;
- foreach(Tuple extent in backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
- {
- start = extent.Item1;
- return true;
- }
-
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Extents/ExtentsConverter.cs b/DiscImageChef.CommonTypes/Extents/ExtentsConverter.cs
deleted file mode 100644
index 995942d8f..000000000
--- a/DiscImageChef.CommonTypes/Extents/ExtentsConverter.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : ExtentsConverter.cs
-// Author(s) : Natalia Portillo
-//
-// Component : XML metadata.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Converts extents to/from XML.
-//
-// --[ 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;
-using System.Collections.Generic;
-using System.Linq;
-using Schemas;
-
-namespace DiscImageChef.CommonTypes.Extents
-{
- public static class ExtentsConverter
- {
- public static ExtentType[] ToMetadata(ExtentsULong extents)
- {
- if(extents == null) return null;
-
- Tuple[] tuples = extents.ToArray();
- ExtentType[] array = new ExtentType[tuples.Length];
-
- for(ulong i = 0; i < (ulong)array.LongLength; i++)
- array[i] = new ExtentType {Start = tuples[i].Item1, End = tuples[i].Item2};
-
- return array;
- }
-
- public static ExtentsULong FromMetadata(ExtentType[] extents)
- {
- if(extents == null) return null;
-
- List> tuples =
- extents.Select(extent => new Tuple(extent.Start, extent.End)).ToList();
-
- return new ExtentsULong(tuples);
- }
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Extents/ExtentsInt.cs b/DiscImageChef.CommonTypes/Extents/ExtentsInt.cs
deleted file mode 100644
index 5c1fd40d7..000000000
--- a/DiscImageChef.CommonTypes/Extents/ExtentsInt.cs
+++ /dev/null
@@ -1,251 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : ExtentsInt.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Extent helpers.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Provides extents for int types.
-//
-// --[ 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;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace DiscImageChef.CommonTypes.Extents
-{
- ///
- /// Implements extents for
- ///
- public class ExtentsInt
- {
- List> backend;
-
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsInt()
- {
- backend = new List>();
- }
-
- ///
- /// Initializes extents with an specific list
- ///
- /// List of extents as tuples "start, end"
- public ExtentsInt(IEnumerable> list)
- {
- backend = list.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Gets a count of how many extents are stored
- ///
- public int Count => backend.Count;
-
- ///
- /// Adds the specified number to the corresponding extent, or creates a new one
- ///
- ///
- public void Add(int item)
- {
- Tuple removeOne = null;
- Tuple removeTwo = null;
- Tuple itemToAdd = null;
-
- for(int i = 0; i < backend.Count; i++)
- {
- // Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
-
- // Expands existing extent start
- if(item == backend[i].Item1 - 1)
- {
- removeOne = backend[i];
-
- if(i > 0 && item == backend[i - 1].Item2 + 1)
- {
- removeTwo = backend[i - 1];
- itemToAdd = new Tuple(backend[i - 1].Item1, backend[i].Item2);
- }
- else itemToAdd = new Tuple(item, backend[i].Item2);
-
- break;
- }
-
- // Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
-
- removeOne = backend[i];
-
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
- {
- removeTwo = backend[i + 1];
- itemToAdd = new Tuple(backend[i].Item1, backend[i + 1].Item2);
- }
- else itemToAdd = new Tuple(backend[i].Item1, item);
-
- break;
- }
-
- if(itemToAdd != null)
- {
- backend.Remove(removeOne);
- backend.Remove(removeTwo);
- backend.Add(itemToAdd);
- }
- else backend.Add(new Tuple(item, item));
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Adds a new extent
- ///
- /// First element of the extent
- ///
- /// Last element of the extent or if is true how many elements the extent runs
- /// for
- ///
- /// If set to true, indicates how many elements the extent runs for
- public void Add(int start, int end, bool run = false)
- {
- int realEnd;
- if(run) realEnd = start + end - 1;
- else realEnd = end;
-
- // TODO: Optimize this
- for(int t = start; t <= realEnd; t++) Add(t);
- }
-
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
- /// Item to seach for
- /// true if any of the extents on this instance contains the item
- public bool Contains(int item)
- {
- return backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- }
-
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
-
- ///
- /// Removes an item from the extents in this instance
- ///
- /// Item to remove
- /// true if the item was contained in a known extent and removed, false otherwise
- public bool Remove(int item)
- {
- Tuple toRemove = null;
- Tuple toAddOne = null;
- Tuple toAddTwo = null;
-
- foreach(Tuple extent in backend)
- {
- // Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, item - 1);
- toAddTwo = new Tuple(item + 1, extent.Item2);
- break;
- }
-
- // Extent is left border, but not only element
- if(item == extent.Item1 && item != extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(item + 1, extent.Item2);
- break;
- }
-
- // Extent is right border, but not only element
- if(item != extent.Item1 && item == extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, item - 1);
- break;
- }
-
- // Extent is only element
- if(item != extent.Item1 || item != extent.Item2) continue;
-
- toRemove = extent;
- break;
- }
-
- // Item not found
- if(toRemove == null) return false;
-
- backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
-
- return true;
- }
-
- ///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
- ///
- /// Array of
- public Tuple[] ToArray() => backend.ToArray();
-
- ///
- /// Gets the first element of the extent that contains the specified item
- ///
- /// Item
- /// First element of extent
- /// true if item was found in an extent, false otherwise
- public bool GetStart(int item, out int start)
- {
- start = 0;
- foreach(Tuple extent in backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
- {
- start = extent.Item1;
- return true;
- }
-
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Extents/ExtentsLong.cs b/DiscImageChef.CommonTypes/Extents/ExtentsLong.cs
deleted file mode 100644
index cda536f78..000000000
--- a/DiscImageChef.CommonTypes/Extents/ExtentsLong.cs
+++ /dev/null
@@ -1,251 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : ExtentsLong.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Extent helpers.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Provides extents for long types.
-//
-// --[ 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;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace DiscImageChef.CommonTypes.Extents
-{
- ///
- /// Implements extents for
- ///
- public class ExtentsLong
- {
- List> backend;
-
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsLong()
- {
- backend = new List>();
- }
-
- ///
- /// Initializes extents with an specific list
- ///
- /// List of extents as tuples "start, end"
- public ExtentsLong(IEnumerable> list)
- {
- backend = list.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Gets a count of how many extents are stored
- ///
- public int Count => backend.Count;
-
- ///
- /// Adds the specified number to the corresponding extent, or creates a new one
- ///
- ///
- public void Add(long item)
- {
- Tuple removeOne = null;
- Tuple removeTwo = null;
- Tuple itemToAdd = null;
-
- for(int i = 0; i < backend.Count; i++)
- {
- // Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
-
- // Expands existing extent start
- if(item == backend[i].Item1 - 1)
- {
- removeOne = backend[i];
-
- if(i > 0 && item == backend[i - 1].Item2 + 1)
- {
- removeTwo = backend[i - 1];
- itemToAdd = new Tuple(backend[i - 1].Item1, backend[i].Item2);
- }
- else itemToAdd = new Tuple(item, backend[i].Item2);
-
- break;
- }
-
- // Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
-
- removeOne = backend[i];
-
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
- {
- removeTwo = backend[i + 1];
- itemToAdd = new Tuple(backend[i].Item1, backend[i + 1].Item2);
- }
- else itemToAdd = new Tuple(backend[i].Item1, item);
-
- break;
- }
-
- if(itemToAdd != null)
- {
- backend.Remove(removeOne);
- backend.Remove(removeTwo);
- backend.Add(itemToAdd);
- }
- else backend.Add(new Tuple(item, item));
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Adds a new extent
- ///
- /// First element of the extent
- ///
- /// Last element of the extent or if is true how many elements the extent runs
- /// for
- ///
- /// If set to true, indicates how many elements the extent runs for
- public void Add(long start, long end, bool run = false)
- {
- long realEnd;
- if(run) realEnd = start + end - 1;
- else realEnd = end;
-
- // TODO: Optimize this
- for(long t = start; t <= realEnd; t++) Add(t);
- }
-
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
- /// Item to seach for
- /// true if any of the extents on this instance contains the item
- public bool Contains(long item)
- {
- return backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- }
-
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
-
- ///
- /// Removes an item from the extents in this instance
- ///
- /// Item to remove
- /// true if the item was contained in a known extent and removed, false otherwise
- public bool Remove(long item)
- {
- Tuple toRemove = null;
- Tuple toAddOne = null;
- Tuple toAddTwo = null;
-
- foreach(Tuple extent in backend)
- {
- // Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, item - 1);
- toAddTwo = new Tuple(item + 1, extent.Item2);
- break;
- }
-
- // Extent is left border, but not only element
- if(item == extent.Item1 && item != extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(item + 1, extent.Item2);
- break;
- }
-
- // Extent is right border, but not only element
- if(item != extent.Item1 && item == extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, item - 1);
- break;
- }
-
- // Extent is only element
- if(item != extent.Item1 || item != extent.Item2) continue;
-
- toRemove = extent;
- break;
- }
-
- // Item not found
- if(toRemove == null) return false;
-
- backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
-
- return true;
- }
-
- ///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
- ///
- /// Array of
- public Tuple[] ToArray() => backend.ToArray();
-
- ///
- /// Gets the first element of the extent that contains the specified item
- ///
- /// Item
- /// First element of extent
- /// true if item was found in an extent, false otherwise
- public bool GetStart(long item, out long start)
- {
- start = 0;
- foreach(Tuple extent in backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
- {
- start = extent.Item1;
- return true;
- }
-
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Extents/ExtentsSByte.cs b/DiscImageChef.CommonTypes/Extents/ExtentsSByte.cs
deleted file mode 100644
index 31a23e0e7..000000000
--- a/DiscImageChef.CommonTypes/Extents/ExtentsSByte.cs
+++ /dev/null
@@ -1,251 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : ExtentsSByte.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Extent helpers.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Provides extents for sbyte types.
-//
-// --[ 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;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace DiscImageChef.CommonTypes.Extents
-{
- ///
- /// Implements extents for
- ///
- public class ExtentsSByte
- {
- List> backend;
-
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsSByte()
- {
- backend = new List>();
- }
-
- ///
- /// Initializes extents with an specific list
- ///
- /// List of extents as tuples "start, end"
- public ExtentsSByte(IEnumerable> list)
- {
- backend = list.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Gets a count of how many extents are stored
- ///
- public int Count => backend.Count;
-
- ///
- /// Adds the specified number to the corresponding extent, or creates a new one
- ///
- ///
- public void Add(sbyte item)
- {
- Tuple removeOne = null;
- Tuple removeTwo = null;
- Tuple itemToAdd = null;
-
- for(int i = 0; i < backend.Count; i++)
- {
- // Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
-
- // Expands existing extent start
- if(item == backend[i].Item1 - 1)
- {
- removeOne = backend[i];
-
- if(i > 0 && item == backend[i - 1].Item2 + 1)
- {
- removeTwo = backend[i - 1];
- itemToAdd = new Tuple(backend[i - 1].Item1, backend[i].Item2);
- }
- else itemToAdd = new Tuple(item, backend[i].Item2);
-
- break;
- }
-
- // Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
-
- removeOne = backend[i];
-
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
- {
- removeTwo = backend[i + 1];
- itemToAdd = new Tuple(backend[i].Item1, backend[i + 1].Item2);
- }
- else itemToAdd = new Tuple(backend[i].Item1, item);
-
- break;
- }
-
- if(itemToAdd != null)
- {
- backend.Remove(removeOne);
- backend.Remove(removeTwo);
- backend.Add(itemToAdd);
- }
- else backend.Add(new Tuple(item, item));
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Adds a new extent
- ///
- /// First element of the extent
- ///
- /// Last element of the extent or if is true how many elements the extent runs
- /// for
- ///
- /// If set to true, indicates how many elements the extent runs for
- public void Add(sbyte start, sbyte end, bool run = false)
- {
- sbyte realEnd;
- if(run) realEnd = (sbyte)(start + end - 1);
- else realEnd = end;
-
- // TODO: Optimize this
- for(sbyte t = start; t <= realEnd; t++) Add(t);
- }
-
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
- /// Item to seach for
- /// true if any of the extents on this instance contains the item
- public bool Contains(sbyte item)
- {
- return backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- }
-
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
-
- ///
- /// Removes an item from the extents in this instance
- ///
- /// Item to remove
- /// true if the item was contained in a known extent and removed, false otherwise
- public bool Remove(sbyte item)
- {
- Tuple toRemove = null;
- Tuple toAddOne = null;
- Tuple toAddTwo = null;
-
- foreach(Tuple extent in backend)
- {
- // Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, (sbyte)(item - 1));
- toAddTwo = new Tuple((sbyte)(item + 1), extent.Item2);
- break;
- }
-
- // Extent is left border, but not only element
- if(item == extent.Item1 && item != extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple((sbyte)(item + 1), extent.Item2);
- break;
- }
-
- // Extent is right border, but not only element
- if(item != extent.Item1 && item == extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, (sbyte)(item - 1));
- break;
- }
-
- // Extent is only element
- if(item != extent.Item1 || item != extent.Item2) continue;
-
- toRemove = extent;
- break;
- }
-
- // Item not found
- if(toRemove == null) return false;
-
- backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
-
- return true;
- }
-
- ///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
- ///
- /// Array of
- public Tuple[] ToArray() => backend.ToArray();
-
- ///
- /// Gets the first element of the extent that contains the specified item
- ///
- /// Item
- /// First element of extent
- /// true if item was found in an extent, false otherwise
- public bool GetStart(sbyte item, out sbyte start)
- {
- start = 0;
- foreach(Tuple extent in backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
- {
- start = extent.Item1;
- return true;
- }
-
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Extents/ExtentsShort.cs b/DiscImageChef.CommonTypes/Extents/ExtentsShort.cs
deleted file mode 100644
index 5e09cd3af..000000000
--- a/DiscImageChef.CommonTypes/Extents/ExtentsShort.cs
+++ /dev/null
@@ -1,251 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : ExtentsShort.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Extent helpers.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Provides extents for short types.
-//
-// --[ 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;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace DiscImageChef.CommonTypes.Extents
-{
- ///
- /// Implements extents for
- ///
- public class ExtentsShort
- {
- List> backend;
-
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsShort()
- {
- backend = new List>();
- }
-
- ///
- /// Initializes extents with an specific list
- ///
- /// List of extents as tuples "start, end"
- public ExtentsShort(IEnumerable> list)
- {
- backend = list.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Gets a count of how many extents are stored
- ///
- public int Count => backend.Count;
-
- ///
- /// Adds the specified number to the corresponding extent, or creates a new one
- ///
- ///
- public void Add(short item)
- {
- Tuple removeOne = null;
- Tuple removeTwo = null;
- Tuple itemToAdd = null;
-
- for(int i = 0; i < backend.Count; i++)
- {
- // Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
-
- // Expands existing extent start
- if(item == backend[i].Item1 - 1)
- {
- removeOne = backend[i];
-
- if(i > 0 && item == backend[i - 1].Item2 + 1)
- {
- removeTwo = backend[i - 1];
- itemToAdd = new Tuple(backend[i - 1].Item1, backend[i].Item2);
- }
- else itemToAdd = new Tuple(item, backend[i].Item2);
-
- break;
- }
-
- // Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
-
- removeOne = backend[i];
-
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
- {
- removeTwo = backend[i + 1];
- itemToAdd = new Tuple(backend[i].Item1, backend[i + 1].Item2);
- }
- else itemToAdd = new Tuple(backend[i].Item1, item);
-
- break;
- }
-
- if(itemToAdd != null)
- {
- backend.Remove(removeOne);
- backend.Remove(removeTwo);
- backend.Add(itemToAdd);
- }
- else backend.Add(new Tuple(item, item));
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Adds a new extent
- ///
- /// First element of the extent
- ///
- /// Last element of the extent or if is true how many elements the extent runs
- /// for
- ///
- /// If set to true, indicates how many elements the extent runs for
- public void Add(short start, short end, bool run = false)
- {
- short realEnd;
- if(run) realEnd = (short)(start + end - 1);
- else realEnd = end;
-
- // TODO: Optimize this
- for(short t = start; t <= realEnd; t++) Add(t);
- }
-
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
- /// Item to seach for
- /// true if any of the extents on this instance contains the item
- public bool Contains(short item)
- {
- return backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- }
-
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
-
- ///
- /// Removes an item from the extents in this instance
- ///
- /// Item to remove
- /// true if the item was contained in a known extent and removed, false otherwise
- public bool Remove(short item)
- {
- Tuple toRemove = null;
- Tuple toAddOne = null;
- Tuple toAddTwo = null;
-
- foreach(Tuple extent in backend)
- {
- // Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, (short)(item - 1));
- toAddTwo = new Tuple((short)(item + 1), extent.Item2);
- break;
- }
-
- // Extent is left border, but not only element
- if(item == extent.Item1 && item != extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple((short)(item + 1), extent.Item2);
- break;
- }
-
- // Extent is right border, but not only element
- if(item != extent.Item1 && item == extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, (short)(item - 1));
- break;
- }
-
- // Extent is only element
- if(item != extent.Item1 || item != extent.Item2) continue;
-
- toRemove = extent;
- break;
- }
-
- // Item not found
- if(toRemove == null) return false;
-
- backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
-
- return true;
- }
-
- ///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
- ///
- /// Array of
- public Tuple[] ToArray() => backend.ToArray();
-
- ///
- /// Gets the first element of the extent that contains the specified item
- ///
- /// Item
- /// First element of extent
- /// true if item was found in an extent, false otherwise
- public bool GetStart(short item, out short start)
- {
- start = 0;
- foreach(Tuple extent in backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
- {
- start = extent.Item1;
- return true;
- }
-
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Extents/ExtentsUInt.cs b/DiscImageChef.CommonTypes/Extents/ExtentsUInt.cs
deleted file mode 100644
index 2c80f799b..000000000
--- a/DiscImageChef.CommonTypes/Extents/ExtentsUInt.cs
+++ /dev/null
@@ -1,251 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : ExtentsUInt.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Extent helpers.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Provides extents for uint types.
-//
-// --[ 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;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace DiscImageChef.CommonTypes.Extents
-{
- ///
- /// Implements extents for
- ///
- public class ExtentsUInt
- {
- List> backend;
-
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsUInt()
- {
- backend = new List>();
- }
-
- ///
- /// Initializes extents with an specific list
- ///
- /// List of extents as tuples "start, end"
- public ExtentsUInt(IEnumerable> list)
- {
- backend = list.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Gets a count of how many extents are stored
- ///
- public int Count => backend.Count;
-
- ///
- /// Adds the specified number to the corresponding extent, or creates a new one
- ///
- ///
- public void Add(uint item)
- {
- Tuple removeOne = null;
- Tuple removeTwo = null;
- Tuple itemToAdd = null;
-
- for(int i = 0; i < backend.Count; i++)
- {
- // Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
-
- // Expands existing extent start
- if(item == backend[i].Item1 - 1)
- {
- removeOne = backend[i];
-
- if(i > 0 && item == backend[i - 1].Item2 + 1)
- {
- removeTwo = backend[i - 1];
- itemToAdd = new Tuple(backend[i - 1].Item1, backend[i].Item2);
- }
- else itemToAdd = new Tuple(item, backend[i].Item2);
-
- break;
- }
-
- // Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
-
- removeOne = backend[i];
-
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
- {
- removeTwo = backend[i + 1];
- itemToAdd = new Tuple(backend[i].Item1, backend[i + 1].Item2);
- }
- else itemToAdd = new Tuple(backend[i].Item1, item);
-
- break;
- }
-
- if(itemToAdd != null)
- {
- backend.Remove(removeOne);
- backend.Remove(removeTwo);
- backend.Add(itemToAdd);
- }
- else backend.Add(new Tuple(item, item));
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Adds a new extent
- ///
- /// First element of the extent
- ///
- /// Last element of the extent or if is true how many elements the extent runs
- /// for
- ///
- /// If set to true, indicates how many elements the extent runs for
- public void Add(uint start, uint end, bool run = false)
- {
- uint realEnd;
- if(run) realEnd = start + end - 1;
- else realEnd = end;
-
- // TODO: Optimize this
- for(uint t = start; t <= realEnd; t++) Add(t);
- }
-
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
- /// Item to seach for
- /// true if any of the extents on this instance contains the item
- public bool Contains(uint item)
- {
- return backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- }
-
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
-
- ///
- /// Removes an item from the extents in this instance
- ///
- /// Item to remove
- /// true if the item was contained in a known extent and removed, false otherwise
- public bool Remove(uint item)
- {
- Tuple toRemove = null;
- Tuple toAddOne = null;
- Tuple toAddTwo = null;
-
- foreach(Tuple extent in backend)
- {
- // Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, item - 1);
- toAddTwo = new Tuple(item + 1, extent.Item2);
- break;
- }
-
- // Extent is left border, but not only element
- if(item == extent.Item1 && item != extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(item + 1, extent.Item2);
- break;
- }
-
- // Extent is right border, but not only element
- if(item != extent.Item1 && item == extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, item - 1);
- break;
- }
-
- // Extent is only element
- if(item != extent.Item1 || item != extent.Item2) continue;
-
- toRemove = extent;
- break;
- }
-
- // Item not found
- if(toRemove == null) return false;
-
- backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
-
- return true;
- }
-
- ///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
- ///
- /// Array of
- public Tuple[] ToArray() => backend.ToArray();
-
- ///
- /// Gets the first element of the extent that contains the specified item
- ///
- /// Item
- /// First element of extent
- /// true if item was found in an extent, false otherwise
- public bool GetStart(uint item, out uint start)
- {
- start = 0;
- foreach(Tuple extent in backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
- {
- start = extent.Item1;
- return true;
- }
-
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Extents/ExtentsULong.cs b/DiscImageChef.CommonTypes/Extents/ExtentsULong.cs
deleted file mode 100644
index 8540a0aea..000000000
--- a/DiscImageChef.CommonTypes/Extents/ExtentsULong.cs
+++ /dev/null
@@ -1,251 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : ExtentsULong.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Extent helpers.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Provides extents for ulong types.
-//
-// --[ 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;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace DiscImageChef.CommonTypes.Extents
-{
- ///
- /// Implements extents for
- ///
- public class ExtentsULong
- {
- List> backend;
-
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsULong()
- {
- backend = new List>();
- }
-
- ///
- /// Initializes extents with an specific list
- ///
- /// List of extents as tuples "start, end"
- public ExtentsULong(IEnumerable> list)
- {
- backend = list.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Gets a count of how many extents are stored
- ///
- public int Count => backend.Count;
-
- ///
- /// Adds the specified number to the corresponding extent, or creates a new one
- ///
- ///
- public void Add(ulong item)
- {
- Tuple removeOne = null;
- Tuple removeTwo = null;
- Tuple itemToAdd = null;
-
- for(int i = 0; i < backend.Count; i++)
- {
- // Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
-
- // Expands existing extent start
- if(item == backend[i].Item1 - 1)
- {
- removeOne = backend[i];
-
- if(i > 0 && item == backend[i - 1].Item2 + 1)
- {
- removeTwo = backend[i - 1];
- itemToAdd = new Tuple(backend[i - 1].Item1, backend[i].Item2);
- }
- else itemToAdd = new Tuple(item, backend[i].Item2);
-
- break;
- }
-
- // Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
-
- removeOne = backend[i];
-
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
- {
- removeTwo = backend[i + 1];
- itemToAdd = new Tuple(backend[i].Item1, backend[i + 1].Item2);
- }
- else itemToAdd = new Tuple(backend[i].Item1, item);
-
- break;
- }
-
- if(itemToAdd != null)
- {
- backend.Remove(removeOne);
- backend.Remove(removeTwo);
- backend.Add(itemToAdd);
- }
- else backend.Add(new Tuple(item, item));
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Adds a new extent
- ///
- /// First element of the extent
- ///
- /// Last element of the extent or if is true how many elements the extent runs
- /// for
- ///
- /// If set to true, indicates how many elements the extent runs for
- public void Add(ulong start, ulong end, bool run = false)
- {
- ulong realEnd;
- if(run) realEnd = start + end - 1;
- else realEnd = end;
-
- // TODO: Optimize this
- for(ulong t = start; t <= realEnd; t++) Add(t);
- }
-
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
- /// Item to seach for
- /// true if any of the extents on this instance contains the item
- public bool Contains(ulong item)
- {
- return backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- }
-
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
-
- ///
- /// Removes an item from the extents in this instance
- ///
- /// Item to remove
- /// true if the item was contained in a known extent and removed, false otherwise
- public bool Remove(ulong item)
- {
- Tuple toRemove = null;
- Tuple toAddOne = null;
- Tuple toAddTwo = null;
-
- foreach(Tuple extent in backend)
- {
- // Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, item - 1);
- toAddTwo = new Tuple(item + 1, extent.Item2);
- break;
- }
-
- // Extent is left border, but not only element
- if(item == extent.Item1 && item != extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(item + 1, extent.Item2);
- break;
- }
-
- // Extent is right border, but not only element
- if(item != extent.Item1 && item == extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, item - 1);
- break;
- }
-
- // Extent is only element
- if(item != extent.Item1 || item != extent.Item2) continue;
-
- toRemove = extent;
- break;
- }
-
- // Item not found
- if(toRemove == null) return false;
-
- backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
-
- return true;
- }
-
- ///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
- ///
- /// Array of
- public Tuple[] ToArray() => backend.ToArray();
-
- ///
- /// Gets the first element of the extent that contains the specified item
- ///
- /// Item
- /// First element of extent
- /// true if item was found in an extent, false otherwise
- public bool GetStart(ulong item, out ulong start)
- {
- start = 0;
- foreach(Tuple extent in backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
- {
- start = extent.Item1;
- return true;
- }
-
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Extents/ExtentsUShort.cs b/DiscImageChef.CommonTypes/Extents/ExtentsUShort.cs
deleted file mode 100644
index cec53bbd3..000000000
--- a/DiscImageChef.CommonTypes/Extents/ExtentsUShort.cs
+++ /dev/null
@@ -1,252 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : ExtentsUShort.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Extent helpers.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Provides extents for ushort types.
-//
-// --[ 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;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace DiscImageChef.CommonTypes.Extents
-{
- ///
- /// Implements extents for
- ///
- public class ExtentsUShort
- {
- List> backend;
-
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsUShort()
- {
- backend = new List>();
- }
-
- ///
- /// Initializes extents with an specific list
- ///
- /// List of extents as tuples "start, end"
- public ExtentsUShort(IEnumerable> list)
- {
- backend = list.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Gets a count of how many extents are stored
- ///
- public int Count => backend.Count;
-
- ///
- /// Adds the specified number to the corresponding extent, or creates a new one
- ///
- ///
- public void Add(ushort item)
- {
- Tuple removeOne = null;
- Tuple removeTwo = null;
- Tuple itemToAdd = null;
-
- for(int i = 0; i < backend.Count; i++)
- {
- // Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
-
- // Expands existing extent start
- if(item == backend[i].Item1 - 1)
- {
- removeOne = backend[i];
-
- if(i > 0 && item == backend[i - 1].Item2 + 1)
- {
- removeTwo = backend[i - 1];
- itemToAdd = new Tuple(backend[i - 1].Item1, backend[i].Item2);
- }
- else itemToAdd = new Tuple(item, backend[i].Item2);
-
- break;
- }
-
- // Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
-
- removeOne = backend[i];
-
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
- {
- removeTwo = backend[i + 1];
- itemToAdd = new Tuple(backend[i].Item1, backend[i + 1].Item2);
- }
- else itemToAdd = new Tuple(backend[i].Item1, item);
-
- break;
- }
-
- if(itemToAdd != null)
- {
- backend.Remove(removeOne);
- backend.Remove(removeTwo);
- backend.Add(itemToAdd);
- }
- else backend.Add(new Tuple(item, item));
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
- }
-
- ///
- /// Adds a new extent
- ///
- /// First element of the extent
- ///
- /// Last element of the extent or if is true how many elements the extent runs
- /// for
- ///
- /// If set to true, indicates how many elements the extent runs for
- public void Add(ushort start, ushort end, bool run = false)
- {
- ushort realEnd;
- if(run) realEnd = (ushort)(start + end - 1);
- else realEnd = end;
-
- // TODO: Optimize this
- for(ushort t = start; t <= realEnd; t++) Add(t);
- }
-
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
- /// Item to seach for
- /// true if any of the extents on this instance contains the item
- public bool Contains(ushort item)
- {
- return backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- }
-
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
-
- ///
- /// Removes an item from the extents in this instance
- ///
- /// Item to remove
- /// true if the item was contained in a known extent and removed, false otherwise
- public bool Remove(ushort item)
- {
- Tuple toRemove = null;
- Tuple toAddOne = null;
- Tuple toAddTwo = null;
-
- foreach(Tuple extent in backend)
- {
- // Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, (ushort)(item - 1));
- toAddTwo = new Tuple((ushort)(item + 1), extent.Item2);
- break;
- }
-
- // Extent is left border, but not only element
- if(item == extent.Item1 && item != extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple((ushort)(item + 1), extent.Item2);
- break;
- }
-
- // Extent is right border, but not only element
- if(item != extent.Item1 && item == extent.Item2)
- {
- toRemove = extent;
- toAddOne = new Tuple(extent.Item1, (ushort)(item - 1));
- break;
- }
-
- // Extent is only element
- if(item != extent.Item1 || item != extent.Item2) continue;
-
- toRemove = extent;
- break;
- }
-
- // Item not found
- if(toRemove == null) return false;
-
- backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
-
- // Sort
- backend = backend.OrderBy(t => t.Item1).ToList();
-
- return true;
- }
-
- ///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
- ///
- /// Array of
- public Tuple[] ToArray() => backend.ToArray();
-
- ///
- /// Gets the first element of the extent that contains the specified item
- ///
- /// Item
- /// First element of extent
- /// true if item was found in an extent, false otherwise
- public bool GetStart(ushort item, out ushort start)
- {
- start = 0;
- foreach(Tuple extent in
- backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
- {
- start = extent.Item1;
- return true;
- }
-
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Filters.cs b/DiscImageChef.CommonTypes/Filters.cs
deleted file mode 100644
index 297c4389f..000000000
--- a/DiscImageChef.CommonTypes/Filters.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : Filters.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Filters.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Enumerates all filters and instantiates the correct one.
-//
-// --[ 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;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using DiscImageChef.CommonTypes.Interfaces;
-using DiscImageChef.Console;
-
-namespace DiscImageChef.CommonTypes
-{
- public class FiltersList
- {
- public SortedDictionary Filters;
-
- ///
- /// Fills the list of all known filters
- ///
- public FiltersList()
- {
- Assembly assembly = Assembly.Load("DiscImageChef.Filters");
- Filters = new SortedDictionary();
-
- foreach(Type type in assembly.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(IFilter))))
- try
- {
- IFilter filter = (IFilter)type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
- if(filter != null && !Filters.ContainsKey(filter.Name.ToLower()))
- Filters.Add(filter.Name.ToLower(), filter);
- }
- catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); }
- }
-
- ///
- /// Gets the filter that allows to read the specified path
- ///
- /// Path
- /// The filter that allows reading the specified path
- public IFilter GetFilter(string path)
- {
- try
- {
- IFilter noFilter = null;
- foreach(IFilter filter in Filters.Values)
- if(filter.Id != new Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
- {
- if(!filter.Identify(path)) continue;
-
- IFilter foundFilter =
- (IFilter)filter.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
-
- foundFilter?.Open(path);
-
- if(foundFilter?.IsOpened() == true) return foundFilter;
- }
- else
- noFilter = filter;
-
- if(!noFilter?.Identify(path) == true) return noFilter;
-
- noFilter?.Open(path);
-
- return noFilter;
- }
- catch(IOException) { return null; }
- }
-
- ///
- /// Gets all known filters
- ///
- /// Known filters
- public SortedDictionary GetFiltersList() => Filters;
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Geometry.cs b/DiscImageChef.CommonTypes/Geometry.cs
deleted file mode 100644
index 6ea550953..000000000
--- a/DiscImageChef.CommonTypes/Geometry.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : Geometry.cs
-// Author(s) : Natalia Portillo
-//
-// Component : CommonTypes.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Includes geometry for several medias.
-//
-// --[ 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.Linq;
-
-namespace DiscImageChef.CommonTypes
-{
- public static class Geometry
- {
- static readonly (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding
- encoding, bool variableSectorsPerTrack, MediaType type)[] KnownGeometries =
- {
- (32, 1, 8, 319, MediaEncoding.FM, false, MediaType.IBM23FD),
- (35, 1, 9, 256, MediaEncoding.FM, false, MediaType.ECMA_66),
- (35, 1, 13, 256, MediaEncoding.AppleGCR, false, MediaType.Apple32SS),
- (35, 1, 16, 256, MediaEncoding.AppleGCR, false, MediaType.Apple33SS),
- (35, 1, 19, 256, MediaEncoding.CommodoreGCR, false, MediaType.CBM_1540),
- (35, 2, 13, 256, MediaEncoding.AppleGCR, false, MediaType.Apple32DS),
- (35, 2, 16, 256, MediaEncoding.AppleGCR, false, MediaType.Apple33DS),
- (35, 2, 19, 256, MediaEncoding.CommodoreGCR, false, MediaType.CBM_1571),
- (40, 1, 8, 512, MediaEncoding.MFM, false, MediaType.DOS_525_SS_DD_8),
- (40, 1, 9, 512, MediaEncoding.MFM, false, MediaType.DOS_525_SS_DD_9),
- (40, 1, 10, 256, MediaEncoding.FM, false, MediaType.ACORN_525_SS_SD_40),
- (40, 1, 16, 256, MediaEncoding.MFM, false, MediaType.ACORN_525_SS_DD_40),
- (40, 1, 18, 128, MediaEncoding.FM, false, MediaType.ATARI_525_SD),
- (40, 1, 18, 256, MediaEncoding.MFM, false, MediaType.ATARI_525_DD),
- (40, 1, 19, 256, MediaEncoding.CommodoreGCR, false, MediaType.CBM_1540_Ext),
- (40, 1, 26, 128, MediaEncoding.MFM, false, MediaType.ATARI_525_ED),
- (40, 2, 8, 512, MediaEncoding.MFM, false, MediaType.DOS_525_DS_DD_8),
- (40, 2, 9, 512, MediaEncoding.MFM, false, MediaType.DOS_525_DS_DD_9),
- (40, 2, 16, 256, MediaEncoding.FM, false, MediaType.ECMA_70),
- (70, 2, 9, 512, MediaEncoding.MFM, false, MediaType.Apricot_35),
- (74, 1, 8, 512, MediaEncoding.FM, false, MediaType.IBM33FD_512),
- (74, 1, 15, 256, MediaEncoding.FM, false, MediaType.IBM33FD_256),
- (74, 1, 26, 128, MediaEncoding.FM, false, MediaType.IBM33FD_128),
- (74, 2, 8, 1024, MediaEncoding.MFM, false, MediaType.IBM53FD_1024),
- (74, 2, 15, 256, MediaEncoding.FM, false, MediaType.IBM43FD_256),
- (74, 2, 15, 512, MediaEncoding.MFM, false, MediaType.IBM53FD_512),
- (74, 2, 26, 128, MediaEncoding.FM, false, MediaType.IBM43FD_128),
- (74, 2, 26, 256, MediaEncoding.MFM, false, MediaType.IBM53FD_256),
- (77, 1, 26, 128, MediaEncoding.FM, false, MediaType.RX01),
- (77, 1, 26, 256, MediaEncoding.MFM, false, MediaType.RX02),
- (77, 2, 8, 1024, MediaEncoding.MFM, false, MediaType.NEC_525_HD),
- (77, 2, 15, 512, MediaEncoding.MFM, false, MediaType.ECMA_99_15),
- (77, 2, 26, 128, MediaEncoding.FM, false, MediaType.NEC_8_SD),
- (77, 2, 26, 256, MediaEncoding.MFM, false, MediaType.RX03),
- (80, 1, 8, 512, MediaEncoding.MFM, false, MediaType.DOS_35_SS_DD_8),
- (80, 1, 9, 512, MediaEncoding.MFM, false, MediaType.DOS_35_SS_DD_9),
- (80, 1, 10, 256, MediaEncoding.FM, false, MediaType.ACORN_525_SS_SD_80),
- (80, 1, 10, 512, MediaEncoding.AppleGCR, true, MediaType.AppleSonySS),
- (80, 1, 10, 512, MediaEncoding.MFM, false, MediaType.RX50),
- (80, 1, 11, 512, MediaEncoding.MFM, false, MediaType.ATARI_35_SS_DD_11),
- (80, 1, 16, 256, MediaEncoding.MFM, false, MediaType.ACORN_525_SS_DD_80),
- (80, 2, 5, 1024, MediaEncoding.MFM, false, MediaType.ACORN_35_DS_DD),
- (80, 2, 8, 512, MediaEncoding.MFM, false, MediaType.DOS_35_DS_DD_8),
- (80, 2, 9, 512, MediaEncoding.MFM, false, MediaType.DOS_35_DS_DD_9),
- (80, 2, 10, 512, MediaEncoding.AppleGCR, true, MediaType.AppleSonyDS),
- (80, 2, 10, 512, MediaEncoding.MFM, false, MediaType.CBM_35_DD),
- (80, 2, 10, 1024, MediaEncoding.MFM, false, MediaType.ACORN_35_DS_HD),
- (80, 2, 11, 512, MediaEncoding.MFM, false, MediaType.CBM_AMIGA_35_DD),
- (80, 2, 15, 512, MediaEncoding.MFM, false, MediaType.DOS_525_HD),
- (80, 2, 16, 256, MediaEncoding.FM, false, MediaType.ECMA_78),
- (80, 2, 16, 256, MediaEncoding.MFM, false, MediaType.ACORN_525_DS_DD),
- (80, 2, 18, 512, MediaEncoding.MFM, false, MediaType.DOS_35_HD),
- (80, 2, 19, 512, MediaEncoding.MFM, false, MediaType.XDF_525),
- (80, 2, 21, 512, MediaEncoding.MFM, false, MediaType.DMF),
- (80, 2, 22, 512, MediaEncoding.MFM, false, MediaType.CBM_AMIGA_35_HD),
- (80, 2, 23, 512, MediaEncoding.MFM, false, MediaType.XDF_35),
- (80, 2, 36, 512, MediaEncoding.MFM, false, MediaType.DOS_35_ED),
- (82, 2, 10, 512, MediaEncoding.MFM, false, MediaType.FDFORMAT_35_DD),
- (82, 2, 17, 512, MediaEncoding.MFM, false, MediaType.FDFORMAT_525_HD),
- (82, 2, 21, 512, MediaEncoding.MFM, false, MediaType.FDFORMAT_35_HD),
- (240, 2, 38, 512, MediaEncoding.MFM, false, MediaType.NEC_35_TD),
- (753, 2, 27, 512, MediaEncoding.MFM, false, MediaType.Floptical),
- // Following ones are what the device itself report, not the physical geometry
- (154, 16, 32, 512, MediaEncoding.MFM, false, MediaType.PocketZip),
- (262, 32, 56, 512, MediaEncoding.MFM, false, MediaType.LS240),
- (963, 8, 32, 512, MediaEncoding.MFM, false, MediaType.LS120),
- (1021, 64, 32, 512, MediaEncoding.MFM, false, MediaType.Jaz),
- (1024, 2, 32, 512, MediaEncoding.MFM, false, MediaType.FD32MB)
- };
-
- public static MediaType GetMediaType(
- (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding encoding, bool
- variableSectorsPerTrack) geometry) =>
- (from geom in KnownGeometries
- where geom.cylinders == geometry.cylinders &&
- geom.heads == geometry.heads &&
- geom.sectorsPerTrack == geometry.sectorsPerTrack &&
- geom.bytesPerSector == geometry.bytesPerSector &&
- geom.encoding == geometry.encoding &&
- geom.variableSectorsPerTrack == geometry.variableSectorsPerTrack
- select geom.type).FirstOrDefault();
-
- public static (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding encoding
- , bool variableSectorsPerTrack, MediaType type) GetGeometry(MediaType mediaType) =>
- (from geom in KnownGeometries where geom.type == mediaType select geom).FirstOrDefault();
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Interfaces/IArchive.cs b/DiscImageChef.CommonTypes/Interfaces/IArchive.cs
deleted file mode 100644
index b71dab40e..000000000
--- a/DiscImageChef.CommonTypes/Interfaces/IArchive.cs
+++ /dev/null
@@ -1,253 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : IArchive.cs
-// Author(s) : Michael Drüing
-//
-// Component : Archives.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Defines the interface for an Archive.
-//
-// --[ 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 © 2018-2019 Michael Drüing
-// Copyright © 2011-2019 Natalia Portillo
-// ****************************************************************************/
-
-using System;
-using System.IO;
-using System.Collections.Generic;
-
-namespace DiscImageChef.CommonTypes.Interfaces
-{
- [Flags]
- public enum ArchiveSupportedFeature : uint
- {
- ///
- /// The archive supports filenames for its entries. If this flag is not set,
- /// files can only be accessed by number.
- ///
- SupportsFilenames = 1 << 0,
-
- ///
- /// The archive supports compression. If this flag is not set, compressed and
- /// uncompressed lengths are always the same.
- ///
- SupportsCompression = 1 << 1,
-
- ///
- /// The archive supports subdirectories. If this flag is not set, all filenames are
- /// guaranteed to not contain any "/" character.
- ///
- SupportsSubdirectories = 1 << 2,
-
- ///
- /// The archive supports explicit entries for directories (like Zip, for example).
- /// If this flag is not set, directories are implicit by the relative name of the files.
- ///
- HasExplicitDirectories = 1 << 3,
-
- ///
- /// The archive stores a timestamp with each entry if this flag is set.
- ///
- HasEntryTimestamp = 1 << 4,
-
- ///
- /// If this flag is set, individual files or the whole archive might be encrypted or
- /// password-protected.
- ///
- SupportsProtection = 1 << 5, // TODO: not implemented yet
-
- ///
- /// If this flag is set, the archive supports returning extended attributes (Xattrs) for each entry.
- ///
- SupportsXAttrs = 1 << 6,
- };
-
- public interface IArchive
- {
- /// Descriptive name of the plugin
- string Name { get; }
-
- /// Unique UUID of the plugin
- Guid Id { get; }
-
- ///
- /// Identifies if the specified path contains data recognizable by this archive instance
- ///
- /// Path.
- bool Identify(string path);
-
- ///
- /// Identifies if the specified stream contains data recognizable by this archive instance
- ///
- /// Stream.
- bool Identify(Stream stream);
-
- ///
- /// Identifies if the specified buffer contains data recognizable by this archive instance
- ///
- /// Buffer.
- bool Identify(byte[] buffer);
-
- ///
- /// Opens the specified path with this archive instance
- ///
- /// Path.
- void Open(string path);
-
- ///
- /// Opens the specified stream with this archive instance
- ///
- /// Stream.
- void Open(Stream stream);
-
- ///
- /// Opens the specified buffer with this archive instance
- ///
- /// Buffer.
- void Open(byte[] buffer);
-
- ///
- /// Returns true if the archive has a file/stream/buffer currently opened and no
- /// has been issued.
- ///
- bool IsOpened();
-
- ///
- /// Closes all opened streams.
- ///
- void Close();
-
- ///
- /// Return a bitfield indicating the features supported by this archive type.
- ///
- /// The ArchiveSupportedFeature bitfield.
- ///
- /// This should be a constant, tied to the archive type, not to the particular
- /// features used by the currently-opened archive file.
- ///
- ArchiveSupportedFeature GetArchiveFeatures();
-
- ///
- /// Gets the number of entries (i.e. files) that are contained in this archive.
- ///
- ///
- /// Entries in this context can also mean directories or volume labels, for some types of
- /// archives that store these explicitly. Do not rely on all entries being regular files!
- ///
- /// The number of files.
- int GetNumberOfEntries();
-
- ///
- /// Gets the file name (and path) of the given entry in the archive.
- ///
- ///
- /// The path components are separated by a forward slash "/".
- /// The path should not start with a leading slash (i.e. it should be relative, not absolute).
- ///
- ///
- /// The entry in the archive for which to return the file name.
- /// The file name, with (relative) path
- string GetFilename(int entryNumber);
-
- ///
- /// Gets the entry number for a particular file path in the archive. fileName is
- /// the relative path of the file in the archive. If the file cannot be found, -1 is returned.
- ///
- ///
- /// The path should be relative (no leading slash), using regular slashes as path separator, and be
- /// normalized, i.e. no "foo//bar" or "foo/../bar" path components.
- ///
- /// The relative path for which to get the entry number.
- /// If set, do a case insensitive matching and return the first file that matches.
- /// The number of the entry corresponding to the given path, or -1 if the path does not exist.
- int GetEntryNumber(string fileName, bool caseInsensitiveMatch);
-
- ///
- /// Gets the (compressed) size of the given entry.
- ///
- /// The entry for which to get the compressed size.
- /// The compressed size of the entry, or 0 if the entry is not a regular file.
- ///
- /// The return value is equal to the return value of GetUncompressedSize() if the file is not compressed.
- ///
- ///
- long GetCompressedSize(int entryNumber);
-
- ///
- /// Gets the uncompressed size of the given entry.
- ///
- /// The entry for which to get the uncompressed size.
- /// The uncompressed size of the entry, or 0 if the entry is not a regular file.
- ///
- /// The return value is equal to the return value of GetCompressedSize() if the file is not compressed.
- ///
- ///
- long GetUncompressedSize(int entryNumber);
-
- ///
- /// Gets the attributes of a file or directory.
- ///
- ///
- /// Error number.
- /// The entry in the archive for which to retreive the attributes.
- /// File attributes, or zero if the archive does not support attributes.
- FileAttributes GetAttributes(int entryNumber);
-
- ///
- /// Lists all extended attributes, alternate data streams and forks of the given file.
- ///
- /// The entry in the archive for which to retreive the list of attributes.
- /// List of extended attributes, alternate data streams and forks.
- List GetXAttrs(int entryNumber);
-
- ///
- /// Reads an extended attribute, alternate data stream or fork from the given file.
- ///
- /// Error number.
- /// The entry in the archive for which to retreive the XAttr.
- /// Extended attribute, alternate data stream or fork name.
- /// Buffer with the XAttr data.
- byte[] GetXattr(int entryNumber, string xattr);
-
- ///
- /// Gets information about an entry in the archive.
- ///
- ///
- /// Note that some of the data might be incomplete or not available at all, depending on the type of
- /// archive.
- ///
- ///
- ///
- /// The entry int he archive for which to get the information
- /// The available information about the entry in the archive
- FileSystemInfo Stat(int entryNumber);
-
- ///
- /// Returns the Filter for the given entry. It will return null if the entry in question
- /// is not a regular file (i.e. directory, volume label, etc.)
- ///
- /// The entry for which the Filter should be returned.
- /// The Filter for the given entry.
- IFilter GetEntry(int entryNumber);
- }
-}
-
diff --git a/DiscImageChef.CommonTypes/Interfaces/IChecksum.cs b/DiscImageChef.CommonTypes/Interfaces/IChecksum.cs
deleted file mode 100644
index b1f6bad2c..000000000
--- a/DiscImageChef.CommonTypes/Interfaces/IChecksum.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : IChecksum.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Checksums.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Provides an interface for implementing checksums and hashes.
-//
-// --[ 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 IChecksum
- {
- ///
- /// Updates the hash with data.
- ///
- /// Data buffer.
- /// Length of buffer to hash.
- void Update(byte[] data, uint len);
-
- ///
- /// Updates the hash with data.
- ///
- /// Data buffer.
- void Update(byte[] data);
-
- ///
- /// Returns a byte array of the hash value.
- ///
- byte[] Final();
-
- ///
- /// Returns a hexadecimal representation of the hash value.
- ///
- string End();
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Interfaces/IFilesystem.cs b/DiscImageChef.CommonTypes/Interfaces/IFilesystem.cs
deleted file mode 100644
index e5eeaf691..000000000
--- a/DiscImageChef.CommonTypes/Interfaces/IFilesystem.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : IFilesystem.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Filesystem plugins.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Interface for filesystem 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;
-using System.Text;
-using Schemas;
-
-namespace DiscImageChef.CommonTypes.Interfaces
-{
- ///
- /// Interface to implement filesystem plugins.
- ///
- public interface IFilesystem
- {
- Encoding Encoding { get; }
- /// Plugin name.
- string Name { get; }
- /// Plugin UUID.
- Guid Id { get; }
- ///
- /// Information about the filesystem as expected by CICM Metadata XML
- ///
- /// Information about the filesystem as expected by CICM Metadata XML
- FileSystemType XmlFsType { get; }
- /// Plugin author
- string Author { get; }
-
- ///
- /// Identifies the filesystem in the specified LBA
- ///
- /// Disk image.
- /// Partition.
- /// true, if the filesystem is recognized, false otherwise.
- bool Identify(IMediaImage imagePlugin, Partition partition);
-
- ///
- /// Gets information about the identified filesystem.
- ///
- /// Disk image.
- /// Partition.
- /// Filesystem information.
- /// Which encoding to use for this filesystem.
- void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding);
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Interfaces/IFilter.cs b/DiscImageChef.CommonTypes/Interfaces/IFilter.cs
deleted file mode 100644
index a4b071426..000000000
--- a/DiscImageChef.CommonTypes/Interfaces/IFilter.cs
+++ /dev/null
@@ -1,180 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : IFilter.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Filters.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Defines the interface for a Filter.
-//
-// --[ 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;
-using System.IO;
-
-namespace DiscImageChef.CommonTypes.Interfaces
-{
- public interface IFilter
- {
- /// Descriptive name of the plugin
- string Name { get; }
- /// Unique UUID of the plugin
- Guid Id { get; }
- /// Plugin author
- string Author { get; }
-
- ///
- /// Closes all opened streams.
- ///
- void Close();
-
- ///
- /// Gets the path used to open this filter.
- /// UNIX: /path/to/archive.zip/path/to/file.bin => /path/to/archive.zip/path/to/file.bin
- /// Windows: C:\path\to\archive.zip\path\to\file.bin => C:\path\to\archive.zip\path\to\file.bin
- ///
- /// Path used to open this filter.
- string GetBasePath();
-
- ///
- /// Gets creation time of file referenced by this filter.
- ///
- /// The creation time.
- DateTime GetCreationTime();
-
- ///
- /// Gets length of this filter's data fork.
- ///
- /// The data fork length.
- long GetDataForkLength();
-
- ///
- /// Gets a stream to access the data fork contents.
- ///
- /// The data fork stream.
- Stream GetDataForkStream();
-
- ///
- /// Gets the filename for the file referenced by this filter.
- /// UNIX: /path/to/archive.zip/path/to/file.bin => file.bin
- /// Windows: C:\path\to\archive.zip\path\to\file.bin => file.bin
- ///
- /// The filename.
- string GetFilename();
-
- ///
- /// Gets last write time of file referenced by this filter.
- ///
- /// The last write time.
- DateTime GetLastWriteTime();
-
- ///
- /// Gets length of file referenced by ths filter.
- ///
- /// The length.
- long GetLength();
-
- ///
- /// Gets full path to file referenced by this filter. If it's an archive, it's the path inside the archive.
- /// UNIX: /path/to/archive.zip/path/to/file.bin => /path/to/file.bin
- /// Windows: C:\path\to\archive.zip\path\to\file.bin => \path\to\file.bin
- ///
- /// The path.
- string GetPath();
-
- ///
- /// Gets path to parent folder to the file referenced by this filter. If it's an archive, it's the full path to the
- /// archive itself.
- /// UNIX: /path/to/archive.zip/path/to/file.bin => /path/to/archive.zip
- /// Windows: C:\path\to\archive.zip\path\to\file.bin => C:\path\to\archive.zip
- ///
- /// The parent folder.
- string GetParentFolder();
-
- ///
- /// Gets length of this filter's resource fork.
- ///
- /// The resource fork length.
- long GetResourceForkLength();
-
- ///
- /// Gets a stream to access the resource fork contents.
- ///
- /// The resource fork stream.
- Stream GetResourceForkStream();
-
- ///
- /// Returns true if the file referenced by this filter has a resource fork
- ///
- bool HasResourceFork();
-
- ///
- /// Identifies if the specified path contains data recognizable by this filter instance
- ///
- /// Path.
- bool Identify(string path);
-
- ///
- /// Identifies if the specified stream contains data recognizable by this filter instance
- ///
- /// Stream.
- bool Identify(Stream stream);
-
- ///
- /// Identifies if the specified buffer contains data recognizable by this filter instance
- ///
- /// Buffer.
- bool Identify(byte[] buffer);
-
- ///
- /// Returns true if the filter has a file/stream/buffer currently opened and no
- /// has been issued.
- ///
- bool IsOpened();
-
- ///
- /// Opens the specified path with this filter instance
- ///
- /// Path.
- void Open(string path);
-
- ///
- /// Opens the specified stream with this filter instance
- ///
- /// Stream.
- void Open(Stream stream);
-
- ///
- /// Opens the specified buffer with this filter instance
- ///
- /// Buffer.
- void Open(byte[] buffer);
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Interfaces/IFloppyImage.cs b/DiscImageChef.CommonTypes/Interfaces/IFloppyImage.cs
deleted file mode 100644
index f7c675a99..000000000
--- a/DiscImageChef.CommonTypes/Interfaces/IFloppyImage.cs
+++ /dev/null
@@ -1,135 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : IFloppyImage.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Disc image plugins.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Defines interface to be implemented by floppy 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 DiscImageChef.CommonTypes.Enums;
-using DiscImageChef.CommonTypes.Structs;
-
-namespace DiscImageChef.CommonTypes.Interfaces
-{
- ///
- /// Abstract class to implement disk image reading plugins that can contain floppy images.
- /// This interface is needed because floppy formatting characteristics are not necesarily compatible with the whole.
- /// LBA-oriented interface is defined by .
- /// All data returned by these methods is already decoded from its corresponding bitstream.
- ///
- public interface IFloppyImage : IMediaImage
- {
- ///
- /// Floppy info, contains information about physical characteristics of floppy, like size, bitrate, track density,
- /// etc...
- ///
- FloppyInfo FloppyInfo { get; }
-
- ///
- /// Reads a sector's user data.
- ///
- ///
- /// If is one of the duplicates is returned
- /// randomly.
- /// If is or
- /// random data is returned.
- /// If is null is returned.
- /// Otherwise, whatever is in the sector is returned.
- ///
- /// Physical track (position of the heads over the floppy media, 0-based).
- /// Physical head (0-based).
- /// Logical sector ID.
- /// Status of request.
- byte[] ReadSector(ushort track, byte head, ushort sector, out FloppySectorStatus status);
-
- ///
- /// Reads a sector's tag.
- ///
- ///
- /// If is one of the duplicates is returned
- /// randomly.
- /// If is or
- /// random data is returned.
- /// If is null is returned.
- /// Otherwise, whatever tag is in the sector is returned.
- ///
- /// Physical track (position of the heads over the floppy media, 0-based).
- /// Physical head (0-based).
- /// Logical sector ID.
- /// Status of request.
- byte[] ReadSectorTag(ushort track, byte head, ushort sector, out FloppySectorStatus status, SectorTagType tag);
-
- ///
- /// Reads a whole track. It includes all gaps, address marks, sectors data, etc.
- ///
- /// The track data.
- /// Physical track (position of the heads over the floppy media, 0-based).
- /// Physical head (0-based).
- byte[] ReadTrack(ushort track, byte head);
-
- ///
- /// Reads a sector's data including all tags, address mark, and so, in a format dependent of represented media.
- ///
- ///
- /// If is one of the duplicates is returned
- /// randomly.
- /// If is or
- /// random data is returned.
- /// If is null is returned.
- /// Otherwise, whatever is in the sector is returned.
- ///
- /// Physical track (position of the heads over the floppy media, 0-based).
- /// Physical head (0-based).
- /// Logical sector ID.
- /// Status of request.
- byte[] ReadSectorLong(ushort track, byte head, ushort sector, out FloppySectorStatus status);
-
- ///
- /// Verifies a track.
- ///
- /// True if correct, false if incorrect, null if uncheckable.
- /// Physical track (position of the heads over the floppy media, 0-based).
- /// Physical head (0-based).
- bool? VerifyTrack(ushort track, byte head);
-
- ///
- /// Verifies a sector, relative to track.
- ///
- /// True if correct, false if incorrect, null if uncheckable.
- /// Physical track (position of the heads over the floppy media, 0-based).
- /// Physical head (0-based).
- /// Logical sector ID.
- /// Status of request.
- bool? VerifySector(ushort track, byte head, ushort sector);
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Interfaces/IMediaImage.cs b/DiscImageChef.CommonTypes/Interfaces/IMediaImage.cs
deleted file mode 100644
index b02a10e6f..000000000
--- a/DiscImageChef.CommonTypes/Interfaces/IMediaImage.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : IMediaImage.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Disc image plugins.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Defines interface to be implemented by block addressable disk 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;
-using System.Collections.Generic;
-using DiscImageChef.CommonTypes.Enums;
-using DiscImageChef.CommonTypes.Structs;
-using Schemas;
-
-namespace DiscImageChef.CommonTypes.Interfaces
-{
- ///
- /// Abstract class to implement disk image reading plugins.
- ///
- public interface IMediaImage
- {
- /// Image information
- ImageInfo Info { get; }
- /// Plugin name.
- string Name { get; }
- /// Plugin UUID.
- Guid Id { get; }
- /// Plugin author
- string Author { get; }
- ///
- /// Gets the image format.
- ///
- /// The image format.
- string Format { get; }
- /// List of dump hardware used to create the image from real media
- List DumpHardware { get; }
- /// Gets the CICM XML metadata for the image
- CICMMetadataType CicmMetadata { get; }
-
- ///
- /// Identifies the image.
- ///
- /// true, if image was identified, false otherwise.
- /// Image filter.
- bool Identify(IFilter imageFilter);
-
- ///
- /// Opens the image.
- ///
- /// true, if image was opened, false otherwise.
- /// Image filter.
- bool Open(IFilter imageFilter);
-
- ///
- /// Reads a disk tag.
- ///
- /// Disk tag
- /// Tag type to read.
- byte[] ReadDiskTag(MediaTagType tag);
-
- ///
- /// Reads a sector's user data.
- ///
- /// The sector's user data.
- /// Sector address (LBA).
- byte[] ReadSector(ulong sectorAddress);
-
- ///
- /// Reads a sector's tag.
- ///
- /// The sector's tag.
- /// Sector address (LBA).
- /// Tag type.
- byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag);
-
- ///
- /// Reads user data from several sectors.
- ///
- /// The sectors user data.
- /// Starting sector address (LBA).
- /// How many sectors to read.
- byte[] ReadSectors(ulong sectorAddress, uint length);
-
- ///
- /// Reads tag from several sectors.
- ///
- /// The sectors tag.
- /// Starting sector address (LBA).
- /// How many sectors to read.
- /// Tag type.
- byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag);
-
- ///
- /// Reads a complete sector (user data + all tags).
- ///
- /// The complete sector. Format depends on disk type.
- /// Sector address (LBA).
- byte[] ReadSectorLong(ulong sectorAddress);
-
- ///
- /// Reads several complete sector (user data + all tags).
- ///
- /// The complete sectors. Format depends on disk type.
- /// Starting sector address (LBA).
- /// How many sectors to read.
- byte[] ReadSectorsLong(ulong sectorAddress, uint length);
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.CommonTypes/Interfaces/IOpticalMediaImage.cs b/DiscImageChef.CommonTypes/Interfaces/IOpticalMediaImage.cs
deleted file mode 100644
index 7cb50c838..000000000
--- a/DiscImageChef.CommonTypes/Interfaces/IOpticalMediaImage.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-// /***************************************************************************
-// 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, IVerifiableSectorsImage
- {
- ///
- /// Gets the disc track extents (start, length).
- ///
- /// The track extents.
- List