diff --git a/Enums/DeviceType.cs b/Enums/DeviceType.cs
index 368d32f..79a5b11 100644
--- a/Enums/DeviceType.cs
+++ b/Enums/DeviceType.cs
@@ -40,12 +40,8 @@ namespace DiscImageChef.CommonTypes.Enums
{
public enum DeviceType
{
- Unknown = -1,
- ATA = 1,
- ATAPI = 2,
- SCSI = 3,
- SecureDigital = 4,
- MMC = 5,
- NVMe = 6
+ Unknown = -1, ATA = 1, ATAPI = 2,
+ SCSI = 3, SecureDigital = 4, MMC = 5,
+ NVMe = 6
}
}
\ No newline at end of file
diff --git a/Enums/ErrorNumber.cs b/Enums/ErrorNumber.cs
index 29d8d00..0b652dc 100644
--- a/Enums/ErrorNumber.cs
+++ b/Enums/ErrorNumber.cs
@@ -38,78 +38,43 @@
namespace DiscImageChef.CommonTypes.Enums
{
- ///
- /// Enumerates error codes. Positive for warnings or informative codes, negative for errors.
- ///
+ /// 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
+ 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/Enums/Images.cs b/Enums/Images.cs
index 478e423..f56c606 100644
--- a/Enums/Images.cs
+++ b/Enums/Images.cs
@@ -40,263 +40,136 @@ using System;
namespace DiscImageChef.CommonTypes.Enums
{
- ///
- /// Track (as partitioning element) types.
- ///
+ /// 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
+ 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
- ///
+ /// 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
- ///
+ /// 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").
- ///
+ /// 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)
+ 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.
- ///
+ /// 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,
- ///
+ 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
+ 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
- ///
+ /// 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
- ///
+ /// 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
}
@@ -305,12 +178,9 @@ namespace DiscImageChef.CommonTypes.Enums
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.
+ FourChannel = 0x08, /// Track is non-audio (data).
+ DataTrack = 0x04, /// Track is copy protected.
+ CopyPermitted = 0x02, /// Track has pre-emphasis.
PreEmphasis = 0x01
}
@@ -319,16 +189,12 @@ namespace DiscImageChef.CommonTypes.Enums
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.
+ 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.
+ 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
@@ -337,16 +203,11 @@ namespace DiscImageChef.CommonTypes.Enums
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
+ Floppy, /// 5.25" floppy
+ MiniFloppy, /// 3.5" floppy
+ MicroFloppy, /// 3" floppy
+ CompactFloppy, /// 5.25" twiggy
+ FileWare, /// 2.5" quickdisk
QuickDisk
}
@@ -355,10 +216,8 @@ namespace DiscImageChef.CommonTypes.Enums
/// 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).
+ 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/Exceptions/Images.cs b/Exceptions/Images.cs
index f684a17..e557957 100644
--- a/Exceptions/Images.cs
+++ b/Exceptions/Images.cs
@@ -41,154 +41,119 @@ using System.Runtime.Serialization;
namespace DiscImageChef.CommonTypes.Exceptions
{
- ///
- /// Feature is supported by image but not implemented yet.
- ///
+ /// Feature is supported by image but not implemented yet.
[Serializable]
public class FeatureSupportedButNotImplementedImageException : Exception
{
- ///
- /// Feature is supported by image but not implemented yet.
- ///
+ /// 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.
- ///
+ /// 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.
- ///
+ /// 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));
+ if(info == null)
+ throw new ArgumentNullException(nameof(info));
}
}
- ///
- /// Feature is not supported by image.
- ///
+ /// Feature is not supported by image.
[Serializable]
public class FeatureUnsupportedImageException : Exception
{
- ///
- /// Feature is not supported by image.
- ///
+ /// Feature is not supported by image.
/// Message.
/// Inner.
public FeatureUnsupportedImageException(string message, Exception inner) : base(message, inner) { }
- ///
- /// Feature is not supported by image.
- ///
+ /// Feature is not supported by image.
/// Message.
public FeatureUnsupportedImageException(string message) : base(message) { }
- ///
- /// Feature is not supported by image.
- ///
+ /// Feature is not supported by image.
/// Info.
/// Context.
protected FeatureUnsupportedImageException(SerializationInfo info, StreamingContext context)
{
- if(info == null) throw new ArgumentNullException(nameof(info));
+ if(info == null)
+ throw new ArgumentNullException(nameof(info));
}
}
- ///
- /// Feature is supported by image but not present on it.
- ///
+ /// 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.
- ///
+ /// 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.
- ///
+ /// 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.
- ///
+ /// 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));
+ if(info == null)
+ throw new ArgumentNullException(nameof(info));
}
}
- ///
- /// Feature is supported by image but not by the disc it represents.
- ///
+ /// 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.
- ///
+ /// 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.
- ///
+ /// 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.
- ///
+ /// 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));
+ if(info == null)
+ throw new ArgumentNullException(nameof(info));
}
}
- ///
- /// Corrupt, incorrect or unhandled feature found on image
- ///
+ /// Corrupt, incorrect or unhandled feature found on image
[Serializable]
public class ImageNotSupportedException : Exception
{
- ///
- /// Corrupt, incorrect or unhandled feature found on image
- ///
+ /// 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
- ///
+ /// Corrupt, incorrect or unhandled feature found on image
/// Message.
public ImageNotSupportedException(string message) : base(message) { }
- ///
- /// Corrupt, incorrect or unhandled feature found on image
- ///
+ /// Corrupt, incorrect or unhandled feature found on image
/// Info.
/// Context.
protected ImageNotSupportedException(SerializationInfo info, StreamingContext context)
{
- if(info == null) throw new ArgumentNullException(nameof(info));
+ if(info == null)
+ throw new ArgumentNullException(nameof(info));
}
}
}
\ No newline at end of file
diff --git a/Extents/ExtentsByte.cs b/Extents/ExtentsByte.cs
index 6227129..33464c6 100644
--- a/Extents/ExtentsByte.cs
+++ b/Extents/ExtentsByte.cs
@@ -42,38 +42,22 @@ using System.Linq;
namespace DiscImageChef.CommonTypes.Extents
{
- ///
- /// Implements extents for
- ///
+ /// Implements extents for
public class ExtentsByte
{
List> backend;
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsByte()
- {
- backend = new List>();
- }
+ /// Initialize an empty list of extents
+ public ExtentsByte() => backend = new List>();
- ///
- /// Initializes extents with an specific 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();
- }
+ public ExtentsByte(IEnumerable> list) => backend = list.OrderBy(t => t.Item1).ToList();
- ///
- /// Gets a count of how many extents are stored
- ///
+ /// 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
- ///
+ /// Adds the specified number to the corresponding extent, or creates a new one
///
public void Add(byte item)
{
@@ -84,34 +68,41 @@ namespace DiscImageChef.CommonTypes.Extents
for(int i = 0; i < backend.Count; i++)
{
// Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
+ 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)
+ 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);
+ else
+ itemToAdd = new Tuple(item, backend[i].Item2);
break;
}
// Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
+ if(item != backend[i].Item2 + 1)
+ continue;
removeOne = backend[i];
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
+ 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);
+ else
+ itemToAdd = new Tuple(backend[i].Item1, item);
break;
}
@@ -122,15 +113,14 @@ namespace DiscImageChef.CommonTypes.Extents
backend.Remove(removeTwo);
backend.Add(itemToAdd);
}
- else backend.Add(new Tuple(item, item));
+ else
+ backend.Add(new Tuple(item, item));
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
}
- ///
- /// Adds a new extent
- ///
+ /// Adds a new extent
/// First element of the extent
///
/// Last element of the extent or if is true how many elements the extent runs
@@ -140,34 +130,26 @@ namespace DiscImageChef.CommonTypes.Extents
public void Add(byte start, byte end, bool run = false)
{
byte realEnd;
- if(run) realEnd = (byte)(start + end - 1);
- else realEnd = end;
+
+ if(run)
+ realEnd = (byte)(start + end - 1);
+ else
+ realEnd = end;
// TODO: Optimize this
- for(byte t = start; t <= realEnd; t++) Add(t);
+ for(byte t = start; t <= realEnd; t++)
+ Add(t);
}
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
+ /// 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);
- }
+ public bool Contains(byte item) => backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
+ /// Removes all extents from this instance
+ public void Clear() => backend.Clear();
- ///
- /// Removes an item from the extents in this instance
- ///
+ /// 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)
@@ -179,43 +161,57 @@ namespace DiscImageChef.CommonTypes.Extents
foreach(Tuple extent in backend)
{
// Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
+ 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)
+ 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)
+ 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;
+ if(item != extent.Item1 ||
+ item != extent.Item2)
+ continue;
toRemove = extent;
+
break;
}
// Item not found
- if(toRemove == null) return false;
+ if(toRemove == null)
+ return false;
backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
+
+ if(toAddOne != null)
+ backend.Add(toAddOne);
+
+ if(toAddTwo != null)
+ backend.Add(toAddTwo);
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
@@ -224,24 +220,24 @@ namespace DiscImageChef.CommonTypes.Extents
}
///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
+ /// 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
- ///
+ /// 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;
}
diff --git a/Extents/ExtentsConverter.cs b/Extents/ExtentsConverter.cs
index 995942d..9a56f73 100644
--- a/Extents/ExtentsConverter.cs
+++ b/Extents/ExtentsConverter.cs
@@ -47,20 +47,25 @@ namespace DiscImageChef.CommonTypes.Extents
{
public static ExtentType[] ToMetadata(ExtentsULong extents)
{
- if(extents == null) return null;
+ 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};
+ 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;
+ if(extents == null)
+ return null;
List> tuples =
extents.Select(extent => new Tuple(extent.Start, extent.End)).ToList();
diff --git a/Extents/ExtentsInt.cs b/Extents/ExtentsInt.cs
index 5c1fd40..02b6b2b 100644
--- a/Extents/ExtentsInt.cs
+++ b/Extents/ExtentsInt.cs
@@ -42,38 +42,22 @@ using System.Linq;
namespace DiscImageChef.CommonTypes.Extents
{
- ///
- /// Implements extents for
- ///
+ /// Implements extents for
public class ExtentsInt
{
List> backend;
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsInt()
- {
- backend = new List>();
- }
+ /// Initialize an empty list of extents
+ public ExtentsInt() => backend = new List>();
- ///
- /// Initializes extents with an specific 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();
- }
+ public ExtentsInt(IEnumerable> list) => backend = list.OrderBy(t => t.Item1).ToList();
- ///
- /// Gets a count of how many extents are stored
- ///
+ /// 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
- ///
+ /// Adds the specified number to the corresponding extent, or creates a new one
///
public void Add(int item)
{
@@ -84,34 +68,41 @@ namespace DiscImageChef.CommonTypes.Extents
for(int i = 0; i < backend.Count; i++)
{
// Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
+ 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)
+ 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);
+ else
+ itemToAdd = new Tuple(item, backend[i].Item2);
break;
}
// Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
+ if(item != backend[i].Item2 + 1)
+ continue;
removeOne = backend[i];
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
+ 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);
+ else
+ itemToAdd = new Tuple(backend[i].Item1, item);
break;
}
@@ -122,15 +113,14 @@ namespace DiscImageChef.CommonTypes.Extents
backend.Remove(removeTwo);
backend.Add(itemToAdd);
}
- else backend.Add(new Tuple(item, item));
+ else
+ backend.Add(new Tuple(item, item));
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
}
- ///
- /// Adds a new extent
- ///
+ /// Adds a new extent
/// First element of the extent
///
/// Last element of the extent or if is true how many elements the extent runs
@@ -140,34 +130,26 @@ namespace DiscImageChef.CommonTypes.Extents
public void Add(int start, int end, bool run = false)
{
int realEnd;
- if(run) realEnd = start + end - 1;
- else realEnd = end;
+
+ if(run)
+ realEnd = start + end - 1;
+ else
+ realEnd = end;
// TODO: Optimize this
- for(int t = start; t <= realEnd; t++) Add(t);
+ for(int t = start; t <= realEnd; t++)
+ Add(t);
}
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
+ /// 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);
- }
+ public bool Contains(int item) => backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
+ /// Removes all extents from this instance
+ public void Clear() => backend.Clear();
- ///
- /// Removes an item from the extents in this instance
- ///
+ /// 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)
@@ -179,43 +161,57 @@ namespace DiscImageChef.CommonTypes.Extents
foreach(Tuple extent in backend)
{
// Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
+ 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)
+ 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)
+ 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;
+ if(item != extent.Item1 ||
+ item != extent.Item2)
+ continue;
toRemove = extent;
+
break;
}
// Item not found
- if(toRemove == null) return false;
+ if(toRemove == null)
+ return false;
backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
+
+ if(toAddOne != null)
+ backend.Add(toAddOne);
+
+ if(toAddTwo != null)
+ backend.Add(toAddTwo);
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
@@ -224,24 +220,24 @@ namespace DiscImageChef.CommonTypes.Extents
}
///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
+ /// 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
- ///
+ /// 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;
}
diff --git a/Extents/ExtentsLong.cs b/Extents/ExtentsLong.cs
index cda536f..1b8c8cb 100644
--- a/Extents/ExtentsLong.cs
+++ b/Extents/ExtentsLong.cs
@@ -42,38 +42,22 @@ using System.Linq;
namespace DiscImageChef.CommonTypes.Extents
{
- ///
- /// Implements extents for
- ///
+ /// Implements extents for
public class ExtentsLong
{
List> backend;
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsLong()
- {
- backend = new List>();
- }
+ /// Initialize an empty list of extents
+ public ExtentsLong() => backend = new List>();
- ///
- /// Initializes extents with an specific 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();
- }
+ public ExtentsLong(IEnumerable> list) => backend = list.OrderBy(t => t.Item1).ToList();
- ///
- /// Gets a count of how many extents are stored
- ///
+ /// 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
- ///
+ /// Adds the specified number to the corresponding extent, or creates a new one
///
public void Add(long item)
{
@@ -84,34 +68,41 @@ namespace DiscImageChef.CommonTypes.Extents
for(int i = 0; i < backend.Count; i++)
{
// Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
+ 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)
+ 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);
+ else
+ itemToAdd = new Tuple(item, backend[i].Item2);
break;
}
// Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
+ if(item != backend[i].Item2 + 1)
+ continue;
removeOne = backend[i];
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
+ 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);
+ else
+ itemToAdd = new Tuple(backend[i].Item1, item);
break;
}
@@ -122,15 +113,14 @@ namespace DiscImageChef.CommonTypes.Extents
backend.Remove(removeTwo);
backend.Add(itemToAdd);
}
- else backend.Add(new Tuple(item, item));
+ else
+ backend.Add(new Tuple(item, item));
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
}
- ///
- /// Adds a new extent
- ///
+ /// Adds a new extent
/// First element of the extent
///
/// Last element of the extent or if is true how many elements the extent runs
@@ -140,34 +130,26 @@ namespace DiscImageChef.CommonTypes.Extents
public void Add(long start, long end, bool run = false)
{
long realEnd;
- if(run) realEnd = start + end - 1;
- else realEnd = end;
+
+ if(run)
+ realEnd = start + end - 1;
+ else
+ realEnd = end;
// TODO: Optimize this
- for(long t = start; t <= realEnd; t++) Add(t);
+ for(long t = start; t <= realEnd; t++)
+ Add(t);
}
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
+ /// 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);
- }
+ public bool Contains(long item) => backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
+ /// Removes all extents from this instance
+ public void Clear() => backend.Clear();
- ///
- /// Removes an item from the extents in this instance
- ///
+ /// 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)
@@ -179,43 +161,57 @@ namespace DiscImageChef.CommonTypes.Extents
foreach(Tuple extent in backend)
{
// Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
+ 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)
+ 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)
+ 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;
+ if(item != extent.Item1 ||
+ item != extent.Item2)
+ continue;
toRemove = extent;
+
break;
}
// Item not found
- if(toRemove == null) return false;
+ if(toRemove == null)
+ return false;
backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
+
+ if(toAddOne != null)
+ backend.Add(toAddOne);
+
+ if(toAddTwo != null)
+ backend.Add(toAddTwo);
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
@@ -224,24 +220,24 @@ namespace DiscImageChef.CommonTypes.Extents
}
///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
+ /// 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
- ///
+ /// 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;
}
diff --git a/Extents/ExtentsSByte.cs b/Extents/ExtentsSByte.cs
index 31a23e0..41c21f9 100644
--- a/Extents/ExtentsSByte.cs
+++ b/Extents/ExtentsSByte.cs
@@ -42,38 +42,22 @@ using System.Linq;
namespace DiscImageChef.CommonTypes.Extents
{
- ///
- /// Implements extents for
- ///
+ /// Implements extents for
public class ExtentsSByte
{
List> backend;
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsSByte()
- {
- backend = new List>();
- }
+ /// Initialize an empty list of extents
+ public ExtentsSByte() => backend = new List>();
- ///
- /// Initializes extents with an specific 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();
- }
+ public ExtentsSByte(IEnumerable> list) => backend = list.OrderBy(t => t.Item1).ToList();
- ///
- /// Gets a count of how many extents are stored
- ///
+ /// 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
- ///
+ /// Adds the specified number to the corresponding extent, or creates a new one
///
public void Add(sbyte item)
{
@@ -84,34 +68,41 @@ namespace DiscImageChef.CommonTypes.Extents
for(int i = 0; i < backend.Count; i++)
{
// Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
+ 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)
+ 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);
+ else
+ itemToAdd = new Tuple(item, backend[i].Item2);
break;
}
// Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
+ if(item != backend[i].Item2 + 1)
+ continue;
removeOne = backend[i];
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
+ 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);
+ else
+ itemToAdd = new Tuple(backend[i].Item1, item);
break;
}
@@ -122,15 +113,14 @@ namespace DiscImageChef.CommonTypes.Extents
backend.Remove(removeTwo);
backend.Add(itemToAdd);
}
- else backend.Add(new Tuple(item, item));
+ else
+ backend.Add(new Tuple(item, item));
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
}
- ///
- /// Adds a new extent
- ///
+ /// Adds a new extent
/// First element of the extent
///
/// Last element of the extent or if is true how many elements the extent runs
@@ -140,34 +130,26 @@ namespace DiscImageChef.CommonTypes.Extents
public void Add(sbyte start, sbyte end, bool run = false)
{
sbyte realEnd;
- if(run) realEnd = (sbyte)(start + end - 1);
- else realEnd = end;
+
+ if(run)
+ realEnd = (sbyte)(start + end - 1);
+ else
+ realEnd = end;
// TODO: Optimize this
- for(sbyte t = start; t <= realEnd; t++) Add(t);
+ for(sbyte t = start; t <= realEnd; t++)
+ Add(t);
}
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
+ /// 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);
- }
+ public bool Contains(sbyte item) => backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
+ /// Removes all extents from this instance
+ public void Clear() => backend.Clear();
- ///
- /// Removes an item from the extents in this instance
- ///
+ /// 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)
@@ -179,43 +161,57 @@ namespace DiscImageChef.CommonTypes.Extents
foreach(Tuple extent in backend)
{
// Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
+ 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)
+ 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)
+ 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;
+ if(item != extent.Item1 ||
+ item != extent.Item2)
+ continue;
toRemove = extent;
+
break;
}
// Item not found
- if(toRemove == null) return false;
+ if(toRemove == null)
+ return false;
backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
+
+ if(toAddOne != null)
+ backend.Add(toAddOne);
+
+ if(toAddTwo != null)
+ backend.Add(toAddTwo);
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
@@ -224,24 +220,24 @@ namespace DiscImageChef.CommonTypes.Extents
}
///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
+ /// 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
- ///
+ /// 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;
}
diff --git a/Extents/ExtentsShort.cs b/Extents/ExtentsShort.cs
index 5e09cd3..38f01ed 100644
--- a/Extents/ExtentsShort.cs
+++ b/Extents/ExtentsShort.cs
@@ -42,38 +42,22 @@ using System.Linq;
namespace DiscImageChef.CommonTypes.Extents
{
- ///
- /// Implements extents for
- ///
+ /// Implements extents for
public class ExtentsShort
{
List> backend;
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsShort()
- {
- backend = new List>();
- }
+ /// Initialize an empty list of extents
+ public ExtentsShort() => backend = new List>();
- ///
- /// Initializes extents with an specific 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();
- }
+ public ExtentsShort(IEnumerable> list) => backend = list.OrderBy(t => t.Item1).ToList();
- ///
- /// Gets a count of how many extents are stored
- ///
+ /// 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
- ///
+ /// Adds the specified number to the corresponding extent, or creates a new one
///
public void Add(short item)
{
@@ -84,34 +68,41 @@ namespace DiscImageChef.CommonTypes.Extents
for(int i = 0; i < backend.Count; i++)
{
// Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
+ 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)
+ 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);
+ else
+ itemToAdd = new Tuple(item, backend[i].Item2);
break;
}
// Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
+ if(item != backend[i].Item2 + 1)
+ continue;
removeOne = backend[i];
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
+ 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);
+ else
+ itemToAdd = new Tuple(backend[i].Item1, item);
break;
}
@@ -122,15 +113,14 @@ namespace DiscImageChef.CommonTypes.Extents
backend.Remove(removeTwo);
backend.Add(itemToAdd);
}
- else backend.Add(new Tuple(item, item));
+ else
+ backend.Add(new Tuple(item, item));
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
}
- ///
- /// Adds a new extent
- ///
+ /// Adds a new extent
/// First element of the extent
///
/// Last element of the extent or if is true how many elements the extent runs
@@ -140,34 +130,26 @@ namespace DiscImageChef.CommonTypes.Extents
public void Add(short start, short end, bool run = false)
{
short realEnd;
- if(run) realEnd = (short)(start + end - 1);
- else realEnd = end;
+
+ if(run)
+ realEnd = (short)(start + end - 1);
+ else
+ realEnd = end;
// TODO: Optimize this
- for(short t = start; t <= realEnd; t++) Add(t);
+ for(short t = start; t <= realEnd; t++)
+ Add(t);
}
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
+ /// 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);
- }
+ public bool Contains(short item) => backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
+ /// Removes all extents from this instance
+ public void Clear() => backend.Clear();
- ///
- /// Removes an item from the extents in this instance
- ///
+ /// 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)
@@ -179,43 +161,57 @@ namespace DiscImageChef.CommonTypes.Extents
foreach(Tuple extent in backend)
{
// Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
+ 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)
+ 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)
+ 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;
+ if(item != extent.Item1 ||
+ item != extent.Item2)
+ continue;
toRemove = extent;
+
break;
}
// Item not found
- if(toRemove == null) return false;
+ if(toRemove == null)
+ return false;
backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
+
+ if(toAddOne != null)
+ backend.Add(toAddOne);
+
+ if(toAddTwo != null)
+ backend.Add(toAddTwo);
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
@@ -224,24 +220,24 @@ namespace DiscImageChef.CommonTypes.Extents
}
///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
+ /// 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
- ///
+ /// 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;
}
diff --git a/Extents/ExtentsUInt.cs b/Extents/ExtentsUInt.cs
index 2c80f79..9cc8b4e 100644
--- a/Extents/ExtentsUInt.cs
+++ b/Extents/ExtentsUInt.cs
@@ -42,38 +42,22 @@ using System.Linq;
namespace DiscImageChef.CommonTypes.Extents
{
- ///
- /// Implements extents for
- ///
+ /// Implements extents for
public class ExtentsUInt
{
List> backend;
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsUInt()
- {
- backend = new List>();
- }
+ /// Initialize an empty list of extents
+ public ExtentsUInt() => backend = new List>();
- ///
- /// Initializes extents with an specific 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();
- }
+ public ExtentsUInt(IEnumerable> list) => backend = list.OrderBy(t => t.Item1).ToList();
- ///
- /// Gets a count of how many extents are stored
- ///
+ /// 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
- ///
+ /// Adds the specified number to the corresponding extent, or creates a new one
///
public void Add(uint item)
{
@@ -84,34 +68,41 @@ namespace DiscImageChef.CommonTypes.Extents
for(int i = 0; i < backend.Count; i++)
{
// Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
+ 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)
+ 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);
+ else
+ itemToAdd = new Tuple(item, backend[i].Item2);
break;
}
// Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
+ if(item != backend[i].Item2 + 1)
+ continue;
removeOne = backend[i];
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
+ 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);
+ else
+ itemToAdd = new Tuple(backend[i].Item1, item);
break;
}
@@ -122,15 +113,14 @@ namespace DiscImageChef.CommonTypes.Extents
backend.Remove(removeTwo);
backend.Add(itemToAdd);
}
- else backend.Add(new Tuple(item, item));
+ else
+ backend.Add(new Tuple(item, item));
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
}
- ///
- /// Adds a new extent
- ///
+ /// Adds a new extent
/// First element of the extent
///
/// Last element of the extent or if is true how many elements the extent runs
@@ -140,34 +130,26 @@ namespace DiscImageChef.CommonTypes.Extents
public void Add(uint start, uint end, bool run = false)
{
uint realEnd;
- if(run) realEnd = start + end - 1;
- else realEnd = end;
+
+ if(run)
+ realEnd = start + end - 1;
+ else
+ realEnd = end;
// TODO: Optimize this
- for(uint t = start; t <= realEnd; t++) Add(t);
+ for(uint t = start; t <= realEnd; t++)
+ Add(t);
}
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
+ /// 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);
- }
+ public bool Contains(uint item) => backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
+ /// Removes all extents from this instance
+ public void Clear() => backend.Clear();
- ///
- /// Removes an item from the extents in this instance
- ///
+ /// 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)
@@ -179,43 +161,57 @@ namespace DiscImageChef.CommonTypes.Extents
foreach(Tuple extent in backend)
{
// Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
+ 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)
+ 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)
+ 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;
+ if(item != extent.Item1 ||
+ item != extent.Item2)
+ continue;
toRemove = extent;
+
break;
}
// Item not found
- if(toRemove == null) return false;
+ if(toRemove == null)
+ return false;
backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
+
+ if(toAddOne != null)
+ backend.Add(toAddOne);
+
+ if(toAddTwo != null)
+ backend.Add(toAddTwo);
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
@@ -224,24 +220,24 @@ namespace DiscImageChef.CommonTypes.Extents
}
///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
+ /// 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
- ///
+ /// 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;
}
diff --git a/Extents/ExtentsULong.cs b/Extents/ExtentsULong.cs
index 8540a0a..2d68199 100644
--- a/Extents/ExtentsULong.cs
+++ b/Extents/ExtentsULong.cs
@@ -42,38 +42,22 @@ using System.Linq;
namespace DiscImageChef.CommonTypes.Extents
{
- ///
- /// Implements extents for
- ///
+ /// Implements extents for
public class ExtentsULong
{
List> backend;
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsULong()
- {
- backend = new List>();
- }
+ /// Initialize an empty list of extents
+ public ExtentsULong() => backend = new List>();
- ///
- /// Initializes extents with an specific 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();
- }
+ public ExtentsULong(IEnumerable> list) => backend = list.OrderBy(t => t.Item1).ToList();
- ///
- /// Gets a count of how many extents are stored
- ///
+ /// 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
- ///
+ /// Adds the specified number to the corresponding extent, or creates a new one
///
public void Add(ulong item)
{
@@ -84,34 +68,41 @@ namespace DiscImageChef.CommonTypes.Extents
for(int i = 0; i < backend.Count; i++)
{
// Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
+ 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)
+ 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);
+ else
+ itemToAdd = new Tuple(item, backend[i].Item2);
break;
}
// Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
+ if(item != backend[i].Item2 + 1)
+ continue;
removeOne = backend[i];
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
+ 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);
+ else
+ itemToAdd = new Tuple(backend[i].Item1, item);
break;
}
@@ -122,15 +113,14 @@ namespace DiscImageChef.CommonTypes.Extents
backend.Remove(removeTwo);
backend.Add(itemToAdd);
}
- else backend.Add(new Tuple(item, item));
+ else
+ backend.Add(new Tuple(item, item));
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
}
- ///
- /// Adds a new extent
- ///
+ /// Adds a new extent
/// First element of the extent
///
/// Last element of the extent or if is true how many elements the extent runs
@@ -140,34 +130,26 @@ namespace DiscImageChef.CommonTypes.Extents
public void Add(ulong start, ulong end, bool run = false)
{
ulong realEnd;
- if(run) realEnd = start + end - 1;
- else realEnd = end;
+
+ if(run)
+ realEnd = start + end - 1;
+ else
+ realEnd = end;
// TODO: Optimize this
- for(ulong t = start; t <= realEnd; t++) Add(t);
+ for(ulong t = start; t <= realEnd; t++)
+ Add(t);
}
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
+ /// 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);
- }
+ public bool Contains(ulong item) => backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
+ /// Removes all extents from this instance
+ public void Clear() => backend.Clear();
- ///
- /// Removes an item from the extents in this instance
- ///
+ /// 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)
@@ -179,43 +161,57 @@ namespace DiscImageChef.CommonTypes.Extents
foreach(Tuple extent in backend)
{
// Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
+ 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)
+ 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)
+ 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;
+ if(item != extent.Item1 ||
+ item != extent.Item2)
+ continue;
toRemove = extent;
+
break;
}
// Item not found
- if(toRemove == null) return false;
+ if(toRemove == null)
+ return false;
backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
+
+ if(toAddOne != null)
+ backend.Add(toAddOne);
+
+ if(toAddTwo != null)
+ backend.Add(toAddTwo);
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
@@ -224,24 +220,24 @@ namespace DiscImageChef.CommonTypes.Extents
}
///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
+ /// 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
- ///
+ /// 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;
}
diff --git a/Extents/ExtentsUShort.cs b/Extents/ExtentsUShort.cs
index cec53bb..fa8889a 100644
--- a/Extents/ExtentsUShort.cs
+++ b/Extents/ExtentsUShort.cs
@@ -42,38 +42,22 @@ using System.Linq;
namespace DiscImageChef.CommonTypes.Extents
{
- ///
- /// Implements extents for
- ///
+ /// Implements extents for
public class ExtentsUShort
{
List> backend;
- ///
- /// Initialize an empty list of extents
- ///
- public ExtentsUShort()
- {
- backend = new List>();
- }
+ /// Initialize an empty list of extents
+ public ExtentsUShort() => backend = new List>();
- ///
- /// Initializes extents with an specific 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();
- }
+ public ExtentsUShort(IEnumerable> list) => backend = list.OrderBy(t => t.Item1).ToList();
- ///
- /// Gets a count of how many extents are stored
- ///
+ /// 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
- ///
+ /// Adds the specified number to the corresponding extent, or creates a new one
///
public void Add(ushort item)
{
@@ -84,34 +68,41 @@ namespace DiscImageChef.CommonTypes.Extents
for(int i = 0; i < backend.Count; i++)
{
// Already contained in an extent
- if(item >= backend[i].Item1 && item <= backend[i].Item2) return;
+ 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)
+ 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);
+ else
+ itemToAdd = new Tuple(item, backend[i].Item2);
break;
}
// Expands existing extent end
- if(item != backend[i].Item2 + 1) continue;
+ if(item != backend[i].Item2 + 1)
+ continue;
removeOne = backend[i];
- if(i < backend.Count - 1 && item == backend[i + 1].Item1 - 1)
+ 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);
+ else
+ itemToAdd = new Tuple(backend[i].Item1, item);
break;
}
@@ -122,15 +113,14 @@ namespace DiscImageChef.CommonTypes.Extents
backend.Remove(removeTwo);
backend.Add(itemToAdd);
}
- else backend.Add(new Tuple(item, item));
+ else
+ backend.Add(new Tuple(item, item));
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
}
- ///
- /// Adds a new extent
- ///
+ /// Adds a new extent
/// First element of the extent
///
/// Last element of the extent or if is true how many elements the extent runs
@@ -140,34 +130,26 @@ namespace DiscImageChef.CommonTypes.Extents
public void Add(ushort start, ushort end, bool run = false)
{
ushort realEnd;
- if(run) realEnd = (ushort)(start + end - 1);
- else realEnd = end;
+
+ if(run)
+ realEnd = (ushort)(start + end - 1);
+ else
+ realEnd = end;
// TODO: Optimize this
- for(ushort t = start; t <= realEnd; t++) Add(t);
+ for(ushort t = start; t <= realEnd; t++)
+ Add(t);
}
- ///
- /// Checks if the specified item is contained by an extent on this instance
- ///
+ /// 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);
- }
+ public bool Contains(ushort item) => backend.Any(extent => item >= extent.Item1 && item <= extent.Item2);
- ///
- /// Removes all extents from this instance
- ///
- public void Clear()
- {
- backend.Clear();
- }
+ /// Removes all extents from this instance
+ public void Clear() => backend.Clear();
- ///
- /// Removes an item from the extents in this instance
- ///
+ /// 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)
@@ -179,43 +161,57 @@ namespace DiscImageChef.CommonTypes.Extents
foreach(Tuple extent in backend)
{
// Extent is contained and not a border
- if(item > extent.Item1 && item < extent.Item2)
+ 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)
+ 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)
+ 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;
+ if(item != extent.Item1 ||
+ item != extent.Item2)
+ continue;
toRemove = extent;
+
break;
}
// Item not found
- if(toRemove == null) return false;
+ if(toRemove == null)
+ return false;
backend.Remove(toRemove);
- if(toAddOne != null) backend.Add(toAddOne);
- if(toAddTwo != null) backend.Add(toAddTwo);
+
+ if(toAddOne != null)
+ backend.Add(toAddOne);
+
+ if(toAddTwo != null)
+ backend.Add(toAddTwo);
// Sort
backend = backend.OrderBy(t => t.Item1).ToList();
@@ -224,25 +220,25 @@ namespace DiscImageChef.CommonTypes.Extents
}
///
- /// Converts the list of extents to an array of where T1 is first element of the extent and T2 is
- /// last element
+ /// 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
- ///
+ /// 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))
+
+ foreach(Tuple extent in backend.Where(extent =>
+ item >= extent.Item1 && item <= extent.Item2))
{
start = extent.Item1;
+
return true;
}
diff --git a/Filters.cs b/Filters.cs
index 297c438..80e2985 100644
--- a/Filters.cs
+++ b/Filters.cs
@@ -50,9 +50,7 @@ namespace DiscImageChef.CommonTypes
{
public SortedDictionary Filters;
- ///
- /// Fills the list of all known filters
- ///
+ /// Fills the list of all known filters
public FiltersList()
{
Assembly assembly = Assembly.Load("DiscImageChef.Filters");
@@ -61,16 +59,20 @@ namespace DiscImageChef.CommonTypes
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()))
+ var 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); }
+ catch(Exception exception)
+ {
+ DicConsole.ErrorWriteLine("Exception {0}", exception);
+ }
}
- ///
- /// Gets the filter that allows to read the specified path
- ///
+ /// Gets the filter that allows to read the specified path
/// Path
/// The filter that allows reading the specified path
public IFilter GetFilter(string path)
@@ -78,33 +80,38 @@ namespace DiscImageChef.CommonTypes
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;
+ if(!filter.Identify(path))
+ continue;
- IFilter foundFilter =
- (IFilter)filter.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
+ var foundFilter = (IFilter)filter.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
+ { });
foundFilter?.Open(path);
- if(foundFilter?.IsOpened() == true) return foundFilter;
+ if(foundFilter?.IsOpened() == true)
+ return foundFilter;
}
else
noFilter = filter;
- if(!noFilter?.Identify(path) == true) return noFilter;
+ if(!noFilter?.Identify(path) == true)
+ return noFilter;
noFilter?.Open(path);
return noFilter;
}
- catch(IOException) { return null; }
+ catch(IOException)
+ {
+ return null;
+ }
}
- ///
- /// Gets all known filters
- ///
+ /// Gets all known filters
/// Known filters
public SortedDictionary GetFiltersList() => Filters;
}
diff --git a/Geometry.cs b/Geometry.cs
index 6ea5509..c5de22d 100644
--- a/Geometry.cs
+++ b/Geometry.cs
@@ -42,7 +42,7 @@ namespace DiscImageChef.CommonTypes
{
public static class Geometry
{
- static readonly (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding
+ 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),
@@ -107,6 +107,7 @@ namespace DiscImageChef.CommonTypes
(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),
@@ -117,18 +118,18 @@ namespace DiscImageChef.CommonTypes
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();
+ 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) =>
+ 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/Interfaces/IArchive.cs b/Interfaces/IArchive.cs
index b71dab4..098ebc7 100644
--- a/Interfaces/IArchive.cs
+++ b/Interfaces/IArchive.cs
@@ -32,54 +32,34 @@
// ****************************************************************************/
using System;
-using System.IO;
using System.Collections.Generic;
+using System.IO;
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.
+ /// 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.
///
- SupportsFilenames = 1 << 0,
+ 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
- ///
- /// 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,
- };
+ /// If this flag is set, the archive supports returning extended attributes (Xattrs) for each entry.
+ SupportsXAttrs = 1 << 6
+ }
public interface IArchive
{
@@ -89,39 +69,27 @@ namespace DiscImageChef.CommonTypes.Interfaces
/// Unique UUID of the plugin
Guid Id { get; }
- ///
- /// Identifies if the specified path contains data recognizable by this archive instance
- ///
+ /// 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
- ///
+ /// 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
- ///
+ /// 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
- ///
+ /// Opens the specified path with this archive instance
/// Path.
void Open(string path);
- ///
- /// Opens the specified stream with this archive instance
- ///
+ /// Opens the specified stream with this archive instance
/// Stream.
void Open(Stream stream);
- ///
- /// Opens the specified buffer with this archive instance
- ///
+ /// Opens the specified buffer with this archive instance
/// Buffer.
void Open(byte[] buffer);
@@ -131,123 +99,95 @@ namespace DiscImageChef.CommonTypes.Interfaces
///
bool IsOpened();
- ///
- /// Closes all opened streams.
- ///
+ /// Closes all opened streams.
void Close();
- ///
- /// Return a bitfield indicating the features supported by this archive type.
- ///
+ /// 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.
+ /// 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.
- ///
+ /// 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!
+ /// 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.
- ///
+ /// 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 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.
+ /// 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 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.
- ///
+ /// 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.
- ///
- ///
+ /// 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.
- ///
+ /// 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.
- ///
- ///
+ /// 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.
- ///
- ///
+ /// 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.
- ///
+ /// 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.
- ///
+ /// 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.
- ///
- ///
- ///
+ /// 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.)
+ /// 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);
}
-}
-
+}
\ No newline at end of file
diff --git a/Interfaces/IChecksum.cs b/Interfaces/IChecksum.cs
index b1f6bad..d5ed8eb 100644
--- a/Interfaces/IChecksum.cs
+++ b/Interfaces/IChecksum.cs
@@ -40,27 +40,19 @@ namespace DiscImageChef.CommonTypes.Interfaces
{
public interface IChecksum
{
- ///
- /// Updates the hash with data.
- ///
+ /// Updates the hash with data.
/// Data buffer.
/// Length of buffer to hash.
void Update(byte[] data, uint len);
- ///
- /// Updates the hash with data.
- ///
+ /// Updates the hash with data.
/// Data buffer.
void Update(byte[] data);
- ///
- /// Returns a byte array of the hash value.
- ///
+ /// Returns a byte array of the hash value.
byte[] Final();
- ///
- /// Returns a hexadecimal representation of the hash value.
- ///
+ /// Returns a hexadecimal representation of the hash value.
string End();
}
}
\ No newline at end of file
diff --git a/Interfaces/IFilesystem.cs b/Interfaces/IFilesystem.cs
index e5eeaf6..eccbe64 100644
--- a/Interfaces/IFilesystem.cs
+++ b/Interfaces/IFilesystem.cs
@@ -42,9 +42,7 @@ using Schemas;
namespace DiscImageChef.CommonTypes.Interfaces
{
- ///
- /// Interface to implement filesystem plugins.
- ///
+ /// Interface to implement filesystem plugins.
public interface IFilesystem
{
Encoding Encoding { get; }
@@ -52,25 +50,19 @@ namespace DiscImageChef.CommonTypes.Interfaces
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
/// 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
- ///
+ /// 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.
- ///
+ /// Gets information about the identified filesystem.
/// Disk image.
/// Partition.
/// Filesystem information.
diff --git a/Interfaces/IFilter.cs b/Interfaces/IFilter.cs
index a4b0714..94b9f5b 100644
--- a/Interfaces/IFilter.cs
+++ b/Interfaces/IFilter.cs
@@ -50,106 +50,80 @@ namespace DiscImageChef.CommonTypes.Interfaces
/// Plugin author
string Author { get; }
- ///
- /// Closes all opened streams.
- ///
+ /// 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
+ /// 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.
- ///
+ /// Gets creation time of file referenced by this filter.
/// The creation time.
DateTime GetCreationTime();
- ///
- /// Gets length of this filter's data fork.
- ///
+ /// Gets length of this filter's data fork.
/// The data fork length.
long GetDataForkLength();
- ///
- /// Gets a stream to access the data fork contents.
- ///
+ /// 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
+ /// 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.
- ///
+ /// Gets last write time of file referenced by this filter.
/// The last write time.
DateTime GetLastWriteTime();
- ///
- /// Gets length of file referenced by ths filter.
- ///
+ /// 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
+ /// 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
+ /// 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.
- ///
+ /// Gets length of this filter's resource fork.
/// The resource fork length.
long GetResourceForkLength();
- ///
- /// Gets a stream to access the resource fork contents.
- ///
+ /// 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
- ///
+ /// 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
- ///
+ /// 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
- ///
+ /// 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
- ///
+ /// Identifies if the specified buffer contains data recognizable by this filter instance
/// Buffer.
bool Identify(byte[] buffer);
@@ -159,21 +133,15 @@ namespace DiscImageChef.CommonTypes.Interfaces
///
bool IsOpened();
- ///
- /// Opens the specified path with this filter instance
- ///
+ /// Opens the specified path with this filter instance
/// Path.
void Open(string path);
- ///
- /// Opens the specified stream with this filter instance
- ///
+ /// Opens the specified stream with this filter instance
/// Stream.
void Open(Stream stream);
- ///
- /// Opens the specified buffer with this filter instance
- ///
+ /// Opens the specified buffer with this filter instance
/// Buffer.
void Open(byte[] buffer);
}
diff --git a/Interfaces/IFloppyImage.cs b/Interfaces/IFloppyImage.cs
index f7c675a..6b20c7d 100644
--- a/Interfaces/IFloppyImage.cs
+++ b/Interfaces/IFloppyImage.cs
@@ -42,10 +42,10 @@ 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.
+ /// 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
{
@@ -55,16 +55,13 @@ namespace DiscImageChef.CommonTypes.Interfaces
///
FloppyInfo FloppyInfo { get; }
- ///
- /// Reads a sector's user data.
- ///
+ /// 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.
+ /// 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).
@@ -72,16 +69,13 @@ namespace DiscImageChef.CommonTypes.Interfaces
/// Status of request.
byte[] ReadSector(ushort track, byte head, ushort sector, out FloppySectorStatus status);
- ///
- /// Reads a sector's tag.
- ///
+ /// 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.
+ /// 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).
@@ -89,24 +83,19 @@ namespace DiscImageChef.CommonTypes.Interfaces
/// 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.
- ///
+ /// 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.
- ///
+ /// 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.
+ /// 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).
@@ -114,17 +103,13 @@ namespace DiscImageChef.CommonTypes.Interfaces
/// Status of request.
byte[] ReadSectorLong(ushort track, byte head, ushort sector, out FloppySectorStatus status);
- ///
- /// Verifies a track.
- ///
+ /// 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.
- ///
+ /// 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).
diff --git a/Interfaces/IMediaImage.cs b/Interfaces/IMediaImage.cs
index b02a10e..04ef5f8 100644
--- a/Interfaces/IMediaImage.cs
+++ b/Interfaces/IMediaImage.cs
@@ -45,9 +45,7 @@ using Schemas;
namespace DiscImageChef.CommonTypes.Interfaces
{
- ///
- /// Abstract class to implement disk image reading plugins.
- ///
+ /// Abstract class to implement disk image reading plugins.
public interface IMediaImage
{
/// Image information
@@ -58,9 +56,7 @@ namespace DiscImageChef.CommonTypes.Interfaces
Guid Id { get; }
/// Plugin author
string Author { get; }
- ///
- /// Gets the image format.
- ///
+ /// Gets the image format.
/// The image format.
string Format { get; }
/// List of dump hardware used to create the image from real media
@@ -68,69 +64,51 @@ namespace DiscImageChef.CommonTypes.Interfaces
/// Gets the CICM XML metadata for the image
CICMMetadataType CicmMetadata { get; }
- ///
- /// Identifies the image.
- ///
+ /// Identifies the image.
/// true, if image was identified, false otherwise.
/// Image filter.
bool Identify(IFilter imageFilter);
- ///
- /// Opens the image.
- ///
+ /// Opens the image.
/// true, if image was opened, false otherwise.
/// Image filter.
bool Open(IFilter imageFilter);
- ///
- /// Reads a disk tag.
- ///
+ /// Reads a disk tag.
/// Disk tag
/// Tag type to read.
byte[] ReadDiskTag(MediaTagType tag);
- ///
- /// Reads a sector's user data.
- ///
+ /// Reads a sector's user data.
/// The sector's user data.
/// Sector address (LBA).
byte[] ReadSector(ulong sectorAddress);
- ///
- /// Reads a sector's tag.
- ///
+ /// 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.
- ///
+ /// 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.
- ///
+ /// 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).
- ///
+ /// 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).
- ///
+ /// 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.
diff --git a/Interfaces/IOpticalMediaImage.cs b/Interfaces/IOpticalMediaImage.cs
index 7cb50c8..29a8679 100644
--- a/Interfaces/IOpticalMediaImage.cs
+++ b/Interfaces/IOpticalMediaImage.cs
@@ -42,51 +42,37 @@ using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.CommonTypes.Interfaces
{
- ///
- /// Abstract class to implement disk image reading plugins.
- ///
+ /// Abstract class to implement disk image reading plugins.
public interface IOpticalMediaImage : IMediaImage, IPartitionableMediaImage, IVerifiableSectorsImage
{
- ///
- /// Gets the disc track extents (start, length).
- ///
+ /// Gets the disc track extents (start, length).
/// The track extents.
List