From 681fd8e8b9578276346630e0817cdd244f2ad931 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 3 Nov 2019 01:41:48 +0000 Subject: [PATCH] Reformat. --- Enums/DeviceType.cs | 10 +- Enums/ErrorNumber.cs | 103 +-- Enums/Images.cs | 373 ++++------ Exceptions/Images.cs | 95 +-- Extents/ExtentsByte.cs | 126 ++-- Extents/ExtentsConverter.cs | 11 +- Extents/ExtentsInt.cs | 126 ++-- Extents/ExtentsLong.cs | 126 ++-- Extents/ExtentsSByte.cs | 126 ++-- Extents/ExtentsShort.cs | 126 ++-- Extents/ExtentsUInt.cs | 126 ++-- Extents/ExtentsULong.cs | 126 ++-- Extents/ExtentsUShort.cs | 130 ++-- Filters.cs | 43 +- Geometry.cs | 25 +- Interfaces/IArchive.cs | 174 ++--- Interfaces/IChecksum.cs | 16 +- Interfaces/IFilesystem.cs | 16 +- Interfaces/IFilter.cs | 82 +-- Interfaces/IFloppyImage.cs | 59 +- Interfaces/IMediaImage.cs | 44 +- Interfaces/IOpticalMediaImage.cs | 50 +- Interfaces/IPartition.cs | 8 +- Interfaces/IPartitionableMediaImage.cs | 5 +- Interfaces/IPluginRegister.cs | 36 +- Interfaces/IReadOnlyFilesystem.cs | 55 +- Interfaces/ITapeImage.cs | 12 +- Interfaces/IVerifiableImage.cs | 4 +- Interfaces/IVerifiableSectorsImage.cs | 8 +- Interfaces/IWritableFloppyImage.cs | 34 +- Interfaces/IWritableImage.cs | 78 +-- Interfaces/IWritableOpticalImage.cs | 4 +- Interfaces/IWritableTapeImage.cs | 12 +- Interop/DetectOS.cs | 312 +++++---- Interop/PlatformID.cs | 186 +---- Interop/Version.cs | 27 +- MediaType.cs | 919 ++++++++----------------- MediaTypeFromSCSI.cs | 603 ++++++++-------- Metadata/DeviceReport.cs | 9 +- Metadata/DeviceReportV2.cs | 764 ++++++++++++-------- Metadata/Dimensions.cs | 85 ++- Metadata/MediaType.cs | 453 ++++++++++++ Metadata/Resume.cs | 3 +- Metadata/Version.cs | 16 +- Partition.cs | 22 +- PluginBase.cs | 71 +- Structs/Filesystems.cs | 240 +++---- Structs/Images.cs | 17 +- Structs/TapeFile.cs | 17 +- Structs/TapePartition.cs | 12 +- 50 files changed, 2941 insertions(+), 3184 deletions(-) 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 Tracks { get; } - /// - /// Gets the sessions (optical discs only). - /// + /// Gets the sessions (optical discs only). /// The sessions. List Sessions { get; } - /// - /// Reads a sector's user data, relative to track. - /// + /// Reads a sector's user data, relative to track. /// The sector's user data. /// Sector address (relative LBA). /// Track. byte[] ReadSector(ulong sectorAddress, uint track); - /// - /// Reads a sector's tag, relative to track. - /// + /// Reads a sector's tag, relative to track. /// The sector's tag. /// Sector address (relative LBA). /// Track. /// Tag type. byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag); - /// - /// Reads user data from several sectors, relative to track. - /// + /// Reads user data from several sectors, relative to track. /// The sectors user data. /// Starting sector address (relative LBA). /// How many sectors to read. /// Track. byte[] ReadSectors(ulong sectorAddress, uint length, uint track); - /// - /// Reads tag from several sectors, relative to track. - /// + /// Reads tag from several sectors, relative to track. /// The sectors tag. /// Starting sector address (relative LBA). /// How many sectors to read. @@ -94,47 +80,37 @@ namespace DiscImageChef.CommonTypes.Interfaces /// Tag type. byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag); - /// - /// Reads a complete sector (user data + all tags), relative to track. - /// + /// Reads a complete sector (user data + all tags), relative to track. /// The complete sector. Format depends on disk type. /// Sector address (relative LBA). /// Track. byte[] ReadSectorLong(ulong sectorAddress, uint track); - /// - /// Reads several complete sector (user data + all tags), relative to track. - /// + /// Reads several complete sector (user data + all tags), relative to track. /// The complete sectors. Format depends on disk type. /// Starting sector address (relative LBA). /// How many sectors to read. /// Track. byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track); - /// - /// Gets the disc track extents for a specified session. - /// + /// Gets the disc track extents for a specified session. /// The track exents for that session. /// Session. List GetSessionTracks(Session session); - /// - /// Gets the disc track extents for a specified session. - /// + /// Gets the disc track extents for a specified session. /// The track exents for that session. /// Session. List GetSessionTracks(ushort session); - /// - /// Verifies several sectors, relative to track. - /// + /// Verifies several sectors, relative to track. /// True if all are correct, false if any is incorrect, null if any is uncheckable. /// Starting sector address (relative LBA). /// How many sectors to read. /// Track. /// List of incorrect sectors /// List of uncheckable sectors - bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, out List unknownLbas); } } \ No newline at end of file diff --git a/Interfaces/IPartition.cs b/Interfaces/IPartition.cs index 98ba538..a8620ff 100644 --- a/Interfaces/IPartition.cs +++ b/Interfaces/IPartition.cs @@ -44,9 +44,7 @@ using DiscImageChef.CommonTypes.Interfaces; namespace DiscImageChef.Partitions { - /// - /// Abstract class to implement partitioning schemes interpreting plugins. - /// + /// Abstract class to implement partitioning schemes interpreting plugins. public interface IPartition { /// Plugin name. @@ -56,9 +54,7 @@ namespace DiscImageChef.Partitions /// Plugin author string Author { get; } - /// - /// Interprets a partitioning scheme. - /// + /// Interprets a partitioning scheme. /// true, if partitioning scheme is recognized, false otherwise. /// Disk image. /// Returns list of partitions. diff --git a/Interfaces/IPartitionableMediaImage.cs b/Interfaces/IPartitionableMediaImage.cs index f342e33..d365c44 100644 --- a/Interfaces/IPartitionableMediaImage.cs +++ b/Interfaces/IPartitionableMediaImage.cs @@ -44,9 +44,8 @@ namespace DiscImageChef.CommonTypes.Interfaces public interface IPartitionableMediaImage { /// - /// Gets an array partitions. Typically only useful for optical disc - /// images where each track and index means a different partition, as - /// reads can be relative to them. + /// Gets an array partitions. Typically only useful for optical disc images where each track and index means a + /// different partition, as reads can be relative to them. /// /// The partitions. List Partitions { get; } diff --git a/Interfaces/IPluginRegister.cs b/Interfaces/IPluginRegister.cs index e95f72c..5382c30 100644 --- a/Interfaces/IPluginRegister.cs +++ b/Interfaces/IPluginRegister.cs @@ -43,57 +43,39 @@ namespace DiscImageChef.CommonTypes.Interfaces { public interface IPluginRegister { - /// - /// Gets all checksum plugins - /// + /// Gets all checksum plugins /// List of checksum plugins List GetAllChecksumPlugins(); - /// - /// Gets all filesystem plugins - /// + /// Gets all filesystem plugins /// List of filesystem plugins List GetAllFilesystemPlugins(); - /// - /// Gets all filter plugins - /// + /// Gets all filter plugins /// List of filter plugins List GetAllFilterPlugins(); - /// - /// Gets all floppy image plugins - /// + /// Gets all floppy image plugins /// List of floppy image plugins List GetAllFloppyImagePlugins(); - /// - /// Gets all media image plugins - /// + /// Gets all media image plugins /// List of media image plugins List GetAllMediaImagePlugins(); - /// - /// Gets all partition plugins - /// + /// Gets all partition plugins /// List of partition plugins List GetAllPartitionPlugins(); - /// - /// Gets all read-only filesystem plugins - /// + /// Gets all read-only filesystem plugins /// List of read-only filesystem plugins List GetAllReadOnlyFilesystemPlugins(); - /// - /// Gets all writable floppy image plugins - /// + /// Gets all writable floppy image plugins /// List of writable floppy image plugins List GetAllWritableFloppyImagePlugins(); - /// - /// Gets all writable media image plugins - /// + /// Gets all writable media image plugins /// List of writable media image plugins List GetAllWritableImagePlugins(); } diff --git a/Interfaces/IReadOnlyFilesystem.cs b/Interfaces/IReadOnlyFilesystem.cs index f694273..5fe9663 100644 --- a/Interfaces/IReadOnlyFilesystem.cs +++ b/Interfaces/IReadOnlyFilesystem.cs @@ -44,21 +44,17 @@ using DiscImageChef.CommonTypes.Structs; namespace DiscImageChef.CommonTypes.Interfaces { - /// - /// Interface to implement filesystem plugins. - /// + /// Interface to implement filesystem plugins. public interface IReadOnlyFilesystem : IFilesystem { - /// - /// Retrieves a list of options supported by the filesystem, with name, type and description - /// + /// Retrieves a list of options supported by the filesystem, with name, type and description IEnumerable<(string name, Type type, string description)> SupportedOptions { get; } Dictionary Namespaces { get; } /// - /// Initializates whatever internal structures the filesystem plugin needs to be able to read files and directories - /// from the filesystem. + /// Initializates whatever internal structures the filesystem plugin needs to be able to read files and + /// directories from the filesystem. /// /// /// @@ -66,80 +62,59 @@ namespace DiscImageChef.CommonTypes.Interfaces /// Dictionary of key=value pairs containing options to pass to the filesystem /// Filename namespace Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, Dictionary options, - string @namespace); + string @namespace); - /// - /// Frees all internal structures created by - /// - /// + /// Frees all internal structures created by Errno Unmount(); - /// - /// Maps a filesystem block from a file to a block from the underlying device. - /// + /// Maps a filesystem block from a file to a block from the underlying device. /// Error number. /// File path. /// File block. /// Device block. Errno MapBlock(string path, long fileBlock, out long deviceBlock); - /// - /// Gets the attributes of a file or directory - /// + /// Gets the attributes of a file or directory /// Error number. /// File path. /// File attributes. Errno GetAttributes(string path, out FileAttributes attributes); - /// - /// 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. /// Error number. /// Path. /// List of extended attributes, alternate data streams and forks. Errno ListXAttr(string path, out List xattrs); - /// - /// 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. /// File path. /// Extendad attribute, alternate data stream or fork name. /// Buffer. Errno GetXattr(string path, string xattr, ref byte[] buf); - /// - /// Reads data from a file (main/only data stream or data fork). - /// + /// Reads data from a file (main/only data stream or data fork). /// File path. /// Offset. /// Bytes to read. /// Buffer. Errno Read(string path, long offset, long size, ref byte[] buf); - /// - /// Lists contents from a directory. - /// + /// Lists contents from a directory. /// Directory path. /// Directory contents. Errno ReadDir(string path, out List contents); - /// - /// Gets information about the mounted volume. - /// + /// Gets information about the mounted volume. /// Information about the mounted volume. Errno StatFs(out FileSystemInfo stat); - /// - /// Gets information about a file or directory. - /// + /// Gets information about a file or directory. /// File path. /// File information. Errno Stat(string path, out FileEntryInfo stat); - /// - /// Solves a symbolic link. - /// + /// Solves a symbolic link. /// Link path. /// Link destination. Errno ReadLink(string path, out string dest); diff --git a/Interfaces/ITapeImage.cs b/Interfaces/ITapeImage.cs index 6899ac5..e16cbd2 100644 --- a/Interfaces/ITapeImage.cs +++ b/Interfaces/ITapeImage.cs @@ -44,17 +44,11 @@ namespace DiscImageChef.CommonTypes.Interfaces { public interface ITapeImage : IMediaImage { - /// - /// Gets a list of all the files registered in the image - /// + /// Gets a list of all the files registered in the image List Files { get; } - /// - /// Gets a list of all the partitions registered in the image - /// + /// Gets a list of all the partitions registered in the image List TapePartitions { get; } - /// - /// If the media is a really a tape, as some formats can store non-tapes - /// + /// If the media is a really a tape, as some formats can store non-tapes bool IsTape { get; } } } \ No newline at end of file diff --git a/Interfaces/IVerifiableImage.cs b/Interfaces/IVerifiableImage.cs index af6d77e..11af836 100644 --- a/Interfaces/IVerifiableImage.cs +++ b/Interfaces/IVerifiableImage.cs @@ -41,9 +41,7 @@ namespace DiscImageChef.CommonTypes.Interfaces { public interface IVerifiableImage { - /// - /// Verifies media image internal checksum. - /// + /// Verifies media image internal checksum. /// True if correct, false if incorrect, null if there is no internal checksum available bool? VerifyMediaImage(); } diff --git a/Interfaces/IVerifiableSectorsImage.cs b/Interfaces/IVerifiableSectorsImage.cs index f9da0d5..fa7f804 100644 --- a/Interfaces/IVerifiableSectorsImage.cs +++ b/Interfaces/IVerifiableSectorsImage.cs @@ -43,16 +43,12 @@ namespace DiscImageChef.CommonTypes.Interfaces { public interface IVerifiableSectorsImage { - /// - /// Verifies a sector. - /// + /// Verifies a sector. /// True if correct, false if incorrect, null if uncheckable. /// Sector address (LBA). bool? VerifySector(ulong sectorAddress); - /// - /// Verifies several sectors. - /// + /// Verifies several sectors. /// True if all are correct, false if any is incorrect, null if any is uncheckable. /// Starting sector address (LBA). /// How many sectors to read. diff --git a/Interfaces/IWritableFloppyImage.cs b/Interfaces/IWritableFloppyImage.cs index db33ee4..3dd6d9d 100644 --- a/Interfaces/IWritableFloppyImage.cs +++ b/Interfaces/IWritableFloppyImage.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 defined by . - /// All data expected 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 defined by . All data expected by these methods is already decoded from its + /// corresponding bitstream. /// public interface IWritableFloppyImage : IFloppyImage, IWritableImage { @@ -60,14 +60,11 @@ namespace DiscImageChef.CommonTypes.Interfaces /// true if operating completed successfully, false otherwise bool SetFloppyCharacteristics(FloppyInfo info); - /// - /// Writes a sector's user data. - /// + /// Writes a sector's user data. /// - /// If is one of the duplicates. - /// If is , , - /// it will be ignored. - /// Otherwise, whatever data should be in the sector. + /// If is one of the duplicates. If + /// is , , + /// it will be ignored. Otherwise, whatever data should be in the sector. /// /// Physical track (position of the heads over the floppy media, 0-based). /// Physical head (0-based). @@ -76,23 +73,18 @@ namespace DiscImageChef.CommonTypes.Interfaces /// true if operating completed successfully, false otherwise bool WriteSector(byte[] data, ushort track, byte head, ushort sector, FloppySectorStatus status); - /// - /// Writes a whole track, including all gaps, address marks, sectors data, etc. - /// + /// Writes a whole track, including 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). /// true if operating completed successfully, false otherwise bool WriteTrack(byte[] data, ushort track, byte head); - /// - /// Writes a sector's data including all tags, address mark, and so, in a format dependent of represented media. - /// + /// Writes a sector's data including all tags, address mark, and so, in a format dependent of represented media. /// - /// If is one of the duplicates. - /// If is , , - /// it will be ignored. - /// Otherwise, whatever data should be in the sector. + /// If is one of the duplicates. If + /// is , , + /// it will be ignored. Otherwise, whatever data should be in the sector. /// /// Physical track (position of the heads over the floppy media, 0-based). /// Physical head (0-based). diff --git a/Interfaces/IWritableImage.cs b/Interfaces/IWritableImage.cs index d7777de..f962666 100644 --- a/Interfaces/IWritableImage.cs +++ b/Interfaces/IWritableImage.cs @@ -45,38 +45,28 @@ using Schemas; namespace DiscImageChef.CommonTypes.Interfaces { /// - /// Abstract class to implement disk image writing plugins. - /// TODO: This interface is subject to change until notice. + /// Abstract class to implement disk image writing plugins. TODO: This interface is subject to change until + /// notice. /// public interface IWritableImage : IMediaImage { - /// - /// Gets a list of that are supported by the media image format - /// + /// Gets a list of that are supported by the media image format IEnumerable SupportedMediaTags { get; } - /// - /// Gets a list of that are supported by the media image format - /// + /// Gets a list of that are supported by the media image format IEnumerable SupportedSectorTags { get; } - /// - /// Gets a list of that are supported by the media image format - /// + /// Gets a list of that are supported by the media image format IEnumerable SupportedMediaTypes { get; } - /// - /// Retrieves a list of options supported by the filesystem, with name, type and description - /// + /// Retrieves a list of options supported by the filesystem, with name, type and description IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions { get; } - /// - /// Gets a list of known extensions for format auto-chosing - /// + /// Gets a list of known extensions for format auto-chosing IEnumerable KnownExtensions { get; } bool IsWriting { get; } string ErrorMessage { get; } /// - /// Creates a new image in the specified path, for the specified , with the - /// specified options to hold a media with the specified number of sectors + /// Creates a new image in the specified path, for the specified , with the specified + /// options to hold a media with the specified number of sectors /// /// Path to the new image, with extension /// that will be written in the image @@ -85,11 +75,9 @@ namespace DiscImageChef.CommonTypes.Interfaces /// /// true if operating completed successfully, false otherwise bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize); + uint sectorSize); - /// - /// Writes a media tag to the image - /// + /// Writes a media tag to the image /// Media tag /// /// @@ -97,74 +85,56 @@ namespace DiscImageChef.CommonTypes.Interfaces /// true if operating completed successfully, false otherwise bool WriteMediaTag(byte[] data, MediaTagType tag); - /// - /// Writes a sector to the image - /// + /// Writes a sector to the image /// Sector data /// Sector address /// true if operating completed successfully, false otherwise bool WriteSector(byte[] data, ulong sectorAddress); - /// - /// Writes several sectors to the image - /// + /// Writes several sectors to the image /// Sectors data /// Sector starting address /// How many sectors to write /// true if operating completed successfully, false otherwise bool WriteSectors(byte[] data, ulong sectorAddress, uint length); - /// - /// Writes a sector to the image with main channel tags attached - /// + /// Writes a sector to the image with main channel tags attached /// Sector data with its main channel tags attached /// Sector address /// true if operating completed successfully, false otherwise bool WriteSectorLong(byte[] data, ulong sectorAddress); - /// - /// Writes several sectors to the image - /// + /// Writes several sectors to the image /// Sector data with their main channel tags attached /// Sector starting address /// How many sectors to write /// true if operating completed successfully, false otherwise bool WriteSectorsLong(byte[] data, ulong sectorAddress, uint length); - /// - /// Closes and flushes to disk the image - /// + /// Closes and flushes to disk the image /// true if operating completed successfully, false otherwise bool Close(); - /// - /// Sets image metadata - /// + /// Sets image metadata /// containing image metadata /// true if operating completed successfully, false otherwise bool SetMetadata(ImageInfo metadata); - /// - /// Sets media geometry - /// + /// Sets media geometry /// Cylinders /// Heads /// Sectors per track /// true if operating completed successfully, false otherwise bool SetGeometry(uint cylinders, uint heads, uint sectorsPerTrack); - /// - /// Writes parallel or subchannel sector tag for one sector - /// + /// Writes parallel or subchannel sector tag for one sector /// Tag data to write /// Sector address /// Tag type /// true if operating completed successfully, false otherwise bool WriteSectorTag(byte[] data, ulong sectorAddress, SectorTagType tag); - /// - /// Writes parallel or subchannel sector tag for several sector - /// + /// Writes parallel or subchannel sector tag for several sector /// Tag data to write /// Starting sector address /// How many sectors to write @@ -172,14 +142,10 @@ namespace DiscImageChef.CommonTypes.Interfaces /// true if operating completed successfully, false otherwise bool WriteSectorsTag(byte[] data, ulong sectorAddress, uint length, SectorTagType tag); - /// - /// Sets the list of dump hardware used to create the image from real media - /// + /// Sets the list of dump hardware used to create the image from real media bool SetDumpHardware(List dumpHardware); - /// - /// Sets the CICM XML metadata for the image - /// + /// Sets the CICM XML metadata for the image bool SetCicmMetadata(CICMMetadataType metadata); } } \ No newline at end of file diff --git a/Interfaces/IWritableOpticalImage.cs b/Interfaces/IWritableOpticalImage.cs index 072815c..afa104b 100644 --- a/Interfaces/IWritableOpticalImage.cs +++ b/Interfaces/IWritableOpticalImage.cs @@ -43,9 +43,7 @@ namespace DiscImageChef.CommonTypes.Interfaces { public interface IWritableOpticalImage : IWritableImage, IOpticalMediaImage { - /// - /// Sets tracks for optical media - /// + /// Sets tracks for optical media /// List of tracks /// true if operating completed successfully, false otherwise bool SetTracks(List tracks); diff --git a/Interfaces/IWritableTapeImage.cs b/Interfaces/IWritableTapeImage.cs index b082638..312281b 100644 --- a/Interfaces/IWritableTapeImage.cs +++ b/Interfaces/IWritableTapeImage.cs @@ -43,23 +43,19 @@ namespace DiscImageChef.CommonTypes.Interfaces { public interface IWritableTapeImage : ITapeImage, IWritableImage { - /// - /// Registers a new file in the image - /// + /// Registers a new file in the image /// Tape file descriptor /// true if successful, false otherwise bool AddFile(TapeFile file); - /// - /// Registers a new partition - /// + /// Registers a new partition /// Tape partition descriptor /// true if successful, false otherwise bool AddPartition(TapePartition partition); /// - /// Tells the image plugin to set the internal structures to expect a tape (e.g. unknown block count and size). - /// Must be called before + /// Tells the image plugin to set the internal structures to expect a tape (e.g. unknown block count and size). + /// Must be called before /// /// true if successful, false otherwise bool SetTape(); diff --git a/Interop/DetectOS.cs b/Interop/DetectOS.cs index cc58436..9862124 100644 --- a/Interop/DetectOS.cs +++ b/Interop/DetectOS.cs @@ -55,38 +55,47 @@ namespace DiscImageChef.CommonTypes.Interop public static readonly bool IsNetNative = RuntimeInformation.FrameworkDescription.StartsWith(".NET Native", StringComparison.Ordinal); - /// - /// Checks if the underlying runtime runs in 64-bit mode - /// + /// Checks if the underlying runtime runs in 64-bit mode public static readonly bool Is64Bit = IntPtr.Size == 8; - /// - /// Checks if the underlying runtime runs in 32-bit mode - /// + /// Checks if the underlying runtime runs in 32-bit mode public static readonly bool Is32Bit = IntPtr.Size == 4; - public static bool IsWindows => - GetRealPlatformID() == PlatformID.Win32NT || GetRealPlatformID() == PlatformID.Win32S || - GetRealPlatformID() == PlatformID.Win32Windows || GetRealPlatformID() == PlatformID.WinCE || - GetRealPlatformID() == PlatformID.WindowsPhone || GetRealPlatformID() == PlatformID.Xbox; + public static bool IsWindows => GetRealPlatformID() == PlatformID.Win32NT || + GetRealPlatformID() == PlatformID.Win32S || + GetRealPlatformID() == PlatformID.Win32Windows || + GetRealPlatformID() == PlatformID.WinCE || + GetRealPlatformID() == PlatformID.WindowsPhone || + GetRealPlatformID() == PlatformID.Xbox; public static bool IsAdmin { get { - if(!IsWindows) return Environment.UserName == "root"; + if(!IsWindows) + return Environment.UserName == "root"; bool isAdmin; WindowsIdentity user = null; + try { user = WindowsIdentity.GetCurrent(); - WindowsPrincipal principal = new WindowsPrincipal(user); + var principal = new WindowsPrincipal(user); isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator); } - catch(UnauthorizedAccessException ex) { isAdmin = false; } - catch(Exception ex) { isAdmin = false; } - finally { user?.Dispose(); } + catch(UnauthorizedAccessException ex) + { + isAdmin = false; + } + catch(Exception ex) + { + isAdmin = false; + } + finally + { + user?.Dispose(); + } return isAdmin; } @@ -98,35 +107,37 @@ namespace DiscImageChef.CommonTypes.Interop [DllImport("libc", SetLastError = true, EntryPoint = "sysctlbyname", CharSet = CharSet.Ansi)] static extern int OSX_sysctlbyname(string name, IntPtr oldp, IntPtr oldlenp, IntPtr newp, uint newlen); - /// - /// Gets the real platform ID, not the incomplete .NET framework one - /// + /// Gets the real platform ID, not the incomplete .NET framework one /// Platform ID /// Unhandled exception public static PlatformID GetRealPlatformID() { - if((int)Environment.OSVersion.Platform < 4 || (int)Environment.OSVersion.Platform == 5) - return (PlatformID)(int)Environment.OSVersion.Platform; + if((int)Environment.OSVersion.Platform < 4 || + (int)Environment.OSVersion.Platform == 5) + return(PlatformID)(int)Environment.OSVersion.Platform; int error = uname(out utsname unixname); - if(error != 0) throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); + + if(error != 0) + throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); switch(unixname.sysname) { // TODO: Differentiate Linux, Android, Tizen - case "Linux": + case"Linux": { - #if __ANDROID__ + #if __ANDROID__ return PlatformID.Android; - #else + #else return PlatformID.Linux; - #endif + #endif } - case "Darwin": + case"Darwin": { IntPtr pLen = Marshal.AllocHGlobal(sizeof(int)); int osxError = OSX_sysctlbyname("hw.machine", IntPtr.Zero, pLen, IntPtr.Zero, 0); + if(osxError != 0) { Marshal.FreeHGlobal(pLen); @@ -137,6 +148,7 @@ namespace DiscImageChef.CommonTypes.Interop int length = Marshal.ReadInt32(pLen); IntPtr pStr = Marshal.AllocHGlobal(length); osxError = OSX_sysctlbyname("hw.machine", pStr, pLen, IntPtr.Zero, 0); + if(osxError != 0) { Marshal.FreeHGlobal(pStr); @@ -150,52 +162,52 @@ namespace DiscImageChef.CommonTypes.Interop Marshal.FreeHGlobal(pStr); Marshal.FreeHGlobal(pLen); - if(machine != null && (machine.StartsWith("iPad", StringComparison.Ordinal) || - machine.StartsWith("iPod", StringComparison.Ordinal) || - machine.StartsWith("iPhone", StringComparison.Ordinal))) + if(machine != null && + (machine.StartsWith("iPad", StringComparison.Ordinal) || + machine.StartsWith("iPod", StringComparison.Ordinal) || + machine.StartsWith("iPhone", StringComparison.Ordinal))) return PlatformID.iOS; return PlatformID.MacOSX; } - case "GNU": return PlatformID.Hurd; - case "FreeBSD": - case "GNU/kFreeBSD": return PlatformID.FreeBSD; - case "DragonFly": return PlatformID.DragonFly; - case "Haiku": return PlatformID.Haiku; - case "HP-UX": return PlatformID.HPUX; - case "AIX": return PlatformID.AIX; - case "OS400": return PlatformID.OS400; - case "IRIX": - case "IRIX64": return PlatformID.IRIX; - case "Minix": return PlatformID.Minix; - case "NetBSD": return PlatformID.NetBSD; - case "NONSTOP_KERNEL": return PlatformID.NonStop; - case "OpenBSD": return PlatformID.OpenBSD; - case "QNX": return PlatformID.QNX; - case "SINIX-Y": return PlatformID.SINIX; - case "SunOS": return PlatformID.Solaris; - case "OSF1": return PlatformID.Tru64; - case "ULTRIX": return PlatformID.Ultrix; - case "SCO_SV": return PlatformID.OpenServer; - case "UnixWare": return PlatformID.UnixWare; - case "Interix": - case "UWIN-W7": return PlatformID.Win32NT; + case"GNU": return PlatformID.Hurd; + case"FreeBSD": + case"GNU/kFreeBSD": return PlatformID.FreeBSD; + case"DragonFly": return PlatformID.DragonFly; + case"Haiku": return PlatformID.Haiku; + case"HP-UX": return PlatformID.HPUX; + case"AIX": return PlatformID.AIX; + case"OS400": return PlatformID.OS400; + case"IRIX": + case"IRIX64": return PlatformID.IRIX; + case"Minix": return PlatformID.Minix; + case"NetBSD": return PlatformID.NetBSD; + case"NONSTOP_KERNEL": return PlatformID.NonStop; + case"OpenBSD": return PlatformID.OpenBSD; + case"QNX": return PlatformID.QNX; + case"SINIX-Y": return PlatformID.SINIX; + case"SunOS": return PlatformID.Solaris; + case"OSF1": return PlatformID.Tru64; + case"ULTRIX": return PlatformID.Ultrix; + case"SCO_SV": return PlatformID.OpenServer; + case"UnixWare": return PlatformID.UnixWare; + case"Interix": + case"UWIN-W7": return PlatformID.Win32NT; default: { - if(unixname.sysname.StartsWith("CYGWIN_NT", StringComparison.Ordinal) || + if(unixname.sysname.StartsWith("CYGWIN_NT", StringComparison.Ordinal) || unixname.sysname.StartsWith("MINGW32_NT", StringComparison.Ordinal) || - unixname.sysname.StartsWith("MSYS_NT", StringComparison.Ordinal) || - unixname.sysname.StartsWith("UWIN", StringComparison.Ordinal)) return PlatformID.Win32NT; + unixname.sysname.StartsWith("MSYS_NT", StringComparison.Ordinal) || + unixname.sysname.StartsWith("UWIN", StringComparison.Ordinal)) + return PlatformID.Win32NT; return PlatformID.Unknown; } } } - /// - /// Gets a string for the current operating system REAL version (handles Darwin 1.4 and Windows 10 falsifying) - /// + /// Gets a string for the current operating system REAL version (handles Darwin 1.4 and Windows 10 falsifying) /// Current operating system version public static string GetVersion() { @@ -205,12 +217,12 @@ namespace DiscImageChef.CommonTypes.Interop { case PlatformID.MacOSX: if(Environment.OSVersion.Version.Major != 1) - return $"10.{Environment.OSVersion.Version.Major - 4}.{Environment.OSVersion.Version.Minor}"; + return$"10.{Environment.OSVersion.Version.Major - 4}.{Environment.OSVersion.Version.Minor}"; switch(Environment.OSVersion.Version.Minor) { - case 3: return "10.0"; - case 4: return "10.1"; + case 3: return"10.0"; + case 4: return"10.1"; } goto default; @@ -218,8 +230,8 @@ namespace DiscImageChef.CommonTypes.Interop // From Windows 8.1 the reported version is simply falsified... if(Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Major >= 2 || Environment.OSVersion.Version.Major > 6) - return FileVersionInfo - .GetVersionInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), + return FileVersionInfo. + GetVersionInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "KERNEL32.DLL")).ProductVersion; return environ; @@ -227,9 +239,7 @@ namespace DiscImageChef.CommonTypes.Interop } } - /// - /// From a platform ID and version returns a human-readable version - /// + /// From a platform ID and version returns a human-readable version /// Platform ID /// Version number /// Operating system name @@ -237,111 +247,135 @@ namespace DiscImageChef.CommonTypes.Interop { switch(id) { - case PlatformID.AIX: return "AIX"; - case PlatformID.Android: return "Android"; - case PlatformID.DragonFly: return "DragonFly BSD"; - case PlatformID.FreeBSD: return "FreeBSD"; - case PlatformID.Haiku: return "Haiku"; - case PlatformID.HPUX: return "HP/UX"; - case PlatformID.Hurd: return "Hurd"; - case PlatformID.iOS: return "iOS"; - case PlatformID.IRIX: return "IRIX"; + case PlatformID.AIX: return"AIX"; + case PlatformID.Android: return"Android"; + case PlatformID.DragonFly: return"DragonFly BSD"; + case PlatformID.FreeBSD: return"FreeBSD"; + case PlatformID.Haiku: return"Haiku"; + case PlatformID.HPUX: return"HP/UX"; + case PlatformID.Hurd: return"Hurd"; + case PlatformID.iOS: return"iOS"; + case PlatformID.IRIX: return"IRIX"; case PlatformID.Linux: - if(!File.Exists("/proc/version")) return "Linux"; + if(!File.Exists("/proc/version")) + return"Linux"; string s = File.ReadAllText("/proc/version"); return s.Contains("Microsoft") || s.Contains("WSL") ? "Windows Subsystem for Linux" : "Linux"; case PlatformID.MacOSX: - if(string.IsNullOrEmpty(version)) return "macOS"; + if(string.IsNullOrEmpty(version)) + return"macOS"; string[] pieces = version.Split('.'); - if(pieces.Length < 2 || !int.TryParse(pieces[1], out int minor)) return "macOS"; - if(minor >= 12) return "macOS"; - if(minor >= 8) return "OS X"; + if(pieces.Length < 2 || + !int.TryParse(pieces[1], out int minor)) + return"macOS"; - return "Mac OS X"; + if(minor >= 12) + return"macOS"; - case PlatformID.Minix: return "MINIX"; - case PlatformID.NetBSD: return "NetBSD"; - case PlatformID.NonStop: return "NonStop OS"; - case PlatformID.OpenBSD: return "OpenBSD"; - case PlatformID.OpenServer: return "SCO OpenServer"; - case PlatformID.OS400: return "OS/400"; - case PlatformID.PlayStation3: return "Sony CellOS"; - case PlatformID.PlayStation4: return "Sony Orbis OS"; - case PlatformID.QNX: return "QNX"; - case PlatformID.SINIX: return "SINIX"; - case PlatformID.Solaris: return "Sun Solaris"; - case PlatformID.Tizen: return "Samsung Tizen"; - case PlatformID.Tru64: return "Tru64 UNIX"; - case PlatformID.Ultrix: return "Ultrix"; - case PlatformID.Unix: return "UNIX"; - case PlatformID.UnixWare: return "SCO UnixWare"; - case PlatformID.Wii: return "Nintendo Wii"; - case PlatformID.WiiU: return "Nintendo Wii U"; + if(minor >= 8) + return"OS X"; + + return"Mac OS X"; + + case PlatformID.Minix: return"MINIX"; + case PlatformID.NetBSD: return"NetBSD"; + case PlatformID.NonStop: return"NonStop OS"; + case PlatformID.OpenBSD: return"OpenBSD"; + case PlatformID.OpenServer: return"SCO OpenServer"; + case PlatformID.OS400: return"OS/400"; + case PlatformID.PlayStation3: return"Sony CellOS"; + case PlatformID.PlayStation4: return"Sony Orbis OS"; + case PlatformID.QNX: return"QNX"; + case PlatformID.SINIX: return"SINIX"; + case PlatformID.Solaris: return"Sun Solaris"; + case PlatformID.Tizen: return"Samsung Tizen"; + case PlatformID.Tru64: return"Tru64 UNIX"; + case PlatformID.Ultrix: return"Ultrix"; + case PlatformID.Unix: return"UNIX"; + case PlatformID.UnixWare: return"SCO UnixWare"; + case PlatformID.Wii: return"Nintendo Wii"; + case PlatformID.WiiU: return"Nintendo Wii U"; case PlatformID.Win32NT: - if(string.IsNullOrEmpty(version)) return "Windows NT/2000/XP/Vista/7/10"; + if(string.IsNullOrEmpty(version)) + return"Windows NT/2000/XP/Vista/7/10"; + if(version.StartsWith("3.", StringComparison.Ordinal) || - version.StartsWith("4.", StringComparison.Ordinal)) return "Windows NT"; - if(version.StartsWith("5.0", StringComparison.Ordinal)) return "Windows 2000"; - if(version.StartsWith("5.1", StringComparison.Ordinal)) return "Windows XP"; - if(version.StartsWith("5.2", StringComparison.Ordinal)) return "Windows 2003"; - if(version.StartsWith("6.0", StringComparison.Ordinal)) return "Windows Vista"; - if(version.StartsWith("6.1", StringComparison.Ordinal)) return "Windows 7"; - if(version.StartsWith("6.2", StringComparison.Ordinal)) return "Windows 8"; - if(version.StartsWith("6.3", StringComparison.Ordinal)) return "Windows 8.1"; - if(version.StartsWith("10.0", StringComparison.Ordinal)) return "Windows 10"; + version.StartsWith("4.", StringComparison.Ordinal)) + return"Windows NT"; - return "Windows NT/2000/XP/Vista/7/10"; - case PlatformID.Win32S: return "Windows 3.x with win32s"; + if(version.StartsWith("5.0", StringComparison.Ordinal)) + return"Windows 2000"; + + if(version.StartsWith("5.1", StringComparison.Ordinal)) + return"Windows XP"; + + if(version.StartsWith("5.2", StringComparison.Ordinal)) + return"Windows 2003"; + + if(version.StartsWith("6.0", StringComparison.Ordinal)) + return"Windows Vista"; + + if(version.StartsWith("6.1", StringComparison.Ordinal)) + return"Windows 7"; + + if(version.StartsWith("6.2", StringComparison.Ordinal)) + return"Windows 8"; + + if(version.StartsWith("6.3", StringComparison.Ordinal)) + return"Windows 8.1"; + + if(version.StartsWith("10.0", StringComparison.Ordinal)) + return"Windows 10"; + + return"Windows NT/2000/XP/Vista/7/10"; + case PlatformID.Win32S: return"Windows 3.x with win32s"; case PlatformID.Win32Windows: - if(string.IsNullOrEmpty(version)) return "Windows 9x/Me"; - if(version.StartsWith("4.0", StringComparison.Ordinal)) return "Windows 95"; - if(version.StartsWith("4.10.2222", StringComparison.Ordinal)) return "Windows 98 SE"; - if(version.StartsWith("4.1", StringComparison.Ordinal)) return "Windows 98"; - if(version.StartsWith("4.9", StringComparison.Ordinal)) return "Windows Me"; + if(string.IsNullOrEmpty(version)) + return"Windows 9x/Me"; - return "Windows 9x/Me"; - case PlatformID.WinCE: return "Windows CE/Mobile"; - case PlatformID.WindowsPhone: return "Windows Phone"; - case PlatformID.Xbox: return "Xbox OS"; - case PlatformID.zOS: return "z/OS"; + if(version.StartsWith("4.0", StringComparison.Ordinal)) + return"Windows 95"; + + if(version.StartsWith("4.10.2222", StringComparison.Ordinal)) + return"Windows 98 SE"; + + if(version.StartsWith("4.1", StringComparison.Ordinal)) + return"Windows 98"; + + if(version.StartsWith("4.9", StringComparison.Ordinal)) + return"Windows Me"; + + return"Windows 9x/Me"; + case PlatformID.WinCE: return"Windows CE/Mobile"; + case PlatformID.WindowsPhone: return"Windows Phone"; + case PlatformID.Xbox: return"Xbox OS"; + case PlatformID.zOS: return"z/OS"; default: return id.ToString(); } } - /// - /// POSIX uname structure, size from OSX, big enough to handle extra fields - /// + /// POSIX uname structure, size from OSX, big enough to handle extra fields [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] struct utsname { - /// - /// System name - /// + /// System name [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public readonly string sysname; - /// - /// Node name - /// + /// Node name [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public readonly string nodename; - /// - /// Release level - /// + /// Release level [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public readonly string release; - /// - /// Version level - /// + /// Version level [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public readonly string version; - /// - /// Hardware level - /// + /// Hardware level [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public readonly string machine; } diff --git a/Interop/PlatformID.cs b/Interop/PlatformID.cs index 0cd6dd1..50c4c93 100644 --- a/Interop/PlatformID.cs +++ b/Interop/PlatformID.cs @@ -38,155 +38,45 @@ namespace DiscImageChef.CommonTypes.Interop { - /// - /// Contains an arbitrary list of OSes, even if .NET does not run on them - /// + /// Contains an arbitrary list of OSes, even if .NET does not run on them public enum PlatformID { - /// - /// Win32s - /// - Win32S = 0, - /// - /// Win32 (Windows 9x) - /// - Win32Windows = 1, - /// - /// Windows NT - /// - Win32NT = 2, - /// - /// Windows Mobile - /// - WinCE = 3, - /// - /// UNIX (do not use, too generic) - /// - Unix = 4, - /// - /// Xbox 360 - /// - Xbox = 5, - /// - /// OS X - /// - MacOSX = 6, - /// - /// iOS is not OS X - /// - iOS = 7, - /// - /// Linux - /// - Linux = 8, - /// - /// Sun Solaris - /// - Solaris = 9, - /// - /// NetBSD - /// - NetBSD = 10, - /// - /// OpenBSD - /// - OpenBSD = 11, - /// - /// FreeBSD - /// - FreeBSD = 12, - /// - /// DragonFly BSD - /// - DragonFly = 13, - /// - /// Nintendo Wii - /// - Wii = 14, - /// - /// Nintendo Wii U - /// - WiiU = 15, - /// - /// Sony PlayStation 3 - /// - PlayStation3 = 16, - /// - /// Sony Playstation 4 - /// - PlayStation4 = 17, - /// - /// Google Android - /// - Android = 18, - /// - /// Samsung Tizen - /// - Tizen = 19, - /// - /// Windows Phone - /// - WindowsPhone = 20, - /// - /// GNU/Hurd - /// - Hurd = 21, - /// - /// Haiku - /// - Haiku = 22, - /// - /// HP-UX - /// - HPUX = 23, - /// - /// AIX - /// - AIX = 24, - /// - /// OS/400 - /// - OS400 = 25, - /// - /// IRIX - /// - IRIX = 26, - /// - /// Minix - /// - Minix = 27, - /// - /// NonStop - /// - NonStop = 28, - /// - /// QNX - /// - QNX = 29, - /// - /// SINIX - /// - SINIX = 30, - /// - /// Tru64 UNIX - /// - Tru64 = 31, - /// - /// Ultrix - /// - Ultrix = 32, - /// - /// SCO OpenServer / SCO UNIX - /// - OpenServer = 33, - /// - /// SCO UnixWare - /// - UnixWare = 34, - /// - /// IBM z/OS - /// - zOS = 35, - Unknown = -1 + /// Win32s + Win32S = 0, /// Win32 (Windows 9x) + Win32Windows = 1, /// Windows NT + Win32NT = 2, /// Windows Mobile + WinCE = 3, /// UNIX (do not use, too generic) + Unix = 4, /// Xbox 360 + Xbox = 5, /// OS X + MacOSX = 6, /// iOS is not OS X + iOS = 7, /// Linux + Linux = 8, /// Sun Solaris + Solaris = 9, /// NetBSD + NetBSD = 10, /// OpenBSD + OpenBSD = 11, /// FreeBSD + FreeBSD = 12, /// DragonFly BSD + DragonFly = 13, /// Nintendo Wii + Wii = 14, /// Nintendo Wii U + WiiU = 15, /// Sony PlayStation 3 + PlayStation3 = 16, /// Sony Playstation 4 + PlayStation4 = 17, /// Google Android + Android = 18, /// Samsung Tizen + Tizen = 19, /// Windows Phone + WindowsPhone = 20, /// GNU/Hurd + Hurd = 21, /// Haiku + Haiku = 22, /// HP-UX + HPUX = 23, /// AIX + AIX = 24, /// OS/400 + OS400 = 25, /// IRIX + IRIX = 26, /// Minix + Minix = 27, /// NonStop + NonStop = 28, /// QNX + QNX = 29, /// SINIX + SINIX = 30, /// Tru64 UNIX + Tru64 = 31, /// Ultrix + Ultrix = 32, /// SCO OpenServer / SCO UNIX + OpenServer = 33, /// SCO UnixWare + UnixWare = 34, /// IBM z/OS + zOS = 35, Unknown = -1 } } \ No newline at end of file diff --git a/Interop/Version.cs b/Interop/Version.cs index 3dfbe4f..adffd70 100644 --- a/Interop/Version.cs +++ b/Interop/Version.cs @@ -44,19 +44,23 @@ namespace DiscImageChef.CommonTypes.Interop { public static class Version { - /// - /// Gets version string - /// + /// Gets version string /// Version public static string GetVersion() => typeof(Version).Assembly.GetName().Version.ToString(); public static string GetNetCoreVersion() { Assembly assembly = typeof(GCSettings).Assembly; - string[] assemblyPath = - assembly.CodeBase.Split(new[] {'/', '\\'}, StringSplitOptions.RemoveEmptyEntries); + + string[] assemblyPath = assembly.CodeBase.Split(new[] + { + '/', '\\' + }, StringSplitOptions.RemoveEmptyEntries); + int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App"); - if(netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2) + + if(netCoreAppIndex > 0 && + netCoreAppIndex < assemblyPath.Length - 2) return assemblyPath[netCoreAppIndex + 1]; return null; @@ -64,11 +68,14 @@ namespace DiscImageChef.CommonTypes.Interop public static string GetMonoVersion() { - if(!DetectOS.IsMono) return null; + if(!DetectOS.IsMono) + return null; - MethodInfo monoDisplayName = Type.GetType("Mono.Runtime") - ?.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static); - if(monoDisplayName != null) return (string)monoDisplayName.Invoke(null, null); + MethodInfo monoDisplayName = Type.GetType("Mono.Runtime")?. + GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static); + + if(monoDisplayName != null) + return(string)monoDisplayName.Invoke(null, null); return null; } diff --git a/MediaType.cs b/MediaType.cs index 4863edb..57dbfbd 100644 --- a/MediaType.cs +++ b/MediaType.cs @@ -43,182 +43,114 @@ namespace DiscImageChef.CommonTypes { public enum MediaEncoding { - Unknown, - FM, - MFM, - M2FM, - AppleGCR, - CommodoreGCR + Unknown, FM, MFM, + M2FM, AppleGCR, CommodoreGCR } - /// - /// Contains an enumeration of all known types of media. - /// + /// Contains an enumeration of all known types of media. public enum MediaType : uint { #region Generics, types 0 to 9 /// Unknown disk type - Unknown = 0, - /// Unknown magneto-optical - UnknownMO = 1, - /// Generic hard disk - GENERIC_HDD = 2, - /// Microdrive type hard disk - Microdrive = 3, - /// Zoned hard disk - Zone_HDD = 4, - /// USB flash drives - FlashDrive = 5, - /// USB flash drives + Unknown = 0, /// Unknown magneto-optical + UnknownMO = 1, /// Generic hard disk + GENERIC_HDD = 2, /// Microdrive type hard disk + Microdrive = 3, /// Zoned hard disk + Zone_HDD = 4, /// USB flash drives + FlashDrive = 5, /// USB flash drives UnknownTape = 4, #endregion Generics, types 0 to 9 #region Somewhat standard Compact Disc formats, types 10 to 39 /// Any unknown or standard violating CD - CD = 10, - /// CD Digital Audio (Red Book) - CDDA = 11, - /// CD+G (Red Book) - CDG = 12, - /// CD+EG (Red Book) - CDEG = 13, - /// CD-i (Green Book) - CDI = 14, - /// CD-ROM (Yellow Book) - CDROM = 15, - /// CD-ROM XA (Yellow Book) - CDROMXA = 16, - /// CD+ (Blue Book) - CDPLUS = 17, - /// CD-MO (Orange Book) - CDMO = 18, - /// CD-Recordable (Orange Book) - CDR = 19, - /// CD-ReWritable (Orange Book) - CDRW = 20, - /// Mount-Rainier CD-RW - CDMRW = 21, - /// Video CD (White Book) - VCD = 22, - /// Super Video CD (White Book) - SVCD = 23, - /// Photo CD (Beige Book) - PCD = 24, - /// Super Audio CD (Scarlet Book) - SACD = 25, - /// Double-Density CD-ROM (Purple Book) - DDCD = 26, - /// DD CD-R (Purple Book) - DDCDR = 27, - /// DD CD-RW (Purple Book) - DDCDRW = 28, - /// DTS audio CD (non-standard) - DTSCD = 29, - /// CD-MIDI (Red Book) - CDMIDI = 30, - /// CD-Video (ISO/IEC 61104) + CD = 10, /// CD Digital Audio (Red Book) + CDDA = 11, /// CD+G (Red Book) + CDG = 12, /// CD+EG (Red Book) + CDEG = 13, /// CD-i (Green Book) + CDI = 14, /// CD-ROM (Yellow Book) + CDROM = 15, /// CD-ROM XA (Yellow Book) + CDROMXA = 16, /// CD+ (Blue Book) + CDPLUS = 17, /// CD-MO (Orange Book) + CDMO = 18, /// CD-Recordable (Orange Book) + CDR = 19, /// CD-ReWritable (Orange Book) + CDRW = 20, /// Mount-Rainier CD-RW + CDMRW = 21, /// Video CD (White Book) + VCD = 22, /// Super Video CD (White Book) + SVCD = 23, /// Photo CD (Beige Book) + PCD = 24, /// Super Audio CD (Scarlet Book) + SACD = 25, /// Double-Density CD-ROM (Purple Book) + DDCD = 26, /// DD CD-R (Purple Book) + DDCDR = 27, /// DD CD-RW (Purple Book) + DDCDRW = 28, /// DTS audio CD (non-standard) + DTSCD = 29, /// CD-MIDI (Red Book) + CDMIDI = 30, /// CD-Video (ISO/IEC 61104) CDV = 31, /// 120mm, Phase-Change, 1298496 sectors, 512 bytes/sector, PD650, ECMA-240, ISO 15485 PD650 = 32, /// 120mm, Write-Once, 1281856 sectors, 512 bytes/sector, PD650, ECMA-240, ISO 15485 - PD650_WORM = 33, - /// + PD650_WORM = 33, /// /// CD-i Ready, contains a track before the first TOC track, in mode 2, and all TOC tracks are Audio. Subchannel /// marks track as audio pause. /// - CDIREADY = 34, - FMTOWNS = 35, + CDIREADY = 34, FMTOWNS = 35, #endregion Somewhat standard Compact Disc formats, types 10 to 39 #region Standard DVD formats, types 40 to 50 /// DVD-ROM (applies to DVD Video and DVD Audio) - DVDROM = 40, - /// DVD-R - DVDR = 41, - /// DVD-RW - DVDRW = 42, - /// DVD+R - DVDPR = 43, - /// DVD+RW - DVDPRW = 44, - /// DVD+RW DL - DVDPRWDL = 45, - /// DVD-R DL - DVDRDL = 46, - /// DVD+R DL - DVDPRDL = 47, - /// DVD-RAM - DVDRAM = 48, - /// DVD-RW DL - DVDRWDL = 49, - /// DVD-Download + DVDROM = 40, /// DVD-R + DVDR = 41, /// DVD-RW + DVDRW = 42, /// DVD+R + DVDPR = 43, /// DVD+RW + DVDPRW = 44, /// DVD+RW DL + DVDPRWDL = 45, /// DVD-R DL + DVDRDL = 46, /// DVD+R DL + DVDPRDL = 47, /// DVD-RAM + DVDRAM = 48, /// DVD-RW DL + DVDRWDL = 49, /// DVD-Download DVDDownload = 50, #endregion Standard DVD formats, types 40 to 50 #region Standard HD-DVD formats, types 51 to 59 /// HD DVD-ROM (applies to HD DVD Video) - HDDVDROM = 51, - /// HD DVD-RAM - HDDVDRAM = 52, - /// HD DVD-R - HDDVDR = 53, - /// HD DVD-RW - HDDVDRW = 54, - /// HD DVD-R DL - HDDVDRDL = 55, - /// HD DVD-RW DL + HDDVDROM = 51, /// HD DVD-RAM + HDDVDRAM = 52, /// HD DVD-R + HDDVDR = 53, /// HD DVD-RW + HDDVDRW = 54, /// HD DVD-R DL + HDDVDRDL = 55, /// HD DVD-RW DL HDDVDRWDL = 56, #endregion Standard HD-DVD formats, types 51 to 59 #region Standard Blu-ray formats, types 60 to 69 /// BD-ROM (and BD Video) - BDROM = 60, - /// BD-R - BDR = 61, - /// BD-RE - BDRE = 62, - /// BD-R XL - BDRXL = 63, - /// BD-RE XL + BDROM = 60, /// BD-R + BDR = 61, /// BD-RE + BDRE = 62, /// BD-R XL + BDRXL = 63, /// BD-RE XL BDREXL = 64, #endregion Standard Blu-ray formats, types 60 to 69 #region Rare or uncommon optical standards, types 70 to 79 /// Enhanced Versatile Disc - EVD = 70, - /// Forward Versatile Disc - FVD = 71, - /// Holographic Versatile Disc - HVD = 72, - /// China Blue High Definition - CBHD = 73, - /// High Definition Versatile Multilayer Disc - HDVMD = 74, - /// Versatile Compact Disc High Density - VCDHD = 75, - /// Stacked Volumetric Optical Disc - SVOD = 76, - /// Five Dimensional disc + EVD = 70, /// Forward Versatile Disc + FVD = 71, /// Holographic Versatile Disc + HVD = 72, /// China Blue High Definition + CBHD = 73, /// High Definition Versatile Multilayer Disc + HDVMD = 74, /// Versatile Compact Disc High Density + VCDHD = 75, /// Stacked Volumetric Optical Disc + SVOD = 76, /// Five Dimensional disc FDDVD = 77, #endregion Rare or uncommon optical standards, types 70 to 79 #region LaserDisc based, types 80 to 89 /// Pioneer LaserDisc - LD = 80, - /// Pioneer LaserDisc data - LDROM = 81, - LDROM2 = 82, - LVROM = 83, - MegaLD = 84, + LD = 80, /// Pioneer LaserDisc data + LDROM = 81, LDROM2 = 82, LVROM = 83, MegaLD = 84, #endregion LaserDisc based, types 80 to 89 #region MiniDisc based, types 90 to 99 /// Sony Hi-MD - HiMD = 90, - /// Sony MiniDisc - MD = 91, - MDData = 92, - MDData2 = 93, + HiMD = 90, /// Sony MiniDisc + MD = 91, MDData = 92, MDData2 = 93, #endregion MiniDisc based, types 90 to 99 #region Plasmon UDO, types 100 to 109 @@ -231,84 +163,53 @@ namespace DiscImageChef.CommonTypes #endregion Plasmon UDO, types 100 to 109 #region Sony game media, types 110 to 129 - PlayStationMemoryCard = 110, - PlayStationMemoryCard2 = 111, - /// Sony PlayStation game CD - PS1CD = 112, - /// Sony PlayStation 2 game CD - PS2CD = 113, - /// Sony PlayStation 2 game DVD - PS2DVD = 114, - /// Sony PlayStation 3 game DVD - PS3DVD = 115, - /// Sony PlayStation 3 game Blu-ray - PS3BD = 116, - /// Sony PlayStation 4 game Blu-ray - PS4BD = 117, - /// Sony PlayStation Portable Universal Media Disc (ECMA-365) - UMD = 118, - PlayStationVitaGameCard = 119, + PlayStationMemoryCard = 110, PlayStationMemoryCard2 = 111, /// Sony PlayStation game CD + PS1CD = 112, /// Sony PlayStation 2 game CD + PS2CD = 113, /// Sony PlayStation 2 game DVD + PS2DVD = 114, /// Sony PlayStation 3 game DVD + PS3DVD = 115, /// Sony PlayStation 3 game Blu-ray + PS3BD = 116, /// Sony PlayStation 4 game Blu-ray + PS4BD = 117, /// Sony PlayStation Portable Universal Media Disc (ECMA-365) + UMD = 118, PlayStationVitaGameCard = 119, #endregion Sony game media, types 110 to 129 #region Microsoft game media, types 130 to 149 /// Microsoft X-box Game Disc - XGD = 130, - /// Microsoft X-box 360 Game Disc - XGD2 = 131, - /// Microsoft X-box 360 Game Disc - XGD3 = 132, - /// Microsoft X-box One Game Disc + XGD = 130, /// Microsoft X-box 360 Game Disc + XGD2 = 131, /// Microsoft X-box 360 Game Disc + XGD3 = 132, /// Microsoft X-box One Game Disc XGD4 = 133, #endregion Microsoft game media, types 130 to 149 #region Sega game media, types 150 to 169 /// Sega MegaCD - MEGACD = 150, - /// Sega Saturn disc - SATURNCD = 151, - /// Sega/Yamaha Gigabyte Disc - GDROM = 152, - /// Sega/Yamaha recordable Gigabyte Disc - GDR = 153, - SegaCard = 154, - MilCD = 155, + MEGACD = 150, /// Sega Saturn disc + SATURNCD = 151, /// Sega/Yamaha Gigabyte Disc + GDROM = 152, /// Sega/Yamaha recordable Gigabyte Disc + GDR = 153, SegaCard = 154, MilCD = 155, #endregion Sega game media, types 150 to 169 #region Other game media, types 170 to 179 /// PC-Engine / TurboGrafx cartridge - HuCard = 170, - /// PC-Engine / TurboGrafx CD - SuperCDROM2 = 171, - /// Atari Jaguar CD - JaguarCD = 172, - /// 3DO CD - ThreeDO = 173, - /// NEC PC-FX - PCFX = 174, - /// NEO-GEO CD - NeoGeoCD = 175, - /// Commodore CDTV - CDTV = 176, - /// Amiga CD32 - CD32 = 177, - /// Nuon (DVD based videogame console) - Nuon = 178, - /// Bandai Playdia + HuCard = 170, /// PC-Engine / TurboGrafx CD + SuperCDROM2 = 171, /// Atari Jaguar CD + JaguarCD = 172, /// 3DO CD + ThreeDO = 173, /// NEC PC-FX + PCFX = 174, /// NEO-GEO CD + NeoGeoCD = 175, /// Commodore CDTV + CDTV = 176, /// Amiga CD32 + CD32 = 177, /// Nuon (DVD based videogame console) + Nuon = 178, /// Bandai Playdia Playdia = 179, #endregion Other game media, types 170 to 179 #region Apple standard floppy format, types 180 to 189 /// 5.25", SS, DD, 35 tracks, 13 spt, 256 bytes/sector, GCR - Apple32SS = 180, - /// 5.25", DS, DD, 35 tracks, 13 spt, 256 bytes/sector, GCR - Apple32DS = 181, - /// 5.25", SS, DD, 35 tracks, 16 spt, 256 bytes/sector, GCR - Apple33SS = 182, - /// 5.25", DS, DD, 35 tracks, 16 spt, 256 bytes/sector, GCR - Apple33DS = 183, - /// 3.5", SS, DD, 80 tracks, 8 to 12 spt, 512 bytes/sector, GCR - AppleSonySS = 184, - /// 3.5", DS, DD, 80 tracks, 8 to 12 spt, 512 bytes/sector, GCR + Apple32SS = 180, /// 5.25", DS, DD, 35 tracks, 13 spt, 256 bytes/sector, GCR + Apple32DS = 181, /// 5.25", SS, DD, 35 tracks, 16 spt, 256 bytes/sector, GCR + Apple33SS = 182, /// 5.25", DS, DD, 35 tracks, 16 spt, 256 bytes/sector, GCR + Apple33DS = 183, /// 3.5", SS, DD, 80 tracks, 8 to 12 spt, 512 bytes/sector, GCR + AppleSonySS = 184, /// 3.5", DS, DD, 80 tracks, 8 to 12 spt, 512 bytes/sector, GCR AppleSonyDS = 185, /// 5.25", DS, ?D, ?? tracks, ?? spt, 512 bytes/sector, GCR, opposite side heads, aka Twiggy AppleFileWare = 186, @@ -316,37 +217,23 @@ namespace DiscImageChef.CommonTypes #region IBM/Microsoft PC floppy formats, types 190 to 209 /// 5.25", SS, DD, 40 tracks, 8 spt, 512 bytes/sector, MFM - DOS_525_SS_DD_8 = 190, - /// 5.25", SS, DD, 40 tracks, 9 spt, 512 bytes/sector, MFM - DOS_525_SS_DD_9 = 191, - /// 5.25", DS, DD, 40 tracks, 8 spt, 512 bytes/sector, MFM - DOS_525_DS_DD_8 = 192, - /// 5.25", DS, DD, 40 tracks, 9 spt, 512 bytes/sector, MFM - DOS_525_DS_DD_9 = 193, - /// 5.25", DS, HD, 80 tracks, 15 spt, 512 bytes/sector, MFM - DOS_525_HD = 194, - /// 3.5", SS, DD, 80 tracks, 8 spt, 512 bytes/sector, MFM - DOS_35_SS_DD_8 = 195, - /// 3.5", SS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM - DOS_35_SS_DD_9 = 196, - /// 3.5", DS, DD, 80 tracks, 8 spt, 512 bytes/sector, MFM - DOS_35_DS_DD_8 = 197, - /// 3.5", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM - DOS_35_DS_DD_9 = 198, - /// 3.5", DS, HD, 80 tracks, 18 spt, 512 bytes/sector, MFM - DOS_35_HD = 199, - /// 3.5", DS, ED, 80 tracks, 36 spt, 512 bytes/sector, MFM - DOS_35_ED = 200, - /// 3.5", DS, HD, 80 tracks, 21 spt, 512 bytes/sector, MFM - DMF = 201, - /// 3.5", DS, HD, 82 tracks, 21 spt, 512 bytes/sector, MFM - DMF_82 = 202, - /// - /// 5.25", DS, HD, 80 tracks, ? spt, ??? + ??? + ??? bytes/sector, MFM track 0 = ??15 sectors, 512 - /// bytes/sector, falsified to DOS as 19 spt, 512 bps + DOS_525_SS_DD_8 = 190, /// 5.25", SS, DD, 40 tracks, 9 spt, 512 bytes/sector, MFM + DOS_525_SS_DD_9 = 191, /// 5.25", DS, DD, 40 tracks, 8 spt, 512 bytes/sector, MFM + DOS_525_DS_DD_8 = 192, /// 5.25", DS, DD, 40 tracks, 9 spt, 512 bytes/sector, MFM + DOS_525_DS_DD_9 = 193, /// 5.25", DS, HD, 80 tracks, 15 spt, 512 bytes/sector, MFM + DOS_525_HD = 194, /// 3.5", SS, DD, 80 tracks, 8 spt, 512 bytes/sector, MFM + DOS_35_SS_DD_8 = 195, /// 3.5", SS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM + DOS_35_SS_DD_9 = 196, /// 3.5", DS, DD, 80 tracks, 8 spt, 512 bytes/sector, MFM + DOS_35_DS_DD_8 = 197, /// 3.5", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM + DOS_35_DS_DD_9 = 198, /// 3.5", DS, HD, 80 tracks, 18 spt, 512 bytes/sector, MFM + DOS_35_HD = 199, /// 3.5", DS, ED, 80 tracks, 36 spt, 512 bytes/sector, MFM + DOS_35_ED = 200, /// 3.5", DS, HD, 80 tracks, 21 spt, 512 bytes/sector, MFM + DMF = 201, /// 3.5", DS, HD, 82 tracks, 21 spt, 512 bytes/sector, MFM + DMF_82 = 202, /// + /// 5.25", DS, HD, 80 tracks, ? spt, ??? + ??? + ??? bytes/sector, MFM track 0 = ??15 sectors, 512 bytes/sector, + /// falsified to DOS as 19 spt, 512 bps /// - XDF_525 = 203, - /// + XDF_525 = 203, /// /// 3.5", DS, HD, 80 tracks, 4 spt, 8192 + 2048 + 1024 + 512 bytes/sector, MFM track 0 = 19 sectors, 512 /// bytes/sector, falsified to DOS as 23 spt, 512 bps /// @@ -355,8 +242,7 @@ namespace DiscImageChef.CommonTypes #region IBM standard floppy formats, types 210 to 219 /// 8", SS, SD, 32 tracks, 8 spt, 319 bytes/sector, FM - IBM23FD = 210, - /// 8", SS, SD, 73 tracks, 26 spt, 128 bytes/sector, FM + IBM23FD = 210, /// 8", SS, SD, 73 tracks, 26 spt, 128 bytes/sector, FM IBM33FD_128 = 211, /// 8", SS, SD, 74 tracks, 15 spt, 256 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector IBM33FD_256 = 212, @@ -365,18 +251,15 @@ namespace DiscImageChef.CommonTypes /// 8", DS, SD, 74 tracks, 26 spt, 128 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector IBM43FD_128 = 214, /// 8", DS, SD, 74 tracks, 26 spt, 256 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector - IBM43FD_256 = 215, - /// + IBM43FD_256 = 215, /// /// 8", DS, DD, 74 tracks, 26 spt, 256 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 /// side 1 = 26 sectors, 256 bytes/sector /// - IBM53FD_256 = 216, - /// + IBM53FD_256 = 216, /// /// 8", DS, DD, 74 tracks, 15 spt, 512 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 /// side 1 = 26 sectors, 256 bytes/sector /// - IBM53FD_512 = 217, - /// + IBM53FD_512 = 217, /// /// 8", DS, DD, 74 tracks, 8 spt, 1024 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 /// side 1 = 26 sectors, 256 bytes/sector /// @@ -385,88 +268,57 @@ namespace DiscImageChef.CommonTypes #region DEC standard floppy formats, types 220 to 229 /// 8", SS, DD, 77 tracks, 26 spt, 128 bytes/sector, FM - RX01 = 220, - /// 8", SS, DD, 77 tracks, 26 spt, 256 bytes/sector, FM/MFM - RX02 = 221, - /// 8", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, FM/MFM - RX03 = 222, - /// 5.25", SS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM + RX01 = 220, /// 8", SS, DD, 77 tracks, 26 spt, 256 bytes/sector, FM/MFM + RX02 = 221, /// 8", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, FM/MFM + RX03 = 222, /// 5.25", SS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM RX50 = 223, #endregion DEC standard floppy formats, types 220 to 229 #region Acorn standard floppy formats, types 230 to 239 /// 5,25", SS, SD, 40 tracks, 10 spt, 256 bytes/sector, FM - ACORN_525_SS_SD_40 = 230, - /// 5,25", SS, SD, 80 tracks, 10 spt, 256 bytes/sector, FM - ACORN_525_SS_SD_80 = 231, - /// 5,25", SS, DD, 40 tracks, 16 spt, 256 bytes/sector, MFM - ACORN_525_SS_DD_40 = 232, - /// 5,25", SS, DD, 80 tracks, 16 spt, 256 bytes/sector, MFM - ACORN_525_SS_DD_80 = 233, - /// 5,25", DS, DD, 80 tracks, 16 spt, 256 bytes/sector, MFM - ACORN_525_DS_DD = 234, - /// 3,5", DS, DD, 80 tracks, 5 spt, 1024 bytes/sector, MFM - ACORN_35_DS_DD = 235, - /// 3,5", DS, HD, 80 tracks, 10 spt, 1024 bytes/sector, MFM + ACORN_525_SS_SD_40 = 230, /// 5,25", SS, SD, 80 tracks, 10 spt, 256 bytes/sector, FM + ACORN_525_SS_SD_80 = 231, /// 5,25", SS, DD, 40 tracks, 16 spt, 256 bytes/sector, MFM + ACORN_525_SS_DD_40 = 232, /// 5,25", SS, DD, 80 tracks, 16 spt, 256 bytes/sector, MFM + ACORN_525_SS_DD_80 = 233, /// 5,25", DS, DD, 80 tracks, 16 spt, 256 bytes/sector, MFM + ACORN_525_DS_DD = 234, /// 3,5", DS, DD, 80 tracks, 5 spt, 1024 bytes/sector, MFM + ACORN_35_DS_DD = 235, /// 3,5", DS, HD, 80 tracks, 10 spt, 1024 bytes/sector, MFM ACORN_35_DS_HD = 236, #endregion Acorn standard floppy formats, types 230 to 239 #region Atari standard floppy formats, types 240 to 249 /// 5,25", SS, SD, 40 tracks, 18 spt, 128 bytes/sector, FM - ATARI_525_SD = 240, - /// 5,25", SS, ED, 40 tracks, 26 spt, 128 bytes/sector, MFM - ATARI_525_ED = 241, - /// 5,25", SS, DD, 40 tracks, 18 spt, 256 bytes/sector, MFM - ATARI_525_DD = 242, - /// 3,5", SS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM - ATARI_35_SS_DD = 243, - /// 3,5", DS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM - ATARI_35_DS_DD = 244, - /// 3,5", SS, DD, 80 tracks, 11 spt, 512 bytes/sector, MFM - ATARI_35_SS_DD_11 = 245, - /// 3,5", DS, DD, 80 tracks, 11 spt, 512 bytes/sector, MFM + ATARI_525_SD = 240, /// 5,25", SS, ED, 40 tracks, 26 spt, 128 bytes/sector, MFM + ATARI_525_ED = 241, /// 5,25", SS, DD, 40 tracks, 18 spt, 256 bytes/sector, MFM + ATARI_525_DD = 242, /// 3,5", SS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM + ATARI_35_SS_DD = 243, /// 3,5", DS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM + ATARI_35_DS_DD = 244, /// 3,5", SS, DD, 80 tracks, 11 spt, 512 bytes/sector, MFM + ATARI_35_SS_DD_11 = 245, /// 3,5", DS, DD, 80 tracks, 11 spt, 512 bytes/sector, MFM ATARI_35_DS_DD_11 = 246, #endregion Atari standard floppy formats, types 240 to 249 #region Commodore standard floppy formats, types 250 to 259 /// 3,5", DS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM (1581) - CBM_35_DD = 250, - /// 3,5", DS, DD, 80 tracks, 11 spt, 512 bytes/sector, MFM (Amiga) - CBM_AMIGA_35_DD = 251, - /// 3,5", DS, HD, 80 tracks, 22 spt, 512 bytes/sector, MFM (Amiga) - CBM_AMIGA_35_HD = 252, - /// 5,25", SS, DD, 35 tracks, GCR - CBM_1540 = 253, - /// 5,25", SS, DD, 40 tracks, GCR - CBM_1540_Ext = 254, - /// 5,25", DS, DD, 35 tracks, GCR + CBM_35_DD = 250, /// 3,5", DS, DD, 80 tracks, 11 spt, 512 bytes/sector, MFM (Amiga) + CBM_AMIGA_35_DD = 251, /// 3,5", DS, HD, 80 tracks, 22 spt, 512 bytes/sector, MFM (Amiga) + CBM_AMIGA_35_HD = 252, /// 5,25", SS, DD, 35 tracks, GCR + CBM_1540 = 253, /// 5,25", SS, DD, 40 tracks, GCR + CBM_1540_Ext = 254, /// 5,25", DS, DD, 35 tracks, GCR CBM_1571 = 255, #endregion Commodore standard floppy formats, types 250 to 259 #region NEC/SHARP standard floppy formats, types 260 to 269 /// 8", DS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM - NEC_8_SD = 260, - /// 8", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, MFM - NEC_8_DD = 261, - /// 5.25", SS, SD, 80 tracks, 16 spt, 256 bytes/sector, FM - NEC_525_SS = 262, - /// 5.25", DS, SD, 80 tracks, 16 spt, 256 bytes/sector, MFM - NEC_525_DS = 263, - /// 5,25", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM - NEC_525_HD = 264, - /// 3,5", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM, aka mode 3 - NEC_35_HD_8 = 265, - /// 3,5", DS, HD, 80 tracks, 15 spt, 512 bytes/sector, MFM - NEC_35_HD_15 = 266, - /// 3,5", DS, TD, 240 tracks, 38 spt, 512 bytes/sector, MFM - NEC_35_TD = 267, - /// 5,25", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM - SHARP_525 = NEC_525_HD, - /// 3,5", DS, HD, 80 tracks, 9 spt, 1024 bytes/sector, MFM - SHARP_525_9 = 268, - /// 3,5", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM - SHARP_35 = NEC_35_HD_8, - /// 3,5", DS, HD, 80 tracks, 9 spt, 1024 bytes/sector, MFM + NEC_8_SD = 260, /// 8", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, MFM + NEC_8_DD = 261, /// 5.25", SS, SD, 80 tracks, 16 spt, 256 bytes/sector, FM + NEC_525_SS = 262, /// 5.25", DS, SD, 80 tracks, 16 spt, 256 bytes/sector, MFM + NEC_525_DS = 263, /// 5,25", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM + NEC_525_HD = 264, /// 3,5", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM, aka mode 3 + NEC_35_HD_8 = 265, /// 3,5", DS, HD, 80 tracks, 15 spt, 512 bytes/sector, MFM + NEC_35_HD_15 = 266, /// 3,5", DS, TD, 240 tracks, 38 spt, 512 bytes/sector, MFM + NEC_35_TD = 267, /// 5,25", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM + SHARP_525 = NEC_525_HD, /// 3,5", DS, HD, 80 tracks, 9 spt, 1024 bytes/sector, MFM + SHARP_525_9 = 268, /// 3,5", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM + SHARP_35 = NEC_35_HD_8, /// 3,5", DS, HD, 80 tracks, 9 spt, 1024 bytes/sector, MFM SHARP_35_9 = 269, #endregion NEC/SHARP standard floppy formats, types 260 to 269 @@ -475,66 +327,50 @@ namespace DiscImageChef.CommonTypes /// 5,25", DS, DD, 80 tracks, 8 spt, 1024 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track /// 0 side 1 = 26 sectors, 256 bytes/sector /// - ECMA_99_8 = 270, - /// + ECMA_99_8 = 270, /// /// 5,25", DS, DD, 77 tracks, 15 spt, 512 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track /// 0 side 1 = 26 sectors, 256 bytes/sector /// - ECMA_99_15 = 271, - /// + ECMA_99_15 = 271, /// /// 5,25", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track /// 0 side 1 = 26 sectors, 256 bytes/sector /// - ECMA_99_26 = 272, - /// 3,5", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM - ECMA_100 = DOS_35_DS_DD_9, - /// 3,5", DS, HD, 80 tracks, 18 spt, 512 bytes/sector, MFM - ECMA_125 = DOS_35_HD, - /// 3,5", DS, ED, 80 tracks, 36 spt, 512 bytes/sector, MFM - ECMA_147 = DOS_35_ED, - /// 8", SS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM - ECMA_54 = 273, - /// 8", DS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM + ECMA_99_26 = 272, /// 3,5", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM + ECMA_100 = DOS_35_DS_DD_9, /// 3,5", DS, HD, 80 tracks, 18 spt, 512 bytes/sector, MFM + ECMA_125 = DOS_35_HD, /// 3,5", DS, ED, 80 tracks, 36 spt, 512 bytes/sector, MFM + ECMA_147 = DOS_35_ED, /// 8", SS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM + ECMA_54 = 273, /// 8", DS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM ECMA_59 = 274, /// 5,25", SS, DD, 35 tracks, 9 spt, 256 bytes/sector, FM, track 0 side 0 = 16 sectors, 128 bytes/sector - ECMA_66 = 275, - /// + ECMA_66 = 275, /// /// 8", DS, DD, 77 tracks, 8 spt, 1024 bytes/sector, FM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 /// side 1 = 26 sectors, 256 bytes/sector /// - ECMA_69_8 = 276, - /// + ECMA_69_8 = 276, /// /// 8", DS, DD, 77 tracks, 15 spt, 512 bytes/sector, FM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 /// side 1 = 26 sectors, 256 bytes/sector /// - ECMA_69_15 = 277, - /// + ECMA_69_15 = 277, /// /// 8", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, FM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 /// side 1 = 26 sectors, 256 bytes/sector /// - ECMA_69_26 = 278, - /// + ECMA_69_26 = 278, /// /// 5,25", DS, DD, 40 tracks, 16 spt, 256 bytes/sector, FM, track 0 side 0 = 16 sectors, 128 bytes/sector, track 0 /// side 1 = 16 sectors, 256 bytes/sector /// - ECMA_70 = 279, - /// + ECMA_70 = 279, /// /// 5,25", DS, DD, 80 tracks, 16 spt, 256 bytes/sector, FM, track 0 side 0 = 16 sectors, 128 bytes/sector, track 0 /// side 1 = 16 sectors, 256 bytes/sector /// - ECMA_78 = 280, - /// 5,25", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, FM + ECMA_78 = 280, /// 5,25", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, FM ECMA_78_2 = 281, #endregion ECMA floppy standards, types 270 to 289 #region Non-standard PC formats (FDFORMAT, 2M, etc), types 290 to 308 /// 5,25", DS, DD, 82 tracks, 10 spt, 512 bytes/sector, MFM - FDFORMAT_525_DD = 290, - /// 5,25", DS, HD, 82 tracks, 17 spt, 512 bytes/sector, MFM - FDFORMAT_525_HD = 291, - /// 3,5", DS, DD, 82 tracks, 10 spt, 512 bytes/sector, MFM - FDFORMAT_35_DD = 292, - /// 3,5", DS, HD, 82 tracks, 21 spt, 512 bytes/sector, MFM + FDFORMAT_525_DD = 290, /// 5,25", DS, HD, 82 tracks, 17 spt, 512 bytes/sector, MFM + FDFORMAT_525_HD = 291, /// 3,5", DS, DD, 82 tracks, 10 spt, 512 bytes/sector, MFM + FDFORMAT_35_DD = 292, /// 3,5", DS, HD, 82 tracks, 21 spt, 512 bytes/sector, MFM FDFORMAT_35_HD = 293, #endregion Non-standard PC formats (FDFORMAT, 2M, etc), types 290 to 308 @@ -544,47 +380,27 @@ namespace DiscImageChef.CommonTypes #endregion Apricot ACT standard floppy formats, type 309 #region OnStream ADR, types 310 to 319 - ADR2120 = 310, - ADR260 = 311, - ADR30 = 312, + ADR2120 = 310, ADR260 = 311, ADR30 = 312, ADR50 = 313, #endregion OnStream ADR, types 310 to 319 #region Advanced Intelligent Tape, types 320 to 339 - AIT1 = 320, - AIT1Turbo = 321, - AIT2 = 322, - AIT2Turbo = 323, - AIT3 = 324, - AIT3Ex = 325, - AIT3Turbo = 326, - AIT4 = 327, - AIT5 = 328, - AITETurbo = 329, - SAIT1 = 330, - SAIT2 = 331, + AIT1 = 320, AIT1Turbo = 321, AIT2 = 322, + AIT2Turbo = 323, AIT3 = 324, AIT3Ex = 325, + AIT3Turbo = 326, AIT4 = 327, AIT5 = 328, + AITETurbo = 329, SAIT1 = 330, SAIT2 = 331, #endregion Advanced Intelligent Tape, types 320 to 339 #region Iomega, types 340 to 359 - Bernoulli = 340, - Bernoulli2 = 341, - Ditto = 342, - DittoMax = 343, - Jaz = 344, - Jaz2 = 345, - PocketZip = 346, - REV120 = 347, - REV35 = 348, - REV70 = 349, - ZIP100 = 350, - ZIP250 = 351, - ZIP750 = 352, + Bernoulli = 340, Bernoulli2 = 341, Ditto = 342, + DittoMax = 343, Jaz = 344, Jaz2 = 345, + PocketZip = 346, REV120 = 347, REV35 = 348, + REV70 = 349, ZIP100 = 350, ZIP250 = 351, + ZIP750 = 352, #endregion Iomega, types 340 to 359 #region Audio or video media, types 360 to 369 - CompactCassette = 360, - Data8 = 361, - MiniDV = 362, + CompactCassette = 360, Data8 = 361, MiniDV = 362, /// D/CAS-25: Digital data on Compact Cassette form factor, special magnetic media, 9-track Dcas25 = 363, /// D/CAS-85: Digital data on Compact Cassette form factor, special magnetic media, 17-track @@ -594,267 +410,148 @@ namespace DiscImageChef.CommonTypes #endregion Audio media, types 360 to 369 #region CompactFlash Association, types 370 to 379 - CFast = 370, - CompactFlash = 371, - CompactFlashType2 = 372, + CFast = 370, CompactFlash = 371, CompactFlashType2 = 372, #endregion CompactFlash Association, types 370 to 379 #region Digital Audio Tape / Digital Data Storage, types 380 to 389 - DigitalAudioTape = 380, - DAT160 = 381, - DAT320 = 382, - DAT72 = 383, - DDS1 = 384, - DDS2 = 385, - DDS3 = 386, - DDS4 = 387, + DigitalAudioTape = 380, DAT160 = 381, DAT320 = 382, + DAT72 = 383, DDS1 = 384, DDS2 = 385, + DDS3 = 386, DDS4 = 387, #endregion Digital Audio Tape / Digital Data Storage, types 380 to 389 #region DEC, types 390 to 399 - CompactTapeI = 390, - CompactTapeII = 391, - DECtapeII = 392, - DLTtapeIII = 393, - DLTtapeIIIxt = 394, - DLTtapeIV = 395, - DLTtapeS4 = 396, - SDLT1 = 397, - SDLT2 = 398, - VStapeI = 399, + CompactTapeI = 390, CompactTapeII = 391, DECtapeII = 392, + DLTtapeIII = 393, DLTtapeIIIxt = 394, DLTtapeIV = 395, + DLTtapeS4 = 396, SDLT1 = 397, SDLT2 = 398, + VStapeI = 399, #endregion DEC, types 390 to 399 #region Exatape, types 400 to 419 - Exatape15m = 400, - Exatape22m = 401, - Exatape22mAME = 402, - Exatape28m = 403, - Exatape40m = 404, - Exatape45m = 405, - Exatape54m = 406, - Exatape75m = 407, - Exatape76m = 408, - Exatape80m = 409, - Exatape106m = 410, - Exatape160mXL = 411, - Exatape112m = 412, - Exatape125m = 413, - Exatape150m = 414, - Exatape170m = 415, - Exatape225m = 416, + Exatape15m = 400, Exatape22m = 401, Exatape22mAME = 402, + Exatape28m = 403, Exatape40m = 404, Exatape45m = 405, + Exatape54m = 406, Exatape75m = 407, Exatape76m = 408, + Exatape80m = 409, Exatape106m = 410, Exatape160mXL = 411, + Exatape112m = 412, Exatape125m = 413, Exatape150m = 414, + Exatape170m = 415, Exatape225m = 416, #endregion Exatape, types 400 to 419 #region PCMCIA / ExpressCard, types 420 to 429 - ExpressCard34 = 420, - ExpressCard54 = 421, - PCCardTypeI = 422, - PCCardTypeII = 423, - PCCardTypeIII = 424, - PCCardTypeIV = 425, + ExpressCard34 = 420, ExpressCard54 = 421, PCCardTypeI = 422, + PCCardTypeII = 423, PCCardTypeIII = 424, PCCardTypeIV = 425, #endregion PCMCIA / ExpressCard, types 420 to 429 #region SyQuest, types 430 to 449 - EZ135 = 430, - EZ230 = 431, - Quest = 432, - SparQ = 433, - SQ100 = 434, - SQ200 = 435, - SQ300 = 436, - SQ310 = 437, - SQ327 = 438, - SQ400 = 439, - SQ800 = 440, - SQ1500 = 441, - SQ2000 = 442, - SyJet = 443, + EZ135 = 430, EZ230 = 431, Quest = 432, + SparQ = 433, SQ100 = 434, SQ200 = 435, + SQ300 = 436, SQ310 = 437, SQ327 = 438, + SQ400 = 439, SQ800 = 440, SQ1500 = 441, + SQ2000 = 442, SyJet = 443, #endregion SyQuest, types 430 to 449 #region Nintendo, types 450 to 469 - FamicomGamePak = 450, - GameBoyAdvanceGamePak = 451, - GameBoyGamePak = 452, + FamicomGamePak = 450, GameBoyAdvanceGamePak = 451, GameBoyGamePak = 452, /// Nintendo GameCube Optical Disc - GOD = 453, - N64DD = 454, - N64GamePak = 455, - NESGamePak = 456, - Nintendo3DSGameCard = 457, - NintendoDiskCard = 458, - NintendoDSGameCard = 459, - NintendoDSiGameCard = 460, - SNESGamePak = 461, - SNESGamePakUS = 462, + GOD = 453, N64DD = 454, N64GamePak = 455, NESGamePak = 456, + Nintendo3DSGameCard = 457, NintendoDiskCard = 458, NintendoDSGameCard = 459, + NintendoDSiGameCard = 460, SNESGamePak = 461, SNESGamePakUS = 462, /// Nintendo Wii Optical Disc - WOD = 463, - /// Nintendo Wii U Optical Disc - WUOD = 464, - SwitchGameCard = 465, + WOD = 463, /// Nintendo Wii U Optical Disc + WUOD = 464, SwitchGameCard = 465, #endregion Nintendo, types 450 to 469 #region IBM Tapes, types 470 to 479 - IBM3470 = 470, - IBM3480 = 471, - IBM3490 = 472, - IBM3490E = 473, - IBM3592 = 474, + IBM3470 = 470, IBM3480 = 471, IBM3490 = 472, + IBM3490E = 473, IBM3592 = 474, #endregion IBM Tapes, types 470 to 479 #region LTO Ultrium, types 480 to 509 - LTO = 480, - LTO2 = 481, - LTO3 = 482, - LTO3WORM = 483, - LTO4 = 484, - LTO4WORM = 485, - LTO5 = 486, - LTO5WORM = 487, - LTO6 = 488, - LTO6WORM = 489, - LTO7 = 490, - LTO7WORM = 491, + LTO = 480, LTO2 = 481, LTO3 = 482, + LTO3WORM = 483, LTO4 = 484, LTO4WORM = 485, + LTO5 = 486, LTO5WORM = 487, LTO6 = 488, + LTO6WORM = 489, LTO7 = 490, LTO7WORM = 491, #endregion LTO Ultrium, types 480 to 509 #region MemoryStick, types 510 to 519 - MemoryStick = 510, - MemoryStickDuo = 511, - MemoryStickMicro = 512, - MemoryStickPro = 513, - MemoryStickProDuo = 514, + MemoryStick = 510, MemoryStickDuo = 511, MemoryStickMicro = 512, + MemoryStickPro = 513, MemoryStickProDuo = 514, #endregion MemoryStick, types 510 to 519 #region SecureDigital, types 520 to 529 - microSD = 520, - miniSD = 521, - SecureDigital = 522, + microSD = 520, miniSD = 521, SecureDigital = 522, #endregion SecureDigital, types 520 to 529 #region MultiMediaCard, types 530 to 539 - MMC = 530, - MMCmicro = 531, - RSMMC = 532, - MMCplus = 533, - MMCmobile = 534, + MMC = 530, MMCmicro = 531, RSMMC = 532, + MMCplus = 533, MMCmobile = 534, #endregion MultiMediaCard, types 530 to 539 #region SLR, types 540 to 569 - MLR1 = 540, - MLR1SL = 541, - MLR3 = 542, - SLR1 = 543, - SLR2 = 544, - SLR3 = 545, - SLR32 = 546, - SLR32SL = 547, - SLR4 = 548, - SLR5 = 549, - SLR5SL = 550, - SLR6 = 551, - SLRtape7 = 552, - SLRtape7SL = 553, - SLRtape24 = 554, - SLRtape24SL = 555, - SLRtape40 = 556, - SLRtape50 = 557, - SLRtape60 = 558, - SLRtape75 = 559, - SLRtape100 = 560, + MLR1 = 540, MLR1SL = 541, MLR3 = 542, + SLR1 = 543, SLR2 = 544, SLR3 = 545, + SLR32 = 546, SLR32SL = 547, SLR4 = 548, + SLR5 = 549, SLR5SL = 550, SLR6 = 551, + SLRtape7 = 552, SLRtape7SL = 553, SLRtape24 = 554, + SLRtape24SL = 555, SLRtape40 = 556, SLRtape50 = 557, + SLRtape60 = 558, SLRtape75 = 559, SLRtape100 = 560, SLRtape140 = 561, #endregion SLR, types 540 to 569 #region QIC, types 570 to 589 - QIC11 = 570, - QIC120 = 571, - QIC1350 = 572, - QIC150 = 573, - QIC24 = 574, - QIC3010 = 575, - QIC3020 = 576, - QIC3080 = 577, - QIC3095 = 578, - QIC320 = 579, - QIC40 = 580, - QIC525 = 581, + QIC11 = 570, QIC120 = 571, QIC1350 = 572, + QIC150 = 573, QIC24 = 574, QIC3010 = 575, + QIC3020 = 576, QIC3080 = 577, QIC3095 = 578, + QIC320 = 579, QIC40 = 580, QIC525 = 581, QIC80 = 582, #endregion QIC, types 570 to 589 #region StorageTek tapes, types 590 to 609 - STK4480 = 590, - STK4490 = 591, - STK9490 = 592, - T9840A = 593, - T9840B = 594, - T9840C = 595, - T9840D = 596, - T9940A = 597, - T9940B = 598, - T10000A = 599, - T10000B = 600, - T10000C = 601, + STK4480 = 590, STK4490 = 591, STK9490 = 592, + T9840A = 593, T9840B = 594, T9840C = 595, + T9840D = 596, T9940A = 597, T9940B = 598, + T10000A = 599, T10000B = 600, T10000C = 601, T10000D = 602, #endregion StorageTek tapes, types 590 to 609 #region Travan, types 610 to 619 - Travan = 610, - Travan1Ex = 611, - Travan3 = 612, - Travan3Ex = 613, - Travan4 = 614, - Travan5 = 615, + Travan = 610, Travan1Ex = 611, Travan3 = 612, + Travan3Ex = 613, Travan4 = 614, Travan5 = 615, Travan7 = 616, #endregion Travan, types 610 to 619 #region VXA, types 620 to 629 - VXA1 = 620, - VXA2 = 621, - VXA3 = 622, + VXA1 = 620, VXA2 = 621, VXA3 = 622, #endregion VXA, types 620 to 629 #region Magneto-optical, types 630 to 659 /// 5,25", M.O., ??? sectors, 1024 bytes/sector, ECMA-153, ISO 11560 - ECMA_153 = 630, - /// 5,25", M.O., ??? sectors, 512 bytes/sector, ECMA-153, ISO 11560 - ECMA_153_512 = 631, - /// 3,5", M.O., 249850 sectors, 512 bytes/sector, ECMA-154, ISO 10090 - ECMA_154 = 632, - /// 5,25", M.O., 904995 sectors, 512 bytes/sector, ECMA-183, ISO 13481 - ECMA_183_512 = 633, - /// 5,25", M.O., 498526 sectors, 1024 bytes/sector, ECMA-183, ISO 13481 + ECMA_153 = 630, /// 5,25", M.O., ??? sectors, 512 bytes/sector, ECMA-153, ISO 11560 + ECMA_153_512 = 631, /// 3,5", M.O., 249850 sectors, 512 bytes/sector, ECMA-154, ISO 10090 + ECMA_154 = 632, /// 5,25", M.O., 904995 sectors, 512 bytes/sector, ECMA-183, ISO 13481 + ECMA_183_512 = 633, /// 5,25", M.O., 498526 sectors, 1024 bytes/sector, ECMA-183, ISO 13481 ECMA_183 = 634, /// 5,25", M.O., 1128772 or 1163337 sectors, 512 bytes/sector, ECMA-183, ISO 13549 ECMA_184_512 = 635, /// 5,25", M.O., 603466 or 637041 sectors, 1024 bytes/sector, ECMA-183, ISO 13549 - ECMA_184 = 636, - /// 300mm, M.O., ??? sectors, 1024 bytes/sector, ECMA-189, ISO 13614 - ECMA_189 = 637, - /// 300mm, M.O., ??? sectors, 1024 bytes/sector, ECMA-190, ISO 13403 + ECMA_184 = 636, /// 300mm, M.O., ??? sectors, 1024 bytes/sector, ECMA-189, ISO 13614 + ECMA_189 = 637, /// 300mm, M.O., ??? sectors, 1024 bytes/sector, ECMA-190, ISO 13403 ECMA_190 = 638, /// 5,25", M.O., 936921 or 948770 sectors, 1024 bytes/sector, ECMA-195, ISO 13842 ECMA_195 = 639, /// 5,25", M.O., 1644581 or 1647371 sectors, 512 bytes/sector, ECMA-195, ISO 13842 - ECMA_195_512 = 640, - /// 3,5", M.O., 446325 sectors, 512 bytes/sector, ECMA-201, ISO 13963 - ECMA_201 = 641, - /// 3,5", M.O., 429975 sectors, 512 bytes/sector, embossed, ISO 13963 - ECMA_201_ROM = 642, - /// 3,5", M.O., 371371 sectors, 1024 bytes/sector, ECMA-223 - ECMA_223 = 643, - /// 3,5", M.O., 694929 sectors, 512 bytes/sector, ECMA-223 - ECMA_223_512 = 644, - /// 5,25", M.O., 1244621 sectors, 1024 bytes/sector, ECMA-238, ISO 15486 + ECMA_195_512 = 640, /// 3,5", M.O., 446325 sectors, 512 bytes/sector, ECMA-201, ISO 13963 + ECMA_201 = 641, /// 3,5", M.O., 429975 sectors, 512 bytes/sector, embossed, ISO 13963 + ECMA_201_ROM = 642, /// 3,5", M.O., 371371 sectors, 1024 bytes/sector, ECMA-223 + ECMA_223 = 643, /// 3,5", M.O., 694929 sectors, 512 bytes/sector, ECMA-223 + ECMA_223_512 = 644, /// 5,25", M.O., 1244621 sectors, 1024 bytes/sector, ECMA-238, ISO 15486 ECMA_238 = 645, /// 3,5", M.O., 318988, 320332 or 321100 sectors, 2048 bytes/sector, ECMA-239, ISO 15498 - ECMA_239 = 646, - /// 356mm, M.O., 14476734 sectors, 1024 bytes/sector, ECMA-260, ISO 15898 - ECMA_260 = 647, - /// 356mm, M.O., 24445990 sectors, 1024 bytes/sector, ECMA-260, ISO 15898 + ECMA_239 = 646, /// 356mm, M.O., 14476734 sectors, 1024 bytes/sector, ECMA-260, ISO 15898 + ECMA_260 = 647, /// 356mm, M.O., 24445990 sectors, 1024 bytes/sector, ECMA-260, ISO 15898 ECMA_260_Double = 648, /// 5,25", M.O., 1128134 sectors, 2048 bytes/sector, ECMA-280, ISO 18093 - ECMA_280 = 649, - /// 300mm, M.O., 7355716 sectors, 2048 bytes/sector, ECMA-317, ISO 20162 - ECMA_317 = 650, - /// 5,25", M.O., 1095840 sectors, 4096 bytes/sector, ECMA-322, ISO 22092 - ECMA_322 = 651, - /// 5,25", M.O., 2043664 sectors, 2048 bytes/sector, ECMA-322, ISO 22092 + ECMA_280 = 649, /// 300mm, M.O., 7355716 sectors, 2048 bytes/sector, ECMA-317, ISO 20162 + ECMA_317 = 650, /// 5,25", M.O., 1095840 sectors, 4096 bytes/sector, ECMA-322, ISO 22092 + ECMA_322 = 651, /// 5,25", M.O., 2043664 sectors, 2048 bytes/sector, ECMA-322, ISO 22092 ECMA_322_2k = 652, /// 3,5", M.O., 605846 sectors, 2048 bytes/sector, Cherry Book, GigaMo, ECMA-351, ISO 17346 GigaMo = 653, @@ -863,46 +560,25 @@ namespace DiscImageChef.CommonTypes #endregion Magneto-optical, types 630 to 659 #region Other floppy standards, types 660 to 689 - CompactFloppy = 660, - DemiDiskette = 661, + CompactFloppy = 660, DemiDiskette = 661, /// 3.5", 652 tracks, 2 sides, 512 bytes/sector, Floptical, ECMA-207, ISO 14169 - Floptical = 662, - HiFD = 663, - QuickDisk = 664, - UHD144 = 665, - VideoFloppy = 666, - Wafer = 667, - ZXMicrodrive = 668, + Floptical = 662, HiFD = 663, QuickDisk = 664, UHD144 = 665, + VideoFloppy = 666, Wafer = 667, ZXMicrodrive = 668, #endregion Other floppy standards, types 660 to 669 #region Miscellaneous, types 670 to 689 - BeeCard = 670, - Borsu = 671, - DataStore = 672, - DIR = 673, - DST = 674, - DTF = 675, - DTF2 = 676, - Flextra3020 = 677, - Flextra3225 = 678, - HiTC1 = 679, - HiTC2 = 680, - LT1 = 681, - MiniCard = 872, - Orb = 683, - Orb5 = 684, - SmartMedia = 685, - xD = 686, - XQD = 687, - DataPlay = 688, + BeeCard = 670, Borsu = 671, DataStore = 672, + DIR = 673, DST = 674, DTF = 675, + DTF2 = 676, Flextra3020 = 677, Flextra3225 = 678, + HiTC1 = 679, HiTC2 = 680, LT1 = 681, + MiniCard = 872, Orb = 683, Orb5 = 684, + SmartMedia = 685, xD = 686, XQD = 687, + DataPlay = 688, #endregion Miscellaneous, types 670 to 689 #region Apple specific media, types 690 to 699 - AppleProfile = 690, - AppleWidget = 691, - AppleHD20 = 692, - PriamDataTower = 693, - Pippin = 694, + AppleProfile = 690, AppleWidget = 691, AppleHD20 = 692, + PriamDataTower = 693, Pippin = 694, #endregion Apple specific media, types 690 to 699 #region DEC hard disks, types 700 to 729 @@ -910,133 +586,107 @@ namespace DiscImageChef.CommonTypes /// 2382 cylinders, 4 tracks/cylinder, 42 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, /// 204890112 bytes /// - RA60 = 700, - /// + RA60 = 700, /// /// 546 cylinders, 14 tracks/cylinder, 31 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, /// 121325568 bytes /// - RA80 = 701, - /// + RA80 = 701, /// /// 1248 cylinders, 14 tracks/cylinder, 51 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, /// 456228864 bytes /// - RA81 = 702, - /// + RA81 = 702, /// /// 302 cylinders, 4 tracks/cylinder, 42 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 25976832 /// bytes /// - RC25 = 703, - /// + RC25 = 703, /// /// 615 cylinders, 4 tracks/cylinder, 17 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 21411840 /// bytes /// - RD31 = 704, - /// + RD31 = 704, /// /// 820 cylinders, 6 tracks/cylinder, 17 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 42823680 /// bytes /// - RD32 = 705, - /// + RD32 = 705, /// /// 306 cylinders, 4 tracks/cylinder, 17 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 10653696 /// bytes /// - RD51 = 706, - /// + RD51 = 706, /// /// 480 cylinders, 7 tracks/cylinder, 18 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 30965760 /// bytes /// - RD52 = 707, - /// + RD52 = 707, /// /// 1024 cylinders, 7 tracks/cylinder, 18 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, /// 75497472 bytes /// - RD53 = 708, - /// + RD53 = 708, /// /// 1225 cylinders, 8 tracks/cylinder, 18 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, /// 159936000 bytes /// - RD54 = 709, - /// + RD54 = 709, /// /// 411 cylinders, 3 tracks/cylinder, 22 sectors/track, 256 words/sector, 16 bits/word, 512 bytes/sector, 13888512 /// bytes /// - RK06 = 710, - /// + RK06 = 710, /// /// 411 cylinders, 3 tracks/cylinder, 20 sectors/track, 256 words/sector, 18 bits/word, 576 bytes/sector, 14204160 /// bytes /// - RK06_18 = 711, - /// + RK06_18 = 711, /// /// 815 cylinders, 3 tracks/cylinder, 22 sectors/track, 256 words/sector, 16 bits/word, 512 bytes/sector, 27540480 /// bytes /// - RK07 = 712, - /// + RK07 = 712, /// /// 815 cylinders, 3 tracks/cylinder, 20 sectors/track, 256 words/sector, 18 bits/word, 576 bytes/sector, 28166400 /// bytes /// - RK07_18 = 713, - /// + RK07_18 = 713, /// /// 823 cylinders, 5 tracks/cylinder, 32 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 67420160 /// bytes /// - RM02 = 714, - /// + RM02 = 714, /// /// 823 cylinders, 5 tracks/cylinder, 32 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 67420160 /// bytes /// - RM03 = 715, - /// + RM03 = 715, /// /// 823 cylinders, 19 tracks/cylinder, 32 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, /// 256196608 bytes /// - RM05 = 716, - /// + RM05 = 716, /// /// 203 cylinders, 10 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, /// 22865920 bytes /// - RP02 = 717, - /// + RP02 = 717, /// /// 203 cylinders, 10 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word, 576 bytes/sector, /// 23385600 bytes /// - RP02_18 = 718, - /// + RP02_18 = 718, /// /// 400 cylinders, 10 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, /// 45056000 bytes /// - RP03 = 719, - /// + RP03 = 719, /// /// 400 cylinders, 10 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word, 576 bytes/sector, /// 46080000 bytes /// - RP03_18 = 720, - /// + RP03_18 = 720, /// /// 411 cylinders, 19 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, /// 87960576 bytes /// - RP04 = 721, - /// + RP04 = 721, /// /// 411 cylinders, 19 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word, 576 bytes/sector, /// 89959680 bytes /// - RP04_18 = 722, - /// + RP04_18 = 722, /// /// 411 cylinders, 19 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, /// 87960576 bytes /// - RP05 = 723, - /// + RP05 = 723, /// /// 411 cylinders, 19 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word, 576 bytes/sector, /// 89959680 bytes /// - RP05_18 = 724, - /// + RP05_18 = 724, /// /// 815 cylinders, 19 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, /// 174423040 bytes /// - RP06 = 725, - /// + RP06 = 725, /// /// 815 cylinders, 19 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word, 576 bytes/sector, /// 178387200 bytes /// @@ -1044,18 +694,13 @@ namespace DiscImageChef.CommonTypes #endregion DEC hard disks, types 700 to 729 #region Imation, types 730 to 739 - LS120 = 730, - LS240 = 731, - FD32MB = 732, - RDX = 733, - /// Imation 320Gb RDX + LS120 = 730, LS240 = 731, FD32MB = 732, + RDX = 733, /// Imation 320Gb RDX RDX320 = 734, #endregion Imation, types 730 to 739 #region VideoNow, types 740 to 749 - VideoNow = 740, - VideoNowColor = 741, - VideoNowXp = 742 + VideoNow = 740, VideoNowColor = 741, VideoNowXp = 742 #endregion } } \ No newline at end of file diff --git a/MediaTypeFromSCSI.cs b/MediaTypeFromSCSI.cs index f77c459..994702f 100644 --- a/MediaTypeFromSCSI.cs +++ b/MediaTypeFromSCSI.cs @@ -40,12 +40,10 @@ using System; namespace DiscImageChef.CommonTypes { -#pragma warning disable RECS0063 // Warns when a culture-aware 'StartsWith' call is used by default. + #pragma warning disable RECS0063 // Warns when a culture-aware 'StartsWith' call is used by default. public static class MediaTypeFromScsi { - /// - /// Tries to guess, from SCSI information, the media type of a device and/or its inserted media - /// + /// Tries to guess, from SCSI information, the media type of a device and/or its inserted media /// The SCSI Peripheral Type as indicated in the INQUIRY response /// The vendor string of the device /// The model string of the device @@ -55,27 +53,33 @@ namespace DiscImageChef.CommonTypes /// Size in bytes of each block /// public static MediaType Get(byte scsiPeripheralType, string vendor, string model, byte mediumType, - byte densityCode, ulong blocks, uint blockSize) + byte densityCode, ulong blocks, uint blockSize) { - switch (scsiPeripheralType) + switch(scsiPeripheralType) { // Direct access device case 0x00: // Simpilified access device case 0x0E: { - if (mediumType == 0x03 || mediumType == 0x05 || mediumType == 0x07) goto case 0x07; + if(mediumType == 0x03 || + mediumType == 0x05 || + mediumType == 0x07) + goto case 0x07; - if (vendor.ToLowerInvariant() == "syquest") + if(vendor.ToLowerInvariant() == "syquest") { - if (blocks == 173400 && blockSize == 256) return MediaType.SQ400; + if(blocks == 173400 && + blockSize == 256) + return MediaType.SQ400; - if (blockSize != 512) return MediaType.Unknown; + if(blockSize != 512) + return MediaType.Unknown; - if (model.ToLowerInvariant().StartsWith("syjet", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("syjet", StringComparison.Ordinal)) return MediaType.SyJet; - switch (blocks) + switch(blocks) { case 262144: return MediaType.EZ135; case 524288: return MediaType.SQ327; @@ -84,65 +88,80 @@ namespace DiscImageChef.CommonTypes return MediaType.Unknown; } - if (vendor.ToLowerInvariant().StartsWith("iomega", StringComparison.Ordinal) && - (model.ToLowerInvariant().StartsWith("clik", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("pocketzip", StringComparison.Ordinal)) && - blockSize == 512 && - blocks == 78882) return MediaType.PocketZip; + if(vendor.ToLowerInvariant().StartsWith("iomega", StringComparison.Ordinal) && + (model.ToLowerInvariant().StartsWith("clik", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("pocketzip", StringComparison.Ordinal)) && + blockSize == 512 && + blocks == 78882) + return MediaType.PocketZip; - if (model.ToLowerInvariant().StartsWith("zip", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("zip", StringComparison.Ordinal)) { - if (blockSize != 512) return MediaType.Unknown; + if(blockSize != 512) + return MediaType.Unknown; - if (blocks == 196608) return MediaType.ZIP100; + if(blocks == 196608) + return MediaType.ZIP100; return blocks == 489532 ? MediaType.ZIP250 : MediaType.ZIP750; } - if (model.ToLowerInvariant().StartsWith("jaz", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("jaz", StringComparison.Ordinal)) { - if (blockSize != 512) return MediaType.Unknown; + if(blockSize != 512) + return MediaType.Unknown; - if (blocks == 2091050) return MediaType.Jaz; + if(blocks == 2091050) + return MediaType.Jaz; return blocks == 3915600 ? MediaType.Jaz2 : MediaType.Unknown; } - if (model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal)) { - if (blockSize == 512) + if(blockSize == 512) { - if (blocks == 469504) return MediaType.LS240; - if (blocks == 246528) return MediaType.LS120; - if (blocks == 65536) return MediaType.FD32MB; - if (blocks == 2880) return MediaType.DOS_35_HD; - if (blocks == 1440) return MediaType.DOS_35_DS_DD_9; + if(blocks == 469504) + return MediaType.LS240; + + if(blocks == 246528) + return MediaType.LS120; + + if(blocks == 65536) + return MediaType.FD32MB; + + if(blocks == 2880) + return MediaType.DOS_35_HD; + + if(blocks == 1440) + return MediaType.DOS_35_DS_DD_9; } - else if (blockSize == 1024) + else if(blockSize == 1024) { - if (blocks == 1232) + if(blocks == 1232) return MediaType.NEC_35_HD_8; } return MediaType.Unknown; } - if (model.ToLowerInvariant().StartsWith("rdx", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("rdx", StringComparison.Ordinal)) { - if (blockSize != 512) return MediaType.Unknown; + if(blockSize != 512) + return MediaType.Unknown; return blocks == 625134256 ? MediaType.RDX320 : MediaType.RDX; } - switch (mediumType) + switch(mediumType) { case 0x01: - switch (blockSize) + switch(blockSize) { case 128: - switch (blocks) + switch(blocks) { - case 720: return MediaType.ATARI_525_SD; + case 720: return MediaType.ATARI_525_SD; case 1040: return MediaType.ATARI_525_DD; case 1898: return MediaType.IBM33FD_128; case 2002: return MediaType.ECMA_54; @@ -150,15 +169,15 @@ namespace DiscImageChef.CommonTypes break; case 256: - switch (blocks) + switch(blocks) { - case 322: return MediaType.ECMA_66; - case 400: return MediaType.ACORN_525_SS_SD_40; - case 455: return MediaType.Apple32SS; - case 560: return MediaType.Apple33SS; - case 640: return MediaType.ACORN_525_SS_DD_40; - case 720: return MediaType.ATARI_525_DD; - case 800: return MediaType.ACORN_525_SS_SD_80; + case 322: return MediaType.ECMA_66; + case 400: return MediaType.ACORN_525_SS_SD_40; + case 455: return MediaType.Apple32SS; + case 560: return MediaType.Apple33SS; + case 640: return MediaType.ACORN_525_SS_DD_40; + case 720: return MediaType.ATARI_525_DD; + case 800: return MediaType.ACORN_525_SS_SD_80; case 1121: return MediaType.IBM33FD_256; case 1280: return MediaType.ACORN_525_SS_DD_80; case 2002: return MediaType.RX02; @@ -166,22 +185,22 @@ namespace DiscImageChef.CommonTypes break; case 319: - switch (blocks) + switch(blocks) { case 256: return MediaType.IBM23FD; } break; case 512: - switch (blocks) + switch(blocks) { - case 320: return MediaType.DOS_525_DS_DD_8; - case 360: return MediaType.DOS_35_SS_DD_9; - case 610: return MediaType.IBM33FD_512; - case 630: return MediaType.Apricot_35; - case 640: return MediaType.DOS_35_SS_DD_8; - case 720: return MediaType.DOS_35_DS_DD_9; - case 800: return MediaType.AppleSonySS; + case 320: return MediaType.DOS_525_DS_DD_8; + case 360: return MediaType.DOS_35_SS_DD_9; + case 610: return MediaType.IBM33FD_512; + case 630: return MediaType.Apricot_35; + case 640: return MediaType.DOS_35_SS_DD_8; + case 720: return MediaType.DOS_35_DS_DD_9; + case 800: return MediaType.AppleSonySS; case 249850: return MediaType.ECMA_154; case 429975: return MediaType.ECMA_201_ROM; case 446325: return MediaType.ECMA_201; @@ -198,7 +217,7 @@ namespace DiscImageChef.CommonTypes break; case 1024: { - switch (blocks) + switch(blocks) { case 371371: return MediaType.ECMA_223; case 498526: return MediaType.ECMA_183; @@ -206,7 +225,7 @@ namespace DiscImageChef.CommonTypes case 637041: return MediaType.ECMA_184; case 936921: case 948770: return MediaType.ECMA_195; - case 1244621: return MediaType.ECMA_238; + case 1244621: return MediaType.ECMA_238; case 14476734: return MediaType.ECMA_260; case 24445990: return MediaType.ECMA_260_Double; } @@ -215,13 +234,13 @@ namespace DiscImageChef.CommonTypes break; case 2048: { - switch (blocks) + switch(blocks) { case 310352: // Found in real media case 318988: case 320332: case 321100: return MediaType.ECMA_239; - case 605846: return MediaType.GigaMo; + case 605846: return MediaType.GigaMo; case 1063146: return MediaType.GigaMo2; case 1128134: return MediaType.ECMA_280; case 2043664: return MediaType.ECMA_322_2k; @@ -232,7 +251,7 @@ namespace DiscImageChef.CommonTypes break; case 4096: { - switch (blocks) + switch(blocks) { case 1095840: return MediaType.ECMA_322; } @@ -241,7 +260,7 @@ namespace DiscImageChef.CommonTypes break; case 8192: { - switch (blocks) + switch(blocks) { case 1834348: return MediaType.UDO; case 3668759: return MediaType.UDO2_WORM; @@ -254,10 +273,10 @@ namespace DiscImageChef.CommonTypes return MediaType.Unknown; case 0x02: - switch (blockSize) + switch(blockSize) { case 128: - switch (blocks) + switch(blocks) { case 3848: return MediaType.IBM43FD_128; case 4004: return MediaType.ECMA_59; @@ -265,9 +284,9 @@ namespace DiscImageChef.CommonTypes break; case 256: - switch (blocks) + switch(blocks) { - case 910: return MediaType.Apple32DS; + case 910: return MediaType.Apple32DS; case 1120: return MediaType.Apple33DS; case 1280: return MediaType.ECMA_70; case 2560: return MediaType.ECMA_78; @@ -277,23 +296,23 @@ namespace DiscImageChef.CommonTypes break; case 512: - switch (blocks) + switch(blocks) { - case 640: return MediaType.DOS_525_DS_DD_8; - case 720: return MediaType.DOS_525_DS_DD_9; - case 1280: return MediaType.DOS_35_DS_DD_8; - case 1440: return MediaType.DOS_35_DS_DD_9; - case 1640: return MediaType.FDFORMAT_35_DD; - case 1760: return MediaType.CBM_AMIGA_35_DD; - case 2242: return MediaType.IBM53FD_512; - case 2332: return MediaType.ECMA_99_15; - case 2400: return MediaType.DOS_525_HD; - case 2788: return MediaType.FDFORMAT_525_HD; - case 2880: return MediaType.DOS_35_HD; - case 3360: return MediaType.DMF; - case 3444: return MediaType.FDFORMAT_35_HD; - case 3520: return MediaType.CBM_AMIGA_35_HD; - case 5760: return MediaType.DOS_35_ED; + case 640: return MediaType.DOS_525_DS_DD_8; + case 720: return MediaType.DOS_525_DS_DD_9; + case 1280: return MediaType.DOS_35_DS_DD_8; + case 1440: return MediaType.DOS_35_DS_DD_9; + case 1640: return MediaType.FDFORMAT_35_DD; + case 1760: return MediaType.CBM_AMIGA_35_DD; + case 2242: return MediaType.IBM53FD_512; + case 2332: return MediaType.ECMA_99_15; + case 2400: return MediaType.DOS_525_HD; + case 2788: return MediaType.FDFORMAT_525_HD; + case 2880: return MediaType.DOS_35_HD; + case 3360: return MediaType.DMF; + case 3444: return MediaType.FDFORMAT_35_HD; + case 3520: return MediaType.CBM_AMIGA_35_HD; + case 5760: return MediaType.DOS_35_ED; case 249850: return MediaType.ECMA_154; case 429975: return MediaType.ECMA_201_ROM; case 446325: return MediaType.ECMA_201; @@ -309,22 +328,22 @@ namespace DiscImageChef.CommonTypes break; case 1024: - switch (blocks) + switch(blocks) { - case 800: return MediaType.ACORN_35_DS_DD; - case 1600: return MediaType.ACORN_35_DS_HD; - case 1220: return MediaType.IBM53FD_1024; - case 1232: return MediaType.SHARP_35; - case 1268: return MediaType.ECMA_69_8; - case 1280: return MediaType.NEC_525_HD; - case 1316: return MediaType.ECMA_99_8; + case 800: return MediaType.ACORN_35_DS_DD; + case 1600: return MediaType.ACORN_35_DS_HD; + case 1220: return MediaType.IBM53FD_1024; + case 1232: return MediaType.SHARP_35; + case 1268: return MediaType.ECMA_69_8; + case 1280: return MediaType.NEC_525_HD; + case 1316: return MediaType.ECMA_99_8; case 371371: return MediaType.ECMA_223; case 498526: return MediaType.ECMA_183; case 603466: case 637041: return MediaType.ECMA_184; case 936921: case 948770: return MediaType.ECMA_195; - case 1244621: return MediaType.ECMA_238; + case 1244621: return MediaType.ECMA_238; case 14476734: return MediaType.ECMA_260; case 24445990: return MediaType.ECMA_260_Double; } @@ -332,13 +351,13 @@ namespace DiscImageChef.CommonTypes break; case 2048: { - switch (blocks) + switch(blocks) { case 310352: // Found in real media case 318988: case 320332: case 321100: return MediaType.ECMA_239; - case 605846: return MediaType.GigaMo; + case 605846: return MediaType.GigaMo; case 1063146: return MediaType.GigaMo2; case 1128134: return MediaType.ECMA_280; case 2043664: return MediaType.ECMA_322_2k; @@ -349,7 +368,7 @@ namespace DiscImageChef.CommonTypes break; case 4096: { - switch (blocks) + switch(blocks) { case 1095840: return MediaType.ECMA_322; } @@ -358,7 +377,7 @@ namespace DiscImageChef.CommonTypes break; case 8192: { - switch (blocks) + switch(blocks) { case 1834348: return MediaType.UDO; case 3668759: return MediaType.UDO2_WORM; @@ -373,10 +392,10 @@ namespace DiscImageChef.CommonTypes case 0x09: return MediaType.ECMA_54; case 0x0A: return MediaType.ECMA_59; case 0x0B: - switch (blockSize) + switch(blockSize) { - case 256: return MediaType.ECMA_69_26; - case 512: return MediaType.ECMA_69_15; + case 256: return MediaType.ECMA_69_26; + case 512: return MediaType.ECMA_69_15; case 1024: return MediaType.ECMA_69_8; } @@ -384,7 +403,7 @@ namespace DiscImageChef.CommonTypes case 0x0E: return MediaType.ECMA_66; case 0x12: return MediaType.ECMA_70; case 0x16: - switch (blockSize) + switch(blockSize) { case 256: return MediaType.ECMA_78; case 512: return MediaType.ECMA_78_2; @@ -392,20 +411,21 @@ namespace DiscImageChef.CommonTypes return MediaType.Unknown; case 0x1A: - switch (blockSize) + switch(blockSize) { - case 256: return MediaType.ECMA_99_26; - case 512: return MediaType.ECMA_99_15; + case 256: return MediaType.ECMA_99_26; + case 512: return MediaType.ECMA_99_15; case 1024: return MediaType.ECMA_99_8; } return MediaType.Unknown; case 0x1E: return MediaType.DOS_35_DS_DD_9; case 0x41: - switch (blocks) + switch(blocks) { case 58620544: return MediaType.REV120; case 17090880: return MediaType.REV35; + // TODO: Unknown value default: return MediaType.REV70; } @@ -415,13 +435,13 @@ namespace DiscImageChef.CommonTypes case 0x94: return MediaType.DOS_35_HD; } - switch (blockSize) + switch(blockSize) { case 128: { - switch (blocks) + switch(blocks) { - case 720: return MediaType.ATARI_525_SD; + case 720: return MediaType.ATARI_525_SD; case 1040: return MediaType.ATARI_525_ED; case 1898: return MediaType.IBM33FD_128; case 2002: return MediaType.ECMA_54; @@ -433,16 +453,16 @@ namespace DiscImageChef.CommonTypes break; case 256: { - switch (blocks) + switch(blocks) { - case 322: return MediaType.ECMA_66; - case 400: return MediaType.ACORN_525_SS_SD_40; - case 455: return MediaType.Apple32SS; - case 560: return MediaType.Apple33SS; - case 640: return MediaType.ACORN_525_SS_DD_40; - case 720: return MediaType.ATARI_525_DD; - case 800: return MediaType.ACORN_525_SS_SD_80; - case 910: return MediaType.Apple32DS; + case 322: return MediaType.ECMA_66; + case 400: return MediaType.ACORN_525_SS_SD_40; + case 455: return MediaType.Apple32SS; + case 560: return MediaType.Apple33SS; + case 640: return MediaType.ACORN_525_SS_DD_40; + case 720: return MediaType.ATARI_525_DD; + case 800: return MediaType.ACORN_525_SS_SD_80; + case 910: return MediaType.Apple32DS; case 1120: return MediaType.Apple33DS; case 1121: return MediaType.IBM33FD_256; case 1280: return MediaType.ECMA_70; @@ -455,7 +475,7 @@ namespace DiscImageChef.CommonTypes break; case 319: - switch (blocks) + switch(blocks) { case 256: return MediaType.IBM23FD; } @@ -463,14 +483,14 @@ namespace DiscImageChef.CommonTypes break; case 512: { - switch (blocks) + switch(blocks) { - case 320: return MediaType.DOS_525_SS_DD_8; - case 360: return MediaType.DOS_525_SS_DD_9; - case 610: return MediaType.IBM33FD_512; - case 640: return MediaType.DOS_525_DS_DD_8; - case 720: return MediaType.DOS_525_DS_DD_9; - case 800: return MediaType.AppleSonySS; + case 320: return MediaType.DOS_525_SS_DD_8; + case 360: return MediaType.DOS_525_SS_DD_9; + case 610: return MediaType.IBM33FD_512; + case 640: return MediaType.DOS_525_DS_DD_8; + case 720: return MediaType.DOS_525_DS_DD_9; + case 800: return MediaType.AppleSonySS; case 1280: return MediaType.DOS_35_DS_DD_8; case 1440: return MediaType.DOS_35_DS_DD_9; case 1600: return MediaType.ACORN_35_DS_DD; @@ -491,7 +511,7 @@ namespace DiscImageChef.CommonTypes break; case 1024: { - switch (blocks) + switch(blocks) { case 1220: return MediaType.IBM53FD_1024; case 1232: return MediaType.SHARP_35; @@ -510,10 +530,10 @@ namespace DiscImageChef.CommonTypes // Sequential access device case 0x01: { - switch (mediumType) + switch(mediumType) { case 0x00: - switch (densityCode) + switch(densityCode) { case 0x04: return MediaType.QIC11; case 0x05: return MediaType.QIC24; @@ -527,9 +547,10 @@ namespace DiscImageChef.CommonTypes case 0x28: return MediaType.IBM3490E; case 0x40: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO; - if (model.ToLowerInvariant().StartsWith("sdz", StringComparison.Ordinal)) + + if(model.ToLowerInvariant().StartsWith("sdz", StringComparison.Ordinal)) return MediaType.SAIT1; break; @@ -537,7 +558,7 @@ namespace DiscImageChef.CommonTypes case 0x41: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO2; break; @@ -545,76 +566,88 @@ namespace DiscImageChef.CommonTypes case 0x42: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO2; - if (vendor.ToLowerInvariant() == "stk") return MediaType.T9840A; + + if(vendor.ToLowerInvariant() == "stk") + return MediaType.T9840A; break; } case 0x43: { - if (vendor.ToLowerInvariant() == "stk") return MediaType.T9940A; + if(vendor.ToLowerInvariant() == "stk") + return MediaType.T9940A; break; } case 0x44: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO3; - if (vendor.ToLowerInvariant() == "stk") return MediaType.T9940B; + + if(vendor.ToLowerInvariant() == "stk") + return MediaType.T9940B; break; } case 0x45: { - if (vendor.ToLowerInvariant() == "stk") return MediaType.T9840C; + if(vendor.ToLowerInvariant() == "stk") + return MediaType.T9840C; break; } case 0x46: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO4; - if (vendor.ToLowerInvariant() == "stk") return MediaType.T9840D; + + if(vendor.ToLowerInvariant() == "stk") + return MediaType.T9840D; break; } case 0x4A: { - if (vendor.ToLowerInvariant() == "stk") return MediaType.T10000A; + if(vendor.ToLowerInvariant() == "stk") + return MediaType.T10000A; break; } case 0x4B: { - if (vendor.ToLowerInvariant() == "stk") return MediaType.T10000B; + if(vendor.ToLowerInvariant() == "stk") + return MediaType.T10000B; break; } case 0x4C: { - if (vendor.ToLowerInvariant() == "stk") return MediaType.T10000C; + if(vendor.ToLowerInvariant() == "stk") + return MediaType.T10000C; break; } case 0x4D: { - if (vendor.ToLowerInvariant() == "stk") return MediaType.T10000D; + if(vendor.ToLowerInvariant() == "stk") + return MediaType.T10000D; break; } case 0x58: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO5; break; @@ -632,11 +665,11 @@ namespace DiscImageChef.CommonTypes break; case 0x01: { - switch (densityCode) + switch(densityCode) { case 0x44: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO3WORM; break; @@ -644,7 +677,7 @@ namespace DiscImageChef.CommonTypes case 0x46: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO4WORM; break; @@ -652,7 +685,7 @@ namespace DiscImageChef.CommonTypes case 0x58: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO5WORM; break; @@ -663,11 +696,11 @@ namespace DiscImageChef.CommonTypes break; case 0x18: { - switch (densityCode) + switch(densityCode) { case 0x00: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO; break; @@ -683,11 +716,11 @@ namespace DiscImageChef.CommonTypes break; case 0x28: { - switch (densityCode) + switch(densityCode) { case 0x00: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO2; break; @@ -700,12 +733,12 @@ namespace DiscImageChef.CommonTypes break; case 0x33: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x25: { - if (model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) return MediaType.DDS3; break; @@ -716,12 +749,12 @@ namespace DiscImageChef.CommonTypes break; case 0x34: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x26: { - if (model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) return MediaType.DDS4; break; @@ -732,12 +765,12 @@ namespace DiscImageChef.CommonTypes break; case 0x35: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x47: { - if (model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) return MediaType.DAT72; break; @@ -748,12 +781,12 @@ namespace DiscImageChef.CommonTypes break; case 0x38: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x44: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO3; break; @@ -764,12 +797,12 @@ namespace DiscImageChef.CommonTypes break; case 0x3C: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x44: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO3WORM; break; @@ -780,12 +813,12 @@ namespace DiscImageChef.CommonTypes break; case 0x48: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x46: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO4; break; @@ -796,12 +829,12 @@ namespace DiscImageChef.CommonTypes break; case 0x4C: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x46: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO4WORM; break; @@ -812,27 +845,28 @@ namespace DiscImageChef.CommonTypes break; case 0x50: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x24: { - if (model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) return MediaType.DDS2; break; } } } + break; case 0x58: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x58: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO5; break; @@ -843,12 +877,12 @@ namespace DiscImageChef.CommonTypes break; case 0x5C: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x58: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO5WORM; break; @@ -859,12 +893,12 @@ namespace DiscImageChef.CommonTypes break; case 0x68: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x5A: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO6; break; @@ -875,12 +909,12 @@ namespace DiscImageChef.CommonTypes break; case 0x6C: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x5A: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO6WORM; break; @@ -891,12 +925,12 @@ namespace DiscImageChef.CommonTypes break; case 0x78: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x5C: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO7; break; @@ -907,12 +941,12 @@ namespace DiscImageChef.CommonTypes break; case 0x7C: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x5C: { - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) return MediaType.LTO7WORM; break; @@ -923,14 +957,17 @@ namespace DiscImageChef.CommonTypes break; case 0x81: { - switch (densityCode) + switch(densityCode) { case 0x00: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape15m; - if (vendor.ToLowerInvariant() == "ibm") return MediaType.IBM3592; - if (model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) + + if(vendor.ToLowerInvariant() == "ibm") + return MediaType.IBM3592; + + if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) return MediaType.VXA1; break; @@ -942,7 +979,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape15m; break; @@ -951,14 +988,15 @@ namespace DiscImageChef.CommonTypes case 0x29: case 0x2A: { - if (vendor.ToLowerInvariant() == "ibm") return MediaType.IBM3592; + if(vendor.ToLowerInvariant() == "ibm") + return MediaType.IBM3592; break; } case 0x80: { - if (model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) return MediaType.VXA1; break; @@ -969,20 +1007,22 @@ namespace DiscImageChef.CommonTypes break; case 0x82: { - switch (densityCode) + switch(densityCode) { case 0x00: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape28m; - if (vendor.ToLowerInvariant() == "ibm") return MediaType.IBM3592; + + if(vendor.ToLowerInvariant() == "ibm") + return MediaType.IBM3592; break; } case 0x0A: { - if (model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) return MediaType.CompactTapeI; break; @@ -994,7 +1034,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape28m; break; @@ -1002,7 +1042,7 @@ namespace DiscImageChef.CommonTypes case 0x16: { - if (model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) return MediaType.CompactTapeII; break; @@ -1011,14 +1051,15 @@ namespace DiscImageChef.CommonTypes case 0x29: case 0x2A: { - if (vendor.ToLowerInvariant() == "ibm") return MediaType.IBM3592; + if(vendor.ToLowerInvariant() == "ibm") + return MediaType.IBM3592; break; } case 0x81: { - if (model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) return MediaType.VXA2; break; @@ -1026,7 +1067,7 @@ namespace DiscImageChef.CommonTypes case 0x82: { - if (model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) return MediaType.VXA3; break; @@ -1037,13 +1078,14 @@ namespace DiscImageChef.CommonTypes break; case 0x83: { - switch (densityCode) + switch(densityCode) { case 0x00: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape54m; - if (model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) return MediaType.DLTtapeIII; break; @@ -1055,7 +1097,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape54m; break; @@ -1067,7 +1109,7 @@ namespace DiscImageChef.CommonTypes case 0x80: case 0x81: { - if (model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) return MediaType.DLTtapeIII; break; @@ -1078,13 +1120,14 @@ namespace DiscImageChef.CommonTypes break; case 0x84: { - switch (densityCode) + switch(densityCode) { case 0x00: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape80m; - if (model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) return MediaType.DLTtapeIIIxt; break; @@ -1096,7 +1139,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape80m; break; @@ -1106,7 +1149,7 @@ namespace DiscImageChef.CommonTypes case 0x80: case 0x81: { - if (model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) return MediaType.DLTtapeIIIxt; break; @@ -1117,17 +1160,19 @@ namespace DiscImageChef.CommonTypes break; case 0x85: { - switch (densityCode) + switch(densityCode) { case 0x00: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape106m; - if (model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) return MediaType.DLTtapeIV; - if (model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) + + if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) return MediaType.Travan5; break; @@ -1139,7 +1184,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape106m; break; @@ -1158,9 +1203,9 @@ namespace DiscImageChef.CommonTypes case 0x88: case 0x89: { - if (model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) return MediaType.DLTtapeIV; break; @@ -1168,7 +1213,7 @@ namespace DiscImageChef.CommonTypes case 0x46: { - if (model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) return MediaType.Travan5; break; @@ -1179,16 +1224,17 @@ namespace DiscImageChef.CommonTypes break; case 0x86: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape160mXL; - if (model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) return MediaType.SDLT1; break; @@ -1196,7 +1242,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape160mXL; break; @@ -1206,9 +1252,9 @@ namespace DiscImageChef.CommonTypes case 0x92: case 0x93: { - if (model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) return MediaType.SDLT1; break; @@ -1219,14 +1265,14 @@ namespace DiscImageChef.CommonTypes break; case 0x87: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x4A: { - if (model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) return MediaType.SDLT2; break; @@ -1237,16 +1283,16 @@ namespace DiscImageChef.CommonTypes break; case 0x90: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x50: case 0x98: case 0x99: { - if (model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) return MediaType.VStapeI; break; @@ -1257,14 +1303,14 @@ namespace DiscImageChef.CommonTypes break; case 0x95: { - if (model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) return MediaType.Travan7; } break; case 0xC1: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x14: @@ -1272,7 +1318,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape22m; break; @@ -1283,7 +1329,7 @@ namespace DiscImageChef.CommonTypes break; case 0xC2: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x14: @@ -1292,7 +1338,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape40m; break; @@ -1303,7 +1349,7 @@ namespace DiscImageChef.CommonTypes break; case 0xC3: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x14: @@ -1312,7 +1358,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape76m; break; @@ -1323,7 +1369,7 @@ namespace DiscImageChef.CommonTypes break; case 0xC4: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x14: @@ -1332,7 +1378,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape112m; break; @@ -1343,13 +1389,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD1: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape22mAME; break; @@ -1360,13 +1406,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD2: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape170m; break; @@ -1377,13 +1423,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD3: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape125m; break; @@ -1394,13 +1440,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD4: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape45m; break; @@ -1411,13 +1457,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD5: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape225m; break; @@ -1428,13 +1474,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD6: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape150m; break; @@ -1445,13 +1491,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD7: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) return MediaType.Exatape75m; break; @@ -1470,14 +1516,18 @@ namespace DiscImageChef.CommonTypes // Optical device case 0x07: { - if (mediumType != 0x01 && mediumType != 0x02 && mediumType != 0x03 && mediumType != 0x05 && - mediumType != 0x07) return MediaType.UnknownMO; + if(mediumType != 0x01 && + mediumType != 0x02 && + mediumType != 0x03 && + mediumType != 0x05 && + mediumType != 0x07) + return MediaType.UnknownMO; - switch (blockSize) + switch(blockSize) { case 512: { - switch (blocks) + switch(blocks) { case 249850: return MediaType.ECMA_154; case 429975: return MediaType.ECMA_201_ROM; @@ -1496,7 +1546,7 @@ namespace DiscImageChef.CommonTypes case 1024: { - switch (blocks) + switch(blocks) { case 371371: return MediaType.ECMA_223; case 498526: return MediaType.ECMA_183; @@ -1504,47 +1554,47 @@ namespace DiscImageChef.CommonTypes case 637041: return MediaType.ECMA_184; case 936921: case 948770: return MediaType.ECMA_195; - case 1244621: return MediaType.ECMA_238; + case 1244621: return MediaType.ECMA_238; case 14476734: return MediaType.ECMA_260; case 24445990: return MediaType.ECMA_260_Double; - default: return MediaType.UnknownMO; + default: return MediaType.UnknownMO; } } case 2048: { - switch (blocks) + switch(blocks) { case 310352: // Found in real media case 318988: case 320332: case 321100: return MediaType.ECMA_239; - case 605846: return MediaType.GigaMo; + case 605846: return MediaType.GigaMo; case 1063146: return MediaType.GigaMo2; case 1128134: return MediaType.ECMA_280; case 2043664: return MediaType.ECMA_322_2k; case 7355716: return MediaType.ECMA_317; - default: return MediaType.UnknownMO; + default: return MediaType.UnknownMO; } } case 4096: { - switch (blocks) + switch(blocks) { case 1095840: return MediaType.ECMA_322; - default: return MediaType.UnknownMO; + default: return MediaType.UnknownMO; } } case 8192: { - switch (blocks) + switch(blocks) { case 1834348: return MediaType.UDO; case 3668759: return MediaType.UDO2_WORM; case 3669724: return MediaType.UDO2; - default: return MediaType.UnknownMO; + default: return MediaType.UnknownMO; } } @@ -1555,14 +1605,12 @@ namespace DiscImageChef.CommonTypes // MultiMedia Device case 0x05: { - switch (mediumType) + switch(mediumType) { case 0x00: - return blockSize == 512 - ? blocks == 1281856 - ? MediaType.PD650_WORM - : MediaType.PD650 - : MediaType.CD; + return blockSize == 512 ? blocks == 1281856 + ? MediaType.PD650_WORM + : MediaType.PD650 : MediaType.CD; case 0x01: case 0x05: return MediaType.CDROM; case 0x02: @@ -1589,8 +1637,8 @@ namespace DiscImageChef.CommonTypes case 0x27: case 0x28: return MediaType.CDRW; case 0x80: - if (model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - switch (densityCode) + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + switch(densityCode) { case 0x42: return MediaType.LTO2; case 0x44: return MediaType.LTO3; @@ -1603,6 +1651,7 @@ namespace DiscImageChef.CommonTypes } break; + // Host managed zoned block device case 0x14: { @@ -1613,5 +1662,5 @@ namespace DiscImageChef.CommonTypes return MediaType.Unknown; } } -#pragma warning restore RECS0063 // Warns when a culture-aware 'StartsWith' call is used by default. + #pragma warning restore RECS0063 // Warns when a culture-aware 'StartsWith' call is used by default. } \ No newline at end of file diff --git a/Metadata/DeviceReport.cs b/Metadata/DeviceReport.cs index f73ca68..5e79982 100644 --- a/Metadata/DeviceReport.cs +++ b/Metadata/DeviceReport.cs @@ -48,8 +48,7 @@ using Newtonsoft.Json; namespace DiscImageChef.CommonTypes.Metadata { - [Serializable] - [XmlRoot("DicDeviceReport", Namespace = "", IsNullable = false)] + [Serializable, XmlRoot("DicDeviceReport", Namespace = "", IsNullable = false)] public class DeviceReport { public usbType USB { get; set; } @@ -981,8 +980,7 @@ namespace DiscImageChef.CommonTypes.Metadata public class SupportedDensity { - [XmlIgnore] - [JsonIgnore] + [XmlIgnore, JsonIgnore] public int Id { get; set; } public byte PrimaryCode { get; set; } public byte SecondaryCode { get; set; } @@ -1000,8 +998,7 @@ namespace DiscImageChef.CommonTypes.Metadata public class SupportedMedia { - [XmlIgnore] - [JsonIgnore] + [XmlIgnore, JsonIgnore] public int Id { get; set; } public byte MediumType { get; set; } public int[] DensityCodes { get; set; } diff --git a/Metadata/DeviceReportV2.cs b/Metadata/DeviceReportV2.cs index 1041229..e9638b5 100644 --- a/Metadata/DeviceReportV2.cs +++ b/Metadata/DeviceReportV2.cs @@ -61,10 +61,18 @@ namespace DiscImageChef.CommonTypes.Metadata public DeviceReportV2(DeviceReport reportV1) { - if(reportV1.USB != null) USB = new Usb(reportV1.USB); - if(reportV1.FireWire != null) FireWire = new FireWire(reportV1.FireWire); - if(reportV1.PCMCIA != null) PCMCIA = new Pcmcia(reportV1.PCMCIA); - if(reportV1.CompactFlashSpecified) CompactFlash = reportV1.CompactFlash; + if(reportV1.USB != null) + USB = new Usb(reportV1.USB); + + if(reportV1.FireWire != null) + FireWire = new FireWire(reportV1.FireWire); + + if(reportV1.PCMCIA != null) + PCMCIA = new Pcmcia(reportV1.PCMCIA); + + if(reportV1.CompactFlashSpecified) + CompactFlash = reportV1.CompactFlash; + if(reportV1.ATA != null) { ATA = new Ata(reportV1.ATA); @@ -113,7 +121,8 @@ namespace DiscImageChef.CommonTypes.Metadata Model = reportV1.SCSI.Inquiry.ProductIdentification; Revision = reportV1.SCSI.Inquiry.ProductRevisionLevel; } - else if(reportV1.ATA != null || reportV1.ATAPI != null) + else if(reportV1.ATA != null || + reportV1.ATAPI != null) { ataType ata = reportV1.ATA ?? reportV1.ATAPI; @@ -124,7 +133,8 @@ namespace DiscImageChef.CommonTypes.Metadata Manufacturer = split[0]; Model = string.Join(" ", split, 1, split.Length - 1); } - else Model = ata.Model; + else + Model = ata.Model; Revision = ata.FirmwareRevision; } @@ -202,7 +212,8 @@ namespace DiscImageChef.CommonTypes.Metadata { Identify = ata.Identify; - if(ata.ReadCapabilities != null) ReadCapabilities = new TestedMedia(ata.ReadCapabilities, true); + if(ata.ReadCapabilities != null) + ReadCapabilities = new TestedMedia(ata.ReadCapabilities, true); if(ata.RemovableMedias != null) { @@ -212,170 +223,247 @@ namespace DiscImageChef.CommonTypes.Metadata RemovableMedias.Add(new TestedMedia(ataRemovableMedia, true)); } - if(Identify != null) return; + if(Identify != null) + return; - Identify.IdentifyDevice identifyDevice = new Identify.IdentifyDevice(); + var identifyDevice = new Identify.IdentifyDevice(); - if(ata.AdditionalPIDSpecified) identifyDevice.AdditionalPID = ata.AdditionalPID; + if(ata.AdditionalPIDSpecified) + identifyDevice.AdditionalPID = ata.AdditionalPID; - if(ata.APIOSupportedSpecified) identifyDevice.APIOSupported = ata.APIOSupported; + if(ata.APIOSupportedSpecified) + identifyDevice.APIOSupported = ata.APIOSupported; - if(ata.ATAPIByteCountSpecified) identifyDevice.ATAPIByteCount = ata.ATAPIByteCount; + if(ata.ATAPIByteCountSpecified) + identifyDevice.ATAPIByteCount = ata.ATAPIByteCount; - if(ata.BufferTypeSpecified) identifyDevice.BufferType = ata.BufferType; + if(ata.BufferTypeSpecified) + identifyDevice.BufferType = ata.BufferType; - if(ata.BufferSizeSpecified) identifyDevice.BufferSize = ata.BufferSize; + if(ata.BufferSizeSpecified) + identifyDevice.BufferSize = ata.BufferSize; - if(ata.CapabilitiesSpecified) identifyDevice.Capabilities = ata.Capabilities; + if(ata.CapabilitiesSpecified) + identifyDevice.Capabilities = ata.Capabilities; - if(ata.Capabilities2Specified) identifyDevice.Capabilities2 = ata.Capabilities2; + if(ata.Capabilities2Specified) + identifyDevice.Capabilities2 = ata.Capabilities2; - if(ata.Capabilities3Specified) identifyDevice.Capabilities3 = ata.Capabilities3; + if(ata.Capabilities3Specified) + identifyDevice.Capabilities3 = ata.Capabilities3; - if(ata.CFAPowerModeSpecified) identifyDevice.CFAPowerMode = ata.CFAPowerMode; + if(ata.CFAPowerModeSpecified) + identifyDevice.CFAPowerMode = ata.CFAPowerMode; - if(ata.CommandSetSpecified) identifyDevice.CommandSet = ata.CommandSet; + if(ata.CommandSetSpecified) + identifyDevice.CommandSet = ata.CommandSet; - if(ata.CommandSet2Specified) identifyDevice.CommandSet2 = ata.CommandSet2; + if(ata.CommandSet2Specified) + identifyDevice.CommandSet2 = ata.CommandSet2; - if(ata.CommandSet3Specified) identifyDevice.CommandSet3 = ata.CommandSet3; + if(ata.CommandSet3Specified) + identifyDevice.CommandSet3 = ata.CommandSet3; - if(ata.CommandSet4Specified) identifyDevice.CommandSet4 = ata.CommandSet4; + if(ata.CommandSet4Specified) + identifyDevice.CommandSet4 = ata.CommandSet4; - if(ata.CommandSet5Specified) identifyDevice.CommandSet4 = ata.CommandSet4; + if(ata.CommandSet5Specified) + identifyDevice.CommandSet4 = ata.CommandSet4; - if(ata.CurrentAAMSpecified) identifyDevice.CurrentAAM = ata.CurrentAAM; + if(ata.CurrentAAMSpecified) + identifyDevice.CurrentAAM = ata.CurrentAAM; - if(ata.CurrentAPMSpecified) identifyDevice.CurrentAPM = ata.CurrentAPM; + if(ata.CurrentAPMSpecified) + identifyDevice.CurrentAPM = ata.CurrentAPM; - if(ata.DataSetMgmtSpecified) identifyDevice.DataSetMgmt = ata.DataSetMgmt; + if(ata.DataSetMgmtSpecified) + identifyDevice.DataSetMgmt = ata.DataSetMgmt; - if(ata.DataSetMgmtSizeSpecified) identifyDevice.DataSetMgmtSize = ata.DataSetMgmtSize; + if(ata.DataSetMgmtSizeSpecified) + identifyDevice.DataSetMgmtSize = ata.DataSetMgmtSize; - if(ata.DeviceFormFactorSpecified) identifyDevice.DeviceFormFactor = ata.DeviceFormFactor; + if(ata.DeviceFormFactorSpecified) + identifyDevice.DeviceFormFactor = ata.DeviceFormFactor; - if(ata.DMAActiveSpecified) identifyDevice.DMAActive = ata.DMAActive; + if(ata.DMAActiveSpecified) + identifyDevice.DMAActive = ata.DMAActive; - if(ata.DMASupportedSpecified) identifyDevice.DMASupported = ata.DMASupported; + if(ata.DMASupportedSpecified) + identifyDevice.DMASupported = ata.DMASupported; - if(ata.DMATransferTimingModeSpecified) identifyDevice.DMATransferTimingMode = ata.DMATransferTimingMode; + if(ata.DMATransferTimingModeSpecified) + identifyDevice.DMATransferTimingMode = ata.DMATransferTimingMode; if(ata.EnhancedSecurityEraseTimeSpecified) identifyDevice.EnhancedSecurityEraseTime = ata.EnhancedSecurityEraseTime; - if(ata.EnabledCommandSetSpecified) identifyDevice.EnabledCommandSet = ata.EnabledCommandSet; + if(ata.EnabledCommandSetSpecified) + identifyDevice.EnabledCommandSet = ata.EnabledCommandSet; - if(ata.EnabledCommandSet2Specified) identifyDevice.EnabledCommandSet2 = ata.EnabledCommandSet2; + if(ata.EnabledCommandSet2Specified) + identifyDevice.EnabledCommandSet2 = ata.EnabledCommandSet2; - if(ata.EnabledCommandSet3Specified) identifyDevice.EnabledCommandSet3 = ata.EnabledCommandSet3; + if(ata.EnabledCommandSet3Specified) + identifyDevice.EnabledCommandSet3 = ata.EnabledCommandSet3; - if(ata.EnabledCommandSet4Specified) identifyDevice.EnabledCommandSet4 = ata.EnabledCommandSet4; + if(ata.EnabledCommandSet4Specified) + identifyDevice.EnabledCommandSet4 = ata.EnabledCommandSet4; - if(ata.EnabledSATAFeaturesSpecified) identifyDevice.EnabledSATAFeatures = ata.EnabledSATAFeatures; + if(ata.EnabledSATAFeaturesSpecified) + identifyDevice.EnabledSATAFeatures = ata.EnabledSATAFeatures; - if(ata.ExtendedUserSectorsSpecified) identifyDevice.ExtendedUserSectors = ata.ExtendedUserSectors; + if(ata.ExtendedUserSectorsSpecified) + identifyDevice.ExtendedUserSectors = ata.ExtendedUserSectors; - if(ata.FreeFallSensitivitySpecified) identifyDevice.FreeFallSensitivity = ata.FreeFallSensitivity; + if(ata.FreeFallSensitivitySpecified) + identifyDevice.FreeFallSensitivity = ata.FreeFallSensitivity; - if(ata.FirmwareRevisionSpecified) identifyDevice.FirmwareRevision = ata.FirmwareRevision; + if(ata.FirmwareRevisionSpecified) + identifyDevice.FirmwareRevision = ata.FirmwareRevision; - if(ata.GeneralConfigurationSpecified) identifyDevice.GeneralConfiguration = ata.GeneralConfiguration; + if(ata.GeneralConfigurationSpecified) + identifyDevice.GeneralConfiguration = ata.GeneralConfiguration; - if(ata.HardwareResetResultSpecified) identifyDevice.HardwareResetResult = ata.HardwareResetResult; + if(ata.HardwareResetResultSpecified) + identifyDevice.HardwareResetResult = ata.HardwareResetResult; - if(ata.InterseekDelaySpecified) identifyDevice.InterseekDelay = ata.InterseekDelay; + if(ata.InterseekDelaySpecified) + identifyDevice.InterseekDelay = ata.InterseekDelay; - if(ata.MajorVersionSpecified) identifyDevice.MajorVersion = ata.MajorVersion; + if(ata.MajorVersionSpecified) + identifyDevice.MajorVersion = ata.MajorVersion; if(ata.MasterPasswordRevisionCodeSpecified) identifyDevice.MasterPasswordRevisionCode = ata.MasterPasswordRevisionCode; - if(ata.MaxDownloadMicroMode3Specified) identifyDevice.MaxDownloadMicroMode3 = ata.MaxDownloadMicroMode3; + if(ata.MaxDownloadMicroMode3Specified) + identifyDevice.MaxDownloadMicroMode3 = ata.MaxDownloadMicroMode3; - if(ata.MaxQueueDepthSpecified) identifyDevice.MaxQueueDepth = ata.MaxQueueDepth; + if(ata.MaxQueueDepthSpecified) + identifyDevice.MaxQueueDepth = ata.MaxQueueDepth; - if(ata.MDMAActiveSpecified) identifyDevice.MDMAActive = ata.MDMAActive; + if(ata.MDMAActiveSpecified) + identifyDevice.MDMAActive = ata.MDMAActive; - if(ata.MDMASupportedSpecified) identifyDevice.MDMASupported = ata.MDMASupported; + if(ata.MDMASupportedSpecified) + identifyDevice.MDMASupported = ata.MDMASupported; - if(ata.MinDownloadMicroMode3Specified) identifyDevice.MinDownloadMicroMode3 = ata.MinDownloadMicroMode3; + if(ata.MinDownloadMicroMode3Specified) + identifyDevice.MinDownloadMicroMode3 = ata.MinDownloadMicroMode3; - if(ata.MinMDMACycleTimeSpecified) identifyDevice.MinMDMACycleTime = ata.MinMDMACycleTime; + if(ata.MinMDMACycleTimeSpecified) + identifyDevice.MinMDMACycleTime = ata.MinMDMACycleTime; - if(ata.MinorVersionSpecified) identifyDevice.MinorVersion = ata.MinorVersion; + if(ata.MinorVersionSpecified) + identifyDevice.MinorVersion = ata.MinorVersion; - if(ata.MinPIOCycleTimeNoFlowSpecified) identifyDevice.MinPIOCycleTimeNoFlow = ata.MinPIOCycleTimeNoFlow; + if(ata.MinPIOCycleTimeNoFlowSpecified) + identifyDevice.MinPIOCycleTimeNoFlow = ata.MinPIOCycleTimeNoFlow; - if(ata.MinPIOCycleTimeFlowSpecified) identifyDevice.MinPIOCycleTimeFlow = ata.MinPIOCycleTimeFlow; + if(ata.MinPIOCycleTimeFlowSpecified) + identifyDevice.MinPIOCycleTimeFlow = ata.MinPIOCycleTimeFlow; - if(ata.ModelSpecified) identifyDevice.Model = ata.Model; + if(ata.ModelSpecified) + identifyDevice.Model = ata.Model; - if(ata.MultipleMaxSectorsSpecified) identifyDevice.MultipleMaxSectors = ata.MultipleMaxSectors; + if(ata.MultipleMaxSectorsSpecified) + identifyDevice.MultipleMaxSectors = ata.MultipleMaxSectors; - if(ata.MultipleSectorNumberSpecified) identifyDevice.MultipleSectorNumber = ata.MultipleSectorNumber; + if(ata.MultipleSectorNumberSpecified) + identifyDevice.MultipleSectorNumber = ata.MultipleSectorNumber; - if(ata.NVCacheCapsSpecified) identifyDevice.NVCacheCaps = ata.NVCacheCaps; + if(ata.NVCacheCapsSpecified) + identifyDevice.NVCacheCaps = ata.NVCacheCaps; - if(ata.NVCacheSizeSpecified) identifyDevice.NVCacheSize = ata.NVCacheSize; + if(ata.NVCacheSizeSpecified) + identifyDevice.NVCacheSize = ata.NVCacheSize; - if(ata.NVCacheWriteSpeedSpecified) identifyDevice.NVCacheWriteSpeed = ata.NVCacheWriteSpeed; + if(ata.NVCacheWriteSpeedSpecified) + identifyDevice.NVCacheWriteSpeed = ata.NVCacheWriteSpeed; - if(ata.NVEstimatedSpinUpSpecified) identifyDevice.NVEstimatedSpinUp = ata.NVEstimatedSpinUp; + if(ata.NVEstimatedSpinUpSpecified) + identifyDevice.NVEstimatedSpinUp = ata.NVEstimatedSpinUp; - if(ata.PacketBusReleaseSpecified) identifyDevice.PacketBusRelease = ata.PacketBusRelease; + if(ata.PacketBusReleaseSpecified) + identifyDevice.PacketBusRelease = ata.PacketBusRelease; - if(ata.PIOTransferTimingModeSpecified) identifyDevice.PIOTransferTimingMode = ata.PIOTransferTimingMode; + if(ata.PIOTransferTimingModeSpecified) + identifyDevice.PIOTransferTimingMode = ata.PIOTransferTimingMode; - if(ata.RecommendedAAMSpecified) identifyDevice.RecommendedAAM = ata.RecommendedAAM; + if(ata.RecommendedAAMSpecified) + identifyDevice.RecommendedAAM = ata.RecommendedAAM; - if(ata.RecommendedMDMACycleTimeSpecified) identifyDevice.RecMDMACycleTime = ata.RecommendedMDMACycleTime; + if(ata.RecommendedMDMACycleTimeSpecified) + identifyDevice.RecMDMACycleTime = ata.RecommendedMDMACycleTime; - if(ata.RemovableStatusSetSpecified) identifyDevice.RemovableStatusSet = ata.RemovableStatusSet; + if(ata.RemovableStatusSetSpecified) + identifyDevice.RemovableStatusSet = ata.RemovableStatusSet; - if(ata.SATACapabilitiesSpecified) identifyDevice.SATACapabilities = ata.SATACapabilities; + if(ata.SATACapabilitiesSpecified) + identifyDevice.SATACapabilities = ata.SATACapabilities; - if(ata.SATACapabilities2Specified) identifyDevice.SATACapabilities2 = ata.SATACapabilities2; + if(ata.SATACapabilities2Specified) + identifyDevice.SATACapabilities2 = ata.SATACapabilities2; - if(ata.SATAFeaturesSpecified) identifyDevice.SATAFeatures = ata.SATAFeatures; + if(ata.SATAFeaturesSpecified) + identifyDevice.SATAFeatures = ata.SATAFeatures; - if(ata.SCTCommandTransportSpecified) identifyDevice.SCTCommandTransport = ata.SCTCommandTransport; + if(ata.SCTCommandTransportSpecified) + identifyDevice.SCTCommandTransport = ata.SCTCommandTransport; - if(ata.SectorsPerCardSpecified) identifyDevice.SectorsPerCard = ata.SectorsPerCard; + if(ata.SectorsPerCardSpecified) + identifyDevice.SectorsPerCard = ata.SectorsPerCard; - if(ata.SecurityEraseTimeSpecified) identifyDevice.SecurityEraseTime = ata.SecurityEraseTime; + if(ata.SecurityEraseTimeSpecified) + identifyDevice.SecurityEraseTime = ata.SecurityEraseTime; - if(ata.SecurityStatusSpecified) identifyDevice.SecurityStatus = ata.SecurityStatus; + if(ata.SecurityStatusSpecified) + identifyDevice.SecurityStatus = ata.SecurityStatus; - if(ata.ServiceBusyClearSpecified) identifyDevice.ServiceBusyClear = ata.ServiceBusyClear; + if(ata.ServiceBusyClearSpecified) + identifyDevice.ServiceBusyClear = ata.ServiceBusyClear; - if(ata.SpecificConfigurationSpecified) identifyDevice.SpecificConfiguration = ata.SpecificConfiguration; + if(ata.SpecificConfigurationSpecified) + identifyDevice.SpecificConfiguration = ata.SpecificConfiguration; - if(ata.StreamAccessLatencySpecified) identifyDevice.StreamAccessLatency = ata.StreamAccessLatency; + if(ata.StreamAccessLatencySpecified) + identifyDevice.StreamAccessLatency = ata.StreamAccessLatency; - if(ata.StreamMinReqSizeSpecified) identifyDevice.StreamMinReqSize = ata.StreamMinReqSize; + if(ata.StreamMinReqSizeSpecified) + identifyDevice.StreamMinReqSize = ata.StreamMinReqSize; if(ata.StreamPerformanceGranularitySpecified) identifyDevice.StreamPerformanceGranularity = ata.StreamPerformanceGranularity; - if(ata.StreamTransferTimeDMASpecified) identifyDevice.StreamTransferTimeDMA = ata.StreamTransferTimeDMA; + if(ata.StreamTransferTimeDMASpecified) + identifyDevice.StreamTransferTimeDMA = ata.StreamTransferTimeDMA; - if(ata.StreamTransferTimePIOSpecified) identifyDevice.StreamTransferTimePIO = ata.StreamTransferTimePIO; + if(ata.StreamTransferTimePIOSpecified) + identifyDevice.StreamTransferTimePIO = ata.StreamTransferTimePIO; - if(ata.TransportMajorVersionSpecified) identifyDevice.TransportMajorVersion = ata.TransportMajorVersion; + if(ata.TransportMajorVersionSpecified) + identifyDevice.TransportMajorVersion = ata.TransportMajorVersion; - if(ata.TransportMinorVersionSpecified) identifyDevice.TransportMinorVersion = ata.TransportMinorVersion; + if(ata.TransportMinorVersionSpecified) + identifyDevice.TransportMinorVersion = ata.TransportMinorVersion; - if(ata.TrustedComputingSpecified) identifyDevice.TrustedComputing = ata.TrustedComputing; + if(ata.TrustedComputingSpecified) + identifyDevice.TrustedComputing = ata.TrustedComputing; - if(ata.UDMAActiveSpecified) identifyDevice.UDMAActive = ata.UDMAActive; + if(ata.UDMAActiveSpecified) + identifyDevice.UDMAActive = ata.UDMAActive; - if(ata.UDMASupportedSpecified) identifyDevice.UDMASupported = ata.UDMASupported; + if(ata.UDMASupportedSpecified) + identifyDevice.UDMASupported = ata.UDMASupported; - if(ata.WRVModeSpecified) identifyDevice.WRVMode = ata.WRVMode; + if(ata.WRVModeSpecified) + identifyDevice.WRVMode = ata.WRVMode; - if(ata.WRVSectorCountMode3Specified) identifyDevice.WRVSectorCountMode3 = ata.WRVSectorCountMode3; + if(ata.WRVSectorCountMode3Specified) + identifyDevice.WRVSectorCountMode3 = ata.WRVSectorCountMode3; - if(ata.WRVSectorCountMode2Specified) identifyDevice.WRVSectorCountMode2 = ata.WRVSectorCountMode2; + if(ata.WRVSectorCountMode2Specified) + identifyDevice.WRVSectorCountMode2 = ata.WRVSectorCountMode2; Identify = Decoders.ATA.Identify.Encode(identifyDevice); } @@ -417,12 +505,15 @@ namespace DiscImageChef.CommonTypes.Metadata SupportsModeSense6 = scsi.SupportsModeSense6; SupportsModeSense10 = scsi.SupportsModeSense10; SupportsModeSubpages = scsi.SupportsModeSubpages; - if(scsi.ReadCapabilitiesSpecified && scsi.ReadCapabilities != null) + + if(scsi.ReadCapabilitiesSpecified && + scsi.ReadCapabilities != null) ReadCapabilities = new TestedMedia(scsi.ReadCapabilities, false); if(scsi.RemovableMedias != null) { RemovableMedias = new List(); + foreach(testedMediaType scsiRemovableMedia in scsi.RemovableMedias) RemovableMedias.Add(new TestedMedia(scsiRemovableMedia, false)); } @@ -433,26 +524,36 @@ namespace DiscImageChef.CommonTypes.Metadata if(scsi.EVPDPages != null) { EVPDPages = new List(); - foreach(pageType evpdPage in scsi.EVPDPages) EVPDPages.Add(new ScsiPage(evpdPage)); + + foreach(pageType evpdPage in scsi.EVPDPages) + EVPDPages.Add(new ScsiPage(evpdPage)); } - if(scsi.ModeSense != null) ModeSense = new ScsiMode(scsi.ModeSense); + if(scsi.ModeSense != null) + ModeSense = new ScsiMode(scsi.ModeSense); - if(scsi.MultiMediaDevice != null) MultiMediaDevice = new Mmc(scsi.MultiMediaDevice); + if(scsi.MultiMediaDevice != null) + MultiMediaDevice = new Mmc(scsi.MultiMediaDevice); - if(scsi.SequentialDevice != null) SequentialDevice = new Ssc(scsi.SequentialDevice); + if(scsi.SequentialDevice != null) + SequentialDevice = new Ssc(scsi.SequentialDevice); - if(InquiryData != null) return; + if(InquiryData != null) + return; - Inquiry.SCSIInquiry inq = new Inquiry.SCSIInquiry(); + var inq = new Inquiry.SCSIInquiry(); - if(scsi.Inquiry.ANSIVersionSpecified) inq.ANSIVersion = scsi.Inquiry.ANSIVersion; + if(scsi.Inquiry.ANSIVersionSpecified) + inq.ANSIVersion = scsi.Inquiry.ANSIVersion; - if(scsi.Inquiry.ECMAVersionSpecified) inq.ECMAVersion = scsi.Inquiry.ECMAVersion; + if(scsi.Inquiry.ECMAVersionSpecified) + inq.ECMAVersion = scsi.Inquiry.ECMAVersion; - if(scsi.Inquiry.DeviceTypeModifierSpecified) inq.DeviceTypeModifier = scsi.Inquiry.DeviceTypeModifier; + if(scsi.Inquiry.DeviceTypeModifierSpecified) + inq.DeviceTypeModifier = scsi.Inquiry.DeviceTypeModifier; - if(scsi.Inquiry.ISOVersionSpecified) inq.ISOVersion = scsi.Inquiry.ISOVersion; + if(scsi.Inquiry.ISOVersionSpecified) + inq.ISOVersion = scsi.Inquiry.ISOVersion; if(scsi.Inquiry.ProductIdentificationSpecified) { @@ -468,7 +569,8 @@ namespace DiscImageChef.CommonTypes.Metadata Array.Copy(tmp, 0, inq.ProductRevisionLevel, 0, tmp.Length); } - if(scsi.Inquiry.ResponseDataFormatSpecified) inq.ResponseDataFormat = scsi.Inquiry.ResponseDataFormat; + if(scsi.Inquiry.ResponseDataFormatSpecified) + inq.ResponseDataFormat = scsi.Inquiry.ResponseDataFormat; if(scsi.Inquiry.VendorIdentificationSpecified) { @@ -540,22 +642,33 @@ namespace DiscImageChef.CommonTypes.Metadata public ScsiMode(modeType mode) { - if(mode.MediumTypeSpecified) MediumType = mode.MediumType; + if(mode.MediumTypeSpecified) + MediumType = mode.MediumType; + WriteProtected = mode.WriteProtected; - if(mode.SpeedSpecified) Speed = mode.Speed; - if(mode.BufferedModeSpecified) BufferedMode = mode.BufferedMode; + + if(mode.SpeedSpecified) + Speed = mode.Speed; + + if(mode.BufferedModeSpecified) + BufferedMode = mode.BufferedMode; + BlankCheckEnabled = mode.BlankCheckEnabled; DPOandFUA = mode.DPOandFUA; if(mode.ModePages != null) { ModePages = new List(); - foreach(modePageType modePage in mode.ModePages) ModePages.Add(new ScsiPage(modePage)); + + foreach(modePageType modePage in mode.ModePages) + ModePages.Add(new ScsiPage(modePage)); } - if(mode.BlockDescriptors == null) return; + if(mode.BlockDescriptors == null) + return; BlockDescriptors = new List(); + foreach(blockDescriptorType blockDescriptor in mode.BlockDescriptors) BlockDescriptors.Add(new BlockDescriptor(blockDescriptor)); } @@ -579,8 +692,12 @@ namespace DiscImageChef.CommonTypes.Metadata public BlockDescriptor(blockDescriptorType descriptor) { Density = descriptor.Density; - if(descriptor.BlocksSpecified) Blocks = descriptor.Blocks; - if(descriptor.BlockLengthSpecified) BlockLength = descriptor.BlockLength; + + if(descriptor.BlocksSpecified) + Blocks = descriptor.Blocks; + + if(descriptor.BlockLengthSpecified) + BlockLength = descriptor.BlockLength; } [JsonIgnore] @@ -623,76 +740,67 @@ namespace DiscImageChef.CommonTypes.Metadata if(mmc.ModeSense2A != null) ModeSense2AData = Modes.EncodeModePage_2A(new Modes.ModePage_2A { - AccurateCDDA = mmc.ModeSense2A.AccurateCDDA, - BCK = mmc.ModeSense2A.BCK, - BufferSize = mmc.ModeSense2A.BufferSize, - BUF = mmc.ModeSense2A.BufferUnderRunProtection, - Eject = mmc.ModeSense2A.CanEject, - Lock = mmc.ModeSense2A.CanLockMedia, - CDDACommand = mmc.ModeSense2A.CDDACommand, - Composite = mmc.ModeSense2A.CompositeAudioVideo, - CMRSupported = - (ushort)(mmc.ModeSense2A.CSSandCPPMSupported - ? 1 - : 0), - CurrentSpeed = mmc.ModeSense2A.CurrentSpeed, - CurrentWriteSpeed = mmc.ModeSense2A.CurrentWriteSpeed, - CurrentWriteSpeedSelected = - mmc.ModeSense2A.CurrentWriteSpeedSelected, - SDP = mmc.ModeSense2A.DeterministicSlotChanger, - DigitalPort1 = mmc.ModeSense2A.DigitalPort1, - DigitalPort2 = mmc.ModeSense2A.DigitalPort2, - LeadInPW = mmc.ModeSense2A.LeadInPW, - LoadingMechanism = - mmc.ModeSense2A.LoadingMechanismType, - LockState = mmc.ModeSense2A.LockStatus, - LSBF = mmc.ModeSense2A.LSBF, - MaximumSpeed = mmc.ModeSense2A.MaximumSpeed, - MaxWriteSpeed = mmc.ModeSense2A.MaximumWriteSpeed, - AudioPlay = mmc.ModeSense2A.PlaysAudio, - PreventJumper = mmc.ModeSense2A.PreventJumperStatus, - RCK = mmc.ModeSense2A.RCK, - ReadBarcode = mmc.ModeSense2A.ReadsBarcode, - SCC = mmc.ModeSense2A.ReadsBothSides, - ReadCDR = mmc.ModeSense2A.ReadsCDR, - ReadCDRW = mmc.ModeSense2A.ReadsCDRW, - DeinterlaveSubchannel = - mmc.ModeSense2A.ReadsDeinterlavedSubchannel, - ReadDVDR = mmc.ModeSense2A.ReadsDVDR, - ReadDVDRAM = mmc.ModeSense2A.ReadsDVDRAM, - ReadDVDROM = mmc.ModeSense2A.ReadsDVDROM, - ISRC = mmc.ModeSense2A.ReadsISRC, - Mode2Form2 = mmc.ModeSense2A.ReadsMode2Form2, - Mode2Form1 = mmc.ModeSense2A.ReadsMode2Form1, - Method2 = mmc.ModeSense2A.ReadsPacketCDR, - Subchannel = mmc.ModeSense2A.ReadsSubchannel, - UPC = mmc.ModeSense2A.ReadsUPC, - C2Pointer = mmc.ModeSense2A.ReturnsC2Pointers, - RotationControlSelected = - mmc.ModeSense2A.RotationControlSelected, - SeparateChannelMute = - mmc.ModeSense2A.SeparateChannelMute, - SeparateChannelVolume = - mmc.ModeSense2A.SeparateChannelVolume, - SSS = mmc.ModeSense2A.SSS, - MultiSession = mmc.ModeSense2A.SupportsMultiSession, - SupportedVolumeLevels = - mmc.ModeSense2A.SupportedVolumeLevels, - TestWrite = mmc.ModeSense2A.TestWrite, - WriteCDR = mmc.ModeSense2A.WritesCDR, - WriteCDRW = mmc.ModeSense2A.WritesCDRW, - WriteDVDR = mmc.ModeSense2A.WritesDVDR, - WriteDVDRAM = mmc.ModeSense2A.WritesDVDRAM, - WriteSpeedPerformanceDescriptors = - mmc.ModeSense2A.WriteSpeedPerformanceDescriptors + AccurateCDDA = mmc.ModeSense2A.AccurateCDDA, BCK = mmc.ModeSense2A.BCK, + BufferSize = mmc.ModeSense2A.BufferSize, + BUF = mmc.ModeSense2A.BufferUnderRunProtection, + Eject = mmc.ModeSense2A.CanEject, + Lock = mmc.ModeSense2A.CanLockMedia, + CDDACommand = mmc.ModeSense2A.CDDACommand, + Composite = mmc.ModeSense2A.CompositeAudioVideo, + CMRSupported = (ushort)(mmc.ModeSense2A.CSSandCPPMSupported ? 1 : 0), + CurrentSpeed = mmc.ModeSense2A.CurrentSpeed, + CurrentWriteSpeed = mmc.ModeSense2A.CurrentWriteSpeed, + CurrentWriteSpeedSelected = mmc.ModeSense2A.CurrentWriteSpeedSelected, + SDP = mmc.ModeSense2A.DeterministicSlotChanger, + DigitalPort1 = mmc.ModeSense2A.DigitalPort1, + DigitalPort2 = mmc.ModeSense2A.DigitalPort2, + LeadInPW = mmc.ModeSense2A.LeadInPW, + LoadingMechanism = mmc.ModeSense2A.LoadingMechanismType, + LockState = mmc.ModeSense2A.LockStatus, + LSBF = mmc.ModeSense2A.LSBF, + MaximumSpeed = mmc.ModeSense2A.MaximumSpeed, + MaxWriteSpeed = mmc.ModeSense2A.MaximumWriteSpeed, + AudioPlay = mmc.ModeSense2A.PlaysAudio, + PreventJumper = mmc.ModeSense2A.PreventJumperStatus, + RCK = mmc.ModeSense2A.RCK, + ReadBarcode = mmc.ModeSense2A.ReadsBarcode, + SCC = mmc.ModeSense2A.ReadsBothSides, + ReadCDR = mmc.ModeSense2A.ReadsCDR, + ReadCDRW = mmc.ModeSense2A.ReadsCDRW, + DeinterlaveSubchannel = mmc.ModeSense2A.ReadsDeinterlavedSubchannel, + ReadDVDR = mmc.ModeSense2A.ReadsDVDR, + ReadDVDRAM = mmc.ModeSense2A.ReadsDVDRAM, + ReadDVDROM = mmc.ModeSense2A.ReadsDVDROM, + ISRC = mmc.ModeSense2A.ReadsISRC, + Mode2Form2 = mmc.ModeSense2A.ReadsMode2Form2, + Mode2Form1 = mmc.ModeSense2A.ReadsMode2Form1, + Method2 = mmc.ModeSense2A.ReadsPacketCDR, + Subchannel = mmc.ModeSense2A.ReadsSubchannel, + UPC = mmc.ModeSense2A.ReadsUPC, + C2Pointer = mmc.ModeSense2A.ReturnsC2Pointers, + RotationControlSelected = mmc.ModeSense2A.RotationControlSelected, + SeparateChannelMute = mmc.ModeSense2A.SeparateChannelMute, + SeparateChannelVolume = mmc.ModeSense2A.SeparateChannelVolume, SSS = mmc.ModeSense2A.SSS, + MultiSession = mmc.ModeSense2A.SupportsMultiSession, + SupportedVolumeLevels = mmc.ModeSense2A.SupportedVolumeLevels, + TestWrite = mmc.ModeSense2A.TestWrite, + WriteCDR = mmc.ModeSense2A.WritesCDR, + WriteCDRW = mmc.ModeSense2A.WritesCDRW, + WriteDVDR = mmc.ModeSense2A.WritesDVDR, + WriteDVDRAM = mmc.ModeSense2A.WritesDVDRAM, + WriteSpeedPerformanceDescriptors = mmc.ModeSense2A.WriteSpeedPerformanceDescriptors }); - if(mmc.Features != null) Features = new MmcFeatures(mmc.Features); + if(mmc.Features != null) + Features = new MmcFeatures(mmc.Features); - if(mmc.TestedMedia == null) return; + if(mmc.TestedMedia == null) + return; TestedMedia = new List(); - foreach(testedMediaType mediaType in mmc.TestedMedia) TestedMedia.Add(new TestedMedia(mediaType, false)); + + foreach(testedMediaType mediaType in mmc.TestedMedia) + TestedMedia.Add(new TestedMedia(mediaType, false)); } [JsonIgnore] @@ -709,31 +817,42 @@ namespace DiscImageChef.CommonTypes.Metadata public MmcFeatures(mmcFeaturesType features) { - if(features.PhysicalInterfaceStandardSpecified && !features.PhysicalInterfaceStandardNumberSpecified) + if(features.PhysicalInterfaceStandardSpecified && + !features.PhysicalInterfaceStandardNumberSpecified) PhysicalInterfaceStandardNumber = (uint?)features.PhysicalInterfaceStandard; if(features.PhysicalInterfaceStandardNumberSpecified) PhysicalInterfaceStandardNumber = features.PhysicalInterfaceStandardNumber; - if(features.AACSVersionSpecified) AACSVersion = features.AACSVersion; + if(features.AACSVersionSpecified) + AACSVersion = features.AACSVersion; - if(features.AGIDsSpecified) AGIDs = features.AGIDs; + if(features.AGIDsSpecified) + AGIDs = features.AGIDs; - if(features.BindingNonceBlocksSpecified) BindingNonceBlocks = features.BindingNonceBlocks; + if(features.BindingNonceBlocksSpecified) + BindingNonceBlocks = features.BindingNonceBlocks; - if(features.CPRMVersionSpecified) CPRMVersion = features.CPRMVersion; + if(features.CPRMVersionSpecified) + CPRMVersion = features.CPRMVersion; - if(features.CSSVersionSpecified) CSSVersion = features.CSSVersion; + if(features.CSSVersionSpecified) + CSSVersion = features.CSSVersion; - if(features.LoadingMechanismTypeSpecified) LoadingMechanismType = features.LoadingMechanismType; + if(features.LoadingMechanismTypeSpecified) + LoadingMechanismType = features.LoadingMechanismType; - if(features.LogicalBlockSizeSpecified) LogicalBlockSize = features.LogicalBlockSize; + if(features.LogicalBlockSizeSpecified) + LogicalBlockSize = features.LogicalBlockSize; - if(features.BlocksPerReadableUnitSpecified) BlocksPerReadableUnit = features.BlocksPerReadableUnit; + if(features.BlocksPerReadableUnitSpecified) + BlocksPerReadableUnit = features.BlocksPerReadableUnit; - if(features.FirmwareDateSpecified) FirmwareDate = features.FirmwareDate; + if(features.FirmwareDateSpecified) + FirmwareDate = features.FirmwareDate; - if(features.VolumeLevelsSpecified) VolumeLevels = features.VolumeLevels; + if(features.VolumeLevelsSpecified) + VolumeLevels = features.VolumeLevels; BufferUnderrunFreeInDVD = features.BufferUnderrunFreeInDVD; BufferUnderrunFreeInSAO = features.BufferUnderrunFreeInSAO; @@ -987,21 +1106,29 @@ namespace DiscImageChef.CommonTypes.Metadata public TestedMedia(testedMediaType mediaType, bool ata) { - if(mediaType.BlocksSpecified) Blocks = mediaType.Blocks; + if(mediaType.BlocksSpecified) + Blocks = mediaType.Blocks; - if(mediaType.BlockSizeSpecified) BlockSize = mediaType.BlockSize; + if(mediaType.BlockSizeSpecified) + BlockSize = mediaType.BlockSize; - if(mediaType.CanReadAACSSpecified) CanReadAACS = mediaType.CanReadAACS; + if(mediaType.CanReadAACSSpecified) + CanReadAACS = mediaType.CanReadAACS; - if(mediaType.CanReadADIPSpecified) CanReadADIP = mediaType.CanReadADIP; + if(mediaType.CanReadADIPSpecified) + CanReadADIP = mediaType.CanReadADIP; - if(mediaType.CanReadATIPSpecified) CanReadATIP = mediaType.CanReadATIP; + if(mediaType.CanReadATIPSpecified) + CanReadATIP = mediaType.CanReadATIP; - if(mediaType.CanReadBCASpecified) CanReadBCA = mediaType.CanReadBCA; + if(mediaType.CanReadBCASpecified) + CanReadBCA = mediaType.CanReadBCA; - if(mediaType.CanReadC2PointersSpecified) CanReadC2Pointers = mediaType.CanReadC2Pointers; + if(mediaType.CanReadC2PointersSpecified) + CanReadC2Pointers = mediaType.CanReadC2Pointers; - if(mediaType.CanReadCMISpecified) CanReadCMI = mediaType.CanReadCMI; + if(mediaType.CanReadCMISpecified) + CanReadCMI = mediaType.CanReadCMI; if(mediaType.CanReadCorrectedSubchannelSpecified) CanReadCorrectedSubchannel = mediaType.CanReadCorrectedSubchannel; @@ -1009,153 +1136,217 @@ namespace DiscImageChef.CommonTypes.Metadata if(mediaType.CanReadCorrectedSubchannelWithC2Specified) CanReadCorrectedSubchannelWithC2 = mediaType.CanReadCorrectedSubchannelWithC2; - if(mediaType.CanReadDCBSpecified) CanReadDCB = mediaType.CanReadDCB; + if(mediaType.CanReadDCBSpecified) + CanReadDCB = mediaType.CanReadDCB; - if(mediaType.CanReadDDSSpecified) CanReadDDS = mediaType.CanReadDDS; + if(mediaType.CanReadDDSSpecified) + CanReadDDS = mediaType.CanReadDDS; - if(mediaType.CanReadDMISpecified) CanReadDMI = mediaType.CanReadDMI; + if(mediaType.CanReadDMISpecified) + CanReadDMI = mediaType.CanReadDMI; - if(mediaType.CanReadDiscInformationSpecified) CanReadDiscInformation = mediaType.CanReadDiscInformation; + if(mediaType.CanReadDiscInformationSpecified) + CanReadDiscInformation = mediaType.CanReadDiscInformation; - if(mediaType.CanReadFullTOCSpecified) CanReadFullTOC = mediaType.CanReadFullTOC; + if(mediaType.CanReadFullTOCSpecified) + CanReadFullTOC = mediaType.CanReadFullTOC; - if(mediaType.CanReadHDCMISpecified) CanReadHDCMI = mediaType.CanReadHDCMI; + if(mediaType.CanReadHDCMISpecified) + CanReadHDCMI = mediaType.CanReadHDCMI; - if(mediaType.CanReadLayerCapacitySpecified) CanReadLayerCapacity = mediaType.CanReadLayerCapacity; + if(mediaType.CanReadLayerCapacitySpecified) + CanReadLayerCapacity = mediaType.CanReadLayerCapacity; - if(mediaType.CanReadLeadInSpecified) CanReadFirstTrackPreGap = mediaType.CanReadLeadIn; + if(mediaType.CanReadLeadInSpecified) + CanReadFirstTrackPreGap = mediaType.CanReadLeadIn; - if(mediaType.CanReadLeadOutSpecified) CanReadLeadOut = mediaType.CanReadLeadOut; + if(mediaType.CanReadLeadOutSpecified) + CanReadLeadOut = mediaType.CanReadLeadOut; - if(mediaType.CanReadMediaIDSpecified) CanReadMediaID = mediaType.CanReadMediaID; + if(mediaType.CanReadMediaIDSpecified) + CanReadMediaID = mediaType.CanReadMediaID; - if(mediaType.CanReadMediaSerialSpecified) CanReadMediaSerial = mediaType.CanReadMediaSerial; + if(mediaType.CanReadMediaSerialSpecified) + CanReadMediaSerial = mediaType.CanReadMediaSerial; - if(mediaType.CanReadPACSpecified) CanReadPAC = mediaType.CanReadPAC; + if(mediaType.CanReadPACSpecified) + CanReadPAC = mediaType.CanReadPAC; - if(mediaType.CanReadPFISpecified) CanReadPFI = mediaType.CanReadPFI; + if(mediaType.CanReadPFISpecified) + CanReadPFI = mediaType.CanReadPFI; - if(mediaType.CanReadPMASpecified) CanReadPMA = mediaType.CanReadPMA; + if(mediaType.CanReadPMASpecified) + CanReadPMA = mediaType.CanReadPMA; - if(mediaType.CanReadPQSubchannelSpecified) CanReadPQSubchannel = mediaType.CanReadPQSubchannel; + if(mediaType.CanReadPQSubchannelSpecified) + CanReadPQSubchannel = mediaType.CanReadPQSubchannel; if(mediaType.CanReadPQSubchannelWithC2Specified) CanReadPQSubchannelWithC2 = mediaType.CanReadPQSubchannelWithC2; - if(mediaType.CanReadPRISpecified) CanReadPRI = mediaType.CanReadPRI; + if(mediaType.CanReadPRISpecified) + CanReadPRI = mediaType.CanReadPRI; - if(mediaType.CanReadRWSubchannelSpecified) CanReadRWSubchannel = mediaType.CanReadRWSubchannel; + if(mediaType.CanReadRWSubchannelSpecified) + CanReadRWSubchannel = mediaType.CanReadRWSubchannel; if(mediaType.CanReadRWSubchannelWithC2Specified) CanReadRWSubchannelWithC2 = mediaType.CanReadRWSubchannelWithC2; - if(mediaType.CanReadRecordablePFISpecified) CanReadRecordablePFI = mediaType.CanReadRecordablePFI; + if(mediaType.CanReadRecordablePFISpecified) + CanReadRecordablePFI = mediaType.CanReadRecordablePFI; if(mediaType.CanReadSpareAreaInformationSpecified) CanReadSpareAreaInformation = mediaType.CanReadSpareAreaInformation; - if(mediaType.CanReadTOCSpecified) CanReadTOC = mediaType.CanReadTOC; + if(mediaType.CanReadTOCSpecified) + CanReadTOC = mediaType.CanReadTOC; - if(mediaType.DensitySpecified) Density = mediaType.Density; + if(mediaType.DensitySpecified) + Density = mediaType.Density; - if(mediaType.LongBlockSizeSpecified) LongBlockSize = mediaType.LongBlockSize; + if(mediaType.LongBlockSizeSpecified) + LongBlockSize = mediaType.LongBlockSize; - if(mediaType.ManufacturerSpecified) Manufacturer = mediaType.Manufacturer; + if(mediaType.ManufacturerSpecified) + Manufacturer = mediaType.Manufacturer; - if(mediaType.MediumTypeSpecified) MediumType = mediaType.MediumType; + if(mediaType.MediumTypeSpecified) + MediumType = mediaType.MediumType; - if(mediaType.ModelSpecified) Model = mediaType.Model; + if(mediaType.ModelSpecified) + Model = mediaType.Model; if(mediaType.SupportsHLDTSTReadRawDVDSpecified) SupportsHLDTSTReadRawDVD = mediaType.SupportsHLDTSTReadRawDVD; - if(mediaType.SupportsNECReadCDDASpecified) SupportsNECReadCDDA = mediaType.SupportsNECReadCDDA; + if(mediaType.SupportsNECReadCDDASpecified) + SupportsNECReadCDDA = mediaType.SupportsNECReadCDDA; - if(mediaType.SupportsPioneerReadCDDASpecified) SupportsPioneerReadCDDA = mediaType.SupportsPioneerReadCDDA; + if(mediaType.SupportsPioneerReadCDDASpecified) + SupportsPioneerReadCDDA = mediaType.SupportsPioneerReadCDDA; if(mediaType.SupportsPioneerReadCDDAMSFSpecified) SupportsPioneerReadCDDAMSF = mediaType.SupportsPioneerReadCDDAMSF; - if(mediaType.SupportsPlextorReadCDDASpecified) SupportsPlextorReadCDDA = mediaType.SupportsPlextorReadCDDA; + if(mediaType.SupportsPlextorReadCDDASpecified) + SupportsPlextorReadCDDA = mediaType.SupportsPlextorReadCDDA; if(mediaType.SupportsPlextorReadRawDVDSpecified) SupportsPlextorReadRawDVD = mediaType.SupportsPlextorReadRawDVD; - if(mediaType.SupportsRead10Specified) SupportsRead10 = mediaType.SupportsRead10; + if(mediaType.SupportsRead10Specified) + SupportsRead10 = mediaType.SupportsRead10; - if(mediaType.SupportsRead12Specified) SupportsRead12 = mediaType.SupportsRead12; + if(mediaType.SupportsRead12Specified) + SupportsRead12 = mediaType.SupportsRead12; - if(mediaType.SupportsRead16Specified) SupportsRead16 = mediaType.SupportsRead16; + if(mediaType.SupportsRead16Specified) + SupportsRead16 = mediaType.SupportsRead16; if(mediaType.SupportsReadSpecified) { - if(ata) SupportsReadSectors = mediaType.SupportsRead; - else SupportsRead6 = mediaType.SupportsRead; + if(ata) + SupportsReadSectors = mediaType.SupportsRead; + else + SupportsRead6 = mediaType.SupportsRead; } - if(mediaType.SupportsReadCapacity16Specified) SupportsReadCapacity16 = mediaType.SupportsReadCapacity16; + if(mediaType.SupportsReadCapacity16Specified) + SupportsReadCapacity16 = mediaType.SupportsReadCapacity16; - if(mediaType.SupportsReadCapacitySpecified) SupportsReadCapacity = mediaType.SupportsReadCapacity; + if(mediaType.SupportsReadCapacitySpecified) + SupportsReadCapacity = mediaType.SupportsReadCapacity; - if(mediaType.SupportsReadCdSpecified) SupportsReadCd = mediaType.SupportsReadCd; + if(mediaType.SupportsReadCdSpecified) + SupportsReadCd = mediaType.SupportsReadCd; - if(mediaType.SupportsReadCdMsfSpecified) SupportsReadCdMsf = mediaType.SupportsReadCdMsf; + if(mediaType.SupportsReadCdMsfSpecified) + SupportsReadCdMsf = mediaType.SupportsReadCdMsf; - if(mediaType.SupportsReadCdRawSpecified) SupportsReadCdRaw = mediaType.SupportsReadCdRaw; + if(mediaType.SupportsReadCdRawSpecified) + SupportsReadCdRaw = mediaType.SupportsReadCdRaw; - if(mediaType.SupportsReadCdMsfRawSpecified) SupportsReadCdMsfRaw = mediaType.SupportsReadCdMsfRaw; + if(mediaType.SupportsReadCdMsfRawSpecified) + SupportsReadCdMsfRaw = mediaType.SupportsReadCdMsfRaw; - if(mediaType.SupportsReadLong16Specified) SupportsReadLong16 = mediaType.SupportsReadLong16; + if(mediaType.SupportsReadLong16Specified) + SupportsReadLong16 = mediaType.SupportsReadLong16; - if(mediaType.SupportsReadLongSpecified) SupportsReadLong = mediaType.SupportsReadLong; + if(mediaType.SupportsReadLongSpecified) + SupportsReadLong = mediaType.SupportsReadLong; - if(mediaType.LBASectorsSpecified) LBASectors = mediaType.LBASectors; + if(mediaType.LBASectorsSpecified) + LBASectors = mediaType.LBASectors; - if(mediaType.LBA48SectorsSpecified) LBA48Sectors = mediaType.LBA48Sectors; + if(mediaType.LBA48SectorsSpecified) + LBA48Sectors = mediaType.LBA48Sectors; - if(mediaType.LogicalAlignmentSpecified) LogicalAlignment = mediaType.LogicalAlignment; + if(mediaType.LogicalAlignmentSpecified) + LogicalAlignment = mediaType.LogicalAlignment; - if(mediaType.NominalRotationRateSpecified) NominalRotationRate = mediaType.NominalRotationRate; + if(mediaType.NominalRotationRateSpecified) + NominalRotationRate = mediaType.NominalRotationRate; - if(mediaType.PhysicalBlockSizeSpecified) PhysicalBlockSize = mediaType.PhysicalBlockSize; + if(mediaType.PhysicalBlockSizeSpecified) + PhysicalBlockSize = mediaType.PhysicalBlockSize; - if(mediaType.SolidStateDeviceSpecified) SolidStateDevice = mediaType.SolidStateDevice; + if(mediaType.SolidStateDeviceSpecified) + SolidStateDevice = mediaType.SolidStateDevice; - if(mediaType.UnformattedBPTSpecified) UnformattedBPT = mediaType.UnformattedBPT; + if(mediaType.UnformattedBPTSpecified) + UnformattedBPT = mediaType.UnformattedBPT; - if(mediaType.UnformattedBPSSpecified) UnformattedBPS = mediaType.UnformattedBPS; + if(mediaType.UnformattedBPSSpecified) + UnformattedBPS = mediaType.UnformattedBPS; - if(mediaType.SupportsReadDmaLbaSpecified) SupportsReadDmaLba = mediaType.SupportsReadDmaLba; + if(mediaType.SupportsReadDmaLbaSpecified) + SupportsReadDmaLba = mediaType.SupportsReadDmaLba; - if(mediaType.SupportsReadDmaRetryLbaSpecified) SupportsReadDmaRetryLba = mediaType.SupportsReadDmaRetryLba; + if(mediaType.SupportsReadDmaRetryLbaSpecified) + SupportsReadDmaRetryLba = mediaType.SupportsReadDmaRetryLba; - if(mediaType.SupportsReadLbaSpecified) SupportsReadLba = mediaType.SupportsReadLba; + if(mediaType.SupportsReadLbaSpecified) + SupportsReadLba = mediaType.SupportsReadLba; - if(mediaType.SupportsReadRetryLbaSpecified) SupportsReadRetryLba = mediaType.SupportsReadRetryLba; + if(mediaType.SupportsReadRetryLbaSpecified) + SupportsReadRetryLba = mediaType.SupportsReadRetryLba; - if(mediaType.SupportsReadLongLbaSpecified) SupportsReadLongLba = mediaType.SupportsReadLongLba; + if(mediaType.SupportsReadLongLbaSpecified) + SupportsReadLongLba = mediaType.SupportsReadLongLba; if(mediaType.SupportsReadLongRetryLbaSpecified) SupportsReadLongRetryLba = mediaType.SupportsReadLongRetryLba; - if(mediaType.SupportsSeekLbaSpecified) SupportsSeekLba = mediaType.SupportsSeekLba; + if(mediaType.SupportsSeekLbaSpecified) + SupportsSeekLba = mediaType.SupportsSeekLba; - if(mediaType.SupportsReadDmaLba48Specified) SupportsReadDmaLba48 = mediaType.SupportsReadDmaLba48; + if(mediaType.SupportsReadDmaLba48Specified) + SupportsReadDmaLba48 = mediaType.SupportsReadDmaLba48; - if(mediaType.SupportsReadLba48Specified) SupportsReadLba48 = mediaType.SupportsReadLba48; + if(mediaType.SupportsReadLba48Specified) + SupportsReadLba48 = mediaType.SupportsReadLba48; - if(mediaType.SupportsReadDmaSpecified) SupportsReadDma = mediaType.SupportsReadDma; + if(mediaType.SupportsReadDmaSpecified) + SupportsReadDma = mediaType.SupportsReadDma; - if(mediaType.SupportsReadDmaRetrySpecified) SupportsReadDmaRetry = mediaType.SupportsReadDmaRetry; + if(mediaType.SupportsReadDmaRetrySpecified) + SupportsReadDmaRetry = mediaType.SupportsReadDmaRetry; - if(mediaType.SupportsReadRetrySpecified) SupportsReadRetry = mediaType.SupportsReadRetry; + if(mediaType.SupportsReadRetrySpecified) + SupportsReadRetry = mediaType.SupportsReadRetry; - if(mediaType.SupportsReadLongRetrySpecified) SupportsReadLongRetry = mediaType.SupportsReadLongRetry; + if(mediaType.SupportsReadLongRetrySpecified) + SupportsReadLongRetry = mediaType.SupportsReadLongRetry; - if(mediaType.SupportsSeekSpecified) SupportsSeek = mediaType.SupportsSeek; + if(mediaType.SupportsSeekSpecified) + SupportsSeek = mediaType.SupportsSeek; - if(mediaType.CHS != null) CHS = new Chs(mediaType.CHS); - if(mediaType.CurrentCHS != null) CurrentCHS = new Chs(mediaType.CurrentCHS); + if(mediaType.CHS != null) + CHS = new Chs(mediaType.CHS); + + if(mediaType.CurrentCHS != null) + CurrentCHS = new Chs(mediaType.CurrentCHS); MediaIsRecognized = mediaType.MediaIsRecognized; MediumTypeName = mediaType.MediumTypeName; @@ -1349,22 +1540,31 @@ namespace DiscImageChef.CommonTypes.Metadata public Ssc(sscType ssc) { - if(ssc.BlockSizeGranularitySpecified) BlockSizeGranularity = ssc.BlockSizeGranularity; - if(ssc.MaxBlockLengthSpecified) MaxBlockLength = ssc.MaxBlockLength; - if(ssc.MinBlockLengthSpecified) MinBlockLength = ssc.MinBlockLength; + if(ssc.BlockSizeGranularitySpecified) + BlockSizeGranularity = ssc.BlockSizeGranularity; - if(ssc.SupportedDensities != null) SupportedDensities = new List(ssc.SupportedDensities); + if(ssc.MaxBlockLengthSpecified) + MaxBlockLength = ssc.MaxBlockLength; + + if(ssc.MinBlockLengthSpecified) + MinBlockLength = ssc.MinBlockLength; + + if(ssc.SupportedDensities != null) + SupportedDensities = new List(ssc.SupportedDensities); if(ssc.SupportedMediaTypes != null) { SupportedMediaTypes = new List(); + foreach(SupportedMedia mediaType in ssc.SupportedMediaTypes) SupportedMediaTypes.Add(new SscSupportedMedia(mediaType)); } - if(ssc.TestedMedia == null) return; + if(ssc.TestedMedia == null) + return; TestedMedia = new List(); + foreach(SequentialMedia testedMedia in ssc.TestedMedia) TestedMedia.Add(new TestedSequentialMedia(testedMedia)); } @@ -1386,19 +1586,28 @@ namespace DiscImageChef.CommonTypes.Metadata public TestedSequentialMedia(SequentialMedia media) { - if(media.CanReadMediaSerialSpecified) CanReadMediaSerial = media.CanReadMediaSerial; - if(media.DensitySpecified) Density = media.Density; + if(media.CanReadMediaSerialSpecified) + CanReadMediaSerial = media.CanReadMediaSerial; + + if(media.DensitySpecified) + Density = media.Density; + Manufacturer = media.Manufacturer; MediaIsRecognized = media.MediaIsRecognized; - if(media.MediumTypeSpecified) MediumType = media.MediumType; + + if(media.MediumTypeSpecified) + MediumType = media.MediumType; + MediumTypeName = media.MediumTypeName; Model = media.Model; + if(media.SupportedDensities != null) SupportedDensities = new List(media.SupportedDensities); if(media.SupportedMediaTypes != null) { SupportedMediaTypes = new List(); + foreach(SupportedMedia supportedMedia in media.SupportedMediaTypes) SupportedMediaTypes.Add(new SscSupportedMedia(supportedMedia)); } @@ -1434,8 +1643,13 @@ namespace DiscImageChef.CommonTypes.Metadata AdditionalInformation = pcmcia.AdditionalInformation; CIS = pcmcia.CIS; Compliance = pcmcia.Compliance; - if(pcmcia.ManufacturerCodeSpecified) ManufacturerCode = pcmcia.ManufacturerCode; - if(pcmcia.CardCodeSpecified) CardCode = pcmcia.CardCode; + + if(pcmcia.ManufacturerCodeSpecified) + ManufacturerCode = pcmcia.ManufacturerCode; + + if(pcmcia.CardCodeSpecified) + CardCode = pcmcia.CardCode; + Manufacturer = pcmcia.Manufacturer; ProductName = pcmcia.ProductName; } @@ -1484,10 +1698,17 @@ namespace DiscImageChef.CommonTypes.Metadata Organization = media.Organization; Name = media.Name; Description = media.Description; - if(media.DensityCodes == null) return; + + if(media.DensityCodes == null) + return; DensityCodes = new List(); - foreach(int densityCode in media.DensityCodes) DensityCodes.Add(new DensityCode {Code = densityCode}); + + foreach(int densityCode in media.DensityCodes) + DensityCodes.Add(new DensityCode + { + Code = densityCode + }); } [JsonIgnore] @@ -1503,24 +1724,29 @@ namespace DiscImageChef.CommonTypes.Metadata public class DensityCode : IEquatable { - [JsonIgnore] - [Key] + [JsonIgnore, Key] public int Id { get; set; } public int Code { get; set; } public bool Equals(DensityCode other) { - if(ReferenceEquals(null, other)) return false; - if(ReferenceEquals(this, other)) return true; + if(ReferenceEquals(null, other)) + return false; + + if(ReferenceEquals(this, other)) + return true; return Code == other.Code; } public override bool Equals(object obj) { - if(ReferenceEquals(null, obj)) return false; - if(ReferenceEquals(this, obj)) return true; + if(ReferenceEquals(null, obj)) + return false; + + if(ReferenceEquals(this, obj)) + return true; return obj.GetType() == GetType() && Equals((DensityCode)obj); } diff --git a/Metadata/Dimensions.cs b/Metadata/Dimensions.cs index 55372a4..257dfc9 100644 --- a/Metadata/Dimensions.cs +++ b/Metadata/Dimensions.cs @@ -44,7 +44,7 @@ namespace DiscImageChef.CommonTypes.Metadata { public static DimensionsType DimensionsFromMediaType(CommonTypes.MediaType dskType) { - DimensionsType dmns = new DimensionsType(); + var dmns = new DimensionsType(); switch(dskType) { @@ -87,6 +87,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 133.3; dmns.WidthSpecified = true; dmns.Thickness = 1.65; + return dmns; #endregion 5.25" floppy disk @@ -121,6 +122,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 90; dmns.WidthSpecified = true; dmns.Thickness = 3.3; + return dmns; #endregion 3.5" floppy disk @@ -149,6 +151,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 203.2; dmns.WidthSpecified = true; dmns.Thickness = 1.65; + return dmns; #endregion 8" floppy disk @@ -161,6 +164,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 443.76; dmns.WidthSpecified = true; dmns.Thickness = 25.4; + return dmns; #endregion 356mm magneto optical @@ -174,6 +178,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 320; dmns.WidthSpecified = true; dmns.Thickness = 17; + return dmns; #endregion 300mm magneto optical @@ -199,6 +204,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 135; dmns.WidthSpecified = true; dmns.Thickness = 11; + return dmns; #endregion 5.25" magneto optical @@ -216,6 +222,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 90; dmns.WidthSpecified = true; dmns.Thickness = 6; + return dmns; #endregion 3.5" magneto optical @@ -226,6 +233,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 124; dmns.WidthSpecified = true; dmns.Thickness = 7.8; + return dmns; case CommonTypes.MediaType.ECMA_239: dmns.Height = 97; @@ -233,6 +241,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 92; dmns.WidthSpecified = true; dmns.Thickness = 5; + return dmns; case CommonTypes.MediaType.MMCmicro: dmns.Height = 14; @@ -240,6 +249,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 12; dmns.WidthSpecified = true; dmns.Thickness = 1.1; + return dmns; case CommonTypes.MediaType.MemoryStickMicro: dmns.Height = 15; @@ -247,6 +257,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 12.5; dmns.WidthSpecified = true; dmns.Thickness = 1.2; + return dmns; case CommonTypes.MediaType.microSD: dmns.Height = 11; @@ -254,6 +265,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 15; dmns.WidthSpecified = true; dmns.Thickness = 1; + return dmns; case CommonTypes.MediaType.miniSD: dmns.Height = 21.5; @@ -261,6 +273,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 20; dmns.WidthSpecified = true; dmns.Thickness = 1.4; + return dmns; case CommonTypes.MediaType.QIC3010: case CommonTypes.MediaType.QIC3020: @@ -274,6 +287,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 21.5; dmns.WidthSpecified = true; dmns.Thickness = 1.6; + return dmns; case CommonTypes.MediaType.RSMMC: dmns.Height = 18; @@ -281,6 +295,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 24; dmns.WidthSpecified = true; dmns.Thickness = 1.4; + return dmns; case CommonTypes.MediaType.MMC: dmns.Height = 32; @@ -288,6 +303,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 24; dmns.WidthSpecified = true; dmns.Thickness = 1.4; + return dmns; case CommonTypes.MediaType.SecureDigital: dmns.Height = 32; @@ -295,6 +311,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 24; dmns.WidthSpecified = true; dmns.Thickness = 2.1; + return dmns; case CommonTypes.MediaType.xD: dmns.Height = 20; @@ -302,6 +319,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 25; dmns.WidthSpecified = true; dmns.Thickness = 1.78; + return dmns; case CommonTypes.MediaType.XQD: dmns.Height = 38.5; @@ -309,6 +327,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 29.8; dmns.WidthSpecified = true; dmns.Thickness = 3.8; + return dmns; case CommonTypes.MediaType.MemoryStickDuo: case CommonTypes.MediaType.MemoryStickProDuo: @@ -317,6 +336,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 31; dmns.WidthSpecified = true; dmns.Thickness = 1.6; + return dmns; case CommonTypes.MediaType.Nintendo3DSGameCard: case CommonTypes.MediaType.NintendoDSGameCard: @@ -326,6 +346,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 33; dmns.WidthSpecified = true; dmns.Thickness = 3.8; + return dmns; case CommonTypes.MediaType.DataPlay: dmns.Height = 42; @@ -333,6 +354,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 33.5; dmns.WidthSpecified = true; dmns.Thickness = 3; + return dmns; case CommonTypes.MediaType.Microdrive: dmns.Height = 44; @@ -340,6 +362,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 34; dmns.WidthSpecified = true; dmns.Thickness = 8; + return dmns; case CommonTypes.MediaType.ExpressCard34: dmns.Height = 75; @@ -347,6 +370,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 34; dmns.WidthSpecified = true; dmns.Thickness = 5; + return dmns; case CommonTypes.MediaType.SmartMedia: dmns.Height = 45; @@ -354,6 +378,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 37; dmns.WidthSpecified = true; dmns.Thickness = 0.76; + return dmns; case CommonTypes.MediaType.MiniCard: dmns.Height = 45; @@ -361,6 +386,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 37; dmns.WidthSpecified = true; dmns.Thickness = 3.5; + return dmns; case CommonTypes.MediaType.PlayStationMemoryCard: case CommonTypes.MediaType.PlayStationMemoryCard2: @@ -369,6 +395,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 41.5; dmns.WidthSpecified = true; dmns.Thickness = 7; + return dmns; case CommonTypes.MediaType.CFast: case CommonTypes.MediaType.CompactFlash: @@ -377,6 +404,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 43; dmns.WidthSpecified = true; dmns.Thickness = 3.3; + return dmns; case CommonTypes.MediaType.CompactFlashType2: dmns.Height = 36; @@ -384,6 +412,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 43; dmns.WidthSpecified = true; dmns.Thickness = 5; + return dmns; case CommonTypes.MediaType.ZXMicrodrive: dmns.Height = 36; @@ -391,6 +420,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 43; dmns.WidthSpecified = true; dmns.Thickness = 5; + return dmns; case CommonTypes.MediaType.MemoryStick: case CommonTypes.MediaType.MemoryStickPro: @@ -399,6 +429,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 50; dmns.WidthSpecified = true; dmns.Thickness = 2.6; + return dmns; case CommonTypes.MediaType.PocketZip: dmns.Height = 54.5; @@ -406,6 +437,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 50; dmns.WidthSpecified = true; dmns.Thickness = 2; + return dmns; case CommonTypes.MediaType.ExpressCard54: dmns.Height = 75; @@ -413,6 +445,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 54; dmns.WidthSpecified = true; dmns.Thickness = 5; + return dmns; case CommonTypes.MediaType.PCCardTypeI: dmns.Height = 85.6; @@ -420,6 +453,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 54; dmns.WidthSpecified = true; dmns.Thickness = 3.3; + return dmns; case CommonTypes.MediaType.PCCardTypeII: dmns.Height = 85.6; @@ -427,6 +461,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 54; dmns.WidthSpecified = true; dmns.Thickness = 5; + return dmns; case CommonTypes.MediaType.PCCardTypeIII: dmns.Height = 85.6; @@ -434,6 +469,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 54; dmns.WidthSpecified = true; dmns.Thickness = 10.5; + return dmns; case CommonTypes.MediaType.PCCardTypeIV: dmns.Height = 85.6; @@ -441,6 +477,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 54; dmns.WidthSpecified = true; dmns.Thickness = 16; + return dmns; case CommonTypes.MediaType.DataStore: dmns.Height = 86.5; @@ -448,6 +485,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 54; dmns.WidthSpecified = true; dmns.Thickness = 2.5; + return dmns; case CommonTypes.MediaType.VideoFloppy: dmns.Height = 54; @@ -455,6 +493,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 60; dmns.WidthSpecified = true; dmns.Thickness = 3.5; + return dmns; case CommonTypes.MediaType.VXA1: case CommonTypes.MediaType.VXA2: @@ -464,6 +503,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 62.5; dmns.WidthSpecified = true; dmns.Thickness = 15; + return dmns; case CommonTypes.MediaType.MiniDV: dmns.Height = 47.5; @@ -471,6 +511,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 66; dmns.WidthSpecified = true; dmns.Thickness = 12; + return dmns; case CommonTypes.MediaType.Wafer: dmns.Height = 46.8; @@ -478,6 +519,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 67.1; dmns.WidthSpecified = true; dmns.Thickness = 7.9; + return dmns; case CommonTypes.MediaType.NintendoDiskCard: dmns.Height = 76.2; @@ -485,6 +527,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 71.12; dmns.WidthSpecified = true; dmns.Thickness = 0; + return dmns; case CommonTypes.MediaType.HiMD: case CommonTypes.MediaType.MD: @@ -495,6 +538,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 71.5; dmns.WidthSpecified = true; dmns.Thickness = 4.8; + return dmns; case CommonTypes.MediaType.DAT160: case CommonTypes.MediaType.DAT320: @@ -509,6 +553,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 73; dmns.WidthSpecified = true; dmns.Thickness = 10.5; + return dmns; case CommonTypes.MediaType.CompactFloppy: dmns.Height = 100; @@ -516,6 +561,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 80; dmns.WidthSpecified = true; dmns.Thickness = 5; + return dmns; case CommonTypes.MediaType.DECtapeII: dmns.Height = 60; @@ -523,6 +569,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 81; dmns.WidthSpecified = true; dmns.Thickness = 13; + return dmns; case CommonTypes.MediaType.Ditto: dmns.Height = 60; @@ -530,6 +577,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 81; dmns.WidthSpecified = true; dmns.Thickness = 14; + return dmns; case CommonTypes.MediaType.DittoMax: dmns.Height = 126; @@ -537,6 +585,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 81; dmns.WidthSpecified = true; dmns.Thickness = 14; + return dmns; case CommonTypes.MediaType.RDX: case CommonTypes.MediaType.RDX320: @@ -545,6 +594,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 87; dmns.WidthSpecified = true; dmns.Thickness = 23; + return dmns; case CommonTypes.MediaType.LS120: case CommonTypes.MediaType.LS240: @@ -553,6 +603,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 90; dmns.WidthSpecified = true; dmns.Thickness = 3.5; + return dmns; case CommonTypes.MediaType.Travan: case CommonTypes.MediaType.Travan3: @@ -564,6 +615,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 92; dmns.WidthSpecified = true; dmns.Thickness = 15; + return dmns; case CommonTypes.MediaType.Travan1Ex: dmns.Height = 0; @@ -571,6 +623,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 92; dmns.WidthSpecified = true; dmns.Thickness = 15; + return dmns; case CommonTypes.MediaType.Travan3Ex: dmns.Height = 0; @@ -578,6 +631,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 92; dmns.WidthSpecified = true; dmns.Thickness = 15; + return dmns; case CommonTypes.MediaType.ADR2120: case CommonTypes.MediaType.ADR260: @@ -588,6 +642,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 93; dmns.WidthSpecified = true; dmns.Thickness = 14.5; + return dmns; case CommonTypes.MediaType.Data8: case CommonTypes.MediaType.AIT1: @@ -622,6 +677,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 95; dmns.WidthSpecified = true; dmns.Thickness = 15; + return dmns; case CommonTypes.MediaType.EZ135: case CommonTypes.MediaType.EZ230: @@ -630,6 +686,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 98; dmns.WidthSpecified = true; dmns.Thickness = 9.5; + return dmns; case CommonTypes.MediaType.ZIP100: case CommonTypes.MediaType.ZIP250: @@ -639,6 +696,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 98; dmns.WidthSpecified = true; dmns.Thickness = 6.5; + return dmns; case CommonTypes.MediaType.Jaz: case CommonTypes.MediaType.Jaz2: @@ -647,6 +705,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 98; dmns.WidthSpecified = true; dmns.Thickness = 12; + return dmns; case CommonTypes.MediaType.Orb: case CommonTypes.MediaType.Orb5: @@ -655,6 +714,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 98; dmns.WidthSpecified = true; dmns.Thickness = 8; + return dmns; case CommonTypes.MediaType.SparQ: dmns.Height = 98; @@ -662,6 +722,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 100; dmns.WidthSpecified = true; dmns.Thickness = 9.7; + return dmns; case CommonTypes.MediaType.SLR1: case CommonTypes.MediaType.SLR2: @@ -687,6 +748,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 100; dmns.WidthSpecified = true; dmns.Thickness = 18; + return dmns; case CommonTypes.MediaType.N64DD: dmns.Height = 103.124; @@ -694,6 +756,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 101.092; dmns.WidthSpecified = true; dmns.Thickness = 10.16; + return dmns; case CommonTypes.MediaType.CompactTapeI: case CommonTypes.MediaType.CompactTapeII: @@ -709,6 +772,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 105; dmns.WidthSpecified = true; dmns.Thickness = 25; + return dmns; case CommonTypes.MediaType.LTO: case CommonTypes.MediaType.LTO2: @@ -727,6 +791,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 105.41; dmns.WidthSpecified = true; dmns.Thickness = 21.59; + return dmns; case CommonTypes.MediaType.IBM3480: case CommonTypes.MediaType.IBM3490: @@ -737,6 +802,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 107.95; dmns.WidthSpecified = true; dmns.Thickness = 25.4; + return dmns; case CommonTypes.MediaType.T9840A: case CommonTypes.MediaType.T9840B: @@ -749,6 +815,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 109.22; dmns.WidthSpecified = true; dmns.Thickness = 25.4; + return dmns; case CommonTypes.MediaType.CompactCassette: case CommonTypes.MediaType.Dcas25: @@ -759,6 +826,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 128; dmns.WidthSpecified = true; dmns.Thickness = 12; + return dmns; case CommonTypes.MediaType.IBM3470: dmns.Height = 58.42; @@ -766,6 +834,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 137.16; dmns.WidthSpecified = true; dmns.Thickness = 16.51; + return dmns; case CommonTypes.MediaType.Bernoulli2: dmns.Height = 136; @@ -773,6 +842,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 140; dmns.WidthSpecified = true; dmns.Thickness = 9; + return dmns; case CommonTypes.MediaType.MLR1: case CommonTypes.MediaType.MLR3: @@ -782,6 +852,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 152.4; dmns.WidthSpecified = true; dmns.Thickness = 15.24; + return dmns; case CommonTypes.MediaType.QIC11: case CommonTypes.MediaType.QIC120: @@ -794,6 +865,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 154.2; dmns.WidthSpecified = true; dmns.Thickness = 16.6; + return dmns; case CommonTypes.MediaType.Bernoulli: dmns.Height = 275; @@ -801,6 +873,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 210; dmns.WidthSpecified = true; dmns.Thickness = 0; + return dmns; case CommonTypes.MediaType.DTF: case CommonTypes.MediaType.DTF2: @@ -809,6 +882,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 254; dmns.WidthSpecified = true; dmns.Thickness = 25.4; + return dmns; case CommonTypes.MediaType.LD: case CommonTypes.MediaType.LDROM: @@ -818,6 +892,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Diameter = 300; dmns.DiameterSpecified = true; dmns.Thickness = 2.5; + return dmns; case CommonTypes.MediaType.REV35: case CommonTypes.MediaType.REV70: @@ -827,6 +902,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 76.8; dmns.WidthSpecified = true; dmns.Thickness = 10; + return dmns; #region CD/DVD/BD @@ -905,22 +981,26 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Diameter = 120; dmns.DiameterSpecified = true; dmns.Thickness = 1.2; + return dmns; case CommonTypes.MediaType.GOD: dmns.Diameter = 80; dmns.DiameterSpecified = true; dmns.Thickness = 1.2; + return dmns; case CommonTypes.MediaType.VideoNow: dmns.Diameter = 85; dmns.DiameterSpecified = true; dmns.Thickness = 1.2; + return dmns; case CommonTypes.MediaType.VideoNowColor: case CommonTypes.MediaType.VideoNowXp: dmns.Diameter = 108; dmns.DiameterSpecified = true; dmns.Thickness = 1.2; + return dmns; #endregion CD/DVD/BD @@ -932,6 +1012,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 438.9; dmns.WidthSpecified = true; dmns.Thickness = 111.5; + return dmns; case CommonTypes.MediaType.AppleHD20: dmns.Height = 246.4; @@ -939,6 +1020,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 266.7; dmns.WidthSpecified = true; dmns.Thickness = 78.7; + return dmns; #endregion Apple Hard Disks @@ -948,6 +1030,7 @@ namespace DiscImageChef.CommonTypes.Metadata dmns.Width = 63; dmns.WidthSpecified = true; dmns.Thickness = 4; + return dmns; default: return null; } diff --git a/Metadata/MediaType.cs b/Metadata/MediaType.cs index 728956a..3ac1b24 100644 --- a/Metadata/MediaType.cs +++ b/Metadata/MediaType.cs @@ -47,1835 +47,2288 @@ namespace DiscImageChef.CommonTypes.Metadata case CommonTypes.MediaType.BDR: discType = "Blu-ray"; discSubType = "BD-R"; + break; case CommonTypes.MediaType.BDRE: discType = "Blu-ray"; discSubType = "BD-RE"; + break; case CommonTypes.MediaType.BDREXL: discType = "Blu-ray"; discSubType = "BD-RE XL"; + break; case CommonTypes.MediaType.BDROM: discType = "Blu-ray"; discSubType = "BD-ROM"; + break; case CommonTypes.MediaType.BDRXL: discType = "Blu-ray"; discSubType = "BD-R XL"; + break; case CommonTypes.MediaType.CBHD: discType = "Blu-ray"; discSubType = "CBHD"; + break; case CommonTypes.MediaType.CD: discType = "Compact Disc"; discSubType = "CD"; + break; case CommonTypes.MediaType.CDDA: discType = "Compact Disc"; discSubType = "CD Digital Audio"; + break; case CommonTypes.MediaType.CDEG: discType = "Compact Disc"; discSubType = "CD+EG"; + break; case CommonTypes.MediaType.CDG: discType = "Compact Disc"; discSubType = "CD+G"; + break; case CommonTypes.MediaType.CDI: discType = "Compact Disc"; discSubType = "CD-i"; + break; case CommonTypes.MediaType.CDIREADY: discType = "Compact Disc"; discSubType = "CD-i Ready"; + break; case CommonTypes.MediaType.CDMIDI: discType = "Compact Disc"; discSubType = "CD+MIDI"; + break; case CommonTypes.MediaType.CDMO: discType = "Compact Disc"; discSubType = "CD-MO"; + break; case CommonTypes.MediaType.CDMRW: discType = "Compact Disc"; discSubType = "CD-MRW"; + break; case CommonTypes.MediaType.CDPLUS: discType = "Compact Disc"; discSubType = "CD+"; + break; case CommonTypes.MediaType.CDR: discType = "Compact Disc"; discSubType = "CD-R"; + break; case CommonTypes.MediaType.CDROM: discType = "Compact Disc"; discSubType = "CD-ROM"; + break; case CommonTypes.MediaType.CDROMXA: discType = "Compact Disc"; discSubType = "CD-ROM XA"; + break; case CommonTypes.MediaType.CDRW: discType = "Compact Disc"; discSubType = "CD-RW"; + break; case CommonTypes.MediaType.CDV: discType = "Compact Disc"; discSubType = "CD-Video"; + break; case CommonTypes.MediaType.DDCD: discType = "DDCD"; discSubType = "DDCD"; + break; case CommonTypes.MediaType.DDCDR: discType = "DDCD"; discSubType = "DDCD-R"; + break; case CommonTypes.MediaType.DDCDRW: discType = "DDCD"; discSubType = "DDCD-RW"; + break; case CommonTypes.MediaType.DTSCD: discType = "Compact Disc"; discSubType = "DTS CD"; + break; case CommonTypes.MediaType.DVDDownload: discType = "DVD"; discSubType = "DVD-Download"; + break; case CommonTypes.MediaType.DVDPR: discType = "DVD"; discSubType = "DVD+R"; + break; case CommonTypes.MediaType.DVDPRDL: discType = "DVD"; discSubType = "DVD+R DL"; + break; case CommonTypes.MediaType.DVDPRW: discType = "DVD"; discSubType = "DVD+RW"; + break; case CommonTypes.MediaType.DVDPRWDL: discType = "DVD"; discSubType = "DVD+RW DL"; + break; case CommonTypes.MediaType.DVDR: discType = "DVD"; discSubType = "DVD-R"; + break; case CommonTypes.MediaType.DVDRAM: discType = "DVD"; discSubType = "DVD-RAM"; + break; case CommonTypes.MediaType.DVDRDL: discType = "DVD"; discSubType = "DVD-R DL"; + break; case CommonTypes.MediaType.DVDROM: discType = "DVD"; discSubType = "DVD-ROM"; + break; case CommonTypes.MediaType.DVDRW: discType = "DVD"; discSubType = "DVD-RW"; + break; case CommonTypes.MediaType.DVDRWDL: discType = "DVD"; discSubType = "DVD-RW DL"; + break; case CommonTypes.MediaType.EVD: discType = "EVD"; discSubType = "EVD"; + break; case CommonTypes.MediaType.FDDVD: discType = "FDDVD"; discSubType = "FDDVD"; + break; case CommonTypes.MediaType.FVD: discType = "FVD"; discSubType = "FVD"; + break; case CommonTypes.MediaType.GDR: discType = "GD"; discSubType = "GD-R"; + break; case CommonTypes.MediaType.GDROM: discType = "GD"; discSubType = "GD-ROM"; + break; case CommonTypes.MediaType.GOD: discType = "DVD"; discSubType = "GameCube Game Disc"; + break; case CommonTypes.MediaType.WOD: discType = "DVD"; discSubType = "Wii Optical Disc"; + break; case CommonTypes.MediaType.WUOD: discType = "Blu-ray"; discSubType = "Wii U Optical Disc"; + break; case CommonTypes.MediaType.HDDVDR: discType = "HD DVD"; discSubType = "HD DVD-R"; + break; case CommonTypes.MediaType.HDDVDRAM: discType = "HD DVD"; discSubType = "HD DVD-RAM"; + break; case CommonTypes.MediaType.HDDVDRDL: discType = "HD DVD"; discSubType = "HD DVD-R DL"; + break; case CommonTypes.MediaType.HDDVDROM: discType = "HD DVD"; discSubType = "HD DVD-ROM"; + break; case CommonTypes.MediaType.HDDVDRW: discType = "HD DVD"; discSubType = "HD DVD-RW"; + break; case CommonTypes.MediaType.HDDVDRWDL: discType = "HD DVD"; discSubType = "HD DVD-RW DL"; + break; case CommonTypes.MediaType.HDVMD: discType = "HD VMD"; discSubType = "HD VMD"; + break; case CommonTypes.MediaType.HiMD: discType = "MiniDisc"; discSubType = "HiMD"; + break; case CommonTypes.MediaType.HVD: discType = "HVD"; discSubType = "HVD"; + break; case CommonTypes.MediaType.LD: discType = "LaserDisc"; discSubType = "LaserDisc"; + break; case CommonTypes.MediaType.LDROM: discType = "LaserDisc"; discSubType = "LD-ROM"; + break; case CommonTypes.MediaType.LVROM: discType = "LaserDisc"; discSubType = "LV-ROM"; + break; case CommonTypes.MediaType.MegaLD: discType = "LaserDisc"; discSubType = "MegaLD"; + break; case CommonTypes.MediaType.MD: discType = "MiniDisc"; discSubType = "MiniDisc"; + break; case CommonTypes.MediaType.MEGACD: discType = "Compact Disc"; discSubType = "Sega Mega CD"; + break; case CommonTypes.MediaType.PCD: discType = "Compact Disc"; discSubType = "Photo CD"; + break; case CommonTypes.MediaType.PlayStationMemoryCard: discType = "PlayStation Memory Card"; discSubType = "PlayStation Memory Card"; + break; case CommonTypes.MediaType.PlayStationMemoryCard2: discType = "PlayStation Memory Card"; discSubType = "PlayStation 2 Memory Card"; + break; case CommonTypes.MediaType.PS1CD: discType = "Compact Disc"; discSubType = "PlayStation Game Disc"; + break; case CommonTypes.MediaType.PS2CD: discType = "Compact Disc"; discSubType = "PlayStation 2 Game Disc"; + break; case CommonTypes.MediaType.PS2DVD: discType = "DVD"; discSubType = "PlayStation 2 Game Disc"; + break; case CommonTypes.MediaType.PS3BD: discType = "Blu-ray"; discSubType = "PlayStation 3 Game Disc"; + break; case CommonTypes.MediaType.PS3DVD: discType = "DVD"; discSubType = "PlayStation 3 Game Disc"; + break; case CommonTypes.MediaType.PS4BD: discType = "Blu-ray"; discSubType = "PlayStation 4 Game Disc"; + break; case CommonTypes.MediaType.SACD: discType = "SACD"; discSubType = "Super Audio CD"; + break; case CommonTypes.MediaType.SegaCard: discType = "Sega Card"; discSubType = "Sega Card"; + break; case CommonTypes.MediaType.SATURNCD: discType = "Compact Disc"; discSubType = "Sega Saturn CD"; + break; case CommonTypes.MediaType.SVCD: discType = "Compact Disc"; discSubType = "Super Video CD"; + break; case CommonTypes.MediaType.SVOD: discType = "SVOD"; discSubType = "SVOD"; + break; case CommonTypes.MediaType.UDO: discType = "UDO"; discSubType = "UDO"; + break; case CommonTypes.MediaType.UMD: discType = "UMD"; discSubType = "Universal Media Disc"; + break; case CommonTypes.MediaType.VCD: discType = "Compact Disc"; discSubType = "Video CD"; + break; case CommonTypes.MediaType.Nuon: discType = "DVD"; discSubType = "Nuon"; + break; case CommonTypes.MediaType.XGD: discType = "DVD"; discSubType = "Xbox Game Disc (XGD)"; + break; case CommonTypes.MediaType.XGD2: discType = "DVD"; discSubType = "Xbox 360 Game Disc (XGD2)"; + break; case CommonTypes.MediaType.XGD3: discType = "DVD"; discSubType = "Xbox 360 Game Disc (XGD3)"; + break; case CommonTypes.MediaType.XGD4: discType = "Blu-ray"; discSubType = "Xbox One Game Disc (XGD4)"; + break; case CommonTypes.MediaType.FMTOWNS: discType = "Compact Disc"; discSubType = "FM-Towns"; + break; case CommonTypes.MediaType.Apple32SS: discType = "5.25\" floppy"; discSubType = "Apple DOS 3.2"; + break; case CommonTypes.MediaType.Apple32DS: discType = "5.25\" floppy"; discSubType = "Apple DOS 3.2 (double-sided)"; + break; case CommonTypes.MediaType.Apple33SS: discType = "5.25\" floppy"; discSubType = "Apple DOS 3.3"; + break; case CommonTypes.MediaType.Apple33DS: discType = "5.25\" floppy"; discSubType = "Apple DOS 3.3 (double-sided)"; + break; case CommonTypes.MediaType.AppleSonySS: discType = "3.5\" floppy"; discSubType = "Apple 400K"; + break; case CommonTypes.MediaType.AppleSonyDS: discType = "3.5\" floppy"; discSubType = "Apple 800K"; + break; case CommonTypes.MediaType.AppleFileWare: discType = "5.25\" floppy"; discSubType = "Apple FileWare"; + break; case CommonTypes.MediaType.RX50: discType = "5.25\" floppy"; discSubType = "DEC RX50"; + break; case CommonTypes.MediaType.DOS_525_SS_DD_8: discType = "5.25\" floppy"; discSubType = "IBM double-density, single-sided, 8 sectors"; + break; case CommonTypes.MediaType.DOS_525_SS_DD_9: discType = "5.25\" floppy"; discSubType = "IBM double-density, single-sided, 9 sectors"; + break; case CommonTypes.MediaType.DOS_525_DS_DD_8: discType = "5.25\" floppy"; discSubType = "IBM double-density, double-sided, 8 sectors"; + break; case CommonTypes.MediaType.DOS_525_DS_DD_9: discType = "5.25\" floppy"; discSubType = "IBM double-density, double-sided, 9 sectors"; + break; case CommonTypes.MediaType.DOS_525_HD: discType = "5.25\" floppy"; discSubType = "IBM high-density"; + break; case CommonTypes.MediaType.DOS_35_SS_DD_8: discType = "3.5\" floppy"; discSubType = "IBM double-density, single-sided, 8 sectors"; + break; case CommonTypes.MediaType.DOS_35_SS_DD_9: discType = "3.5\" floppy"; discSubType = "IBM double-density, single-sided, 9 sectors"; + break; case CommonTypes.MediaType.DOS_35_DS_DD_8: discType = "3.5\" floppy"; discSubType = "IBM double-density, double-sided, 8 sectors"; + break; case CommonTypes.MediaType.DOS_35_DS_DD_9: discType = "3.5\" floppy"; discSubType = "IBM double-density, double-sided, 9 sectors"; + break; case CommonTypes.MediaType.DOS_35_HD: discType = "3.5\" floppy"; discSubType = "IBM high-density"; + break; case CommonTypes.MediaType.DOS_35_ED: discType = "3.5\" floppy"; discSubType = "IBM extra-density"; + break; case CommonTypes.MediaType.Apricot_35: discType = "3.5\" floppy"; discSubType = "Apricot double-density, single-sided, 70 tracks"; + break; case CommonTypes.MediaType.DMF: discType = "3.5\" floppy"; discSubType = "Microsoft DMF"; + break; case CommonTypes.MediaType.DMF_82: discType = "3.5\" floppy"; discSubType = "Microsoft DMF (82-track)"; + break; case CommonTypes.MediaType.XDF_35: discType = "3.5\" floppy"; discSubType = "IBM XDF"; + break; case CommonTypes.MediaType.XDF_525: discType = "5.25\" floppy"; discSubType = "IBM XDF"; + break; case CommonTypes.MediaType.IBM23FD: discType = "8\" floppy"; discSubType = "IBM 23FD"; + break; case CommonTypes.MediaType.IBM33FD_128: discType = "8\" floppy"; discSubType = "IBM 33FD (128 bytes/sector)"; + break; case CommonTypes.MediaType.IBM33FD_256: discType = "8\" floppy"; discSubType = "IBM 33FD (256 bytes/sector)"; + break; case CommonTypes.MediaType.IBM33FD_512: discType = "8\" floppy"; discSubType = "IBM 33FD (512 bytes/sector)"; + break; case CommonTypes.MediaType.IBM43FD_128: discType = "8\" floppy"; discSubType = "IBM 43FD (128 bytes/sector)"; + break; case CommonTypes.MediaType.IBM43FD_256: discType = "8\" floppy"; discSubType = "IBM 43FD (256 bytes/sector)"; + break; case CommonTypes.MediaType.IBM53FD_256: discType = "8\" floppy"; discSubType = "IBM 53FD (256 bytes/sector)"; + break; case CommonTypes.MediaType.IBM53FD_512: discType = "8\" floppy"; discSubType = "IBM 53FD (512 bytes/sector)"; + break; case CommonTypes.MediaType.IBM53FD_1024: discType = "8\" floppy"; discSubType = "IBM 53FD (1024 bytes/sector)"; + break; case CommonTypes.MediaType.RX01: discType = "8\" floppy"; discSubType = "DEC RX-01"; + break; case CommonTypes.MediaType.RX02: discType = "8\" floppy"; discSubType = "DEC RX-02"; + break; case CommonTypes.MediaType.RX03: discType = "8\" floppy"; discSubType = "DEC RX-03"; + break; case CommonTypes.MediaType.ACORN_525_SS_SD_40: discType = "5.25\" floppy"; discSubType = "BBC Micro 100K"; + break; case CommonTypes.MediaType.ACORN_525_SS_SD_80: discType = "5.25\" floppy"; discSubType = "BBC Micro 200K"; + break; case CommonTypes.MediaType.ACORN_525_SS_DD_40: discType = "5.25\" floppy"; discSubType = "Acorn S"; + break; case CommonTypes.MediaType.ACORN_525_SS_DD_80: discType = "5.25\" floppy"; discSubType = "Acorn M"; + break; case CommonTypes.MediaType.ACORN_525_DS_DD: discType = "5.25\" floppy"; discSubType = "Acorn L"; + break; case CommonTypes.MediaType.ACORN_35_DS_DD: discType = "3.5\" floppy"; discSubType = "Acorn Archimedes"; + break; case CommonTypes.MediaType.ACORN_35_DS_HD: discType = "3.5\" floppy"; discSubType = "Acorn Archimedes high-density"; + break; case CommonTypes.MediaType.ATARI_525_SD: discType = "5.25\" floppy"; discSubType = "Atari single-density"; + break; case CommonTypes.MediaType.ATARI_525_ED: discType = "5.25\" floppy"; discSubType = "Atari enhanced-density"; + break; case CommonTypes.MediaType.ATARI_525_DD: discType = "5.25\" floppy"; discSubType = "Atari double-density"; + break; case CommonTypes.MediaType.ATARI_35_SS_DD: discType = "3.5\" floppy"; discSubType = "Atari ST double-density, single-sided, 10 sectors"; + break; case CommonTypes.MediaType.ATARI_35_DS_DD: discType = "3.5\" floppy"; discSubType = "Atari ST double-density, double-sided, 10 sectors"; + break; case CommonTypes.MediaType.ATARI_35_SS_DD_11: discType = "3.5\" floppy"; discSubType = "Atari ST double-density, single-sided, 11 sectors"; + break; case CommonTypes.MediaType.ATARI_35_DS_DD_11: discType = "3.5\" floppy"; discSubType = "Atari ST double-density, double-sided, 11 sectors"; + break; case CommonTypes.MediaType.CBM_1540: case CommonTypes.MediaType.CBM_1540_Ext: discType = "5.25\" floppy"; discSubType = "Commodore 1540/1541"; + break; case CommonTypes.MediaType.CBM_1571: discType = "5.25\" floppy"; discSubType = "Commodore 1571"; + break; case CommonTypes.MediaType.CBM_35_DD: discType = "3.5\" floppy"; discSubType = "Commodore 1581"; + break; case CommonTypes.MediaType.CBM_AMIGA_35_DD: discType = "3.5\" floppy"; discSubType = "Amiga double-density"; + break; case CommonTypes.MediaType.CBM_AMIGA_35_HD: discType = "3.5\" floppy"; discSubType = "Amiga high-density"; + break; case CommonTypes.MediaType.NEC_8_SD: discType = "8\" floppy"; discSubType = "NEC single-sided"; + break; case CommonTypes.MediaType.NEC_8_DD: discType = "8\" floppy"; discSubType = "NEC double-sided"; + break; case CommonTypes.MediaType.NEC_525_SS: discType = "5.25\" floppy"; discSubType = "NEC single-sided"; + break; case CommonTypes.MediaType.NEC_525_HD: discType = "5.25\" floppy"; discSubType = "NEC high-density"; + break; case CommonTypes.MediaType.NEC_35_HD_8: discType = "3.5\" floppy"; discSubType = "NEC high-density"; + break; case CommonTypes.MediaType.NEC_35_HD_15: discType = "3.5\" floppy"; discSubType = "NEC high-density"; + break; case CommonTypes.MediaType.NEC_35_TD: discType = "3.5\" floppy"; discSubType = "NEC triple-density"; + break; case CommonTypes.MediaType.SHARP_525_9: discType = "5.25\" floppy"; discSubType = "Sharp (9 sectors per track)"; + break; case CommonTypes.MediaType.SHARP_35_9: discType = "3.5\" floppy"; discSubType = "Sharp (9 sectors per track)"; + break; case CommonTypes.MediaType.ECMA_54: discType = "8\" floppy"; discSubType = "ECMA-54"; + break; case CommonTypes.MediaType.ECMA_59: discType = "8\" floppy"; discSubType = "ECMA-59"; + break; case CommonTypes.MediaType.ECMA_69_8: case CommonTypes.MediaType.ECMA_69_15: case CommonTypes.MediaType.ECMA_69_26: discType = "8\" floppy"; discSubType = "ECMA-69"; + break; case CommonTypes.MediaType.ECMA_66: discType = "5.25\" floppy"; discSubType = "ECMA-66"; + break; case CommonTypes.MediaType.ECMA_70: discType = "5.25\" floppy"; discSubType = "ECMA-70"; + break; case CommonTypes.MediaType.ECMA_78: case CommonTypes.MediaType.ECMA_78_2: discType = "5.25\" floppy"; discSubType = "ECMA-78"; + break; case CommonTypes.MediaType.ECMA_99_8: case CommonTypes.MediaType.ECMA_99_15: case CommonTypes.MediaType.ECMA_99_26: discType = "5.25\" floppy"; discSubType = "ECMA-99"; + break; case CommonTypes.MediaType.FDFORMAT_525_DD: discType = "5.25\" floppy"; discSubType = "FDFORMAT double-density"; + break; case CommonTypes.MediaType.FDFORMAT_525_HD: discType = "5.25\" floppy"; discSubType = "FDFORMAT high-density"; + break; case CommonTypes.MediaType.FDFORMAT_35_DD: discType = "3.5\" floppy"; discSubType = "FDFORMAT double-density"; + break; case CommonTypes.MediaType.FDFORMAT_35_HD: discType = "3.5\" floppy"; discSubType = "FDFORMAT high-density"; + break; case CommonTypes.MediaType.ECMA_260: case CommonTypes.MediaType.ECMA_260_Double: discType = "356mm magneto-optical"; discSubType = "ECMA-260 / ISO 15898"; + break; case CommonTypes.MediaType.ECMA_183_512: case CommonTypes.MediaType.ECMA_183: discType = "5.25\" magneto-optical"; discSubType = "ECMA-183"; + break; case CommonTypes.MediaType.ECMA_184_512: case CommonTypes.MediaType.ECMA_184: discType = "5.25\" magneto-optical"; discSubType = "ECMA-184"; + break; case CommonTypes.MediaType.ECMA_154: discType = "3.5\" magneto-optical"; discSubType = "ECMA-154"; + break; case CommonTypes.MediaType.ECMA_201: case CommonTypes.MediaType.ECMA_201_ROM: discType = "3.5\" magneto-optical"; discSubType = "ECMA-201"; + break; case CommonTypes.MediaType.FlashDrive: discType = "USB flash drive"; discSubType = "USB flash drive"; + break; case CommonTypes.MediaType.SuperCDROM2: discType = "Compact Disc"; discSubType = "Super CD-ROM²"; + break; case CommonTypes.MediaType.LDROM2: discType = "LaserDisc"; discSubType = "LD-ROM²"; + break; case CommonTypes.MediaType.JaguarCD: discType = "Compact Disc"; discSubType = "Atari Jaguar CD"; + break; case CommonTypes.MediaType.MilCD: discType = "Compact Disc"; discSubType = "Sega MilCD"; + break; case CommonTypes.MediaType.ThreeDO: discType = "Compact Disc"; discSubType = "3DO"; + break; case CommonTypes.MediaType.PCFX: discType = "Compact Disc"; discSubType = "PC-FX"; + break; case CommonTypes.MediaType.NeoGeoCD: discType = "Compact Disc"; discSubType = "NEO-GEO CD"; + break; case CommonTypes.MediaType.CDTV: discType = "Compact Disc"; discSubType = "Commodore CDTV"; + break; case CommonTypes.MediaType.CD32: discType = "Compact Disc"; discSubType = "Amiga CD32"; + break; case CommonTypes.MediaType.Playdia: discType = "Compact Disc"; discSubType = "Bandai Playdia"; + break; case CommonTypes.MediaType.Pippin: discType = "Compact Disc"; discSubType = "Apple Pippin"; + break; case CommonTypes.MediaType.ZIP100: discType = "Iomega ZIP"; discSubType = "Iomega ZIP100"; + break; case CommonTypes.MediaType.ZIP250: discType = "Iomega ZIP"; discSubType = "Iomega ZIP250"; + break; case CommonTypes.MediaType.ZIP750: discType = "Iomega ZIP"; discSubType = "Iomega ZIP750"; + break; case CommonTypes.MediaType.AppleProfile: discType = "Hard Disk Drive"; discSubType = "Apple Profile"; + break; case CommonTypes.MediaType.AppleWidget: discType = "Hard Disk Drive"; discSubType = "Apple Widget"; + break; case CommonTypes.MediaType.AppleHD20: discType = "Hard Disk Drive"; discSubType = "Apple HD20"; + break; case CommonTypes.MediaType.PriamDataTower: discType = "Hard Disk Drive"; discSubType = "Priam DataTower"; + break; case CommonTypes.MediaType.DDS1: discType = "Digital Data Storage"; discSubType = "DDS"; + break; case CommonTypes.MediaType.DDS2: discType = "Digital Data Storage"; discSubType = "DDS-2"; + break; case CommonTypes.MediaType.DDS3: discType = "Digital Data Storage"; discSubType = "DDS-3"; + break; case CommonTypes.MediaType.DDS4: discType = "Digital Data Storage"; discSubType = "DDS-4"; + break; case CommonTypes.MediaType.PocketZip: discType = "Iomega PocketZip"; discSubType = "Iomega PocketZip"; + break; case CommonTypes.MediaType.CompactFloppy: discType = "3\" floppy"; discSubType = "Compact Floppy"; + break; case CommonTypes.MediaType.GENERIC_HDD: discType = "Hard Disk Drive"; discSubType = "Unknown"; + break; case CommonTypes.MediaType.MDData: discType = "MiniDisc"; discSubType = "MD-DATA"; + break; case CommonTypes.MediaType.MDData2: discType = "MiniDisc"; discSubType = "MD-DATA2"; + break; case CommonTypes.MediaType.UDO2: discType = "UDO"; discSubType = "UDO2"; + break; case CommonTypes.MediaType.UDO2_WORM: discType = "UDO"; discSubType = "UDO2 (WORM)"; + break; case CommonTypes.MediaType.ADR30: discType = "Advanced Digital Recording"; discSubType = "ADR 30"; + break; case CommonTypes.MediaType.ADR50: discType = "Advanced Digital Recording"; discSubType = "ADR 50"; + break; case CommonTypes.MediaType.ADR260: discType = "Advanced Digital Recording"; discSubType = "ADR 2.60"; + break; case CommonTypes.MediaType.ADR2120: discType = "Advanced Digital Recording"; discSubType = "ADR 2.120"; + break; case CommonTypes.MediaType.AIT1: discType = "Advanced Intelligent Tape"; discSubType = "AIT-1"; + break; case CommonTypes.MediaType.AIT1Turbo: discType = "Advanced Intelligent Tape"; discSubType = "AIT-1 Turbo"; + break; case CommonTypes.MediaType.AIT2: discType = "Advanced Intelligent Tape"; discSubType = "AIT-2"; + break; case CommonTypes.MediaType.AIT2Turbo: discType = "Advanced Intelligent Tape"; discSubType = "AIT-2 Turbo"; + break; case CommonTypes.MediaType.AIT3: discType = "Advanced Intelligent Tape"; discSubType = "AIT-3"; + break; case CommonTypes.MediaType.AIT3Ex: discType = "Advanced Intelligent Tape"; discSubType = "AIT-3Ex"; + break; case CommonTypes.MediaType.AIT3Turbo: discType = "Advanced Intelligent Tape"; discSubType = "AIT-3 Turbo"; + break; case CommonTypes.MediaType.AIT4: discType = "Advanced Intelligent Tape"; discSubType = "AIT-4"; + break; case CommonTypes.MediaType.AIT5: discType = "Advanced Intelligent Tape"; discSubType = "AIT-5"; + break; case CommonTypes.MediaType.AITETurbo: discType = "Advanced Intelligent Tape"; discSubType = "AIT-E Turbo"; + break; case CommonTypes.MediaType.SAIT1: discType = "Super Advanced Intelligent Tape"; discSubType = "SAIT-1"; + break; case CommonTypes.MediaType.SAIT2: discType = "Super Advanced Intelligent Tape"; discSubType = "SAIT-2"; + break; case CommonTypes.MediaType.Bernoulli: discType = "Iomega Bernoulli"; discSubType = "Iomega Bernoulli"; + break; case CommonTypes.MediaType.Bernoulli2: discType = "Iomega Bernoulli"; discSubType = "Iomega Bernoulli 2"; + break; case CommonTypes.MediaType.Ditto: discType = "Iomega Ditto"; discSubType = "Iomega Ditto"; + break; case CommonTypes.MediaType.DittoMax: discType = "Iomega Ditto"; discSubType = "Iomega Ditto Max"; + break; case CommonTypes.MediaType.Jaz: discType = "Iomega Jaz"; discSubType = "Iomega Jaz 1GB"; + break; case CommonTypes.MediaType.Jaz2: discType = "Iomega Jaz"; discSubType = "Iomega Jaz 2GB"; + break; case CommonTypes.MediaType.REV35: discType = "Iomega REV"; discSubType = "Iomega REV-35"; + break; case CommonTypes.MediaType.REV70: discType = "Iomega REV"; discSubType = "Iomega REV-70"; + break; case CommonTypes.MediaType.REV120: discType = "Iomega REV"; discSubType = "Iomega REV-120"; + break; case CommonTypes.MediaType.CompactFlash: discType = "Compact Flash"; discSubType = "Compact Flash"; + break; case CommonTypes.MediaType.CompactFlashType2: discType = "Compact Flash"; discSubType = "Compact Flash Type 2"; + break; case CommonTypes.MediaType.CFast: discType = "Compact Flash"; discSubType = "CFast"; + break; case CommonTypes.MediaType.DigitalAudioTape: discType = "Digital Audio Tape"; discSubType = "Digital Audio Tape"; + break; case CommonTypes.MediaType.DAT72: discType = "Digital Data Storage"; discSubType = "DAT-72"; + break; case CommonTypes.MediaType.DAT160: discType = "Digital Data Storage"; discSubType = "DAT-160"; + break; case CommonTypes.MediaType.DAT320: discType = "Digital Data Storage"; discSubType = "DAT-320"; + break; case CommonTypes.MediaType.DECtapeII: discType = "DECtape"; discSubType = "DECtape II"; + break; case CommonTypes.MediaType.CompactTapeI: discType = "CompacTape"; discSubType = "CompacTape"; + break; case CommonTypes.MediaType.CompactTapeII: discType = "CompacTape"; discSubType = "CompacTape II"; + break; case CommonTypes.MediaType.DLTtapeIII: discType = "Digital Linear Tape"; discSubType = "DLTtape III"; + break; case CommonTypes.MediaType.DLTtapeIIIxt: discType = "Digital Linear Tape"; discSubType = "DLTtape IIIXT"; + break; case CommonTypes.MediaType.DLTtapeIV: discType = "Digital Linear Tape"; discSubType = "DLTtape IV"; + break; case CommonTypes.MediaType.DLTtapeS4: discType = "Digital Linear Tape"; discSubType = "DLTtape S4"; + break; case CommonTypes.MediaType.SDLT1: discType = "Super Digital Linear Tape"; discSubType = "SDLTtape I"; + break; case CommonTypes.MediaType.SDLT2: discType = "Super Digital Linear Tape"; discSubType = "SDLTtape II"; + break; case CommonTypes.MediaType.VStapeI: discType = "Digital Linear Tape"; discSubType = "DLTtape VS1"; + break; case CommonTypes.MediaType.Data8: discType = "Data8"; discSubType = "Data8"; + break; case CommonTypes.MediaType.MiniDV: discType = "DV tape"; discSubType = "MiniDV"; + break; case CommonTypes.MediaType.Exatape15m: discType = "Exatape"; discSubType = "Exatape (15m)"; + break; case CommonTypes.MediaType.Exatape22m: discType = "Exatape"; discSubType = "Exatape (22m)"; + break; case CommonTypes.MediaType.Exatape22mAME: discType = "Exatape"; discSubType = "Exatape (22m AME)"; + break; case CommonTypes.MediaType.Exatape28m: discType = "Exatape"; discSubType = "Exatape (28m)"; + break; case CommonTypes.MediaType.Exatape40m: discType = "Exatape"; discSubType = "Exatape (40m)"; + break; case CommonTypes.MediaType.Exatape45m: discType = "Exatape"; discSubType = "Exatape (45m)"; + break; case CommonTypes.MediaType.Exatape54m: discType = "Exatape"; discSubType = "Exatape (54m)"; + break; case CommonTypes.MediaType.Exatape75m: discType = "Exatape"; discSubType = "Exatape (75m)"; + break; case CommonTypes.MediaType.Exatape76m: discType = "Exatape"; discSubType = "Exatape (76m)"; + break; case CommonTypes.MediaType.Exatape80m: discType = "Exatape"; discSubType = "Exatape (80m)"; + break; case CommonTypes.MediaType.Exatape106m: discType = "Exatape"; discSubType = "Exatape (106m)"; + break; case CommonTypes.MediaType.Exatape112m: discType = "Exatape"; discSubType = "Exatape (112m)"; + break; case CommonTypes.MediaType.Exatape125m: discType = "Exatape"; discSubType = "Exatape (125m)"; + break; case CommonTypes.MediaType.Exatape150m: discType = "Exatape"; discSubType = "Exatape (150m)"; + break; case CommonTypes.MediaType.Exatape160mXL: discType = "Exatape"; discSubType = "Exatape XL (160m)"; + break; case CommonTypes.MediaType.Exatape170m: discType = "Exatape"; discSubType = "Exatape (170m)"; + break; case CommonTypes.MediaType.Exatape225m: discType = "Exatape"; discSubType = "Exatape (225m)"; + break; case CommonTypes.MediaType.EZ135: discType = "3.5\" SyQuest cartridge"; discSubType = "EZ135"; + break; case CommonTypes.MediaType.EZ230: discType = "3.5\" SyQuest cartridge"; discSubType = "EZ230"; + break; case CommonTypes.MediaType.Quest: discType = "3.5\" SyQuest cartridge"; discSubType = "Quest"; + break; case CommonTypes.MediaType.SparQ: discType = "3.5\" SyQuest cartridge"; discSubType = "SparQ"; + break; case CommonTypes.MediaType.SQ100: discType = "3.9\" SyQuest cartridge"; discSubType = "SQ100"; + break; case CommonTypes.MediaType.SQ200: discType = "3.9\" SyQuest cartridge"; discSubType = "SQ200"; + break; case CommonTypes.MediaType.SQ300: discType = "3.9\" SyQuest cartridge"; discSubType = "SQ300"; + break; case CommonTypes.MediaType.SQ310: discType = "3.5\" SyQuest cartridge"; discSubType = "SQ310"; + break; case CommonTypes.MediaType.SQ327: discType = "3.5\" SyQuest cartridge"; discSubType = "SQ327"; + break; case CommonTypes.MediaType.SQ400: discType = "5.25\" SyQuest cartridge"; discSubType = "SQ400"; + break; case CommonTypes.MediaType.SQ800: discType = "5.25\" SyQuest cartridge"; discSubType = "SQ800"; + break; case CommonTypes.MediaType.SQ1500: discType = "3.5\" SyQuest cartridge"; discSubType = "SQ1500"; + break; case CommonTypes.MediaType.SQ2000: discType = "5.25\" SyQuest cartridge"; discSubType = "SQ2000"; + break; case CommonTypes.MediaType.SyJet: discType = "3.5\" SyQuest cartridge"; discSubType = "SyJet"; + break; case CommonTypes.MediaType.LTO: discType = "Linear Tape-Open"; discSubType = "LTO"; + break; case CommonTypes.MediaType.LTO2: discType = "Linear Tape-Open"; discSubType = "LTO-2"; + break; case CommonTypes.MediaType.LTO3: discType = "Linear Tape-Open"; discSubType = "LTO-3"; + break; case CommonTypes.MediaType.LTO3WORM: discType = "Linear Tape-Open"; discSubType = "LTO-3 (WORM)"; + break; case CommonTypes.MediaType.LTO4: discType = "Linear Tape-Open"; discSubType = "LTO-4"; + break; case CommonTypes.MediaType.LTO4WORM: discType = "Linear Tape-Open"; discSubType = "LTO-4 (WORM)"; + break; case CommonTypes.MediaType.LTO5: discType = "Linear Tape-Open"; discSubType = "LTO-5"; + break; case CommonTypes.MediaType.LTO5WORM: discType = "Linear Tape-Open"; discSubType = "LTO-5 (WORM)"; + break; case CommonTypes.MediaType.LTO6: discType = "Linear Tape-Open"; discSubType = "LTO-6"; + break; case CommonTypes.MediaType.LTO6WORM: discType = "Linear Tape-Open"; discSubType = "LTO-6 (WORM)"; + break; case CommonTypes.MediaType.LTO7: discType = "Linear Tape-Open"; discSubType = "LTO-7"; + break; case CommonTypes.MediaType.LTO7WORM: discType = "Linear Tape-Open"; discSubType = "LTO-7 (WORM)"; + break; case CommonTypes.MediaType.MemoryStick: discType = "Memory Stick"; discSubType = "Memory Stick"; + break; case CommonTypes.MediaType.MemoryStickDuo: discType = "Memory Stick"; discSubType = "Memory Stick Duo"; + break; case CommonTypes.MediaType.MemoryStickMicro: discType = "Memory Stick"; discSubType = "Memory Stick Micro"; + break; case CommonTypes.MediaType.MemoryStickPro: discType = "Memory Stick"; discSubType = "Memory Stick Pro"; + break; case CommonTypes.MediaType.MemoryStickProDuo: discType = "Memory Stick"; discSubType = "Memory Stick PRO Duo"; + break; case CommonTypes.MediaType.SecureDigital: discType = "Secure Digital"; discSubType = "Secure Digital"; + break; case CommonTypes.MediaType.miniSD: discType = "Secure Digital"; discSubType = "miniSD"; + break; case CommonTypes.MediaType.microSD: discType = "Secure Digital"; discSubType = "microSD"; + break; case CommonTypes.MediaType.MMC: discType = "MultiMediaCard"; discSubType = "MultiMediaCard"; + break; case CommonTypes.MediaType.MMCmicro: discType = "MultiMediaCard"; discSubType = "MMCmicro"; + break; case CommonTypes.MediaType.RSMMC: discType = "MultiMediaCard"; discSubType = "Reduced-Size MultiMediaCard"; + break; case CommonTypes.MediaType.MMCplus: discType = "MultiMediaCard"; discSubType = "MMCplus"; + break; case CommonTypes.MediaType.MMCmobile: discType = "MultiMediaCard"; discSubType = "MMCmobile"; + break; case CommonTypes.MediaType.MLR1: discType = "Scalable Linear Recording"; discSubType = "MLR1"; + break; case CommonTypes.MediaType.MLR1SL: discType = "Scalable Linear Recording"; discSubType = "MLR1 SL"; + break; case CommonTypes.MediaType.MLR3: discType = "Scalable Linear Recording"; discSubType = "MLR3"; + break; case CommonTypes.MediaType.SLR1: discType = "Scalable Linear Recording"; discSubType = "SLR1"; + break; case CommonTypes.MediaType.SLR2: discType = "Scalable Linear Recording"; discSubType = "SLR2"; + break; case CommonTypes.MediaType.SLR3: discType = "Scalable Linear Recording"; discSubType = "SLR3"; + break; case CommonTypes.MediaType.SLR32: discType = "Scalable Linear Recording"; discSubType = "SLR32"; + break; case CommonTypes.MediaType.SLR32SL: discType = "Scalable Linear Recording"; discSubType = "SLR32 SL"; + break; case CommonTypes.MediaType.SLR4: discType = "Scalable Linear Recording"; discSubType = "SLR4"; + break; case CommonTypes.MediaType.SLR5: discType = "Scalable Linear Recording"; discSubType = "SLR5"; + break; case CommonTypes.MediaType.SLR5SL: discType = "Scalable Linear Recording"; discSubType = "SLR5 SL"; + break; case CommonTypes.MediaType.SLR6: discType = "Scalable Linear Recording"; discSubType = "SLR6"; + break; case CommonTypes.MediaType.SLRtape7: discType = "Scalable Linear Recording"; discSubType = "SLRtape7"; + break; case CommonTypes.MediaType.SLRtape7SL: discType = "Scalable Linear Recording"; discSubType = "SLRtape7 SL"; + break; case CommonTypes.MediaType.SLRtape24: discType = "Scalable Linear Recording"; discSubType = "SLRtape24"; + break; case CommonTypes.MediaType.SLRtape24SL: discType = "Scalable Linear Recording"; discSubType = "SLRtape24 SL"; + break; case CommonTypes.MediaType.SLRtape40: discType = "Scalable Linear Recording"; discSubType = "SLRtape40"; + break; case CommonTypes.MediaType.SLRtape50: discType = "Scalable Linear Recording"; discSubType = "SLRtape50"; + break; case CommonTypes.MediaType.SLRtape60: discType = "Scalable Linear Recording"; discSubType = "SLRtape60"; + break; case CommonTypes.MediaType.SLRtape75: discType = "Scalable Linear Recording"; discSubType = "SLRtape75"; + break; case CommonTypes.MediaType.SLRtape100: discType = "Scalable Linear Recording"; discSubType = "SLRtape100"; + break; case CommonTypes.MediaType.SLRtape140: discType = "Scalable Linear Recording"; discSubType = "SLRtape140"; + break; case CommonTypes.MediaType.QIC11: discType = "Quarter-inch cartridge"; discSubType = "QIC-11"; + break; case CommonTypes.MediaType.QIC24: discType = "Quarter-inch cartridge"; discSubType = "QIC-24"; + break; case CommonTypes.MediaType.QIC40: discType = "Quarter-inch mini cartridge"; discSubType = "QIC-40"; + break; case CommonTypes.MediaType.QIC80: discType = "Quarter-inch mini cartridge"; discSubType = "QIC-80"; + break; case CommonTypes.MediaType.QIC120: discType = "Quarter-inch cartridge"; discSubType = "QIC-120"; + break; case CommonTypes.MediaType.QIC150: discType = "Quarter-inch cartridge"; discSubType = "QIC-150"; + break; case CommonTypes.MediaType.QIC320: discType = "Quarter-inch cartridge"; discSubType = "QIC-320"; + break; case CommonTypes.MediaType.QIC525: discType = "Quarter-inch cartridge"; discSubType = "QIC-525"; + break; case CommonTypes.MediaType.QIC1350: discType = "Quarter-inch cartridge"; discSubType = "QIC-1350"; + break; case CommonTypes.MediaType.QIC3010: discType = "Quarter-inch cartridge"; discSubType = "QIC-3010"; + break; case CommonTypes.MediaType.QIC3020: discType = "Quarter-inch cartridge"; discSubType = "QIC-3020"; + break; case CommonTypes.MediaType.QIC3080: discType = "Quarter-inch cartridge"; discSubType = "QIC-3080"; + break; case CommonTypes.MediaType.QIC3095: discType = "Quarter-inch cartridge"; discSubType = "QIC-3095"; + break; case CommonTypes.MediaType.Travan: discType = "Travan"; discSubType = "TR-1"; + break; case CommonTypes.MediaType.Travan1Ex: discType = "Travan"; discSubType = "TR-1 Ex"; + break; case CommonTypes.MediaType.Travan3: discType = "Travan"; discSubType = "TR-3"; + break; case CommonTypes.MediaType.Travan3Ex: discType = "Travan"; discSubType = "TR-3 Ex"; + break; case CommonTypes.MediaType.Travan4: discType = "Travan"; discSubType = "TR-4"; + break; case CommonTypes.MediaType.Travan5: discType = "Travan"; discSubType = "TR-5"; + break; case CommonTypes.MediaType.Travan7: discType = "Travan"; discSubType = "TR-7"; + break; case CommonTypes.MediaType.VXA1: discType = "VXA"; discSubType = "VXA-1"; + break; case CommonTypes.MediaType.VXA2: discType = "VXA"; discSubType = "VXA-2"; + break; case CommonTypes.MediaType.VXA3: discType = "VXA"; discSubType = "VXA-3"; + break; case CommonTypes.MediaType.ECMA_153: case CommonTypes.MediaType.ECMA_153_512: discType = "5.25\" magneto-optical"; discSubType = "ECMA-153"; + break; case CommonTypes.MediaType.ECMA_189: discType = "300mm magneto optical"; discSubType = "ECMA-189"; + break; case CommonTypes.MediaType.ECMA_190: discType = "300mm magneto optical"; discSubType = "ECMA-190"; + break; case CommonTypes.MediaType.ECMA_195: case CommonTypes.MediaType.ECMA_195_512: discType = "5.25\" magneto-optical"; discSubType = "ECMA-195"; + break; case CommonTypes.MediaType.ECMA_223: case CommonTypes.MediaType.ECMA_223_512: discType = "3.5\" magneto-optical"; discSubType = "ECMA-223"; + break; case CommonTypes.MediaType.ECMA_238: discType = "5.25\" magneto-optical"; discSubType = "ECMA-238"; + break; case CommonTypes.MediaType.ECMA_239: discType = "3.5\" magneto-optical"; discSubType = "ECMA-239"; + break; case CommonTypes.MediaType.ECMA_280: discType = "5.25\" magneto-optical"; discSubType = "ECMA-280"; + break; case CommonTypes.MediaType.ECMA_317: discType = "300mm magneto optical"; discSubType = "ECMA-317"; + break; case CommonTypes.MediaType.ECMA_322: case CommonTypes.MediaType.ECMA_322_2k: discType = "5.25\" magneto-optical"; discSubType = "ECMA-322"; + break; case CommonTypes.MediaType.GigaMo: discType = "3.5\" magneto-optical"; discSubType = "GIGAMO"; + break; case CommonTypes.MediaType.GigaMo2: discType = "3.5\" magneto-optical"; discSubType = "2.3GB GIGAMO"; + break; case CommonTypes.MediaType.UnknownMO: discType = "Magneto-optical"; discSubType = "Unknown"; + break; case CommonTypes.MediaType.Floptical: discType = "Floptical"; discSubType = "Floptical"; + break; case CommonTypes.MediaType.HiFD: discType = "HiFD"; discSubType = "HiFD"; + break; case CommonTypes.MediaType.LS120: discType = "SuperDisk"; discSubType = "LS-120"; + break; case CommonTypes.MediaType.LS240: discType = "SuperDisk"; discSubType = "LS-240"; + break; case CommonTypes.MediaType.FD32MB: discType = "3.5\" floppy"; discSubType = "FD32MB"; + break; case CommonTypes.MediaType.UHD144: discType = "UHD144"; discSubType = "UHD144"; + break; case CommonTypes.MediaType.VCDHD: discType = "VCDHD"; discSubType = "VCDHD"; + break; case CommonTypes.MediaType.HuCard: discType = "HuCard"; discSubType = "HuCard"; + break; case CommonTypes.MediaType.CompactCassette: discType = "Compact Cassette"; discSubType = "Compact Cassette"; + break; case CommonTypes.MediaType.Dcas25: discType = "Compact Cassette"; discSubType = "D/CAS-25"; + break; case CommonTypes.MediaType.Dcas85: discType = "Compact Cassette"; discSubType = "D/CAS-85"; + break; case CommonTypes.MediaType.Dcas103: discType = "Compact Cassette"; discSubType = "D/CAS-103"; + break; case CommonTypes.MediaType.PCCardTypeI: discType = "PCMCIA Card"; discSubType = "PC-Card Type I"; + break; case CommonTypes.MediaType.PCCardTypeII: discType = "PCMCIA Card"; discSubType = "PC-Card Type II"; + break; case CommonTypes.MediaType.PCCardTypeIII: discType = "PCMCIA Card"; discSubType = "PC-Card Type III"; + break; case CommonTypes.MediaType.PCCardTypeIV: discType = "PCMCIA Card"; discSubType = "PC-Card Type IV"; + break; case CommonTypes.MediaType.ExpressCard34: discType = "Express Card"; discSubType = "Express Card (34mm)"; + break; case CommonTypes.MediaType.ExpressCard54: discType = "Express Card"; discSubType = "Express Card (54mm)"; + break; case CommonTypes.MediaType.FamicomGamePak: discType = "Nintendo Famicom Game Pak"; discSubType = "Nintendo Famicom Game Pak"; + break; case CommonTypes.MediaType.GameBoyAdvanceGamePak: discType = "Nintendo Game Boy Advance Game Pak"; discSubType = "Nintendo Game Boy Advance Game Pak"; + break; case CommonTypes.MediaType.GameBoyGamePak: discType = "Nintendo Game Boy Game Pak"; discSubType = "Nintendo Game Boy Game Pak"; + break; case CommonTypes.MediaType.N64DD: discType = "Nintendo 64 Disk"; discSubType = "Nintendo 64 Disk"; + break; case CommonTypes.MediaType.N64GamePak: discType = "Nintendo 64 Game Pak"; discSubType = "Nintendo 64 Game Pak"; + break; case CommonTypes.MediaType.NESGamePak: discType = "Nintendo Entertainment System Game Pak"; discSubType = "Nintendo Entertainment System Game Pak"; + break; case CommonTypes.MediaType.Nintendo3DSGameCard: discType = "Nintendo 3DS Game Card"; discSubType = "Nintendo 3DS Game Card"; + break; case CommonTypes.MediaType.NintendoDiskCard: discType = "Nintendo Disk Card"; discSubType = "Nintendo Disk Card"; + break; case CommonTypes.MediaType.NintendoDSGameCard: discType = "Nintendo DS Game Card"; discSubType = "Nintendo DS Game Card"; + break; case CommonTypes.MediaType.NintendoDSiGameCard: discType = "Nintendo DSi Game Card"; discSubType = "Nintendo DSi Game Card"; + break; case CommonTypes.MediaType.SNESGamePak: discType = "Super Nintendo Game Pak"; discSubType = "Super Nintendo Game Pak"; + break; case CommonTypes.MediaType.SNESGamePakUS: discType = "Super Nintendo Game Pak (US)"; discSubType = "Super Nintendo Game Pak (US)"; + break; case CommonTypes.MediaType.SwitchGameCard: discType = "Nintendo Switch Game Card"; discSubType = "Nintendo Switch Game Card"; + break; case CommonTypes.MediaType.IBM3470: discType = "IBM 3470"; discSubType = "IBM 3470"; + break; case CommonTypes.MediaType.IBM3480: discType = "IBM 3480"; discSubType = "IBM 3480"; + break; case CommonTypes.MediaType.IBM3490: discType = "IBM 3490"; discSubType = "IBM 3490"; + break; case CommonTypes.MediaType.IBM3490E: discType = "IBM 3490E"; discSubType = "IBM 3490E"; + break; case CommonTypes.MediaType.IBM3592: discType = "IBM 3592"; discSubType = "IBM 3592"; + break; case CommonTypes.MediaType.STK4480: discType = "STK 4480"; discSubType = "STK 4480"; + break; case CommonTypes.MediaType.STK4490: discType = "STK 4490"; discSubType = "STK 4490"; + break; case CommonTypes.MediaType.STK9490: discType = "STK 9490"; discSubType = "STK 9490"; + break; case CommonTypes.MediaType.T9840A: discType = "STK T-9840"; discSubType = "STK T-9840A"; + break; case CommonTypes.MediaType.T9840B: discType = "STK T-9840"; discSubType = "STK T-9840B"; + break; case CommonTypes.MediaType.T9840C: discType = "STK T-9840"; discSubType = "STK T-9840C"; + break; case CommonTypes.MediaType.T9840D: discType = "STK T-9840"; discSubType = "STK T-9840D"; + break; case CommonTypes.MediaType.T9940A: discType = "STK T-9940"; discSubType = "STK T-9940A"; + break; case CommonTypes.MediaType.T9940B: discType = "STK T-9840"; discSubType = "STK T-9840B"; + break; case CommonTypes.MediaType.T10000A: discType = "STK T-10000"; discSubType = "STK T-10000A"; + break; case CommonTypes.MediaType.T10000B: discType = "STK T-10000"; discSubType = "STK T-10000B"; + break; case CommonTypes.MediaType.T10000C: discType = "STK T-10000"; discSubType = "STK T-10000C"; + break; case CommonTypes.MediaType.T10000D: discType = "STK T-10000"; discSubType = "STK T-10000D"; + break; case CommonTypes.MediaType.DemiDiskette: discType = "DemiDiskette"; discSubType = "DemiDiskette"; + break; case CommonTypes.MediaType.QuickDisk: discType = "QuickDisk"; discSubType = "QuickDisk"; + break; case CommonTypes.MediaType.VideoFloppy: discType = "VideoFloppy"; discSubType = "VideoFloppy"; + break; case CommonTypes.MediaType.Wafer: discType = "Wafer"; discSubType = "Wafer"; + break; case CommonTypes.MediaType.ZXMicrodrive: discType = "ZX Microdrive"; discSubType = "ZX Microdrive"; + break; case CommonTypes.MediaType.BeeCard: discType = "BeeCard"; discSubType = "BeeCard"; + break; case CommonTypes.MediaType.Borsu: discType = "Borsu"; discSubType = "Borsu"; + break; case CommonTypes.MediaType.DataStore: discType = "DataStore"; discSubType = "DataStore"; + break; case CommonTypes.MediaType.DIR: discType = "DIR"; discSubType = "DIR"; + break; case CommonTypes.MediaType.DST: discType = "DST"; discSubType = "DST"; + break; case CommonTypes.MediaType.DTF: discType = "DTF"; discSubType = "DTF"; + break; case CommonTypes.MediaType.DTF2: discType = "DTF2"; discSubType = "DTF2"; + break; case CommonTypes.MediaType.Flextra3020: discType = "Flextra"; discSubType = "Flextra 3020"; + break; case CommonTypes.MediaType.Flextra3225: discType = "Flextra"; discSubType = "Flextra 3225"; + break; case CommonTypes.MediaType.HiTC1: discType = "HiTC"; discSubType = "HiTC1"; + break; case CommonTypes.MediaType.HiTC2: discType = "HiTC"; discSubType = "HiTC2"; + break; case CommonTypes.MediaType.LT1: discType = "LT1"; discSubType = "LT1"; + break; case CommonTypes.MediaType.MiniCard: discType = "MiniCard"; discSubType = "MiniCard"; + break; case CommonTypes.MediaType.Orb: discType = "Orb"; discSubType = "Orb"; + break; case CommonTypes.MediaType.Orb5: discType = "Orb"; discSubType = "Orb5"; + break; case CommonTypes.MediaType.SmartMedia: discType = "SmartMedia"; discSubType = "SmartMedia"; + break; case CommonTypes.MediaType.xD: discType = "xD"; discSubType = "xD"; + break; case CommonTypes.MediaType.XQD: discType = "XQD"; discSubType = "XQD"; + break; case CommonTypes.MediaType.DataPlay: discType = "DataPlay"; discSubType = "DataPlay"; + break; case CommonTypes.MediaType.PD650: discType = "PD650"; discSubType = "PD650"; + break; case CommonTypes.MediaType.PD650_WORM: discType = "PD650"; discSubType = "PD650 (WORM)"; + break; case CommonTypes.MediaType.RA60: discType = "Hard Disk Drive"; discSubType = "DEC RA-60"; + break; case CommonTypes.MediaType.RA80: discType = "Hard Disk Drive"; discSubType = "DEC RA-80"; + break; case CommonTypes.MediaType.RA81: discType = "Hard Disk Drive"; discSubType = "DEC RA-81"; + break; case CommonTypes.MediaType.RC25: discType = "Hard Disk Drive"; discSubType = "DEC RC-25"; + break; case CommonTypes.MediaType.RD31: discType = "Hard Disk Drive"; discSubType = "DEC RD-31"; + break; case CommonTypes.MediaType.RD32: discType = "Hard Disk Drive"; discSubType = "DEC RD-32"; + break; case CommonTypes.MediaType.RD51: discType = "Hard Disk Drive"; discSubType = "DEC RD-51"; + break; case CommonTypes.MediaType.RD52: discType = "Hard Disk Drive"; discSubType = "DEC RD-52"; + break; case CommonTypes.MediaType.RD53: discType = "Hard Disk Drive"; discSubType = "DEC RD-53"; + break; case CommonTypes.MediaType.RD54: discType = "Hard Disk Drive"; discSubType = "DEC RD-54"; + break; case CommonTypes.MediaType.RK06: case CommonTypes.MediaType.RK06_18: discType = "Hard Disk Drive"; discSubType = "DEC RK-06"; + break; case CommonTypes.MediaType.RK07: case CommonTypes.MediaType.RK07_18: discType = "Hard Disk Drive"; discSubType = "DEC RK-07"; + break; case CommonTypes.MediaType.RM02: discType = "Hard Disk Drive"; discSubType = "DEC RM-02"; + break; case CommonTypes.MediaType.RM03: discType = "Hard Disk Drive"; discSubType = "DEC RM-03"; + break; case CommonTypes.MediaType.RM05: discType = "Hard Disk Drive"; discSubType = "DEC RM-05"; + break; case CommonTypes.MediaType.RP02: case CommonTypes.MediaType.RP02_18: discType = "Hard Disk Drive"; discSubType = "DEC RP-02"; + break; case CommonTypes.MediaType.RP03: case CommonTypes.MediaType.RP03_18: discType = "Hard Disk Drive"; discSubType = "DEC RP-03"; + break; case CommonTypes.MediaType.RP04: case CommonTypes.MediaType.RP04_18: discType = "Hard Disk Drive"; discSubType = "DEC RP-04"; + break; case CommonTypes.MediaType.RP05: case CommonTypes.MediaType.RP05_18: discType = "Hard Disk Drive"; discSubType = "DEC RP-05"; + break; case CommonTypes.MediaType.RP06: case CommonTypes.MediaType.RP06_18: discType = "Hard Disk Drive"; discSubType = "DEC RP-06"; + break; case CommonTypes.MediaType.RDX: discType = "RDX"; discSubType = "RDX"; + break; case CommonTypes.MediaType.RDX320: discType = "RDX"; discSubType = "RDX 320"; + break; case CommonTypes.MediaType.Zone_HDD: discType = "Zoned Hard Disk Drive"; discSubType = "Unknown"; + break; case CommonTypes.MediaType.Microdrive: discType = "Hard Disk Drive"; discSubType = "Microdrive"; + break; case CommonTypes.MediaType.VideoNow: discType = "VideoNow"; discSubType = "VideoNow"; + break; case CommonTypes.MediaType.VideoNowColor: discType = "VideoNow"; discSubType = "VideoNow Color"; + break; case CommonTypes.MediaType.VideoNowXp: discType = "VideoNow"; discSubType = "VideoNow XP"; + break; default: discType = "Unknown"; discSubType = "Unknown"; + break; } } diff --git a/Metadata/Resume.cs b/Metadata/Resume.cs index 356da46..239fef9 100644 --- a/Metadata/Resume.cs +++ b/Metadata/Resume.cs @@ -43,8 +43,7 @@ using Schemas; namespace DiscImageChef.CommonTypes.Metadata { - [Serializable] - [XmlRoot("DicResume", Namespace = "", IsNullable = false)] + [Serializable, XmlRoot("DicResume", Namespace = "", IsNullable = false)] public class Resume { [XmlElement(DataType = "dateTime")] diff --git a/Metadata/Version.cs b/Metadata/Version.cs index 0284f60..c513eab 100644 --- a/Metadata/Version.cs +++ b/Metadata/Version.cs @@ -43,16 +43,12 @@ namespace DiscImageChef.CommonTypes.Metadata { public static class Version { - /// - /// Gets XML software type for the running version - /// + /// Gets XML software type for the running version /// XML software type - public static SoftwareType GetSoftwareType() => - new SoftwareType - { - Name = "DiscImageChef", - OperatingSystem = DetectOS.GetRealPlatformID().ToString(), - Version = typeof(Version).Assembly.GetName().Version.ToString() - }; + public static SoftwareType GetSoftwareType() => new SoftwareType + { + Name = "DiscImageChef", OperatingSystem = DetectOS.GetRealPlatformID().ToString(), + Version = typeof(Version).Assembly.GetName().Version.ToString() + }; } } \ No newline at end of file diff --git a/Partition.cs b/Partition.cs index f933081..0e771be 100644 --- a/Partition.cs +++ b/Partition.cs @@ -40,9 +40,7 @@ using System; namespace DiscImageChef.CommonTypes { - /// - /// Partition structure. - /// + /// Partition structure. public struct Partition : IEquatable, IComparable { /// Partition number, 0-started @@ -66,9 +64,7 @@ namespace DiscImageChef.CommonTypes /// Name of partition scheme that contains this partition public string Scheme; - /// - /// Compares two partitions - /// + /// Compares two partitions /// Partition to compare with /// 0 if both partitions start and end at the same sector public bool Equals(Partition other) => Start == other.Start && Length == other.Length; @@ -78,18 +74,22 @@ namespace DiscImageChef.CommonTypes public override int GetHashCode() => Start.GetHashCode() + End.GetHashCode(); /// - /// Compares this partition with another and returns an integer that indicates whether the current partition precedes, - /// follows, or is in the same place as the other partition. + /// Compares this partition with another and returns an integer that indicates whether the current partition + /// precedes, follows, or is in the same place as the other partition. /// /// Partition to compare with /// A value that indicates the relative equality of the partitions being compared. public int CompareTo(Partition other) { - if(Start == other.Start && End == other.End) return 0; + if(Start == other.Start && + End == other.End) + return 0; - if(Start > other.Start || End > other.End) return 1; + if(Start > other.Start || + End > other.End) + return 1; - return -1; + return-1; } // Define the equality operator. diff --git a/PluginBase.cs b/PluginBase.cs index 264e260..6953d35 100644 --- a/PluginBase.cs +++ b/PluginBase.cs @@ -44,51 +44,29 @@ using DiscImageChef.Partitions; namespace DiscImageChef.CommonTypes { - /// - /// Contain all plugins (filesystem, partition and image) - /// + /// Contain all plugins (filesystem, partition and image) public class PluginBase { - /// - /// List of checksum plugins - /// + /// List of checksum plugins public readonly List Checksums; - /// - /// List of filter plugins - /// + /// List of filter plugins public readonly SortedDictionary Filters; - /// - /// List of floppy image plugins - /// + /// List of floppy image plugins public readonly SortedDictionary FloppyImages; - /// - /// List of all media image plugins - /// + /// List of all media image plugins public readonly SortedDictionary ImagePluginsList; - /// - /// List of all partition plugins - /// + /// List of all partition plugins public readonly SortedDictionary PartPluginsList; - /// - /// List of all filesystem plugins - /// + /// List of all filesystem plugins public readonly SortedDictionary PluginsList; - /// - /// List of read-only filesystem plugins - /// + /// List of read-only filesystem plugins public readonly SortedDictionary ReadOnlyFilesystems; - /// - /// List of writable floppy image plugins - /// + /// List of writable floppy image plugins public readonly SortedDictionary WritableFloppyImages; - /// - /// List of writable media image plugins - /// + /// List of writable media image plugins public readonly SortedDictionary WritableImages; - /// - /// Initializes the plugins lists - /// + /// Initializes the plugins lists public PluginBase() { PluginsList = new SortedDictionary(); @@ -105,46 +83,55 @@ namespace DiscImageChef.CommonTypes public void AddPlugins(IPluginRegister pluginRegister) { foreach(Type type in pluginRegister.GetAllChecksumPlugins() ?? Enumerable.Empty()) - if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { }) is IChecksum plugin) + if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] + { }) is IChecksum plugin) Checksums.Add(plugin); foreach(Type type in pluginRegister.GetAllFilesystemPlugins() ?? Enumerable.Empty()) - if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { }) is IFilesystem plugin && + if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] + { }) is IFilesystem plugin && !PluginsList.ContainsKey(plugin.Name.ToLower())) PluginsList.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllFilterPlugins() ?? Enumerable.Empty()) - if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { }) is IFilter plugin && + if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] + { }) is IFilter plugin && !Filters.ContainsKey(plugin.Name.ToLower())) Filters.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllFloppyImagePlugins() ?? Enumerable.Empty()) - if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { }) is IFloppyImage plugin && + if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] + { }) is IFloppyImage plugin && !FloppyImages.ContainsKey(plugin.Name.ToLower())) FloppyImages.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllMediaImagePlugins() ?? Enumerable.Empty()) - if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { }) is IMediaImage plugin && + if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] + { }) is IMediaImage plugin && !ImagePluginsList.ContainsKey(plugin.Name.ToLower())) ImagePluginsList.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllPartitionPlugins() ?? Enumerable.Empty()) - if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { }) is IPartition plugin && + if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] + { }) is IPartition plugin && !PartPluginsList.ContainsKey(plugin.Name.ToLower())) PartPluginsList.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllReadOnlyFilesystemPlugins() ?? Enumerable.Empty()) - if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { }) is IReadOnlyFilesystem plugin && + if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] + { }) is IReadOnlyFilesystem plugin && !ReadOnlyFilesystems.ContainsKey(plugin.Name.ToLower())) ReadOnlyFilesystems.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllWritableFloppyImagePlugins() ?? Enumerable.Empty()) - if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { }) is IWritableFloppyImage plugin && + if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] + { }) is IWritableFloppyImage plugin && !WritableFloppyImages.ContainsKey(plugin.Name.ToLower())) WritableFloppyImages.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllWritableImagePlugins() ?? Enumerable.Empty()) - if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { }) is IWritableImage plugin && + if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] + { }) is IWritableImage plugin && !WritableImages.ContainsKey(plugin.Name.ToLower())) WritableImages.Add(plugin.Name.ToLower(), plugin); } diff --git a/Structs/Filesystems.cs b/Structs/Filesystems.cs index f85c274..a67c8c1 100644 --- a/Structs/Filesystems.cs +++ b/Structs/Filesystems.cs @@ -42,119 +42,72 @@ using System.Runtime.InteropServices; namespace DiscImageChef.CommonTypes.Structs { - /// - /// File attributes. - /// + /// File attributes. [Flags] public enum FileAttributes : ulong { /// File has no attributes - None = 0, - /// File is an alias (Mac OS) - Alias = 0x01, - /// Indicates that the file can only be writable appended - AppendOnly = 0x02, - /// File is candidate for archival/backup - Archive = 0x04, - /// File is a block device - BlockDevice = 0x08, - /// File is stored on filesystem block units instead of device sectors - BlockUnits = 0x10, - /// Directory is a bundle or file contains a BNDL resource - Bundle = 0x20, - /// File is a char device - CharDevice = 0x40, - /// File is compressed - Compressed = 0x80, - /// File is compressed and should not be uncompressed on read - CompressedRaw = 0x100, - /// File has compression errors - CompressionError = 0x200, - /// Compressed file is dirty - CompressionDirty = 0x400, - /// File is a device - Device = 0x800, - /// File is a directory - Directory = 0x1000, - /// File is encrypted - Encrypted = 0x2000, - /// File is stored on disk using extents - Extents = 0x4000, - /// File is a FIFO - FIFO = 0x8000, - /// File is a normal file + None = 0, /// File is an alias (Mac OS) + Alias = 0x01, /// Indicates that the file can only be writable appended + AppendOnly = 0x02, /// File is candidate for archival/backup + Archive = 0x04, /// File is a block device + BlockDevice = 0x08, /// File is stored on filesystem block units instead of device sectors + BlockUnits = 0x10, /// Directory is a bundle or file contains a BNDL resource + Bundle = 0x20, /// File is a char device + CharDevice = 0x40, /// File is compressed + Compressed = 0x80, /// File is compressed and should not be uncompressed on read + CompressedRaw = 0x100, /// File has compression errors + CompressionError = 0x200, /// Compressed file is dirty + CompressionDirty = 0x400, /// File is a device + Device = 0x800, /// File is a directory + Directory = 0x1000, /// File is encrypted + Encrypted = 0x2000, /// File is stored on disk using extents + Extents = 0x4000, /// File is a FIFO + FIFO = 0x8000, /// File is a normal file File = 0x10000, /// File is a Mac OS file containing desktop databases that has already been added to the desktop database - HasBeenInited = 0x20000, - /// File contains an icon resource / EA + HasBeenInited = 0x20000, /// File contains an icon resource / EA HasCustomIcon = 0x40000, /// File is a Mac OS extension or control panel lacking INIT resources - HasNoINITs = 0x80000, - /// File is hidden/invisible - Hidden = 0x100000, - /// File cannot be written, deleted, modified or linked to - Immutable = 0x200000, - /// Directory is indexed using hashed trees - IndexedDirectory = 0x400000, - /// File contents are stored alongside its inode (or equivalent) - Inline = 0x800000, - /// File contains integrity checks - IntegrityStream = 0x1000000, - /// File is on desktop + HasNoINITs = 0x80000, /// File is hidden/invisible + Hidden = 0x100000, /// File cannot be written, deleted, modified or linked to + Immutable = 0x200000, /// Directory is indexed using hashed trees + IndexedDirectory = 0x400000, /// File contents are stored alongside its inode (or equivalent) + Inline = 0x800000, /// File contains integrity checks + IntegrityStream = 0x1000000, /// File is on desktop IsOnDesk = 0x2000000, /// File changes are written to filesystem journal before being written to file itself - Journaled = 0x4000000, - /// Access time will not be modified - NoAccessTime = 0x8000000, - /// File will not be subject to copy-on-write - NoCopyOnWrite = 0x10000000, - /// File will not be backed up - NoDump = 0x20000000, - /// File contents should not be scrubbed - NoScrub = 0x40000000, - /// File contents should not be indexed - NotIndexed = 0x80000000, - /// File is offline - Offline = 0x100000000, - /// File is password protected, but contents are not encrypted on disk - Password = 0x200000000, - /// File is read-only - ReadOnly = 0x400000000, - /// File is a reparse point + Journaled = 0x4000000, /// Access time will not be modified + NoAccessTime = 0x8000000, /// File will not be subject to copy-on-write + NoCopyOnWrite = 0x10000000, /// File will not be backed up + NoDump = 0x20000000, /// File contents should not be scrubbed + NoScrub = 0x40000000, /// File contents should not be indexed + NotIndexed = 0x80000000, /// File is offline + Offline = 0x100000000, /// File is password protected, but contents are not encrypted on disk + Password = 0x200000000, /// File is read-only + ReadOnly = 0x400000000, /// File is a reparse point ReparsePoint = 0x800000000, /// When file is removed its content will be overwritten with zeroes - Secured = 0x1000000000, - /// File contents are sparse - Sparse = 0x2000000000, - /// File is a shadow (OS/2) - Shadow = 0x4000000000, - /// File is shared - Shared = 0x8000000000, - /// File is a stationery - Stationery = 0x10000000000, - /// File is a symbolic link - Symlink = 0x20000000000, - /// File writes are synchronously written to disk - Sync = 0x40000000000, - /// File belongs to the operating system + Secured = 0x1000000000, /// File contents are sparse + Sparse = 0x2000000000, /// File is a shadow (OS/2) + Shadow = 0x4000000000, /// File is shared + Shared = 0x8000000000, /// File is a stationery + Stationery = 0x10000000000, /// File is a symbolic link + Symlink = 0x20000000000, /// File writes are synchronously written to disk + Sync = 0x40000000000, /// File belongs to the operating system System = 0x80000000000, /// If file end is a partial block its content will be merged with other files - TailMerged = 0x100000000000, - /// File is temporary + TailMerged = 0x100000000000, /// File is temporary Temporary = 0x200000000000, /// Subdirectories inside of this directory are not related and should be allocated elsewhere TopDirectory = 0x400000000000, /// If file is deleted, contents should be stored, for a possible future undeletion - Undeletable = 0x800000000000, - /// File is a pipe - Pipe = 0x1000000000000, - /// File is a socket + Undeletable = 0x800000000000, /// File is a pipe + Pipe = 0x1000000000000, /// File is a socket Socket = 0x2000000000000 } - /// - /// Information about a file entry - /// + /// Information about a file entry public class FileEntryInfo { /// File attributes @@ -194,24 +147,28 @@ namespace DiscImageChef.CommonTypes.Structs get => CreationTimeUtc?.ToLocalTime(); set => CreationTimeUtc = value?.ToUniversalTime(); } + /// File last access date. Null if the underlying filesystem does not support them. public DateTime? AccessTime { get => AccessTimeUtc?.ToLocalTime(); set => AccessTimeUtc = value?.ToUniversalTime(); } + /// File attributes change date. Null if the underlying filesystem does not support them. public DateTime? StatusChangeTime { get => StatusChangeTimeUtc?.ToLocalTime(); set => StatusChangeTimeUtc = value?.ToUniversalTime(); } + /// File last backup date. Null if the underlying filesystem does not support them. public DateTime? BackupTime { get => BackupTimeUtc?.ToLocalTime(); set => BackupTimeUtc = value?.ToUniversalTime(); } + /// File last modification date. Null if the underlying filesystem does not support them. public DateTime? LastWriteTime { @@ -239,10 +196,7 @@ namespace DiscImageChef.CommonTypes.Structs /// Filesystem type public string Type; - public FileSystemInfo() - { - Id = new FileSystemId(); - } + public FileSystemInfo() => Id = new FileSystemId(); public FileSystemInfo ShallowCopy() => (FileSystemInfo)MemberwiseClone(); } @@ -265,72 +219,40 @@ namespace DiscImageChef.CommonTypes.Structs public Guid uuid; } - /// - /// Errors - /// + /// Errors public enum Errno { /// No error happened - NoError = 0, - /// Access denied - AccessDenied = -13, - /// Busy, cannot complete - Busy = -16, - /// File is too large - FileTooLarge = -27, - /// Invalid argument - InvalidArgument = -22, - /// I/O error - InOutError = -5, - /// Is a directory (e.g.: trying to Read() a dir) - IsDirectory = -21, - /// Name is too long - NameTooLong = -36, - /// There is no data available - NoData = 61, - /// There is no such attribute - NoSuchExtendedAttribute = NoData, - /// No such device - NoSuchDevice = -19, - /// No such file or directory - NoSuchFile = -2, - /// Is not a directory (e.g.: trying to ReadDir() a file) - NotDirectory = -20, - /// Not implemented - NotImplemented = -38, - /// Not supported - NotSupported = -252, - /// Link is severed - SeveredLink = -67, - /// Access denied - EACCES = AccessDenied, - /// Busy, cannot complete - EBUSY = Busy, - /// File is too large - EFBIG = FileTooLarge, - /// Invalid argument - EINVAL = InvalidArgument, - /// I/O error - EIO = InOutError, - /// Is a directory (e.g.: trying to Read() a dir) - EISDIR = IsDirectory, - /// Name is too long - ENAMETOOLONG = NameTooLong, - /// There is no such attribute - ENOATTR = NoSuchExtendedAttribute, - /// There is no data available - ENODATA = NoData, - /// No such device - ENODEV = NoSuchDevice, - /// No such file or directory - ENOENT = NoSuchFile, - /// Link is severed - ENOLINK = SeveredLink, - /// Not implemented - ENOSYS = NotImplemented, - /// Is not a directory (e.g.: trying to ReadDir() a file) - ENOTDIR = NotDirectory, - /// Not supported + NoError = 0, /// Access denied + AccessDenied = -13, /// Busy, cannot complete + Busy = -16, /// File is too large + FileTooLarge = -27, /// Invalid argument + InvalidArgument = -22, /// I/O error + InOutError = -5, /// Is a directory (e.g.: trying to Read() a dir) + IsDirectory = -21, /// Name is too long + NameTooLong = -36, /// There is no data available + NoData = 61, /// There is no such attribute + NoSuchExtendedAttribute = NoData, /// No such device + NoSuchDevice = -19, /// No such file or directory + NoSuchFile = -2, /// Is not a directory (e.g.: trying to ReadDir() a file) + NotDirectory = -20, /// Not implemented + NotImplemented = -38, /// Not supported + NotSupported = -252, /// Link is severed + SeveredLink = -67, /// Access denied + EACCES = AccessDenied, /// Busy, cannot complete + EBUSY = Busy, /// File is too large + EFBIG = FileTooLarge, /// Invalid argument + EINVAL = InvalidArgument, /// I/O error + EIO = InOutError, /// Is a directory (e.g.: trying to Read() a dir) + EISDIR = IsDirectory, /// Name is too long + ENAMETOOLONG = NameTooLong, /// There is no such attribute + ENOATTR = NoSuchExtendedAttribute, /// There is no data available + ENODATA = NoData, /// No such device + ENODEV = NoSuchDevice, /// No such file or directory + ENOENT = NoSuchFile, /// Link is severed + ENOLINK = SeveredLink, /// Not implemented + ENOSYS = NotImplemented, /// Is not a directory (e.g.: trying to ReadDir() a file) + ENOTDIR = NotDirectory, /// Not supported ENOTSUP = NotSupported } } \ No newline at end of file diff --git a/Structs/Images.cs b/Structs/Images.cs index 27c5651..135ad59 100644 --- a/Structs/Images.cs +++ b/Structs/Images.cs @@ -43,9 +43,7 @@ using DiscImageChef.CommonTypes.Interfaces; namespace DiscImageChef.CommonTypes.Structs { - /// - /// Contains information about a dump image and its contents - /// + /// Contains information about a dump image and its contents public struct ImageInfo { /// Image contains partitions (or tracks for optical media) @@ -104,6 +102,7 @@ namespace DiscImageChef.CommonTypes.Structs public string DriveFirmwareRevision; /// Type of the media represented by the image to use in XML sidecars public XmlMediaType XmlMediaType; + // CHS geometry... /// Cylinders of the media represented by the image public uint Cylinders; @@ -113,9 +112,7 @@ namespace DiscImageChef.CommonTypes.Structs public uint SectorsPerTrack; } - /// - /// Session defining structure. - /// + /// Session defining structure. public struct Session { /// Session number, 1-started @@ -130,9 +127,7 @@ namespace DiscImageChef.CommonTypes.Structs public ulong EndSector; } - /// - /// Track defining structure. - /// + /// Track defining structure. public struct Track { /// Track number, 1-started @@ -173,9 +168,7 @@ namespace DiscImageChef.CommonTypes.Structs public TrackSubchannelType TrackSubchannelType; } - /// - /// Floppy physical characteristics structure. - /// + /// Floppy physical characteristics structure. public struct FloppyInfo { /// Physical floppy type. diff --git a/Structs/TapeFile.cs b/Structs/TapeFile.cs index 18d289a..7f424fd 100644 --- a/Structs/TapeFile.cs +++ b/Structs/TapeFile.cs @@ -35,25 +35,18 @@ // ---------------------------------------------------------------------------- // Copyright © 2011-2019 Natalia Portillo // ****************************************************************************/ + namespace DiscImageChef.CommonTypes.Structs { public struct TapeFile { - /// - /// File number - /// + /// File number public uint File; - /// - /// Partition number - /// + /// Partition number public byte Partition; - /// - /// First block, inclusive, of the file - /// + /// First block, inclusive, of the file public ulong FirstBlock; - /// - /// Last block, inclusive, of the file - /// + /// Last block, inclusive, of the file public ulong LastBlock; } } \ No newline at end of file diff --git a/Structs/TapePartition.cs b/Structs/TapePartition.cs index a0de793..cf583d5 100644 --- a/Structs/TapePartition.cs +++ b/Structs/TapePartition.cs @@ -40,17 +40,11 @@ namespace DiscImageChef.CommonTypes.Structs { public struct TapePartition { - /// - /// Partition number - /// + /// Partition number public byte Number; - /// - /// First block, inclusive, of the partition - /// + /// First block, inclusive, of the partition public ulong FirstBlock; - /// - /// Last block, inclusive, of the partition - /// + /// Last block, inclusive, of the partition public ulong LastBlock; } } \ No newline at end of file