From e6f6ace80bc7220114d4c8a68ee5764d7cfb6213 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 19 Dec 2017 20:33:03 +0000 Subject: [PATCH] REFACTOR: Reformat code. --- DiscImageChef.Checksums/Adler32Context.cs | 13 +- DiscImageChef.Checksums/CDChecksums.cs | 345 +- DiscImageChef.Checksums/CRC16Context.cs | 37 +- DiscImageChef.Checksums/CRC32Context.cs | 41 +- DiscImageChef.Checksums/CRC64Context.cs | 41 +- DiscImageChef.Checksums/FletcherContext.cs | 1 + DiscImageChef.Checksums/MD5Context.cs | 18 +- .../Properties/AssemblyInfo.cs | 3 +- DiscImageChef.Checksums/RIPEMD160Context.cs | 13 +- DiscImageChef.Checksums/ReedSolomon.cs | 172 +- DiscImageChef.Checksums/SHA1Context.cs | 13 +- DiscImageChef.Checksums/SHA256Context.cs | 13 +- DiscImageChef.Checksums/SHA384Context.cs | 13 +- DiscImageChef.Checksums/SHA512Context.cs | 13 +- DiscImageChef.Checksums/SpamSumContext.cs | 131 +- DiscImageChef.CommonTypes/MediaType.cs | 2 +- .../MediaTypeFromSCSI.cs | 2916 +- DiscImageChef.CommonTypes/Partition.cs | 20 +- .../Properties/AssemblyInfo.cs | 3 +- DiscImageChef.Console/DicConsole.cs | 70 +- .../Properties/AssemblyInfo.cs | 3 +- DiscImageChef.Core/Benchmark.cs | 270 +- DiscImageChef.Core/Checksum.cs | 60 +- DiscImageChef.Core/DataFile.cs | 21 +- DiscImageChef.Core/Delegates.cs | 15 +- DiscImageChef.Core/Devices/Dumping/ATA.cs | 162 +- .../Devices/Dumping/Alcohol120.cs | 81 +- .../Devices/Dumping/CompactDisc.cs | 281 +- DiscImageChef.Core/Devices/Dumping/MMC.cs | 150 +- DiscImageChef.Core/Devices/Dumping/NVMe.cs | 6 +- .../Devices/Dumping/ResumeSupport.cs | 50 +- DiscImageChef.Core/Devices/Dumping/SBC.cs | 283 +- DiscImageChef.Core/Devices/Dumping/SCSI.cs | 48 +- DiscImageChef.Core/Devices/Dumping/SSC.cs | 159 +- .../Devices/Dumping/SecureDigital.cs | 198 +- DiscImageChef.Core/Devices/Dumping/XGD.cs | 366 +- DiscImageChef.Core/Devices/Reader.cs | 95 +- DiscImageChef.Core/Devices/ReaderATA.cs | 86 +- DiscImageChef.Core/Devices/ReaderSCSI.cs | 221 +- DiscImageChef.Core/Devices/Report/ATA.cs | 488 +- DiscImageChef.Core/Devices/Report/ATAPI.cs | 8 +- DiscImageChef.Core/Devices/Report/FireWire.cs | 5 +- DiscImageChef.Core/Devices/Report/NVMe.cs | 5 +- DiscImageChef.Core/Devices/Report/PCMCIA.cs | 2 +- .../Devices/Report/SCSI/General.cs | 306 +- DiscImageChef.Core/Devices/Report/SCSI/MMC.cs | 1587 +- DiscImageChef.Core/Devices/Report/SCSI/SSC.cs | 93 +- .../Devices/Report/SecureDigital.cs | 36 +- DiscImageChef.Core/Devices/Report/USB.cs | 8 +- DiscImageChef.Core/Devices/Scanning/ATA.cs | 140 +- DiscImageChef.Core/Devices/Scanning/NVMe.cs | 2 +- DiscImageChef.Core/Devices/Scanning/SCSI.cs | 209 +- .../Devices/Scanning/ScanResults.cs | 2 +- .../Devices/Scanning/SecureDigital.cs | 92 +- DiscImageChef.Core/Filesystems.cs | 5 +- DiscImageChef.Core/ImageFormat.cs | 23 +- DiscImageChef.Core/Logging/DumpLog.cs | 17 +- DiscImageChef.Core/Logging/IBGLog.cs | 29 +- DiscImageChef.Core/Logging/MHDDLog.cs | 22 +- DiscImageChef.Core/Partitions.cs | 41 +- DiscImageChef.Core/PluginBase.cs | 29 +- DiscImageChef.Core/Properties/AssemblyInfo.cs | 2 +- DiscImageChef.Core/Remote.cs | 11 +- DiscImageChef.Core/Sidecar/AudioMedia.cs | 34 +- DiscImageChef.Core/Sidecar/BlockMedia.cs | 172 +- DiscImageChef.Core/Sidecar/BlockTape.cs | 97 +- DiscImageChef.Core/Sidecar/Events.cs | 17 +- DiscImageChef.Core/Sidecar/Helpers.cs | 2 +- DiscImageChef.Core/Sidecar/LinearMedia.cs | 29 +- DiscImageChef.Core/Sidecar/OpticalDisc.cs | 165 +- DiscImageChef.Core/Sidecar/Sidecar.cs | 5 +- DiscImageChef.Core/Statistics.cs | 165 +- DiscImageChef.Core/Version.cs | 2 +- DiscImageChef.Core/packages.config | 3 +- DiscImageChef.Decoders/ATA/Identify.cs | 671 +- DiscImageChef.Decoders/ATA/Registers.cs | 3 +- DiscImageChef.Decoders/Blu-ray/BCA.cs | 18 +- DiscImageChef.Decoders/Blu-ray/Cartridge.cs | 46 +- DiscImageChef.Decoders/Blu-ray/DDS.cs | 41 +- DiscImageChef.Decoders/Blu-ray/DI.cs | 75 +- DiscImageChef.Decoders/Blu-ray/Spare.cs | 22 +- DiscImageChef.Decoders/CD/ATIP.cs | 438 +- DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs | 202 +- DiscImageChef.Decoders/CD/Enums.cs | 3 +- DiscImageChef.Decoders/CD/FullTOC.cs | 616 +- DiscImageChef.Decoders/CD/PMA.cs | 99 +- DiscImageChef.Decoders/CD/Sector.cs | 296 +- DiscImageChef.Decoders/CD/Session.cs | 32 +- DiscImageChef.Decoders/CD/TOC.cs | 35 +- DiscImageChef.Decoders/DVD/AACS.cs | 3 +- DiscImageChef.Decoders/DVD/ADIP.cs | 3 +- DiscImageChef.Decoders/DVD/BCA.cs | 3 +- DiscImageChef.Decoders/DVD/CPRM.cs | 3 +- DiscImageChef.Decoders/DVD/CSS&CPRM.cs | 45 +- DiscImageChef.Decoders/DVD/Cartridge.cs | 27 +- DiscImageChef.Decoders/DVD/DDS.cs | 33 +- DiscImageChef.Decoders/DVD/DMI.cs | 3 +- DiscImageChef.Decoders/DVD/Enums.cs | 3 +- DiscImageChef.Decoders/DVD/Layers.cs | 3 +- DiscImageChef.Decoders/DVD/PFI.cs | 143 +- DiscImageChef.Decoders/DVD/PRI.cs | 3 +- DiscImageChef.Decoders/DVD/RMD.cs | 3 +- DiscImageChef.Decoders/DVD/Spare.cs | 24 +- DiscImageChef.Decoders/DVD/UDI.cs | 3 +- DiscImageChef.Decoders/Floppy/Amiga.cs | 15 +- DiscImageChef.Decoders/Floppy/Apple2.cs | 133 +- DiscImageChef.Decoders/Floppy/AppleSony.cs | 88 +- DiscImageChef.Decoders/Floppy/Commodore.cs | 6 +- DiscImageChef.Decoders/Floppy/Enums.cs | 3 +- DiscImageChef.Decoders/Floppy/ISO.cs | 21 +- .../Floppy/Perpendicular.cs | 30 +- DiscImageChef.Decoders/Floppy/System34.cs | 30 +- DiscImageChef.Decoders/Floppy/System3740.cs | 21 +- DiscImageChef.Decoders/LisaTag.cs | 29 +- DiscImageChef.Decoders/MMC/CID.cs | 25 +- DiscImageChef.Decoders/MMC/CSD.cs | 85 +- DiscImageChef.Decoders/MMC/ExtendedCSD.cs | 238 +- DiscImageChef.Decoders/MMC/OCR.cs | 65 +- DiscImageChef.Decoders/MMC/VendorString.cs | 8 +- DiscImageChef.Decoders/PCMCIA/CIS.cs | 119 +- DiscImageChef.Decoders/PCMCIA/Enums.cs | 2 +- DiscImageChef.Decoders/PCMCIA/Types.cs | 2 +- DiscImageChef.Decoders/PCMCIA/VendorCode.cs | 941 +- .../Properties/AssemblyInfo.cs | 3 +- .../SCSI/DiscStructureCapabilities.cs | 6 +- DiscImageChef.Decoders/SCSI/EVPD.cs | 762 +- DiscImageChef.Decoders/SCSI/Enums.cs | 3 +- DiscImageChef.Decoders/SCSI/Inquiry.cs | 223 +- DiscImageChef.Decoders/SCSI/MMC/AACS.cs | 84 +- DiscImageChef.Decoders/SCSI/MMC/CPRM.cs | 15 +- .../SCSI/MMC/DiscInformation.cs | 131 +- DiscImageChef.Decoders/SCSI/MMC/Enums.cs | 3 +- DiscImageChef.Decoders/SCSI/MMC/Features.cs | 1600 +- DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs | 83 +- .../SCSI/MMC/WriteProtect.cs | 39 +- DiscImageChef.Decoders/SCSI/Modes.cs | 5218 +- DiscImageChef.Decoders/SCSI/ModesEncoders.cs | 109 +- .../SCSI/SSC/BlockLimits.cs | 19 +- .../SCSI/SSC/DensitySupport.cs | 64 +- DiscImageChef.Decoders/SCSI/Sense.cs | 2491 +- DiscImageChef.Decoders/SCSI/Types.cs | 23 +- DiscImageChef.Decoders/SCSI/VendorString.cs | 2400 +- DiscImageChef.Decoders/SecureDigital/CID.cs | 23 +- DiscImageChef.Decoders/SecureDigital/CSD.cs | 89 +- DiscImageChef.Decoders/SecureDigital/OCR.cs | 50 +- DiscImageChef.Decoders/SecureDigital/SCR.cs | 43 +- .../SecureDigital/VendorString.cs | 8 +- DiscImageChef.Decoders/Sega/CD.cs | 135 +- DiscImageChef.Decoders/Sega/Dreamcast.cs | 159 +- DiscImageChef.Decoders/Sega/Saturn.cs | 96 +- DiscImageChef.Decoders/Xbox/DMI.cs | 96 +- DiscImageChef.Decoders/Xbox/SS.cs | 64 +- DiscImageChef.Device.Report/ata.h | 65 +- DiscImageChef.Device.Report/main.c | 15 +- DiscImageChef.Device.Report/scsi_report.c | 5 +- DiscImageChef.Devices/Command.cs | 298 +- .../Device/AtaCommands/Ata28.cs | 100 +- .../Device/AtaCommands/Ata48.cs | 64 +- .../Device/AtaCommands/AtaCHS.cs | 95 +- .../Device/AtaCommands/Atapi.cs | 11 +- .../Device/AtaCommands/Cfa.cs | 27 +- .../Device/AtaCommands/MCPT.cs | 17 +- .../Device/AtaCommands/Smart.cs | 55 +- DiscImageChef.Devices/Device/Commands.cs | 35 +- DiscImageChef.Devices/Device/Constructor.cs | 277 +- DiscImageChef.Devices/Device/Destructor.cs | 3 +- DiscImageChef.Devices/Device/List.cs | 15 +- .../Device/MmcCommands/MMC.cs | 61 +- .../Device/MmcCommands/SecureDigital.cs | 19 +- .../Device/ScsiCommands/Adaptec.cs | 48 +- .../Device/ScsiCommands/ArchiveCorp.cs | 18 +- .../Device/ScsiCommands/Certance.cs | 9 +- .../Device/ScsiCommands/Fujitsu.cs | 24 +- .../Device/ScsiCommands/HL-DT-ST.cs | 9 +- .../Device/ScsiCommands/HP.cs | 31 +- .../Device/ScsiCommands/Kreon.cs | 30 +- .../Device/ScsiCommands/MMC.cs | 146 +- .../Device/ScsiCommands/NEC.cs | 9 +- .../Device/ScsiCommands/Pioneer.cs | 22 +- .../Device/ScsiCommands/Plasmon.cs | 25 +- .../Device/ScsiCommands/Plextor.cs | 85 +- .../Device/ScsiCommands/SBC.cs | 105 +- .../Device/ScsiCommands/SMC.cs | 22 +- .../Device/ScsiCommands/SPC.cs | 213 +- .../Device/ScsiCommands/SSC.cs | 299 +- .../Device/ScsiCommands/SyQuest.cs | 63 +- DiscImageChef.Devices/Device/Variables.cs | 144 +- DiscImageChef.Devices/Enums.cs | 68 +- DiscImageChef.Devices/FreeBSD/Command.cs | 53 +- DiscImageChef.Devices/FreeBSD/Enums.cs | 259 +- DiscImageChef.Devices/FreeBSD/Extern.cs | 13 +- DiscImageChef.Devices/FreeBSD/ListDevices.cs | 1 - DiscImageChef.Devices/FreeBSD/Structs.cs | 12 +- DiscImageChef.Devices/Linux/Command.cs | 111 +- DiscImageChef.Devices/Linux/Enums.cs | 3 +- DiscImageChef.Devices/Linux/Extern.cs | 11 +- DiscImageChef.Devices/Linux/ListDevices.cs | 19 +- DiscImageChef.Devices/Linux/Structs.cs | 46 +- .../Properties/AssemblyInfo.cs | 3 +- DiscImageChef.Devices/Windows/Command.cs | 198 +- DiscImageChef.Devices/Windows/Enums.cs | 15 +- DiscImageChef.Devices/Windows/Extern.cs | 144 +- DiscImageChef.Devices/Windows/ListDevices.cs | 65 +- DiscImageChef.Devices/Windows/Structs.cs | 80 +- DiscImageChef.Devices/Windows/Usb.cs | 196 +- DiscImageChef.Devices/Windows/UsbFunctions.cs | 60 +- DiscImageChef.DiscImages/Alcohol120.cs | 980 +- DiscImageChef.DiscImages/Anex86.cs | 1017 +- DiscImageChef.DiscImages/Apple2MG.cs | 161 +- DiscImageChef.DiscImages/AppleDOS.cs | 707 +- DiscImageChef.DiscImages/AppleNIB.cs | 1060 +- DiscImageChef.DiscImages/Apridisk.cs | 1158 +- DiscImageChef.DiscImages/BLU.cs | 122 +- DiscImageChef.DiscImages/BlindWrite4.cs | 544 +- DiscImageChef.DiscImages/BlindWrite5.cs | 1143 +- DiscImageChef.DiscImages/CDRDAO.cs | 960 +- DiscImageChef.DiscImages/CDRWin.cs | 1136 +- DiscImageChef.DiscImages/CHD.cs | 4981 +- DiscImageChef.DiscImages/CPCDSK.cs | 219 +- DiscImageChef.DiscImages/CisCopy.cs | 1117 +- DiscImageChef.DiscImages/CloneCD.cs | 3052 +- DiscImageChef.DiscImages/CopyQM.cs | 242 +- DiscImageChef.DiscImages/D88.cs | 1541 +- DiscImageChef.DiscImages/DART.cs | 1340 +- DiscImageChef.DiscImages/DIM.cs | 129 +- DiscImageChef.DiscImages/DiscFerret.cs | 33 +- DiscImageChef.DiscImages/DiscJuggler.cs | 2655 +- DiscImageChef.DiscImages/DiskCopy42.cs | 316 +- DiscImageChef.DiscImages/DriDiskCopy.cs | 1183 +- DiscImageChef.DiscImages/GDI.cs | 455 +- DiscImageChef.DiscImages/HDCopy.cs | 96 +- DiscImageChef.DiscImages/IMD.cs | 1143 +- DiscImageChef.DiscImages/ImageInfo.cs | 13 +- DiscImageChef.DiscImages/ImagePlugin.cs | 104 +- DiscImageChef.DiscImages/KryoFlux.cs | 61 +- DiscImageChef.DiscImages/MaxiDisk.cs | 995 +- DiscImageChef.DiscImages/NDIF.cs | 1575 +- DiscImageChef.DiscImages/NHDr0.cs | 771 +- DiscImageChef.DiscImages/Nero.cs | 1586 +- DiscImageChef.DiscImages/Parallels.cs | 76 +- DiscImageChef.DiscImages/PartClone.cs | 1029 +- DiscImageChef.DiscImages/Partimage.cs | 1629 +- .../Properties/AssemblyInfo.cs | 3 +- DiscImageChef.DiscImages/QCOW.cs | 134 +- DiscImageChef.DiscImages/QCOW2.cs | 143 +- DiscImageChef.DiscImages/QED.cs | 93 +- DiscImageChef.DiscImages/RayDIM.cs | 910 +- DiscImageChef.DiscImages/RsIde.cs | 778 +- DiscImageChef.DiscImages/SaveDskF.cs | 1111 +- DiscImageChef.DiscImages/SuperCardPro.cs | 144 +- DiscImageChef.DiscImages/T98.cs | 696 +- DiscImageChef.DiscImages/TeleDisk.cs | 3397 +- DiscImageChef.DiscImages/UDIF.cs | 1124 +- DiscImageChef.DiscImages/UkvFdi.cs | 1014 +- DiscImageChef.DiscImages/VDI.cs | 68 +- DiscImageChef.DiscImages/VHD.cs | 848 +- DiscImageChef.DiscImages/VHDX.cs | 187 +- DiscImageChef.DiscImages/VMware.cs | 392 +- DiscImageChef.DiscImages/Virtual98.cs | 786 +- DiscImageChef.DiscImages/ZZZRawImage.cs | 1084 +- DiscImageChef.DiscImages/packages.config | 11 +- DiscImageChef.Filesystems/AODOS.cs | 23 +- DiscImageChef.Filesystems/APFS.cs | 37 +- DiscImageChef.Filesystems/Acorn.cs | 191 +- DiscImageChef.Filesystems/AmigaDOS.cs | 116 +- .../AppleDOS/AppleDOS.cs | 2 +- DiscImageChef.Filesystems/AppleDOS/Dir.cs | 29 +- DiscImageChef.Filesystems/AppleDOS/File.cs | 118 +- DiscImageChef.Filesystems/AppleDOS/Info.cs | 29 +- DiscImageChef.Filesystems/AppleDOS/Structs.cs | 35 +- DiscImageChef.Filesystems/AppleDOS/Super.cs | 8 +- DiscImageChef.Filesystems/AppleDOS/Xattr.cs | 57 +- DiscImageChef.Filesystems/AppleHFS.cs | 147 +- DiscImageChef.Filesystems/AppleHFSPlus.cs | 113 +- .../AppleMFS/AppleMFS.cs | 14 +- DiscImageChef.Filesystems/AppleMFS/Consts.cs | 3 +- DiscImageChef.Filesystems/AppleMFS/Dir.cs | 34 +- DiscImageChef.Filesystems/AppleMFS/File.cs | 157 +- DiscImageChef.Filesystems/AppleMFS/Info.cs | 42 +- DiscImageChef.Filesystems/AppleMFS/Structs.cs | 3 +- DiscImageChef.Filesystems/AppleMFS/Super.cs | 50 +- DiscImageChef.Filesystems/AppleMFS/Xattr.cs | 50 +- DiscImageChef.Filesystems/AtheOS.cs | 62 +- DiscImageChef.Filesystems/BFS.cs | 96 +- DiscImageChef.Filesystems/BTRFS.cs | 65 +- DiscImageChef.Filesystems/CBM.cs | 66 +- DiscImageChef.Filesystems/CPM/CPM.cs | 15 +- DiscImageChef.Filesystems/CPM/Consts.cs | 3 +- DiscImageChef.Filesystems/CPM/Definitions.cs | 18 +- DiscImageChef.Filesystems/CPM/Dir.cs | 34 +- DiscImageChef.Filesystems/CPM/File.cs | 58 +- DiscImageChef.Filesystems/CPM/Info.cs | 219 +- DiscImageChef.Filesystems/CPM/Structs.cs | 93 +- DiscImageChef.Filesystems/CPM/Super.cs | 230 +- DiscImageChef.Filesystems/CPM/Xattr.cs | 34 +- DiscImageChef.Filesystems/CPM/cpmdefs.xml | 43691 ++++++++-------- DiscImageChef.Filesystems/Cram.cs | 33 +- DiscImageChef.Filesystems/ECMA67.cs | 47 +- DiscImageChef.Filesystems/EFS.cs | 87 +- DiscImageChef.Filesystems/F2FS.cs | 81 +- DiscImageChef.Filesystems/FAT.cs | 663 +- DiscImageChef.Filesystems/FATX.cs | 18 +- DiscImageChef.Filesystems/FFS.cs | 190 +- DiscImageChef.Filesystems/Filesystem.cs | 25 +- DiscImageChef.Filesystems/Fossil.cs | 27 +- DiscImageChef.Filesystems/HAMMER.cs | 61 +- DiscImageChef.Filesystems/HPFS.cs | 130 +- .../ISO9660/Consts/AAIP.cs | 2 +- .../ISO9660/Consts/Amiga.cs | 2 +- .../ISO9660/Consts/Apple.cs | 2 +- .../ISO9660/Consts/CDi.cs | 2 +- .../ISO9660/Consts/ElTorito.cs | 2 +- .../ISO9660/Consts/HighSierra.cs | 2 +- .../ISO9660/Consts/ISO.cs | 2 +- .../ISO9660/Consts/RRIP.cs | 2 +- .../ISO9660/Consts/SUSP.cs | 2 +- .../ISO9660/Consts/XA.cs | 2 +- .../ISO9660/Consts/Ziso.cs | 2 +- DiscImageChef.Filesystems/ISO9660/Dir.cs | 2 +- DiscImageChef.Filesystems/ISO9660/Extent.cs | 2 +- DiscImageChef.Filesystems/ISO9660/File.cs | 2 +- DiscImageChef.Filesystems/ISO9660/ISO9660.cs | 14 +- DiscImageChef.Filesystems/ISO9660/Info.cs | 438 +- .../ISO9660/Structs/Amiga.cs | 2 +- .../ISO9660/Structs/Apple.cs | 5 +- .../ISO9660/Structs/CDi.cs | 97 +- .../ISO9660/Structs/Common.cs | 2 +- .../ISO9660/Structs/ElTorito.cs | 29 +- .../ISO9660/Structs/HighSierra.cs | 79 +- .../ISO9660/Structs/ISO.cs | 127 +- .../ISO9660/Structs/Joliet.cs | 23 +- .../ISO9660/Structs/RRIP.cs | 2 +- .../ISO9660/Structs/SUSP.cs | 2 +- .../ISO9660/Structs/XA.cs | 5 +- .../ISO9660/Structs/Ziso.cs | 2 +- DiscImageChef.Filesystems/ISO9660/Super.cs | 2 +- DiscImageChef.Filesystems/ISO9660/Xattr.cs | 2 +- DiscImageChef.Filesystems/JFS.cs | 158 +- DiscImageChef.Filesystems/LIF.cs | 33 +- DiscImageChef.Filesystems/LisaFS/Consts.cs | 3 +- DiscImageChef.Filesystems/LisaFS/Dir.cs | 39 +- DiscImageChef.Filesystems/LisaFS/Extent.cs | 132 +- DiscImageChef.Filesystems/LisaFS/File.cs | 159 +- DiscImageChef.Filesystems/LisaFS/Info.cs | 215 +- DiscImageChef.Filesystems/LisaFS/LisaFS.cs | 2 +- DiscImageChef.Filesystems/LisaFS/Structs.cs | 4 +- DiscImageChef.Filesystems/LisaFS/Super.cs | 32 +- DiscImageChef.Filesystems/LisaFS/Xattr.cs | 48 +- DiscImageChef.Filesystems/Locus.cs | 276 +- DiscImageChef.Filesystems/MicroDOS.cs | 39 +- DiscImageChef.Filesystems/MinixFS.cs | 89 +- DiscImageChef.Filesystems/NILFS2.cs | 66 +- DiscImageChef.Filesystems/NTFS.cs | 42 +- DiscImageChef.Filesystems/Nintendo.cs | 287 +- DiscImageChef.Filesystems/ODS.cs | 225 +- DiscImageChef.Filesystems/Opera.cs | 61 +- DiscImageChef.Filesystems/PCEngine.cs | 18 +- DiscImageChef.Filesystems/PFS.cs | 41 +- DiscImageChef.Filesystems/ProDOS.cs | 102 +- .../Properties/AssemblyInfo.cs | 3 +- DiscImageChef.Filesystems/QNX4.cs | 67 +- DiscImageChef.Filesystems/QNX6.cs | 49 +- DiscImageChef.Filesystems/RBF.cs | 165 +- DiscImageChef.Filesystems/RT11.cs | 72 +- DiscImageChef.Filesystems/Reiser.cs | 95 +- DiscImageChef.Filesystems/Reiser4.cs | 57 +- DiscImageChef.Filesystems/SFS.cs | 56 +- DiscImageChef.Filesystems/SolarFS.cs | 44 +- DiscImageChef.Filesystems/Squash.cs | 33 +- DiscImageChef.Filesystems/Structs.cs | 80 +- DiscImageChef.Filesystems/Symbian.cs | 2 +- DiscImageChef.Filesystems/SysV.cs | 222 +- .../UCSDPascal/Consts.cs | 3 +- DiscImageChef.Filesystems/UCSDPascal/Dir.cs | 8 +- DiscImageChef.Filesystems/UCSDPascal/File.cs | 59 +- DiscImageChef.Filesystems/UCSDPascal/Info.cs | 61 +- .../UCSDPascal/Structs.cs | 3 +- DiscImageChef.Filesystems/UCSDPascal/Super.cs | 20 +- .../UCSDPascal/UCSDPascal.cs | 3 +- DiscImageChef.Filesystems/UDF.cs | 199 +- DiscImageChef.Filesystems/UNICOS.cs | 153 +- DiscImageChef.Filesystems/UNIXBFS.cs | 21 +- DiscImageChef.Filesystems/VMfs.cs | 48 +- DiscImageChef.Filesystems/VxFS.cs | 47 +- DiscImageChef.Filesystems/XFS.cs | 86 +- DiscImageChef.Filesystems/ZFS.cs | 172 +- DiscImageChef.Filesystems/dump.cs | 151 +- DiscImageChef.Filesystems/exFAT.cs | 75 +- DiscImageChef.Filesystems/ext2FS.cs | 189 +- DiscImageChef.Filesystems/extFS.cs | 32 +- DiscImageChef.Filesystems/packages.config | 3 +- DiscImageChef.Filters/AppleDouble.cs | 103 +- DiscImageChef.Filters/AppleSingle.cs | 123 +- DiscImageChef.Filters/BZip2.cs | 22 +- DiscImageChef.Filters/Filter.cs | 7 +- DiscImageChef.Filters/Filters.cs | 20 +- DiscImageChef.Filters/ForcedSeekStream.cs | 56 +- DiscImageChef.Filters/GZip.cs | 7 +- DiscImageChef.Filters/LZip.cs | 27 +- DiscImageChef.Filters/MacBinary.cs | 84 +- DiscImageChef.Filters/OffsetStream.cs | 235 +- DiscImageChef.Filters/PCExchange.cs | 45 +- .../Properties/AssemblyInfo.cs | 3 +- DiscImageChef.Filters/XZ.cs | 26 +- DiscImageChef.Filters/ZZZNoFilter.cs | 6 +- DiscImageChef.Filters/packages.config | 3 +- DiscImageChef.Helpers/ArrayFill.cs | 13 +- DiscImageChef.Helpers/ArrayIsEmpty.cs | 17 +- .../BigEndianBitConverter.cs | 48 +- DiscImageChef.Helpers/BigEndianMarshal.cs | 4 +- DiscImageChef.Helpers/CHS.cs | 6 +- DiscImageChef.Helpers/CompareBytes.cs | 8 +- DiscImageChef.Helpers/CountBits.cs | 2 +- DiscImageChef.Helpers/DateHandlers.cs | 117 +- .../EndianAwareBinaryReader.cs | 62 +- DiscImageChef.Helpers/Extents/ExtentsByte.cs | 43 +- DiscImageChef.Helpers/Extents/ExtentsInt.cs | 43 +- DiscImageChef.Helpers/Extents/ExtentsLong.cs | 43 +- DiscImageChef.Helpers/Extents/ExtentsSByte.cs | 43 +- DiscImageChef.Helpers/Extents/ExtentsShort.cs | 43 +- DiscImageChef.Helpers/Extents/ExtentsUInt.cs | 43 +- DiscImageChef.Helpers/Extents/ExtentsULong.cs | 43 +- .../Extents/ExtentsUShort.cs | 42 +- DiscImageChef.Helpers/PrintHex.cs | 7 +- .../Properties/AssemblyInfo.cs | 3 +- DiscImageChef.Helpers/StringHandlers.cs | 42 +- DiscImageChef.Helpers/Swapping.cs | 2 +- DiscImageChef.Interop/DetectOS.cs | 337 +- .../Properties/AssemblyInfo.cs | 3 +- DiscImageChef.Metadata/DeviceReport.cs | 4 +- DiscImageChef.Metadata/Dimensions.cs | 6 +- DiscImageChef.Metadata/ExtentsConverter.cs | 15 +- DiscImageChef.Metadata/MediaType.cs | 3 +- .../Properties/AssemblyInfo.cs | 3 +- DiscImageChef.Metadata/Resume.cs | 14 +- DiscImageChef.Metadata/Statistics.cs | 23 +- DiscImageChef.Partitions/Acorn.cs | 43 +- DiscImageChef.Partitions/AppleMap.cs | 150 +- DiscImageChef.Partitions/Apricot.cs | 276 +- DiscImageChef.Partitions/Atari.cs | 80 +- DiscImageChef.Partitions/BSD.cs | 137 +- DiscImageChef.Partitions/DEC.cs | 15 +- DiscImageChef.Partitions/DragonFlyBSD.cs | 33 +- DiscImageChef.Partitions/GPT.cs | 335 +- DiscImageChef.Partitions/Human68k.cs | 21 +- DiscImageChef.Partitions/MBR.cs | 207 +- DiscImageChef.Partitions/NeXT.cs | 137 +- DiscImageChef.Partitions/PC98.cs | 60 +- DiscImageChef.Partitions/PartPlugin.cs | 7 +- DiscImageChef.Partitions/Plan9.cs | 22 +- .../Properties/AssemblyInfo.cs | 3 +- DiscImageChef.Partitions/RDB.cs | 302 +- DiscImageChef.Partitions/RioKarma.cs | 18 +- DiscImageChef.Partitions/SGI.cs | 113 +- DiscImageChef.Partitions/Sun.cs | 293 +- DiscImageChef.Partitions/UNIX.cs | 1433 +- DiscImageChef.Partitions/VTOC.cs | 310 +- DiscImageChef.Partitions/XENIX.cs | 31 +- DiscImageChef.Partitions/Xbox.cs | 15 +- DiscImageChef.Server/App_Start/Ata.cs | 847 +- DiscImageChef.Server/App_Start/ScsiEvpd.cs | 52 +- DiscImageChef.Server/App_Start/ScsiInquiry.cs | 159 +- .../App_Start/ScsiMmcFeatures.cs | 296 +- DiscImageChef.Server/App_Start/ScsiMmcMode.cs | 138 +- .../App_Start/ScsiModeSense.cs | 532 +- .../App_Start/SscTestedMedia.cs | 14 +- DiscImageChef.Server/App_Start/TestedMedia.cs | 187 +- .../App_Start/WebApiConfig.cs | 9 +- DiscImageChef.Server/Changelog.aspx | 18 +- .../Controllers/UploadReportController.cs | 6 +- .../Controllers/UploadStatsController.cs | 172 +- DiscImageChef.Server/DONATING.aspx | 18 +- DiscImageChef.Server/Default.aspx | 9 +- DiscImageChef.Server/Default.aspx.cs | 6 +- DiscImageChef.Server/Global.asax | 2 +- DiscImageChef.Server/Global.asax.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- DiscImageChef.Server/Statistics.aspx | 425 +- DiscImageChef.Server/Statistics.aspx.cs | 116 +- .../Statistics/Statistics.xml | 3 +- DiscImageChef.Server/TODO.aspx | 18 +- DiscImageChef.Server/ViewReport.aspx | 312 +- DiscImageChef.Server/ViewReport.aspx.cs | 285 +- DiscImageChef.Server/Web.config | 23 +- DiscImageChef.Server/dos.css | 189 +- DiscImageChef.Server/packages.config | 13 +- .../Properties/AssemblyInfo.cs | 3 +- DiscImageChef.Settings/Settings.cs | 601 +- DiscImageChef.Settings/packages.config | 3 +- DiscImageChef.Tests.Devices/ATA.cs | 2 +- DiscImageChef.Tests.Devices/ATA/Ata28.cs | 166 +- DiscImageChef.Tests.Devices/ATA/Ata48.cs | 152 +- DiscImageChef.Tests.Devices/ATA/AtaCHS.cs | 140 +- DiscImageChef.Tests.Devices/ATA/Atapi.cs | 16 +- DiscImageChef.Tests.Devices/ATA/Cfa.cs | 60 +- DiscImageChef.Tests.Devices/ATA/MCPT.cs | 22 +- DiscImageChef.Tests.Devices/ATA/Smart.cs | 103 +- DiscImageChef.Tests.Devices/Command.cs | 2 +- .../DecodeATARegisters.cs | 59 +- DiscImageChef.Tests.Devices/Device.cs | 11 +- DiscImageChef.Tests.Devices/Main.cs | 16 +- DiscImageChef.Tests.Devices/NVMe.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- DiscImageChef.Tests.Devices/SCSI.cs | 2 +- DiscImageChef.Tests.Devices/SCSI/Adaptec.cs | 105 +- .../SCSI/ArchiveCorp.cs | 57 +- DiscImageChef.Tests.Devices/SCSI/Certance.cs | 28 +- DiscImageChef.Tests.Devices/SCSI/Fujitsu.cs | 32 +- DiscImageChef.Tests.Devices/SCSI/HL-DT-ST.cs | 31 +- DiscImageChef.Tests.Devices/SCSI/HP.cs | 38 +- DiscImageChef.Tests.Devices/SCSI/Kreon.cs | 78 +- DiscImageChef.Tests.Devices/SCSI/MMC.cs | 361 +- DiscImageChef.Tests.Devices/SCSI/NEC.cs | 31 +- DiscImageChef.Tests.Devices/SCSI/Pioneer.cs | 106 +- DiscImageChef.Tests.Devices/SCSI/Plasmon.cs | 67 +- DiscImageChef.Tests.Devices/SCSI/Plextor.cs | 320 +- DiscImageChef.Tests.Devices/SCSI/SBC.cs | 246 +- DiscImageChef.Tests.Devices/SCSI/SMC.cs | 41 +- DiscImageChef.Tests.Devices/SCSI/SPC.cs | 256 +- DiscImageChef.Tests.Devices/SCSI/SSC.cs | 446 +- DiscImageChef.Tests.Devices/SCSI/SyQuest.cs | 84 +- DiscImageChef.Tests.Devices/SecureDigital.cs | 2 +- .../SecureDigital/MultiMediaCard.cs | 143 +- .../SecureDigital/SecureDigital.cs | 141 +- DiscImageChef.Tests/Checksums/Adler32.cs | 18 +- DiscImageChef.Tests/Checksums/CRC16.cs | 18 +- DiscImageChef.Tests/Checksums/CRC32.cs | 18 +- DiscImageChef.Tests/Checksums/CRC64.cs | 18 +- DiscImageChef.Tests/Checksums/MD5.cs | 20 +- DiscImageChef.Tests/Checksums/RIPEMD160.cs | 26 +- DiscImageChef.Tests/Checksums/SHA1.cs | 26 +- DiscImageChef.Tests/Checksums/SHA256.cs | 26 +- DiscImageChef.Tests/Checksums/SHA384.cs | 28 +- DiscImageChef.Tests/Checksums/SHA512.cs | 30 +- DiscImageChef.Tests/Checksums/SpamSum.cs | 14 +- DiscImageChef.Tests/Consts.cs | 2 +- DiscImageChef.Tests/Devices/IomegaJaz.cs | 18 +- DiscImageChef.Tests/Devices/LS120.cs | 18 +- DiscImageChef.Tests/Devices/PocketZip.cs | 18 +- DiscImageChef.Tests/Filesystems/ADFS.cs | 48 +- DiscImageChef.Tests/Filesystems/AFFS.cs | 34 +- DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs | 31 +- DiscImageChef.Tests/Filesystems/AFFS_MBR.cs | 31 +- .../Filesystems/AFFS_MBR_RDB.cs | 31 +- DiscImageChef.Tests/Filesystems/AFFS_RDB.cs | 54 +- DiscImageChef.Tests/Filesystems/AFS.cs | 47 +- DiscImageChef.Tests/Filesystems/AFS_MBR.cs | 35 +- DiscImageChef.Tests/Filesystems/AOFS.cs | 34 +- DiscImageChef.Tests/Filesystems/AOFS_MBR.cs | 31 +- .../Filesystems/AOFS_MBR_RDB.cs | 31 +- DiscImageChef.Tests/Filesystems/AOFS_RDB.cs | 35 +- DiscImageChef.Tests/Filesystems/Atheos_MBR.cs | 31 +- DiscImageChef.Tests/Filesystems/BeFS.cs | 38 +- DiscImageChef.Tests/Filesystems/BeFS_APM.cs | 35 +- DiscImageChef.Tests/Filesystems/BeFS_GPT.cs | 31 +- DiscImageChef.Tests/Filesystems/BeFS_MBR.cs | 32 +- DiscImageChef.Tests/Filesystems/COHERENT.cs | 42 +- .../Filesystems/COHERENT_MBR.cs | 35 +- DiscImageChef.Tests/Filesystems/DTFS.cs | 49 +- DiscImageChef.Tests/Filesystems/DTFS_MBR.cs | 35 +- DiscImageChef.Tests/Filesystems/EAFS.cs | 51 +- DiscImageChef.Tests/Filesystems/EAFS_MBR.cs | 35 +- DiscImageChef.Tests/Filesystems/F2FS.cs | 31 +- DiscImageChef.Tests/Filesystems/FAT12.cs | 1561 +- DiscImageChef.Tests/Filesystems/FAT12_APM.cs | 35 +- DiscImageChef.Tests/Filesystems/FAT12_GPT.cs | 35 +- DiscImageChef.Tests/Filesystems/FAT12_MBR.cs | 206 +- DiscImageChef.Tests/Filesystems/FAT16.cs | 29 +- DiscImageChef.Tests/Filesystems/FAT16_APM.cs | 35 +- .../Filesystems/FAT16_Atari.cs | 35 +- DiscImageChef.Tests/Filesystems/FAT16_GPT.cs | 35 +- DiscImageChef.Tests/Filesystems/FAT16_MBR.cs | 202 +- DiscImageChef.Tests/Filesystems/FAT16_RDB.cs | 35 +- DiscImageChef.Tests/Filesystems/FAT32_APM.cs | 35 +- DiscImageChef.Tests/Filesystems/FAT32_GPT.cs | 35 +- DiscImageChef.Tests/Filesystems/FAT32_MBR.cs | 88 +- DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs | 32 +- DiscImageChef.Tests/Filesystems/HFS.cs | 52 +- .../Filesystems/HFSPlus_APM.cs | 96 +- .../Filesystems/HFSPlus_GPT.cs | 35 +- .../Filesystems/HFSPlus_MBR.cs | 75 +- DiscImageChef.Tests/Filesystems/HFSX_APM.cs | 57 +- DiscImageChef.Tests/Filesystems/HFSX_GPT.cs | 35 +- DiscImageChef.Tests/Filesystems/HFSX_MBR.cs | 44 +- DiscImageChef.Tests/Filesystems/HFS_APM.cs | 121 +- DiscImageChef.Tests/Filesystems/HFS_CDROM.cs | 47 +- DiscImageChef.Tests/Filesystems/HFS_MBR.cs | 40 +- DiscImageChef.Tests/Filesystems/HFS_RDB.cs | 31 +- DiscImageChef.Tests/Filesystems/HPFS.cs | 69 +- DiscImageChef.Tests/Filesystems/HTFS.cs | 49 +- DiscImageChef.Tests/Filesystems/HTFS_MBR.cs | 35 +- DiscImageChef.Tests/Filesystems/ISO9660.cs | 131 +- DiscImageChef.Tests/Filesystems/JFS2.cs | 32 +- DiscImageChef.Tests/Filesystems/LFS_MBR.cs | 30 +- DiscImageChef.Tests/Filesystems/LisaFS.cs | 55 +- DiscImageChef.Tests/Filesystems/Locus.cs | 38 +- DiscImageChef.Tests/Filesystems/MFS.cs | 41 +- DiscImageChef.Tests/Filesystems/MINIXv1.cs | 33 +- .../Filesystems/MINIXv1_MBR.cs | 27 +- DiscImageChef.Tests/Filesystems/MINIXv2.cs | 33 +- .../Filesystems/MINIXv2_MBR.cs | 27 +- DiscImageChef.Tests/Filesystems/MINIXv3.cs | 33 +- .../Filesystems/MINIXv3_MBR.cs | 27 +- DiscImageChef.Tests/Filesystems/NILFS2.cs | 31 +- DiscImageChef.Tests/Filesystems/NTFS_GPT.cs | 37 +- DiscImageChef.Tests/Filesystems/NTFS_MBR.cs | 65 +- DiscImageChef.Tests/Filesystems/NWFS386.cs | 30 +- DiscImageChef.Tests/Filesystems/OCFS2.cs | 30 +- DiscImageChef.Tests/Filesystems/PFS3_RDB.cs | 35 +- DiscImageChef.Tests/Filesystems/ProDOS_APM.cs | 50 +- DiscImageChef.Tests/Filesystems/QNX4.cs | 28 +- DiscImageChef.Tests/Filesystems/QNX4_MBR.cs | 23 +- DiscImageChef.Tests/Filesystems/ReFS_MBR.cs | 36 +- DiscImageChef.Tests/Filesystems/Reiser3.cs | 27 +- DiscImageChef.Tests/Filesystems/Reiser4.cs | 31 +- DiscImageChef.Tests/Filesystems/SFS_MBR.cs | 31 +- .../Filesystems/SFS_MBR_RDB.cs | 31 +- DiscImageChef.Tests/Filesystems/SFS_RDB.cs | 31 +- DiscImageChef.Tests/Filesystems/SysV.cs | 70 +- DiscImageChef.Tests/Filesystems/SysV_MBR.cs | 36 +- DiscImageChef.Tests/Filesystems/SysV_RDB.cs | 35 +- DiscImageChef.Tests/Filesystems/UDF.cs | 76 +- DiscImageChef.Tests/Filesystems/UFS.cs | 48 +- DiscImageChef.Tests/Filesystems/UFS_APM.cs | 57 +- DiscImageChef.Tests/Filesystems/UFS_MBR.cs | 119 +- DiscImageChef.Tests/Filesystems/UFS_NeXT.cs | 45 +- .../Filesystems/UFS_NeXT_Floppy.cs | 71 +- DiscImageChef.Tests/Filesystems/UFS_RDB.cs | 35 +- DiscImageChef.Tests/Filesystems/UFS_Suni86.cs | 35 +- DiscImageChef.Tests/Filesystems/UNIXBFS.cs | 37 +- .../Filesystems/UNIXBFS_MBR.cs | 27 +- .../Filesystems/UNIXBFS_RDB.cs | 35 +- DiscImageChef.Tests/Filesystems/XENIX.cs | 50 +- DiscImageChef.Tests/Filesystems/XENIX_MBR.cs | 36 +- DiscImageChef.Tests/Filesystems/XFS_MBR.cs | 31 +- DiscImageChef.Tests/Filesystems/ZFS.cs | 30 +- DiscImageChef.Tests/Filesystems/btrfs.cs | 31 +- DiscImageChef.Tests/Filesystems/exFAT_APM.cs | 31 +- DiscImageChef.Tests/Filesystems/exFAT_GPT.cs | 31 +- DiscImageChef.Tests/Filesystems/exFAT_MBR.cs | 31 +- DiscImageChef.Tests/Filesystems/ext2.cs | 57 +- .../Filters/AppleDoubleDave.cs | 5 +- DiscImageChef.Tests/Filters/AppleDoubleDos.cs | 2 +- .../Filters/AppleDoubleNetatalk.cs | 5 +- DiscImageChef.Tests/Filters/AppleDoubleOsX.cs | 2 +- .../Filters/AppleDoubleProDos.cs | 2 +- .../Filters/AppleDoubleUnAr.cs | 2 +- .../Filters/AppleDoubleUnix.cs | 2 +- DiscImageChef.Tests/Filters/AppleSingle.cs | 2 +- DiscImageChef.Tests/Filters/BZip2.cs | 8 +- DiscImageChef.Tests/Filters/GZip.cs | 8 +- DiscImageChef.Tests/Filters/LZip.cs | 8 +- DiscImageChef.Tests/Filters/MacBinary1.cs | 2 +- DiscImageChef.Tests/Filters/MacBinary2.cs | 2 +- DiscImageChef.Tests/Filters/MacBinary3.cs | 2 +- DiscImageChef.Tests/Filters/PCExchange.cs | 7 +- DiscImageChef.Tests/Filters/XZ.cs | 8 +- DiscImageChef.Tests/Images/2MG.cs | 37 +- DiscImageChef.Tests/Images/Anex86.cs | 30 +- DiscImageChef.Tests/Images/CisCopy.cs | 50 +- DiscImageChef.Tests/Images/CopyQM.cs | 34 +- DiscImageChef.Tests/Images/D88.cs | 65 +- DiscImageChef.Tests/Images/DART.cs | 26 +- DiscImageChef.Tests/Images/DiskCopy42.cs | 55 +- DiscImageChef.Tests/Partitions/Acorn.cs | 66 +- DiscImageChef.Tests/Partitions/AppleMap.cs | 2278 +- DiscImageChef.Tests/Partitions/Atari.cs | 319 +- DiscImageChef.Tests/Partitions/BSD.cs | 399 +- DiscImageChef.Tests/Partitions/GPT.cs | 132 +- DiscImageChef.Tests/Partitions/MBR.cs | 2282 +- DiscImageChef.Tests/Partitions/MINIX.cs | 66 +- DiscImageChef.Tests/Partitions/PC98.cs | 366 +- DiscImageChef.Tests/Partitions/RDB.cs | 215 +- DiscImageChef.Tests/Partitions/SGI.cs | 199 +- DiscImageChef.Tests/Partitions/Sun.cs | 119 +- DiscImageChef.Tests/Partitions/VTOC.cs | 176 +- DiscImageChef.Tests/packages.config | 7 +- DiscImageChef/AssemblyInfo.cs | 3 +- DiscImageChef/Commands/Analyze.cs | 31 +- DiscImageChef/Commands/Benchmark.cs | 24 +- DiscImageChef/Commands/Checksum.cs | 81 +- DiscImageChef/Commands/Commands.cs | 7 +- DiscImageChef/Commands/Compare.cs | 284 +- DiscImageChef/Commands/Configure.cs | 17 +- DiscImageChef/Commands/CreateSidecar.cs | 42 +- DiscImageChef/Commands/Decode.cs | 224 +- DiscImageChef/Commands/DeviceInfo.cs | 2610 +- DiscImageChef/Commands/DeviceReport.cs | 27 +- DiscImageChef/Commands/DumpMedia.cs | 27 +- DiscImageChef/Commands/Entropy.cs | 30 +- DiscImageChef/Commands/ExtractFiles.cs | 510 +- DiscImageChef/Commands/Formats.cs | 33 +- DiscImageChef/Commands/ListDevices.cs | 19 +- DiscImageChef/Commands/ListEncodings.cs | 9 +- DiscImageChef/Commands/Ls.cs | 94 +- DiscImageChef/Commands/MediaInfo.cs | 642 +- DiscImageChef/Commands/MediaScan.cs | 20 +- DiscImageChef/Commands/PrintHex.cs | 15 +- DiscImageChef/Commands/Statistics.cs | 119 +- DiscImageChef/Commands/Verify.cs | 76 +- DiscImageChef/Main.cs | 334 +- DiscImageChef/Options.cs | 144 +- DiscImageChef/Progress.cs | 17 +- DiscImageChef/packages.config | 7 +- 704 files changed, 82627 insertions(+), 83641 deletions(-) diff --git a/DiscImageChef.Checksums/Adler32Context.cs b/DiscImageChef.Checksums/Adler32Context.cs index 31d532c4..1d812cbe 100644 --- a/DiscImageChef.Checksums/Adler32Context.cs +++ b/DiscImageChef.Checksums/Adler32Context.cs @@ -138,10 +138,7 @@ namespace DiscImageChef.Checksums StringBuilder adlerOutput = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - adlerOutput.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { adlerOutput.Append(hash[i].ToString("x2")); } fileStream.Close(); @@ -175,10 +172,7 @@ namespace DiscImageChef.Checksums StringBuilder adlerOutput = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - adlerOutput.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { adlerOutput.Append(hash[i].ToString("x2")); } return adlerOutput.ToString(); } @@ -193,5 +187,4 @@ namespace DiscImageChef.Checksums return Data(data, (uint)data.Length, out hash); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Checksums/CDChecksums.cs b/DiscImageChef.Checksums/CDChecksums.cs index 2d8751f5..f94bdc67 100644 --- a/DiscImageChef.Checksums/CDChecksums.cs +++ b/DiscImageChef.Checksums/CDChecksums.cs @@ -48,34 +48,27 @@ namespace DiscImageChef.Checksums switch(buffer.Length) { case 2448: - { - byte[] subchannel = new byte[96]; - byte[] channel = new byte[2352]; + { + byte[] subchannel = new byte[96]; + byte[] channel = new byte[2352]; - Array.Copy(buffer, 0, channel, 0, 2352); - Array.Copy(buffer, 2352, subchannel, 0, 96); + Array.Copy(buffer, 0, channel, 0, 2352); + Array.Copy(buffer, 2352, subchannel, 0, 96); - bool? channelStatus = CheckCDSectorChannel(channel); - bool? subchannelStatus = CheckCDSectorSubChannel(subchannel); - bool? status = null; + bool? channelStatus = CheckCDSectorChannel(channel); + bool? subchannelStatus = CheckCDSectorSubChannel(subchannel); + bool? status = null; - if(channelStatus == null && subchannelStatus == null) - status = null; - if(channelStatus == false || subchannelStatus == false) - status = false; - if(channelStatus == null && subchannelStatus == true) - status = true; - if(channelStatus == true && subchannelStatus == null) - status = true; - if(channelStatus == true && subchannelStatus == true) - status = true; + if(channelStatus == null && subchannelStatus == null) status = null; + if(channelStatus == false || subchannelStatus == false) status = false; + if(channelStatus == null && subchannelStatus == true) status = true; + if(channelStatus == true && subchannelStatus == null) status = true; + if(channelStatus == true && subchannelStatus == true) status = true; - return status; - } - case 2352: - return CheckCDSectorChannel(buffer); - default: - return null; + return status; + } + case 2352: return CheckCDSectorChannel(buffer); + default: return null; } } @@ -92,15 +85,8 @@ namespace DiscImageChef.Checksums } } - static bool CheckECC( - byte[] address, - byte[] data, - uint major_count, - uint minor_count, - uint major_mult, - uint minor_inc, - byte[] ecc - ) + static bool CheckECC(byte[] address, byte[] data, uint major_count, uint minor_count, uint major_mult, + uint minor_inc, byte[] ecc) { uint size = major_count * minor_count; uint major; @@ -113,31 +99,19 @@ namespace DiscImageChef.Checksums for(minor = 0; minor < minor_count; minor++) { byte temp; - if(index < 4) - { - temp = address[index]; - } - else - { - temp = data[index - 4]; - } + if(index < 4) { temp = address[index]; } + else { temp = data[index - 4]; } index += minor_inc; - if(index >= size) - { - index -= size; - } + if(index >= size) { index -= size; } ecc_a ^= temp; ecc_b ^= temp; ecc_a = ECC_F_Table[ecc_a]; } + ecc_a = ECC_B_Table[ECC_F_Table[ecc_a] ^ ecc_b]; - if( - ecc[major] != (ecc_a) || - ecc[major + major_count] != (ecc_a ^ ecc_b)) - { - return false; - } + if(ecc[major] != (ecc_a) || ecc[major + major_count] != (ecc_a ^ ecc_b)) { return false; } } + return true; } @@ -145,49 +119,44 @@ namespace DiscImageChef.Checksums { ECCInit(); - if( - channel[0x000] == 0x00 && // sync (12 bytes) - channel[0x001] == 0xFF && - channel[0x002] == 0xFF && - channel[0x003] == 0xFF && - channel[0x004] == 0xFF && - channel[0x005] == 0xFF && - channel[0x006] == 0xFF && - channel[0x007] == 0xFF && - channel[0x008] == 0xFF && - channel[0x009] == 0xFF && - channel[0x00A] == 0xFF && - channel[0x00B] == 0x00) + if(channel[0x000] == 0x00 && // sync (12 bytes) + channel[0x001] == 0xFF && channel[0x002] == 0xFF && channel[0x003] == 0xFF && channel[0x004] == 0xFF && + channel[0x005] == 0xFF && channel[0x006] == 0xFF && channel[0x007] == 0xFF && channel[0x008] == 0xFF && + channel[0x009] == 0xFF && channel[0x00A] == 0xFF && channel[0x00B] == 0x00) { - DicConsole.DebugWriteLine("CD checksums", "Data sector, address {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); + DicConsole.DebugWriteLine("CD checksums", "Data sector, address {0:X2}:{1:X2}:{2:X2}", channel[0x00C], + channel[0x00D], channel[0x00E]); if(channel[0x00F] == 0x00) // mode (1 byte) { - DicConsole.DebugWriteLine("CD checksums", "Mode 0 sector at address {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); + DicConsole.DebugWriteLine("CD checksums", "Mode 0 sector at address {0:X2}:{1:X2}:{2:X2}", + channel[0x00C], channel[0x00D], channel[0x00E]); for(int i = 0x010; i < 0x930; i++) { if(channel[i] != 0x00) { - DicConsole.DebugWriteLine("CD checksums", "Mode 0 sector with error at address: {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); + DicConsole.DebugWriteLine("CD checksums", + "Mode 0 sector with error at address: {0:X2}:{1:X2}:{2:X2}", + channel[0x00C], channel[0x00D], channel[0x00E]); return false; } } + return true; } else if(channel[0x00F] == 0x01) // mode (1 byte) { - DicConsole.DebugWriteLine("CD checksums", "Mode 1 sector at address {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); + DicConsole.DebugWriteLine("CD checksums", "Mode 1 sector at address {0:X2}:{1:X2}:{2:X2}", + channel[0x00C], channel[0x00D], channel[0x00E]); if(channel[0x814] != 0x00 || // reserved (8 bytes) - channel[0x815] != 0x00 || - channel[0x816] != 0x00 || - channel[0x817] != 0x00 || - channel[0x818] != 0x00 || - channel[0x819] != 0x00 || - channel[0x81A] != 0x00 || - channel[0x81B] != 0x00) + channel[0x815] != 0x00 || channel[0x816] != 0x00 || channel[0x817] != 0x00 || + channel[0x818] != 0x00 || channel[0x819] != 0x00 || channel[0x81A] != 0x00 || + channel[0x81B] != 0x00) { - DicConsole.DebugWriteLine("CD checksums", "Mode 1 sector with data in reserved bytes at address: {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); + DicConsole.DebugWriteLine("CD checksums", + "Mode 1 sector with data in reserved bytes at address: {0:X2}:{1:X2}:{2:X2}", + channel[0x00C], channel[0x00D], channel[0x00E]); return false; } @@ -207,12 +176,15 @@ namespace DiscImageChef.Checksums bool FailedECC_Q = CheckECC(address, data2, 52, 43, 86, 88, ecc_q); if(FailedECC_P) - DicConsole.DebugWriteLine("CD checksums", "Mode 1 sector at address: {0:X2}:{1:X2}:{2:X2}, fails ECC P check", channel[0x00C], channel[0x00D], channel[0x00E]); + DicConsole.DebugWriteLine("CD checksums", + "Mode 1 sector at address: {0:X2}:{1:X2}:{2:X2}, fails ECC P check", + channel[0x00C], channel[0x00D], channel[0x00E]); if(FailedECC_Q) - DicConsole.DebugWriteLine("CD checksums", "Mode 1 sector at address: {0:X2}:{1:X2}:{2:X2}, fails ECC Q check", channel[0x00C], channel[0x00D], channel[0x00E]); + DicConsole.DebugWriteLine("CD checksums", + "Mode 1 sector at address: {0:X2}:{1:X2}:{2:X2}, fails ECC Q check", + channel[0x00C], channel[0x00D], channel[0x00E]); - if(FailedECC_P || FailedECC_Q) - return false; + if(FailedECC_P || FailedECC_Q) return false; /* TODO: This is not working byte[] SectorForCheck = new byte[0x810]; @@ -232,13 +204,17 @@ namespace DiscImageChef.Checksums } else if(channel[0x00F] == 0x02) // mode (1 byte) { - DicConsole.DebugWriteLine("CD checksums", "Mode 2 sector at address {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); + DicConsole.DebugWriteLine("CD checksums", "Mode 2 sector at address {0:X2}:{1:X2}:{2:X2}", + channel[0x00C], channel[0x00D], channel[0x00E]); if((channel[0x012] & 0x20) == 0x20) // mode 2 form 2 { - if(channel[0x010] != channel[0x014] || channel[0x011] != channel[0x015] || channel[0x012] != channel[0x016] || channel[0x013] != channel[0x017]) + if(channel[0x010] != channel[0x014] || channel[0x011] != channel[0x015] || + channel[0x012] != channel[0x016] || channel[0x013] != channel[0x017]) { - DicConsole.DebugWriteLine("CD checksums", "Subheader copies differ in mode 2 form 2 sector at address: {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); + DicConsole.DebugWriteLine("CD checksums", + "Subheader copies differ in mode 2 form 2 sector at address: {0:X2}:{1:X2}:{2:X2}", + channel[0x00C], channel[0x00D], channel[0x00E]); } /* TODO: This is not working @@ -257,9 +233,12 @@ namespace DiscImageChef.Checksums } else { - if(channel[0x010] != channel[0x014] || channel[0x011] != channel[0x015] || channel[0x012] != channel[0x016] || channel[0x013] != channel[0x017]) + if(channel[0x010] != channel[0x014] || channel[0x011] != channel[0x015] || + channel[0x012] != channel[0x016] || channel[0x013] != channel[0x017]) { - DicConsole.DebugWriteLine("CD checksums", "Subheader copies differ in mode 2 form 1 sector at address: {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); + DicConsole.DebugWriteLine("CD checksums", + "Subheader copies differ in mode 2 form 1 sector at address: {0:X2}:{1:X2}:{2:X2}", + channel[0x00C], channel[0x00D], channel[0x00E]); } byte[] address = new byte[4]; @@ -281,12 +260,15 @@ namespace DiscImageChef.Checksums bool FailedECC_Q = CheckECC(address, data2, 52, 43, 86, 88, ecc_q); if(FailedECC_P) - DicConsole.DebugWriteLine("CD checksums", "Mode 2 form 1 sector at address: {0:X2}:{1:X2}:{2:X2}, fails ECC P check", channel[0x00C], channel[0x00D], channel[0x00E]); + DicConsole.DebugWriteLine("CD checksums", + "Mode 2 form 1 sector at address: {0:X2}:{1:X2}:{2:X2}, fails ECC P check", + channel[0x00C], channel[0x00D], channel[0x00E]); if(FailedECC_Q) - DicConsole.DebugWriteLine("CD checksums", "Mode 2 form 1 sector at address: {0:X2}:{1:X2}:{2:X2}, fails ECC Q check", channel[0x00F], channel[0x00C], channel[0x00D], channel[0x00E]); + DicConsole.DebugWriteLine("CD checksums", + "Mode 2 form 1 sector at address: {0:X2}:{1:X2}:{2:X2}, fails ECC Q check", + channel[0x00F], channel[0x00C], channel[0x00D], channel[0x00E]); - if(FailedECC_P || FailedECC_Q) - return false; + if(FailedECC_P || FailedECC_Q) return false; /* TODO: This is not working byte[] SectorForCheck = new byte[0x808]; @@ -307,10 +289,13 @@ namespace DiscImageChef.Checksums } else { - DicConsole.DebugWriteLine("CD checksums", "Unknown mode {0} sector at address: {1:X2}:{2:X2}:{3:X2}", channel[0x00F], channel[0x00C], channel[0x00D], channel[0x00E]); + DicConsole.DebugWriteLine("CD checksums", + "Unknown mode {0} sector at address: {1:X2}:{2:X2}:{3:X2}", + channel[0x00F], channel[0x00C], channel[0x00D], channel[0x00E]); return null; } } + return null; } @@ -328,8 +313,7 @@ namespace DiscImageChef.Checksums byte[] CDSubRWPack4 = new byte[24]; int i = 0; - for(int j = 0; j < 12; j++) - QSubChannel[j] = 0; + for(int j = 0; j < 12; j++) QSubChannel[j] = 0; for(int j = 0; j < 18; j++) { CDTextPack1[j] = 0; @@ -360,82 +344,46 @@ namespace DiscImageChef.Checksums i = 0; for(int j = 0; j < 18; j++) { - if(j < 18) - CDTextPack1[j] = (byte)(CDTextPack1[j] | ((subchannel[i++] & 0x3F) << 2)); - if(j < 18) - CDTextPack1[j] = (byte)(CDTextPack1[j++] | ((subchannel[i] & 0xC0) >> 4)); - if(j < 18) - CDTextPack1[j] = (byte)(CDTextPack1[j] | ((subchannel[i++] & 0x0F) << 4)); - if(j < 18) - CDTextPack1[j] = (byte)(CDTextPack1[j++] | ((subchannel[i] & 0x3C) >> 2)); - if(j < 18) - CDTextPack1[j] = (byte)(CDTextPack1[j] | ((subchannel[i++] & 0x03) << 6)); - if(j < 18) - CDTextPack1[j] = (byte)(CDTextPack1[j] | (subchannel[i++] & 0x3F)); + if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j] | ((subchannel[i++] & 0x3F) << 2)); + if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j++] | ((subchannel[i] & 0xC0) >> 4)); + if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j] | ((subchannel[i++] & 0x0F) << 4)); + if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j++] | ((subchannel[i] & 0x3C) >> 2)); + if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j] | ((subchannel[i++] & 0x03) << 6)); + if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j] | (subchannel[i++] & 0x3F)); } for(int j = 0; j < 18; j++) { - if(j < 18) - CDTextPack2[j] = (byte)(CDTextPack2[j] | ((subchannel[i++] & 0x3F) << 2)); - if(j < 18) - CDTextPack2[j] = (byte)(CDTextPack2[j++] | ((subchannel[i] & 0xC0) >> 4)); - if(j < 18) - CDTextPack2[j] = (byte)(CDTextPack2[j] | ((subchannel[i++] & 0x0F) << 4)); - if(j < 18) - CDTextPack2[j] = (byte)(CDTextPack2[j++] | ((subchannel[i] & 0x3C) >> 2)); - if(j < 18) - CDTextPack2[j] = (byte)(CDTextPack2[j] | ((subchannel[i++] & 0x03) << 6)); - if(j < 18) - CDTextPack2[j] = (byte)(CDTextPack2[j] | (subchannel[i++] & 0x3F)); + if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j] | ((subchannel[i++] & 0x3F) << 2)); + if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j++] | ((subchannel[i] & 0xC0) >> 4)); + if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j] | ((subchannel[i++] & 0x0F) << 4)); + if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j++] | ((subchannel[i] & 0x3C) >> 2)); + if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j] | ((subchannel[i++] & 0x03) << 6)); + if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j] | (subchannel[i++] & 0x3F)); } for(int j = 0; j < 18; j++) { - if(j < 18) - CDTextPack3[j] = (byte)(CDTextPack3[j] | ((subchannel[i++] & 0x3F) << 2)); - if(j < 18) - CDTextPack3[j] = (byte)(CDTextPack3[j++] | ((subchannel[i] & 0xC0) >> 4)); - if(j < 18) - CDTextPack3[j] = (byte)(CDTextPack3[j] | ((subchannel[i++] & 0x0F) << 4)); - if(j < 18) - CDTextPack3[j] = (byte)(CDTextPack3[j++] | ((subchannel[i] & 0x3C) >> 2)); - if(j < 18) - CDTextPack3[j] = (byte)(CDTextPack3[j] | ((subchannel[i++] & 0x03) << 6)); - if(j < 18) - CDTextPack3[j] = (byte)(CDTextPack3[j] | (subchannel[i++] & 0x3F)); + if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j] | ((subchannel[i++] & 0x3F) << 2)); + if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j++] | ((subchannel[i] & 0xC0) >> 4)); + if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j] | ((subchannel[i++] & 0x0F) << 4)); + if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j++] | ((subchannel[i] & 0x3C) >> 2)); + if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j] | ((subchannel[i++] & 0x03) << 6)); + if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j] | (subchannel[i++] & 0x3F)); } for(int j = 0; j < 18; j++) { - if(j < 18) - CDTextPack4[j] = (byte)(CDTextPack4[j] | ((subchannel[i++] & 0x3F) << 2)); - if(j < 18) - CDTextPack4[j] = (byte)(CDTextPack4[j++] | ((subchannel[i] & 0xC0) >> 4)); - if(j < 18) - CDTextPack4[j] = (byte)(CDTextPack4[j] | ((subchannel[i++] & 0x0F) << 4)); - if(j < 18) - CDTextPack4[j] = (byte)(CDTextPack4[j++] | ((subchannel[i] & 0x3C) >> 2)); - if(j < 18) - CDTextPack4[j] = (byte)(CDTextPack4[j] | ((subchannel[i++] & 0x03) << 6)); - if(j < 18) - CDTextPack4[j] = (byte)(CDTextPack4[j] | (subchannel[i++] & 0x3F)); + if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j] | ((subchannel[i++] & 0x3F) << 2)); + if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j++] | ((subchannel[i] & 0xC0) >> 4)); + if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j] | ((subchannel[i++] & 0x0F) << 4)); + if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j++] | ((subchannel[i] & 0x3C) >> 2)); + if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j] | ((subchannel[i++] & 0x03) << 6)); + if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j] | (subchannel[i++] & 0x3F)); } i = 0; - for(int j = 0; j < 24; j++) - { - CDSubRWPack1[j] = (byte)(subchannel[i++] & 0x3F); - } - for(int j = 0; j < 24; j++) - { - CDSubRWPack2[j] = (byte)(subchannel[i++] & 0x3F); - } - for(int j = 0; j < 24; j++) - { - CDSubRWPack3[j] = (byte)(subchannel[i++] & 0x3F); - } - for(int j = 0; j < 24; j++) - { - CDSubRWPack4[j] = (byte)(subchannel[i++] & 0x3F); - } + for(int j = 0; j < 24; j++) { CDSubRWPack1[j] = (byte)(subchannel[i++] & 0x3F); } + for(int j = 0; j < 24; j++) { CDSubRWPack2[j] = (byte)(subchannel[i++] & 0x3F); } + for(int j = 0; j < 24; j++) { CDSubRWPack3[j] = (byte)(subchannel[i++] & 0x3F); } + for(int j = 0; j < 24; j++) { CDSubRWPack4[j] = (byte)(subchannel[i++] & 0x3F); } switch(CDSubRWPack1[0]) { @@ -461,7 +409,10 @@ namespace DiscImageChef.Checksums DicConsole.DebugWriteLine("CD checksums", "Detected User Pack in subchannel"); break; default: - DicConsole.DebugWriteLine("CD checksums", "Detected unknown Pack type in subchannel: mode {0}, item {1}", Convert.ToString(CDSubRWPack1[0] & 0x38, 2), Convert.ToString(CDSubRWPack1[0] & 0x07, 2)); + DicConsole.DebugWriteLine("CD checksums", + "Detected unknown Pack type in subchannel: mode {0}, item {1}", + Convert.ToString(CDSubRWPack1[0] & 0x38, 2), + Convert.ToString(CDSubRWPack1[0] & 0x07, 2)); break; } @@ -474,7 +425,8 @@ namespace DiscImageChef.Checksums if(QSubChannelCRC != CalculatedQCRC) { - DicConsole.DebugWriteLine("CD checksums", "Q subchannel CRC 0x{0:X4}, expected 0x{1:X4}", CalculatedQCRC, QSubChannelCRC); + DicConsole.DebugWriteLine("CD checksums", "Q subchannel CRC 0x{0:X4}, expected 0x{1:X4}", + CalculatedQCRC, QSubChannelCRC); status = false; } @@ -487,7 +439,8 @@ namespace DiscImageChef.Checksums if(CDTextPack1CRC != CalculatedCDTP1CRC && CDTextPack1CRC != 0) { - DicConsole.DebugWriteLine("CD checksums", "CD-Text Pack 1 CRC 0x{0:X4}, expected 0x{1:X4}", CDTextPack1CRC, CalculatedCDTP1CRC); + DicConsole.DebugWriteLine("CD checksums", "CD-Text Pack 1 CRC 0x{0:X4}, expected 0x{1:X4}", + CDTextPack1CRC, CalculatedCDTP1CRC); status = false; } } @@ -498,11 +451,13 @@ namespace DiscImageChef.Checksums byte[] CDTextPack2ForCRC = new byte[16]; Array.Copy(CDTextPack2, 0, CDTextPack2ForCRC, 0, 16); ushort CalculatedCDTP2CRC = CalculateCCITT_CRC16(CDTextPack2ForCRC); - DicConsole.DebugWriteLine("CD checksums", "Cyclic CDTP2 0x{0:X4}, Calc CDTP2 0x{1:X4}", CDTextPack2CRC, CalculatedCDTP2CRC); + DicConsole.DebugWriteLine("CD checksums", "Cyclic CDTP2 0x{0:X4}, Calc CDTP2 0x{1:X4}", CDTextPack2CRC, + CalculatedCDTP2CRC); if(CDTextPack2CRC != CalculatedCDTP2CRC && CDTextPack2CRC != 0) { - DicConsole.DebugWriteLine("CD checksums", "CD-Text Pack 2 CRC 0x{0:X4}, expected 0x{1:X4}", CDTextPack2CRC, CalculatedCDTP2CRC); + DicConsole.DebugWriteLine("CD checksums", "CD-Text Pack 2 CRC 0x{0:X4}, expected 0x{1:X4}", + CDTextPack2CRC, CalculatedCDTP2CRC); status = false; } } @@ -513,11 +468,13 @@ namespace DiscImageChef.Checksums byte[] CDTextPack3ForCRC = new byte[16]; Array.Copy(CDTextPack3, 0, CDTextPack3ForCRC, 0, 16); ushort CalculatedCDTP3CRC = CalculateCCITT_CRC16(CDTextPack3ForCRC); - DicConsole.DebugWriteLine("CD checksums", "Cyclic CDTP3 0x{0:X4}, Calc CDTP3 0x{1:X4}", CDTextPack3CRC, CalculatedCDTP3CRC); + DicConsole.DebugWriteLine("CD checksums", "Cyclic CDTP3 0x{0:X4}, Calc CDTP3 0x{1:X4}", CDTextPack3CRC, + CalculatedCDTP3CRC); if(CDTextPack3CRC != CalculatedCDTP3CRC && CDTextPack3CRC != 0) { - DicConsole.DebugWriteLine("CD checksums", "CD-Text Pack 3 CRC 0x{0:X4}, expected 0x{1:X4}", CDTextPack3CRC, CalculatedCDTP3CRC); + DicConsole.DebugWriteLine("CD checksums", "CD-Text Pack 3 CRC 0x{0:X4}, expected 0x{1:X4}", + CDTextPack3CRC, CalculatedCDTP3CRC); status = false; } } @@ -528,11 +485,13 @@ namespace DiscImageChef.Checksums byte[] CDTextPack4ForCRC = new byte[16]; Array.Copy(CDTextPack4, 0, CDTextPack4ForCRC, 0, 16); ushort CalculatedCDTP4CRC = CalculateCCITT_CRC16(CDTextPack4ForCRC); - DicConsole.DebugWriteLine("CD checksums", "Cyclic CDTP4 0x{0:X4}, Calc CDTP4 0x{1:X4}", CDTextPack4CRC, CalculatedCDTP4CRC); + DicConsole.DebugWriteLine("CD checksums", "Cyclic CDTP4 0x{0:X4}, Calc CDTP4 0x{1:X4}", CDTextPack4CRC, + CalculatedCDTP4CRC); if(CDTextPack4CRC != CalculatedCDTP4CRC && CDTextPack4CRC != 0) { - DicConsole.DebugWriteLine("CD checksums", "CD-Text Pack 4 CRC 0x{0:X4}, expected 0x{1:X4}", CDTextPack4CRC, CalculatedCDTP4CRC); + DicConsole.DebugWriteLine("CD checksums", "CD-Text Pack 4 CRC 0x{0:X4}, expected 0x{1:X4}", + CDTextPack4CRC, CalculatedCDTP4CRC); status = false; } } @@ -542,38 +501,26 @@ namespace DiscImageChef.Checksums static readonly ushort[] CCITT_CRC16Table = { - 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, - 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, - 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, - 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, - 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, - 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, - 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, - 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, - 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, - 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, - 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, - 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, - 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, - 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, - 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, - 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, - 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, - 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, - 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, - 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, - 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, - 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, - 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, - 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, - 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, - 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, - 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, - 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, - 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, - 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, - 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, - 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, + 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, + 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, + 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, + 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, + 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, + 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, + 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, + 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, + 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, + 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, + 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, + 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, + 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, + 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, + 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, + 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, + 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, + 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, + 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 }; static ushort CalculateCCITT_CRC16(byte[] buffer) @@ -583,10 +530,10 @@ namespace DiscImageChef.Checksums { CRC16 = (ushort)(CCITT_CRC16Table[(CRC16 >> 8) ^ buffer[i]] ^ (CRC16 << 8)); } + CRC16 = (ushort)~CRC16; return CRC16; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Checksums/CRC16Context.cs b/DiscImageChef.Checksums/CRC16Context.cs index d2ab1bc8..fb853c74 100644 --- a/DiscImageChef.Checksums/CRC16Context.cs +++ b/DiscImageChef.Checksums/CRC16Context.cs @@ -59,10 +59,9 @@ namespace DiscImageChef.Checksums { ushort entry = (ushort)i; for(int j = 0; j < 8; j++) - if((entry & 1) == 1) - entry = (ushort)((entry >> 1) ^ crc16Poly); - else - entry = (ushort)(entry >> 1); + if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ crc16Poly); + else entry = (ushort)(entry >> 1); + table[i] = entry; } } @@ -74,8 +73,7 @@ namespace DiscImageChef.Checksums /// Length of buffer to hash. public void Update(byte[] data, uint len) { - for(int i = 0; i < len; i++) - hashInt = (ushort)((hashInt >> 8) ^ table[data[i] ^ (hashInt & 0xFF)]); + for(int i = 0; i < len; i++) hashInt = (ushort)((hashInt >> 8) ^ table[data[i] ^ (hashInt & 0xFF)]); } /// @@ -143,10 +141,9 @@ namespace DiscImageChef.Checksums { ushort entry = (ushort)i; for(int j = 0; j < 8; j++) - if((entry & 1) == 1) - entry = (ushort)((entry >> 1) ^ crc16Poly); - else - entry = (ushort)(entry >> 1); + if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ crc16Poly); + else entry = (ushort)(entry >> 1); + localTable[i] = entry; } @@ -158,10 +155,7 @@ namespace DiscImageChef.Checksums StringBuilder crc16Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - crc16Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { crc16Output.Append(hash[i].ToString("x2")); } fileStream.Close(); @@ -199,10 +193,9 @@ namespace DiscImageChef.Checksums { ushort entry = (ushort)i; for(int j = 0; j < 8; j++) - if((entry & 1) == 1) - entry = (ushort)((entry >> 1) ^ polynomial); - else - entry = (ushort)(entry >> 1); + if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ polynomial); + else entry = (ushort)(entry >> 1); + localTable[i] = entry; } @@ -214,10 +207,7 @@ namespace DiscImageChef.Checksums StringBuilder crc16Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - crc16Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { crc16Output.Append(hash[i].ToString("x2")); } return crc16Output.ToString(); } @@ -232,5 +222,4 @@ namespace DiscImageChef.Checksums return Data(data, (uint)data.Length, out hash); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Checksums/CRC32Context.cs b/DiscImageChef.Checksums/CRC32Context.cs index 1827c44d..d99bc7c7 100644 --- a/DiscImageChef.Checksums/CRC32Context.cs +++ b/DiscImageChef.Checksums/CRC32Context.cs @@ -59,10 +59,9 @@ namespace DiscImageChef.Checksums { uint entry = (uint)i; for(int j = 0; j < 8; j++) - if((entry & 1) == 1) - entry = (entry >> 1) ^ crc32Poly; - else - entry = entry >> 1; + if((entry & 1) == 1) entry = (entry >> 1) ^ crc32Poly; + else entry = entry >> 1; + table[i] = entry; } } @@ -74,8 +73,7 @@ namespace DiscImageChef.Checksums /// Length of buffer to hash. public void Update(byte[] data, uint len) { - for(int i = 0; i < len; i++) - hashInt = (hashInt >> 8) ^ table[data[i] ^ hashInt & 0xff]; + for(int i = 0; i < len; i++) hashInt = (hashInt >> 8) ^ table[data[i] ^ hashInt & 0xff]; } /// @@ -143,10 +141,9 @@ namespace DiscImageChef.Checksums { uint entry = (uint)i; for(int j = 0; j < 8; j++) - if((entry & 1) == 1) - entry = (entry >> 1) ^ crc32Poly; - else - entry = entry >> 1; + if((entry & 1) == 1) entry = (entry >> 1) ^ crc32Poly; + else entry = entry >> 1; + localTable[i] = entry; } @@ -159,10 +156,7 @@ namespace DiscImageChef.Checksums StringBuilder crc32Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - crc32Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { crc32Output.Append(hash[i].ToString("x2")); } fileStream.Close(); @@ -200,15 +194,13 @@ namespace DiscImageChef.Checksums { uint entry = (uint)i; for(int j = 0; j < 8; j++) - if((entry & 1) == 1) - entry = (entry >> 1) ^ polynomial; - else - entry = entry >> 1; + if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial; + else entry = entry >> 1; + localTable[i] = entry; } - for(int i = 0; i < len; i++) - localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ localhashInt & 0xff]; + for(int i = 0; i < len; i++) localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ localhashInt & 0xff]; localhashInt ^= crc32Seed; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -216,10 +208,7 @@ namespace DiscImageChef.Checksums StringBuilder crc32Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - crc32Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { crc32Output.Append(hash[i].ToString("x2")); } return crc32Output.ToString(); } @@ -234,6 +223,4 @@ namespace DiscImageChef.Checksums return Data(data, (uint)data.Length, out hash); } } -} - - +} \ No newline at end of file diff --git a/DiscImageChef.Checksums/CRC64Context.cs b/DiscImageChef.Checksums/CRC64Context.cs index c42fa201..cb17db0c 100644 --- a/DiscImageChef.Checksums/CRC64Context.cs +++ b/DiscImageChef.Checksums/CRC64Context.cs @@ -58,10 +58,9 @@ namespace DiscImageChef.Checksums { ulong entry = (ulong)i; for(int j = 0; j < 8; j++) - if((entry & 1) == 1) - entry = (entry >> 1) ^ crc64Poly; - else - entry = entry >> 1; + if((entry & 1) == 1) entry = (entry >> 1) ^ crc64Poly; + else entry = entry >> 1; + table[i] = entry; } } @@ -73,8 +72,7 @@ namespace DiscImageChef.Checksums /// Length of buffer to hash. public void Update(byte[] data, uint len) { - for(int i = 0; i < len; i++) - hashInt = (hashInt >> 8) ^ table[data[i] ^ hashInt & 0xff]; + for(int i = 0; i < len; i++) hashInt = (hashInt >> 8) ^ table[data[i] ^ hashInt & 0xff]; } /// @@ -142,10 +140,9 @@ namespace DiscImageChef.Checksums { ulong entry = (ulong)i; for(int j = 0; j < 8; j++) - if((entry & 1) == 1) - entry = (entry >> 1) ^ crc64Poly; - else - entry = entry >> 1; + if((entry & 1) == 1) entry = (entry >> 1) ^ crc64Poly; + else entry = entry >> 1; + localTable[i] = entry; } @@ -158,10 +155,7 @@ namespace DiscImageChef.Checksums StringBuilder crc64Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - crc64Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { crc64Output.Append(hash[i].ToString("x2")); } fileStream.Close(); @@ -199,15 +193,13 @@ namespace DiscImageChef.Checksums { ulong entry = (ulong)i; for(int j = 0; j < 8; j++) - if((entry & 1) == 1) - entry = (entry >> 1) ^ polynomial; - else - entry = entry >> 1; + if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial; + else entry = entry >> 1; + localTable[i] = entry; } - for(int i = 0; i < len; i++) - localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ localhashInt & 0xff]; + for(int i = 0; i < len; i++) localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ localhashInt & 0xff]; localhashInt ^= crc64Seed; BigEndianBitConverter.IsLittleEndian = BigEndianBitConverter.IsLittleEndian; @@ -215,10 +207,7 @@ namespace DiscImageChef.Checksums StringBuilder crc64Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - crc64Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { crc64Output.Append(hash[i].ToString("x2")); } return crc64Output.ToString(); } @@ -233,6 +222,4 @@ namespace DiscImageChef.Checksums return Data(data, (uint)data.Length, out hash); } } -} - - +} \ No newline at end of file diff --git a/DiscImageChef.Checksums/FletcherContext.cs b/DiscImageChef.Checksums/FletcherContext.cs index 1e7c241e..13982c8a 100644 --- a/DiscImageChef.Checksums/FletcherContext.cs +++ b/DiscImageChef.Checksums/FletcherContext.cs @@ -453,3 +453,4 @@ namespace DiscImageChef.Checksums } } */ + diff --git a/DiscImageChef.Checksums/MD5Context.cs b/DiscImageChef.Checksums/MD5Context.cs index 943d230c..67898610 100644 --- a/DiscImageChef.Checksums/MD5Context.cs +++ b/DiscImageChef.Checksums/MD5Context.cs @@ -87,10 +87,7 @@ namespace DiscImageChef.Checksums _md5Provider.TransformFinalBlock(new byte[0], 0, 0); StringBuilder md5Output = new StringBuilder(); - for(int i = 0; i < _md5Provider.Hash.Length; i++) - { - md5Output.Append(_md5Provider.Hash[i].ToString("x2")); - } + for(int i = 0; i < _md5Provider.Hash.Length; i++) { md5Output.Append(_md5Provider.Hash[i].ToString("x2")); } return md5Output.ToString(); } @@ -118,10 +115,7 @@ namespace DiscImageChef.Checksums hash = _md5Provider.ComputeHash(fileStream); StringBuilder md5Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - md5Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { md5Output.Append(hash[i].ToString("x2")); } fileStream.Close(); @@ -139,10 +133,7 @@ namespace DiscImageChef.Checksums hash = _md5Provider.ComputeHash(data, 0, (int)len); StringBuilder md5Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - md5Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { md5Output.Append(hash[i].ToString("x2")); } return md5Output.ToString(); } @@ -157,5 +148,4 @@ namespace DiscImageChef.Checksums return Data(data, (uint)data.Length, out hash); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Checksums/Properties/AssemblyInfo.cs b/DiscImageChef.Checksums/Properties/AssemblyInfo.cs index 4cdf7a7f..f939ed83 100644 --- a/DiscImageChef.Checksums/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Checksums/Properties/AssemblyInfo.cs @@ -54,5 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Checksums/RIPEMD160Context.cs b/DiscImageChef.Checksums/RIPEMD160Context.cs index 3709f994..60028593 100644 --- a/DiscImageChef.Checksums/RIPEMD160Context.cs +++ b/DiscImageChef.Checksums/RIPEMD160Context.cs @@ -118,10 +118,7 @@ namespace DiscImageChef.Checksums hash = _ripemd160Provider.ComputeHash(fileStream); StringBuilder ripemd160Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - ripemd160Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { ripemd160Output.Append(hash[i].ToString("x2")); } fileStream.Close(); @@ -139,10 +136,7 @@ namespace DiscImageChef.Checksums hash = _ripemd160Provider.ComputeHash(data, 0, (int)len); StringBuilder ripemd160Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - ripemd160Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { ripemd160Output.Append(hash[i].ToString("x2")); } return ripemd160Output.ToString(); } @@ -157,5 +151,4 @@ namespace DiscImageChef.Checksums return Data(data, (uint)data.Length, out hash); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Checksums/ReedSolomon.cs b/DiscImageChef.Checksums/ReedSolomon.cs index c005ceec..e85384df 100644 --- a/DiscImageChef.Checksums/ReedSolomon.cs +++ b/DiscImageChef.Checksums/ReedSolomon.cs @@ -94,52 +94,51 @@ namespace DiscImageChef.Checksums switch(m) { case 2: - Pp = new[] { 1, 1, 1 }; + Pp = new[] {1, 1, 1}; break; case 3: - Pp = new[] { 1, 1, 0, 1 }; + Pp = new[] {1, 1, 0, 1}; break; case 4: - Pp = new[] { 1, 1, 0, 0, 1 }; + Pp = new[] {1, 1, 0, 0, 1}; break; case 5: - Pp = new[] { 1, 0, 1, 0, 0, 1 }; + Pp = new[] {1, 0, 1, 0, 0, 1}; break; case 6: - Pp = new[] { 1, 1, 0, 0, 0, 0, 1 }; + Pp = new[] {1, 1, 0, 0, 0, 0, 1}; break; case 7: - Pp = new[] { 1, 0, 0, 1, 0, 0, 0, 1 }; + Pp = new[] {1, 0, 0, 1, 0, 0, 0, 1}; break; case 8: - Pp = new[] { 1, 0, 1, 1, 1, 0, 0, 0, 1 }; + Pp = new[] {1, 0, 1, 1, 1, 0, 0, 0, 1}; break; case 9: - Pp = new[] { 1, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; + Pp = new[] {1, 0, 0, 0, 1, 0, 0, 0, 0, 1}; break; case 10: - Pp = new[] { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 }; + Pp = new[] {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1}; break; case 11: - Pp = new[] { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + Pp = new[] {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}; break; case 12: - Pp = new[] { 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1 }; + Pp = new[] {1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1}; break; case 13: - Pp = new[] { 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + Pp = new[] {1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}; break; case 14: - Pp = new[] { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 }; + Pp = new[] {1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1}; break; case 15: - Pp = new[] { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + Pp = new[] {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; break; case 16: - Pp = new[] { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1 }; + Pp = new[] {1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}; break; - default: - throw new ArgumentOutOfRangeException(nameof(m), "m must be between 2 and 16 inclusive"); + default: throw new ArgumentOutOfRangeException(nameof(m), "m must be between 2 and 16 inclusive"); } MM = m; @@ -149,7 +148,6 @@ namespace DiscImageChef.Checksums Alpha_to = new int[n + 1]; Index_of = new int[n + 1]; - Gg = new int[NN - KK + 1]; generate_gf(); @@ -165,6 +163,7 @@ namespace DiscImageChef.Checksums x -= NN; x = (x >> MM) + (x & NN); } + return x; } @@ -176,22 +175,19 @@ namespace DiscImageChef.Checksums static void CLEAR(ref int[] a, int n) { int ci; - for(ci = (n) - 1; ci >= 0; ci--) - (a)[ci] = 0; + for(ci = (n) - 1; ci >= 0; ci--) (a)[ci] = 0; } static void COPY(ref int[] a, ref int[] b, int n) { int ci; - for(ci = (n) - 1; ci >= 0; ci--) - (a)[ci] = (b)[ci]; + for(ci = (n) - 1; ci >= 0; ci--) (a)[ci] = (b)[ci]; } static void COPYDOWN(ref int[] a, ref int[] b, int n) { int ci; - for(ci = (n) - 1; ci >= 0; ci--) - (a)[ci] = (b)[ci]; + for(ci = (n) - 1; ci >= 0; ci--) (a)[ci] = (b)[ci]; } /* generate GF(2**m) from the irreducible polynomial p(X) in p[0]..p[m] @@ -235,10 +231,10 @@ namespace DiscImageChef.Checksums Alpha_to[i] = mask; Index_of[Alpha_to[i]] = i; /* If Pp[i] == 1 then, term @^i occurs in poly-repr of @^MM */ - if(Pp[i] != 0) - Alpha_to[MM] ^= mask; /* Bit-wise EXOR operation */ + if(Pp[i] != 0) Alpha_to[MM] ^= mask; /* Bit-wise EXOR operation */ mask <<= 1; /* single left-shift */ } + Index_of[Alpha_to[MM]] = MM; /* * Have obtained poly-repr of @^MM. Poly-repr of @^(i+1) is given by @@ -248,12 +244,11 @@ namespace DiscImageChef.Checksums mask >>= 1; for(i = MM + 1; i < NN; i++) { - if(Alpha_to[i - 1] >= mask) - Alpha_to[i] = Alpha_to[MM] ^ ((Alpha_to[i - 1] ^ mask) << 1); - else - Alpha_to[i] = Alpha_to[i - 1] << 1; + if(Alpha_to[i - 1] >= mask) Alpha_to[i] = Alpha_to[MM] ^ ((Alpha_to[i - 1] ^ mask) << 1); + else Alpha_to[i] = Alpha_to[i - 1] << 1; Index_of[Alpha_to[i]] = i; } + Index_of[0] = A0; Alpha_to[NN] = 0; } @@ -276,7 +271,7 @@ namespace DiscImageChef.Checksums int i, j; Gg[0] = Alpha_to[B0]; - Gg[1] = 1; /* g(x) = (X+@**B0) initially */ + Gg[1] = 1; /* g(x) = (X+@**B0) initially */ for(i = 2; i <= NN - KK; i++) { Gg[i] = 1; @@ -285,16 +280,13 @@ namespace DiscImageChef.Checksums * (@**(B0+i-1) + x) */ for(j = i - 1; j > 0; j--) - if(Gg[j] != 0) - Gg[j] = Gg[j - 1] ^ Alpha_to[modnn((Index_of[Gg[j]]) + B0 + i - 1)]; - else - Gg[j] = Gg[j - 1]; + if(Gg[j] != 0) Gg[j] = Gg[j - 1] ^ Alpha_to[modnn((Index_of[Gg[j]]) + B0 + i - 1)]; + else Gg[j] = Gg[j - 1]; /* Gg[0] can never be zero */ Gg[0] = Alpha_to[modnn((Index_of[Gg[0]]) + B0 + i - 1)]; } /* convert Gg[] to index form for quicker encoding */ - for(i = 0; i <= NN - KK; i++) - Gg[i] = Index_of[Gg[i]]; + for(i = 0; i <= NN - KK; i++) Gg[i] = Index_of[Gg[i]]; } /* @@ -322,31 +314,31 @@ namespace DiscImageChef.Checksums CLEAR(ref bb, NN - KK); for(i = KK - 1; i >= 0; i--) { - if(MM != 8) - { - if(data[i] > NN) - return -1; /* Illegal symbol */ - } + if(MM != 8) { if(data[i] > NN) return -1; /* Illegal symbol */ } + feedback = Index_of[data[i] ^ bb[NN - KK - 1]]; if(feedback != A0) - { /* feedback term is non-zero */ + { + /* feedback term is non-zero */ for(j = NN - KK - 1; j > 0; j--) - if(Gg[j] != A0) - bb[j] = bb[j - 1] ^ Alpha_to[modnn(Gg[j] + feedback)]; - else - bb[j] = bb[j - 1]; + if(Gg[j] != A0) bb[j] = bb[j - 1] ^ Alpha_to[modnn(Gg[j] + feedback)]; + else bb[j] = bb[j - 1]; + bb[0] = Alpha_to[modnn(Gg[0] + feedback)]; } else - { /* feedback term is zero. encoder becomes a - * single-byte shifter */ - for(j = NN - KK - 1; j > 0; j--) - bb[j] = bb[j - 1]; + { + /* feedback term is zero. encoder becomes a + * single-byte shifter */ + for(j = NN - KK - 1; j > 0; j--) bb[j] = bb[j - 1]; + bb[0] = 0; } } + return 0; } + throw new UnauthorizedAccessException("Trying to calculate RS without initializing!"); } @@ -392,11 +384,8 @@ namespace DiscImageChef.Checksums /* data[] is in polynomial form, copy and convert to index form */ for(i = NN - 1; i >= 0; i--) { - if(MM != 8) - { - if(data[i] > NN) - return -1; /* Illegal symbol */ - } + if(MM != 8) { if(data[i] > NN) return -1; /* Illegal symbol */ } + recd[i] = Index_of[data[i]]; } /* first form the syndromes; i.e., evaluate recd(x) at roots of g(x) @@ -407,13 +396,15 @@ namespace DiscImageChef.Checksums { tmp = 0; for(j = 0; j < NN; j++) - if(recd[j] != A0) /* recd[j] in index form */ + if(recd[j] != A0) /* recd[j] in index form */ tmp ^= Alpha_to[modnn(recd[j] + (B0 + i - 1) * j)]; - syn_error |= tmp; /* set flag if non-zero syndrome => + + syn_error |= tmp; /* set flag if non-zero syndrome => * error */ /* store syndrome in index form */ s[i] = Index_of[tmp]; } + if(syn_error == 0) { /* @@ -422,6 +413,7 @@ namespace DiscImageChef.Checksums */ return 0; } + CLEAR(ref lambda, NN - KK); lambda[0] = 1; if(no_eras > 0) @@ -434,15 +426,14 @@ namespace DiscImageChef.Checksums for(j = i + 1; j > 0; j--) { tmp = Index_of[lambda[j - 1]]; - if(tmp != A0) - lambda[j] ^= Alpha_to[modnn(u + tmp)]; + if(tmp != A0) lambda[j] ^= Alpha_to[modnn(u + tmp)]; } } #if DEBUG /* find roots of the erasure location polynomial */ - for(i = 1; i <= no_eras; i++) - reg[i] = Index_of[lambda[i]]; + for(i = 1; i <= no_eras; i++) reg[i] = Index_of[lambda[i]]; + count = 0; for(i = 1; i <= NN; i++) { @@ -453,6 +444,7 @@ namespace DiscImageChef.Checksums reg[j] = modnn(reg[j] + j); q ^= Alpha_to[reg[j]]; } + if(q == 0) { /* store root and error location @@ -463,20 +455,22 @@ namespace DiscImageChef.Checksums count++; } } + if(count != no_eras) { DicConsole.DebugWriteLine("Reed Solomon", "\n lambda(x) is WRONG\n"); return -1; } - DicConsole.DebugWriteLine("Reed Solomon", "\n Erasure positions as determined by roots of Eras Loc Poly:\n"); - for(i = 0; i < count; i++) - DicConsole.DebugWriteLine("Reed Solomon", "{0} ", loc[i]); + DicConsole.DebugWriteLine("Reed Solomon", + "\n Erasure positions as determined by roots of Eras Loc Poly:\n"); + for(i = 0; i < count; i++) DicConsole.DebugWriteLine("Reed Solomon", "{0} ", loc[i]); + DicConsole.DebugWriteLine("Reed Solomon", "\n"); #endif } - for(i = 0; i < NN - KK + 1; i++) - b[i] = Index_of[lambda[i]]; + + for(i = 0; i < NN - KK + 1; i++) b[i] = Index_of[lambda[i]]; /* * Begin Berlekamp-Massey algorithm to determine error+erasure @@ -485,7 +479,8 @@ namespace DiscImageChef.Checksums r = no_eras; el = no_eras; while(++r <= NN - KK) - { /* r is the step number */ + { + /* r is the step number */ /* Compute discrepancy at the r-th step in poly-form */ discr_r = 0; for(i = 0; i < r; i++) @@ -495,7 +490,8 @@ namespace DiscImageChef.Checksums discr_r ^= Alpha_to[modnn(Index_of[lambda[i]] + s[r - i])]; } } - discr_r = Index_of[discr_r]; /* Index form */ + + discr_r = Index_of[discr_r]; /* Index form */ if(discr_r == A0) { /* 2 lines below: B(x) <-- x*B(x) */ @@ -508,11 +504,10 @@ namespace DiscImageChef.Checksums t[0] = lambda[0]; for(i = 0; i < NN - KK; i++) { - if(b[i] != A0) - t[i + 1] = lambda[i + 1] ^ Alpha_to[modnn(discr_r + b[i])]; - else - t[i + 1] = lambda[i + 1]; + if(b[i] != A0) t[i + 1] = lambda[i + 1] ^ Alpha_to[modnn(discr_r + b[i])]; + else t[i + 1] = lambda[i + 1]; } + if(2 * el <= r + no_eras - 1) { el = r + no_eras - el; @@ -529,6 +524,7 @@ namespace DiscImageChef.Checksums COPYDOWN(ref b, ref b, NN - KK); b[0] = A0; } + COPY(ref lambda, ref t, NN - KK + 1); } } @@ -538,8 +534,7 @@ namespace DiscImageChef.Checksums for(i = 0; i < NN - KK + 1; i++) { lambda[i] = Index_of[lambda[i]]; - if(lambda[i] != A0) - deg_lambda = i; + if(lambda[i] != A0) deg_lambda = i; } /* * Find roots of the error+erasure locator polynomial. By Chien @@ -548,7 +543,7 @@ namespace DiscImageChef.Checksums int temp = reg[0]; COPY(ref reg, ref lambda, NN - KK); reg[0] = temp; - count = 0; /* Number of roots of lambda(x) */ + count = 0; /* Number of roots of lambda(x) */ for(i = 1; i <= NN; i++) { q = 1; @@ -558,6 +553,7 @@ namespace DiscImageChef.Checksums reg[j] = modnn(reg[j] + j); q ^= Alpha_to[reg[j]]; } + if(q == 0) { /* store root (index-form) and error location number */ @@ -569,8 +565,8 @@ namespace DiscImageChef.Checksums #if DEBUG DicConsole.DebugWriteLine("Reed Solomon", "\n Final error positions:\t"); - for(i = 0; i < count; i++) - DicConsole.DebugWriteLine("Reed Solomon", "{0} ", loc[i]); + for(i = 0; i < count; i++) DicConsole.DebugWriteLine("Reed Solomon", "{0} ", loc[i]); + DicConsole.DebugWriteLine("Reed Solomon", "\n"); #endif @@ -593,13 +589,13 @@ namespace DiscImageChef.Checksums j = (deg_lambda < i) ? deg_lambda : i; for(; j >= 0; j--) { - if((s[i + 1 - j] != A0) && (lambda[j] != A0)) - tmp ^= Alpha_to[modnn(s[i + 1 - j] + lambda[j])]; + if((s[i + 1 - j] != A0) && (lambda[j] != A0)) tmp ^= Alpha_to[modnn(s[i + 1 - j] + lambda[j])]; } - if(tmp != 0) - deg_omega = i; + + if(tmp != 0) deg_omega = i; omega[i] = Index_of[tmp]; } + omega[NN - KK] = A0; /* @@ -611,18 +607,18 @@ namespace DiscImageChef.Checksums num1 = 0; for(i = deg_omega; i >= 0; i--) { - if(omega[i] != A0) - num1 ^= Alpha_to[modnn(omega[i] + i * root[j])]; + if(omega[i] != A0) num1 ^= Alpha_to[modnn(omega[i] + i * root[j])]; } + num2 = Alpha_to[modnn(root[j] * (B0 - 1) + NN)]; den = 0; /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */ for(i = min(deg_lambda, NN - KK - 1) & ~1; i >= 0; i -= 2) { - if(lambda[i + 1] != A0) - den ^= Alpha_to[modnn(lambda[i + 1] + i * root[j])]; + if(lambda[i + 1] != A0) den ^= Alpha_to[modnn(lambda[i + 1] + i * root[j])]; } + if(den == 0) { DicConsole.DebugWriteLine("Reed Solomon", "\n ERROR: denominator = 0\n"); @@ -634,9 +630,11 @@ namespace DiscImageChef.Checksums data[loc[j]] ^= Alpha_to[modnn(Index_of[num1] + Index_of[num2] + NN - Index_of[den])]; } } + return count; } + throw new UnauthorizedAccessException("Trying to calculate RS without initializing!"); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Checksums/SHA1Context.cs b/DiscImageChef.Checksums/SHA1Context.cs index a2c5c94e..ce3db615 100644 --- a/DiscImageChef.Checksums/SHA1Context.cs +++ b/DiscImageChef.Checksums/SHA1Context.cs @@ -118,10 +118,7 @@ namespace DiscImageChef.Checksums hash = _sha1Provider.ComputeHash(fileStream); StringBuilder sha1Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - sha1Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { sha1Output.Append(hash[i].ToString("x2")); } fileStream.Close(); @@ -139,10 +136,7 @@ namespace DiscImageChef.Checksums hash = _sha1Provider.ComputeHash(data, 0, (int)len); StringBuilder sha1Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - sha1Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { sha1Output.Append(hash[i].ToString("x2")); } return sha1Output.ToString(); } @@ -157,5 +151,4 @@ namespace DiscImageChef.Checksums return Data(data, (uint)data.Length, out hash); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Checksums/SHA256Context.cs b/DiscImageChef.Checksums/SHA256Context.cs index eb55465d..c0e0df57 100644 --- a/DiscImageChef.Checksums/SHA256Context.cs +++ b/DiscImageChef.Checksums/SHA256Context.cs @@ -118,10 +118,7 @@ namespace DiscImageChef.Checksums hash = _sha256Provider.ComputeHash(fileStream); StringBuilder sha256Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - sha256Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { sha256Output.Append(hash[i].ToString("x2")); } fileStream.Close(); @@ -139,10 +136,7 @@ namespace DiscImageChef.Checksums hash = _sha256Provider.ComputeHash(data, 0, (int)len); StringBuilder sha256Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - sha256Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { sha256Output.Append(hash[i].ToString("x2")); } return sha256Output.ToString(); } @@ -157,5 +151,4 @@ namespace DiscImageChef.Checksums return Data(data, (uint)data.Length, out hash); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Checksums/SHA384Context.cs b/DiscImageChef.Checksums/SHA384Context.cs index 4ec21899..84768067 100644 --- a/DiscImageChef.Checksums/SHA384Context.cs +++ b/DiscImageChef.Checksums/SHA384Context.cs @@ -118,10 +118,7 @@ namespace DiscImageChef.Checksums hash = _sha384Provider.ComputeHash(fileStream); StringBuilder sha384Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - sha384Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { sha384Output.Append(hash[i].ToString("x2")); } fileStream.Close(); @@ -139,10 +136,7 @@ namespace DiscImageChef.Checksums hash = _sha384Provider.ComputeHash(data, 0, (int)len); StringBuilder sha384Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - sha384Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { sha384Output.Append(hash[i].ToString("x2")); } return sha384Output.ToString(); } @@ -157,5 +151,4 @@ namespace DiscImageChef.Checksums return Data(data, (uint)data.Length, out hash); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Checksums/SHA512Context.cs b/DiscImageChef.Checksums/SHA512Context.cs index 7cf07e4f..1d049c2d 100644 --- a/DiscImageChef.Checksums/SHA512Context.cs +++ b/DiscImageChef.Checksums/SHA512Context.cs @@ -118,10 +118,7 @@ namespace DiscImageChef.Checksums hash = _sha512Provider.ComputeHash(fileStream); StringBuilder sha512Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - sha512Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { sha512Output.Append(hash[i].ToString("x2")); } fileStream.Close(); @@ -139,10 +136,7 @@ namespace DiscImageChef.Checksums hash = _sha512Provider.ComputeHash(data, 0, (int)len); StringBuilder sha512Output = new StringBuilder(); - for(int i = 0; i < hash.Length; i++) - { - sha512Output.Append(hash[i].ToString("x2")); - } + for(int i = 0; i < hash.Length; i++) { sha512Output.Append(hash[i].ToString("x2")); } return sha512Output.ToString(); } @@ -157,5 +151,4 @@ namespace DiscImageChef.Checksums return Data(data, (uint)data.Length, out hash); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Checksums/SpamSumContext.cs b/DiscImageChef.Checksums/SpamSumContext.cs index a2f3abc2..edfe7e34 100644 --- a/DiscImageChef.Checksums/SpamSumContext.cs +++ b/DiscImageChef.Checksums/SpamSumContext.cs @@ -58,14 +58,11 @@ namespace DiscImageChef.Checksums const uint FUZZY_MAX_RESULT = (2 * SPAMSUM_LENGTH + 20); //"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; readonly byte[] b64 = - {0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, - 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, - 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, - 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, - 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, - 0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33, - 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F + { + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, + 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, + 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, + 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F }; struct roll_state @@ -118,8 +115,7 @@ namespace DiscImageChef.Checksums { self = new fuzzy_state(); self.bh = new blockhash_context[NUM_BLOCKHASHES]; - for(int i = 0; i < NUM_BLOCKHASHES; i++) - self.bh[i].digest = new byte[SPAMSUM_LENGTH]; + for(int i = 0; i < NUM_BLOCKHASHES; i++) self.bh[i].digest = new byte[SPAMSUM_LENGTH]; self.bhstart = 0; self.bhend = 1; @@ -180,8 +176,7 @@ namespace DiscImageChef.Checksums { uint obh, nbh; - if(self.bhend >= NUM_BLOCKHASHES) - return; + if(self.bhend >= NUM_BLOCKHASHES) return; if(self.bhend == 0) // assert throw new Exception("Assertion failed"); @@ -198,20 +193,15 @@ namespace DiscImageChef.Checksums void fuzzy_try_reduce_blockhash() { - if(self.bhstart >= self.bhend) - throw new Exception("Assertion failed"); + if(self.bhstart >= self.bhend) throw new Exception("Assertion failed"); if(self.bhend - self.bhstart < 2) - /* Need at least two working hashes. */ - return; - if((ulong)SSDEEP_BS(self.bhstart) * SPAMSUM_LENGTH >= - self.total_size) + /* Need at least two working hashes. */ return; + if((ulong)SSDEEP_BS(self.bhstart) * SPAMSUM_LENGTH >= self.total_size) /* Initial blocksize estimate would select this or a smaller - * blocksize. */ - return; + * blocksize. */ return; if(self.bh[self.bhstart + 1].dlen < SPAMSUM_LENGTH / 2) - /* Estimate adjustment would select this blocksize. */ - return; + /* Estimate adjustment would select this blocksize. */ return; /* At this point we are clearly no longer interested in the * start_blocksize. Get rid of it. */ ++self.bhstart; @@ -239,8 +229,7 @@ namespace DiscImageChef.Checksums if(h % SSDEEP_BS(i) != SSDEEP_BS(i) - 1) /* Once this condition is false for one bs, it is * automatically false for all further bs. I.e. if - * h === -1 (mod 2*bs) then h === -1 (mod bs). */ - break; + * h === -1 (mod 2*bs) then h === -1 (mod bs). */ break; /* We have hit a reset point. We now emit hashes which are * based on all characters in the piece of the message between * the last reset point and this one */ @@ -268,8 +257,7 @@ namespace DiscImageChef.Checksums self.bh[i].halfdigest = 0; } } - else - fuzzy_try_reduce_blockhash(); + else fuzzy_try_reduce_blockhash(); } } @@ -281,8 +269,7 @@ namespace DiscImageChef.Checksums public void Update(byte[] data, uint len) { self.total_size += len; - for(int i = 0; i < len; i++) - fuzzy_engine_step(data[i]); + for(int i = 0; i < len; i++) fuzzy_engine_step(data[i]); } /// @@ -313,26 +300,20 @@ namespace DiscImageChef.Checksums while((ulong)SSDEEP_BS(bi) * SPAMSUM_LENGTH < self.total_size) { ++bi; - if(bi >= NUM_BLOCKHASHES) - { - throw new OverflowException("The input exceeds data types."); - } + if(bi >= NUM_BLOCKHASHES) { throw new OverflowException("The input exceeds data types."); } } /* Adapt blocksize guess to actual digest length. */ - while(bi >= self.bhend) - --bi; - while(bi > self.bhstart && self.bh[bi].dlen < SPAMSUM_LENGTH / 2) - --bi; - if((bi > 0 && self.bh[bi].dlen < SPAMSUM_LENGTH / 2)) - throw new Exception("Assertion failed"); + while(bi >= self.bhend) --bi; + while(bi > self.bhstart && self.bh[bi].dlen < SPAMSUM_LENGTH / 2) --bi; + + if((bi > 0 && self.bh[bi].dlen < SPAMSUM_LENGTH / 2)) throw new Exception("Assertion failed"); sb.AppendFormat("{0}:", SSDEEP_BS(bi)); i = Encoding.ASCII.GetBytes(sb.ToString()).Length; if(i <= 0) - /* Maybe snprintf has set errno here? */ - throw new OverflowException("The input exceeds data types."); - if(i >= remain) - throw new Exception("Assertion failed"); + /* Maybe snprintf has set errno here? */ throw new OverflowException("The input exceeds data types."); + if(i >= remain) throw new Exception("Assertion failed"); + remain -= i; Array.Copy(Encoding.ASCII.GetBytes(sb.ToString()), 0, result, 0, i); @@ -340,21 +321,18 @@ namespace DiscImageChef.Checksums result_off += i; i = (int)self.bh[bi].dlen; - if(i > remain) - throw new Exception("Assertion failed"); + if(i > remain) throw new Exception("Assertion failed"); Array.Copy(self.bh[bi].digest, 0, result, result_off, i); result_off += i; remain -= i; if(h != 0) { - if(remain <= 0) - throw new Exception("Assertion failed"); + if(remain <= 0) throw new Exception("Assertion failed"); + result[result_off] = b64[self.bh[bi].h % 64]; - if(i < 3 || - result[result_off] != result[result_off - 1] || - result[result_off] != result[result_off - 2] || - result[result_off] != result[result_off - 3]) + if(i < 3 || result[result_off] != result[result_off - 1] || + result[result_off] != result[result_off - 2] || result[result_off] != result[result_off - 3]) { ++result_off; --remain; @@ -362,42 +340,39 @@ namespace DiscImageChef.Checksums } else if(self.bh[bi].digest[i] != 0) { - if(remain <= 0) - throw new Exception("Assertion failed"); + if(remain <= 0) throw new Exception("Assertion failed"); + result[result_off] = self.bh[bi].digest[i]; - if(i < 3 || - result[result_off] != result[result_off - 1] || - result[result_off] != result[result_off - 2] || - result[result_off] != result[result_off - 3]) + if(i < 3 || result[result_off] != result[result_off - 1] || + result[result_off] != result[result_off - 2] || result[result_off] != result[result_off - 3]) { ++result_off; --remain; } } - if(remain <= 0) - throw new Exception("Assertion failed"); + + if(remain <= 0) throw new Exception("Assertion failed"); + result[result_off++] = 0x3A; // ':' --remain; if(bi < self.bhend - 1) { ++bi; i = (int)self.bh[bi].dlen; - if(i > remain) - throw new Exception("Assertion failed"); + if(i > remain) throw new Exception("Assertion failed"); + Array.Copy(self.bh[bi].digest, 0, result, result_off, i); result_off += i; remain -= i; if(h != 0) { - if(remain <= 0) - throw new Exception("Assertion failed"); + if(remain <= 0) throw new Exception("Assertion failed"); + h = self.bh[bi].halfh; result[result_off] = b64[h % 64]; - if(i < 3 || - result[result_off] != result[result_off - 1] || - result[result_off] != result[result_off - 2] || - result[result_off] != result[result_off - 3]) + if(i < 3 || result[result_off] != result[result_off - 1] || + result[result_off] != result[result_off - 2] || result[result_off] != result[result_off - 3]) { ++result_off; --remain; @@ -408,13 +383,11 @@ namespace DiscImageChef.Checksums i = self.bh[bi].halfdigest; if(i != 0) { - if(remain <= 0) - throw new Exception("Assertion failed"); + if(remain <= 0) throw new Exception("Assertion failed"); + result[result_off] = (byte)i; - if(i < 3 || - result[result_off] != result[result_off - 1] || - result[result_off] != result[result_off - 2] || - result[result_off] != result[result_off - 3]) + if(i < 3 || result[result_off] != result[result_off - 1] || + result[result_off] != result[result_off - 2] || result[result_off] != result[result_off - 3]) { ++result_off; --remain; @@ -424,15 +397,15 @@ namespace DiscImageChef.Checksums } else if(h != 0) { - if(self.bh[bi].dlen != 0) - throw new Exception("Assertion failed"); - if(remain <= 0) - throw new Exception("Assertion failed"); + if(self.bh[bi].dlen != 0) throw new Exception("Assertion failed"); + if(remain <= 0) throw new Exception("Assertion failed"); + result[result_off++] = b64[self.bh[bi].h % 64]; /* No need to bother with FUZZY_FLAG_ELIMSEQ, because this * digest has length 1. */ --remain; } + result[result_off] = 0; return 0; } @@ -515,8 +488,7 @@ namespace DiscImageChef.Checksums for(int i = 0; i < CString.Length; i++) { - if(CString[i] == 0) - break; + if(CString[i] == 0) break; sb.Append(Encoding.ASCII.GetString(CString, i, 1)); } @@ -524,5 +496,4 @@ namespace DiscImageChef.Checksums return sb.ToString(); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.CommonTypes/MediaType.cs b/DiscImageChef.CommonTypes/MediaType.cs index c527a945..e5e99a6a 100644 --- a/DiscImageChef.CommonTypes/MediaType.cs +++ b/DiscImageChef.CommonTypes/MediaType.cs @@ -883,4 +883,4 @@ namespace DiscImageChef.CommonTypes FlashDrive #endregion Generic hard disks }; -} +} \ No newline at end of file diff --git a/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs b/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs index 01cb7210..71dcf4f7 100644 --- a/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs +++ b/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs @@ -35,7 +35,8 @@ namespace DiscImageChef.CommonTypes #pragma warning disable RECS0063 // Warns when a culture-aware 'StartsWith' call is used by default. public static class MediaTypeFromSCSI { - public static MediaType Get(byte scsiPeripheralType, string vendor, string model, byte mediumType, byte densityCode, ulong blocks, uint blockSize) + public static MediaType Get(byte scsiPeripheralType, string vendor, string model, byte mediumType, + byte densityCode, ulong blocks, uint blockSize) { switch(scsiPeripheralType) { @@ -43,1596 +44,1411 @@ namespace DiscImageChef.CommonTypes case 0x00: // Simpilified access device case 0x0E: + { + if(mediumType == 0x03 || mediumType == 0x05 || mediumType == 0x07) { goto case 0x07; } + + if(vendor.ToLowerInvariant() == "syquest") { - if(mediumType == 0x03 || mediumType == 0x05 || mediumType == 0x07) - { - goto case 0x07; - } + if(blocks == 173400 && blockSize == 256) return MediaType.SQ400; - if(vendor.ToLowerInvariant() == "syquest") + if(blockSize == 512) { - if(blocks == 173400 && blockSize == 256) - return MediaType.SQ400; - if(blockSize == 512) + if(model.ToLowerInvariant().StartsWith("syjet")) return MediaType.SyJet; + + switch(blocks) { - if(model.ToLowerInvariant().StartsWith("syjet")) - return MediaType.SyJet; - - switch(blocks) - { - case 262144: - return MediaType.EZ135; - case 524288: - return MediaType.SQ327; - } + case 262144: return MediaType.EZ135; + case 524288: return MediaType.SQ327; } - - return MediaType.Unknown; - } - - if(vendor.ToLowerInvariant().StartsWith("iomega") && - (model.ToLowerInvariant().StartsWith("clik") || - model.ToLowerInvariant().StartsWith("pocketzip")) && - blockSize == 512 && blocks == 78882) - return MediaType.PocketZip; - - if(model.ToLowerInvariant().StartsWith("zip")) - { - if(blockSize == 512) - { - if(blocks == 196608) - return MediaType.ZIP100; - if(blocks == 489532) - return MediaType.ZIP250; - return MediaType.ZIP750; - } - - return MediaType.Unknown; - } - - if(model.ToLowerInvariant().StartsWith("jaz")) - { - if(blockSize == 512) - { - if(blocks == 2091050) - return MediaType.Jaz; - if(blocks == 3915600) - return MediaType.Jaz2; - } - - return MediaType.Unknown; - } - - if(model.ToLowerInvariant().StartsWith("ls-")) - { - 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; - } - else if(blockSize == 1024) - { - if(blocks == 1232) - return MediaType.NEC_35_HD_8; - } - - return MediaType.Unknown; - } - - if(model.ToLowerInvariant().StartsWith("rdx")) - { - if(blockSize == 512) - { - if(blocks == 625134256) - return MediaType.RDX320; - return MediaType.RDX; - } - - return MediaType.Unknown; - } - - switch(mediumType) - { - case 0x01: - switch(blockSize) - { - case 128: - switch(blocks) - { - 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; - } - break; - case 256: - 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 1121: - return MediaType.IBM33FD_256; - case 1280: - return MediaType.ACORN_525_SS_DD_80; - case 2002: - return MediaType.RX02; - } - break; - case 319: - switch(blocks) - { - case 256: - return MediaType.IBM23FD; - } - break; - case 512: - 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 249850: - return MediaType.ECMA_154; - case 429975: - return MediaType.ECMA_201_ROM; - case 446325: - return MediaType.ECMA_201; - case 694929: - return MediaType.ECMA_223_512; - case 904995: - return MediaType.ECMA_183_512; - case 1128772: - case 1163337: - return MediaType.ECMA_184_512; - case 1281856: - return MediaType.PD650_WORM; - case 1298496: - return MediaType.PD650; - case 1644581: - case 1647371: - return MediaType.ECMA_195_512; - } - break; - case 1024: - { - switch(blocks) - { - 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 14476734: - return MediaType.ECMA_260; - case 24445990: - return MediaType.ECMA_260_Double; - } - } - break; - case 2048: - { - switch(blocks) - { - case 318988: - case 320332: - case 321100: - return MediaType.ECMA_239; - 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; - } - } - break; - case 4096: - { - switch(blocks) - { - case 1095840: - return MediaType.ECMA_322; - } - } - break; - case 8192: - { - switch(blocks) - { - case 1834348: - return MediaType.UDO; - case 3668759: - return MediaType.UDO2_WORM; - case 3669724: - return MediaType.UDO2; - } - } - break; - } - return MediaType.Unknown; - case 0x02: - switch(blockSize) - { - case 128: - switch(blocks) - { - case 3848: - return MediaType.IBM43FD_128; - case 4004: - return MediaType.ECMA_59; - } - break; - case 256: - switch(blocks) - { - case 910: - return MediaType.Apple32DS; - case 1120: - return MediaType.Apple33DS; - case 1280: - return MediaType.ECMA_70; - case 2560: - return MediaType.ECMA_78; - case 3848: - return MediaType.IBM53FD_256; - case 4004: - return MediaType.ECMA_99_26; - } - break; - case 512: - 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.ECMA_100; - 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.ECMA_125; - case 3360: - return MediaType.DMF; - case 3444: - return MediaType.FDFORMAT_35_HD; - case 3520: - return MediaType.CBM_AMIGA_35_HD; - case 5760: - return MediaType.ECMA_147; - case 249850: - return MediaType.ECMA_154; - case 429975: - return MediaType.ECMA_201_ROM; - case 446325: - return MediaType.ECMA_201; - case 694929: - return MediaType.ECMA_223_512; - case 904995: - return MediaType.ECMA_183_512; - case 1128772: - case 1163337: - return MediaType.ECMA_184_512; - case 1281856: - return MediaType.PD650_WORM; - case 1298496: - return MediaType.PD650; - case 1644581: - case 1647371: - return MediaType.ECMA_195_512; - } - break; - case 1024: - 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 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 14476734: - return MediaType.ECMA_260; - case 24445990: - return MediaType.ECMA_260_Double; - } - break; - case 2048: - { - switch(blocks) - { - case 318988: - case 320332: - case 321100: - return MediaType.ECMA_239; - 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; - } - } - break; - case 4096: - { - switch(blocks) - { - case 1095840: - return MediaType.ECMA_322; - } - } - break; - case 8192: - { - switch(blocks) - { - case 1834348: - return MediaType.UDO; - case 3668759: - return MediaType.UDO2_WORM; - case 3669724: - return MediaType.UDO2; - } - } - break; - } - return MediaType.Unknown; - case 0x09: - return MediaType.ECMA_54; - case 0x0A: - return MediaType.ECMA_59; - case 0x0B: - switch(blockSize) - { - case 256: - return MediaType.ECMA_69_26; - case 512: - return MediaType.ECMA_69_15; - case 1024: - return MediaType.ECMA_69_8; - } - return MediaType.Unknown; - case 0x0E: - return MediaType.ECMA_66; - case 0x12: - return MediaType.ECMA_70; - case 0x16: - switch(blockSize) - { - case 256: - return MediaType.ECMA_78; - case 512: - return MediaType.ECMA_78_2; - } - return MediaType.Unknown; - case 0x1A: - switch(blockSize) - { - 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.ECMA_100; - case 0x93: - return MediaType.NEC_35_HD_15; - case 0x94: - return MediaType.ECMA_125; - } - - switch(blockSize) - { - case 128: - { - switch(blocks) - { - 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; - case 3848: - return MediaType.IBM43FD_128; - case 4004: - return MediaType.ECMA_59; - } - } - break; - case 256: - { - 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 1120: - return MediaType.Apple33DS; - case 1121: - return MediaType.IBM33FD_256; - case 1280: - return MediaType.ECMA_70; - case 2002: - return MediaType.RX02; - case 2560: - return MediaType.ECMA_78; - case 3848: - return MediaType.IBM53FD_256; - case 4004: - return MediaType.ECMA_99_26; - } - } - break; - case 319: - switch(blocks) - { - case 256: - return MediaType.IBM23FD; - } - break; - case 512: - { - 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 1280: - return MediaType.DOS_35_DS_DD_8; - case 1440: - return MediaType.ECMA_100; - case 1600: - return MediaType.ACORN_35_DS_DD; - 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.ECMA_125; - case 3360: - return MediaType.DMF; - case 3444: - return MediaType.FDFORMAT_35_HD; - case 3520: - return MediaType.CBM_AMIGA_35_HD; - case 5760: - return MediaType.ECMA_147; - } - } - break; - case 1024: - { - switch(blocks) - { - 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; - } - } - break; } return MediaType.Unknown; } + + if(vendor.ToLowerInvariant().StartsWith("iomega") && + (model.ToLowerInvariant().StartsWith("clik") || + model.ToLowerInvariant().StartsWith("pocketzip")) && blockSize == 512 && + blocks == 78882) return MediaType.PocketZip; + + if(model.ToLowerInvariant().StartsWith("zip")) + { + if(blockSize == 512) + { + if(blocks == 196608) return MediaType.ZIP100; + if(blocks == 489532) return MediaType.ZIP250; + + return MediaType.ZIP750; + } + + return MediaType.Unknown; + } + + if(model.ToLowerInvariant().StartsWith("jaz")) + { + if(blockSize == 512) + { + if(blocks == 2091050) return MediaType.Jaz; + if(blocks == 3915600) return MediaType.Jaz2; + } + + return MediaType.Unknown; + } + + if(model.ToLowerInvariant().StartsWith("ls-")) + { + 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; + } + else if(blockSize == 1024) { if(blocks == 1232) return MediaType.NEC_35_HD_8; } + + return MediaType.Unknown; + } + + if(model.ToLowerInvariant().StartsWith("rdx")) + { + if(blockSize == 512) + { + if(blocks == 625134256) return MediaType.RDX320; + + return MediaType.RDX; + } + + return MediaType.Unknown; + } + + switch(mediumType) + { + case 0x01: + switch(blockSize) + { + case 128: + switch(blocks) + { + 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; + } + + break; + case 256: + 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 1121: return MediaType.IBM33FD_256; + case 1280: return MediaType.ACORN_525_SS_DD_80; + case 2002: return MediaType.RX02; + } + + break; + case 319: + switch(blocks) + { + case 256: return MediaType.IBM23FD; + } + + break; + case 512: + 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 249850: return MediaType.ECMA_154; + case 429975: return MediaType.ECMA_201_ROM; + case 446325: return MediaType.ECMA_201; + case 694929: return MediaType.ECMA_223_512; + case 904995: return MediaType.ECMA_183_512; + case 1128772: + case 1163337: return MediaType.ECMA_184_512; + case 1281856: return MediaType.PD650_WORM; + case 1298496: return MediaType.PD650; + case 1644581: + case 1647371: return MediaType.ECMA_195_512; + } + + break; + case 1024: + { + switch(blocks) + { + 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 14476734: return MediaType.ECMA_260; + case 24445990: return MediaType.ECMA_260_Double; + } + } + + break; + case 2048: + { + switch(blocks) + { + case 318988: + case 320332: + case 321100: return MediaType.ECMA_239; + 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; + } + } + + break; + case 4096: + { + switch(blocks) + { + case 1095840: return MediaType.ECMA_322; + } + } + + break; + case 8192: + { + switch(blocks) + { + case 1834348: return MediaType.UDO; + case 3668759: return MediaType.UDO2_WORM; + case 3669724: return MediaType.UDO2; + } + } + + break; + } + + return MediaType.Unknown; + case 0x02: + switch(blockSize) + { + case 128: + switch(blocks) + { + case 3848: return MediaType.IBM43FD_128; + case 4004: return MediaType.ECMA_59; + } + + break; + case 256: + switch(blocks) + { + case 910: return MediaType.Apple32DS; + case 1120: return MediaType.Apple33DS; + case 1280: return MediaType.ECMA_70; + case 2560: return MediaType.ECMA_78; + case 3848: return MediaType.IBM53FD_256; + case 4004: return MediaType.ECMA_99_26; + } + + break; + case 512: + 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.ECMA_100; + 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.ECMA_125; + case 3360: return MediaType.DMF; + case 3444: return MediaType.FDFORMAT_35_HD; + case 3520: return MediaType.CBM_AMIGA_35_HD; + case 5760: return MediaType.ECMA_147; + case 249850: return MediaType.ECMA_154; + case 429975: return MediaType.ECMA_201_ROM; + case 446325: return MediaType.ECMA_201; + case 694929: return MediaType.ECMA_223_512; + case 904995: return MediaType.ECMA_183_512; + case 1128772: + case 1163337: return MediaType.ECMA_184_512; + case 1281856: return MediaType.PD650_WORM; + case 1298496: return MediaType.PD650; + case 1644581: + case 1647371: return MediaType.ECMA_195_512; + } + + break; + case 1024: + 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 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 14476734: return MediaType.ECMA_260; + case 24445990: return MediaType.ECMA_260_Double; + } + + break; + case 2048: + { + switch(blocks) + { + case 318988: + case 320332: + case 321100: return MediaType.ECMA_239; + 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; + } + } + + break; + case 4096: + { + switch(blocks) + { + case 1095840: return MediaType.ECMA_322; + } + } + + break; + case 8192: + { + switch(blocks) + { + case 1834348: return MediaType.UDO; + case 3668759: return MediaType.UDO2_WORM; + case 3669724: return MediaType.UDO2; + } + } + + break; + } + + return MediaType.Unknown; + case 0x09: return MediaType.ECMA_54; + case 0x0A: return MediaType.ECMA_59; + case 0x0B: + switch(blockSize) + { + case 256: return MediaType.ECMA_69_26; + case 512: return MediaType.ECMA_69_15; + case 1024: return MediaType.ECMA_69_8; + } + + return MediaType.Unknown; + case 0x0E: return MediaType.ECMA_66; + case 0x12: return MediaType.ECMA_70; + case 0x16: + switch(blockSize) + { + case 256: return MediaType.ECMA_78; + case 512: return MediaType.ECMA_78_2; + } + + return MediaType.Unknown; + case 0x1A: + switch(blockSize) + { + 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.ECMA_100; + case 0x93: return MediaType.NEC_35_HD_15; + case 0x94: return MediaType.ECMA_125; + } + + switch(blockSize) + { + case 128: + { + switch(blocks) + { + 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; + case 3848: return MediaType.IBM43FD_128; + case 4004: return MediaType.ECMA_59; + } + } + + break; + case 256: + { + 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 1120: return MediaType.Apple33DS; + case 1121: return MediaType.IBM33FD_256; + case 1280: return MediaType.ECMA_70; + case 2002: return MediaType.RX02; + case 2560: return MediaType.ECMA_78; + case 3848: return MediaType.IBM53FD_256; + case 4004: return MediaType.ECMA_99_26; + } + } + + break; + case 319: + switch(blocks) + { + case 256: return MediaType.IBM23FD; + } + + break; + case 512: + { + 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 1280: return MediaType.DOS_35_DS_DD_8; + case 1440: return MediaType.ECMA_100; + case 1600: return MediaType.ACORN_35_DS_DD; + 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.ECMA_125; + case 3360: return MediaType.DMF; + case 3444: return MediaType.FDFORMAT_35_HD; + case 3520: return MediaType.CBM_AMIGA_35_HD; + case 5760: return MediaType.ECMA_147; + } + } + + break; + case 1024: + { + switch(blocks) + { + 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; + } + } + + break; + } + + return MediaType.Unknown; + } // Sequential access device case 0x01: + { + switch(mediumType) { - switch(mediumType) + case 0x00: + switch(densityCode) + { + case 0x04: return MediaType.QIC11; + case 0x05: return MediaType.QIC24; + case 0x09: return MediaType.IBM3490; + case 0x0F: return MediaType.QIC120; + case 0x10: return MediaType.QIC150; + case 0x24: return MediaType.DDS2; + case 0x25: return MediaType.DDS3; + case 0x26: return MediaType.DDS4; + case 0x28: return MediaType.IBM3490E; + case 0x40: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO; + if(model.ToLowerInvariant().StartsWith("sdz")) return MediaType.SAIT1; + + break; + } + case 0x41: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO2; + + break; + } + case 0x42: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO2; + if(vendor.ToLowerInvariant() == "stk") return MediaType.T9840A; + + break; + } + case 0x43: + { + if(vendor.ToLowerInvariant() == "stk") return MediaType.T9940A; + + break; + } + case 0x44: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO3; + if(vendor.ToLowerInvariant() == "stk") return MediaType.T9940B; + + break; + } + case 0x45: + { + if(vendor.ToLowerInvariant() == "stk") return MediaType.T9840C; + + break; + } + case 0x46: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO4; + if(vendor.ToLowerInvariant() == "stk") return MediaType.T9840D; + + break; + } + case 0x4A: + { + if(vendor.ToLowerInvariant() == "stk") return MediaType.T10000A; + + break; + } + case 0x4B: + { + if(vendor.ToLowerInvariant() == "stk") return MediaType.T10000B; + + break; + } + case 0x4C: + { + if(vendor.ToLowerInvariant() == "stk") return MediaType.T10000C; + + break; + } + case 0x4D: + { + if(vendor.ToLowerInvariant() == "stk") return MediaType.T10000D; + + break; + } + case 0x58: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO5; + + break; + } + } + + break; + case 0x01: { - case 0x00: - switch(densityCode) + switch(densityCode) + { + case 0x44: { - case 0x04: - return MediaType.QIC11; - case 0x05: - return MediaType.QIC24; - case 0x09: - return MediaType.IBM3490; - case 0x0F: - return MediaType.QIC120; - case 0x10: - return MediaType.QIC150; - case 0x24: - return MediaType.DDS2; - case 0x25: - return MediaType.DDS3; - case 0x26: - return MediaType.DDS4; - case 0x28: - return MediaType.IBM3490E; - case 0x40: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO; - if(model.ToLowerInvariant().StartsWith("sdz")) - return MediaType.SAIT1; - break; - } - case 0x41: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO2; - break; - } - case 0x42: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO2; - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T9840A; - break; - } - case 0x43: - { - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T9940A; - break; - } - case 0x44: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO3; - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T9940B; - break; - } - case 0x45: - { - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T9840C; - break; - } - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO4; - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T9840D; - break; - } - case 0x4A: - { - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T10000A; - break; - } - case 0x4B: - { - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T10000B; - break; - } - case 0x4C: - { - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T10000C; - break; - } - case 0x4D: - { - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T10000D; - break; - } - case 0x58: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO5; - break; - } + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO3WORM; + + break; } - break; - case 0x01: + case 0x46: { - switch(densityCode) - { - case 0x44: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO3WORM; - break; - } - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO4WORM; - break; - } - case 0x58: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO5WORM; - break; - } - } + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO4WORM; + + break; } - break; - case 0x18: + case 0x58: { - switch(densityCode) - { - case 0x00: - case 0x40: - { - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO; - break; - } - } - } + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO5WORM; + + break; } - break; - case 0x28: - { - switch(densityCode) - { - case 0x00: - case 0x42: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO2; - break; - } - } - } - break; - case 0x33: - { - switch(densityCode) - { - case 0x00: - case 0x25: - { - if(model.ToLowerInvariant().StartsWith("dat")) - return MediaType.DDS3; - break; - } - } - } - break; - case 0x34: - { - switch(densityCode) - { - case 0x00: - case 0x26: - { - if(model.ToLowerInvariant().StartsWith("dat")) - return MediaType.DDS4; - break; - } - } - } - break; - case 0x35: - { - switch(densityCode) - { - case 0x00: - case 0x47: - { - if(model.ToLowerInvariant().StartsWith("dat")) - return MediaType.DAT72; - break; - } - } - } - break; - case 0x38: - { - switch(densityCode) - { - case 0x00: - case 0x44: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO3; - break; - } - } - } - break; - case 0x3C: - { - switch(densityCode) - { - case 0x00: - case 0x44: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO3WORM; - break; - } - } - } - break; - case 0x48: - { - switch(densityCode) - { - case 0x00: - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO4; - break; - } - } - } - break; - case 0x4C: - { - switch(densityCode) - { - case 0x00: - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO4WORM; - break; - } - } - } - break; - case 0x58: - { - switch(densityCode) - { - case 0x00: - case 0x58: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO5; - break; - } - } - } - break; - case 0x5C: - { - switch(densityCode) - { - case 0x00: - case 0x58: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO5WORM; - break; - } - } - } - break; - case 0x68: - { - switch(densityCode) - { - case 0x00: - case 0x5A: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO6; - break; - } - } - } - break; - case 0x6C: - { - switch(densityCode) - { - case 0x00: - case 0x5A: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO6WORM; - break; - } - } - } - break; - case 0x78: - { - switch(densityCode) - { - case 0x00: - case 0x5C: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO7; - break; - } - } - } - break; - case 0x7C: - { - switch(densityCode) - { - case 0x00: - case 0x5C: - { - if(model.ToLowerInvariant().StartsWith("ult")) - return MediaType.LTO7WORM; - break; - } - } - } - break; - case 0x81: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape15m; - if(vendor.ToLowerInvariant() == "ibm") - return MediaType.IBM3592; - if(model.ToLowerInvariant().StartsWith("vxa")) - return MediaType.VXA1; - break; - } - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape15m; - break; - } - case 0x29: - case 0x2A: - { - if(vendor.ToLowerInvariant() == "ibm") - return MediaType.IBM3592; - break; - } - case 0x80: - { - if(model.ToLowerInvariant().StartsWith("vxa")) - return MediaType.VXA1; - break; - } - } - } - break; - case 0x82: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape28m; - if(vendor.ToLowerInvariant() == "ibm") - return MediaType.IBM3592; - break; - } - case 0x0A: - { - if(model.ToLowerInvariant().StartsWith("dlt")) - return MediaType.CompactTapeI; - break; - } - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape28m; - break; - } - case 0x16: - { - if(model.ToLowerInvariant().StartsWith("dlt")) - return MediaType.CompactTapeII; - break; - } - case 0x29: - case 0x2A: - { - if(vendor.ToLowerInvariant() == "ibm") - return MediaType.IBM3592; - break; - } - case 0x81: - { - if(model.ToLowerInvariant().StartsWith("vxa")) - return MediaType.VXA2; - break; - } - case 0x82: - { - if(model.ToLowerInvariant().StartsWith("vxa")) - return MediaType.VXA3; - break; - } - } - } - break; - case 0x83: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape54m; - if(model.ToLowerInvariant().StartsWith("dlt")) - return MediaType.DLTtapeIII; - break; - } - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape54m; - break; - } - case 0x17: - case 0x18: - case 0x19: - case 0x80: - case 0x81: - { - if(model.ToLowerInvariant().StartsWith("dlt")) - return MediaType.DLTtapeIII; - break; - } - } - } - break; - case 0x84: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape80m; - if(model.ToLowerInvariant().StartsWith("dlt")) - return MediaType.DLTtapeIIIxt; - break; - } - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape80m; - break; - } - case 0x19: - case 0x80: - case 0x81: - { - if(model.ToLowerInvariant().StartsWith("dlt")) - return MediaType.DLTtapeIIIxt; - break; - } - } - } - break; - case 0x85: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape106m; - if(model.ToLowerInvariant().StartsWith("dlt") || - model.ToLowerInvariant().StartsWith("sdlt") || - model.ToLowerInvariant().StartsWith("superdlt")) - return MediaType.DLTtapeIV; - if(model.ToLowerInvariant().StartsWith("stt")) - return MediaType.Travan5; - break; - } - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape106m; - break; - } - case 0x1A: - case 0x1B: - case 0x40: - case 0x41: - case 0x82: - case 0x83: - case 0x84: - case 0x85: - case 0x86: - case 0x87: - case 0x88: - case 0x89: - { - if(model.ToLowerInvariant().StartsWith("dlt") || - model.ToLowerInvariant().StartsWith("sdlt") || - model.ToLowerInvariant().StartsWith("superdlt")) - return MediaType.DLTtapeIV; - break; - } - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("stt")) - return MediaType.Travan5; - break; - } - } - } - break; - case 0x86: - { - switch(densityCode) - { - case 0x00: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape160mXL; - if(model.ToLowerInvariant().StartsWith("dlt") || - model.ToLowerInvariant().StartsWith("sdlt") || - model.ToLowerInvariant().StartsWith("superdlt")) - return MediaType.SDLT1; - break; - } - case 0x8C: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape160mXL; - break; - } - case 0x91: - case 0x92: - case 0x93: - { - if(model.ToLowerInvariant().StartsWith("dlt") || - model.ToLowerInvariant().StartsWith("sdlt") || - model.ToLowerInvariant().StartsWith("superdlt")) - return MediaType.SDLT1; - break; - } - } - } - break; - case 0x87: - { - switch(densityCode) - { - case 0x00: - case 0x4A: - { - if(model.ToLowerInvariant().StartsWith("dlt") || - model.ToLowerInvariant().StartsWith("sdlt") || - model.ToLowerInvariant().StartsWith("superdlt")) - return MediaType.SDLT2; - break; - } - } - } - break; - case 0x90: - { - switch(densityCode) - { - case 0x00: - case 0x50: - case 0x98: - case 0x99: - { - if(model.ToLowerInvariant().StartsWith("dlt") || - model.ToLowerInvariant().StartsWith("sdlt") || - model.ToLowerInvariant().StartsWith("superdlt")) - return MediaType.VStapeI; - break; - } - } - } - break; - case 0x95: - { - if(model.ToLowerInvariant().StartsWith("stt")) - return MediaType.Travan7; - } - break; - case 0xC1: - { - switch(densityCode) - { - case 0x00: - case 0x14: - case 0x15: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape22m; - break; - } - } - } - break; - case 0xC2: - { - switch(densityCode) - { - case 0x00: - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape40m; - break; - } - } - } - break; - case 0xC3: - { - switch(densityCode) - { - case 0x00: - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape76m; - break; - } - } - } - break; - case 0xC4: - { - switch(densityCode) - { - case 0x00: - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape112m; - break; - } - } - } - break; - case 0xD1: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape22mAME; - break; - } - } - } - break; - case 0xD2: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape170m; - break; - } - } - } - break; - case 0xD3: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape125m; - break; - } - } - } - break; - case 0xD4: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape45m; - break; - } - } - } - break; - case 0xD5: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape225m; - break; - } - } - } - break; - case 0xD6: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape150m; - break; - } - } - } - break; - case 0xD7: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb")) - return MediaType.Exatape75m; - break; - } - } - } - break; + } } - return MediaType.Unknown; + break; + case 0x18: + { + switch(densityCode) + { + case 0x00: + case 0x40: + { + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO; + + break; + } + } + } + } + + break; + case 0x28: + { + switch(densityCode) + { + case 0x00: + case 0x42: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO2; + + break; + } + } + } + + break; + case 0x33: + { + switch(densityCode) + { + case 0x00: + case 0x25: + { + if(model.ToLowerInvariant().StartsWith("dat")) return MediaType.DDS3; + + break; + } + } + } + + break; + case 0x34: + { + switch(densityCode) + { + case 0x00: + case 0x26: + { + if(model.ToLowerInvariant().StartsWith("dat")) return MediaType.DDS4; + + break; + } + } + } + + break; + case 0x35: + { + switch(densityCode) + { + case 0x00: + case 0x47: + { + if(model.ToLowerInvariant().StartsWith("dat")) return MediaType.DAT72; + + break; + } + } + } + + break; + case 0x38: + { + switch(densityCode) + { + case 0x00: + case 0x44: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO3; + + break; + } + } + } + + break; + case 0x3C: + { + switch(densityCode) + { + case 0x00: + case 0x44: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO3WORM; + + break; + } + } + } + + break; + case 0x48: + { + switch(densityCode) + { + case 0x00: + case 0x46: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO4; + + break; + } + } + } + + break; + case 0x4C: + { + switch(densityCode) + { + case 0x00: + case 0x46: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO4WORM; + + break; + } + } + } + + break; + case 0x58: + { + switch(densityCode) + { + case 0x00: + case 0x58: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO5; + + break; + } + } + } + + break; + case 0x5C: + { + switch(densityCode) + { + case 0x00: + case 0x58: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO5WORM; + + break; + } + } + } + + break; + case 0x68: + { + switch(densityCode) + { + case 0x00: + case 0x5A: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO6; + + break; + } + } + } + + break; + case 0x6C: + { + switch(densityCode) + { + case 0x00: + case 0x5A: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO6WORM; + + break; + } + } + } + + break; + case 0x78: + { + switch(densityCode) + { + case 0x00: + case 0x5C: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO7; + + break; + } + } + } + + break; + case 0x7C: + { + switch(densityCode) + { + case 0x00: + case 0x5C: + { + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO7WORM; + + break; + } + } + } + + break; + case 0x81: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape15m; + if(vendor.ToLowerInvariant() == "ibm") return MediaType.IBM3592; + if(model.ToLowerInvariant().StartsWith("vxa")) return MediaType.VXA1; + + break; + } + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape15m; + + break; + } + case 0x29: + case 0x2A: + { + if(vendor.ToLowerInvariant() == "ibm") return MediaType.IBM3592; + + break; + } + case 0x80: + { + if(model.ToLowerInvariant().StartsWith("vxa")) return MediaType.VXA1; + + break; + } + } + } + + break; + case 0x82: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape28m; + if(vendor.ToLowerInvariant() == "ibm") return MediaType.IBM3592; + + break; + } + case 0x0A: + { + if(model.ToLowerInvariant().StartsWith("dlt")) return MediaType.CompactTapeI; + + break; + } + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape28m; + + break; + } + case 0x16: + { + if(model.ToLowerInvariant().StartsWith("dlt")) return MediaType.CompactTapeII; + + break; + } + case 0x29: + case 0x2A: + { + if(vendor.ToLowerInvariant() == "ibm") return MediaType.IBM3592; + + break; + } + case 0x81: + { + if(model.ToLowerInvariant().StartsWith("vxa")) return MediaType.VXA2; + + break; + } + case 0x82: + { + if(model.ToLowerInvariant().StartsWith("vxa")) return MediaType.VXA3; + + break; + } + } + } + + break; + case 0x83: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape54m; + if(model.ToLowerInvariant().StartsWith("dlt")) return MediaType.DLTtapeIII; + + break; + } + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape54m; + + break; + } + case 0x17: + case 0x18: + case 0x19: + case 0x80: + case 0x81: + { + if(model.ToLowerInvariant().StartsWith("dlt")) return MediaType.DLTtapeIII; + + break; + } + } + } + + break; + case 0x84: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape80m; + if(model.ToLowerInvariant().StartsWith("dlt")) return MediaType.DLTtapeIIIxt; + + break; + } + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape80m; + + break; + } + case 0x19: + case 0x80: + case 0x81: + { + if(model.ToLowerInvariant().StartsWith("dlt")) return MediaType.DLTtapeIIIxt; + + break; + } + } + } + + break; + case 0x85: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape106m; + if(model.ToLowerInvariant().StartsWith("dlt") || + model.ToLowerInvariant().StartsWith("sdlt") || + model.ToLowerInvariant().StartsWith("superdlt")) return MediaType.DLTtapeIV; + if(model.ToLowerInvariant().StartsWith("stt")) return MediaType.Travan5; + + break; + } + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape106m; + + break; + } + case 0x1A: + case 0x1B: + case 0x40: + case 0x41: + case 0x82: + case 0x83: + case 0x84: + case 0x85: + case 0x86: + case 0x87: + case 0x88: + case 0x89: + { + if(model.ToLowerInvariant().StartsWith("dlt") || + model.ToLowerInvariant().StartsWith("sdlt") || + model.ToLowerInvariant().StartsWith("superdlt")) return MediaType.DLTtapeIV; + + break; + } + case 0x46: + { + if(model.ToLowerInvariant().StartsWith("stt")) return MediaType.Travan5; + + break; + } + } + } + + break; + case 0x86: + { + switch(densityCode) + { + case 0x00: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape160mXL; + if(model.ToLowerInvariant().StartsWith("dlt") || + model.ToLowerInvariant().StartsWith("sdlt") || + model.ToLowerInvariant().StartsWith("superdlt")) return MediaType.SDLT1; + + break; + } + case 0x8C: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape160mXL; + + break; + } + case 0x91: + case 0x92: + case 0x93: + { + if(model.ToLowerInvariant().StartsWith("dlt") || + model.ToLowerInvariant().StartsWith("sdlt") || + model.ToLowerInvariant().StartsWith("superdlt")) return MediaType.SDLT1; + + break; + } + } + } + + break; + case 0x87: + { + switch(densityCode) + { + case 0x00: + case 0x4A: + { + if(model.ToLowerInvariant().StartsWith("dlt") || + model.ToLowerInvariant().StartsWith("sdlt") || + model.ToLowerInvariant().StartsWith("superdlt")) return MediaType.SDLT2; + + break; + } + } + } + + break; + case 0x90: + { + switch(densityCode) + { + case 0x00: + case 0x50: + case 0x98: + case 0x99: + { + if(model.ToLowerInvariant().StartsWith("dlt") || + model.ToLowerInvariant().StartsWith("sdlt") || + model.ToLowerInvariant().StartsWith("superdlt")) return MediaType.VStapeI; + + break; + } + } + } + + break; + case 0x95: + { + if(model.ToLowerInvariant().StartsWith("stt")) return MediaType.Travan7; + } + + break; + case 0xC1: + { + switch(densityCode) + { + case 0x00: + case 0x14: + case 0x15: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape22m; + + break; + } + } + } + + break; + case 0xC2: + { + switch(densityCode) + { + case 0x00: + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape40m; + + break; + } + } + } + + break; + case 0xC3: + { + switch(densityCode) + { + case 0x00: + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape76m; + + break; + } + } + } + + break; + case 0xC4: + { + switch(densityCode) + { + case 0x00: + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape112m; + + break; + } + } + } + + break; + case 0xD1: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape22mAME; + + break; + } + } + } + + break; + case 0xD2: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape170m; + + break; + } + } + } + + break; + case 0xD3: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape125m; + + break; + } + } + } + + break; + case 0xD4: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape45m; + + break; + } + } + } + + break; + case 0xD5: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape225m; + + break; + } + } + } + + break; + case 0xD6: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape150m; + + break; + } + } + } + + break; + case 0xD7: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape75m; + + break; + } + } + } + + break; } + + return MediaType.Unknown; + } // Write-once device case 0x04: // Optical device case 0x07: + { + if(mediumType == 0x01 || mediumType == 0x02 || mediumType == 0x03 || mediumType == 0x05 || + mediumType == 0x07) { - if(mediumType == 0x01 || mediumType == 0x02 || mediumType == 0x03 || mediumType == 0x05 || mediumType == 0x07) + switch(blockSize) { - switch(blockSize) + case 512: { - case 512: - { - switch(blocks) - { - case 249850: - return MediaType.ECMA_154; - case 429975: - return MediaType.ECMA_201_ROM; - case 446325: - return MediaType.ECMA_201; - case 694929: - return MediaType.ECMA_223_512; - case 904995: - return MediaType.ECMA_183_512; - case 1128772: - case 1163337: - return MediaType.ECMA_184_512; - case 1281856: - return MediaType.PD650_WORM; - case 1298496: - return MediaType.PD650; - case 1644581: - case 1647371: - return MediaType.ECMA_195_512; - default: - return MediaType.UnknownMO; - } - } - case 1024: - { - switch(blocks) - { - 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 14476734: - return MediaType.ECMA_260; - case 24445990: - return MediaType.ECMA_260_Double; - default: - return MediaType.UnknownMO; - } - } - case 2048: - { - switch(blocks) - { - case 318988: - case 320332: - case 321100: - return MediaType.ECMA_239; - 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; - } - } - case 4096: - { - switch(blocks) - { - case 1095840: - return MediaType.ECMA_322; - default: - return MediaType.UnknownMO; - } - } - case 8192: - { - 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; + switch(blocks) + { + case 249850: return MediaType.ECMA_154; + case 429975: return MediaType.ECMA_201_ROM; + case 446325: return MediaType.ECMA_201; + case 694929: return MediaType.ECMA_223_512; + case 904995: return MediaType.ECMA_183_512; + case 1128772: + case 1163337: return MediaType.ECMA_184_512; + case 1281856: return MediaType.PD650_WORM; + case 1298496: return MediaType.PD650; + case 1644581: + case 1647371: return MediaType.ECMA_195_512; + default: return MediaType.UnknownMO; + } } + case 1024: + { + switch(blocks) + { + 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 14476734: return MediaType.ECMA_260; + case 24445990: return MediaType.ECMA_260_Double; + default: return MediaType.UnknownMO; + } + } + case 2048: + { + switch(blocks) + { + case 318988: + case 320332: + case 321100: return MediaType.ECMA_239; + 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; + } + } + case 4096: + { + switch(blocks) + { + case 1095840: return MediaType.ECMA_322; + default: return MediaType.UnknownMO; + } + } + case 8192: + { + 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; } - - return MediaType.UnknownMO; } + + return MediaType.UnknownMO; + } // MultiMedia Device case 0x05: + { + switch(mediumType) { - switch(mediumType) - { - case 0x00: - return MediaType.CD; - case 0x01: - case 0x05: - return MediaType.CDROM; - case 0x02: - case 0x06: - return MediaType.CDDA; - case 0x03: - case 0x07: - return MediaType.CDPLUS; - case 0x04: - return MediaType.PCD; - case 0x10: - case 0x11: - case 0x12: - case 0x13: - case 0x14: - case 0x15: - case 0x16: - case 0x17: - case 0x18: - return MediaType.CDR; - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - case 0x25: - case 0x26: - case 0x27: - case 0x28: - return MediaType.CDRW; - case 0x80: - if(model.ToLowerInvariant().StartsWith("ult")) + case 0x00: return MediaType.CD; + case 0x01: + case 0x05: return MediaType.CDROM; + case 0x02: + case 0x06: return MediaType.CDDA; + case 0x03: + case 0x07: return MediaType.CDPLUS; + case 0x04: return MediaType.PCD; + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: return MediaType.CDR; + case 0x20: + case 0x21: + case 0x22: + case 0x23: + case 0x24: + case 0x25: + case 0x26: + case 0x27: + case 0x28: return MediaType.CDRW; + case 0x80: + if(model.ToLowerInvariant().StartsWith("ult")) + { + switch(densityCode) { - switch(densityCode) - { - case 0x42: - return MediaType.LTO2; - case 0x44: - return MediaType.LTO3; - case 0x46: - return MediaType.LTO4; - case 0x58: - return MediaType.LTO5; - } + case 0x42: return MediaType.LTO2; + case 0x44: return MediaType.LTO3; + case 0x46: return MediaType.LTO4; + case 0x58: return MediaType.LTO5; } - break; - } + } + + break; } + } + break; // Host managed zoned block device case 0x14: - { - return MediaType.Zone_HDD; - } + { + return MediaType.Zone_HDD; + } } return MediaType.Unknown; diff --git a/DiscImageChef.CommonTypes/Partition.cs b/DiscImageChef.CommonTypes/Partition.cs index a6bf740d..23dd19b5 100644 --- a/DiscImageChef.CommonTypes/Partition.cs +++ b/DiscImageChef.CommonTypes/Partition.cs @@ -56,7 +56,10 @@ namespace DiscImageChef.CommonTypes /// Information that does not find space in this struct public string Description; /// LBA of last partition sector - public ulong End { get { return Start + Length - 1; }} + public ulong End + { + get { return Start + Length - 1; } + } /// Name of partition scheme that contains this partition public string Scheme; @@ -67,10 +70,8 @@ namespace DiscImageChef.CommonTypes public override bool Equals(Object obj) { - if(obj == null || !(obj is Partition)) - return false; - else - return Equals((Partition)obj); + if(obj == null || !(obj is Partition)) return false; + else return Equals((Partition)obj); } public override int GetHashCode() @@ -80,11 +81,9 @@ namespace DiscImageChef.CommonTypes 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; } @@ -125,5 +124,4 @@ namespace DiscImageChef.CommonTypes return operand1.CompareTo(operand2) <= 0; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.CommonTypes/Properties/AssemblyInfo.cs b/DiscImageChef.CommonTypes/Properties/AssemblyInfo.cs index fe397033..8640466a 100644 --- a/DiscImageChef.CommonTypes/Properties/AssemblyInfo.cs +++ b/DiscImageChef.CommonTypes/Properties/AssemblyInfo.cs @@ -54,5 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Console/DicConsole.cs b/DiscImageChef.Console/DicConsole.cs index a2708f12..9850329f 100644 --- a/DiscImageChef.Console/DicConsole.cs +++ b/DiscImageChef.Console/DicConsole.cs @@ -33,13 +33,19 @@ namespace DiscImageChef.Console { public delegate void WriteLineHandler(string format, params object[] arg); + public delegate void ErrorWriteLineHandler(string format, params object[] arg); + public delegate void VerboseWriteLineHandler(string format, params object[] arg); + public delegate void DebugWriteLineHandler(string format, params object[] arg); public delegate void WriteHandler(string format, params object[] arg); + public delegate void ErrorWriteHandler(string format, params object[] arg); + public delegate void VerboseWriteHandler(string format, params object[] arg); + public delegate void DebugWriteHandler(string format, params object[] arg); public static class DicConsole @@ -56,124 +62,102 @@ namespace DiscImageChef.Console public static void WriteLine(string format, params object[] arg) { - if(WriteLineEvent != null) - WriteLineEvent(format, arg); + if(WriteLineEvent != null) WriteLineEvent(format, arg); } public static void ErrorWriteLine(string format, params object[] arg) { - if(ErrorWriteLineEvent != null) - ErrorWriteLineEvent(format, arg); + if(ErrorWriteLineEvent != null) ErrorWriteLineEvent(format, arg); } public static void VerboseWriteLine(string format, params object[] arg) { - if(VerboseWriteLineEvent != null) - VerboseWriteLineEvent(format, arg); + if(VerboseWriteLineEvent != null) VerboseWriteLineEvent(format, arg); } public static void DebugWriteLine(string module, string format, params object[] arg) { - if(DebugWriteLineEvent != null) - DebugWriteLineEvent("DEBUG (" + module + "): " + format, arg); + if(DebugWriteLineEvent != null) DebugWriteLineEvent("DEBUG (" + module + "): " + format, arg); } public static void WriteLine() { - if(WriteLineEvent != null) - WriteLineEvent("", null); + if(WriteLineEvent != null) WriteLineEvent("", null); } public static void ErrorWriteLine() { - if(ErrorWriteLineEvent != null) - ErrorWriteLineEvent("", null); + if(ErrorWriteLineEvent != null) ErrorWriteLineEvent("", null); } public static void VerboseWriteLine() { - if(VerboseWriteLineEvent != null) - VerboseWriteLineEvent("", null); + if(VerboseWriteLineEvent != null) VerboseWriteLineEvent("", null); } public static void DebugWriteLine() { - if(DebugWriteLineEvent != null) - DebugWriteLineEvent("", null); + if(DebugWriteLineEvent != null) DebugWriteLineEvent("", null); } public static void Write(string format, params object[] arg) { - if(WriteEvent != null) - WriteEvent(format, arg); + if(WriteEvent != null) WriteEvent(format, arg); } public static void ErrorWrite(string format, params object[] arg) { - if(ErrorWriteEvent != null) - ErrorWriteEvent(format, arg); + if(ErrorWriteEvent != null) ErrorWriteEvent(format, arg); } public static void VerboseWrite(string format, params object[] arg) { - if(VerboseWriteEvent != null) - VerboseWriteEvent(format, arg); + if(VerboseWriteEvent != null) VerboseWriteEvent(format, arg); } public static void DebugWrite(string module, string format, params object[] arg) { - if(DebugWriteEvent != null) - DebugWriteEvent("DEBUG (" + module + "): " + format, arg); + if(DebugWriteEvent != null) DebugWriteEvent("DEBUG (" + module + "): " + format, arg); } public static void Write() { - if(WriteEvent != null) - WriteEvent("", null); + if(WriteEvent != null) WriteEvent("", null); } public static void ErrorWrite() { - if(ErrorWriteEvent != null) - ErrorWriteEvent("", null); + if(ErrorWriteEvent != null) ErrorWriteEvent("", null); } public static void VerboseWrite() { - if(VerboseWriteEvent != null) - VerboseWriteEvent("", null); + if(VerboseWriteEvent != null) VerboseWriteEvent("", null); } public static void DebugWrite() { - if(DebugWriteEvent != null) - DebugWriteEvent("", null); + if(DebugWriteEvent != null) DebugWriteEvent("", null); } public static void WriteLine(string format) { - if(WriteLineEvent != null) - WriteLineEvent("{0}", format); + if(WriteLineEvent != null) WriteLineEvent("{0}", format); } public static void ErrorWriteLine(string format) { - if(ErrorWriteLineEvent != null) - ErrorWriteLineEvent("{0}", format); + if(ErrorWriteLineEvent != null) ErrorWriteLineEvent("{0}", format); } public static void VerboseWriteLine(string format) { - if(VerboseWriteLineEvent != null) - VerboseWriteLineEvent("{0}", format); + if(VerboseWriteLineEvent != null) VerboseWriteLineEvent("{0}", format); } public static void DebugWriteLine(string module, string format) { - if(DebugWriteLineEvent != null) - DebugWriteLineEvent("{0}", "DEBUG (" + module + "): " + format); + if(DebugWriteLineEvent != null) DebugWriteLineEvent("{0}", "DEBUG (" + module + "): " + format); } - } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Console/Properties/AssemblyInfo.cs b/DiscImageChef.Console/Properties/AssemblyInfo.cs index 74fc1228..ba75eeeb 100644 --- a/DiscImageChef.Console/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Console/Properties/AssemblyInfo.cs @@ -54,5 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Core/Benchmark.cs b/DiscImageChef.Core/Benchmark.cs index de0a1254..846d94db 100644 --- a/DiscImageChef.Core/Benchmark.cs +++ b/DiscImageChef.Core/Benchmark.cs @@ -30,7 +30,6 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ - using System; using System.Collections.Generic; using System.IO; @@ -69,8 +68,7 @@ namespace DiscImageChef.Core public static void InitProgress() { - if(InitProgressEvent != null) - InitProgressEvent(); + if(InitProgressEvent != null) InitProgressEvent(); } public static void UpdateProgress(string text, int current, int maximum) @@ -81,8 +79,7 @@ namespace DiscImageChef.Core public static void EndProgress() { - if(EndProgressEvent != null) - EndProgressEvent(); + if(EndProgressEvent != null) EndProgressEvent(); } public static BenchmarkResults Do(int bufferSize, int blockSize) @@ -108,6 +105,7 @@ namespace DiscImageChef.Core rnd.NextBytes(tmp); ms.Write(tmp, 0, blockSize); } + EndProgress(); end = DateTime.Now; @@ -116,10 +114,8 @@ namespace DiscImageChef.Core ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) @@ -128,13 +124,12 @@ namespace DiscImageChef.Core byte[] tmp = new byte[blockSize]; ms.Read(tmp, 0, blockSize); } + EndProgress(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; results.readTime = (end - start).TotalSeconds; results.readSpeed = (bufferSize / 1048576) / (end - start).TotalSeconds; @@ -144,10 +139,8 @@ namespace DiscImageChef.Core ((Adler32Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) @@ -157,16 +150,20 @@ namespace DiscImageChef.Core ms.Read(tmp, 0, blockSize); ((Adler32Context)ctx).Update(tmp); } + EndProgress(); ((Adler32Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; - results.entries.Add("Adler32", new BenchmarkEntry() { timeSpan = (end - start).TotalSeconds, speed = (bufferSize / 1048576) / (end - start).TotalSeconds }); + results.entries.Add("Adler32", + new BenchmarkEntry() + { + timeSpan = (end - start).TotalSeconds, + speed = (bufferSize / 1048576) / (end - start).TotalSeconds + }); results.separateTime += (end - start).TotalSeconds; #endregion Adler32 @@ -175,10 +172,8 @@ namespace DiscImageChef.Core ((CRC16Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) @@ -188,16 +183,20 @@ namespace DiscImageChef.Core ms.Read(tmp, 0, blockSize); ((CRC16Context)ctx).Update(tmp); } + EndProgress(); ((CRC16Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; - results.entries.Add("CRC16", new BenchmarkEntry() { timeSpan = (end - start).TotalSeconds, speed = (bufferSize / 1048576) / (end - start).TotalSeconds }); + results.entries.Add("CRC16", + new BenchmarkEntry() + { + timeSpan = (end - start).TotalSeconds, + speed = (bufferSize / 1048576) / (end - start).TotalSeconds + }); results.separateTime += (end - start).TotalSeconds; #endregion CRC16 @@ -206,10 +205,8 @@ namespace DiscImageChef.Core ((CRC32Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) @@ -219,16 +216,20 @@ namespace DiscImageChef.Core ms.Read(tmp, 0, blockSize); ((CRC32Context)ctx).Update(tmp); } + EndProgress(); ((CRC32Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; - results.entries.Add("CRC32", new BenchmarkEntry() { timeSpan = (end - start).TotalSeconds, speed = (bufferSize / 1048576) / (end - start).TotalSeconds }); + results.entries.Add("CRC32", + new BenchmarkEntry() + { + timeSpan = (end - start).TotalSeconds, + speed = (bufferSize / 1048576) / (end - start).TotalSeconds + }); results.separateTime += (end - start).TotalSeconds; #endregion CRC32 @@ -237,10 +238,8 @@ namespace DiscImageChef.Core ((CRC64Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) @@ -250,16 +249,20 @@ namespace DiscImageChef.Core ms.Read(tmp, 0, blockSize); ((CRC64Context)ctx).Update(tmp); } + EndProgress(); ((CRC64Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; - results.entries.Add("CRC64", new BenchmarkEntry() { timeSpan = (end - start).TotalSeconds, speed = (bufferSize / 1048576) / (end - start).TotalSeconds }); + results.entries.Add("CRC64", + new BenchmarkEntry() + { + timeSpan = (end - start).TotalSeconds, + speed = (bufferSize / 1048576) / (end - start).TotalSeconds + }); results.separateTime += (end - start).TotalSeconds; #endregion CRC64 @@ -268,10 +271,8 @@ namespace DiscImageChef.Core ((MD5Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) @@ -281,16 +282,20 @@ namespace DiscImageChef.Core ms.Read(tmp, 0, blockSize); ((MD5Context)ctx).Update(tmp); } + EndProgress(); ((MD5Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; - results.entries.Add("MD5", new BenchmarkEntry() { timeSpan = (end - start).TotalSeconds, speed = (bufferSize / 1048576) / (end - start).TotalSeconds }); + results.entries.Add("MD5", + new BenchmarkEntry() + { + timeSpan = (end - start).TotalSeconds, + speed = (bufferSize / 1048576) / (end - start).TotalSeconds + }); results.separateTime += (end - start).TotalSeconds; #endregion MD5 @@ -299,10 +304,8 @@ namespace DiscImageChef.Core ((RIPEMD160Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) @@ -312,16 +315,20 @@ namespace DiscImageChef.Core ms.Read(tmp, 0, blockSize); ((RIPEMD160Context)ctx).Update(tmp); } + EndProgress(); ((RIPEMD160Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; - results.entries.Add("RIPEMD160", new BenchmarkEntry() { timeSpan = (end - start).TotalSeconds, speed = (bufferSize / 1048576) / (end - start).TotalSeconds }); + results.entries.Add("RIPEMD160", + new BenchmarkEntry() + { + timeSpan = (end - start).TotalSeconds, + speed = (bufferSize / 1048576) / (end - start).TotalSeconds + }); results.separateTime += (end - start).TotalSeconds; #endregion RIPEMD160 @@ -330,10 +337,8 @@ namespace DiscImageChef.Core ((SHA1Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) @@ -343,16 +348,20 @@ namespace DiscImageChef.Core ms.Read(tmp, 0, blockSize); ((SHA1Context)ctx).Update(tmp); } + EndProgress(); ((SHA1Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; - results.entries.Add("SHA1", new BenchmarkEntry() { timeSpan = (end - start).TotalSeconds, speed = (bufferSize / 1048576) / (end - start).TotalSeconds }); + results.entries.Add("SHA1", + new BenchmarkEntry() + { + timeSpan = (end - start).TotalSeconds, + speed = (bufferSize / 1048576) / (end - start).TotalSeconds + }); results.separateTime += (end - start).TotalSeconds; #endregion SHA1 @@ -361,10 +370,8 @@ namespace DiscImageChef.Core ((SHA256Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) @@ -374,16 +381,20 @@ namespace DiscImageChef.Core ms.Read(tmp, 0, blockSize); ((SHA256Context)ctx).Update(tmp); } + EndProgress(); ((SHA256Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; - results.entries.Add("SHA256", new BenchmarkEntry() { timeSpan = (end - start).TotalSeconds, speed = (bufferSize / 1048576) / (end - start).TotalSeconds }); + results.entries.Add("SHA256", + new BenchmarkEntry() + { + timeSpan = (end - start).TotalSeconds, + speed = (bufferSize / 1048576) / (end - start).TotalSeconds + }); results.separateTime += (end - start).TotalSeconds; #endregion SHA256 @@ -392,10 +403,8 @@ namespace DiscImageChef.Core ((SHA384Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) @@ -405,16 +414,20 @@ namespace DiscImageChef.Core ms.Read(tmp, 0, blockSize); ((SHA384Context)ctx).Update(tmp); } + EndProgress(); ((SHA384Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; - results.entries.Add("SHA384", new BenchmarkEntry() { timeSpan = (end - start).TotalSeconds, speed = (bufferSize / 1048576) / (end - start).TotalSeconds }); + results.entries.Add("SHA384", + new BenchmarkEntry() + { + timeSpan = (end - start).TotalSeconds, + speed = (bufferSize / 1048576) / (end - start).TotalSeconds + }); results.separateTime += (end - start).TotalSeconds; #endregion SHA384 @@ -423,10 +436,8 @@ namespace DiscImageChef.Core ((SHA512Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) @@ -436,16 +447,20 @@ namespace DiscImageChef.Core ms.Read(tmp, 0, blockSize); ((SHA512Context)ctx).Update(tmp); } + EndProgress(); ((SHA512Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; - results.entries.Add("SHA512", new BenchmarkEntry() { timeSpan = (end - start).TotalSeconds, speed = (bufferSize / 1048576) / (end - start).TotalSeconds }); + results.entries.Add("SHA512", + new BenchmarkEntry() + { + timeSpan = (end - start).TotalSeconds, + speed = (bufferSize / 1048576) / (end - start).TotalSeconds + }); results.separateTime += (end - start).TotalSeconds; #endregion SHA512 @@ -454,10 +469,8 @@ namespace DiscImageChef.Core ((SpamSumContext)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) @@ -467,16 +480,20 @@ namespace DiscImageChef.Core ms.Read(tmp, 0, blockSize); ((SpamSumContext)ctx).Update(tmp); } + EndProgress(); ((SpamSumContext)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; - results.entries.Add("SpamSum", new BenchmarkEntry() { timeSpan = (end - start).TotalSeconds, speed = (bufferSize / 1048576) / (end - start).TotalSeconds }); + results.entries.Add("SpamSum", + new BenchmarkEntry() + { + timeSpan = (end - start).TotalSeconds, + speed = (bufferSize / 1048576) / (end - start).TotalSeconds + }); results.separateTime += (end - start).TotalSeconds; #endregion SpamSum @@ -484,10 +501,8 @@ namespace DiscImageChef.Core ulong[] entTable = new ulong[256]; ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; start = DateTime.Now; InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) @@ -495,9 +510,9 @@ namespace DiscImageChef.Core UpdateProgress("Entropying block {0} of {1}.", i + 1, bufferSize / blockSize); byte[] tmp = new byte[blockSize]; ms.Read(tmp, 0, blockSize); - foreach(byte b in tmp) - entTable[b]++; + foreach(byte b in tmp) entTable[b]++; } + EndProgress(); double entropy = 0; foreach(ulong l in entTable) @@ -507,12 +522,11 @@ namespace DiscImageChef.Core #pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values entropy += -(frequency * Math.Log(frequency, 2)); } + end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; results.entropyTime = (end - start).TotalSeconds; results.entropySpeed = (bufferSize / 1048576) / (end - start).TotalSeconds; @@ -524,21 +538,21 @@ namespace DiscImageChef.Core InitProgress(); for(int i = 0; i < bufferSize / blockSize; i++) { - UpdateProgress("Checksumming block {0} of {1} with all algorithms at the same time.", i + 1, bufferSize / blockSize); + UpdateProgress("Checksumming block {0} of {1} with all algorithms at the same time.", i + 1, + bufferSize / blockSize); byte[] tmp = new byte[blockSize]; ms.Read(tmp, 0, blockSize); allChecksums.Update(tmp); } + EndProgress(); allChecksums.End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if(mem > results.maxMemory) - results.maxMemory = mem; - if(mem < results.minMemory) - results.minMemory = mem; + if(mem > results.maxMemory) results.maxMemory = mem; + if(mem < results.minMemory) results.minMemory = mem; results.totalTime = (end - start).TotalSeconds; results.totalSpeed = (bufferSize / 1048576) / results.totalTime; @@ -549,4 +563,4 @@ namespace DiscImageChef.Core return results; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Checksum.cs b/DiscImageChef.Core/Checksum.cs index b21a775b..d1c94dfc 100644 --- a/DiscImageChef.Core/Checksum.cs +++ b/DiscImageChef.Core/Checksum.cs @@ -30,7 +30,6 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ - using System; using System.Collections.Generic; using System.Threading; @@ -268,37 +267,21 @@ namespace DiscImageChef.Core spamsumThread.Start(spamsumPkt); } - while(adlerThread.IsAlive || crc16Thread.IsAlive || - crc32Thread.IsAlive || crc64Thread.IsAlive || - md5Thread.IsAlive || ripemd160Thread.IsAlive || - sha1Thread.IsAlive || sha256Thread.IsAlive || - sha384Thread.IsAlive || sha512Thread.IsAlive || - spamsumThread.IsAlive) - { - } + while(adlerThread.IsAlive || crc16Thread.IsAlive || crc32Thread.IsAlive || crc64Thread.IsAlive || + md5Thread.IsAlive || ripemd160Thread.IsAlive || sha1Thread.IsAlive || sha256Thread.IsAlive || + sha384Thread.IsAlive || sha512Thread.IsAlive || spamsumThread.IsAlive) { } - if(enabled.HasFlag(EnableChecksum.SpamSum)) - adlerThread = new Thread(updateAdler); - if(enabled.HasFlag(EnableChecksum.SpamSum)) - crc16Thread = new Thread(updateCRC16); - if(enabled.HasFlag(EnableChecksum.SpamSum)) - crc32Thread = new Thread(updateCRC32); - if(enabled.HasFlag(EnableChecksum.SpamSum)) - crc64Thread = new Thread(updateCRC64); - if(enabled.HasFlag(EnableChecksum.SpamSum)) - md5Thread = new Thread(updateMD5); - if(enabled.HasFlag(EnableChecksum.SpamSum)) - ripemd160Thread = new Thread(updateRIPEMD160); - if(enabled.HasFlag(EnableChecksum.SpamSum)) - sha1Thread = new Thread(updateSHA1); - if(enabled.HasFlag(EnableChecksum.SpamSum)) - sha256Thread = new Thread(updateSHA256); - if(enabled.HasFlag(EnableChecksum.SpamSum)) - sha384Thread = new Thread(updateSHA384); - if(enabled.HasFlag(EnableChecksum.SpamSum)) - sha512Thread = new Thread(updateSHA512); - if(enabled.HasFlag(EnableChecksum.SpamSum)) - spamsumThread = new Thread(updateSpamSum); + if(enabled.HasFlag(EnableChecksum.SpamSum)) adlerThread = new Thread(updateAdler); + if(enabled.HasFlag(EnableChecksum.SpamSum)) crc16Thread = new Thread(updateCRC16); + if(enabled.HasFlag(EnableChecksum.SpamSum)) crc32Thread = new Thread(updateCRC32); + if(enabled.HasFlag(EnableChecksum.SpamSum)) crc64Thread = new Thread(updateCRC64); + if(enabled.HasFlag(EnableChecksum.SpamSum)) md5Thread = new Thread(updateMD5); + if(enabled.HasFlag(EnableChecksum.SpamSum)) ripemd160Thread = new Thread(updateRIPEMD160); + if(enabled.HasFlag(EnableChecksum.SpamSum)) sha1Thread = new Thread(updateSHA1); + if(enabled.HasFlag(EnableChecksum.SpamSum)) sha256Thread = new Thread(updateSHA256); + if(enabled.HasFlag(EnableChecksum.SpamSum)) sha384Thread = new Thread(updateSHA384); + if(enabled.HasFlag(EnableChecksum.SpamSum)) sha512Thread = new Thread(updateSHA512); + if(enabled.HasFlag(EnableChecksum.SpamSum)) spamsumThread = new Thread(updateSpamSum); } public List End() @@ -546,15 +529,10 @@ namespace DiscImageChef.Core spamsumThreadData.Start(spamsumPktData); } - - while(adlerThreadData.IsAlive || crc16ThreadData.IsAlive || - crc32ThreadData.IsAlive || crc64ThreadData.IsAlive || - md5ThreadData.IsAlive || ripemd160ThreadData.IsAlive || - sha1ThreadData.IsAlive || sha256ThreadData.IsAlive || - sha384ThreadData.IsAlive || sha512ThreadData.IsAlive || - spamsumThreadData.IsAlive) - { - } + while(adlerThreadData.IsAlive || crc16ThreadData.IsAlive || crc32ThreadData.IsAlive || + crc64ThreadData.IsAlive || md5ThreadData.IsAlive || ripemd160ThreadData.IsAlive || + sha1ThreadData.IsAlive || sha256ThreadData.IsAlive || sha384ThreadData.IsAlive || + sha512ThreadData.IsAlive || spamsumThreadData.IsAlive) { } List dataChecksums = new List(); ChecksumType chk; @@ -651,7 +629,6 @@ namespace DiscImageChef.Core } #region Threading helpers - struct adlerPacket { public Adler32Context context; @@ -772,7 +749,6 @@ namespace DiscImageChef.Core { ((spamsumPacket)packet).context.Update(((spamsumPacket)packet).data); } - #endregion Threading helpers } } \ No newline at end of file diff --git a/DiscImageChef.Core/DataFile.cs b/DiscImageChef.Core/DataFile.cs index bcf92cbb..94a9b772 100644 --- a/DiscImageChef.Core/DataFile.cs +++ b/DiscImageChef.Core/DataFile.cs @@ -46,8 +46,7 @@ namespace DiscImageChef.Core public void Close() { - if(dataFs != null) - dataFs.Close(); + if(dataFs != null) dataFs.Close(); } public int Read(byte[] array, int offset, int count) @@ -91,7 +90,10 @@ namespace DiscImageChef.Core dataFs.Write(data, offset, count); } - public long Position { get { return dataFs.Position; }} + public long Position + { + get { return dataFs.Position; } + } public static void WriteTo(string who, string outputPrefix, string outputSuffix, string what, byte[] data) { @@ -99,14 +101,14 @@ namespace DiscImageChef.Core WriteTo(who, outputPrefix + outputSuffix, data, what); } - public static void WriteTo(string who, string filename, byte[] data, string whatWriting = null, bool overwrite = false) + public static void WriteTo(string who, string filename, byte[] data, string whatWriting = null, + bool overwrite = false) { if(!string.IsNullOrEmpty(filename)) { if(File.Exists(filename)) { - if(overwrite) - File.Delete(filename); + if(overwrite) File.Delete(filename); else { DicConsole.ErrorWriteLine("Not overwriting file {0}", filename); @@ -121,11 +123,8 @@ namespace DiscImageChef.Core outputFs.Write(data, 0, data.Length); outputFs.Close(); } - catch - { - DicConsole.ErrorWriteLine("Unable to write file {0}", filename); - } + catch { DicConsole.ErrorWriteLine("Unable to write file {0}", filename); } } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Delegates.cs b/DiscImageChef.Core/Delegates.cs index f2ffb6c8..6e4f4017 100644 --- a/DiscImageChef.Core/Delegates.cs +++ b/DiscImageChef.Core/Delegates.cs @@ -30,21 +30,23 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ - namespace DiscImageChef.Core { /// /// Initializates a progress indicator (e.g. makes a progress bar visible) /// public delegate void InitProgressHandler(); + /// /// Updates a progress indicator with text /// public delegate void UpdateProgressHandler(string text, long current, long maximum); + /// /// Pulses a progress indicator with indeterminate boundaries /// public delegate void PulseProgressHandler(string text); + /// /// Uninitializates a progress indicator (e.g. adds a newline to the console) /// @@ -54,14 +56,17 @@ namespace DiscImageChef.Core /// Initializates a secondary progress indicator (e.g. makes a progress bar visible) /// public delegate void InitProgressHandler2(); + /// /// Updates a secondary progress indicator with text /// public delegate void UpdateProgressHandler2(string text, long current, long maximum); + /// /// Pulses a secondary progress indicator with indeterminate boundaries /// public delegate void PulseProgressHandler2(string text); + /// /// Uninitializates a secondary progress indicator (e.g. adds a newline to the console) /// @@ -71,14 +76,18 @@ namespace DiscImageChef.Core /// Initializates two progress indicators (e.g. makes a progress bar visible) /// public delegate void InitTwoProgressHandler(); + /// /// Updates two progress indicators with text /// - public delegate void UpdateTwoProgressHandler(string text, long current, long maximum, string text2, long current2, long maximum2); + public delegate void UpdateTwoProgressHandler(string text, long current, long maximum, string text2, long current2, + long maximum2); + /// /// Pulses a progress indicator with indeterminate boundaries /// public delegate void PulseTwoProgressHandler(string text, string text2); + /// /// Uninitializates a progress indicator (e.g. adds a newline to the console) /// @@ -88,4 +97,4 @@ namespace DiscImageChef.Core /// Updates a status indicator /// public delegate void UpdateStatusHandler(string text); -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Dumping/ATA.cs b/DiscImageChef.Core/Devices/Dumping/ATA.cs index fe08ac9d..ef27f40e 100644 --- a/DiscImageChef.Core/Devices/Dumping/ATA.cs +++ b/DiscImageChef.Core/Devices/Dumping/ATA.cs @@ -50,7 +50,9 @@ namespace DiscImageChef.Core.Devices.Dumping { public class ATA { - public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref Metadata.Resume resume, ref DumpLog dumpLog, Encoding encoding) + public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, + bool dumpRaw, bool persistent, bool stopOnError, ref Metadata.Resume resume, + ref DumpLog dumpLog, Encoding encoding) { bool aborted; MHDDLog mhddLog; @@ -60,8 +62,7 @@ namespace DiscImageChef.Core.Devices.Dumping { DicConsole.ErrorWriteLine("Raw dumping not yet supported in ATA devices."); - if(force) - DicConsole.ErrorWriteLine("Continuing..."); + if(force) DicConsole.ErrorWriteLine("Continuing..."); else { DicConsole.ErrorWriteLine("Aborting..."); @@ -80,10 +81,8 @@ namespace DiscImageChef.Core.Devices.Dumping { Decoders.ATA.Identify.IdentifyDevice ataId = Decoders.ATA.Identify.Decode(cmdBuf).Value; - CICMMetadataType sidecar = new CICMMetadataType() - { - BlockMedia = new BlockMediaType[] { new BlockMediaType() } - }; + CICMMetadataType sidecar = + new CICMMetadataType() {BlockMedia = new BlockMediaType[] {new BlockMediaType()}}; if(dev.IsUSB) { @@ -123,7 +122,8 @@ namespace DiscImageChef.Core.Devices.Dumping { if(tuple.Code == TupleCodes.CISTPL_MANFID) { - ManufacturerIdentificationTuple manfid = CIS.DecodeManufacturerIdentificationTuple(tuple); + ManufacturerIdentificationTuple manfid = + CIS.DecodeManufacturerIdentificationTuple(tuple); if(manfid != null) { @@ -141,7 +141,8 @@ namespace DiscImageChef.Core.Devices.Dumping { sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer; sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product; - sidecar.BlockMedia[0].PCMCIA.Compliance = string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion); + sidecar.BlockMedia[0].PCMCIA.Compliance = + string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion); sidecar.BlockMedia[0].PCMCIA.AdditionalInformation = vers.AdditionalInformation; } } @@ -170,10 +171,7 @@ namespace DiscImageChef.Core.Devices.Dumping Checksum dataChk; aborted = false; - System.Console.CancelKeyPress += (sender, e) => - { - e.Cancel = aborted = true; - }; + System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; }; DataFile dumpFile; @@ -189,6 +187,7 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine(ataReader.ErrorMessage); return; } + uint blockSize = ataReader.LogicalBlockSize; uint physicalsectorsize = ataReader.PhysicalBlockSize; if(ataReader.FindReadCommand()) @@ -204,21 +203,27 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine(ataReader.ErrorMessage); return; } + uint blocksToRead = ataReader.BlocksToRead; ushort cylinders = ataReader.Cylinders; byte heads = ataReader.Heads; byte sectors = ataReader.Sectors; dumpLog.WriteLine("Device reports {0} blocks ({1} bytes).", blocks, blocks * blockSize); - dumpLog.WriteLine("Device reports {0} cylinders {1} heads {2} sectors per track.", cylinders, heads, sectors); + dumpLog.WriteLine("Device reports {0} cylinders {1} heads {2} sectors per track.", cylinders, heads, + sectors); dumpLog.WriteLine("Device can read {0} blocks at a time.", blocksToRead); dumpLog.WriteLine("Device reports {0} bytes per logical block.", blockSize); dumpLog.WriteLine("Device reports {0} bytes per physical block.", physicalsectorsize); - bool removable = false || (!dev.IsCompactFlash && ataId.GeneralConfiguration.HasFlag(Decoders.ATA.Identify.GeneralConfigurationBit.Removable)); + bool removable = false || (!dev.IsCompactFlash && + ataId.GeneralConfiguration.HasFlag(Decoders.ATA.Identify + .GeneralConfigurationBit + .Removable)); DumpHardwareType currentTry = null; ExtentsULong extents = null; - ResumeSupport.Process(ataReader.IsLBA, removable, blocks, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformID, ref resume, ref currentTry, ref extents); + ResumeSupport.Process(ataReader.IsLBA, removable, blocks, dev.Manufacturer, dev.Model, dev.Serial, + dev.PlatformID, ref resume, ref currentTry, ref extents); if(currentTry == null || extents == null) throw new Exception("Could not process resume file, not continuing..."); @@ -229,8 +234,7 @@ namespace DiscImageChef.Core.Devices.Dumping mhddLog = new MHDDLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead); ibgLog = new IBGLog(outputPrefix + ".ibg", currentProfile); dumpFile = new DataFile(outputPrefix + ".bin"); - if(resume.NextBlock > 0) - dumpLog.WriteLine("Resuming from block {0}.", resume.NextBlock); + if(resume.NextBlock > 0) dumpLog.WriteLine("Resuming from block {0}.", resume.NextBlock); dumpFile.Seek(resume.NextBlock, blockSize); @@ -244,14 +248,11 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - if((blocks - i) < blocksToRead) - blocksToRead = (byte)(blocks - i); + if((blocks - i) < blocksToRead) blocksToRead = (byte)(blocks - i); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(currentSpeed > maxSpeed && currentSpeed != 0) - maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && currentSpeed != 0) - minSpeed = currentSpeed; + if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed; + if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, blocks, currentSpeed); @@ -267,12 +268,10 @@ namespace DiscImageChef.Core.Devices.Dumping } else { - for(ulong b = i; b < i + blocksToRead; b++) - resume.BadBlocks.Add(b); - if(duration < 500) - mhddLog.Write(i, 65535); - else - mhddLog.Write(i, duration); + for(ulong b = i; b < i + blocksToRead; b++) resume.BadBlocks.Add(b); + + if(duration < 500) mhddLog.Write(i, 65535); + else mhddLog.Write(i, duration); ibgLog.Write(i, 0); dumpFile.Write(new byte[blockSize * blocksToRead]); @@ -285,14 +284,18 @@ namespace DiscImageChef.Core.Devices.Dumping GC.Collect(); resume.NextBlock = i + blocksToRead; } + end = DateTime.Now; DicConsole.WriteLine(); mhddLog.Close(); #pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created - ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); + ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), + devicePath); #pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds); - dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); + dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); #region Error handling if(resume.BadBlocks.Count > 0 && !aborted) @@ -301,7 +304,7 @@ namespace DiscImageChef.Core.Devices.Dumping bool forward = true; bool runningPersistent = false; - repeatRetryLba: + repeatRetryLba: ulong[] tmpArray = resume.BadBlocks.ToArray(); foreach(ulong badSector in tmpArray) { @@ -312,7 +315,9 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - DicConsole.Write("\rRetrying sector {0}, pass {1}, {3}{2}", badSector, pass + 1, forward ? "forward" : "reverse", runningPersistent ? "recovering partial data, " : ""); + DicConsole.Write("\rRetrying sector {0}, pass {1}, {3}{2}", badSector, pass + 1, + forward ? "forward" : "reverse", + runningPersistent ? "recovering partial data, " : ""); bool error = ataReader.ReadBlock(out cmdBuf, badSector, out duration); @@ -325,8 +330,7 @@ namespace DiscImageChef.Core.Devices.Dumping dumpFile.WriteAt(cmdBuf, badSector, blockSize); dumpLog.WriteLine("Correctly retried block {0} in pass {1}.", badSector, pass); } - else if(runningPersistent) - dumpFile.WriteAt(cmdBuf, badSector, blockSize); + else if(runningPersistent) dumpFile.WriteAt(cmdBuf, badSector, blockSize); } if(pass < retryPasses && !aborted && resume.BadBlocks.Count > 0) @@ -367,13 +371,12 @@ namespace DiscImageChef.Core.Devices.Dumping } #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(currentSpeed > maxSpeed && currentSpeed != 0) - maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && currentSpeed != 0) - minSpeed = currentSpeed; + if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed; + if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator - DicConsole.Write("\rReading cylinder {0} head {1} sector {2} ({3:F3} MiB/sec.)", Cy, Hd, Sc, currentSpeed); + DicConsole.Write("\rReading cylinder {0} head {1} sector {2} ({3:F3} MiB/sec.)", Cy, Hd, + Sc, currentSpeed); bool error = ataReader.ReadCHS(out cmdBuf, Cy, Hd, Sc, out duration); @@ -390,10 +393,8 @@ namespace DiscImageChef.Core.Devices.Dumping else { resume.BadBlocks.Add(currentBlock); - if(duration < 500) - mhddLog.Write(currentBlock, 65535); - else - mhddLog.Write(currentBlock, duration); + if(duration < 500) mhddLog.Write(currentBlock, 65535); + else mhddLog.Write(currentBlock, duration); ibgLog.Write(currentBlock, 0); dumpFile.Write(new byte[blockSize]); @@ -408,15 +409,20 @@ namespace DiscImageChef.Core.Devices.Dumping } } } + end = DateTime.Now; DicConsole.WriteLine(); mhddLog.Close(); #pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created - ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); + ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), + devicePath); #pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds); - dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); + dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); } + dataChk = new Checksum(); dumpFile.Seek(0, SeekOrigin.Begin); blocksToRead = 500; @@ -430,8 +436,7 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - if((blocks - i) < blocksToRead) - blocksToRead = (byte)(blocks - i); + if((blocks - i) < blocksToRead) blocksToRead = (byte)(blocks - i); DicConsole.Write("\rChecksumming sector {0} of {1} ({2:F3} MiB/sec.)", i, blocks, currentSpeed); @@ -446,11 +451,13 @@ namespace DiscImageChef.Core.Devices.Dumping currentSpeed = ((double)blockSize * blocksToRead / (double)1048576) / (chkDuration / (double)1000); } + DicConsole.WriteLine(); dumpFile.Close(); end = DateTime.UtcNow; dumpLog.WriteLine("Checksum finished in {0} seconds.", (end - start).TotalSeconds); - dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalChkDuration / 1000)); + dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalChkDuration / 1000)); PluginBase plugins = new PluginBase(); plugins.RegisterAllPlugins(encoding); @@ -468,15 +475,8 @@ namespace DiscImageChef.Core.Devices.Dumping _imageFormat = ImageFormat.Detect(inputFilter); PartitionType[] xmlFileSysInfo = null; - try - { - if(!_imageFormat.OpenImage(inputFilter)) - _imageFormat = null; - } - catch - { - _imageFormat = null; - } + try { if(!_imageFormat.OpenImage(inputFilter)) _imageFormat = null; } + catch { _imageFormat = null; } if(_imageFormat != null) { @@ -500,8 +500,10 @@ namespace DiscImageChef.Core.Devices.Dumping Type = partitions[i].Type }; List lstFs = new List(); - dumpLog.WriteLine("Getting filesystems on partition {0}, starting at {1}, ending at {2}, with type {3}, under scheme {4}.", - i, partitions[i].Start, partitions[i].End, partitions[i].Type, partitions[i].Scheme); + dumpLog + .WriteLine("Getting filesystems on partition {0}, starting at {1}, ending at {2}, with type {3}, under scheme {4}.", + i, partitions[i].Start, partitions[i].End, partitions[i].Type, + partitions[i].Scheme); foreach(Filesystem _plugin in plugins.PluginsList.Values) { @@ -523,8 +525,7 @@ namespace DiscImageChef.Core.Devices.Dumping } } - if(lstFs.Count > 0) - xmlFileSysInfo[i].FileSystems = lstFs.ToArray(); + if(lstFs.Count > 0) xmlFileSysInfo[i].FileSystems = lstFs.ToArray(); } } else @@ -532,11 +533,7 @@ namespace DiscImageChef.Core.Devices.Dumping dumpLog.WriteLine("Getting filesystem for whole device."); xmlFileSysInfo = new PartitionType[1]; - xmlFileSysInfo[0] = new PartitionType - { - EndSector = (int)(blocks - 1), - StartSector = 0 - }; + xmlFileSysInfo[0] = new PartitionType {EndSector = (int)(blocks - 1), StartSector = 0}; List lstFs = new List(); Partition wholePart = new Partition @@ -566,8 +563,7 @@ namespace DiscImageChef.Core.Devices.Dumping } } - if(lstFs.Count > 0) - xmlFileSysInfo[0].FileSystems = lstFs.ToArray(); + if(lstFs.Count > 0) xmlFileSysInfo[0].FileSystems = lstFs.ToArray(); } } @@ -577,8 +573,7 @@ namespace DiscImageChef.Core.Devices.Dumping Metadata.MediaType.MediaTypeToString(MediaType.CompactFlash, out xmlDskTyp, out xmlDskSubTyp); else if(dev.IsPCMCIA) Metadata.MediaType.MediaTypeToString(MediaType.PCCardTypeI, out xmlDskTyp, out xmlDskSubTyp); - else - Metadata.MediaType.MediaTypeToString(MediaType.GENERIC_HDD, out xmlDskTyp, out xmlDskSubTyp); + else Metadata.MediaType.MediaTypeToString(MediaType.GENERIC_HDD, out xmlDskTyp, out xmlDskSubTyp); sidecar.BlockMedia[0].DiskType = xmlDskTyp; sidecar.BlockMedia[0].DiskSubType = xmlDskSubTyp; // TODO: Implement device firmware revision @@ -595,8 +590,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.BlockMedia[0].Model = dev.Model; sidecar.BlockMedia[0].Serial = dev.Serial; sidecar.BlockMedia[0].Size = (long)(blocks * blockSize); - if(xmlFileSysInfo != null) - sidecar.BlockMedia[0].FileSystemInformation = xmlFileSysInfo; + if(xmlFileSysInfo != null) sidecar.BlockMedia[0].FileSystemInformation = xmlFileSysInfo; if(cylinders > 0 && heads > 0 && sectors > 0) { sidecar.BlockMedia[0].Cylinders = cylinders; @@ -609,31 +603,31 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.WriteLine(); - DicConsole.WriteLine("Took a total of {0:F3} seconds ({1:F3} processing commands, {2:F3} checksumming).", (end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000); - DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1048576) / (totalDuration / 1000)); + DicConsole.WriteLine("Took a total of {0:F3} seconds ({1:F3} processing commands, {2:F3} checksumming).", + (end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000); + DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1048576) / (totalDuration / 1000)); DicConsole.WriteLine("Fastest speed burst: {0:F3} MiB/sec.", maxSpeed); DicConsole.WriteLine("Slowest speed burst: {0:F3} MiB/sec.", minSpeed); DicConsole.WriteLine("{0} sectors could not be read.", resume.BadBlocks.Count); - if(resume.BadBlocks.Count > 0) - resume.BadBlocks.Sort(); + if(resume.BadBlocks.Count > 0) resume.BadBlocks.Sort(); DicConsole.WriteLine(); if(!aborted) { DicConsole.WriteLine("Writing metadata sidecar"); - FileStream xmlFs = new FileStream(outputPrefix + ".cicm.xml", - FileMode.Create); + FileStream xmlFs = new FileStream(outputPrefix + ".cicm.xml", FileMode.Create); - System.Xml.Serialization.XmlSerializer xmlSer = new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); + System.Xml.Serialization.XmlSerializer xmlSer = + new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); xmlSer.Serialize(xmlFs, sidecar); xmlFs.Close(); } Statistics.AddMedia(MediaType.GENERIC_HDD, true); } - else - DicConsole.ErrorWriteLine("Unable to communicate with ATA device."); + else DicConsole.ErrorWriteLine("Unable to communicate with ATA device."); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Dumping/Alcohol120.cs b/DiscImageChef.Core/Devices/Dumping/Alcohol120.cs index 7a5329aa..ed436810 100644 --- a/DiscImageChef.Core/Devices/Dumping/Alcohol120.cs +++ b/DiscImageChef.Core/Devices/Dumping/Alcohol120.cs @@ -47,23 +47,17 @@ namespace DiscImageChef.Core.Devices.Dumping [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AlcoholHeader { - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] - public string signature; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] version; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string signature; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] version; public AlcoholMediumType type; public ushort sessions; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public ushort[] unknown1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public ushort[] unknown1; public ushort bcaLength; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public uint[] unknown2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] unknown2; public uint bcaOffset; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public uint[] unknown3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public uint[] unknown3; public uint structuresOffset; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public uint[] unknown4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] unknown4; public uint sessionOffset; public uint dpmOffset; } @@ -99,14 +93,12 @@ namespace DiscImageChef.Core.Devices.Dumping public byte pframe; public uint extraOffset; public ushort sectorSize; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] - public byte[] unknown; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] public byte[] unknown; public uint startLba; public ulong startOffset; public uint files; public uint footerOffset; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] - public byte[] unknown2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] unknown2; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -172,24 +164,23 @@ namespace DiscImageChef.Core.Devices.Dumping header = new AlcoholHeader { signature = "MEDIA DESCRIPTOR", - unknown1 = new ushort[] { 0x0002, 0x0000 }, + unknown1 = new ushort[] {0x0002, 0x0000}, unknown2 = new uint[2], unknown3 = new uint[6], unknown4 = new uint[3], - version = new byte[] { 1, 5 } + version = new byte[] {1, 5} }; header.version[0] = 1; header.version[1] = 5; tracks = new List(); sessions = new List(); trackLengths = new Dictionary(); - footer = new AlcoholFooter { widechar = 1 }; + footer = new AlcoholFooter {widechar = 1}; } public void Close() { - if(sessions.Count == 0 || tracks.Count == 0) - return; + if(sessions.Count == 0 || tracks.Count == 0) return; // Calculate first offsets header.sessions = (ushort)sessions.Count; @@ -201,7 +192,7 @@ namespace DiscImageChef.Core.Devices.Dumping for(int i = 0; i < sessionsArray.Length; i++) { sessionsArray[i].allBlocks = (byte)(((sessionsArray[i].lastTrack - sessionsArray[i].firstTrack) + 1) + - sessionsArray[i].nonTrackBlocks); + sessionsArray[i].nonTrackBlocks); sessionsArray[i].trackOffset = (uint)nextOffset; nextOffset += sessionsArray[i].allBlocks * 80; } @@ -214,10 +205,7 @@ namespace DiscImageChef.Core.Devices.Dumping if(tracksArray[i].point >= 0xA0) continue; if(!trackLengths.TryGetValue(tracksArray[i].point, out uint trkLen)) continue; - if(tracksArray[i].mode == AlcoholTrackMode.DVD) - { - tracksArray[i].extraOffset = trkLen; - } + if(tracksArray[i].mode == AlcoholTrackMode.DVD) { tracksArray[i].extraOffset = trkLen; } else { AlcoholTrackExtra extra = new AlcoholTrackExtra(); @@ -247,15 +235,15 @@ namespace DiscImageChef.Core.Devices.Dumping nextOffset += 4100; } - for(int i = 0; i < tracksArray.Length; i++) - tracksArray[i].footerOffset = (uint)nextOffset; + for(int i = 0; i < tracksArray.Length; i++) tracksArray[i].footerOffset = (uint)nextOffset; footer.filenameOffset = (uint)(nextOffset + 16); byte[] filename = Encoding.Unicode.GetBytes(outputPrefix + extension); // Open descriptor file here - FileStream descriptorFile = new FileStream(outputPrefix + ".mds", FileMode.Create, FileAccess.ReadWrite, FileShare.None); + FileStream descriptorFile = + new FileStream(outputPrefix + ".mds", FileMode.Create, FileAccess.ReadWrite, FileShare.None); byte[] tmp = new byte[88]; IntPtr hdrPtr = Marshal.AllocHGlobal(88); @@ -284,7 +272,8 @@ namespace DiscImageChef.Core.Devices.Dumping Marshal.FreeHGlobal(trkPtr); } - if(header.type == AlcoholMediumType.CD || header.type == AlcoholMediumType.CDR || header.type == AlcoholMediumType.CDRW) + if(header.type == AlcoholMediumType.CD || header.type == AlcoholMediumType.CDR || + header.type == AlcoholMediumType.CDRW) { foreach(AlcoholTrackExtra extra in extrasArray) { @@ -429,8 +418,7 @@ namespace DiscImageChef.Core.Devices.Dumping case TrackType.CDMode2Form2: trkArray[i].mode = AlcoholTrackMode.Mode2F2; break; - default: - throw new ArgumentOutOfRangeException(nameof(mode), mode, null); + default: throw new ArgumentOutOfRangeException(nameof(mode), mode, null); } switch(subMode) @@ -447,8 +435,7 @@ namespace DiscImageChef.Core.Devices.Dumping case TrackSubchannelType.Q16: case TrackSubchannelType.Q16Interleaved: throw new FeatureUnsupportedImageException("Specified subchannel type is not supported."); - default: - throw new ArgumentOutOfRangeException(nameof(subMode), subMode, null); + default: throw new ArgumentOutOfRangeException(nameof(subMode), subMode, null); } tracks = new List(trkArray); @@ -472,8 +459,7 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - if(trackLengths.ContainsKey(point)) - trackLengths.Remove(point); + if(trackLengths.ContainsKey(point)) trackLengths.Remove(point); trackLengths.Add(point, (uint)length); @@ -481,18 +467,15 @@ namespace DiscImageChef.Core.Devices.Dumping for(int i = 0; i < sess.Length; i++) { - if(sess[i].firstTrack == point) - sess[i].sessionStart = (int)startLba; - if(sess[i].lastTrack == point) - sess[i].sessionEnd = (int)(startLba + length); + if(sess[i].firstTrack == point) sess[i].sessionStart = (int)startLba; + if(sess[i].lastTrack == point) sess[i].sessionEnd = (int)(startLba + length); } sessions = new List(sess); - } public void AddTrack(byte adrCtl, byte tno, byte point, byte min, byte sec, byte frame, byte zero, byte pmin, - byte psec, byte pframe, byte session) + byte psec, byte pframe, byte session) { AlcoholTrack trk = new AlcoholTrack { @@ -519,11 +502,7 @@ namespace DiscImageChef.Core.Devices.Dumping AlcoholSession[] sess = sessions.ToArray(); - for(int i = 0; i < sess.Length; i++) - { - if(sess[i].sessionSequence == session) - sess[i].nonTrackBlocks++; - } + for(int i = 0; i < sess.Length; i++) { if(sess[i].sessionSequence == session) sess[i].nonTrackBlocks++; } sessions = new List(sess); } @@ -540,8 +519,7 @@ namespace DiscImageChef.Core.Devices.Dumping this.pfi = new byte[2048]; Array.Copy(pfi, 4, this.pfi, 0, 2048); } - else - this.pfi = pfi; + else this.pfi = pfi; } public void AddDMI(byte[] dmi) @@ -551,8 +529,7 @@ namespace DiscImageChef.Core.Devices.Dumping this.dmi = new byte[2048]; Array.Copy(dmi, 4, this.dmi, 0, 2048); } - else - this.dmi = dmi; + else this.dmi = dmi; } public void SetExtension(string extension) @@ -560,4 +537,4 @@ namespace DiscImageChef.Core.Devices.Dumping this.extension = extension; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs b/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs index 01be6230..814841dd 100644 --- a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs +++ b/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs @@ -51,7 +51,10 @@ namespace DiscImageChef.Core.Devices.Dumping internal class CompactDisc { - internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, ref MediaType dskType, bool separateSubchannel, ref Resume resume, ref DumpLog dumpLog, Alcohol120 alcohol, bool dumpLeadIn) + internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, + bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, + ref MediaType dskType, bool separateSubchannel, ref Resume resume, + ref DumpLog dumpLog, Alcohol120 alcohol, bool dumpLeadIn) { MHDDLog mhddLog; IBGLog ibgLog; @@ -76,10 +79,7 @@ namespace DiscImageChef.Core.Devices.Dumping ulong errored = 0; DataFile dumpFile = null; bool aborted = false; - System.Console.CancelKeyPress += (sender, e) => - { - e.Cancel = aborted = true; - }; + System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; }; // We discarded all discs that falsify a TOC before requesting a real TOC // No TOC, no CD (or an empty one) @@ -124,10 +124,13 @@ namespace DiscImageChef.Core.Devices.Dumping } dumpLog.WriteLine("Reading Disc Information"); - sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.DiscInformation, dev.Timeout, out duration); + sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, + MmcDiscInformationDataTypes.DiscInformation, dev.Timeout, + out duration); if(!sense) { - Decoders.SCSI.MMC.DiscInformation.StandardDiscInformation? discInfo = Decoders.SCSI.MMC.DiscInformation.Decode000b(cmdBuf); + Decoders.SCSI.MMC.DiscInformation.StandardDiscInformation? discInfo = + Decoders.SCSI.MMC.DiscInformation.Decode000b(cmdBuf); if(discInfo.HasValue) { // If it is a read-only CD, check CD type if available @@ -172,21 +175,20 @@ namespace DiscImageChef.Core.Devices.Dumping { foreach(FullTOC.TrackDataDescriptor track in toc.Value.TrackDescriptors) { - if(track.TNO == 1 && - ((TOC_CONTROL)(track.CONTROL & 0x0D) == TOC_CONTROL.DataTrack || - (TOC_CONTROL)(track.CONTROL & 0x0D) == TOC_CONTROL.DataTrackIncremental)) + if(track.TNO == 1 && ((TOC_CONTROL)(track.CONTROL & 0x0D) == TOC_CONTROL.DataTrack || + (TOC_CONTROL)(track.CONTROL & 0x0D) == + TOC_CONTROL.DataTrackIncremental)) { allFirstSessionTracksAreAudio &= firstTrackLastSession != 1; } if((TOC_CONTROL)(track.CONTROL & 0x0D) == TOC_CONTROL.DataTrack || - (TOC_CONTROL)(track.CONTROL & 0x0D) == TOC_CONTROL.DataTrackIncremental) + (TOC_CONTROL)(track.CONTROL & 0x0D) == TOC_CONTROL.DataTrackIncremental) { hasDataTrack = true; allFirstSessionTracksAreAudio &= track.TNO >= firstTrackLastSession; } - else - hasAudioTrack = true; + else hasAudioTrack = true; hasVideoTrack |= track.ADR == 4; } @@ -194,12 +196,9 @@ namespace DiscImageChef.Core.Devices.Dumping if(hasDataTrack && hasAudioTrack && allFirstSessionTracksAreAudio && sessions == 2) dskType = MediaType.CDPLUS; - if(!hasDataTrack && hasAudioTrack && sessions == 1) - dskType = MediaType.CDDA; - if(hasDataTrack && !hasAudioTrack && sessions == 1) - dskType = MediaType.CDROM; - if(hasVideoTrack && !hasDataTrack && sessions == 1) - dskType = MediaType.CDV; + if(!hasDataTrack && hasAudioTrack && sessions == 1) dskType = MediaType.CDDA; + if(hasDataTrack && !hasAudioTrack && sessions == 1) dskType = MediaType.CDROM; + if(hasVideoTrack && !hasDataTrack && sessions == 1) dskType = MediaType.CDV; } dumpLog.WriteLine("Reading PMA"); @@ -244,10 +243,8 @@ namespace DiscImageChef.Core.Devices.Dumping blockSize = 2448; subSize = 96; int sectorSize; - if(separateSubchannel) - sectorSize = (int)(blockSize - subSize); - else - sectorSize = (int)blockSize; + if(separateSubchannel) sectorSize = (int)(blockSize - subSize); + else sectorSize = (int)blockSize; if(toc == null) { @@ -271,15 +268,17 @@ namespace DiscImageChef.Core.Devices.Dumping sessionsForAlcohol[trk.SessionNumber - 1].EndTrack = trk.POINT; } } + alcohol.AddSessions(sessionsForAlcohol); foreach(FullTOC.TrackDataDescriptor trk in toc.Value.TrackDescriptors) { alcohol.AddTrack((byte)((trk.ADR << 4) & trk.CONTROL), trk.TNO, trk.POINT, trk.Min, trk.Sec, trk.Frame, - trk.Zero, trk.PMIN, trk.PSEC, trk.PFRAME, trk.SessionNumber); + trk.Zero, trk.PMIN, trk.PSEC, trk.PFRAME, trk.SessionNumber); } - FullTOC.TrackDataDescriptor[] sortedTracks = toc.Value.TrackDescriptors.OrderBy(track => track.POINT).ToArray(); + FullTOC.TrackDataDescriptor[] sortedTracks = + toc.Value.TrackDescriptors.OrderBy(track => track.POINT).ToArray(); List trackList = new List(); long lastSector = 0; string lastMSF = null; @@ -291,22 +290,18 @@ namespace DiscImageChef.Core.Devices.Dumping { TrackType track = new TrackType { - Sequence = new TrackSequenceType - { - Session = trk.SessionNumber, - TrackNumber = trk.POINT - } + Sequence = new TrackSequenceType {Session = trk.SessionNumber, TrackNumber = trk.POINT} }; if((TOC_CONTROL)(trk.CONTROL & 0x0D) == TOC_CONTROL.DataTrack || - (TOC_CONTROL)(trk.CONTROL & 0x0D) == TOC_CONTROL.DataTrackIncremental) + (TOC_CONTROL)(trk.CONTROL & 0x0D) == TOC_CONTROL.DataTrackIncremental) track.TrackType1 = TrackTypeTrackType.mode1; - else - track.TrackType1 = TrackTypeTrackType.audio; + else track.TrackType1 = TrackTypeTrackType.audio; if(trk.PHOUR > 0) - track.StartMSF = string.Format("{3:D2}:{0:D2}:{1:D2}:{2:D2}", trk.PMIN, trk.PSEC, trk.PFRAME, trk.PHOUR); - else - track.StartMSF = string.Format("{0:D2}:{1:D2}:{2:D2}", trk.PMIN, trk.PSEC, trk.PFRAME); - track.StartSector = trk.PHOUR * 3600 * 75 + trk.PMIN * 60 * 75 + trk.PSEC * 75 + trk.PFRAME - 150; + track.StartMSF = string.Format("{3:D2}:{0:D2}:{1:D2}:{2:D2}", trk.PMIN, trk.PSEC, + trk.PFRAME, trk.PHOUR); + else track.StartMSF = string.Format("{0:D2}:{1:D2}:{2:D2}", trk.PMIN, trk.PSEC, trk.PFRAME); + track.StartSector = trk.PHOUR * 3600 * 75 + trk.PMIN * 60 * 75 + trk.PSEC * 75 + trk.PFRAME - + 150; trackList.Add(track); } else if(trk.POINT == 0xA2) @@ -346,17 +341,15 @@ namespace DiscImageChef.Core.Devices.Dumping phour = trk.PHOUR; } - if(phour > 0) - lastMSF = string.Format("{3:D2}:{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe, phour); - else - lastMSF = string.Format("{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe); + if(phour > 0) lastMSF = string.Format("{3:D2}:{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe, phour); + else lastMSF = string.Format("{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe); lastSector = phour * 3600 * 75 + pmin * 60 * 75 + psec * 75 + pframe - 150; } } } TrackType[] tracks = trackList.ToArray(); - for(int t = 1; t < tracks.Length;t++) + for(int t = 1; t < tracks.Length; t++) { tracks[t - 1].EndSector = tracks[t].StartSector - 1; int phour = 0, pmin = 0, psec = 0; @@ -380,9 +373,9 @@ namespace DiscImageChef.Core.Devices.Dumping if(phour > 0) tracks[t - 1].EndMSF = string.Format("{3:D2}:{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe, phour); - else - tracks[t - 1].EndMSF = string.Format("{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe); + else tracks[t - 1].EndMSF = string.Format("{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe); } + tracks[tracks.Length - 1].EndMSF = lastMSF; tracks[tracks.Length - 1].EndSector = lastSector; blocks = (ulong)(lastSector + 1); @@ -393,23 +386,21 @@ namespace DiscImageChef.Core.Devices.Dumping return; } - if(dumpRaw) - { - throw new NotImplementedException("Raw CD dumping not yet implemented"); - } + if(dumpRaw) { throw new NotImplementedException("Raw CD dumping not yet implemented"); } else { // TODO: Check subchannel capabilities - readcd = !dev.ReadCd(out readBuffer, out senseBuf, 0, blockSize, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, - true, true, MmcErrorField.None, MmcSubchannel.Raw, dev.Timeout, out duration); + readcd = !dev.ReadCd(out readBuffer, out senseBuf, 0, blockSize, 1, MmcSectorTypes.AllTypes, false, + false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, + MmcSubchannel.Raw, dev.Timeout, out duration); - if(readcd) - DicConsole.WriteLine("Using MMC READ CD command."); + if(readcd) DicConsole.WriteLine("Using MMC READ CD command."); } DumpHardwareType currentTry = null; ExtentsULong extents = null; - ResumeSupport.Process(true, true, blocks, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformID, ref resume, ref currentTry, ref extents); + ResumeSupport.Process(true, true, blocks, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformID, + ref resume, ref currentTry, ref extents); if(currentTry == null || extents == null) throw new Exception("Could not process resume file, not continuing..."); @@ -503,14 +494,13 @@ namespace DiscImageChef.Core.Devices.Dumping { if(readcd) { - sense = dev.ReadCd(out readBuffer, out senseBuf, 0, blockSize, blocksToRead, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, - true, true, MmcErrorField.None, MmcSubchannel.Raw, dev.Timeout, out duration); - if(dev.Error || sense) - blocksToRead /= 2; + sense = dev.ReadCd(out readBuffer, out senseBuf, 0, blockSize, blocksToRead, + MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.None, MmcSubchannel.Raw, dev.Timeout, out duration); + if(dev.Error || sense) blocksToRead /= 2; } - if(!dev.Error || blocksToRead == 1) - break; + if(!dev.Error || blocksToRead == 1) break; } if(dev.Error || sense) @@ -532,17 +522,14 @@ namespace DiscImageChef.Core.Devices.Dumping dumpFile = new DataFile(outputPrefix + ".bin"); alcohol.SetExtension(".bin"); DataFile subFile = null; - if(separateSubchannel) - subFile = new DataFile(outputPrefix + ".sub"); + if(separateSubchannel) subFile = new DataFile(outputPrefix + ".sub"); mhddLog = new MHDDLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead); ibgLog = new IBGLog(outputPrefix + ".ibg", 0x0008); dumpFile.Seek(resume.NextBlock, (ulong)sectorSize); - if(separateSubchannel) - subFile.Seek(resume.NextBlock, subSize); + if(separateSubchannel) subFile.Seek(resume.NextBlock, subSize); - if(resume.NextBlock > 0) - dumpLog.WriteLine("Resuming from block {0}.", resume.NextBlock); + if(resume.NextBlock > 0) dumpLog.WriteLine("Resuming from block {0}.", resume.NextBlock); start = DateTime.UtcNow; for(int t = 0; t < tracks.Count(); t++) @@ -560,11 +547,7 @@ namespace DiscImageChef.Core.Devices.Dumping tracks[t].Size = (tracks[t].EndSector - tracks[t].StartSector + 1) * sectorSize; tracks[t].SubChannel = new SubChannelType { - Image = new ImageType - { - format = "rw_raw", - offsetSpecified = true - }, + Image = new ImageType {format = "rw_raw", offsetSpecified = true}, Size = (tracks[t].EndSector - tracks[t].StartSector + 1) * subSize }; if(separateSubchannel) @@ -578,8 +561,9 @@ namespace DiscImageChef.Core.Devices.Dumping tracks[t].SubChannel.Image.Value = tracks[t].Image.Value; } - alcohol.SetTrackSizes((byte)(t + 1), sectorSize, tracks[t].StartSector, dumpFile.Position, (tracks[t].EndSector - tracks[t].StartSector + 1)); - + alcohol.SetTrackSizes((byte)(t + 1), sectorSize, tracks[t].StartSector, dumpFile.Position, + (tracks[t].EndSector - tracks[t].StartSector + 1)); + bool checkedDataFormat = false; for(ulong i = resume.NextBlock; i <= (ulong)tracks[t].EndSector; i += blocksToRead) @@ -597,18 +581,18 @@ namespace DiscImageChef.Core.Devices.Dumping blocksToRead = (uint)((ulong)tracks[t].EndSector + 1 - i); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(currentSpeed > maxSpeed && currentSpeed != 0) - maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && currentSpeed != 0) - minSpeed = currentSpeed; + if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed; + if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator - DicConsole.Write("\rReading sector {0} of {1} at track {3} ({2:F3} MiB/sec.)", i, blocks, currentSpeed, t + 1); + DicConsole.Write("\rReading sector {0} of {1} at track {3} ({2:F3} MiB/sec.)", i, blocks, + currentSpeed, t + 1); if(readcd) { - sense = dev.ReadCd(out readBuffer, out senseBuf, (uint)i, blockSize, blocksToRead, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, - true, true, MmcErrorField.None, MmcSubchannel.Raw, dev.Timeout, out cmdDuration); + sense = dev.ReadCd(out readBuffer, out senseBuf, (uint)i, blockSize, blocksToRead, + MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.None, MmcSubchannel.Raw, dev.Timeout, out cmdDuration); totalDuration += cmdDuration; } @@ -625,14 +609,12 @@ namespace DiscImageChef.Core.Devices.Dumping subFile.Write(readBuffer, (int)(sectorSize + b * blockSize), (int)subSize); } } - else - dumpFile.Write(readBuffer); + else dumpFile.Write(readBuffer); } else { // TODO: Reset device after X errors - if(stopOnError) - return; // TODO: Return more cleanly + if(stopOnError) return; // TODO: Return more cleanly // Write empty data if(separateSubchannel) @@ -640,17 +622,15 @@ namespace DiscImageChef.Core.Devices.Dumping dumpFile.Write(new byte[sectorSize * blocksToRead]); subFile.Write(new byte[subSize * blocksToRead]); } - else - dumpFile.Write(new byte[blockSize * blocksToRead]); + else dumpFile.Write(new byte[blockSize * blocksToRead]); errored += blocksToRead; - for(ulong b = i; b < i + blocksToRead; b++) - resume.BadBlocks.Add(b); - DicConsole.DebugWriteLine("Dump-Media", "READ error:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); - if(cmdDuration < 500) - mhddLog.Write(i, 65535); - else - mhddLog.Write(i, cmdDuration); + for(ulong b = i; b < i + blocksToRead; b++) resume.BadBlocks.Add(b); + + DicConsole.DebugWriteLine("Dump-Media", "READ error:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); + if(cmdDuration < 500) mhddLog.Write(i, 65535); + else mhddLog.Write(i, cmdDuration); ibgLog.Write(i, 0); dumpLog.WriteLine("Error reading {0} sectors from sector {1}.", blocksToRead, i); @@ -660,7 +640,10 @@ namespace DiscImageChef.Core.Devices.Dumping { byte[] sync = new byte[12]; Array.Copy(readBuffer, 0, sync, 0, 12); - if(sync.SequenceEqual(new byte[] { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 })) + if(sync.SequenceEqual(new byte[] + { + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 + })) { switch(readBuffer[15]) { @@ -711,21 +694,25 @@ namespace DiscImageChef.Core.Devices.Dumping case TrackTypeTrackType.mode0: trkType = ImagePlugins.TrackType.Data; break; - default: - throw new ArgumentOutOfRangeException(); + default: throw new ArgumentOutOfRangeException(); } alcohol.SetTrackTypes((byte)(t + 1), trkType, - separateSubchannel ? TrackSubchannelType.None : TrackSubchannelType.RawInterleaved); + separateSubchannel + ? TrackSubchannelType.None + : TrackSubchannelType.RawInterleaved); } + DicConsole.WriteLine(); end = DateTime.UtcNow; mhddLog.Close(); #pragma warning disable IDE0004 // Remove Unnecessary Cast - ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); + ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); #pragma warning restore IDE0004 // Remove Unnecessary Cast dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds); - dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); + dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); #region Compact Disc Error handling if(resume.BadBlocks.Count > 0 && !aborted) @@ -734,7 +721,7 @@ namespace DiscImageChef.Core.Devices.Dumping bool forward = true; bool runningPersistent = false; - cdRepeatRetry: + cdRepeatRetry: ulong[] tmpArray = resume.BadBlocks.ToArray(); foreach(ulong badSector in tmpArray) { @@ -747,12 +734,15 @@ namespace DiscImageChef.Core.Devices.Dumping double cmdDuration = 0; - DicConsole.Write("\rRetrying sector {0}, pass {1}, {3}{2}", badSector, pass + 1, forward ? "forward" : "reverse", runningPersistent ? "recovering partial data, " : ""); + DicConsole.Write("\rRetrying sector {0}, pass {1}, {3}{2}", badSector, pass + 1, + forward ? "forward" : "reverse", + runningPersistent ? "recovering partial data, " : ""); if(readcd) { - sense = dev.ReadCd(out readBuffer, out senseBuf, (uint)badSector, blockSize, blocksToRead, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, - true, true, MmcErrorField.None, MmcSubchannel.Raw, dev.Timeout, out cmdDuration); + sense = dev.ReadCd(out readBuffer, out senseBuf, (uint)badSector, blockSize, blocksToRead, + MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.None, MmcSubchannel.Raw, dev.Timeout, out cmdDuration); totalDuration += cmdDuration; } @@ -764,14 +754,13 @@ namespace DiscImageChef.Core.Devices.Dumping extents.Add(badSector); dumpLog.WriteLine("Correctly retried sector {0} in pass {1}.", badSector, pass); } - + if(separateSubchannel) { dumpFile.WriteAt(readBuffer, badSector, (uint)sectorSize, 0, sectorSize); subFile.WriteAt(readBuffer, badSector, subSize, sectorSize, (int)subSize); } - else - dumpFile.WriteAt(readBuffer, badSector, blockSize); + else dumpFile.WriteAt(readBuffer, badSector, blockSize); } } @@ -791,47 +780,39 @@ namespace DiscImageChef.Core.Devices.Dumping if(!runningPersistent && persistent) { - sense = dev.ModeSense6(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current, 0x01, dev.Timeout, out duration); + sense = dev.ModeSense6(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current, 0x01, + dev.Timeout, out duration); if(sense) { - sense = dev.ModeSense10(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current, 0x01, dev.Timeout, out duration); - if(!sense) - currentMode = Decoders.SCSI.Modes.DecodeMode10(readBuffer, dev.SCSIType); + sense = dev.ModeSense10(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current, + 0x01, dev.Timeout, out duration); + if(!sense) currentMode = Decoders.SCSI.Modes.DecodeMode10(readBuffer, dev.SCSIType); } - else - currentMode = Decoders.SCSI.Modes.DecodeMode6(readBuffer, dev.SCSIType); + else currentMode = Decoders.SCSI.Modes.DecodeMode6(readBuffer, dev.SCSIType); - if(currentMode.HasValue) - currentModePage = currentMode.Value.Pages[0]; + if(currentMode.HasValue) currentModePage = currentMode.Value.Pages[0]; - Decoders.SCSI.Modes.ModePage_01_MMC pgMMC = new Decoders.SCSI.Modes.ModePage_01_MMC - { - PS = false, - ReadRetryCount = 255, - Parameter = 0x20 - }; + Decoders.SCSI.Modes.ModePage_01_MMC pgMMC = + new Decoders.SCSI.Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20}; Decoders.SCSI.Modes.DecodedMode md = new Decoders.SCSI.Modes.DecodedMode { Header = new Decoders.SCSI.Modes.ModeHeader(), Pages = new Decoders.SCSI.Modes.ModePage[] - { - new Decoders.SCSI.Modes.ModePage - { - Page = 0x01, - Subpage = 0x00, - PageResponse = Decoders.SCSI.Modes.EncodeModePage_01_MMC(pgMMC) - } - } + { + new Decoders.SCSI.Modes.ModePage + { + Page = 0x01, + Subpage = 0x00, + PageResponse = Decoders.SCSI.Modes.EncodeModePage_01_MMC(pgMMC) + } + } }; md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType); md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.SCSIType); dumpLog.WriteLine("Sending MODE SELECT to drive."); sense = dev.ModeSelect(md6, out senseBuf, true, false, dev.Timeout, out duration); - if(sense) - { - sense = dev.ModeSelect10(md10, out senseBuf, true, false, dev.Timeout, out duration); - } + if(sense) { sense = dev.ModeSelect10(md10, out senseBuf, true, false, dev.Timeout, out duration); } runningPersistent = true; if(!sense && !dev.Error) @@ -845,32 +826,26 @@ namespace DiscImageChef.Core.Devices.Dumping Decoders.SCSI.Modes.DecodedMode md = new Decoders.SCSI.Modes.DecodedMode { Header = new Decoders.SCSI.Modes.ModeHeader(), - Pages = new Decoders.SCSI.Modes.ModePage[] - { - currentModePage.Value - } + Pages = new Decoders.SCSI.Modes.ModePage[] {currentModePage.Value} }; md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType); md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.SCSIType); dumpLog.WriteLine("Sending MODE SELECT to drive."); sense = dev.ModeSelect(md6, out senseBuf, true, false, dev.Timeout, out duration); - if(sense) - { - sense = dev.ModeSelect10(md10, out senseBuf, true, false, dev.Timeout, out duration); - } + if(sense) { sense = dev.ModeSelect10(md10, out senseBuf, true, false, dev.Timeout, out duration); } } DicConsole.WriteLine(); } #endregion Compact Disc Error handling + resume.BadBlocks.Sort(); currentTry.Extents = Metadata.ExtentsConverter.ToMetadata(extents); dataChk = new Checksum(); dumpFile.Seek(0, SeekOrigin.Begin); - if(separateSubchannel) - subFile.Seek(0, SeekOrigin.Begin); + if(separateSubchannel) subFile.Seek(0, SeekOrigin.Begin); blocksToRead = 500; dumpLog.WriteLine("Checksum starts."); @@ -890,7 +865,8 @@ namespace DiscImageChef.Core.Devices.Dumping if(((ulong)tracks[t].EndSector + 1 - i) < blocksToRead) blocksToRead = (uint)((ulong)tracks[t].EndSector + 1 - i); - DicConsole.Write("\rChecksumming sector {0} of {1} at track {3} ({2:F3} MiB/sec.)", i, blocks, currentSpeed, t + 1); + DicConsole.Write("\rChecksumming sector {0} of {1} at track {3} ({2:F3} MiB/sec.)", i, blocks, + currentSpeed, t + 1); DateTime chkStart = DateTime.UtcNow; byte[] dataToCheck = new byte[blockSize * blocksToRead]; @@ -913,6 +889,7 @@ namespace DiscImageChef.Core.Devices.Dumping dataChk.Update(dataToCheck); trkChk.Update(dataToCheck); } + DateTime chkEnd = DateTime.UtcNow; double chkDuration = (chkEnd - chkStart).TotalMilliseconds; @@ -924,16 +901,16 @@ namespace DiscImageChef.Core.Devices.Dumping } tracks[t].Checksums = trkChk.End().ToArray(); - if(separateSubchannel) - tracks[t].SubChannel.Checksums = subChk.End().ToArray(); - else - tracks[t].SubChannel.Checksums = tracks[t].Checksums; + if(separateSubchannel) tracks[t].SubChannel.Checksums = subChk.End().ToArray(); + else tracks[t].SubChannel.Checksums = tracks[t].Checksums; } + DicConsole.WriteLine(); dumpFile.Close(); end = DateTime.UtcNow; dumpLog.WriteLine("Checksum finished in {0} seconds.", (end - start).TotalSeconds); - dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalChkDuration / 1000)); + dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalChkDuration / 1000)); // TODO: Correct this sidecar.OpticalDisc[0].Checksums = dataChk.End().ToArray(); @@ -944,7 +921,7 @@ namespace DiscImageChef.Core.Devices.Dumping Value = outputPrefix + ".bin" }; sidecar.OpticalDisc[0].Sessions = toc.Value.LastCompleteSession; - sidecar.OpticalDisc[0].Tracks = new[] { tracks.Count() }; + sidecar.OpticalDisc[0].Tracks = new[] {tracks.Count()}; sidecar.OpticalDisc[0].Track = tracks; sidecar.OpticalDisc[0].Dimensions = Metadata.Dimensions.DimensionsFromMediaType(dskType); Metadata.MediaType.MediaTypeToString(dskType, out string xmlDskTyp, out string xmlDskSubTyp); @@ -955,10 +932,10 @@ namespace DiscImageChef.Core.Devices.Dumping { DicConsole.WriteLine("Writing metadata sidecar"); - FileStream xmlFs = new FileStream(outputPrefix + ".cicm.xml", - FileMode.Create); + FileStream xmlFs = new FileStream(outputPrefix + ".cicm.xml", FileMode.Create); - System.Xml.Serialization.XmlSerializer xmlSer = new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); + System.Xml.Serialization.XmlSerializer xmlSer = + new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); xmlSer.Serialize(xmlFs, sidecar); xmlFs.Close(); alcohol.Close(); @@ -967,4 +944,4 @@ namespace DiscImageChef.Core.Devices.Dumping Statistics.AddMedia(dskType, true); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Dumping/MMC.cs b/DiscImageChef.Core/Devices/Dumping/MMC.cs index 6910c2e8..65a4eaa2 100644 --- a/DiscImageChef.Core/Devices/Dumping/MMC.cs +++ b/DiscImageChef.Core/Devices/Dumping/MMC.cs @@ -42,7 +42,10 @@ namespace DiscImageChef.Core.Devices.Dumping { internal static class MMC { - internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, ref MediaType dskType, bool separateSubchannel, ref Metadata.Resume resume, ref DumpLog dumpLog, bool dumpLeadIn, Encoding encoding) + internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, + bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, + ref MediaType dskType, bool separateSubchannel, ref Metadata.Resume resume, + ref DumpLog dumpLog, bool dumpLeadIn, Encoding encoding) { byte[] cmdBuf = null; byte[] senseBuf = null; @@ -60,7 +63,8 @@ namespace DiscImageChef.Core.Devices.Dumping // TODO: Log not only what is it reading, but if it was read correctly or not. - sense = dev.GetConfiguration(out cmdBuf, out senseBuf, 0, MmcGetConfigurationRt.Current, dev.Timeout, out duration); + sense = dev.GetConfiguration(out cmdBuf, out senseBuf, 0, MmcGetConfigurationRt.Current, dev.Timeout, + out duration); if(!sense) { Decoders.SCSI.MMC.Features.SeparatedFeatures ftr = Decoders.SCSI.MMC.Features.Separate(cmdBuf); @@ -164,7 +168,9 @@ namespace DiscImageChef.Core.Devices.Dumping if(compactDisc) { - CompactDisc.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, separateSubchannel, ref resume, ref dumpLog, alcohol, dumpLeadIn); + CompactDisc.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, + ref sidecar, ref dskType, separateSubchannel, ref resume, ref dumpLog, alcohol, + dumpLeadIn); return; } @@ -176,17 +182,19 @@ namespace DiscImageChef.Core.Devices.Dumping if(dskType == MediaType.Unknown && blocks > 0) { dumpLog.WriteLine("Reading Physical Format Information"); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration); if(!sense) { Decoders.DVD.PFI.PhysicalFormatInformation? nintendoPfi = Decoders.DVD.PFI.Decode(cmdBuf); if(nintendoPfi != null) { if(nintendoPfi.Value.DiskCategory == Decoders.DVD.DiskCategory.Nintendo && - nintendoPfi.Value.PartVersion == 15) + nintendoPfi.Value.PartVersion == 15) { dumpLog.WriteLine("Dumping Nintendo GameCube or Wii discs is not yet implemented."); - throw new NotImplementedException("Dumping Nintendo GameCube or Wii discs is not yet implemented."); + throw new + NotImplementedException("Dumping Nintendo GameCube or Wii discs is not yet implemented."); } } } @@ -194,18 +202,16 @@ namespace DiscImageChef.Core.Devices.Dumping #endregion Nintendo #region All DVD and HD DVD types - if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDPR || - dskType == MediaType.DVDPRDL || dskType == MediaType.DVDPRW || - dskType == MediaType.DVDPRWDL || dskType == MediaType.DVDR || - dskType == MediaType.DVDRAM || dskType == MediaType.DVDRDL || - dskType == MediaType.DVDROM || dskType == MediaType.DVDRW || - dskType == MediaType.DVDRWDL || dskType == MediaType.HDDVDR || - dskType == MediaType.HDDVDRAM || dskType == MediaType.HDDVDRDL || - dskType == MediaType.HDDVDROM || dskType == MediaType.HDDVDRW || - dskType == MediaType.HDDVDRWDL) + if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDPR || dskType == MediaType.DVDPRDL || + dskType == MediaType.DVDPRW || dskType == MediaType.DVDPRWDL || dskType == MediaType.DVDR || + dskType == MediaType.DVDRAM || dskType == MediaType.DVDRDL || dskType == MediaType.DVDROM || + dskType == MediaType.DVDRW || dskType == MediaType.DVDRWDL || dskType == MediaType.HDDVDR || + dskType == MediaType.HDDVDRAM || dskType == MediaType.HDDVDRDL || dskType == MediaType.HDDVDROM || + dskType == MediaType.HDDVDRW || dskType == MediaType.HDDVDRWDL) { dumpLog.WriteLine("Reading Physical Format Information"); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration); if(!sense) { alcohol.AddPFI(cmdBuf); @@ -242,10 +248,8 @@ namespace DiscImageChef.Core.Devices.Dumping dskType = MediaType.DVDPRWDL; break; case Decoders.DVD.DiskCategory.DVDR: - if(decPfi.PartVersion == 6) - dskType = MediaType.DVDRDL; - else - dskType = MediaType.DVDR; + if(decPfi.PartVersion == 6) dskType = MediaType.DVDRDL; + else dskType = MediaType.DVDR; break; case Decoders.DVD.DiskCategory.DVDRAM: dskType = MediaType.DVDRAM; @@ -254,10 +258,8 @@ namespace DiscImageChef.Core.Devices.Dumping dskType = MediaType.DVDROM; break; case Decoders.DVD.DiskCategory.DVDRW: - if(decPfi.PartVersion == 3) - dskType = MediaType.DVDRWDL; - else - dskType = MediaType.DVDRW; + if(decPfi.PartVersion == 3) dskType = MediaType.DVDRWDL; + else dskType = MediaType.DVDRW; break; case Decoders.DVD.DiskCategory.HDDVDR: dskType = MediaType.HDDVDR; @@ -272,10 +274,8 @@ namespace DiscImageChef.Core.Devices.Dumping dskType = MediaType.HDDVDRW; break; case Decoders.DVD.DiskCategory.Nintendo: - if(decPfi.DiscSize == Decoders.DVD.DVDSize.Eighty) - dskType = MediaType.GOD; - else - dskType = MediaType.WOD; + if(decPfi.DiscSize == Decoders.DVD.DVDSize.Eighty) dskType = MediaType.GOD; + else dskType = MediaType.WOD; break; case Decoders.DVD.DiskCategory.UMD: dskType = MediaType.UMD; @@ -286,13 +286,14 @@ namespace DiscImageChef.Core.Devices.Dumping } dumpLog.WriteLine("Reading Disc Manufacturing Information"); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout, + out duration); if(!sense) { if(Decoders.Xbox.DMI.IsXbox(cmdBuf) || Decoders.Xbox.DMI.IsXbox360(cmdBuf)) { - if(Decoders.Xbox.DMI.IsXbox(cmdBuf)) - dskType = MediaType.XGD; + if(Decoders.Xbox.DMI.IsXbox(cmdBuf)) dskType = MediaType.XGD; else if(Decoders.Xbox.DMI.IsXbox360(cmdBuf)) { dskType = MediaType.XGD2; @@ -307,15 +308,18 @@ namespace DiscImageChef.Core.Devices.Dumping sense = dev.ScsiInquiry(out byte[] inqBuf, out senseBuf); if(sense || !Decoders.SCSI.Inquiry.Decode(inqBuf).HasValue || - (Decoders.SCSI.Inquiry.Decode(inqBuf).HasValue && !Decoders.SCSI.Inquiry.Decode(inqBuf).Value.KreonPresent)) + (Decoders.SCSI.Inquiry.Decode(inqBuf).HasValue && + !Decoders.SCSI.Inquiry.Decode(inqBuf).Value.KreonPresent)) { dumpLog.WriteLine("Dumping Xbox Game Discs requires a drive with Kreon firmware."); - throw new NotImplementedException("Dumping Xbox Game Discs requires a drive with Kreon firmware."); + throw new + NotImplementedException("Dumping Xbox Game Discs requires a drive with Kreon firmware."); } if(dumpRaw && !force) { - DicConsole.ErrorWriteLine("Not continuing. If you want to continue reading cooked data when raw is not available use the force option."); + DicConsole + .ErrorWriteLine("Not continuing. If you want to continue reading cooked data when raw is not available use the force option."); // TODO: Exit more gracefully return; } @@ -324,7 +328,7 @@ namespace DiscImageChef.Core.Devices.Dumping } alcohol.AddDMI(cmdBuf); - + if(cmdBuf.Length == 2052) { tmpBuf = new byte[cmdBuf.Length - 4]; @@ -345,7 +349,9 @@ namespace DiscImageChef.Core.Devices.Dumping if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM) { dumpLog.WriteLine("Reading Lead-in Copyright Information."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout, + out duration); if(!sense) { if(Decoders.DVD.CSS_CPRM.DecodeLeadInCopyright(cmdBuf).HasValue) @@ -360,7 +366,8 @@ namespace DiscImageChef.Core.Devices.Dumping }; DataFile.WriteTo("SCSI Dump", sidecar.OpticalDisc[0].CMI.Image, tmpBuf); - Decoders.DVD.CSS_CPRM.LeadInCopyright cpy = Decoders.DVD.CSS_CPRM.DecodeLeadInCopyright(cmdBuf).Value; + Decoders.DVD.CSS_CPRM.LeadInCopyright cpy = + Decoders.DVD.CSS_CPRM.DecodeLeadInCopyright(cmdBuf).Value; if(cpy.CopyrightType != Decoders.DVD.CopyrightType.NoProtection) sidecar.OpticalDisc[0].CopyProtection = cpy.CopyrightType.ToString(); } @@ -369,11 +376,11 @@ namespace DiscImageChef.Core.Devices.Dumping #endregion DVD-ROM #region DVD-ROM and HD DVD-ROM - if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM || - dskType == MediaType.HDDVDROM) + if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM || dskType == MediaType.HDDVDROM) { dumpLog.WriteLine("Reading Burst Cutting Area."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, out duration); if(!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; @@ -394,7 +401,8 @@ namespace DiscImageChef.Core.Devices.Dumping if(dskType == MediaType.DVDRAM || dskType == MediaType.HDDVDRAM) { dumpLog.WriteLine("Reading Disc Description Structure."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_DDS, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDRAM_DDS, 0, dev.Timeout, out duration); if(!sense) { if(Decoders.DVD.DDS.Decode(cmdBuf).HasValue) @@ -412,7 +420,9 @@ namespace DiscImageChef.Core.Devices.Dumping } dumpLog.WriteLine("Reading Spare Area Information."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, 0, dev.Timeout, + out duration); if(!sense) { if(Decoders.DVD.Spare.Decode(cmdBuf).HasValue) @@ -435,7 +445,8 @@ namespace DiscImageChef.Core.Devices.Dumping if(dskType == MediaType.DVDR || dskType == MediaType.DVDRW) { dumpLog.WriteLine("Reading Pre-Recorded Information."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PreRecordedInfo, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.PreRecordedInfo, 0, dev.Timeout, out duration); if(!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; @@ -455,7 +466,9 @@ namespace DiscImageChef.Core.Devices.Dumping if(dskType == MediaType.DVDR || dskType == MediaType.DVDRW || dskType == MediaType.HDDVDR) { dumpLog.WriteLine("Reading Media Identifier."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_MediaIdentifier, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDR_MediaIdentifier, 0, dev.Timeout, + out duration); if(!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; @@ -470,7 +483,9 @@ namespace DiscImageChef.Core.Devices.Dumping } dumpLog.WriteLine("Reading Recordable Physical Information."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_PhysicalInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDR_PhysicalInformation, 0, dev.Timeout, + out duration); if(!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; @@ -487,11 +502,12 @@ namespace DiscImageChef.Core.Devices.Dumping #endregion DVD-R, DVD-RW and HD DVD-R #region All DVD+ - if(dskType == MediaType.DVDPR || dskType == MediaType.DVDPRDL || - dskType == MediaType.DVDPRW || dskType == MediaType.DVDPRWDL) + if(dskType == MediaType.DVDPR || dskType == MediaType.DVDPRDL || dskType == MediaType.DVDPRW || + dskType == MediaType.DVDPRWDL) { dumpLog.WriteLine("Reading ADdress In Pregroove."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.ADIP, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.ADIP, 0, dev.Timeout, out duration); if(!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; @@ -506,7 +522,8 @@ namespace DiscImageChef.Core.Devices.Dumping } dumpLog.WriteLine("Reading Disc Control Blocks."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DCB, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DCB, 0, dev.Timeout, out duration); if(!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; @@ -526,7 +543,9 @@ namespace DiscImageChef.Core.Devices.Dumping if(dskType == MediaType.HDDVDROM) { dumpLog.WriteLine("Reading Lead-in Copyright Information."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVD_CopyrightInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.HDDVD_CopyrightInformation, 0, dev.Timeout, + out duration); if(!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; @@ -544,10 +563,11 @@ namespace DiscImageChef.Core.Devices.Dumping #region All Blu-ray if(dskType == MediaType.BDR || dskType == MediaType.BDRE || dskType == MediaType.BDROM || - dskType == MediaType.BDRXL || dskType == MediaType.BDREXL) + dskType == MediaType.BDRXL || dskType == MediaType.BDREXL) { dumpLog.WriteLine("Reading Disc Information."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.DiscInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.DiscInformation, 0, dev.Timeout, out duration); if(!sense) { if(Decoders.Bluray.DI.Decode(cmdBuf).HasValue) @@ -565,7 +585,8 @@ namespace DiscImageChef.Core.Devices.Dumping } dumpLog.WriteLine("Reading PAC."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.PAC, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.PAC, 0, dev.Timeout, out duration); if(!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; @@ -581,12 +602,12 @@ namespace DiscImageChef.Core.Devices.Dumping } #endregion All Blu-ray - #region BD-ROM only if(dskType == MediaType.BDROM) { dumpLog.WriteLine("Reading Burst Cutting Area."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_BurstCuttingArea, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.BD_BurstCuttingArea, 0, dev.Timeout, out duration); if(!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; @@ -604,11 +625,12 @@ namespace DiscImageChef.Core.Devices.Dumping #endregion BD-ROM only #region Writable Blu-ray only - if(dskType == MediaType.BDR || dskType == MediaType.BDRE || - dskType == MediaType.BDRXL || dskType == MediaType.BDREXL) + if(dskType == MediaType.BDR || dskType == MediaType.BDRE || dskType == MediaType.BDRXL || + dskType == MediaType.BDREXL) { dumpLog.WriteLine("Reading Disc Definition Structure."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_DDS, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.BD_DDS, 0, dev.Timeout, out duration); if(!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; @@ -623,7 +645,9 @@ namespace DiscImageChef.Core.Devices.Dumping } dumpLog.WriteLine("Reading Spare Area Information."); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_SpareAreaInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.BD_SpareAreaInformation, 0, dev.Timeout, + out duration); if(!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; @@ -641,11 +665,13 @@ namespace DiscImageChef.Core.Devices.Dumping if(isXbox) { - XGD.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, ref resume, ref dumpLog, encoding); + XGD.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, + ref sidecar, ref dskType, ref resume, ref dumpLog, encoding); return; } - SBC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, true, ref resume, ref dumpLog, encoding, alcohol); + SBC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, + ref dskType, true, ref resume, ref dumpLog, encoding, alcohol); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Dumping/NVMe.cs b/DiscImageChef.Core/Devices/Dumping/NVMe.cs index 46a161a5..42fd0620 100644 --- a/DiscImageChef.Core/Devices/Dumping/NVMe.cs +++ b/DiscImageChef.Core/Devices/Dumping/NVMe.cs @@ -39,9 +39,11 @@ namespace DiscImageChef.Core.Devices.Dumping { public static class NVMe { - public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref Metadata.Resume resume, ref DumpLog dumpLog, Encoding encoding) + public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, + bool dumpRaw, bool persistent, bool stopOnError, ref Metadata.Resume resume, + ref DumpLog dumpLog, Encoding encoding) { throw new NotImplementedException("NVMe devices not yet supported."); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs b/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs index 1f2ed8b6..e0aa9120 100644 --- a/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs +++ b/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs @@ -40,45 +40,51 @@ namespace DiscImageChef.Core.Devices.Dumping { public static class ResumeSupport { - public static void Process(bool isLba, bool removable, ulong blocks, string Manufacturer, string Model, string Serial, Interop.PlatformID platform, ref Resume resume, ref DumpHardwareType currentTry, ref ExtentsULong extents) + public static void Process(bool isLba, bool removable, ulong blocks, string Manufacturer, string Model, + string Serial, Interop.PlatformID platform, ref Resume resume, + ref DumpHardwareType currentTry, ref ExtentsULong extents) { if(resume != null) { - if(!isLba) - throw new NotImplementedException("Resuming CHS devices is currently not supported."); + if(!isLba) throw new NotImplementedException("Resuming CHS devices is currently not supported."); if(resume.Removable != removable) - throw new Exception(string.Format("Resume file specifies a {0} device but you're requesting to dump a {1} device, not continuing...", - resume.Removable ? "removable" : "non removable", - removable ? "removable" : "non removable")); + throw new + Exception(string.Format("Resume file specifies a {0} device but you're requesting to dump a {1} device, not continuing...", + resume.Removable ? "removable" : "non removable", + removable ? "removable" : "non removable")); if(resume.LastBlock != blocks - 1) - throw new Exception(string.Format("Resume file specifies a device with {0} blocks but you're requesting to dump one with {1} blocks, not continuing...", - resume.LastBlock + 1, blocks)); - + throw new + Exception(string.Format("Resume file specifies a device with {0} blocks but you're requesting to dump one with {1} blocks, not continuing...", + resume.LastBlock + 1, blocks)); foreach(DumpHardwareType oldtry in resume.Tries) { if(oldtry.Manufacturer != Manufacturer && !removable) - throw new Exception(string.Format("Resume file specifies a device manufactured by {0} but you're requesting to dump one by {1}, not continuing...", - oldtry.Manufacturer, Manufacturer)); + throw new + Exception(string.Format("Resume file specifies a device manufactured by {0} but you're requesting to dump one by {1}, not continuing...", + oldtry.Manufacturer, Manufacturer)); if(oldtry.Model != Model && !removable) - throw new Exception(string.Format("Resume file specifies a device model {0} but you're requesting to dump model {1}, not continuing...", - oldtry.Model, Model)); + throw new + Exception(string.Format("Resume file specifies a device model {0} but you're requesting to dump model {1}, not continuing...", + oldtry.Model, Model)); if(oldtry.Serial != Serial && !removable) - throw new Exception(string.Format("Resume file specifies a device with serial {0} but you're requesting to dump one with serial {1}, not continuing...", - oldtry.Serial, Serial)); + throw new + Exception(string.Format("Resume file specifies a device with serial {0} but you're requesting to dump one with serial {1}, not continuing...", + oldtry.Serial, Serial)); - if(oldtry.Software == null) - throw new Exception("Found corrupt resume file, cannot continue..."); + if(oldtry.Software == null) throw new Exception("Found corrupt resume file, cannot continue..."); - if(oldtry.Software.Name == "DiscImageChef" && oldtry.Software.OperatingSystem == platform.ToString() && oldtry.Software.Version == Version.GetVersion()) + if(oldtry.Software.Name == "DiscImageChef" && + oldtry.Software.OperatingSystem == platform.ToString() && + oldtry.Software.Version == Version.GetVersion()) { - if(removable && (oldtry.Manufacturer != Manufacturer || oldtry.Model != Model || oldtry.Serial != Serial)) - continue; - + if(removable && (oldtry.Manufacturer != Manufacturer || oldtry.Model != Model || + oldtry.Serial != Serial)) continue; + currentTry = oldtry; extents = ExtentsConverter.FromMetadata(currentTry.Extents); break; @@ -120,4 +126,4 @@ namespace DiscImageChef.Core.Devices.Dumping } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Dumping/SBC.cs b/DiscImageChef.Core/Devices/Dumping/SBC.cs index 165695cf..fc7d2bb7 100644 --- a/DiscImageChef.Core/Devices/Dumping/SBC.cs +++ b/DiscImageChef.Core/Devices/Dumping/SBC.cs @@ -51,7 +51,10 @@ namespace DiscImageChef.Core.Devices.Dumping internal static class SBC { - internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, ref MediaType dskType, bool opticalDisc, ref Metadata.Resume resume, ref DumpLog dumpLog, Encoding encoding, Alcohol120 alcohol = null) + internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, + bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, + ref MediaType dskType, bool opticalDisc, ref Metadata.Resume resume, + ref DumpLog dumpLog, Encoding encoding, Alcohol120 alcohol = null) { MHDDLog mhddLog; IBGLog ibgLog; @@ -80,10 +83,7 @@ namespace DiscImageChef.Core.Devices.Dumping ulong errored = 0; DataFile dumpFile = null; bool aborted = false; - System.Console.CancelKeyPress += (sender, e) => - { - e.Cancel = aborted = true; - }; + System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; }; dumpLog.WriteLine("Initializing reader."); Reader scsiReader = new Reader(dev, dev.Timeout, null, dumpRaw); @@ -99,8 +99,8 @@ namespace DiscImageChef.Core.Devices.Dumping if(blocks != 0 && blockSize != 0) { blocks++; - DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", - blocks, blockSize, blocks * (ulong)blockSize); + DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", blocks, + blockSize, blocks * (ulong)blockSize); } // Check how many blocks to read, if error show and return if(scsiReader.GetBlocksToRead()) @@ -109,6 +109,7 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine(scsiReader.ErrorMessage); return; } + blocksToRead = scsiReader.BlocksToRead; logicalBlockSize = blockSize; physicalBlockSize = scsiReader.PhysicalBlockSize; @@ -121,10 +122,10 @@ namespace DiscImageChef.Core.Devices.Dumping } if(dskType == MediaType.Unknown) - dskType = MediaTypeFromSCSI.Get((byte)dev.SCSIType, dev.Manufacturer, dev.Model, scsiMediumType, scsiDensityCode, blocks, blockSize); + dskType = MediaTypeFromSCSI.Get((byte)dev.SCSIType, dev.Manufacturer, dev.Model, scsiMediumType, + scsiDensityCode, blocks, blockSize); - if(dskType == MediaType.Unknown && dev.IsUSB && containsFloppyPage) - dskType = MediaType.FlashDrive; + if(dskType == MediaType.Unknown && dev.IsUSB && containsFloppyPage) dskType = MediaType.FlashDrive; DicConsole.WriteLine("Media identified as {0}", dskType); @@ -224,16 +225,17 @@ namespace DiscImageChef.Core.Devices.Dumping } } - if(evpds.Count > 0) - sidecar.BlockMedia[0].SCSI.EVPD = evpds.ToArray(); + if(evpds.Count > 0) sidecar.BlockMedia[0].SCSI.EVPD = evpds.ToArray(); } } dumpLog.WriteLine("Requesting MODE SENSE (10)."); - sense = dev.ModeSense10(out cmdBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration); + sense = dev.ModeSense10(out cmdBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, + 0x3F, 0xFF, 5, out duration); if(!sense || dev.Error) { - sense = dev.ModeSense10(out cmdBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); + sense = dev.ModeSense10(out cmdBuf, out senseBuf, false, true, + ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); } Decoders.SCSI.Modes.DecodedMode? decMode = null; @@ -254,11 +256,12 @@ namespace DiscImageChef.Core.Devices.Dumping } dumpLog.WriteLine("Requesting MODE SENSE (6)."); - sense = dev.ModeSense6(out cmdBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); + sense = dev.ModeSense6(out cmdBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, + 0x00, 5, out duration); if(sense || dev.Error) - sense = dev.ModeSense6(out cmdBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); - if(sense || dev.Error) - sense = dev.ModeSense(out cmdBuf, out senseBuf, 5, out duration); + sense = dev.ModeSense6(out cmdBuf, out senseBuf, false, ScsiModeSensePageControl.Current, + 0x3F, 0x00, 5, out duration); + if(sense || dev.Error) sense = dev.ModeSense(out cmdBuf, out senseBuf, 5, out duration); if(!sense && !dev.Error) { @@ -278,7 +281,8 @@ namespace DiscImageChef.Core.Devices.Dumping if(decMode.HasValue) { scsiMediumType = (byte)decMode.Value.Header.MediumType; - if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length >= 1) + if(decMode.Value.Header.BlockDescriptors != null && + decMode.Value.Header.BlockDescriptors.Length >= 1) scsiDensityCode = (byte)decMode.Value.Header.BlockDescriptors[0].Density; foreach(Decoders.SCSI.Modes.ModePage modePage in decMode.Value.Pages) @@ -300,12 +304,14 @@ namespace DiscImageChef.Core.Devices.Dumping } else { - DicConsole.ErrorWriteLine("Device is capable of reading raw data but I've been unable to guess correct sector size."); + DicConsole + .ErrorWriteLine("Device is capable of reading raw data but I've been unable to guess correct sector size."); } if(!force) { - DicConsole.ErrorWriteLine("Not continuing. If you want to continue reading cooked data when raw is not available use the force option."); + DicConsole + .ErrorWriteLine("Not continuing. If you want to continue reading cooked data when raw is not available use the force option."); // TODO: Exit more gracefully return; } @@ -315,23 +321,21 @@ namespace DiscImageChef.Core.Devices.Dumping } else { - - if(longBlockSize == 37856) // Only a block will be read, but it contains 16 sectors and command expect sector number not block number + if(longBlockSize == 37856 + ) // Only a block will be read, but it contains 16 sectors and command expect sector number not block number blocksToRead = 16; - else - blocksToRead = 1; - DicConsole.WriteLine("Reading {0} raw bytes ({1} cooked bytes) per sector.", - longBlockSize, blockSize * blocksToRead); + else blocksToRead = 1; + DicConsole.WriteLine("Reading {0} raw bytes ({1} cooked bytes) per sector.", longBlockSize, + blockSize * blocksToRead); physicalBlockSize = longBlockSize; blockSize = longBlockSize; } - } + DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead); string outputExtension = ".bin"; - if(opticalDisc && blockSize == 2048) - outputExtension = ".iso"; + if(opticalDisc && blockSize == 2048) outputExtension = ".iso"; mhddLog = new MHDDLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead); ibgLog = new IBGLog(outputPrefix + ".ibg", currentProfile); dumpFile = new DataFile(outputPrefix + outputExtension); @@ -342,21 +346,22 @@ namespace DiscImageChef.Core.Devices.Dumping if(alcohol != null && !dumpRaw) { - alcohol.AddSessions(new [] { new Session() { StartTrack = 1, EndTrack = 1, SessionSequence = 1}}); + alcohol.AddSessions(new[] {new Session() {StartTrack = 1, EndTrack = 1, SessionSequence = 1}}); alcohol.AddTrack(20, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1); alcohol.SetExtension(outputExtension); alcohol.SetTrackSizes(1, (int)blockSize, 0, 0, (long)blocks); alcohol.SetTrackTypes(1, TrackType.Data, TrackSubchannelType.None); } - + DumpHardwareType currentTry = null; ExtentsULong extents = null; - ResumeSupport.Process(true, dev.IsRemovable, blocks, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformID, ref resume, ref currentTry, ref extents); + ResumeSupport.Process(true, dev.IsRemovable, blocks, dev.Manufacturer, dev.Model, dev.Serial, + dev.PlatformID, ref resume, ref currentTry, ref extents); if(currentTry == null || extents == null) throw new Exception("Could not process resume file, not continuing..."); + dumpFile.Seek(resume.NextBlock, blockSize); - if(resume.NextBlock > 0) - dumpLog.WriteLine("Resuming from block {0}.", resume.NextBlock); + if(resume.NextBlock > 0) dumpLog.WriteLine("Resuming from block {0}.", resume.NextBlock); for(ulong i = resume.NextBlock; i < blocks; i += blocksToRead) { @@ -367,14 +372,11 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - if((blocks - i) < blocksToRead) - blocksToRead = (uint)(blocks - i); + if((blocks - i) < blocksToRead) blocksToRead = (uint)(blocks - i); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(currentSpeed > maxSpeed && currentSpeed != 0) - maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && currentSpeed != 0) - minSpeed = currentSpeed; + if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed; + if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, blocks, currentSpeed); @@ -392,19 +394,16 @@ namespace DiscImageChef.Core.Devices.Dumping else { // TODO: Reset device after X errors - if(stopOnError) - return; // TODO: Return more cleanly + if(stopOnError) return; // TODO: Return more cleanly // Write empty data dumpFile.Write(new byte[blockSize * blocksToRead]); errored += blocksToRead; - for(ulong b = i; b < i + blocksToRead; b++) - resume.BadBlocks.Add(b); - if(cmdDuration < 500) - mhddLog.Write(i, 65535); - else - mhddLog.Write(i, cmdDuration); + for(ulong b = i; b < i + blocksToRead; b++) resume.BadBlocks.Add(b); + + if(cmdDuration < 500) mhddLog.Write(i, 65535); + else mhddLog.Write(i, cmdDuration); ibgLog.Write(i, 0); dumpLog.WriteLine("Error reading {0} blocks from block {1}.", blocksToRead, i); @@ -415,14 +414,17 @@ namespace DiscImageChef.Core.Devices.Dumping #pragma warning restore IDE0004 // Remove Unnecessary Cast resume.NextBlock = i + blocksToRead; } + end = DateTime.UtcNow; DicConsole.WriteLine(); mhddLog.Close(); #pragma warning disable IDE0004 // Remove Unnecessary Cast - ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); + ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); #pragma warning restore IDE0004 // Remove Unnecessary Cast dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds); - dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); + dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); #region Error handling if(resume.BadBlocks.Count > 0 && !aborted) @@ -431,7 +433,7 @@ namespace DiscImageChef.Core.Devices.Dumping bool forward = true; bool runningPersistent = false; - repeatRetry: + repeatRetry: ulong[] tmpArray = resume.BadBlocks.ToArray(); foreach(ulong badSector in tmpArray) { @@ -442,7 +444,9 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - DicConsole.Write("\rRetrying sector {0}, pass {1}, {3}{2}", badSector, pass + 1, forward ? "forward" : "reverse", runningPersistent ? "recovering partial data, " : ""); + DicConsole.Write("\rRetrying sector {0}, pass {1}, {3}{2}", badSector, pass + 1, + forward ? "forward" : "reverse", + runningPersistent ? "recovering partial data, " : ""); sense = scsiReader.ReadBlock(out readBuffer, badSector, out double cmdDuration); totalDuration += cmdDuration; @@ -454,8 +458,7 @@ namespace DiscImageChef.Core.Devices.Dumping dumpFile.WriteAt(readBuffer, badSector, blockSize); dumpLog.WriteLine("Correctly retried block {0} in pass {1}.", badSector, pass); } - else if(runningPersistent) - dumpFile.WriteAt(readBuffer, badSector, blockSize); + else if(runningPersistent) dumpFile.WriteAt(readBuffer, badSector, blockSize); } if(pass < retryPasses && !aborted && resume.BadBlocks.Count > 0) @@ -474,27 +477,27 @@ namespace DiscImageChef.Core.Devices.Dumping if(!runningPersistent && persistent) { - sense = dev.ModeSense6(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current, 0x01, dev.Timeout, out duration); + sense = dev.ModeSense6(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current, 0x01, + dev.Timeout, out duration); if(sense) { - sense = dev.ModeSense10(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current, 0x01, dev.Timeout, out duration); - if(!sense) - currentMode = Decoders.SCSI.Modes.DecodeMode10(readBuffer, dev.SCSIType); + sense = dev.ModeSense10(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current, + 0x01, dev.Timeout, out duration); + if(!sense) currentMode = Decoders.SCSI.Modes.DecodeMode10(readBuffer, dev.SCSIType); } - else - currentMode = Decoders.SCSI.Modes.DecodeMode6(readBuffer, dev.SCSIType); + else currentMode = Decoders.SCSI.Modes.DecodeMode6(readBuffer, dev.SCSIType); - if(currentMode.HasValue) - currentModePage = currentMode.Value.Pages[0]; + if(currentMode.HasValue) currentModePage = currentMode.Value.Pages[0]; if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) { - Decoders.SCSI.Modes.ModePage_01_MMC pgMMC = new Decoders.SCSI.Modes.ModePage_01_MMC - { - PS = false, - ReadRetryCount = 255, - Parameter = 0x20 - }; + Decoders.SCSI.Modes.ModePage_01_MMC pgMMC = + new Decoders.SCSI.Modes.ModePage_01_MMC + { + PS = false, + ReadRetryCount = 255, + Parameter = 0x20 + }; Decoders.SCSI.Modes.DecodedMode md = new Decoders.SCSI.Modes.DecodedMode { Header = new Decoders.SCSI.Modes.ModeHeader(), @@ -545,10 +548,7 @@ namespace DiscImageChef.Core.Devices.Dumping dumpLog.WriteLine("Sending MODE SELECT to drive."); sense = dev.ModeSelect(md6, out senseBuf, true, false, dev.Timeout, out duration); - if(sense) - { - sense = dev.ModeSelect10(md10, out senseBuf, true, false, dev.Timeout, out duration); - } + if(sense) { sense = dev.ModeSelect10(md10, out senseBuf, true, false, dev.Timeout, out duration); } runningPersistent = true; if(!sense && !dev.Error) @@ -562,25 +562,20 @@ namespace DiscImageChef.Core.Devices.Dumping Decoders.SCSI.Modes.DecodedMode md = new Decoders.SCSI.Modes.DecodedMode { Header = new Decoders.SCSI.Modes.ModeHeader(), - Pages = new Decoders.SCSI.Modes.ModePage[] - { - currentModePage.Value - } + Pages = new Decoders.SCSI.Modes.ModePage[] {currentModePage.Value} }; md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType); md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.SCSIType); dumpLog.WriteLine("Sending MODE SELECT to drive."); sense = dev.ModeSelect(md6, out senseBuf, true, false, dev.Timeout, out duration); - if(sense) - { - sense = dev.ModeSelect10(md10, out senseBuf, true, false, dev.Timeout, out duration); - } + if(sense) { sense = dev.ModeSelect10(md10, out senseBuf, true, false, dev.Timeout, out duration); } } DicConsole.WriteLine(); } #endregion Error handling + resume.BadBlocks.Sort(); currentTry.Extents = Metadata.ExtentsConverter.ToMetadata(extents); @@ -597,8 +592,7 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - if((blocks - i) < blocksToRead) - blocksToRead = (uint)(blocks - i); + if((blocks - i) < blocksToRead) blocksToRead = (uint)(blocks - i); DicConsole.Write("\rChecksumming sector {0} of {1} ({2:F3} MiB/sec.)", i, blocks, currentSpeed); @@ -615,11 +609,13 @@ namespace DiscImageChef.Core.Devices.Dumping currentSpeed = ((double)blockSize * blocksToRead / (double)1048576) / (chkDuration / (double)1000); #pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created } + DicConsole.WriteLine(); dumpFile.Close(); end = DateTime.UtcNow; dumpLog.WriteLine("Checksum finished in {0} seconds.", (end - start).TotalSeconds); - dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalChkDuration / 1000)); + dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalChkDuration / 1000)); PluginBase plugins = new PluginBase(); plugins.RegisterAllPlugins(encoding); @@ -636,15 +632,8 @@ namespace DiscImageChef.Core.Devices.Dumping _imageFormat = ImageFormat.Detect(inputFilter); PartitionType[] xmlFileSysInfo = null; - try - { - if(!_imageFormat.OpenImage(inputFilter)) - _imageFormat = null; - } - catch - { - _imageFormat = null; - } + try { if(!_imageFormat.OpenImage(inputFilter)) _imageFormat = null; } + catch { _imageFormat = null; } if(_imageFormat != null) { @@ -669,7 +658,8 @@ namespace DiscImageChef.Core.Devices.Dumping }; List lstFs = new List(); dumpLog.WriteLine("Getting filesystems on partition {0}, starting at {1}, ending at {2}, with type {3}, under scheme {4}.", - i, partitions[i].Start, partitions[i].End, partitions[i].Type, partitions[i].Scheme); + i, partitions[i].Start, partitions[i].End, partitions[i].Type, + partitions[i].Scheme); foreach(Filesystem _plugin in plugins.PluginsList.Values) { @@ -682,12 +672,10 @@ namespace DiscImageChef.Core.Devices.Dumping Statistics.AddFilesystem(_plugin.XmlFSType.Type); dumpLog.WriteLine("Filesystem {0} found.", _plugin.XmlFSType.Type); - if(_plugin.XmlFSType.Type == "Opera") - dskType = MediaType.ThreeDO; + if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO; if(_plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2; - if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") - dskType = MediaType.WOD; + if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD; if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD; } @@ -700,27 +688,18 @@ namespace DiscImageChef.Core.Devices.Dumping } } - if(lstFs.Count > 0) - xmlFileSysInfo[i].FileSystems = lstFs.ToArray(); + if(lstFs.Count > 0) xmlFileSysInfo[i].FileSystems = lstFs.ToArray(); } } else { dumpLog.WriteLine("Getting filesystem for whole device."); xmlFileSysInfo = new PartitionType[1]; - xmlFileSysInfo[0] = new PartitionType - { - EndSector = (int)(blocks - 1), - StartSector = 0 - }; + xmlFileSysInfo[0] = new PartitionType {EndSector = (int)(blocks - 1), StartSector = 0}; List lstFs = new List(); - Partition wholePart = new Partition - { - Name = "Whole device", - Length = blocks, - Size = blocks * blockSize - }; + Partition wholePart = + new Partition {Name = "Whole device", Length = blocks, Size = blocks * blockSize}; foreach(Filesystem _plugin in plugins.PluginsList.Values) { @@ -733,14 +712,10 @@ namespace DiscImageChef.Core.Devices.Dumping Statistics.AddFilesystem(_plugin.XmlFSType.Type); dumpLog.WriteLine("Filesystem {0} found.", _plugin.XmlFSType.Type); - if(_plugin.XmlFSType.Type == "Opera") - dskType = MediaType.ThreeDO; - if(_plugin.XmlFSType.Type == "PC Engine filesystem") - dskType = MediaType.SuperCDROM2; - if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") - dskType = MediaType.WOD; - if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") - dskType = MediaType.GOD; + if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO; + if(_plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2; + if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD; + if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD; } } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body @@ -751,14 +726,12 @@ namespace DiscImageChef.Core.Devices.Dumping } } - if(lstFs.Count > 0) - xmlFileSysInfo[0].FileSystems = lstFs.ToArray(); + if(lstFs.Count > 0) xmlFileSysInfo[0].FileSystems = lstFs.ToArray(); } } - if(alcohol != null && !dumpRaw) - alcohol.SetMediaType(dskType); - + if(alcohol != null && !dumpRaw) alcohol.SetMediaType(dskType); + if(opticalDisc) { sidecar.OpticalDisc[0].Checksums = dataChk.End().ToArray(); @@ -771,30 +744,26 @@ namespace DiscImageChef.Core.Devices.Dumping // TODO: Implement layers //sidecar.OpticalDisc[0].Layers = new LayersType(); sidecar.OpticalDisc[0].Sessions = 1; - sidecar.OpticalDisc[0].Tracks = new[] { 1 }; + sidecar.OpticalDisc[0].Tracks = new[] {1}; sidecar.OpticalDisc[0].Track = new Schemas.TrackType[1]; sidecar.OpticalDisc[0].Track[0] = new Schemas.TrackType { BytesPerSector = (int)blockSize, Checksums = sidecar.OpticalDisc[0].Checksums, EndSector = (long)(blocks - 1), - Image = new ImageType - { - format = "BINARY", - offset = 0, - offsetSpecified = true, - Value = sidecar.OpticalDisc[0].Image.Value - }, - Sequence = new TrackSequenceType - { - Session = 1, - TrackNumber = 1 - }, + Image = + new ImageType + { + format = "BINARY", + offset = 0, + offsetSpecified = true, + Value = sidecar.OpticalDisc[0].Image.Value + }, + Sequence = new TrackSequenceType {Session = 1, TrackNumber = 1}, Size = (long)(blocks * blockSize), StartSector = 0 }; - if(xmlFileSysInfo != null) - sidecar.OpticalDisc[0].Track[0].FileSystemInformation = xmlFileSysInfo; + if(xmlFileSysInfo != null) sidecar.OpticalDisc[0].Track[0].FileSystemInformation = xmlFileSysInfo; switch(dskType) { case MediaType.DDCD: @@ -831,6 +800,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].Track[0].TrackType1 = TrackTypeTrackType.bluray; break; } + sidecar.OpticalDisc[0].Dimensions = Metadata.Dimensions.DimensionsFromMediaType(dskType); Metadata.MediaType.MediaTypeToString(dskType, out string xmlDskTyp, out string xmlDskSubTyp); sidecar.OpticalDisc[0].DiscType = xmlDskTyp; @@ -851,14 +821,10 @@ namespace DiscImageChef.Core.Devices.Dumping }; if(!dev.IsRemovable || dev.IsUSB) { - if(dev.Type == DeviceType.ATAPI) - sidecar.BlockMedia[0].Interface = "ATAPI"; - else if(dev.IsUSB) - sidecar.BlockMedia[0].Interface = "USB"; - else if(dev.IsFireWire) - sidecar.BlockMedia[0].Interface = "FireWire"; - else - sidecar.BlockMedia[0].Interface = "SCSI"; + if(dev.Type == DeviceType.ATAPI) sidecar.BlockMedia[0].Interface = "ATAPI"; + else if(dev.IsUSB) sidecar.BlockMedia[0].Interface = "USB"; + else if(dev.IsFireWire) sidecar.BlockMedia[0].Interface = "FireWire"; + else sidecar.BlockMedia[0].Interface = "SCSI"; } sidecar.BlockMedia[0].LogicalBlocks = (long)blocks; sidecar.BlockMedia[0].PhysicalBlockSize = (int)physicalBlockSize; @@ -867,18 +833,18 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.BlockMedia[0].Model = dev.Model; sidecar.BlockMedia[0].Serial = dev.Serial; sidecar.BlockMedia[0].Size = (long)(blocks * blockSize); - if(xmlFileSysInfo != null) - sidecar.BlockMedia[0].FileSystemInformation = xmlFileSysInfo; + if(xmlFileSysInfo != null) sidecar.BlockMedia[0].FileSystemInformation = xmlFileSysInfo; - if(dev.IsRemovable) - sidecar.BlockMedia[0].DumpHardwareArray = resume.Tries.ToArray(); + if(dev.IsRemovable) sidecar.BlockMedia[0].DumpHardwareArray = resume.Tries.ToArray(); } DicConsole.WriteLine(); - DicConsole.WriteLine("Took a total of {0:F3} seconds ({1:F3} processing commands, {2:F3} checksumming).", (end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000); + DicConsole.WriteLine("Took a total of {0:F3} seconds ({1:F3} processing commands, {2:F3} checksumming).", + (end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000); #pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created - DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1048576) / (totalDuration / 1000)); + DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1048576) / (totalDuration / 1000)); #pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created DicConsole.WriteLine("Fastest speed burst: {0:F3} MiB/sec.", maxSpeed); DicConsole.WriteLine("Slowest speed burst: {0:F3} MiB/sec.", minSpeed); @@ -889,17 +855,16 @@ namespace DiscImageChef.Core.Devices.Dumping { DicConsole.WriteLine("Writing metadata sidecar"); - FileStream xmlFs = new FileStream(outputPrefix + ".cicm.xml", - FileMode.Create); + FileStream xmlFs = new FileStream(outputPrefix + ".cicm.xml", FileMode.Create); - System.Xml.Serialization.XmlSerializer xmlSer = new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); + System.Xml.Serialization.XmlSerializer xmlSer = + new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); xmlSer.Serialize(xmlFs, sidecar); xmlFs.Close(); - if(alcohol != null && !dumpRaw) - alcohol.Close(); + if(alcohol != null && !dumpRaw) alcohol.Close(); } Statistics.AddMedia(dskType, true); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Dumping/SCSI.cs b/DiscImageChef.Core/Devices/Dumping/SCSI.cs index 51d0f7ed..a5868b81 100644 --- a/DiscImageChef.Core/Devices/Dumping/SCSI.cs +++ b/DiscImageChef.Core/Devices/Dumping/SCSI.cs @@ -44,7 +44,9 @@ namespace DiscImageChef.Core.Devices.Dumping public class SCSI { // TODO: Get cartridge serial number from Certance vendor EVPD - public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, bool separateSubchannel, ref Metadata.Resume resume, ref DumpLog dumpLog, bool dumpLeadIn, Encoding encoding) + public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, + bool dumpRaw, bool persistent, bool stopOnError, bool separateSubchannel, + ref Metadata.Resume resume, ref DumpLog dumpLog, bool dumpLeadIn, Encoding encoding) { byte[] senseBuf = null; bool sense = false; @@ -60,14 +62,14 @@ namespace DiscImageChef.Core.Devices.Dumping Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf); if(decSense.HasValue) { - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", + decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.ASCQ); // Just retry, for 5 times if(decSense.Value.ASC == 0x29) { resets++; - if(resets < 5) - goto deviceGotReset; + if(resets < 5) goto deviceGotReset; } if(decSense.Value.ASC == 0x3A) @@ -78,12 +80,12 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.WriteLine("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if(!sense) - break; + if(!sense) break; decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf); if(decSense.HasValue) - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", + decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.ASCQ); leftRetries--; } @@ -101,18 +103,19 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.WriteLine("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if(!sense) - break; + if(!sense) break; decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf); if(decSense.HasValue) - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", + decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.ASCQ); leftRetries--; } if(sense) { - DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); return; } } @@ -137,24 +140,26 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.WriteLine("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if(!sense) - break; + if(!sense) break; decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf); if(decSense.HasValue) - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", + decSense.Value.SenseKey, decSense.Value.ASC, decSense.Value.ASCQ); leftRetries--; } if(sense) { - DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); return; } } else { - DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); return; } } @@ -170,8 +175,7 @@ namespace DiscImageChef.Core.Devices.Dumping if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) { - if(dumpRaw) - throw new ArgumentException("Tapes cannot be dumped raw."); + if(dumpRaw) throw new ArgumentException("Tapes cannot be dumped raw."); SSC.Dump(dev, outputPrefix, devicePath, ref sidecar, ref resume, ref dumpLog); return; @@ -179,11 +183,13 @@ namespace DiscImageChef.Core.Devices.Dumping if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) { - MMC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, separateSubchannel, ref resume, ref dumpLog, dumpLeadIn, encoding); + MMC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, + ref sidecar, ref dskType, separateSubchannel, ref resume, ref dumpLog, dumpLeadIn, encoding); return; } - SBC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, false, ref resume, ref dumpLog, encoding); + SBC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, + ref dskType, false, ref resume, ref dumpLog, encoding); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Dumping/SSC.cs b/DiscImageChef.Core/Devices/Dumping/SSC.cs index 08199e33..9fa46c0c 100644 --- a/DiscImageChef.Core/Devices/Dumping/SSC.cs +++ b/DiscImageChef.Core/Devices/Dumping/SSC.cs @@ -44,7 +44,8 @@ namespace DiscImageChef.Core.Devices.Dumping { internal static class SSC { - internal static void Dump(Device dev, string outputPrefix, string devicePath, ref CICMMetadataType sidecar, ref Metadata.Resume resume, ref DumpLog dumpLog) + internal static void Dump(Device dev, string outputPrefix, string devicePath, ref CICMMetadataType sidecar, + ref Metadata.Resume resume, ref DumpLog dumpLog) { Decoders.SCSI.FixedSense? fxSense; bool aborted; @@ -69,14 +70,16 @@ namespace DiscImageChef.Core.Devices.Dumping if(fxSense.HasValue && fxSense.Value.SenseKey != Decoders.SCSI.SenseKeys.NoSense) { - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, + fxSense.Value.ASC, fxSense.Value.ASCQ); DicConsole.ErrorWriteLine("Drive has status error, please correct. Sense follows..."); DicConsole.ErrorWriteLine("{0}", strSense); return; } // Not in BOM/P - if(fxSense.HasValue && fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x00 && fxSense.Value.ASCQ != 0x04 && fxSense.Value.SenseKey != Decoders.SCSI.SenseKeys.IllegalRequest) + if(fxSense.HasValue && fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x00 && + fxSense.Value.ASCQ != 0x04 && fxSense.Value.SenseKey != Decoders.SCSI.SenseKeys.IllegalRequest) { dumpLog.WriteLine("Rewinding, please wait..."); DicConsole.Write("Rewinding, please wait..."); @@ -91,19 +94,22 @@ namespace DiscImageChef.Core.Devices.Dumping dev.RequestSense(out senseBuf, dev.Timeout, out duration); fxSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf, out strSense); } - while(fxSense.HasValue && fxSense.Value.ASC == 0x00 && (fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ != 0x04)); + while(fxSense.HasValue && fxSense.Value.ASC == 0x00 && + (fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ != 0x04)); dev.RequestSense(out senseBuf, dev.Timeout, out duration); fxSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf, out strSense); // And yet, did not rewind! - if(fxSense.HasValue && ((fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04) || fxSense.Value.ASC != 0x00)) + if(fxSense.HasValue && ((fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04) || + fxSense.Value.ASC != 0x00)) { DicConsole.WriteLine(); DicConsole.ErrorWriteLine("Drive could not rewind, please correct. Sense follows..."); DicConsole.ErrorWriteLine("{0}", strSense); dumpLog.WriteLine("Drive could not rewind, please correct. Sense follows..."); - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, + fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -111,7 +117,8 @@ namespace DiscImageChef.Core.Devices.Dumping } // Check position - sense = dev.ReadPosition(out byte[] cmdBuf, out senseBuf, SscPositionForms.Short, dev.Timeout, out duration); + sense = dev.ReadPosition(out byte[] cmdBuf, out senseBuf, SscPositionForms.Short, dev.Timeout, + out duration); if(sense) { @@ -119,12 +126,15 @@ namespace DiscImageChef.Core.Devices.Dumping // Anyway, <=SCSI-1 tapes do not support partitions fxSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf, out strSense); - if(fxSense.HasValue && ((fxSense.Value.ASC == 0x20 && fxSense.Value.ASCQ != 0x00) || fxSense.Value.ASC != 0x20 && fxSense.Value.SenseKey != Decoders.SCSI.SenseKeys.IllegalRequest)) + if(fxSense.HasValue && ((fxSense.Value.ASC == 0x20 && fxSense.Value.ASCQ != 0x00) || + fxSense.Value.ASC != 0x20 && fxSense.Value.SenseKey != + Decoders.SCSI.SenseKeys.IllegalRequest)) { DicConsole.ErrorWriteLine("Could not get position. Sense follows..."); DicConsole.ErrorWriteLine("{0}", strSense); dumpLog.WriteLine("Could not get position. Sense follows..."); - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, + fxSense.Value.ASC, fxSense.Value.ASCQ); return; } } @@ -143,7 +153,8 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Drive could not rewind, please correct. Sense follows..."); DicConsole.ErrorWriteLine("{0}", strSense); dumpLog.WriteLine("Drive could not rewind, please correct. Sense follows..."); - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -156,27 +167,32 @@ namespace DiscImageChef.Core.Devices.Dumping dev.RequestSense(out senseBuf, dev.Timeout, out duration); fxSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf, out strSense); } - while(fxSense.HasValue && fxSense.Value.ASC == 0x00 && (fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ == 0x19)); + while(fxSense.HasValue && fxSense.Value.ASC == 0x00 && + (fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ == 0x19)); // And yet, did not rewind! - if(fxSense.HasValue && ((fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04) || fxSense.Value.ASC != 0x00)) + if(fxSense.HasValue && ((fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04) || + fxSense.Value.ASC != 0x00)) { DicConsole.WriteLine(); DicConsole.ErrorWriteLine("Drive could not rewind, please correct. Sense follows..."); DicConsole.ErrorWriteLine("{0}", strSense); dumpLog.WriteLine("Drive could not rewind, please correct. Sense follows..."); - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); return; } - sense = dev.ReadPosition(out cmdBuf, out senseBuf, SscPositionForms.Short, dev.Timeout, out duration); + sense = dev.ReadPosition(out cmdBuf, out senseBuf, SscPositionForms.Short, dev.Timeout, + out duration); if(sense) { fxSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf, out strSense); DicConsole.ErrorWriteLine("Drive could not rewind, please correct. Sense follows..."); DicConsole.ErrorWriteLine("{0}", strSense); dumpLog.WriteLine("Drive could not rewind, please correct. Sense follows..."); - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -193,18 +209,17 @@ namespace DiscImageChef.Core.Devices.Dumping } sidecar.BlockMedia = new BlockMediaType[1]; - sidecar.BlockMedia[0] = new BlockMediaType - { - SCSI = new SCSIType() - }; + sidecar.BlockMedia[0] = new BlockMediaType {SCSI = new SCSIType()}; byte scsiMediumTypeTape = 0; byte scsiDensityCodeTape = 0; dumpLog.WriteLine("Requesting MODE SENSE (10)."); - sense = dev.ModeSense10(out cmdBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration); + sense = dev.ModeSense10(out cmdBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, + 5, out duration); if(!sense || dev.Error) { - sense = dev.ModeSense10(out cmdBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); + sense = dev.ModeSense10(out cmdBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, + 0x00, 5, out duration); } Decoders.SCSI.Modes.DecodedMode? decMode = null; @@ -225,11 +240,12 @@ namespace DiscImageChef.Core.Devices.Dumping } dumpLog.WriteLine("Requesting MODE SENSE (6)."); - sense = dev.ModeSense6(out cmdBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); + sense = dev.ModeSense6(out cmdBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, + out duration); if(sense || dev.Error) - sense = dev.ModeSense6(out cmdBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); - if(sense || dev.Error) - sense = dev.ModeSense(out cmdBuf, out senseBuf, 5, out duration); + sense = dev.ModeSense6(out cmdBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, + out duration); + if(sense || dev.Error) sense = dev.ModeSense(out cmdBuf, out senseBuf, 5, out duration); if(!sense && !dev.Error) { @@ -255,11 +271,11 @@ namespace DiscImageChef.Core.Devices.Dumping blockSize = decMode.Value.Header.BlockDescriptors[0].BlockLength; dumpLog.WriteLine("Device reports {0} blocks ({1} bytes).", blocks, blocks * blockSize); } - else - blockSize = 1; + else blockSize = 1; if(dskType == MediaType.Unknown) - dskType = MediaTypeFromSCSI.Get((byte)dev.SCSIType, dev.Manufacturer, dev.Model, scsiMediumTypeTape, scsiDensityCodeTape, blocks, blockSize); + dskType = MediaTypeFromSCSI.Get((byte)dev.SCSIType, dev.Manufacturer, dev.Model, scsiMediumTypeTape, + scsiDensityCodeTape, blocks, blockSize); DicConsole.WriteLine("Media identified as {0}", dskType); @@ -280,7 +296,8 @@ namespace DiscImageChef.Core.Devices.Dumping bool fixedLen = false; uint transferLen = blockSize; - sense = dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize, dev.Timeout, out duration); + sense = dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize, dev.Timeout, + out duration); if(sense) { fxSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf, out strSense); @@ -298,21 +315,24 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Drive could not return back. Sense follows..."); DicConsole.ErrorWriteLine("{0}", strSense); dumpLog.WriteLine("Drive could not return back. Sense follows..."); - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); return; } } fixedLen = true; transferLen = 1; - sense = dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize, dev.Timeout, out duration); + sense = dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize, + dev.Timeout, out duration); if(sense) { DicConsole.WriteLine(); DicConsole.ErrorWriteLine("Drive could not read. Sense follows..."); DicConsole.ErrorWriteLine("{0}", strSense); dumpLog.WriteLine("Drive could not read. Sense follows..."); - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); return; } } @@ -322,7 +342,8 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Drive could not read. Sense follows..."); DicConsole.ErrorWriteLine("{0}", strSense); dumpLog.WriteLine("Drive could not read. Sense follows..."); - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); return; } } @@ -345,7 +366,8 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Drive could not return back. Sense follows..."); DicConsole.ErrorWriteLine("{0}", strSense); dumpLog.WriteLine("Drive could not return back. Sense follows..."); - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, + fxSense.Value.ASC, fxSense.Value.ASCQ); return; } } @@ -393,10 +415,7 @@ namespace DiscImageChef.Core.Devices.Dumping partitionChk = new Checksum(); aborted = false; - System.Console.CancelKeyPress += (sender, e) => - { - e.Cancel = aborted = true; - }; + System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; }; while(currentPartition < totalPartitions) { @@ -461,23 +480,24 @@ namespace DiscImageChef.Core.Devices.Dumping } #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(currentSpeed > maxSpeed && currentSpeed != 0) - maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && currentSpeed != 0) - minSpeed = currentSpeed; + if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed; + if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator DicConsole.Write("\rReading block {0} ({1:F3} MiB/sec.)", currentBlock, currentSpeed); - sense = dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize, dev.Timeout, out duration); + sense = dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize, dev.Timeout, + out duration); totalDuration += duration; if(sense) { fxSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf, out strSense); - if(fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ == 0x00 && fxSense.Value.ILI && fxSense.Value.InformationValid) + if(fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ == 0x00 && fxSense.Value.ILI && + fxSense.Value.InformationValid) { - blockSize = (uint)((int)blockSize - BitConverter.ToInt32(BitConverter.GetBytes(fxSense.Value.Information), 0)); + blockSize = (uint)((int)blockSize - + BitConverter.ToInt32(BitConverter.GetBytes(fxSense.Value.Information), 0)); currentTapeFile.BlockSize = blockSize; DicConsole.WriteLine(); @@ -495,7 +515,8 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("{0}", strSense); dumpFile.Close(); dumpLog.WriteLine("Drive could not go back one block. Sense follows..."); - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -514,7 +535,8 @@ namespace DiscImageChef.Core.Devices.Dumping } // For sure this is an end-of-tape/partition - if(fxSense.Value.ASC == 0x00 && (fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM)) + if(fxSense.Value.ASC == 0x00 && + (fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM)) { // TODO: Detect end of partition endOfMedia = true; @@ -529,7 +551,8 @@ namespace DiscImageChef.Core.Devices.Dumping continue; } - if((fxSense.Value.SenseKey == Decoders.SCSI.SenseKeys.NoSense || fxSense.Value.SenseKey == Decoders.SCSI.SenseKeys.RecoveredError) && + if((fxSense.Value.SenseKey == Decoders.SCSI.SenseKeys.NoSense || + fxSense.Value.SenseKey == Decoders.SCSI.SenseKeys.RecoveredError) && (fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM)) { // TODO: Detect end of partition @@ -538,7 +561,8 @@ namespace DiscImageChef.Core.Devices.Dumping continue; } - if((fxSense.Value.SenseKey == Decoders.SCSI.SenseKeys.NoSense || fxSense.Value.SenseKey == Decoders.SCSI.SenseKeys.RecoveredError) && + if((fxSense.Value.SenseKey == Decoders.SCSI.SenseKeys.NoSense || + fxSense.Value.SenseKey == Decoders.SCSI.SenseKeys.RecoveredError) && (fxSense.Value.ASCQ == 0x01 || fxSense.Value.Filemark)) { currentTapeFile.Checksums = fileChk.End().ToArray(); @@ -574,7 +598,8 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Drive could not read block. Sense follows..."); DicConsole.ErrorWriteLine("{0} {1}", fxSense.Value.SenseKey, strSense); dumpLog.WriteLine("Drive could not read block. Sense follows..."); - dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); + dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, + fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -602,14 +627,19 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.WriteLine(); end = DateTime.UtcNow; mhddLog.Close(); - ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); + ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds); - dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); - dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalChkDuration / 1000)); + dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); + dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalChkDuration / 1000)); - DicConsole.WriteLine("Took a total of {0:F3} seconds ({1:F3} processing commands, {2:F3} checksumming).", (end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000); + DicConsole.WriteLine("Took a total of {0:F3} seconds ({1:F3} processing commands, {2:F3} checksumming).", + (end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000); #pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created - DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1048576) / (totalDuration / 1000)); + DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1048576) / (totalDuration / 1000)); #pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created DicConsole.WriteLine("Fastest speed burst: {0:F3} MiB/sec.", maxSpeed); DicConsole.WriteLine("Slowest speed burst: {0:F3} MiB/sec.", minSpeed); @@ -628,15 +658,8 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.BlockMedia[0].LogicalBlocks = (long)blocks; sidecar.BlockMedia[0].Size = (long)(currentSize); sidecar.BlockMedia[0].DumpHardwareArray = new DumpHardwareType[1]; - sidecar.BlockMedia[0].DumpHardwareArray[0] = new DumpHardwareType - { - Extents = new ExtentType[1] - }; - sidecar.BlockMedia[0].DumpHardwareArray[0].Extents[0] = new ExtentType - { - Start = 0, - End = blocks - 1 - }; + sidecar.BlockMedia[0].DumpHardwareArray[0] = new DumpHardwareType {Extents = new ExtentType[1]}; + sidecar.BlockMedia[0].DumpHardwareArray[0].Extents[0] = new ExtentType {Start = 0, End = blocks - 1}; sidecar.BlockMedia[0].DumpHardwareArray[0].Manufacturer = dev.Manufacturer; sidecar.BlockMedia[0].DumpHardwareArray[0].Model = dev.Model; sidecar.BlockMedia[0].DumpHardwareArray[0].Revision = dev.Revision; @@ -648,10 +671,10 @@ namespace DiscImageChef.Core.Devices.Dumping { DicConsole.WriteLine("Writing metadata sidecar"); - FileStream xmlFs = new FileStream(outputPrefix + ".cicm.xml", - FileMode.Create); + FileStream xmlFs = new FileStream(outputPrefix + ".cicm.xml", FileMode.Create); - System.Xml.Serialization.XmlSerializer xmlSer = new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); + System.Xml.Serialization.XmlSerializer xmlSer = + new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); xmlSer.Serialize(xmlFs, sidecar); xmlFs.Close(); } @@ -661,4 +684,4 @@ namespace DiscImageChef.Core.Devices.Dumping return; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Dumping/SecureDigital.cs b/DiscImageChef.Core/Devices/Dumping/SecureDigital.cs index 842e0c19..65ddfd2c 100644 --- a/DiscImageChef.Core/Devices/Dumping/SecureDigital.cs +++ b/DiscImageChef.Core/Devices/Dumping/SecureDigital.cs @@ -49,7 +49,9 @@ namespace DiscImageChef.Core.Devices.Dumping { public class SecureDigital { - public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref Metadata.Resume resume, ref DumpLog dumpLog, Encoding encoding) + public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, + bool dumpRaw, bool persistent, bool stopOnError, ref Metadata.Resume resume, + ref DumpLog dumpLog, Encoding encoding) { bool aborted; MHDDLog mhddLog; @@ -59,8 +61,7 @@ namespace DiscImageChef.Core.Devices.Dumping { DicConsole.ErrorWriteLine("Raw dumping is not supported in MultiMediaCard or SecureDigital devices."); - if(force) - DicConsole.ErrorWriteLine("Continuing..."); + if(force) DicConsole.ErrorWriteLine("Continuing..."); else { DicConsole.ErrorWriteLine("Aborting..."); @@ -73,10 +74,8 @@ namespace DiscImageChef.Core.Devices.Dumping uint timeout = 5; double duration; - CICMMetadataType sidecar = new CICMMetadataType() - { - BlockMedia = new BlockMediaType[] { new BlockMediaType() } - }; + CICMMetadataType sidecar = + new CICMMetadataType() {BlockMedia = new BlockMediaType[] {new BlockMediaType()}}; uint blocksToRead = 128; uint blockSize = 512; @@ -103,15 +102,12 @@ namespace DiscImageChef.Core.Devices.Dumping blocksToRead = ecsdDecoded.OptimalReadSize; blocks = ecsdDecoded.SectorCount; blockSize = (uint)(ecsdDecoded.SectorSize == 1 ? 4096 : 512); - if(ecsdDecoded.NativeSectorSize == 0) - physicalBlockSize = 512; - else if(ecsdDecoded.NativeSectorSize == 1) - physicalBlockSize = 4096; + if(ecsdDecoded.NativeSectorSize == 0) physicalBlockSize = 512; + else if(ecsdDecoded.NativeSectorSize == 1) physicalBlockSize = 4096; // Supposing it's high-capacity MMC if it has Extended CSD... byteAddressed = false; } - else - ecsd = null; + else ecsd = null; dumpLog.WriteLine("Reading CSD"); sense = dev.ReadCSD(out csd, out response, timeout, out duration); @@ -124,13 +120,11 @@ namespace DiscImageChef.Core.Devices.Dumping blockSize = (uint)Math.Pow(2, csdDecoded.ReadBlockLength); } } - else - csd = null; + else csd = null; dumpLog.WriteLine("Reading OCR"); sense = dev.ReadOCR(out ocr, out response, timeout, out duration); - if(sense) - ocr = null; + if(sense) ocr = null; sidecar.BlockMedia[0].MultiMediaCard = new MultiMediaCardType(); } @@ -143,31 +137,29 @@ namespace DiscImageChef.Core.Devices.Dumping if(!sense) { csdDecoded = Decoders.SecureDigital.Decoders.DecodeCSD(csd); - blocks = (ulong)(csdDecoded.Structure == 0 ? (csdDecoded.Size + 1) * Math.Pow(2, csdDecoded.SizeMultiplier + 2) : (csdDecoded.Size + 1) * 1024); + blocks = (ulong)(csdDecoded.Structure == 0 + ? (csdDecoded.Size + 1) * Math.Pow(2, csdDecoded.SizeMultiplier + 2) + : (csdDecoded.Size + 1) * 1024); blockSize = (uint)Math.Pow(2, csdDecoded.ReadBlockLength); // Structure >=1 for SDHC/SDXC, so that's block addressed byteAddressed = csdDecoded.Structure == 0; } - else - csd = null; + else csd = null; dumpLog.WriteLine("Reading OCR"); sense = dev.ReadSDOCR(out ocr, out response, timeout, out duration); - if(sense) - ocr = null; + if(sense) ocr = null; dumpLog.WriteLine("Reading SCR"); sense = dev.ReadSCR(out scr, out response, timeout, out duration); - if(sense) - scr = null; + if(sense) scr = null; sidecar.BlockMedia[0].SecureDigital = new SecureDigitalType(); } dumpLog.WriteLine("Reading CID"); sense = dev.ReadCID(out cid, out response, timeout, out duration); - if(sense) - cid = null; + if(sense) cid = null; DumpType cidDump = null; DumpType csdDump = null; @@ -182,7 +174,8 @@ namespace DiscImageChef.Core.Devices.Dumping Checksums = Checksum.GetChecksums(cid).ToArray() }; DataFile.WriteTo("MMC/SecureDigital Dump", cidDump.Image, cid); - }; + } + ; if(csd != null) { csdDump = new DumpType @@ -192,7 +185,8 @@ namespace DiscImageChef.Core.Devices.Dumping Checksums = Checksum.GetChecksums(csd).ToArray() }; DataFile.WriteTo("MMC/SecureDigital Dump", csdDump.Image, csd); - }; + } + ; if(ecsd != null) { sidecar.BlockMedia[0].MultiMediaCard.ExtendedCSD = new DumpType @@ -201,8 +195,10 @@ namespace DiscImageChef.Core.Devices.Dumping Size = ecsd.Length, Checksums = Checksum.GetChecksums(ecsd).ToArray() }; - DataFile.WriteTo("MMC/SecureDigital Dump", sidecar.BlockMedia[0].MultiMediaCard.ExtendedCSD.Image, ecsd); - }; + DataFile.WriteTo("MMC/SecureDigital Dump", sidecar.BlockMedia[0].MultiMediaCard.ExtendedCSD.Image, + ecsd); + } + ; if(ocr != null) { ocrDump = new DumpType @@ -212,7 +208,8 @@ namespace DiscImageChef.Core.Devices.Dumping Checksums = Checksum.GetChecksums(ocr).ToArray() }; DataFile.WriteTo("MMC/SecureDigital Dump", ocrDump.Image, ocr); - }; + } + ; if(scr != null) { sidecar.BlockMedia[0].SecureDigital.SCR = new DumpType @@ -222,7 +219,8 @@ namespace DiscImageChef.Core.Devices.Dumping Checksums = Checksum.GetChecksums(scr).ToArray() }; DataFile.WriteTo("MMC/SecureDigital Dump", sidecar.BlockMedia[0].SecureDigital.SCR.Image, scr); - }; + } + ; if(dev.Type == DeviceType.MMC) { @@ -247,10 +245,7 @@ namespace DiscImageChef.Core.Devices.Dumping Checksum dataChk; aborted = false; - System.Console.CancelKeyPress += (sender, e) => - { - e.Cancel = aborted = true; - }; + System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; }; DataFile dumpFile; @@ -260,6 +255,7 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Unable to get device size."); return; } + dumpLog.WriteLine("Device reports {0} blocks.", blocks); byte[] cmdBuf; @@ -267,13 +263,12 @@ namespace DiscImageChef.Core.Devices.Dumping while(true) { - error = dev.Read(out cmdBuf, out response, 0, blockSize, blocksToRead, byteAddressed, timeout, out duration); + error = dev.Read(out cmdBuf, out response, 0, blockSize, blocksToRead, byteAddressed, timeout, + out duration); - if(error) - blocksToRead /= 2; + if(error) blocksToRead /= 2; - if(!error || blocksToRead == 1) - break; + if(!error || blocksToRead == 1) break; } if(error) @@ -288,7 +283,8 @@ namespace DiscImageChef.Core.Devices.Dumping DumpHardwareType currentTry = null; ExtentsULong extents = null; - ResumeSupport.Process(true, false, blocks, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformID, ref resume, ref currentTry, ref extents); + ResumeSupport.Process(true, false, blocks, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformID, + ref resume, ref currentTry, ref extents); if(currentTry == null || extents == null) throw new Exception("Could not process resume file, not continuing..."); @@ -298,8 +294,7 @@ namespace DiscImageChef.Core.Devices.Dumping ibgLog = new IBGLog(outputPrefix + ".ibg", currentProfile); dumpFile = new DataFile(outputPrefix + ".bin"); dumpFile.Seek(resume.NextBlock, blockSize); - if(resume.NextBlock > 0) - dumpLog.WriteLine("Resuming from block {0}.", resume.NextBlock); + if(resume.NextBlock > 0) dumpLog.WriteLine("Resuming from block {0}.", resume.NextBlock); start = DateTime.UtcNow; for(ulong i = resume.NextBlock; i < blocks; i += blocksToRead) @@ -311,19 +306,17 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - if((blocks - i) < blocksToRead) - blocksToRead = (byte)(blocks - i); + if((blocks - i) < blocksToRead) blocksToRead = (byte)(blocks - i); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(currentSpeed > maxSpeed && currentSpeed != 0) - maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && currentSpeed != 0) - minSpeed = currentSpeed; + if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed; + if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, blocks, currentSpeed); - error = dev.Read(out cmdBuf, out response, (uint)i, blockSize, blocksToRead, byteAddressed, timeout, out duration); + error = dev.Read(out cmdBuf, out response, (uint)i, blockSize, blocksToRead, byteAddressed, timeout, + out duration); if(!error) { @@ -334,12 +327,10 @@ namespace DiscImageChef.Core.Devices.Dumping } else { - for(ulong b = i; b < i + blocksToRead; b++) - resume.BadBlocks.Add(b); - if(duration < 500) - mhddLog.Write(i, 65535); - else - mhddLog.Write(i, duration); + for(ulong b = i; b < i + blocksToRead; b++) resume.BadBlocks.Add(b); + + if(duration < 500) mhddLog.Write(i, 65535); + else mhddLog.Write(i, duration); ibgLog.Write(i, 0); dumpFile.Write(new byte[blockSize * blocksToRead]); @@ -352,24 +343,26 @@ namespace DiscImageChef.Core.Devices.Dumping GC.Collect(); resume.NextBlock = i + blocksToRead; } + end = DateTime.Now; DicConsole.WriteLine(); mhddLog.Close(); #pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created - ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); + ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); #pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds); - dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); + dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); #region Error handling if(resume.BadBlocks.Count > 0 && !aborted) { - int pass = 0; bool forward = true; bool runningPersistent = false; - repeatRetryLba: + repeatRetryLba: ulong[] tmpArray = resume.BadBlocks.ToArray(); foreach(ulong badSector in tmpArray) { @@ -380,9 +373,12 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - DicConsole.Write("\rRetrying sector {0}, pass {1}, {3}{2}", badSector, pass + 1, forward ? "forward" : "reverse", runningPersistent ? "recovering partial data, " : ""); + DicConsole.Write("\rRetrying sector {0}, pass {1}, {3}{2}", badSector, pass + 1, + forward ? "forward" : "reverse", + runningPersistent ? "recovering partial data, " : ""); - error = dev.Read(out cmdBuf, out response, (uint)badSector, blockSize, 1, byteAddressed, timeout, out duration); + error = dev.Read(out cmdBuf, out response, (uint)badSector, blockSize, 1, byteAddressed, timeout, + out duration); totalDuration += duration; @@ -393,8 +389,7 @@ namespace DiscImageChef.Core.Devices.Dumping dumpFile.WriteAt(cmdBuf, badSector, blockSize); dumpLog.WriteLine("Correctly retried block {0} in pass {1}.", badSector, pass); } - else if(runningPersistent) - dumpFile.WriteAt(cmdBuf, badSector, blockSize); + else if(runningPersistent) dumpFile.WriteAt(cmdBuf, badSector, blockSize); } if(pass < retryPasses && !aborted && resume.BadBlocks.Count > 0) @@ -425,8 +420,7 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - if((blocks - i) < blocksToRead) - blocksToRead = (byte)(blocks - i); + if((blocks - i) < blocksToRead) blocksToRead = (byte)(blocks - i); DicConsole.Write("\rChecksumming sector {0} of {1} ({2:F3} MiB/sec.)", i, blocks, currentSpeed); @@ -441,11 +435,13 @@ namespace DiscImageChef.Core.Devices.Dumping currentSpeed = ((double)blockSize * blocksToRead / (double)1048576) / (chkDuration / (double)1000); } + DicConsole.WriteLine(); dumpFile.Close(); end = DateTime.UtcNow; dumpLog.WriteLine("Checksum finished in {0} seconds.", (end - start).TotalSeconds); - dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalChkDuration / 1000)); + dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalChkDuration / 1000)); PluginBase plugins = new PluginBase(); plugins.RegisterAllPlugins(encoding); @@ -463,15 +459,8 @@ namespace DiscImageChef.Core.Devices.Dumping _imageFormat = ImageFormat.Detect(inputFilter); PartitionType[] xmlFileSysInfo = null; - try - { - if(!_imageFormat.OpenImage(inputFilter)) - _imageFormat = null; - } - catch - { - _imageFormat = null; - } + try { if(!_imageFormat.OpenImage(inputFilter)) _imageFormat = null; } + catch { _imageFormat = null; } if(_imageFormat != null) { @@ -496,7 +485,8 @@ namespace DiscImageChef.Core.Devices.Dumping }; List lstFs = new List(); dumpLog.WriteLine("Getting filesystems on partition {0}, starting at {1}, ending at {2}, with type {3}, under scheme {4}.", - i, partitions[i].Start, partitions[i].End, partitions[i].Type, partitions[i].Scheme); + i, partitions[i].Start, partitions[i].End, partitions[i].Type, + partitions[i].Scheme); foreach(Filesystem _plugin in plugins.PluginsList.Values) { @@ -518,8 +508,7 @@ namespace DiscImageChef.Core.Devices.Dumping } } - if(lstFs.Count > 0) - xmlFileSysInfo[i].FileSystems = lstFs.ToArray(); + if(lstFs.Count > 0) xmlFileSysInfo[i].FileSystems = lstFs.ToArray(); } } else @@ -527,19 +516,11 @@ namespace DiscImageChef.Core.Devices.Dumping dumpLog.WriteLine("Getting filesystem for whole device."); xmlFileSysInfo = new PartitionType[1]; - xmlFileSysInfo[0] = new PartitionType - { - EndSector = (int)(blocks - 1), - StartSector = 0 - }; + xmlFileSysInfo[0] = new PartitionType {EndSector = (int)(blocks - 1), StartSector = 0}; List lstFs = new List(); - Partition wholePart = new Partition - { - Name = "Whole device", - Length = blocks, - Size = blocks * blockSize - }; + Partition wholePart = + new Partition {Name = "Whole device", Length = blocks, Size = blocks * blockSize}; foreach(Filesystem _plugin in plugins.PluginsList.Values) { @@ -561,8 +542,7 @@ namespace DiscImageChef.Core.Devices.Dumping } } - if(lstFs.Count > 0) - xmlFileSysInfo[0].FileSystems = lstFs.ToArray(); + if(lstFs.Count > 0) xmlFileSysInfo[0].FileSystems = lstFs.ToArray(); } } @@ -586,10 +566,8 @@ namespace DiscImageChef.Core.Devices.Dumping format = "Raw disk image (sector by sector copy)", Value = outputPrefix + ".bin" }; - if(dev.Type == DeviceType.MMC) - sidecar.BlockMedia[0].Interface = "MultiMediaCard"; - else if(dev.Type == DeviceType.SecureDigital) - sidecar.BlockMedia[0].Interface = "SecureDigital"; + if(dev.Type == DeviceType.MMC) sidecar.BlockMedia[0].Interface = "MultiMediaCard"; + else if(dev.Type == DeviceType.SecureDigital) sidecar.BlockMedia[0].Interface = "SecureDigital"; sidecar.BlockMedia[0].LogicalBlocks = (long)blocks; sidecar.BlockMedia[0].PhysicalBlockSize = physicalBlockSize > 0 ? physicalBlockSize : (int)blockSize; sidecar.BlockMedia[0].LogicalBlockSize = (int)blockSize; @@ -597,36 +575,34 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.BlockMedia[0].Model = dev.Model; sidecar.BlockMedia[0].Serial = dev.Serial; sidecar.BlockMedia[0].Size = (long)(blocks * blockSize); - if(xmlFileSysInfo != null) - sidecar.BlockMedia[0].FileSystemInformation = xmlFileSysInfo; + if(xmlFileSysInfo != null) sidecar.BlockMedia[0].FileSystemInformation = xmlFileSysInfo; DicConsole.WriteLine(); - DicConsole.WriteLine("Took a total of {0:F3} seconds ({1:F3} processing commands, {2:F3} checksumming).", (end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000); - DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1048576) / (totalDuration / 1000)); + DicConsole.WriteLine("Took a total of {0:F3} seconds ({1:F3} processing commands, {2:F3} checksumming).", + (end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000); + DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1048576) / (totalDuration / 1000)); DicConsole.WriteLine("Fastest speed burst: {0:F3} MiB/sec.", maxSpeed); DicConsole.WriteLine("Slowest speed burst: {0:F3} MiB/sec.", minSpeed); DicConsole.WriteLine("{0} sectors could not be read.", resume.BadBlocks.Count); - if(resume.BadBlocks.Count > 0) - resume.BadBlocks.Sort(); + if(resume.BadBlocks.Count > 0) resume.BadBlocks.Sort(); DicConsole.WriteLine(); if(!aborted) { DicConsole.WriteLine("Writing metadata sidecar"); - FileStream xmlFs = new FileStream(outputPrefix + ".cicm.xml", - FileMode.Create); + FileStream xmlFs = new FileStream(outputPrefix + ".cicm.xml", FileMode.Create); - System.Xml.Serialization.XmlSerializer xmlSer = new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); + System.Xml.Serialization.XmlSerializer xmlSer = + new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); xmlSer.Serialize(xmlFs, sidecar); xmlFs.Close(); } - if(dev.Type == DeviceType.MMC) - Statistics.AddMedia(MediaType.MMC, true); - else if(dev.Type == DeviceType.SecureDigital) - Statistics.AddMedia(MediaType.SecureDigital, true); + if(dev.Type == DeviceType.MMC) Statistics.AddMedia(MediaType.MMC, true); + else if(dev.Type == DeviceType.SecureDigital) Statistics.AddMedia(MediaType.SecureDigital, true); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Dumping/XGD.cs b/DiscImageChef.Core/Devices/Dumping/XGD.cs index 2c283ad0..d77f5b8e 100644 --- a/DiscImageChef.Core/Devices/Dumping/XGD.cs +++ b/DiscImageChef.Core/Devices/Dumping/XGD.cs @@ -49,7 +49,10 @@ namespace DiscImageChef.Core.Devices.Dumping { internal static class XGD { - internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, ref MediaType dskType, ref Metadata.Resume resume, ref DumpLog dumpLog, Encoding encoding) + internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, + bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, + ref MediaType dskType, ref Metadata.Resume resume, ref DumpLog dumpLog, + Encoding encoding) { MHDDLog mhddLog; IBGLog ibgLog; @@ -68,10 +71,7 @@ namespace DiscImageChef.Core.Devices.Dumping Checksum dataChk; DataFile dumpFile = null; bool aborted = false; - System.Console.CancelKeyPress += (sender, e) => - { - e.Cancel = aborted = true; - }; + System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; }; dumpLog.WriteLine("Reading Xbox Security Sector."); sense = dev.KreonExtractSS(out byte[] ssBuf, out byte[] senseBuf, dev.Timeout, out double duration); @@ -96,19 +96,19 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].Xbox = new XboxType() { SecuritySectors = new XboxSecuritySectorsType[] - { - new XboxSecuritySectorsType() - { - RequestNumber = 0, - RequestVersion = 1, - SecuritySectors = new DumpType() - { - Image = outputPrefix + ".ss.bin", - Size = tmpBuf.Length, - Checksums = Checksum.GetChecksums(tmpBuf).ToArray() - } - } - } + { + new XboxSecuritySectorsType() + { + RequestNumber = 0, + RequestVersion = 1, + SecuritySectors = new DumpType() + { + Image = outputPrefix + ".ss.bin", + Size = tmpBuf.Length, + Checksums = Checksum.GetChecksums(tmpBuf).ToArray() + } + } + } }; DataFile.WriteTo("SCSI Dump", outputPrefix + ".ss.bin", ssBuf); @@ -124,6 +124,7 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Cannot lock drive, not continuing."); return; } + dumpLog.WriteLine("Getting video partition size."); sense = dev.ReadCapacity(out byte[] readBuffer, out senseBuf, dev.Timeout, out duration); if(sense) @@ -132,15 +133,18 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Cannot get disc capacity."); return; } + totalSize = (ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + (readBuffer[3])); dumpLog.WriteLine("Reading Physical Format Information."); - sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, 0, out duration); + sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.PhysicalInformation, 0, 0, out duration); if(sense) { dumpLog.WriteLine("Cannot get PFI."); DicConsole.ErrorWriteLine("Cannot get PFI."); return; } + tmpBuf = new byte[readBuffer.Length - 4]; Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4); sidecar.OpticalDisc[0].PFI = new DumpType @@ -151,16 +155,19 @@ namespace DiscImageChef.Core.Devices.Dumping }; DataFile.WriteTo("SCSI Dump", sidecar.OpticalDisc[0].PFI.Image, tmpBuf, "Locked PFI", true); DicConsole.DebugWriteLine("Dump-media command", "Video partition total size: {0} sectors", totalSize); - l0Video = Decoders.DVD.PFI.Decode(readBuffer).Value.Layer0EndPSN - Decoders.DVD.PFI.Decode(readBuffer).Value.DataAreaStartPSN + 1; + l0Video = Decoders.DVD.PFI.Decode(readBuffer).Value.Layer0EndPSN - + Decoders.DVD.PFI.Decode(readBuffer).Value.DataAreaStartPSN + 1; l1Video = totalSize - l0Video + 1; dumpLog.WriteLine("Reading Disc Manufacturing Information."); - sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, 0, out duration); + sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DiscManufacturingInformation, 0, 0, out duration); if(sense) { dumpLog.WriteLine("Cannot get DMI."); DicConsole.ErrorWriteLine("Cannot get DMI."); return; } + tmpBuf = new byte[readBuffer.Length - 4]; Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4); sidecar.OpticalDisc[0].DMI = new DumpType @@ -181,6 +188,7 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Cannot unlock drive, not continuing."); return; } + dumpLog.WriteLine("Getting game partition size."); sense = dev.ReadCapacity(out readBuffer, out senseBuf, dev.Timeout, out duration); if(sense) @@ -189,7 +197,9 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Cannot get disc capacity."); return; } - gameSize = (ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + (readBuffer[3])) + 1; + + gameSize = (ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + (readBuffer[3])) + + 1; DicConsole.DebugWriteLine("Dump-media command", "Game partition total size: {0} sectors", gameSize); // Get middle zone size @@ -202,6 +212,7 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Cannot unlock drive, not continuing."); return; } + dumpLog.WriteLine("Getting disc size."); sense = dev.ReadCapacity(out readBuffer, out senseBuf, dev.Timeout, out duration); if(sense) @@ -210,18 +221,22 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Cannot get disc capacity."); return; } + totalSize = (ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + (readBuffer[3])); dumpLog.WriteLine("Reading Physical Format Information."); - sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, 0, out duration); + sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.PhysicalInformation, 0, 0, out duration); if(sense) { dumpLog.WriteLine("Cannot get PFI."); DicConsole.ErrorWriteLine("Cannot get PFI."); return; } + DicConsole.DebugWriteLine("Dump-media command", "Unlocked total size: {0} sectors", totalSize); blocks = totalSize + 1; - middleZone = totalSize - (Decoders.DVD.PFI.Decode(readBuffer).Value.Layer0EndPSN - Decoders.DVD.PFI.Decode(readBuffer).Value.DataAreaStartPSN + 1) - gameSize + 1; + middleZone = totalSize - (Decoders.DVD.PFI.Decode(readBuffer).Value.Layer0EndPSN - + Decoders.DVD.PFI.Decode(readBuffer).Value.DataAreaStartPSN + 1) - gameSize + 1; tmpBuf = new byte[readBuffer.Length - 4]; Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4); @@ -234,13 +249,15 @@ namespace DiscImageChef.Core.Devices.Dumping DataFile.WriteTo("SCSI Dump", sidecar.OpticalDisc[0].Xbox.PFI.Image, tmpBuf, "Unlocked PFI", true); dumpLog.WriteLine("Reading Disc Manufacturing Information."); - sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, 0, out duration); + sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DiscManufacturingInformation, 0, 0, out duration); if(sense) { dumpLog.WriteLine("Cannot get DMI."); DicConsole.ErrorWriteLine("Cannot get DMI."); return; } + tmpBuf = new byte[readBuffer.Length - 4]; Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4); sidecar.OpticalDisc[0].Xbox.DMI = new DumpType @@ -251,7 +268,6 @@ namespace DiscImageChef.Core.Devices.Dumping }; DataFile.WriteTo("SCSI Dump", sidecar.OpticalDisc[0].Xbox.DMI.Image, tmpBuf, "Unlocked DMI", true); - totalSize = l0Video + l1Video + middleZone * 2 + gameSize; layerBreak = l0Video + middleZone + gameSize / 2; @@ -270,7 +286,8 @@ namespace DiscImageChef.Core.Devices.Dumping dumpLog.WriteLine("Total 0 size: {0} sectors", totalSize); dumpLog.WriteLine("Real layer break: {0}", layerBreak); - bool read12 = !dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, 0, blockSize, 0, 1, false, dev.Timeout, out duration); + bool read12 = !dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, 0, blockSize, 0, 1, + false, dev.Timeout, out duration); if(!read12) { dumpLog.WriteLine("Cannot read medium, aborting scan..."); @@ -285,13 +302,12 @@ namespace DiscImageChef.Core.Devices.Dumping { if(read12) { - sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, 0, blockSize, 0, blocksToRead, false, dev.Timeout, out duration); - if(sense || dev.Error) - blocksToRead /= 2; + sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, 0, blockSize, 0, + blocksToRead, false, dev.Timeout, out duration); + if(sense || dev.Error) blocksToRead /= 2; } - if(!dev.Error || blocksToRead == 1) - break; + if(!dev.Error || blocksToRead == 1) break; } if(dev.Error) @@ -316,13 +332,14 @@ namespace DiscImageChef.Core.Devices.Dumping uint saveBlocksToRead = blocksToRead; DumpHardwareType currentTry = null; ExtentsULong extents = null; - ResumeSupport.Process(true, true, totalSize, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformID, ref resume, ref currentTry, ref extents); + ResumeSupport.Process(true, true, totalSize, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformID, + ref resume, ref currentTry, ref extents); if(currentTry == null || extents == null) throw new Exception("Could not process resume file, not continuing..."); + ulong currentSector = resume.NextBlock; dumpFile.Seek(resume.NextBlock, blockSize); - if(resume.NextBlock > 0) - dumpLog.WriteLine("Resuming from block {0}.", resume.NextBlock); + if(resume.NextBlock > 0) dumpLog.WriteLine("Resuming from block {0}.", resume.NextBlock); dumpLog.WriteLine("Reading game partition."); for(int e = 0; e <= 16; e++) @@ -335,8 +352,7 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - if(currentSector >= blocks) - break; + if(currentSector >= blocks) break; ulong extentStart, extentEnd; // Extents @@ -345,11 +361,13 @@ namespace DiscImageChef.Core.Devices.Dumping if(xboxSS.Value.Extents[e].StartPSN <= xboxSS.Value.Layer0EndPSN) extentStart = xboxSS.Value.Extents[e].StartPSN - 0x30000; else - extentStart = (xboxSS.Value.Layer0EndPSN + 1) * 2 - ((xboxSS.Value.Extents[e].StartPSN ^ 0xFFFFFF) + 1) - 0x30000; + extentStart = (xboxSS.Value.Layer0EndPSN + 1) * 2 - + ((xboxSS.Value.Extents[e].StartPSN ^ 0xFFFFFF) + 1) - 0x30000; if(xboxSS.Value.Extents[e].EndPSN <= xboxSS.Value.Layer0EndPSN) extentEnd = xboxSS.Value.Extents[e].EndPSN - 0x30000; else - extentEnd = (xboxSS.Value.Layer0EndPSN + 1) * 2 - ((xboxSS.Value.Extents[e].EndPSN ^ 0xFFFFFF) + 1) - 0x30000; + extentEnd = (xboxSS.Value.Layer0EndPSN + 1) * 2 - + ((xboxSS.Value.Extents[e].EndPSN ^ 0xFFFFFF) + 1) - 0x30000; } // After last extent else @@ -358,8 +376,7 @@ namespace DiscImageChef.Core.Devices.Dumping extentEnd = blocks; } - if(currentSector > extentEnd) - continue; + if(currentSector > extentEnd) continue; for(ulong i = currentSector; i < extentStart; i += blocksToRead) { @@ -372,19 +389,17 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - if((extentStart - i) < blocksToRead) - blocksToRead = (uint)(extentStart - i); + if((extentStart - i) < blocksToRead) blocksToRead = (uint)(extentStart - i); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(currentSpeed > maxSpeed && currentSpeed != 0) - maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && currentSpeed != 0) - minSpeed = currentSpeed; + if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed; + if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, totalSize, currentSpeed); - sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)i, blockSize, 0, blocksToRead, false, dev.Timeout, out cmdDuration); + sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)i, blockSize, + 0, blocksToRead, false, dev.Timeout, out cmdDuration); totalDuration += cmdDuration; if(!sense && !dev.Error) @@ -397,27 +412,26 @@ namespace DiscImageChef.Core.Devices.Dumping else { // TODO: Reset device after X errors - if(stopOnError) - return; // TODO: Return more cleanly + if(stopOnError) return; // TODO: Return more cleanly // Write empty data dumpFile.Write(new byte[blockSize * blocksToRead]); errored += blocksToRead; - for(ulong b = i; b < i + blocksToRead; b++) - resume.BadBlocks.Add(b); - DicConsole.DebugWriteLine("Dump-Media", "READ error:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); - if(cmdDuration < 500) - mhddLog.Write(i, 65535); - else - mhddLog.Write(i, cmdDuration); + for(ulong b = i; b < i + blocksToRead; b++) resume.BadBlocks.Add(b); + + DicConsole.DebugWriteLine("Dump-Media", "READ error:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); + if(cmdDuration < 500) mhddLog.Write(i, 65535); + else mhddLog.Write(i, cmdDuration); ibgLog.Write(i, 0); dumpLog.WriteLine("Error reading {0} blocks from block {1}.", blocksToRead, i); - string[] senseLines = Decoders.SCSI.Sense.PrettifySense(senseBuf).Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); - foreach(string senseLine in senseLines) - dumpLog.WriteLine(senseLine); + string[] senseLines = Decoders + .SCSI.Sense.PrettifySense(senseBuf).Split(new[] {Environment.NewLine}, + StringSplitOptions.RemoveEmptyEntries); + foreach(string senseLine in senseLines) dumpLog.WriteLine(senseLine); } #pragma warning disable IDE0004 // Remove Unnecessary Cast @@ -438,8 +452,7 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - if((extentEnd - i) < blocksToRead) - blocksToRead = (uint)(extentEnd - i) + 1; + if((extentEnd - i) < blocksToRead) blocksToRead = (uint)(extentEnd - i) + 1; mhddLog.Write(i, cmdDuration); ibgLog.Write(i, currentSpeed * 1024); @@ -450,8 +463,7 @@ namespace DiscImageChef.Core.Devices.Dumping resume.NextBlock = currentSector; } - if(!aborted) - currentSector = extentEnd + 1; + if(!aborted) currentSector = extentEnd + 1; } // Middle Zone D @@ -465,10 +477,10 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - if(((middleZone - 1) - middle) < blocksToRead) - blocksToRead = (uint)((middleZone - 1) - middle); + if(((middleZone - 1) - middle) < blocksToRead) blocksToRead = (uint)((middleZone - 1) - middle); - DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", middle + currentSector, totalSize, currentSpeed); + DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", middle + currentSector, totalSize, + currentSpeed); mhddLog.Write(middle + currentSector, cmdDuration); ibgLog.Write(middle + currentSector, currentSpeed * 1024); @@ -489,6 +501,7 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Cannot lock drive, not continuing."); return; } + sense = dev.ReadCapacity(out readBuffer, out senseBuf, dev.Timeout, out duration); if(sense) { @@ -507,19 +520,18 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - if(((l0Video + l1Video) - l1) < blocksToRead) - blocksToRead = (uint)((l0Video + l1Video) - l1); + if(((l0Video + l1Video) - l1) < blocksToRead) blocksToRead = (uint)((l0Video + l1Video) - l1); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(currentSpeed > maxSpeed && currentSpeed != 0) - maxSpeed = currentSpeed; - if(currentSpeed < minSpeed && currentSpeed != 0) - minSpeed = currentSpeed; + if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed; + if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator - DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", currentSector, totalSize, currentSpeed); + DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", currentSector, totalSize, + currentSpeed); - sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)l1, blockSize, 0, blocksToRead, false, dev.Timeout, out cmdDuration); + sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)l1, blockSize, 0, + blocksToRead, false, dev.Timeout, out cmdDuration); totalDuration += cmdDuration; if(!sense && !dev.Error) @@ -532,8 +544,7 @@ namespace DiscImageChef.Core.Devices.Dumping else { // TODO: Reset device after X errors - if(stopOnError) - return; // TODO: Return more cleanly + if(stopOnError) return; // TODO: Return more cleanly // Write empty data dumpFile.Write(new byte[blockSize * blocksToRead]); @@ -541,17 +552,17 @@ namespace DiscImageChef.Core.Devices.Dumping // TODO: Handle errors in video partition //errored += blocksToRead; //resume.BadBlocks.Add(l1); - DicConsole.DebugWriteLine("Dump-Media", "READ error:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); - if(cmdDuration < 500) - mhddLog.Write(l1, 65535); - else - mhddLog.Write(l1, cmdDuration); + DicConsole.DebugWriteLine("Dump-Media", "READ error:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); + if(cmdDuration < 500) mhddLog.Write(l1, 65535); + else mhddLog.Write(l1, cmdDuration); ibgLog.Write(l1, 0); dumpLog.WriteLine("Error reading {0} blocks from block {1}.", blocksToRead, l1); - string[] senseLines = Decoders.SCSI.Sense.PrettifySense(senseBuf).Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); - foreach(string senseLine in senseLines) - dumpLog.WriteLine(senseLine); + string[] senseLines = Decoders.SCSI.Sense.PrettifySense(senseBuf).Split(new[] {Environment.NewLine}, + StringSplitOptions + .RemoveEmptyEntries); + foreach(string senseLine in senseLines) dumpLog.WriteLine(senseLine); } #pragma warning disable IDE0004 // Remove Unnecessary Cast @@ -569,6 +580,7 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.ErrorWriteLine("Cannot unlock drive, not continuing."); return; } + sense = dev.ReadCapacity(out readBuffer, out senseBuf, dev.Timeout, out duration); if(sense) { @@ -580,21 +592,19 @@ namespace DiscImageChef.Core.Devices.Dumping DicConsole.WriteLine(); mhddLog.Close(); #pragma warning disable IDE0004 // Remove Unnecessary Cast - ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); + ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); #pragma warning restore IDE0004 // Remove Unnecessary Cast dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds); - dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); + dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000)); #region Error handling if(resume.BadBlocks.Count > 0 && !aborted) { List tmpList = new List(); - foreach(ulong ur in resume.BadBlocks) - { - for(ulong i = ur; i < ur + blocksToRead; i++) - tmpList.Add(i); - } + foreach(ulong ur in resume.BadBlocks) { for(ulong i = ur; i < ur + blocksToRead; i++) tmpList.Add(i); } tmpList.Sort(); @@ -604,7 +614,7 @@ namespace DiscImageChef.Core.Devices.Dumping resume.BadBlocks = tmpList; - repeatRetry: + repeatRetry: ulong[] tmpArray = resume.BadBlocks.ToArray(); foreach(ulong badSector in tmpArray) { @@ -617,9 +627,12 @@ namespace DiscImageChef.Core.Devices.Dumping cmdDuration = 0; - DicConsole.Write("\rRetrying sector {0}, pass {1}, {3}{2}", badSector, pass + 1, forward ? "forward" : "reverse", runningPersistent ? "recovering partial data, " : ""); + DicConsole.Write("\rRetrying sector {0}, pass {1}, {3}{2}", badSector, pass + 1, + forward ? "forward" : "reverse", + runningPersistent ? "recovering partial data, " : ""); - sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)badSector, blockSize, 0, 1, false, dev.Timeout, out cmdDuration); + sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)badSector, + blockSize, 0, 1, false, dev.Timeout, out cmdDuration); totalDuration += cmdDuration; if(!sense && !dev.Error) @@ -629,8 +642,7 @@ namespace DiscImageChef.Core.Devices.Dumping dumpFile.WriteAt(readBuffer, badSector, blockSize); dumpLog.WriteLine("Correctly retried block {0} in pass {1}.", badSector, pass); } - else if(runningPersistent) - dumpFile.WriteAt(readBuffer, badSector, blockSize); + else if(runningPersistent) dumpFile.WriteAt(readBuffer, badSector, blockSize); } if(pass < retryPasses && !aborted && resume.BadBlocks.Count > 0) @@ -649,27 +661,27 @@ namespace DiscImageChef.Core.Devices.Dumping if(!runningPersistent && persistent) { - sense = dev.ModeSense6(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current, 0x01, dev.Timeout, out duration); + sense = dev.ModeSense6(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current, 0x01, + dev.Timeout, out duration); if(sense) { - sense = dev.ModeSense10(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current, 0x01, dev.Timeout, out duration); - if(!sense) - currentMode = Decoders.SCSI.Modes.DecodeMode10(readBuffer, dev.SCSIType); + sense = dev.ModeSense10(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current, + 0x01, dev.Timeout, out duration); + if(!sense) currentMode = Decoders.SCSI.Modes.DecodeMode10(readBuffer, dev.SCSIType); } - else - currentMode = Decoders.SCSI.Modes.DecodeMode6(readBuffer, dev.SCSIType); + else currentMode = Decoders.SCSI.Modes.DecodeMode6(readBuffer, dev.SCSIType); - if(currentMode.HasValue) - currentModePage = currentMode.Value.Pages[0]; + if(currentMode.HasValue) currentModePage = currentMode.Value.Pages[0]; if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) { - Decoders.SCSI.Modes.ModePage_01_MMC pgMMC = new Decoders.SCSI.Modes.ModePage_01_MMC - { - PS = false, - ReadRetryCount = 255, - Parameter = 0x20 - }; + Decoders.SCSI.Modes.ModePage_01_MMC pgMMC = + new Decoders.SCSI.Modes.ModePage_01_MMC + { + PS = false, + ReadRetryCount = 255, + Parameter = 0x20 + }; Decoders.SCSI.Modes.DecodedMode md = new Decoders.SCSI.Modes.DecodedMode { Header = new Decoders.SCSI.Modes.ModeHeader(), @@ -677,10 +689,10 @@ namespace DiscImageChef.Core.Devices.Dumping { new Decoders.SCSI.Modes.ModePage { - Page = 0x01, - Subpage = 0x00, - PageResponse = Decoders.SCSI.Modes.EncodeModePage_01_MMC(pgMMC) - } + Page = 0x01, + Subpage = 0x00, + PageResponse = Decoders.SCSI.Modes.EncodeModePage_01_MMC(pgMMC) + } } }; md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType); @@ -707,11 +719,11 @@ namespace DiscImageChef.Core.Devices.Dumping Pages = new Decoders.SCSI.Modes.ModePage[] { new Decoders.SCSI.Modes.ModePage - { - Page = 0x01, - Subpage = 0x00, - PageResponse = Decoders.SCSI.Modes.EncodeModePage_01(pg) - } + { + Page = 0x01, + Subpage = 0x00, + PageResponse = Decoders.SCSI.Modes.EncodeModePage_01(pg) + } } }; md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType); @@ -720,10 +732,7 @@ namespace DiscImageChef.Core.Devices.Dumping dumpLog.WriteLine("Sending MODE SELECT to drive."); sense = dev.ModeSelect(md6, out senseBuf, true, false, dev.Timeout, out duration); - if(sense) - { - sense = dev.ModeSelect10(md10, out senseBuf, true, false, dev.Timeout, out duration); - } + if(sense) { sense = dev.ModeSelect10(md10, out senseBuf, true, false, dev.Timeout, out duration); } runningPersistent = true; if(!sense && !dev.Error) @@ -737,25 +746,20 @@ namespace DiscImageChef.Core.Devices.Dumping Decoders.SCSI.Modes.DecodedMode md = new Decoders.SCSI.Modes.DecodedMode { Header = new Decoders.SCSI.Modes.ModeHeader(), - Pages = new Decoders.SCSI.Modes.ModePage[] - { - currentModePage.Value - } + Pages = new Decoders.SCSI.Modes.ModePage[] {currentModePage.Value} }; md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType); md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.SCSIType); dumpLog.WriteLine("Sending MODE SELECT to drive."); sense = dev.ModeSelect(md6, out senseBuf, true, false, dev.Timeout, out duration); - if(sense) - { - sense = dev.ModeSelect10(md10, out senseBuf, true, false, dev.Timeout, out duration); - } + if(sense) { sense = dev.ModeSelect10(md10, out senseBuf, true, false, dev.Timeout, out duration); } } DicConsole.WriteLine(); } #endregion Error handling + resume.BadBlocks.Sort(); currentTry.Extents = Metadata.ExtentsConverter.ToMetadata(extents); @@ -774,8 +778,7 @@ namespace DiscImageChef.Core.Devices.Dumping break; } - if((blocks - i) < blocksToRead) - blocksToRead = (uint)(blocks - i); + if((blocks - i) < blocksToRead) blocksToRead = (uint)(blocks - i); DicConsole.Write("\rChecksumming sector {0} of {1} ({2:F3} MiB/sec.)", i, blocks, currentSpeed); @@ -792,11 +795,13 @@ namespace DiscImageChef.Core.Devices.Dumping currentSpeed = ((double)blockSize * blocksToRead / (double)1048576) / (chkDuration / (double)1000); #pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created } + DicConsole.WriteLine(); dumpFile.Close(); end = DateTime.UtcNow; dumpLog.WriteLine("Checksum finished in {0} seconds.", (end - start).TotalSeconds); - dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.", (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalChkDuration / 1000)); + dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.", + (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalChkDuration / 1000)); PluginBase plugins = new PluginBase(); plugins.RegisterAllPlugins(encoding); @@ -813,15 +818,8 @@ namespace DiscImageChef.Core.Devices.Dumping _imageFormat = ImageFormat.Detect(inputFilter); PartitionType[] xmlFileSysInfo = null; - try - { - if(!_imageFormat.OpenImage(inputFilter)) - _imageFormat = null; - } - catch - { - _imageFormat = null; - } + try { if(!_imageFormat.OpenImage(inputFilter)) _imageFormat = null; } + catch { _imageFormat = null; } if(_imageFormat != null) { @@ -846,7 +844,8 @@ namespace DiscImageChef.Core.Devices.Dumping }; List lstFs = new List(); dumpLog.WriteLine("Getting filesystems on partition {0}, starting at {1}, ending at {2}, with type {3}, under scheme {4}.", - i, partitions[i].Start, partitions[i].End, partitions[i].Type, partitions[i].Scheme); + i, partitions[i].Start, partitions[i].End, partitions[i].Type, + partitions[i].Scheme); foreach(Filesystem _plugin in plugins.PluginsList.Values) { @@ -859,12 +858,10 @@ namespace DiscImageChef.Core.Devices.Dumping Statistics.AddFilesystem(_plugin.XmlFSType.Type); dumpLog.WriteLine("Filesystem {0} found.", _plugin.XmlFSType.Type); - if(_plugin.XmlFSType.Type == "Opera") - dskType = MediaType.ThreeDO; + if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO; if(_plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2; - if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") - dskType = MediaType.WOD; + if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD; if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD; } @@ -877,27 +874,18 @@ namespace DiscImageChef.Core.Devices.Dumping } } - if(lstFs.Count > 0) - xmlFileSysInfo[i].FileSystems = lstFs.ToArray(); + if(lstFs.Count > 0) xmlFileSysInfo[i].FileSystems = lstFs.ToArray(); } } else { dumpLog.WriteLine("Getting filesystem for whole device."); xmlFileSysInfo = new PartitionType[1]; - xmlFileSysInfo[0] = new PartitionType - { - EndSector = (int)(blocks - 1), - StartSector = 0 - }; + xmlFileSysInfo[0] = new PartitionType {EndSector = (int)(blocks - 1), StartSector = 0}; List lstFs = new List(); - Partition wholePart = new Partition - { - Name = "Whole device", - Length = blocks, - Size = blocks * blockSize - }; + Partition wholePart = + new Partition {Name = "Whole device", Length = blocks, Size = blocks * blockSize}; foreach(Filesystem _plugin in plugins.PluginsList.Values) { @@ -910,14 +898,10 @@ namespace DiscImageChef.Core.Devices.Dumping Statistics.AddFilesystem(_plugin.XmlFSType.Type); dumpLog.WriteLine("Filesystem {0} found.", _plugin.XmlFSType.Type); - if(_plugin.XmlFSType.Type == "Opera") - dskType = MediaType.ThreeDO; - if(_plugin.XmlFSType.Type == "PC Engine filesystem") - dskType = MediaType.SuperCDROM2; - if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") - dskType = MediaType.WOD; - if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") - dskType = MediaType.GOD; + if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO; + if(_plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2; + if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD; + if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD; } } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body @@ -928,8 +912,7 @@ namespace DiscImageChef.Core.Devices.Dumping } } - if(lstFs.Count > 0) - xmlFileSysInfo[0].FileSystems = lstFs.ToArray(); + if(lstFs.Count > 0) xmlFileSysInfo[0].FileSystems = lstFs.ToArray(); } } @@ -946,35 +929,28 @@ namespace DiscImageChef.Core.Devices.Dumping typeSpecified = true, Sectors = new SectorsType[1] }; - sidecar.OpticalDisc[0].Layers.Sectors[0] = new SectorsType - { - Value = (long)layerBreak - }; + sidecar.OpticalDisc[0].Layers.Sectors[0] = new SectorsType {Value = (long)layerBreak}; sidecar.OpticalDisc[0].Sessions = 1; - sidecar.OpticalDisc[0].Tracks = new[] { 1 }; + sidecar.OpticalDisc[0].Tracks = new[] {1}; sidecar.OpticalDisc[0].Track = new Schemas.TrackType[1]; sidecar.OpticalDisc[0].Track[0] = new Schemas.TrackType { BytesPerSector = (int)blockSize, Checksums = sidecar.OpticalDisc[0].Checksums, EndSector = (long)(blocks - 1), - Image = new ImageType() - { - format = "BINARY", - offset = 0, - offsetSpecified = true, - Value = sidecar.OpticalDisc[0].Image.Value - }, - Sequence = new TrackSequenceType() - { - Session = 1, - TrackNumber = 1 - }, + Image = + new ImageType() + { + format = "BINARY", + offset = 0, + offsetSpecified = true, + Value = sidecar.OpticalDisc[0].Image.Value + }, + Sequence = new TrackSequenceType() {Session = 1, TrackNumber = 1}, Size = (long)(totalSize * blockSize), StartSector = 0 }; - if(xmlFileSysInfo != null) - sidecar.OpticalDisc[0].Track[0].FileSystemInformation = xmlFileSysInfo; + if(xmlFileSysInfo != null) sidecar.OpticalDisc[0].Track[0].FileSystemInformation = xmlFileSysInfo; sidecar.OpticalDisc[0].Track[0].TrackType1 = TrackTypeTrackType.dvd; sidecar.OpticalDisc[0].Dimensions = Metadata.Dimensions.DimensionsFromMediaType(dskType); Metadata.MediaType.MediaTypeToString(dskType, out string xmlDskTyp, out string xmlDskSubTyp); @@ -985,10 +961,10 @@ namespace DiscImageChef.Core.Devices.Dumping { DicConsole.WriteLine("Writing metadata sidecar"); - FileStream xmlFs = new FileStream(outputPrefix + ".cicm.xml", - FileMode.Create); + FileStream xmlFs = new FileStream(outputPrefix + ".cicm.xml", FileMode.Create); - System.Xml.Serialization.XmlSerializer xmlSer = new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); + System.Xml.Serialization.XmlSerializer xmlSer = + new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); xmlSer.Serialize(xmlFs, sidecar); xmlFs.Close(); } @@ -996,4 +972,4 @@ namespace DiscImageChef.Core.Devices.Dumping Statistics.AddMedia(dskType, true); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Reader.cs b/DiscImageChef.Core/Devices/Reader.cs index c227aeac..c25817e0 100644 --- a/DiscImageChef.Core/Devices/Reader.cs +++ b/DiscImageChef.Core/Devices/Reader.cs @@ -48,15 +48,42 @@ namespace DiscImageChef.Core.Devices uint physicalsectorsize; uint longBlockSize; - public string ErrorMessage { get { return errorMessage; } } - public ulong Blocks { get { return blocks; } } - public uint BlocksToRead { get { return blocksToRead; } } - public uint LogicalBlockSize { get { return blockSize; } } - public uint PhysicalBlockSize { get { return physicalsectorsize; } } - public uint LongBlockSize { get { return longBlockSize; } } - public bool CanReadRaw { get { return readRaw; } } - public bool CanSeek { get { return ataSeek || seek6 || seek10; } } - public bool CanSeekLBA { get { return ataSeekLba || seek6 || seek10; } } + public string ErrorMessage + { + get { return errorMessage; } + } + public ulong Blocks + { + get { return blocks; } + } + public uint BlocksToRead + { + get { return blocksToRead; } + } + public uint LogicalBlockSize + { + get { return blockSize; } + } + public uint PhysicalBlockSize + { + get { return physicalsectorsize; } + } + public uint LongBlockSize + { + get { return longBlockSize; } + } + public bool CanReadRaw + { + get { return readRaw; } + } + public bool CanSeek + { + get { return ataSeek || seek6 || seek10; } + } + public bool CanSeekLBA + { + get { return ataSeekLba || seek6 || seek10; } + } public Reader(Device dev, uint timeout, byte[] identification, bool raw = false) { @@ -68,11 +95,9 @@ namespace DiscImageChef.Core.Devices switch(dev.Type) { case DeviceType.ATA: - if(Identify.Decode(identification).HasValue) - ataId = Identify.Decode(identification).Value; + if(Identify.Decode(identification).HasValue) ataId = Identify.Decode(identification).Value; break; - case DeviceType.NVMe: - throw new NotImplementedException("NVMe devices not yet supported."); + case DeviceType.NVMe: throw new NotImplementedException("NVMe devices not yet supported."); } } @@ -80,11 +105,9 @@ namespace DiscImageChef.Core.Devices { switch(dev.Type) { - case DeviceType.ATA: - return AtaGetBlocks(); + case DeviceType.ATA: return AtaGetBlocks(); case DeviceType.ATAPI: - case DeviceType.SCSI: - return ScsiGetBlocks(); + case DeviceType.SCSI: return ScsiGetBlocks(); default: errorMessage = string.Format("Unknown device type {0}.", dev.Type); return 0; @@ -95,11 +118,9 @@ namespace DiscImageChef.Core.Devices { switch(dev.Type) { - case DeviceType.ATA: - return AtaFindReadCommand(); + case DeviceType.ATA: return AtaFindReadCommand(); case DeviceType.ATAPI: - case DeviceType.SCSI: - return ScsiFindReadCommand(); + case DeviceType.SCSI: return ScsiFindReadCommand(); default: errorMessage = string.Format("Unknown device type {0}.", dev.Type); return true; @@ -110,11 +131,9 @@ namespace DiscImageChef.Core.Devices { switch(dev.Type) { - case DeviceType.ATA: - return AtaGetBlockSize(); + case DeviceType.ATA: return AtaGetBlockSize(); case DeviceType.ATAPI: - case DeviceType.SCSI: - return ScsiGetBlockSize(); + case DeviceType.SCSI: return ScsiGetBlockSize(); default: errorMessage = string.Format("Unknown device type {0}.", dev.Type); return true; @@ -125,11 +144,9 @@ namespace DiscImageChef.Core.Devices { switch(dev.Type) { - case DeviceType.ATA: - return AtaGetBlocksToRead(startWithBlocks); + case DeviceType.ATA: return AtaGetBlocksToRead(startWithBlocks); case DeviceType.ATAPI: - case DeviceType.SCSI: - return ScsiGetBlocksToRead(startWithBlocks); + case DeviceType.SCSI: return ScsiGetBlocksToRead(startWithBlocks); default: errorMessage = string.Format("Unknown device type {0}.", dev.Type); return true; @@ -150,11 +167,9 @@ namespace DiscImageChef.Core.Devices { switch(dev.Type) { - case DeviceType.ATA: - return AtaReadBlocks(out buffer, block, count, out duration); + case DeviceType.ATA: return AtaReadBlocks(out buffer, block, count, out duration); case DeviceType.ATAPI: - case DeviceType.SCSI: - return ScsiReadBlocks(out buffer, block, count, out duration); + case DeviceType.SCSI: return ScsiReadBlocks(out buffer, block, count, out duration); default: buffer = null; duration = 0d; @@ -166,8 +181,7 @@ namespace DiscImageChef.Core.Devices { switch(dev.Type) { - case DeviceType.ATA: - return AtaReadCHS(out buffer, cylinder, head, sector, out duration); + case DeviceType.ATA: return AtaReadCHS(out buffer, cylinder, head, sector, out duration); default: buffer = null; duration = 0d; @@ -179,11 +193,9 @@ namespace DiscImageChef.Core.Devices { switch(dev.Type) { - case DeviceType.ATA: - return AtaSeek(block, out duration); + case DeviceType.ATA: return AtaSeek(block, out duration); case DeviceType.ATAPI: - case DeviceType.SCSI: - return ScsiSeek(block, out duration); + case DeviceType.SCSI: return ScsiSeek(block, out duration); default: duration = 0d; return true; @@ -194,12 +206,11 @@ namespace DiscImageChef.Core.Devices { switch(dev.Type) { - case DeviceType.ATA: - return AtaSeekCHS(cylinder, head, sector, out duration); + case DeviceType.ATA: return AtaSeekCHS(cylinder, head, sector, out duration); default: duration = 0; return true; } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/ReaderATA.cs b/DiscImageChef.Core/Devices/ReaderATA.cs index 86723ccd..1589b4c5 100644 --- a/DiscImageChef.Core/Devices/ReaderATA.cs +++ b/DiscImageChef.Core/Devices/ReaderATA.cs @@ -57,15 +57,26 @@ namespace DiscImageChef.Core.Devices Identify.IdentifyDevice ataId; - public bool IsLBA { get { return lbaMode; } } - public ushort Cylinders { get { return cylinders; } } - public byte Heads { get { return heads; } } - public byte Sectors { get { return sectors; } } + public bool IsLBA + { + get { return lbaMode; } + } + public ushort Cylinders + { + get { return cylinders; } + } + public byte Heads + { + get { return heads; } + } + public byte Sectors + { + get { return sectors; } + } public (uint, byte, byte) GetDeviceCHS() { - if(dev.Type != DeviceType.ATA) - return (0, 0, 0); + if(dev.Type != DeviceType.ATA) return (0, 0, 0); if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0) { @@ -76,7 +87,7 @@ namespace DiscImageChef.Core.Devices } if((ataId.CurrentCylinders == 0 || ataId.CurrentHeads == 0 || ataId.CurrentSectorsPerTrack == 0) && - (ataId.Cylinders > 0 && ataId.Heads > 0 && ataId.SectorsPerTrack > 0)) + (ataId.Cylinders > 0 && ataId.Heads > 0 && ataId.SectorsPerTrack > 0)) { cylinders = ataId.Cylinders; heads = (byte)ataId.Heads; @@ -166,26 +177,16 @@ namespace DiscImageChef.Core.Devices } } - if(ataReadDmaLba48) - DicConsole.WriteLine("Using ATA READ DMA EXT command."); - else if(ataReadLba48) - DicConsole.WriteLine("Using ATA READ EXT command."); - else if(ataReadDmaRetryLba) - DicConsole.WriteLine("Using ATA READ DMA command with retries (LBA)."); - else if(ataReadDmaLba) - DicConsole.WriteLine("Using ATA READ DMA command (LBA)."); - else if(ataReadRetryLba) - DicConsole.WriteLine("Using ATA READ command with retries (LBA)."); - else if(ataReadLba) - DicConsole.WriteLine("Using ATA READ command (LBA)."); - else if(ataReadDmaRetry) - DicConsole.WriteLine("Using ATA READ DMA command with retries (CHS)."); - else if(ataReadDma) - DicConsole.WriteLine("Using ATA READ DMA command (CHS)."); - else if(ataReadRetry) - DicConsole.WriteLine("Using ATA READ command with retries (CHS)."); - else if(ataRead) - DicConsole.WriteLine("Using ATA READ command (CHS)."); + if(ataReadDmaLba48) DicConsole.WriteLine("Using ATA READ DMA EXT command."); + else if(ataReadLba48) DicConsole.WriteLine("Using ATA READ EXT command."); + else if(ataReadDmaRetryLba) DicConsole.WriteLine("Using ATA READ DMA command with retries (LBA)."); + else if(ataReadDmaLba) DicConsole.WriteLine("Using ATA READ DMA command (LBA)."); + else if(ataReadRetryLba) DicConsole.WriteLine("Using ATA READ command with retries (LBA)."); + else if(ataReadLba) DicConsole.WriteLine("Using ATA READ command (LBA)."); + else if(ataReadDmaRetry) DicConsole.WriteLine("Using ATA READ DMA command with retries (CHS)."); + else if(ataReadDma) DicConsole.WriteLine("Using ATA READ DMA command (CHS)."); + else if(ataReadRetry) DicConsole.WriteLine("Using ATA READ command with retries (CHS)."); + else if(ataRead) DicConsole.WriteLine("Using ATA READ command (CHS)."); else { errorMessage = "Could not get a working read command!"; @@ -197,18 +198,14 @@ namespace DiscImageChef.Core.Devices bool AtaGetBlockSize() { - if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && - (ataId.PhysLogSectorSize & 0x4000) == 0x4000) + if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000) { if((ataId.PhysLogSectorSize & 0x1000) == 0x1000) { - if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) - blockSize = 512; - else - blockSize = ataId.LogicalSectorWords * 2; + if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) blockSize = 512; + else blockSize = ataId.LogicalSectorWords * 2; } - else - blockSize = 512; + else blockSize = 512; if((ataId.PhysLogSectorSize & 0x2000) == 0x2000) { @@ -216,8 +213,7 @@ namespace DiscImageChef.Core.Devices physicalsectorsize = blockSize * (uint)Math.Pow(2, (double)(ataId.PhysLogSectorSize & 0xF)); #pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created } - else - physicalsectorsize = blockSize; + else physicalsectorsize = blockSize; } else { @@ -281,17 +277,15 @@ namespace DiscImageChef.Core.Devices error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0); } - if(error) - blocksToRead /= 2; + if(error) blocksToRead /= 2; - if(!error || blocksToRead == 1) - break; + if(!error || blocksToRead == 1) break; } if(error && lbaMode) { blocksToRead = 1; - errorMessage=string.Format("Device error {0} trying to guess ideal transfer length.", dev.LastError); + errorMessage = string.Format("Device error {0} trying to guess ideal transfer length.", dev.LastError); return true; } @@ -351,8 +345,7 @@ namespace DiscImageChef.Core.Devices errorByte = errorLba.error; } - if(error) - DicConsole.DebugWriteLine("ATA Reader", "ATA ERROR: {0} STATUS: {1}", errorByte, status); + if(error) DicConsole.DebugWriteLine("ATA Reader", "ATA ERROR: {0} STATUS: {1}", errorByte, status); return error; } @@ -395,8 +388,7 @@ namespace DiscImageChef.Core.Devices errorByte = errorChs.error; } - if(error) - DicConsole.DebugWriteLine("ATA Reader", "ATA ERROR: {0} STATUS: {1}", errorByte, status); + if(error) DicConsole.DebugWriteLine("ATA Reader", "ATA ERROR: {0} STATUS: {1}", errorByte, status); return error; } @@ -417,4 +409,4 @@ namespace DiscImageChef.Core.Devices return !(!sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/ReaderSCSI.cs b/DiscImageChef.Core/Devices/ReaderSCSI.cs index eec0a9ba..9899608a 100644 --- a/DiscImageChef.Core/Devices/ReaderSCSI.cs +++ b/DiscImageChef.Core/Devices/ReaderSCSI.cs @@ -65,11 +65,14 @@ namespace DiscImageChef.Core.Devices read6 = !dev.Read6(out readBuffer, out senseBuf, 0, blockSize, timeout, out duration); - read10 = !dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, 0, blockSize, 0, 1, timeout, out duration); + read10 = !dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, 0, blockSize, 0, 1, + timeout, out duration); - read12 = !dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, 0, blockSize, 0, 1, false, timeout, out duration); + read12 = !dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, 0, blockSize, 0, 1, false, + timeout, out duration); - read16 = !dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, 0, blockSize, 0, 1, false, timeout, out duration); + read16 = !dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, 0, blockSize, 0, 1, false, + timeout, out duration); seek6 = !dev.Seek6(out senseBuf, 0, timeout, out duration); @@ -83,7 +86,9 @@ namespace DiscImageChef.Core.Devices if(read6 && !read10 && !read12 && !read16 && blocks > (0x001FFFFF + 1)) { - errorMessage = string.Format("Device only supports SCSI READ (6) but has more than {0} blocks ({1} blocks total)", 0x001FFFFF + 1, blocks); + errorMessage = + string.Format("Device only supports SCSI READ (6) but has more than {0} blocks ({1} blocks total)", + 0x001FFFFF + 1, blocks); return true; } @@ -92,7 +97,9 @@ namespace DiscImageChef.Core.Devices #pragma warning restore IDE0004 // Remove Unnecessary Cast { #pragma warning disable IDE0004 // Remove Unnecessary Cast - errorMessage = string.Format("Device only supports SCSI READ (10) but has more than {0} blocks ({1} blocks total)", (long)0xFFFFFFFF + (long)1, blocks); + errorMessage = + string.Format("Device only supports SCSI READ (10) but has more than {0} blocks ({1} blocks total)", + (long)0xFFFFFFFF + (long)1, blocks); #pragma warning restore IDE0004 // Remove Unnecessary Cast return true; } @@ -124,20 +131,22 @@ namespace DiscImageChef.Core.Devices } }*/ - testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, 0xFFFF, timeout, out duration); + testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, 0xFFFF, timeout, + out duration); if(testSense && !dev.Error) { decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf); if(decSense.HasValue) { if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest && - decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) + decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) { readRaw = true; if(decSense.Value.InformationValid && decSense.Value.ILI) { longBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); - readLong10 = !dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, (ushort)longBlockSize, timeout, out duration); + readLong10 = !dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, + (ushort)longBlockSize, timeout, out duration); } } } @@ -147,15 +156,18 @@ namespace DiscImageChef.Core.Devices { if(blockSize == 512) { - foreach(ushort testSize in new[] { - // Long sector sizes for floppies - 514, - // Long sector sizes for SuperDisk - 536, 558, - // Long sector sizes for 512-byte magneto-opticals - 600, 610, 630 }) + foreach(ushort testSize in new[] { - testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, testSize, timeout, out duration); + // Long sector sizes for floppies + 514, + // Long sector sizes for SuperDisk + 536, 558, + // Long sector sizes for 512-byte magneto-opticals + 600, 610, 630 + }) + { + testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, testSize, timeout, + out duration); if(!testSense && !dev.Error) { readLong16 = true; @@ -164,7 +176,8 @@ namespace DiscImageChef.Core.Devices break; } - testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, testSize, timeout, out duration); + testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, testSize, + timeout, out duration); if(!testSense && !dev.Error) { readLong10 = true; @@ -176,13 +189,16 @@ namespace DiscImageChef.Core.Devices } else if(blockSize == 1024) { - foreach(ushort testSize in new[] { - // Long sector sizes for floppies - 1026, - // Long sector sizes for 1024-byte magneto-opticals - 1200 }) + foreach(ushort testSize in new[] { - testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, testSize, timeout, out duration); + // Long sector sizes for floppies + 1026, + // Long sector sizes for 1024-byte magneto-opticals + 1200 + }) + { + testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, testSize, timeout, + out duration); if(!testSense && !dev.Error) { readLong16 = true; @@ -191,7 +207,8 @@ namespace DiscImageChef.Core.Devices break; } - testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, testSize, timeout, out duration); + testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, testSize, + timeout, out duration); if(!testSense && !dev.Error) { readLong10 = true; @@ -203,7 +220,8 @@ namespace DiscImageChef.Core.Devices } else if(blockSize == 2048) { - testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 2380, timeout, out duration); + testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 2380, timeout, + out duration); if(!testSense && !dev.Error) { readLong16 = true; @@ -212,7 +230,8 @@ namespace DiscImageChef.Core.Devices } else { - testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, 2380, timeout, out duration); + testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, 2380, timeout, + out duration); if(!testSense && !dev.Error) { readLong10 = true; @@ -223,7 +242,8 @@ namespace DiscImageChef.Core.Devices } else if(blockSize == 4096) { - testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 4760, timeout, out duration); + testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 4760, timeout, + out duration); if(!testSense && !dev.Error) { readLong16 = true; @@ -232,7 +252,8 @@ namespace DiscImageChef.Core.Devices } else { - testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, 4760, timeout, out duration); + testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, 4760, timeout, + out duration); if(!testSense && !dev.Error) { readLong10 = true; @@ -243,7 +264,8 @@ namespace DiscImageChef.Core.Devices } else if(blockSize == 8192) { - testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 9424, timeout, out duration); + testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 9424, timeout, + out duration); if(!testSense && !dev.Error) { readLong16 = true; @@ -252,7 +274,8 @@ namespace DiscImageChef.Core.Devices } else { - testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, 9424, timeout, out duration); + testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, 9424, timeout, + out duration); if(!testSense && !dev.Error) { readLong10 = true; @@ -265,38 +288,44 @@ namespace DiscImageChef.Core.Devices if(!readRaw && dev.Manufacturer == "SYQUEST") { - testSense = dev.SyQuestReadLong10(out readBuffer, out senseBuf, 0, 0xFFFF, timeout, out duration); + testSense = dev.SyQuestReadLong10(out readBuffer, out senseBuf, 0, 0xFFFF, timeout, + out duration); if(testSense) { decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf); if(decSense.HasValue) { if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest && - decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) + decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) { readRaw = true; if(decSense.Value.InformationValid && decSense.Value.ILI) { longBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); - syqReadLong10 = !dev.SyQuestReadLong10(out readBuffer, out senseBuf, 0, longBlockSize, timeout, out duration); + syqReadLong10 = + !dev.SyQuestReadLong10(out readBuffer, out senseBuf, 0, longBlockSize, + timeout, out duration); } } else { - testSense = dev.SyQuestReadLong6(out readBuffer, out senseBuf, 0, 0xFFFF, timeout, out duration); + testSense = dev.SyQuestReadLong6(out readBuffer, out senseBuf, 0, 0xFFFF, timeout, + out duration); if(testSense) { decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf); if(decSense.HasValue) { if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest && - decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) + decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) { readRaw = true; if(decSense.Value.InformationValid && decSense.Value.ILI) { longBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); - syqReadLong6 = !dev.SyQuestReadLong6(out readBuffer, out senseBuf, 0, longBlockSize, timeout, out duration); + syqReadLong6 = + !dev.SyQuestReadLong6(out readBuffer, out senseBuf, 0, + longBlockSize, timeout, out duration); } } } @@ -307,7 +336,8 @@ namespace DiscImageChef.Core.Devices if(!readRaw && blockSize == 256) { - testSense = dev.SyQuestReadLong6(out readBuffer, out senseBuf, 0, 262, timeout, out duration); + testSense = dev.SyQuestReadLong6(out readBuffer, out senseBuf, 0, 262, timeout, + out duration); if(!testSense && !dev.Error) { syqReadLong6 = true; @@ -320,10 +350,12 @@ namespace DiscImageChef.Core.Devices else { if(dev.Manufacturer == "HL-DT-ST") - hldtstReadRaw = !dev.HlDtStReadRawDvd(out readBuffer, out senseBuf, 0, 1, timeout, out duration); + hldtstReadRaw = + !dev.HlDtStReadRawDvd(out readBuffer, out senseBuf, 0, 1, timeout, out duration); if(dev.Manufacturer == "PLEXTOR") - plextorReadRaw = !dev.PlextorReadRawDvd(out readBuffer, out senseBuf, 0, 1, timeout, out duration); + plextorReadRaw = + !dev.PlextorReadRawDvd(out readBuffer, out senseBuf, 0, 1, timeout, out duration); if(hldtstReadRaw || plextorReadRaw) { @@ -334,7 +366,8 @@ namespace DiscImageChef.Core.Devices // READ LONG (10) for some DVD drives if(!readRaw && dev.Manufacturer == "MATSHITA") { - testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, 37856, timeout, out duration); + testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, 37856, timeout, + out duration); if(!testSense && !dev.Error) { readLongDvd = true; @@ -347,27 +380,17 @@ namespace DiscImageChef.Core.Devices if(readRaw) { - if(readLong16) - DicConsole.WriteLine("Using SCSI READ LONG (16) command."); - else if(readLong10 || readLongDvd) - DicConsole.WriteLine("Using SCSI READ LONG (10) command."); - else if(syqReadLong10) - DicConsole.WriteLine("Using SyQuest READ LONG (10) command."); - else if(syqReadLong6) - DicConsole.WriteLine("Using SyQuest READ LONG (6) command."); - else if(hldtstReadRaw) - DicConsole.WriteLine("Using HL-DT-ST raw DVD reading."); - else if(plextorReadRaw) - DicConsole.WriteLine("Using Plextor raw DVD reading."); + if(readLong16) DicConsole.WriteLine("Using SCSI READ LONG (16) command."); + else if(readLong10 || readLongDvd) DicConsole.WriteLine("Using SCSI READ LONG (10) command."); + else if(syqReadLong10) DicConsole.WriteLine("Using SyQuest READ LONG (10) command."); + else if(syqReadLong6) DicConsole.WriteLine("Using SyQuest READ LONG (6) command."); + else if(hldtstReadRaw) DicConsole.WriteLine("Using HL-DT-ST raw DVD reading."); + else if(plextorReadRaw) DicConsole.WriteLine("Using Plextor raw DVD reading."); } - else if(read16) - DicConsole.WriteLine("Using SCSI READ (16) command."); - else if(read12) - DicConsole.WriteLine("Using SCSI READ (12) command."); - else if(read10) - DicConsole.WriteLine("Using SCSI READ (10) command."); - else if(read6) - DicConsole.WriteLine("Using SCSI READ (6) command."); + else if(read16) DicConsole.WriteLine("Using SCSI READ (16) command."); + else if(read12) DicConsole.WriteLine("Using SCSI READ (12) command."); + else if(read10) DicConsole.WriteLine("Using SCSI READ (10) command."); + else if(read6) DicConsole.WriteLine("Using SCSI READ (6) command."); return false; } @@ -396,8 +419,8 @@ namespace DiscImageChef.Core.Devices // Not all MMC devices support READ CAPACITY, as they have READ TOC if(dev.SCSIType != Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) { - errorMessage = string.Format("Unable to get media capacity\n" + - "{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + errorMessage = string.Format("Unable to get media capacity\n" + "{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); return true; } @@ -431,31 +454,30 @@ namespace DiscImageChef.Core.Devices { if(read16) { - sense = dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, 0, blockSize, 0, blocksToRead, false, timeout, out duration); - if(dev.Error) - blocksToRead /= 2; + sense = dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, 0, blockSize, 0, + blocksToRead, false, timeout, out duration); + if(dev.Error) blocksToRead /= 2; } else if(read12) { - sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, 0, blockSize, 0, blocksToRead, false, timeout, out duration); - if(dev.Error) - blocksToRead /= 2; + sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, 0, blockSize, 0, + blocksToRead, false, timeout, out duration); + if(dev.Error) blocksToRead /= 2; } else if(read10) { - sense = dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, 0, blockSize, 0, (ushort)blocksToRead, timeout, out duration); - if(dev.Error) - blocksToRead /= 2; + sense = dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, 0, blockSize, 0, + (ushort)blocksToRead, timeout, out duration); + if(dev.Error) blocksToRead /= 2; } else if(read6) { - sense = dev.Read6(out readBuffer, out senseBuf, 0, blockSize, (byte)blocksToRead, timeout, out duration); - if(dev.Error) - blocksToRead /= 2; + sense = dev.Read6(out readBuffer, out senseBuf, 0, blockSize, (byte)blocksToRead, timeout, + out duration); + if(dev.Error) blocksToRead /= 2; } - if(!dev.Error || blocksToRead == 1) - break; + if(!dev.Error || blocksToRead == 1) break; } if(dev.Error) @@ -478,37 +500,46 @@ namespace DiscImageChef.Core.Devices if(readRaw) { if(readLong16) - sense = dev.ReadLong16(out buffer, out senseBuf, false, block, longBlockSize, timeout, out duration); + sense = dev.ReadLong16(out buffer, out senseBuf, false, block, longBlockSize, timeout, + out duration); else if(readLong10) - sense = dev.ReadLong10(out buffer, out senseBuf, false, false, (uint)block, (ushort)longBlockSize, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuf, false, false, (uint)block, (ushort)longBlockSize, + timeout, out duration); else if(syqReadLong10) - sense = dev.SyQuestReadLong10(out buffer, out senseBuf, (uint)block, longBlockSize, timeout, out duration); + sense = dev.SyQuestReadLong10(out buffer, out senseBuf, (uint)block, longBlockSize, timeout, + out duration); else if(syqReadLong6) - sense = dev.SyQuestReadLong6(out buffer, out senseBuf, (uint)block, longBlockSize, timeout, out duration); + sense = dev.SyQuestReadLong6(out buffer, out senseBuf, (uint)block, longBlockSize, timeout, + out duration); else if(hldtstReadRaw) - sense = dev.HlDtStReadRawDvd(out buffer, out senseBuf, (uint)block, longBlockSize, timeout, out duration); + sense = dev.HlDtStReadRawDvd(out buffer, out senseBuf, (uint)block, longBlockSize, timeout, + out duration); else if(plextorReadRaw) - sense = dev.PlextorReadRawDvd(out buffer, out senseBuf, (uint)block, longBlockSize, timeout, out duration); - else - return true; + sense = dev.PlextorReadRawDvd(out buffer, out senseBuf, (uint)block, longBlockSize, timeout, + out duration); + else return true; } else { if(read16) - sense = dev.Read16(out buffer, out senseBuf, 0, false, true, false, block, blockSize, 0, count, false, timeout, out duration); + sense = dev.Read16(out buffer, out senseBuf, 0, false, true, false, block, blockSize, 0, count, + false, timeout, out duration); else if(read12) - sense = dev.Read12(out buffer, out senseBuf, 0, false, false, false, false, (uint)block, blockSize, 0, count, false, timeout, out duration); + sense = dev.Read12(out buffer, out senseBuf, 0, false, false, false, false, (uint)block, blockSize, + 0, count, false, timeout, out duration); else if(read10) - sense = dev.Read10(out buffer, out senseBuf, 0, false, true, false, false, (uint)block, blockSize, 0, (ushort)count, timeout, out duration); + sense = dev.Read10(out buffer, out senseBuf, 0, false, true, false, false, (uint)block, blockSize, + 0, (ushort)count, timeout, out duration); else if(read6) - sense = dev.Read6(out buffer, out senseBuf, (uint)block, blockSize, (byte)count, timeout, out duration); - else - return true; + sense = dev.Read6(out buffer, out senseBuf, (uint)block, blockSize, (byte)count, timeout, + out duration); + else return true; } if(sense || dev.Error) { - DicConsole.DebugWriteLine("SCSI Reader", "READ error:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("SCSI Reader", "READ error:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); return true; } @@ -521,12 +552,10 @@ namespace DiscImageChef.Core.Devices bool sense = true; duration = 0; - if(seek6) - sense = dev.Seek6(out senseBuf, (uint)block, timeout, out duration); - else if(seek10) - sense = dev.Seek10(out senseBuf, (uint)block, timeout, out duration); + if(seek6) sense = dev.Seek6(out senseBuf, (uint)block, timeout, out duration); + else if(seek10) sense = dev.Seek10(out senseBuf, (uint)block, timeout, out duration); return sense; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Report/ATA.cs b/DiscImageChef.Core/Devices/Report/ATA.cs index 6fd0500b..34237d71 100644 --- a/DiscImageChef.Core/Devices/Report/ATA.cs +++ b/DiscImageChef.Core/Devices/Report/ATA.cs @@ -42,8 +42,7 @@ namespace DiscImageChef.Core.Devices.Report { public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable) { - if(report == null) - return; + if(report == null) return; Decoders.ATA.AtaErrorRegistersCHS errorRegs; byte[] buffer; @@ -51,14 +50,11 @@ namespace DiscImageChef.Core.Devices.Report uint timeout = 5; ConsoleKeyInfo pressedKey; - if(dev.IsUSB) - USB.Report(dev, ref report, debug, ref removable); + if(dev.IsUSB) USB.Report(dev, ref report, debug, ref removable); - if(dev.IsFireWire) - FireWire.Report(dev, ref report, debug, ref removable); + if(dev.IsFireWire) FireWire.Report(dev, ref report, debug, ref removable); - if(dev.IsPCMCIA) - PCMCIA.Report(dev, ref report, debug, ref removable); + if(dev.IsPCMCIA) PCMCIA.Report(dev, ref report, debug, ref removable); DicConsole.WriteLine("Querying ATA IDENTIFY..."); @@ -74,7 +70,8 @@ namespace DiscImageChef.Core.Devices.Report report.CompactFlashSpecified = true; removable = false; } - else if(!removable && ataId.GeneralConfiguration.HasFlag(Decoders.ATA.Identify.GeneralConfigurationBit.Removable)) + else if(!removable && + ataId.GeneralConfiguration.HasFlag(Decoders.ATA.Identify.GeneralConfigurationBit.Removable)) { pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) @@ -488,9 +485,8 @@ namespace DiscImageChef.Core.Devices.Report report.ATA.WRVSectorCountMode2 = ataId.WRVSectorCountMode2; report.ATA.WRVSectorCountMode2Specified = true; } - if(debug) - report.ATA.Identify = buffer; - + if(debug) report.ATA.Identify = buffer; + if(removable) { List mediaTests = new List(); @@ -549,14 +545,17 @@ namespace DiscImageChef.Core.Devices.Report mediaTest.BlocksSpecified = true; } - if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0) + if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && + ataId.CurrentSectorsPerTrack > 0) { mediaTest.CurrentCHS = new chsType(); mediaTest.CurrentCHS.Cylinders = ataId.CurrentCylinders; mediaTest.CurrentCHS.Heads = ataId.CurrentHeads; mediaTest.CurrentCHS.Sectors = ataId.CurrentSectorsPerTrack; if(mediaTest.Blocks == 0) - mediaTest.Blocks = (ulong)(ataId.CurrentCylinders * ataId.CurrentHeads * ataId.CurrentSectorsPerTrack); + mediaTest.Blocks = + (ulong)(ataId.CurrentCylinders * ataId.CurrentHeads * + ataId.CurrentSectorsPerTrack); mediaTest.BlocksSpecified = true; } @@ -576,8 +575,7 @@ namespace DiscImageChef.Core.Devices.Report mediaTest.BlocksSpecified = true; } - if(ataId.NominalRotationRate != 0x0000 && - ataId.NominalRotationRate != 0xFFFF) + if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF) { if(ataId.NominalRotationRate == 0x0001) { @@ -596,26 +594,24 @@ namespace DiscImageChef.Core.Devices.Report uint logicalsectorsize = 0; uint physicalsectorsize; if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && - (ataId.PhysLogSectorSize & 0x4000) == 0x4000) + (ataId.PhysLogSectorSize & 0x4000) == 0x4000) { if((ataId.PhysLogSectorSize & 0x1000) == 0x1000) { if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) logicalsectorsize = 512; - else - logicalsectorsize = ataId.LogicalSectorWords * 2; + else logicalsectorsize = ataId.LogicalSectorWords * 2; } - else - logicalsectorsize = 512; + else logicalsectorsize = 512; if((ataId.PhysLogSectorSize & 0x2000) == 0x2000) { #pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created - physicalsectorsize = (uint)(logicalsectorsize * (1 << ataId.PhysLogSectorSize & 0xF)); + physicalsectorsize = + (uint)(logicalsectorsize * (1 << ataId.PhysLogSectorSize & 0xF)); #pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created } - else - physicalsectorsize = logicalsectorsize; + else physicalsectorsize = logicalsectorsize; } else { @@ -631,7 +627,7 @@ namespace DiscImageChef.Core.Devices.Report mediaTest.PhysicalBlockSizeSpecified = true; if((ataId.LogicalAlignment & 0x8000) == 0x0000 && - (ataId.LogicalAlignment & 0x4000) == 0x4000) + (ataId.LogicalAlignment & 0x4000) == 0x4000) { mediaTest.LogicalAlignment = (ushort)(ataId.LogicalAlignment & 0x3FFF); mediaTest.LogicalAlignmentSpecified = true; @@ -644,15 +640,16 @@ namespace DiscImageChef.Core.Devices.Report mediaTest.LongBlockSizeSpecified = true; } - if(ataId.UnformattedBPS > logicalsectorsize && (!mediaTest.LongBlockSizeSpecified || mediaTest.LongBlockSize == 516)) + if(ataId.UnformattedBPS > logicalsectorsize && + (!mediaTest.LongBlockSizeSpecified || mediaTest.LongBlockSize == 516)) { mediaTest.LongBlockSize = ataId.UnformattedBPS; mediaTest.LongBlockSizeSpecified = true; } if(ataId.CommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MustBeSet) && - !ataId.CommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MustBeClear) && - ataId.EnabledCommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MediaSerial)) + !ataId.CommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MustBeClear) && + ataId.EnabledCommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MediaSerial)) { mediaTest.CanReadMediaSerial = true; mediaTest.CanReadMediaSerialSpecified = true; @@ -692,137 +689,213 @@ namespace DiscImageChef.Core.Devices.Report DicConsole.WriteLine("Trying READ SECTOR(S) in CHS mode..."); sense = dev.Read(out readBuf, out errorChs, false, 0, 0, 1, 1, timeout, out duration); - mediaTest.SupportsRead = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + mediaTest.SupportsRead = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && + readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectorschs", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readsectorschs", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in CHS mode..."); sense = dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, timeout, out duration); - mediaTest.SupportsReadRetry = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + mediaTest.SupportsReadRetry = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && + readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectorsretrychs", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readsectorsretrychs", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); DicConsole.WriteLine("Trying READ DMA in CHS mode..."); - sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, timeout, out duration); - mediaTest.SupportsReadDma = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, timeout, + out duration); + mediaTest.SupportsReadDma = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && + readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdmachs", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readdmachs", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); DicConsole.WriteLine("Trying READ DMA RETRY in CHS mode..."); sense = dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, timeout, out duration); - mediaTest.SupportsReadDmaRetry = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + mediaTest.SupportsReadDmaRetry = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && + readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdmaretrychs", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readdmaretrychs", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); DicConsole.WriteLine("Trying SEEK in CHS mode..."); sense = dev.Seek(out errorChs, 0, 0, 1, timeout, out duration); - mediaTest.SupportsSeek = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", - sense, errorChs.status, errorChs.error); - + mediaTest.SupportsSeek = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense, + errorChs.status, errorChs.error); DicConsole.WriteLine("Trying READ SECTOR(S) in LBA mode..."); sense = dev.Read(out readBuf, out errorLba, false, 0, 1, timeout, out duration); - mediaTest.SupportsReadLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + mediaTest.SupportsReadLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && + readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectors", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readsectors", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in LBA mode..."); sense = dev.Read(out readBuf, out errorLba, true, 0, 1, timeout, out duration); - mediaTest.SupportsReadRetryLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + mediaTest.SupportsReadRetryLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && + readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectorsretry", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readsectorsretry", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); DicConsole.WriteLine("Trying READ DMA in LBA mode..."); sense = dev.ReadDma(out readBuf, out errorLba, false, 0, 1, timeout, out duration); - mediaTest.SupportsReadDmaLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + mediaTest.SupportsReadDmaLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && + readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdma", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readdma", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode..."); sense = dev.ReadDma(out readBuf, out errorLba, true, 0, 1, timeout, out duration); - mediaTest.SupportsReadDmaRetryLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + mediaTest.SupportsReadDmaRetryLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && + readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdmaretry", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readdmaretry", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); DicConsole.WriteLine("Trying SEEK in LBA mode..."); sense = dev.Seek(out errorLba, 0, timeout, out duration); - mediaTest.SupportsSeekLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", - sense, errorChs.status, errorChs.error); - + mediaTest.SupportsSeekLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense, + errorChs.status, errorChs.error); DicConsole.WriteLine("Trying READ SECTOR(S) in LBA48 mode..."); sense = dev.Read(out readBuf, out errorLba48, 0, 1, timeout, out duration); - mediaTest.SupportsReadLba48 = (!sense && (errorLba48.status & 0x01) != 0x01 && errorLba48.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + mediaTest.SupportsReadLba48 = + (!sense && (errorLba48.status & 0x01) != 0x01 && errorLba48.error == 0 && + readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectors48", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readsectors48", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); DicConsole.WriteLine("Trying READ DMA in LBA48 mode..."); sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, timeout, out duration); - mediaTest.SupportsReadDmaLba48 = (!sense && (errorLba48.status & 0x01) != 0x01 && errorLba48.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + mediaTest.SupportsReadDmaLba48 = + (!sense && (errorLba48.status & 0x01) != 0x01 && errorLba48.error == 0 && + readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdma48", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); - + DataFile.WriteTo("ATA Report", "readdma48", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); DicConsole.WriteLine("Trying READ LONG in CHS mode..."); - sense = dev.ReadLong(out readBuf, out errorChs, false, 0, 0, 1, mediaTest.LongBlockSize, timeout, out duration); - mediaTest.SupportsReadLong = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + sense = dev.ReadLong(out readBuf, out errorChs, false, 0, 0, 1, mediaTest.LongBlockSize, + timeout, out duration); + mediaTest.SupportsReadLong = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && + readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readlongchs", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readlongchs", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); DicConsole.WriteLine("Trying READ LONG RETRY in CHS mode..."); - sense = dev.ReadLong(out readBuf, out errorChs, true, 0, 0, 1, mediaTest.LongBlockSize, timeout, out duration); - mediaTest.SupportsReadLongRetry = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + sense = dev.ReadLong(out readBuf, out errorChs, true, 0, 0, 1, mediaTest.LongBlockSize, + timeout, out duration); + mediaTest.SupportsReadLongRetry = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && + readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readlongretrychs", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readlongretrychs", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); DicConsole.WriteLine("Trying READ LONG in LBA mode..."); - sense = dev.ReadLong(out readBuf, out errorLba, false, 0, mediaTest.LongBlockSize, timeout, out duration); - mediaTest.SupportsReadLongLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + sense = dev.ReadLong(out readBuf, out errorLba, false, 0, mediaTest.LongBlockSize, + timeout, out duration); + mediaTest.SupportsReadLongLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && + readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readlong", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readlong", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); DicConsole.WriteLine("Trying READ LONG RETRY in LBA mode..."); - sense = dev.ReadLong(out readBuf, out errorLba, true, 0, mediaTest.LongBlockSize, timeout, out duration); - mediaTest.SupportsReadLongRetryLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", + sense = dev.ReadLong(out readBuf, out errorLba, true, 0, mediaTest.LongBlockSize, + timeout, out duration); + mediaTest.SupportsReadLongRetryLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && + readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readlongretry", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readlongretry", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + readBuf); } - else - mediaTest.MediaIsRecognized = false; + else mediaTest.MediaIsRecognized = false; mediaTests.Add(mediaTest); } } + report.ATA.RemovableMedias = mediaTests.ToArray(); } else @@ -846,7 +919,8 @@ namespace DiscImageChef.Core.Devices.Report report.ATA.ReadCapabilities.CHS.Cylinders = ataId.Cylinders; report.ATA.ReadCapabilities.CHS.Heads = ataId.Heads; report.ATA.ReadCapabilities.CHS.Sectors = ataId.SectorsPerTrack; - report.ATA.ReadCapabilities.Blocks = (ulong)(ataId.Cylinders * ataId.Heads * ataId.SectorsPerTrack); + report.ATA.ReadCapabilities.Blocks = + (ulong)(ataId.Cylinders * ataId.Heads * ataId.SectorsPerTrack); report.ATA.ReadCapabilities.BlocksSpecified = true; } @@ -856,7 +930,8 @@ namespace DiscImageChef.Core.Devices.Report report.ATA.ReadCapabilities.CurrentCHS.Cylinders = ataId.CurrentCylinders; report.ATA.ReadCapabilities.CurrentCHS.Heads = ataId.CurrentHeads; report.ATA.ReadCapabilities.CurrentCHS.Sectors = ataId.CurrentSectorsPerTrack; - report.ATA.ReadCapabilities.Blocks = (ulong)(ataId.CurrentCylinders * ataId.CurrentHeads * ataId.CurrentSectorsPerTrack); + report.ATA.ReadCapabilities.Blocks = + (ulong)(ataId.CurrentCylinders * ataId.CurrentHeads * ataId.CurrentSectorsPerTrack); report.ATA.ReadCapabilities.BlocksSpecified = true; } @@ -876,8 +951,7 @@ namespace DiscImageChef.Core.Devices.Report report.ATA.ReadCapabilities.BlocksSpecified = true; } - if(ataId.NominalRotationRate != 0x0000 && - ataId.NominalRotationRate != 0xFFFF) + if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF) { if(ataId.NominalRotationRate == 0x0001) { @@ -895,27 +969,24 @@ namespace DiscImageChef.Core.Devices.Report uint logicalsectorsize = 0; uint physicalsectorsize; - if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && - (ataId.PhysLogSectorSize & 0x4000) == 0x4000) + if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000) { if((ataId.PhysLogSectorSize & 0x1000) == 0x1000) { if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) logicalsectorsize = 512; - else - logicalsectorsize = ataId.LogicalSectorWords * 2; + else logicalsectorsize = ataId.LogicalSectorWords * 2; } - else - logicalsectorsize = 512; + else logicalsectorsize = 512; if((ataId.PhysLogSectorSize & 0x2000) == 0x2000) { #pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created - physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, (double)(ataId.PhysLogSectorSize & 0xF)); + physicalsectorsize = logicalsectorsize * + (uint)Math.Pow(2, (double)(ataId.PhysLogSectorSize & 0xF)); #pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created } - else - physicalsectorsize = logicalsectorsize; + else physicalsectorsize = logicalsectorsize; } else { @@ -930,8 +1001,7 @@ namespace DiscImageChef.Core.Devices.Report report.ATA.ReadCapabilities.PhysicalBlockSize = physicalsectorsize; report.ATA.ReadCapabilities.PhysicalBlockSizeSpecified = true; - if((ataId.LogicalAlignment & 0x8000) == 0x0000 && - (ataId.LogicalAlignment & 0x4000) == 0x4000) + if((ataId.LogicalAlignment & 0x8000) == 0x0000 && (ataId.LogicalAlignment & 0x4000) == 0x4000) { report.ATA.ReadCapabilities.LogicalAlignment = (ushort)(ataId.LogicalAlignment & 0x3FFF); report.ATA.ReadCapabilities.LogicalAlignmentSpecified = true; @@ -944,15 +1014,17 @@ namespace DiscImageChef.Core.Devices.Report report.ATA.ReadCapabilities.LongBlockSizeSpecified = true; } - if(ataId.UnformattedBPS > logicalsectorsize && (!report.ATA.ReadCapabilities.LongBlockSizeSpecified || report.ATA.ReadCapabilities.LongBlockSize == 516)) + if(ataId.UnformattedBPS > logicalsectorsize && + (!report.ATA.ReadCapabilities.LongBlockSizeSpecified || + report.ATA.ReadCapabilities.LongBlockSize == 516)) { report.ATA.ReadCapabilities.LongBlockSize = ataId.UnformattedBPS; report.ATA.ReadCapabilities.LongBlockSizeSpecified = true; } if(ataId.CommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MustBeSet) && - !ataId.CommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MustBeClear) && - ataId.EnabledCommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MediaSerial)) + !ataId.CommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MustBeClear) && + ataId.EnabledCommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MediaSerial)) { report.ATA.ReadCapabilities.CanReadMediaSerial = true; report.ATA.ReadCapabilities.CanReadMediaSerialSpecified = true; @@ -992,129 +1064,181 @@ namespace DiscImageChef.Core.Devices.Report DicConsole.WriteLine("Trying READ SECTOR(S) in CHS mode..."); sense = dev.Read(out readBuf, out errorChs, false, 0, 0, 1, 1, timeout, out duration); - report.ATA.ReadCapabilities.SupportsRead = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorChs.status, errorChs.error, readBuf.Length); + report.ATA.ReadCapabilities.SupportsRead = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectorschs", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readsectorschs", "_debug_" + report.ATA.Model + ".bin", + "read results", readBuf); DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in CHS mode..."); sense = dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, timeout, out duration); - report.ATA.ReadCapabilities.SupportsReadRetry = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorChs.status, errorChs.error, readBuf.Length); + report.ATA.ReadCapabilities.SupportsReadRetry = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectorsretrychs", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); - + DataFile.WriteTo("ATA Report", "readsectorsretrychs", "_debug_" + report.ATA.Model + ".bin", + "read results", readBuf); + DicConsole.WriteLine("Trying READ DMA in CHS mode..."); sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, timeout, out duration); - report.ATA.ReadCapabilities.SupportsReadDma = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorChs.status, errorChs.error, readBuf.Length); + report.ATA.ReadCapabilities.SupportsReadDma = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdmachs", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); - + DataFile.WriteTo("ATA Report", "readdmachs", "_debug_" + report.ATA.Model + ".bin", + "read results", readBuf); + DicConsole.WriteLine("Trying READ DMA RETRY in CHS mode..."); sense = dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, timeout, out duration); - report.ATA.ReadCapabilities.SupportsReadDmaRetry = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorChs.status, errorChs.error, readBuf.Length); + report.ATA.ReadCapabilities.SupportsReadDmaRetry = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdmaretrychs", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); - + DataFile.WriteTo("ATA Report", "readdmaretrychs", "_debug_" + report.ATA.Model + ".bin", + "read results", readBuf); + DicConsole.WriteLine("Trying SEEK in CHS mode..."); sense = dev.Seek(out errorChs, 0, 0, 1, timeout, out duration); - report.ATA.ReadCapabilities.SupportsSeek = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", - sense, errorChs.status, errorChs.error); + report.ATA.ReadCapabilities.SupportsSeek = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0); + DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense, + errorChs.status, errorChs.error); DicConsole.WriteLine("Trying READ SECTOR(S) in LBA mode..."); sense = dev.Read(out readBuf, out errorLba, false, 0, 1, timeout, out duration); - report.ATA.ReadCapabilities.SupportsReadLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorLba.status, errorLba.error, readBuf.Length); + report.ATA.ReadCapabilities.SupportsReadLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorLba.status, errorLba.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectors", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); - + DataFile.WriteTo("ATA Report", "readsectors", "_debug_" + report.ATA.Model + ".bin", + "read results", readBuf); + DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in LBA mode..."); sense = dev.Read(out readBuf, out errorLba, true, 0, 1, timeout, out duration); - report.ATA.ReadCapabilities.SupportsReadRetryLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorLba.status, errorLba.error, readBuf.Length); + report.ATA.ReadCapabilities.SupportsReadRetryLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorLba.status, errorLba.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectorsretry", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); - + DataFile.WriteTo("ATA Report", "readsectorsretry", "_debug_" + report.ATA.Model + ".bin", + "read results", readBuf); + DicConsole.WriteLine("Trying READ DMA in LBA mode..."); sense = dev.ReadDma(out readBuf, out errorLba, false, 0, 1, timeout, out duration); - report.ATA.ReadCapabilities.SupportsReadDmaLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorLba.status, errorLba.error, readBuf.Length); + report.ATA.ReadCapabilities.SupportsReadDmaLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorLba.status, errorLba.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdma", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); - + DataFile.WriteTo("ATA Report", "readdma", "_debug_" + report.ATA.Model + ".bin", "read results", + readBuf); + DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode..."); sense = dev.ReadDma(out readBuf, out errorLba, true, 0, 1, timeout, out duration); - report.ATA.ReadCapabilities.SupportsReadDmaRetryLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorLba.status, errorLba.error, readBuf.Length); + report.ATA.ReadCapabilities.SupportsReadDmaRetryLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorLba.status, errorLba.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdmaretry", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); - + DataFile.WriteTo("ATA Report", "readdmaretry", "_debug_" + report.ATA.Model + ".bin", + "read results", readBuf); + DicConsole.WriteLine("Trying SEEK in LBA mode..."); sense = dev.Seek(out errorLba, 0, timeout, out duration); - report.ATA.ReadCapabilities.SupportsSeekLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", - sense, errorLba.status, errorLba.error); + report.ATA.ReadCapabilities.SupportsSeekLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0); + DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense, + errorLba.status, errorLba.error); DicConsole.WriteLine("Trying READ SECTOR(S) in LBA48 mode..."); sense = dev.Read(out readBuf, out errorLba48, 0, 1, timeout, out duration); - report.ATA.ReadCapabilities.SupportsReadLba48 = (!sense && (errorLba48.status & 0x01) != 0x01 && errorLba48.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorLba48.status, errorLba48.error, readBuf.Length); + report.ATA.ReadCapabilities.SupportsReadLba48 = + (!sense && (errorLba48.status & 0x01) != 0x01 && errorLba48.error == 0 && readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorLba48.status, errorLba48.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectors48", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); - + DataFile.WriteTo("ATA Report", "readsectors48", "_debug_" + report.ATA.Model + ".bin", + "read results", readBuf); + DicConsole.WriteLine("Trying READ DMA in LBA48 mode..."); sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, timeout, out duration); - report.ATA.ReadCapabilities.SupportsReadDmaLba48 = (!sense && (errorLba48.status & 0x01) != 0x01 && errorLba48.error == 0 && readBuf.Length > 0); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorLba48.status, errorLba48.error, readBuf.Length); + report.ATA.ReadCapabilities.SupportsReadDmaLba48 = + (!sense && (errorLba48.status & 0x01) != 0x01 && errorLba48.error == 0 && readBuf.Length > 0); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorLba48.status, errorLba48.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdma48", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readdma48", "_debug_" + report.ATA.Model + ".bin", + "read results", readBuf); DicConsole.WriteLine("Trying READ LONG in CHS mode..."); - sense = dev.ReadLong(out readBuf, out errorChs, false, 0, 0, 1, report.ATA.ReadCapabilities.LongBlockSize, timeout, out duration); - report.ATA.ReadCapabilities.SupportsReadLong = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorChs.status, errorChs.error, readBuf.Length); + sense = dev.ReadLong(out readBuf, out errorChs, false, 0, 0, 1, + report.ATA.ReadCapabilities.LongBlockSize, timeout, out duration); + report.ATA.ReadCapabilities.SupportsReadLong = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0 && + BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readlongchs", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); - + DataFile.WriteTo("ATA Report", "readlongchs", "_debug_" + report.ATA.Model + ".bin", + "read results", readBuf); + DicConsole.WriteLine("Trying READ LONG RETRY in CHS mode..."); - sense = dev.ReadLong(out readBuf, out errorChs, true, 0, 0, 1, report.ATA.ReadCapabilities.LongBlockSize, timeout, out duration); - report.ATA.ReadCapabilities.SupportsReadLongRetry = (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorChs.status, errorChs.error, readBuf.Length); + sense = dev.ReadLong(out readBuf, out errorChs, true, 0, 0, 1, + report.ATA.ReadCapabilities.LongBlockSize, timeout, out duration); + report.ATA.ReadCapabilities.SupportsReadLongRetry = + (!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0 && + BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorChs.status, errorChs.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readlongretrychs", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); - + DataFile.WriteTo("ATA Report", "readlongretrychs", "_debug_" + report.ATA.Model + ".bin", + "read results", readBuf); + DicConsole.WriteLine("Trying READ LONG in LBA mode..."); - sense = dev.ReadLong(out readBuf, out errorLba, false, 0, report.ATA.ReadCapabilities.LongBlockSize, timeout, out duration); - report.ATA.ReadCapabilities.SupportsReadLongLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorLba.status, errorLba.error, readBuf.Length); + sense = dev.ReadLong(out readBuf, out errorLba, false, 0, report.ATA.ReadCapabilities.LongBlockSize, + timeout, out duration); + report.ATA.ReadCapabilities.SupportsReadLongLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0 && + BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorLba.status, errorLba.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readlong", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); - + DataFile.WriteTo("ATA Report", "readlong", "_debug_" + report.ATA.Model + ".bin", + "read results", readBuf); + DicConsole.WriteLine("Trying READ LONG RETRY in LBA mode..."); - sense = dev.ReadLong(out readBuf, out errorLba, true, 0, report.ATA.ReadCapabilities.LongBlockSize, timeout, out duration); - report.ATA.ReadCapabilities.SupportsReadLongRetryLba = (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); - DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", - sense, errorLba.status, errorLba.error, readBuf.Length); + sense = dev.ReadLong(out readBuf, out errorLba, true, 0, report.ATA.ReadCapabilities.LongBlockSize, + timeout, out duration); + report.ATA.ReadCapabilities.SupportsReadLongRetryLba = + (!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0 && + BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead); + DicConsole.DebugWriteLine("ATA Report", + "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, + errorLba.status, errorLba.error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readlongretry", "_debug_" + report.ATA.Model + ".bin", "read results", readBuf); + DataFile.WriteTo("ATA Report", "readlongretry", "_debug_" + report.ATA.Model + ".bin", + "read results", readBuf); } } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Report/ATAPI.cs b/DiscImageChef.Core/Devices/Report/ATAPI.cs index a72d2a1c..6de6d2c7 100644 --- a/DiscImageChef.Core/Devices/Report/ATAPI.cs +++ b/DiscImageChef.Core/Devices/Report/ATAPI.cs @@ -40,8 +40,7 @@ namespace DiscImageChef.Core.Devices.Report { public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable) { - if(report == null) - return; + if(report == null) return; byte[] buffer; double duration; @@ -453,9 +452,8 @@ namespace DiscImageChef.Core.Devices.Report report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2; report.ATAPI.WRVSectorCountMode2Specified = true; } - if(debug) - report.ATAPI.Identify = buffer; + if(debug) report.ATAPI.Identify = buffer; } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Report/FireWire.cs b/DiscImageChef.Core/Devices/Report/FireWire.cs index d5f12a07..aff3e5e3 100644 --- a/DiscImageChef.Core/Devices/Report/FireWire.cs +++ b/DiscImageChef.Core/Devices/Report/FireWire.cs @@ -41,8 +41,7 @@ namespace DiscImageChef.Core.Devices.Report { public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable) { - if(report == null) - return; + if(report == null) return; ConsoleKeyInfo pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) @@ -73,4 +72,4 @@ namespace DiscImageChef.Core.Devices.Report } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Report/NVMe.cs b/DiscImageChef.Core/Devices/Report/NVMe.cs index a64b0e33..c4ff8cc0 100644 --- a/DiscImageChef.Core/Devices/Report/NVMe.cs +++ b/DiscImageChef.Core/Devices/Report/NVMe.cs @@ -40,10 +40,9 @@ namespace DiscImageChef.Core.Devices.Report { public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable) { - if(report == null) - return; + if(report == null) return; throw new NotImplementedException("NVMe devices not yet supported."); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Report/PCMCIA.cs b/DiscImageChef.Core/Devices/Report/PCMCIA.cs index c87dd9ef..0fa675da 100644 --- a/DiscImageChef.Core/Devices/Report/PCMCIA.cs +++ b/DiscImageChef.Core/Devices/Report/PCMCIA.cs @@ -75,4 +75,4 @@ namespace DiscImageChef.Core.Devices.Report } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Report/SCSI/General.cs b/DiscImageChef.Core/Devices/Report/SCSI/General.cs index d7b3c80d..de895415 100644 --- a/DiscImageChef.Core/Devices/Report/SCSI/General.cs +++ b/DiscImageChef.Core/Devices/Report/SCSI/General.cs @@ -43,8 +43,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable) { - if(report == null) - return; + if(report == null) return; byte[] senseBuffer; byte[] buffer; @@ -53,14 +52,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI uint timeout = 5; ConsoleKeyInfo pressedKey; - if(dev.IsUSB) - USB.Report(dev, ref report, debug, ref removable); + if(dev.IsUSB) USB.Report(dev, ref report, debug, ref removable); - if(dev.IsFireWire) - FireWire.Report(dev, ref report, debug, ref removable); + if(dev.IsFireWire) FireWire.Report(dev, ref report, debug, ref removable); - if(dev.IsPCMCIA) - PCMCIA.Report(dev, ref report, debug, ref removable); + if(dev.IsPCMCIA) PCMCIA.Report(dev, ref report, debug, ref removable); if(!dev.IsUSB && !dev.IsFireWire && dev.IsRemovable) { @@ -75,8 +71,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI removable = pressedKey.Key == ConsoleKey.Y; } - if(dev.Type == DeviceType.ATAPI) - ATAPI.Report(dev, ref report, debug, ref removable); + if(dev.Type == DeviceType.ATAPI) ATAPI.Report(dev, ref report, debug, ref removable); DicConsole.WriteLine("Querying SCSI INQUIRY..."); sense = dev.ScsiInquiry(out buffer, out senseBuffer); @@ -117,19 +112,22 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.VendorIdentification))) { - report.SCSI.Inquiry.VendorIdentification = StringHandlers.CToString(inq.VendorIdentification).Trim(); + report.SCSI.Inquiry.VendorIdentification = + StringHandlers.CToString(inq.VendorIdentification).Trim(); if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.VendorIdentification)) report.SCSI.Inquiry.VendorIdentificationSpecified = true; } if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductIdentification))) { - report.SCSI.Inquiry.ProductIdentification = StringHandlers.CToString(inq.ProductIdentification).Trim(); + report.SCSI.Inquiry.ProductIdentification = + StringHandlers.CToString(inq.ProductIdentification).Trim(); if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductIdentification)) report.SCSI.Inquiry.ProductIdentificationSpecified = true; } if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductRevisionLevel))) { - report.SCSI.Inquiry.ProductRevisionLevel = StringHandlers.CToString(inq.ProductRevisionLevel).Trim(); + report.SCSI.Inquiry.ProductRevisionLevel = + StringHandlers.CToString(inq.ProductRevisionLevel).Trim(); if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductRevisionLevel)) report.SCSI.Inquiry.ProductRevisionLevelSpecified = true; } @@ -137,8 +135,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { foreach(ushort descriptor in inq.VersionDescriptors) { - if(descriptor != 0) - versionDescriptors.Add(descriptor); + if(descriptor != 0) versionDescriptors.Add(descriptor); } if(versionDescriptors.Count > 0) @@ -146,7 +143,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } report.SCSI.Inquiry.PeripheralQualifier = (Decoders.SCSI.PeripheralQualifiers)inq.PeripheralQualifier; - report.SCSI.Inquiry.PeripheralDeviceType = (Decoders.SCSI.PeripheralDeviceTypes)inq.PeripheralDeviceType; + report.SCSI.Inquiry.PeripheralDeviceType = + (Decoders.SCSI.PeripheralDeviceTypes)inq.PeripheralDeviceType; report.SCSI.Inquiry.AsymmetricalLUNAccess = (Decoders.SCSI.TGPSValues)inq.TPGS; report.SCSI.Inquiry.SPIClocking = (Decoders.SCSI.SPIClocking)inq.Clocking; @@ -177,8 +175,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.Inquiry.WideBus16 = inq.WBus16; report.SCSI.Inquiry.WideBus32 = inq.WBus32; - if(debug) - report.SCSI.Inquiry.Data = buffer; + if(debug) report.SCSI.Inquiry.Data = buffer; } DicConsole.WriteLine("Querying list of SCSI EVPDs..."); @@ -205,8 +202,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } } } - if(evpds.Count > 0) - report.SCSI.EVPDPages = evpds.ToArray(); + + if(evpds.Count > 0) report.SCSI.EVPDPages = evpds.ToArray(); } } @@ -231,11 +228,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Decoders.SCSI.PeripheralDeviceTypes devType = dev.SCSIType; DicConsole.WriteLine("Querying all mode pages and subpages using SCSI MODE SENSE (10)..."); - sense = dev.ModeSense10(out byte[] mode10Buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Default, 0x3F, 0xFF, timeout, out duration); + sense = dev.ModeSense10(out byte[] mode10Buffer, out senseBuffer, false, true, + ScsiModeSensePageControl.Default, 0x3F, 0xFF, timeout, out duration); if(sense || dev.Error) { DicConsole.WriteLine("Querying all mode pages using SCSI MODE SENSE (10)..."); - sense = dev.ModeSense10(out mode10Buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Default, 0x3F, 0x00, timeout, out duration); + sense = dev.ModeSense10(out mode10Buffer, out senseBuffer, false, true, + ScsiModeSensePageControl.Default, 0x3F, 0x00, timeout, out duration); if(!sense && !dev.Error) { report.SCSI.SupportsModeSense10 = true; @@ -251,19 +250,20 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } DicConsole.WriteLine("Querying all mode pages and subpages using SCSI MODE SENSE (6)..."); - sense = dev.ModeSense6(out byte[] mode6Buffer, out senseBuffer, false, ScsiModeSensePageControl.Default, 0x3F, 0xFF, timeout, out duration); + sense = dev.ModeSense6(out byte[] mode6Buffer, out senseBuffer, false, ScsiModeSensePageControl.Default, + 0x3F, 0xFF, timeout, out duration); if(sense || dev.Error) { DicConsole.WriteLine("Querying all mode pages using SCSI MODE SENSE (6)..."); - sense = dev.ModeSense6(out mode6Buffer, out senseBuffer, false, ScsiModeSensePageControl.Default, 0x3F, 0x00, timeout, out duration); + sense = dev.ModeSense6(out mode6Buffer, out senseBuffer, false, ScsiModeSensePageControl.Default, 0x3F, + 0x00, timeout, out duration); if(sense || dev.Error) { DicConsole.WriteLine("Querying SCSI MODE SENSE (6)..."); sense = dev.ModeSense(out mode6Buffer, out senseBuffer, timeout, out duration); } } - else - report.SCSI.SupportsModeSubpages = true; + else report.SCSI.SupportsModeSubpages = true; if(!sense && !dev.Error && !decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(mode6Buffer, devType); @@ -272,10 +272,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Decoders.SCSI.Modes.ModePage_2A? cdromMode = null; - if(debug && report.SCSI.SupportsModeSense6) - report.SCSI.ModeSense6Data = mode6Buffer; - if(debug && report.SCSI.SupportsModeSense10) - report.SCSI.ModeSense10Data = mode10Buffer; + if(debug && report.SCSI.SupportsModeSense6) report.SCSI.ModeSense6Data = mode6Buffer; + if(debug && report.SCSI.SupportsModeSense10) report.SCSI.ModeSense10Data = mode10Buffer; if(decMode.HasValue) { @@ -313,8 +311,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } } - if(modePages.Count > 0) - report.SCSI.ModeSense.ModePages = modePages.ToArray(); + if(modePages.Count > 0) report.SCSI.ModeSense.ModePages = modePages.ToArray(); } } @@ -372,8 +369,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.Write("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if(!sense) - break; + if(!sense) break; leftRetries--; } @@ -388,19 +384,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.Write("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if(!sense) - break; + if(!sense) break; leftRetries--; } mediaTest.MediaIsRecognized &= !sense; } - else - mediaTest.MediaIsRecognized = false; + else mediaTest.MediaIsRecognized = false; } - else - mediaTest.MediaIsRecognized = false; + else mediaTest.MediaIsRecognized = false; } if(mediaTest.MediaIsRecognized) @@ -413,8 +406,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!sense && !dev.Error) { mediaTest.SupportsReadCapacity = true; - mediaTest.Blocks = (ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + (buffer[3])) + 1; - mediaTest.BlockSize = (uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + (buffer[7])); + mediaTest.Blocks = + (ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + + (buffer[3])) + 1; + mediaTest.BlockSize = + (uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + (buffer[7])); mediaTest.BlocksSpecified = true; mediaTest.BlockSizeSpecified = true; } @@ -428,7 +424,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Array.Copy(buffer, 0, temp, 0, 8); Array.Reverse(temp); mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1; - mediaTest.BlockSize = (uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + (buffer[11])); + mediaTest.BlockSize = + (uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + + (buffer[11])); mediaTest.BlocksSpecified = true; mediaTest.BlockSizeSpecified = true; } @@ -436,13 +434,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI decMode = null; DicConsole.WriteLine("Querying SCSI MODE SENSE (10)..."); - sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration); + sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, + ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, + out duration); if(!sense && !dev.Error) { report.SCSI.SupportsModeSense10 = true; decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType); - if(debug) - mediaTest.ModeSense10Data = buffer; + if(debug) mediaTest.ModeSense10Data = buffer; } DicConsole.WriteLine("Querying SCSI MODE SENSE..."); @@ -452,15 +451,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.SupportsModeSense6 = true; if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType); - if(debug) - mediaTest.ModeSense6Data = buffer; + if(debug) mediaTest.ModeSense6Data = buffer; } if(decMode.HasValue) { mediaTest.MediumType = (byte)decMode.Value.Header.MediumType; mediaTest.MediumTypeSpecified = true; - if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) + if(decMode.Value.Header.BlockDescriptors != null && + decMode.Value.Header.BlockDescriptors.Length > 0) { mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; mediaTest.DensitySpecified = true; @@ -474,44 +473,61 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaTest.SupportsReadLongSpecified = true; DicConsole.WriteLine("Trying SCSI READ (6)..."); - mediaTest.SupportsRead = !dev.Read6(out buffer, out senseBuffer, 0, mediaTest.BlockSize, timeout, out duration); + mediaTest.SupportsRead = !dev.Read6(out buffer, out senseBuffer, 0, mediaTest.BlockSize, + timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead); if(debug) - DataFile.WriteTo("SCSI Report", "read6", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "read6", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + buffer); DicConsole.WriteLine("Trying SCSI READ (10)..."); - mediaTest.SupportsRead10 = !dev.Read10(out buffer, out senseBuffer, 0, false, true, false, false, 0, mediaTest.BlockSize, 0, 1, timeout, out duration); + mediaTest.SupportsRead10 = + !dev.Read10(out buffer, out senseBuffer, 0, false, true, false, false, 0, + mediaTest.BlockSize, 0, 1, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead10); if(debug) - DataFile.WriteTo("SCSI Report", "read10", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "read10", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + buffer); DicConsole.WriteLine("Trying SCSI READ (12)..."); - mediaTest.SupportsRead12 = !dev.Read12(out buffer, out senseBuffer, 0, false, true, false, false, 0, mediaTest.BlockSize, 0, 1, false, timeout, out duration); + mediaTest.SupportsRead12 = + !dev.Read12(out buffer, out senseBuffer, 0, false, true, false, false, 0, + mediaTest.BlockSize, 0, 1, false, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead12); if(debug) - DataFile.WriteTo("SCSI Report", "read12", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "read12", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + buffer); DicConsole.WriteLine("Trying SCSI READ (16)..."); - mediaTest.SupportsRead16 = !dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0, mediaTest.BlockSize, 0, 1, false, timeout, out duration); + mediaTest.SupportsRead16 = + !dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0, + mediaTest.BlockSize, 0, 1, false, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead16); if(debug) - DataFile.WriteTo("SCSI Report", "read16", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "read16", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + buffer); mediaTest.LongBlockSize = mediaTest.BlockSize; DicConsole.WriteLine("Trying SCSI READ LONG (10)..."); - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 0xFFFF, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 0xFFFF, timeout, + out duration); if(sense && !dev.Error) { Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer); if(decSense.HasValue) { if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest && - decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) + decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) { mediaTest.SupportsReadLong = true; if(decSense.Value.InformationValid && decSense.Value.ILI) { - mediaTest.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); + mediaTest.LongBlockSize = + 0xFFFF - (decSense.Value.Information & 0xFFFF); mediaTest.LongBlockSizeSpecified = true; } } @@ -522,15 +538,18 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { if(mediaTest.BlockSize == 512) { - foreach(ushort testSize in new[] { + foreach(ushort testSize in new[] + { // Long sector sizes for floppies 514, // Long sector sizes for SuperDisk 536, 558, // Long sector sizes for 512-byte magneto-opticals - 600, 610, 630 }) + 600, 610, 630 + }) { - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, + testSize, timeout, out duration); if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; @@ -542,13 +561,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } else if(mediaTest.BlockSize == 1024) { - foreach(ushort testSize in new[] { + foreach(ushort testSize in new[] + { // Long sector sizes for floppies 1026, // Long sector sizes for 1024-byte magneto-opticals - 1200 }) + 1200 + }) { - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, + testSize, timeout, out duration); if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; @@ -560,7 +582,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } else if(mediaTest.BlockSize == 2048) { - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380, + timeout, out duration); if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; @@ -570,7 +593,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } else if(mediaTest.BlockSize == 4096) { - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760, + timeout, out duration); if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; @@ -580,7 +604,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } else if(mediaTest.BlockSize == 8192) { - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424, + timeout, out duration); if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; @@ -595,7 +620,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { - DicConsole.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): "); + DicConsole + .Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } @@ -605,7 +631,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI for(ushort i = (ushort)mediaTest.BlockSize; i <= ushort.MaxValue; i++) { DicConsole.Write("\rTrying to READ LONG with a size of {0} bytes...", i); - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i, + timeout, out duration); if(!sense) { mediaTest.LongBlockSize = i; @@ -613,27 +640,34 @@ namespace DiscImageChef.Core.Devices.Report.SCSI break; } - if(i == ushort.MaxValue) - break; + if(i == ushort.MaxValue) break; } + DicConsole.WriteLine(); } } - if(debug && mediaTest.SupportsReadLong && mediaTest.LongBlockSizeSpecified && mediaTest.LongBlockSize != mediaTest.BlockSize) + if(debug && mediaTest.SupportsReadLong && mediaTest.LongBlockSizeSpecified && + mediaTest.LongBlockSize != mediaTest.BlockSize) { - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, (ushort)mediaTest.LongBlockSize, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, + (ushort)mediaTest.LongBlockSize, timeout, out duration); if(!sense) - DataFile.WriteTo("SCSI Report", "readlong10", "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readlong10", + "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", + buffer); } mediaTest.CanReadMediaSerialSpecified = true; DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER..."); - mediaTest.CanReadMediaSerial = !dev.ReadMediaSerialNumber(out buffer, out senseBuffer, timeout, out duration); + mediaTest.CanReadMediaSerial = + !dev.ReadMediaSerialNumber(out buffer, out senseBuffer, timeout, out duration); } + mediaTests.Add(mediaTest); } } + report.SCSI.RemovableMedias = mediaTests.ToArray(); } else @@ -650,8 +684,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!sense && !dev.Error) { report.SCSI.ReadCapabilities.SupportsReadCapacity = true; - report.SCSI.ReadCapabilities.Blocks = (ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + (buffer[3])) + 1; - report.SCSI.ReadCapabilities.BlockSize = (uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + (buffer[7])); + report.SCSI.ReadCapabilities.Blocks = + (ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + (buffer[3])) + 1; + report.SCSI.ReadCapabilities.BlockSize = + (uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + (buffer[7])); report.SCSI.ReadCapabilities.BlocksSpecified = true; report.SCSI.ReadCapabilities.BlockSizeSpecified = true; } @@ -665,7 +701,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Array.Copy(buffer, 0, temp, 0, 8); Array.Reverse(temp); report.SCSI.ReadCapabilities.Blocks = BitConverter.ToUInt64(temp, 0) + 1; - report.SCSI.ReadCapabilities.BlockSize = (uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + (buffer[11])); + report.SCSI.ReadCapabilities.BlockSize = + (uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + (buffer[11])); report.SCSI.ReadCapabilities.BlocksSpecified = true; report.SCSI.ReadCapabilities.BlockSizeSpecified = true; } @@ -673,13 +710,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI decMode = null; DicConsole.WriteLine("Querying SCSI MODE SENSE (10)..."); - sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration); + sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Current, + 0x3F, 0x00, timeout, out duration); if(!sense && !dev.Error) { report.SCSI.SupportsModeSense10 = true; decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType); - if(debug) - report.SCSI.ReadCapabilities.ModeSense10Data = buffer; + if(debug) report.SCSI.ReadCapabilities.ModeSense10Data = buffer; } DicConsole.WriteLine("Querying SCSI MODE SENSE..."); @@ -687,19 +724,19 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!sense && !dev.Error) { report.SCSI.SupportsModeSense6 = true; - if(!decMode.HasValue) - decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType); - if(debug) - report.SCSI.ReadCapabilities.ModeSense6Data = buffer; + if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType); + if(debug) report.SCSI.ReadCapabilities.ModeSense6Data = buffer; } if(decMode.HasValue) { report.SCSI.ReadCapabilities.MediumType = (byte)decMode.Value.Header.MediumType; report.SCSI.ReadCapabilities.MediumTypeSpecified = true; - if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) + if(decMode.Value.Header.BlockDescriptors != null && + decMode.Value.Header.BlockDescriptors.Length > 0) { - report.SCSI.ReadCapabilities.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; + report.SCSI.ReadCapabilities.Density = + (byte)decMode.Value.Header.BlockDescriptors[0].Density; report.SCSI.ReadCapabilities.DensitySpecified = true; } } @@ -711,28 +748,47 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.ReadCapabilities.SupportsReadLongSpecified = true; DicConsole.WriteLine("Trying SCSI READ (6)..."); - report.SCSI.ReadCapabilities.SupportsRead = !dev.Read6(out buffer, out senseBuffer, 0, report.SCSI.ReadCapabilities.BlockSize, timeout, out duration); + report.SCSI.ReadCapabilities.SupportsRead = !dev.Read6(out buffer, out senseBuffer, 0, + report.SCSI.ReadCapabilities.BlockSize, + timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !report.SCSI.ReadCapabilities.SupportsRead); if(debug) - DataFile.WriteTo("SCSI Report", "read6", "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", "read results", buffer); - + DataFile.WriteTo("SCSI Report", "read6", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", "read results", + buffer); + DicConsole.WriteLine("Trying SCSI READ (10)..."); - report.SCSI.ReadCapabilities.SupportsRead10 = !dev.Read10(out buffer, out senseBuffer, 0, false, true, false, false, 0, report.SCSI.ReadCapabilities.BlockSize, 0, 1, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !report.SCSI.ReadCapabilities.SupportsRead10); + report.SCSI.ReadCapabilities.SupportsRead10 = + !dev.Read10(out buffer, out senseBuffer, 0, false, true, false, false, 0, + report.SCSI.ReadCapabilities.BlockSize, 0, 1, timeout, out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !report.SCSI.ReadCapabilities.SupportsRead10); if(debug) - DataFile.WriteTo("SCSI Report", "read10", "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "read10", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", "read results", + buffer); DicConsole.WriteLine("Trying SCSI READ (12)..."); - report.SCSI.ReadCapabilities.SupportsRead12 = !dev.Read12(out buffer, out senseBuffer, 0, false, true, false, false, 0, report.SCSI.ReadCapabilities.BlockSize, 0, 1, false, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !report.SCSI.ReadCapabilities.SupportsRead12); + report.SCSI.ReadCapabilities.SupportsRead12 = + !dev.Read12(out buffer, out senseBuffer, 0, false, true, false, false, 0, + report.SCSI.ReadCapabilities.BlockSize, 0, 1, false, timeout, out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !report.SCSI.ReadCapabilities.SupportsRead12); if(debug) - DataFile.WriteTo("SCSI Report", "read12", "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "read12", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", "read results", + buffer); DicConsole.WriteLine("Trying SCSI READ (16)..."); - report.SCSI.ReadCapabilities.SupportsRead16 = !dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0, report.SCSI.ReadCapabilities.BlockSize, 0, 1, false, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !report.SCSI.ReadCapabilities.SupportsRead16); + report.SCSI.ReadCapabilities.SupportsRead16 = + !dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0, + report.SCSI.ReadCapabilities.BlockSize, 0, 1, false, timeout, out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !report.SCSI.ReadCapabilities.SupportsRead16); if(debug) - DataFile.WriteTo("SCSI Report", "read16", "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "read16", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", "read results", + buffer); report.SCSI.ReadCapabilities.LongBlockSize = report.SCSI.ReadCapabilities.BlockSize; DicConsole.WriteLine("Trying SCSI READ LONG (10)..."); @@ -743,19 +799,21 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(decSense.HasValue) { if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest && - decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) + decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) { report.SCSI.ReadCapabilities.SupportsReadLong = true; if(decSense.Value.InformationValid && decSense.Value.ILI) { - report.SCSI.ReadCapabilities.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); + report.SCSI.ReadCapabilities.LongBlockSize = + 0xFFFF - (decSense.Value.Information & 0xFFFF); report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; } } } } - if(report.SCSI.ReadCapabilities.SupportsReadLong && report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize) + if(report.SCSI.ReadCapabilities.SupportsReadLong && report.SCSI.ReadCapabilities.LongBlockSize == + report.SCSI.ReadCapabilities.BlockSize) { if(report.SCSI.ReadCapabilities.BlockSize == 512) { @@ -803,7 +861,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } else if(report.SCSI.ReadCapabilities.BlockSize == 2048) { - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380, timeout, + out duration); if(!sense && !dev.Error) { report.SCSI.ReadCapabilities.SupportsReadLong = true; @@ -813,7 +872,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } else if(report.SCSI.ReadCapabilities.BlockSize == 4096) { - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760, timeout, + out duration); if(!sense && !dev.Error) { report.SCSI.ReadCapabilities.SupportsReadLong = true; @@ -823,7 +883,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } else if(report.SCSI.ReadCapabilities.BlockSize == 8192) { - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424, timeout, + out duration); if(!sense && !dev.Error) { report.SCSI.ReadCapabilities.SupportsReadLong = true; @@ -833,12 +894,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } } - if(report.SCSI.ReadCapabilities.SupportsReadLong && report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize) + if(report.SCSI.ReadCapabilities.SupportsReadLong && report.SCSI.ReadCapabilities.LongBlockSize == + report.SCSI.ReadCapabilities.BlockSize) { pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { - DicConsole.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): "); + DicConsole + .Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } @@ -848,12 +911,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI for(ushort i = (ushort)report.SCSI.ReadCapabilities.BlockSize; i <= ushort.MaxValue; i++) { DicConsole.Write("\rTrying to READ LONG with a size of {0} bytes...", i); - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i, timeout, + out duration); if(!sense) { if(debug) { - FileStream bingo = new FileStream(string.Format("{0}_readlong.bin", dev.Model), FileMode.Create); + FileStream bingo = + new FileStream(string.Format("{0}_readlong.bin", dev.Model), + FileMode.Create); bingo.Write(buffer, 0, buffer.Length); bingo.Close(); } @@ -862,21 +928,27 @@ namespace DiscImageChef.Core.Devices.Report.SCSI break; } - if(i == ushort.MaxValue) - break; + if(i == ushort.MaxValue) break; } + DicConsole.WriteLine(); } } - if(debug && report.SCSI.ReadCapabilities.SupportsReadLong && report.SCSI.ReadCapabilities.LongBlockSizeSpecified && report.SCSI.ReadCapabilities.LongBlockSize != report.SCSI.ReadCapabilities.BlockSize) + if(debug && report.SCSI.ReadCapabilities.SupportsReadLong && + report.SCSI.ReadCapabilities.LongBlockSizeSpecified && + report.SCSI.ReadCapabilities.LongBlockSize != report.SCSI.ReadCapabilities.BlockSize) { - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, (ushort)report.SCSI.ReadCapabilities.LongBlockSize, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, + (ushort)report.SCSI.ReadCapabilities.LongBlockSize, timeout, + out duration); if(!sense) - DataFile.WriteTo("SCSI Report", "readlong10", "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readlong10", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", + "read results", buffer); } } } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs b/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs index 5decafcb..0a46962a 100644 --- a/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs +++ b/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs @@ -41,10 +41,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { internal static class MMC { - internal static void Report(Device dev, ref DeviceReport report, bool debug, ref Decoders.SCSI.Modes.ModePage_2A? cdromMode, ref List mediaTypes) + internal static void Report(Device dev, ref DeviceReport report, bool debug, + ref Decoders.SCSI.Modes.ModePage_2A? cdromMode, ref List mediaTypes) { - if(report == null) - return; + if(report == null) return; byte[] senseBuffer; byte[] buffer; @@ -76,7 +76,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } if(cdromMode.Value.CurrentWriteSpeedSelected != 0) { - report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSelected = cdromMode.Value.CurrentWriteSpeedSelected; + report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSelected = + cdromMode.Value.CurrentWriteSpeedSelected; report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSelectedSpecified = true; } if(cdromMode.Value.MaximumSpeed != 0) @@ -91,12 +92,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } if(cdromMode.Value.RotationControlSelected != 0) { - report.SCSI.MultiMediaDevice.ModeSense2A.RotationControlSelected = cdromMode.Value.RotationControlSelected; + report.SCSI.MultiMediaDevice.ModeSense2A.RotationControlSelected = + cdromMode.Value.RotationControlSelected; report.SCSI.MultiMediaDevice.ModeSense2A.RotationControlSelectedSpecified = true; } if(cdromMode.Value.SupportedVolumeLevels != 0) { - report.SCSI.MultiMediaDevice.ModeSense2A.SupportedVolumeLevels = cdromMode.Value.SupportedVolumeLevels; + report.SCSI.MultiMediaDevice.ModeSense2A.SupportedVolumeLevels = + cdromMode.Value.SupportedVolumeLevels; report.SCSI.MultiMediaDevice.ModeSense2A.SupportedVolumeLevelsSpecified = true; } @@ -122,7 +125,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.MultiMediaDevice.ModeSense2A.ReadsBothSides = cdromMode.Value.SCC; report.SCSI.MultiMediaDevice.ModeSense2A.ReadsCDR = cdromMode.Value.ReadCDR; report.SCSI.MultiMediaDevice.ModeSense2A.ReadsCDRW = cdromMode.Value.ReadCDRW; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDeinterlavedSubchannel = cdromMode.Value.DeinterlaveSubchannel; + report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDeinterlavedSubchannel = + cdromMode.Value.DeinterlaveSubchannel; report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDR = cdromMode.Value.ReadDVDR; report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDRAM = cdromMode.Value.ReadDVDRAM; report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDROM = cdromMode.Value.ReadDVDROM; @@ -142,20 +146,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.MultiMediaDevice.ModeSense2A.WritesCDRW = cdromMode.Value.WriteCDRW; report.SCSI.MultiMediaDevice.ModeSense2A.WritesDVDR = cdromMode.Value.WriteDVDR; report.SCSI.MultiMediaDevice.ModeSense2A.WritesDVDRAM = cdromMode.Value.WriteDVDRAM; - report.SCSI.MultiMediaDevice.ModeSense2A.WriteSpeedPerformanceDescriptors = cdromMode.Value.WriteSpeedPerformanceDescriptors; + report.SCSI.MultiMediaDevice.ModeSense2A.WriteSpeedPerformanceDescriptors = + cdromMode.Value.WriteSpeedPerformanceDescriptors; mediaTypes.Add("CD-ROM"); mediaTypes.Add("Audio CD"); - if(cdromMode.Value.ReadCDR) - mediaTypes.Add("CD-R"); - if(cdromMode.Value.ReadCDRW) - mediaTypes.Add("CD-RW"); - if(cdromMode.Value.ReadDVDROM) - mediaTypes.Add("DVD-ROM"); - if(cdromMode.Value.ReadDVDRAM) - mediaTypes.Add("DVD-RAM"); - if(cdromMode.Value.ReadDVDR) - mediaTypes.Add("DVD-R"); + if(cdromMode.Value.ReadCDR) mediaTypes.Add("CD-R"); + if(cdromMode.Value.ReadCDRW) mediaTypes.Add("CD-RW"); + if(cdromMode.Value.ReadDVDROM) mediaTypes.Add("DVD-ROM"); + if(cdromMode.Value.ReadDVDRAM) mediaTypes.Add("DVD-RAM"); + if(cdromMode.Value.ReadDVDR) mediaTypes.Add("DVD-R"); } DicConsole.WriteLine("Querying MMC GET CONFIGURATION..."); @@ -172,112 +172,127 @@ namespace DiscImageChef.Core.Devices.Report.SCSI switch(desc.Code) { case 0x0001: + { + Decoders.SCSI.MMC.Feature_0001? ftr0001 = + Decoders.SCSI.MMC.Features.Decode_0001(desc.Data); + if(ftr0001.HasValue) { - Decoders.SCSI.MMC.Feature_0001? ftr0001 = Decoders.SCSI.MMC.Features.Decode_0001(desc.Data); - if(ftr0001.HasValue) + report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandard = + ftr0001.Value.PhysicalInterfaceStandard; + report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandardSpecified = true; + if((uint)ftr0001.Value.PhysicalInterfaceStandard > 0x8) { - report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandard = ftr0001.Value.PhysicalInterfaceStandard; - report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandardSpecified = true; - if((uint)ftr0001.Value.PhysicalInterfaceStandard > 0x8) - { - report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandardNumber = (uint)ftr0001.Value.PhysicalInterfaceStandard; - report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandardNumberSpecified = true; - report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandard = Decoders.SCSI.MMC.PhysicalInterfaces.Unspecified; - } - report.SCSI.MultiMediaDevice.Features.SupportsDeviceBusyEvent = ftr0001.Value.DBE; + report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandardNumber = + (uint)ftr0001.Value.PhysicalInterfaceStandard; + report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandardNumberSpecified = + true; + report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandard = + Decoders.SCSI.MMC.PhysicalInterfaces.Unspecified; } + report.SCSI.MultiMediaDevice.Features.SupportsDeviceBusyEvent = ftr0001.Value.DBE; } + } break; case 0x0003: + { + Decoders.SCSI.MMC.Feature_0003? ftr0003 = + Decoders.SCSI.MMC.Features.Decode_0003(desc.Data); + if(ftr0003.HasValue) { - Decoders.SCSI.MMC.Feature_0003? ftr0003 = Decoders.SCSI.MMC.Features.Decode_0003(desc.Data); - if(ftr0003.HasValue) - { - report.SCSI.MultiMediaDevice.Features.LoadingMechanismType = ftr0003.Value.LoadingMechanismType; - report.SCSI.MultiMediaDevice.Features.LoadingMechanismTypeSpecified = true; - report.SCSI.MultiMediaDevice.Features.CanLoad = ftr0003.Value.Load; - report.SCSI.MultiMediaDevice.Features.CanEject = ftr0003.Value.Eject; - report.SCSI.MultiMediaDevice.Features.PreventJumper = ftr0003.Value.PreventJumper; - report.SCSI.MultiMediaDevice.Features.DBML = ftr0003.Value.DBML; - report.SCSI.MultiMediaDevice.Features.Locked = ftr0003.Value.Lock; - } + report.SCSI.MultiMediaDevice.Features.LoadingMechanismType = + ftr0003.Value.LoadingMechanismType; + report.SCSI.MultiMediaDevice.Features.LoadingMechanismTypeSpecified = true; + report.SCSI.MultiMediaDevice.Features.CanLoad = ftr0003.Value.Load; + report.SCSI.MultiMediaDevice.Features.CanEject = ftr0003.Value.Eject; + report.SCSI.MultiMediaDevice.Features.PreventJumper = ftr0003.Value.PreventJumper; + report.SCSI.MultiMediaDevice.Features.DBML = ftr0003.Value.DBML; + report.SCSI.MultiMediaDevice.Features.Locked = ftr0003.Value.Lock; } + } break; case 0x0004: + { + Decoders.SCSI.MMC.Feature_0004? ftr0004 = + Decoders.SCSI.MMC.Features.Decode_0004(desc.Data); + if(ftr0004.HasValue) { - Decoders.SCSI.MMC.Feature_0004? ftr0004 = Decoders.SCSI.MMC.Features.Decode_0004(desc.Data); - if(ftr0004.HasValue) - { - report.SCSI.MultiMediaDevice.Features.SupportsWriteProtectPAC = ftr0004.Value.DWP; - report.SCSI.MultiMediaDevice.Features.SupportsWriteInhibitDCB = ftr0004.Value.WDCB; - report.SCSI.MultiMediaDevice.Features.SupportsPWP = ftr0004.Value.SPWP; - report.SCSI.MultiMediaDevice.Features.SupportsSWPP = ftr0004.Value.SSWPP; - } + report.SCSI.MultiMediaDevice.Features.SupportsWriteProtectPAC = ftr0004.Value.DWP; + report.SCSI.MultiMediaDevice.Features.SupportsWriteInhibitDCB = ftr0004.Value.WDCB; + report.SCSI.MultiMediaDevice.Features.SupportsPWP = ftr0004.Value.SPWP; + report.SCSI.MultiMediaDevice.Features.SupportsSWPP = ftr0004.Value.SSWPP; } + } break; case 0x0010: + { + Decoders.SCSI.MMC.Feature_0010? ftr0010 = + Decoders.SCSI.MMC.Features.Decode_0010(desc.Data); + if(ftr0010.HasValue) { - Decoders.SCSI.MMC.Feature_0010? ftr0010 = Decoders.SCSI.MMC.Features.Decode_0010(desc.Data); - if(ftr0010.HasValue) + if(ftr0010.Value.LogicalBlockSize > 0) { - if(ftr0010.Value.LogicalBlockSize > 0) - { - report.SCSI.MultiMediaDevice.Features.LogicalBlockSize = ftr0010.Value.LogicalBlockSize; - report.SCSI.MultiMediaDevice.Features.LogicalBlockSizeSpecified = true; - } - if(ftr0010.Value.Blocking > 0) - { - report.SCSI.MultiMediaDevice.Features.BlocksPerReadableUnit = ftr0010.Value.Blocking; - report.SCSI.MultiMediaDevice.Features.BlocksPerReadableUnitSpecified = true; - } - report.SCSI.MultiMediaDevice.Features.ErrorRecoveryPage = ftr0010.Value.PP; + report.SCSI.MultiMediaDevice.Features.LogicalBlockSize = + ftr0010.Value.LogicalBlockSize; + report.SCSI.MultiMediaDevice.Features.LogicalBlockSizeSpecified = true; } + if(ftr0010.Value.Blocking > 0) + { + report.SCSI.MultiMediaDevice.Features.BlocksPerReadableUnit = + ftr0010.Value.Blocking; + report.SCSI.MultiMediaDevice.Features.BlocksPerReadableUnitSpecified = true; + } + report.SCSI.MultiMediaDevice.Features.ErrorRecoveryPage = ftr0010.Value.PP; } + } break; case 0x001D: report.SCSI.MultiMediaDevice.Features.MultiRead = true; break; case 0x001E: + { + report.SCSI.MultiMediaDevice.Features.CanReadCD = true; + Decoders.SCSI.MMC.Feature_001E? ftr001E = + Decoders.SCSI.MMC.Features.Decode_001E(desc.Data); + if(ftr001E.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanReadCD = true; - Decoders.SCSI.MMC.Feature_001E? ftr001E = Decoders.SCSI.MMC.Features.Decode_001E(desc.Data); - if(ftr001E.HasValue) - { - report.SCSI.MultiMediaDevice.Features.SupportsDAP = ftr001E.Value.DAP; - report.SCSI.MultiMediaDevice.Features.SupportsC2 = ftr001E.Value.C2; - report.SCSI.MultiMediaDevice.Features.CanReadLeadInCDText = ftr001E.Value.CDText; - } + report.SCSI.MultiMediaDevice.Features.SupportsDAP = ftr001E.Value.DAP; + report.SCSI.MultiMediaDevice.Features.SupportsC2 = ftr001E.Value.C2; + report.SCSI.MultiMediaDevice.Features.CanReadLeadInCDText = ftr001E.Value.CDText; } + } break; case 0x001F: + { + report.SCSI.MultiMediaDevice.Features.CanReadDVD = true; + Decoders.SCSI.MMC.Feature_001F? ftr001F = + Decoders.SCSI.MMC.Features.Decode_001F(desc.Data); + if(ftr001F.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanReadDVD = true; - Decoders.SCSI.MMC.Feature_001F? ftr001F = Decoders.SCSI.MMC.Features.Decode_001F(desc.Data); - if(ftr001F.HasValue) - { - report.SCSI.MultiMediaDevice.Features.DVDMultiRead = ftr001F.Value.MULTI110; - report.SCSI.MultiMediaDevice.Features.CanReadAllDualRW = ftr001F.Value.DualRW; - report.SCSI.MultiMediaDevice.Features.CanReadAllDualR = ftr001F.Value.DualR; - } + report.SCSI.MultiMediaDevice.Features.DVDMultiRead = ftr001F.Value.MULTI110; + report.SCSI.MultiMediaDevice.Features.CanReadAllDualRW = ftr001F.Value.DualRW; + report.SCSI.MultiMediaDevice.Features.CanReadAllDualR = ftr001F.Value.DualR; } + } break; case 0x0022: report.SCSI.MultiMediaDevice.Features.CanEraseSector = true; break; case 0x0023: + { + report.SCSI.MultiMediaDevice.Features.CanFormat = true; + Decoders.SCSI.MMC.Feature_0023? ftr0023 = + Decoders.SCSI.MMC.Features.Decode_0023(desc.Data); + if(ftr0023.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanFormat = true; - Decoders.SCSI.MMC.Feature_0023? ftr0023 = Decoders.SCSI.MMC.Features.Decode_0023(desc.Data); - if(ftr0023.HasValue) - { - report.SCSI.MultiMediaDevice.Features.CanFormatBDREWithoutSpare = ftr0023.Value.RENoSA; - report.SCSI.MultiMediaDevice.Features.CanExpandBDRESpareArea = ftr0023.Value.Expand; - report.SCSI.MultiMediaDevice.Features.CanFormatQCert = ftr0023.Value.QCert; - report.SCSI.MultiMediaDevice.Features.CanFormatCert = ftr0023.Value.Cert; - report.SCSI.MultiMediaDevice.Features.CanFormatFRF = ftr0023.Value.FRF; - report.SCSI.MultiMediaDevice.Features.CanFormatRRM = ftr0023.Value.RRM; - } + report.SCSI.MultiMediaDevice.Features.CanFormatBDREWithoutSpare = + ftr0023.Value.RENoSA; + report.SCSI.MultiMediaDevice.Features.CanExpandBDRESpareArea = ftr0023.Value.Expand; + report.SCSI.MultiMediaDevice.Features.CanFormatQCert = ftr0023.Value.QCert; + report.SCSI.MultiMediaDevice.Features.CanFormatCert = ftr0023.Value.Cert; + report.SCSI.MultiMediaDevice.Features.CanFormatFRF = ftr0023.Value.FRF; + report.SCSI.MultiMediaDevice.Features.CanFormatRRM = ftr0023.Value.RRM; } + } break; case 0x0024: report.SCSI.MultiMediaDevice.Features.CanReadSpareAreaInformation = true; @@ -286,90 +301,100 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.MultiMediaDevice.Features.CanWriteCDRWCAV = true; break; case 0x0028: + { + report.SCSI.MultiMediaDevice.Features.CanReadCDMRW = true; + Decoders.SCSI.MMC.Feature_0028? ftr0028 = + Decoders.SCSI.MMC.Features.Decode_0028(desc.Data); + if(ftr0028.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanReadCDMRW = true; - Decoders.SCSI.MMC.Feature_0028? ftr0028 = Decoders.SCSI.MMC.Features.Decode_0028(desc.Data); - if(ftr0028.HasValue) - { - report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW = ftr0028.Value.DVDPRead; - report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusMRW = ftr0028.Value.DVDPWrite; - report.SCSI.MultiMediaDevice.Features.CanWriteCDMRW = ftr0028.Value.Write; - } + report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW = ftr0028.Value.DVDPRead; + report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusMRW = ftr0028.Value.DVDPWrite; + report.SCSI.MultiMediaDevice.Features.CanWriteCDMRW = ftr0028.Value.Write; } + } break; case 0x002A: + { + report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRW = true; + Decoders.SCSI.MMC.Feature_002A? ftr002A = + Decoders.SCSI.MMC.Features.Decode_002A(desc.Data); + if(ftr002A.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRW = true; - Decoders.SCSI.MMC.Feature_002A? ftr002A = Decoders.SCSI.MMC.Features.Decode_002A(desc.Data); - if(ftr002A.HasValue) - { - report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusRW = ftr002A.Value.Write; - } + report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusRW = ftr002A.Value.Write; } + } break; case 0x002B: + { + report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusR = true; + Decoders.SCSI.MMC.Feature_002B? ftr002B = + Decoders.SCSI.MMC.Features.Decode_002B(desc.Data); + if(ftr002B.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusR = true; - Decoders.SCSI.MMC.Feature_002B? ftr002B = Decoders.SCSI.MMC.Features.Decode_002B(desc.Data); - if(ftr002B.HasValue) - { - report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusR = ftr002B.Value.Write; - } + report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusR = ftr002B.Value.Write; } + } break; case 0x002D: + { + report.SCSI.MultiMediaDevice.Features.CanWriteCDTAO = true; + Decoders.SCSI.MMC.Feature_002D? ftr002D = + Decoders.SCSI.MMC.Features.Decode_002D(desc.Data); + if(ftr002D.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanWriteCDTAO = true; - Decoders.SCSI.MMC.Feature_002D? ftr002D = Decoders.SCSI.MMC.Features.Decode_002D(desc.Data); - if(ftr002D.HasValue) - { - report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInTAO = ftr002D.Value.BUF; - report.SCSI.MultiMediaDevice.Features.CanWriteRawSubchannelInTAO = ftr002D.Value.RWRaw; - report.SCSI.MultiMediaDevice.Features.CanWritePackedSubchannelInTAO = ftr002D.Value.RWPack; - report.SCSI.MultiMediaDevice.Features.CanTestWriteInTAO = ftr002D.Value.TestWrite; - report.SCSI.MultiMediaDevice.Features.CanOverwriteTAOTrack = ftr002D.Value.CDRW; - report.SCSI.MultiMediaDevice.Features.CanWriteRWSubchannelInTAO = ftr002D.Value.RWSubchannel; - } + report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInTAO = ftr002D.Value.BUF; + report.SCSI.MultiMediaDevice.Features.CanWriteRawSubchannelInTAO = + ftr002D.Value.RWRaw; + report.SCSI.MultiMediaDevice.Features.CanWritePackedSubchannelInTAO = + ftr002D.Value.RWPack; + report.SCSI.MultiMediaDevice.Features.CanTestWriteInTAO = ftr002D.Value.TestWrite; + report.SCSI.MultiMediaDevice.Features.CanOverwriteTAOTrack = ftr002D.Value.CDRW; + report.SCSI.MultiMediaDevice.Features.CanWriteRWSubchannelInTAO = + ftr002D.Value.RWSubchannel; } + } break; case 0x002E: + { + report.SCSI.MultiMediaDevice.Features.CanWriteCDSAO = true; + Decoders.SCSI.MMC.Feature_002E? ftr002E = + Decoders.SCSI.MMC.Features.Decode_002E(desc.Data); + if(ftr002E.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanWriteCDSAO = true; - Decoders.SCSI.MMC.Feature_002E? ftr002E = Decoders.SCSI.MMC.Features.Decode_002E(desc.Data); - if(ftr002E.HasValue) - { - report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInSAO = ftr002E.Value.BUF; - report.SCSI.MultiMediaDevice.Features.CanWriteRawMultiSession = ftr002E.Value.RAWMS; - report.SCSI.MultiMediaDevice.Features.CanWriteRaw = ftr002E.Value.RAW; - report.SCSI.MultiMediaDevice.Features.CanTestWriteInSAO = ftr002E.Value.TestWrite; - report.SCSI.MultiMediaDevice.Features.CanOverwriteSAOTrack = ftr002E.Value.CDRW; - report.SCSI.MultiMediaDevice.Features.CanWriteRWSubchannelInSAO = ftr002E.Value.RW; - } + report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInSAO = ftr002E.Value.BUF; + report.SCSI.MultiMediaDevice.Features.CanWriteRawMultiSession = ftr002E.Value.RAWMS; + report.SCSI.MultiMediaDevice.Features.CanWriteRaw = ftr002E.Value.RAW; + report.SCSI.MultiMediaDevice.Features.CanTestWriteInSAO = ftr002E.Value.TestWrite; + report.SCSI.MultiMediaDevice.Features.CanOverwriteSAOTrack = ftr002E.Value.CDRW; + report.SCSI.MultiMediaDevice.Features.CanWriteRWSubchannelInSAO = ftr002E.Value.RW; } + } break; case 0x002F: + { + report.SCSI.MultiMediaDevice.Features.CanWriteDVDR = true; + Decoders.SCSI.MMC.Feature_002F? ftr002F = + Decoders.SCSI.MMC.Features.Decode_002F(desc.Data); + if(ftr002F.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanWriteDVDR = true; - Decoders.SCSI.MMC.Feature_002F? ftr002F = Decoders.SCSI.MMC.Features.Decode_002F(desc.Data); - if(ftr002F.HasValue) - { - report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInDVD = ftr002F.Value.BUF; - report.SCSI.MultiMediaDevice.Features.CanWriteDVDRDL = ftr002F.Value.RDL; - report.SCSI.MultiMediaDevice.Features.CanTestWriteDVD = ftr002F.Value.TestWrite; - report.SCSI.MultiMediaDevice.Features.CanWriteDVDRW = ftr002F.Value.DVDRW; - } + report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInDVD = ftr002F.Value.BUF; + report.SCSI.MultiMediaDevice.Features.CanWriteDVDRDL = ftr002F.Value.RDL; + report.SCSI.MultiMediaDevice.Features.CanTestWriteDVD = ftr002F.Value.TestWrite; + report.SCSI.MultiMediaDevice.Features.CanWriteDVDRW = ftr002F.Value.DVDRW; } + } break; case 0x0030: report.SCSI.MultiMediaDevice.Features.CanReadDDCD = true; break; case 0x0031: - { - report.SCSI.MultiMediaDevice.Features.CanWriteDDCDR = true; - Decoders.SCSI.MMC.Feature_0031? ftr0031 = Decoders.SCSI.MMC.Features.Decode_0031(desc.Data); - if(ftr0031.HasValue) - report.SCSI.MultiMediaDevice.Features.CanTestWriteDDCDR = ftr0031.Value.TestWrite; - } + { + report.SCSI.MultiMediaDevice.Features.CanWriteDDCDR = true; + Decoders.SCSI.MMC.Feature_0031? ftr0031 = + Decoders.SCSI.MMC.Features.Decode_0031(desc.Data); + if(ftr0031.HasValue) + report.SCSI.MultiMediaDevice.Features.CanTestWriteDDCDR = ftr0031.Value.TestWrite; + } break; case 0x0032: report.SCSI.MultiMediaDevice.Features.CanWriteDDCDRW = true; @@ -381,73 +406,79 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.MultiMediaDevice.Features.CanPseudoOverwriteBDR = true; break; case 0x003A: - { - report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRWDL = true; - Decoders.SCSI.MMC.Feature_003A? ftr003A = Decoders.SCSI.MMC.Features.Decode_003A(desc.Data); - if(ftr003A.HasValue) - report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusRWDL = ftr003A.Value.Write; - } + { + report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRWDL = true; + Decoders.SCSI.MMC.Feature_003A? ftr003A = + Decoders.SCSI.MMC.Features.Decode_003A(desc.Data); + if(ftr003A.HasValue) + report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusRWDL = ftr003A.Value.Write; + } break; case 0x003B: - { - report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRDL = true; - Decoders.SCSI.MMC.Feature_003B? ftr003B = Decoders.SCSI.MMC.Features.Decode_003B(desc.Data); - if(ftr003B.HasValue) - report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusRDL = ftr003B.Value.Write; - } + { + report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRDL = true; + Decoders.SCSI.MMC.Feature_003B? ftr003B = + Decoders.SCSI.MMC.Features.Decode_003B(desc.Data); + if(ftr003B.HasValue) + report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusRDL = ftr003B.Value.Write; + } break; case 0x0040: + { + report.SCSI.MultiMediaDevice.Features.CanReadBD = true; + Decoders.SCSI.MMC.Feature_0040? ftr0040 = + Decoders.SCSI.MMC.Features.Decode_0040(desc.Data); + if(ftr0040.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanReadBD = true; - Decoders.SCSI.MMC.Feature_0040? ftr0040 = Decoders.SCSI.MMC.Features.Decode_0040(desc.Data); - if(ftr0040.HasValue) - { - report.SCSI.MultiMediaDevice.Features.CanReadBluBCA = ftr0040.Value.BCA; - report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 = ftr0040.Value.RE2; - report.SCSI.MultiMediaDevice.Features.CanReadBDRE1 = ftr0040.Value.RE1; - report.SCSI.MultiMediaDevice.Features.CanReadOldBDRE = ftr0040.Value.OldRE; - report.SCSI.MultiMediaDevice.Features.CanReadBDR = ftr0040.Value.R; - report.SCSI.MultiMediaDevice.Features.CanReadOldBDR = ftr0040.Value.OldR; - report.SCSI.MultiMediaDevice.Features.CanReadBDROM = ftr0040.Value.ROM; - report.SCSI.MultiMediaDevice.Features.CanReadOldBDROM = ftr0040.Value.OldROM; - } + report.SCSI.MultiMediaDevice.Features.CanReadBluBCA = ftr0040.Value.BCA; + report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 = ftr0040.Value.RE2; + report.SCSI.MultiMediaDevice.Features.CanReadBDRE1 = ftr0040.Value.RE1; + report.SCSI.MultiMediaDevice.Features.CanReadOldBDRE = ftr0040.Value.OldRE; + report.SCSI.MultiMediaDevice.Features.CanReadBDR = ftr0040.Value.R; + report.SCSI.MultiMediaDevice.Features.CanReadOldBDR = ftr0040.Value.OldR; + report.SCSI.MultiMediaDevice.Features.CanReadBDROM = ftr0040.Value.ROM; + report.SCSI.MultiMediaDevice.Features.CanReadOldBDROM = ftr0040.Value.OldROM; } + } break; case 0x0041: + { + report.SCSI.MultiMediaDevice.Features.CanWriteBD = true; + Decoders.SCSI.MMC.Feature_0041? ftr0041 = + Decoders.SCSI.MMC.Features.Decode_0041(desc.Data); + if(ftr0041.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanWriteBD = true; - Decoders.SCSI.MMC.Feature_0041? ftr0041 = Decoders.SCSI.MMC.Features.Decode_0041(desc.Data); - if(ftr0041.HasValue) - { - report.SCSI.MultiMediaDevice.Features.CanWriteBDRE2 = ftr0041.Value.RE2; - report.SCSI.MultiMediaDevice.Features.CanWriteBDRE1 = ftr0041.Value.RE1; - report.SCSI.MultiMediaDevice.Features.CanWriteOldBDRE = ftr0041.Value.OldRE; - report.SCSI.MultiMediaDevice.Features.CanWriteBDR = ftr0041.Value.R; - report.SCSI.MultiMediaDevice.Features.CanWriteOldBDR = ftr0041.Value.OldR; - } + report.SCSI.MultiMediaDevice.Features.CanWriteBDRE2 = ftr0041.Value.RE2; + report.SCSI.MultiMediaDevice.Features.CanWriteBDRE1 = ftr0041.Value.RE1; + report.SCSI.MultiMediaDevice.Features.CanWriteOldBDRE = ftr0041.Value.OldRE; + report.SCSI.MultiMediaDevice.Features.CanWriteBDR = ftr0041.Value.R; + report.SCSI.MultiMediaDevice.Features.CanWriteOldBDR = ftr0041.Value.OldR; } + } break; case 0x0050: + { + report.SCSI.MultiMediaDevice.Features.CanReadHDDVD = true; + Decoders.SCSI.MMC.Feature_0050? ftr0050 = + Decoders.SCSI.MMC.Features.Decode_0050(desc.Data); + if(ftr0050.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanReadHDDVD = true; - Decoders.SCSI.MMC.Feature_0050? ftr0050 = Decoders.SCSI.MMC.Features.Decode_0050(desc.Data); - if(ftr0050.HasValue) - { - report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR = ftr0050.Value.HDDVDR; - report.SCSI.MultiMediaDevice.Features.CanReadHDDVDRAM = ftr0050.Value.HDDVDRAM; - } + report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR = ftr0050.Value.HDDVDR; + report.SCSI.MultiMediaDevice.Features.CanReadHDDVDRAM = ftr0050.Value.HDDVDRAM; } + } break; case 0x0051: + { + // TODO: Write HD DVD-RW + Decoders.SCSI.MMC.Feature_0051? ftr0051 = + Decoders.SCSI.MMC.Features.Decode_0051(desc.Data); + if(ftr0051.HasValue) { - // TODO: Write HD DVD-RW - Decoders.SCSI.MMC.Feature_0051? ftr0051 = Decoders.SCSI.MMC.Features.Decode_0051(desc.Data); - if(ftr0051.HasValue) - { - report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDR = ftr0051.Value.HDDVDR; - report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDRAM = ftr0051.Value.HDDVDRAM; - } + report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDR = ftr0051.Value.HDDVDR; + report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDRAM = ftr0051.Value.HDDVDRAM; } + } break; case 0x0080: report.SCSI.MultiMediaDevice.Features.SupportsHybridDiscs = true; @@ -456,50 +487,56 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.MultiMediaDevice.Features.SupportsModePage1Ch = true; break; case 0x0102: + { + report.SCSI.MultiMediaDevice.Features.EmbeddedChanger = true; + Decoders.SCSI.MMC.Feature_0102? ftr0102 = + Decoders.SCSI.MMC.Features.Decode_0102(desc.Data); + if(ftr0102.HasValue) { - report.SCSI.MultiMediaDevice.Features.EmbeddedChanger = true; - Decoders.SCSI.MMC.Feature_0102? ftr0102 = Decoders.SCSI.MMC.Features.Decode_0102(desc.Data); - if(ftr0102.HasValue) - { - report.SCSI.MultiMediaDevice.Features.ChangerIsSideChangeCapable = ftr0102.Value.SCC; - report.SCSI.MultiMediaDevice.Features.ChangerSupportsDiscPresent = ftr0102.Value.SDP; - report.SCSI.MultiMediaDevice.Features.ChangerSlots = (byte)(ftr0102.Value.HighestSlotNumber + 1); - } + report.SCSI.MultiMediaDevice.Features.ChangerIsSideChangeCapable = + ftr0102.Value.SCC; + report.SCSI.MultiMediaDevice.Features.ChangerSupportsDiscPresent = + ftr0102.Value.SDP; + report.SCSI.MultiMediaDevice.Features.ChangerSlots = + (byte)(ftr0102.Value.HighestSlotNumber + 1); } + } break; case 0x0103: + { + report.SCSI.MultiMediaDevice.Features.CanPlayCDAudio = true; + Decoders.SCSI.MMC.Feature_0103? ftr0103 = + Decoders.SCSI.MMC.Features.Decode_0103(desc.Data); + if(ftr0103.HasValue) { - report.SCSI.MultiMediaDevice.Features.CanPlayCDAudio = true; - Decoders.SCSI.MMC.Feature_0103? ftr0103 = Decoders.SCSI.MMC.Features.Decode_0103(desc.Data); - if(ftr0103.HasValue) + report.SCSI.MultiMediaDevice.Features.CanAudioScan = ftr0103.Value.Scan; + report.SCSI.MultiMediaDevice.Features.CanMuteSeparateChannels = ftr0103.Value.SCM; + report.SCSI.MultiMediaDevice.Features.SupportsSeparateVolume = ftr0103.Value.SV; + if(ftr0103.Value.VolumeLevels > 0) { - report.SCSI.MultiMediaDevice.Features.CanAudioScan = ftr0103.Value.Scan; - report.SCSI.MultiMediaDevice.Features.CanMuteSeparateChannels = ftr0103.Value.SCM; - report.SCSI.MultiMediaDevice.Features.SupportsSeparateVolume = ftr0103.Value.SV; - if(ftr0103.Value.VolumeLevels > 0) - { - report.SCSI.MultiMediaDevice.Features.VolumeLevelsSpecified = true; - report.SCSI.MultiMediaDevice.Features.VolumeLevels = ftr0103.Value.VolumeLevels; - } + report.SCSI.MultiMediaDevice.Features.VolumeLevelsSpecified = true; + report.SCSI.MultiMediaDevice.Features.VolumeLevels = ftr0103.Value.VolumeLevels; } } + } break; case 0x0104: report.SCSI.MultiMediaDevice.Features.CanUpgradeFirmware = true; break; case 0x0106: + { + report.SCSI.MultiMediaDevice.Features.SupportsCSS = true; + Decoders.SCSI.MMC.Feature_0106? ftr0106 = + Decoders.SCSI.MMC.Features.Decode_0106(desc.Data); + if(ftr0106.HasValue) { - report.SCSI.MultiMediaDevice.Features.SupportsCSS = true; - Decoders.SCSI.MMC.Feature_0106? ftr0106 = Decoders.SCSI.MMC.Features.Decode_0106(desc.Data); - if(ftr0106.HasValue) + if(ftr0106.Value.CSSVersion > 0) { - if(ftr0106.Value.CSSVersion > 0) - { - report.SCSI.MultiMediaDevice.Features.CSSVersionSpecified = true; - report.SCSI.MultiMediaDevice.Features.CSSVersion = ftr0106.Value.CSSVersion; - } + report.SCSI.MultiMediaDevice.Features.CSSVersionSpecified = true; + report.SCSI.MultiMediaDevice.Features.CSSVersion = ftr0106.Value.CSSVersion; } } + } break; case 0x0108: report.SCSI.MultiMediaDevice.Features.CanReportDriveSerial = true; @@ -508,101 +545,106 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.MultiMediaDevice.Features.CanReportMediaSerial = true; break; case 0x010B: + { + report.SCSI.MultiMediaDevice.Features.SupportsCPRM = true; + Decoders.SCSI.MMC.Feature_010B? ftr010B = + Decoders.SCSI.MMC.Features.Decode_010B(desc.Data); + if(ftr010B.HasValue) { - report.SCSI.MultiMediaDevice.Features.SupportsCPRM = true; - Decoders.SCSI.MMC.Feature_010B? ftr010B = Decoders.SCSI.MMC.Features.Decode_010B(desc.Data); - if(ftr010B.HasValue) + if(ftr010B.Value.CPRMVersion > 0) { - if(ftr010B.Value.CPRMVersion > 0) - { - report.SCSI.MultiMediaDevice.Features.CPRMVersionSpecified = true; - report.SCSI.MultiMediaDevice.Features.CPRMVersion = ftr010B.Value.CPRMVersion; - } + report.SCSI.MultiMediaDevice.Features.CPRMVersionSpecified = true; + report.SCSI.MultiMediaDevice.Features.CPRMVersion = ftr010B.Value.CPRMVersion; } } + } break; case 0x010C: + { + Decoders.SCSI.MMC.Feature_010C? ftr010C = + Decoders.SCSI.MMC.Features.Decode_010C(desc.Data); + if(ftr010C.HasValue) { - Decoders.SCSI.MMC.Feature_010C? ftr010C = Decoders.SCSI.MMC.Features.Decode_010C(desc.Data); - if(ftr010C.HasValue) + string syear, smonth, sday, shour, sminute, ssecond; + byte[] temp; + + temp = new byte[4]; + temp[0] = (byte)((ftr010C.Value.Century & 0xFF00) >> 8); + temp[1] = (byte)(ftr010C.Value.Century & 0xFF); + temp[2] = (byte)((ftr010C.Value.Year & 0xFF00) >> 8); + temp[3] = (byte)(ftr010C.Value.Year & 0xFF); + syear = System.Text.Encoding.ASCII.GetString(temp); + temp = new byte[2]; + temp[0] = (byte)((ftr010C.Value.Month & 0xFF00) >> 8); + temp[1] = (byte)(ftr010C.Value.Month & 0xFF); + smonth = System.Text.Encoding.ASCII.GetString(temp); + temp = new byte[2]; + temp[0] = (byte)((ftr010C.Value.Day & 0xFF00) >> 8); + temp[1] = (byte)(ftr010C.Value.Day & 0xFF); + sday = System.Text.Encoding.ASCII.GetString(temp); + temp = new byte[2]; + temp[0] = (byte)((ftr010C.Value.Hour & 0xFF00) >> 8); + temp[1] = (byte)(ftr010C.Value.Hour & 0xFF); + shour = System.Text.Encoding.ASCII.GetString(temp); + temp = new byte[2]; + temp[0] = (byte)((ftr010C.Value.Minute & 0xFF00) >> 8); + temp[1] = (byte)(ftr010C.Value.Minute & 0xFF); + sminute = System.Text.Encoding.ASCII.GetString(temp); + temp = new byte[2]; + temp[0] = (byte)((ftr010C.Value.Second & 0xFF00) >> 8); + temp[1] = (byte)(ftr010C.Value.Second & 0xFF); + ssecond = System.Text.Encoding.ASCII.GetString(temp); + + try { - string syear, smonth, sday, shour, sminute, ssecond; - byte[] temp; + report.SCSI.MultiMediaDevice.Features.FirmwareDate = + new DateTime(int.Parse(syear), int.Parse(smonth), int.Parse(sday), + int.Parse(shour), int.Parse(sminute), int.Parse(ssecond), + DateTimeKind.Utc); - temp = new byte[4]; - temp[0] = (byte)((ftr010C.Value.Century & 0xFF00) >> 8); - temp[1] = (byte)(ftr010C.Value.Century & 0xFF); - temp[2] = (byte)((ftr010C.Value.Year & 0xFF00) >> 8); - temp[3] = (byte)(ftr010C.Value.Year & 0xFF); - syear = System.Text.Encoding.ASCII.GetString(temp); - temp = new byte[2]; - temp[0] = (byte)((ftr010C.Value.Month & 0xFF00) >> 8); - temp[1] = (byte)(ftr010C.Value.Month & 0xFF); - smonth = System.Text.Encoding.ASCII.GetString(temp); - temp = new byte[2]; - temp[0] = (byte)((ftr010C.Value.Day & 0xFF00) >> 8); - temp[1] = (byte)(ftr010C.Value.Day & 0xFF); - sday = System.Text.Encoding.ASCII.GetString(temp); - temp = new byte[2]; - temp[0] = (byte)((ftr010C.Value.Hour & 0xFF00) >> 8); - temp[1] = (byte)(ftr010C.Value.Hour & 0xFF); - shour = System.Text.Encoding.ASCII.GetString(temp); - temp = new byte[2]; - temp[0] = (byte)((ftr010C.Value.Minute & 0xFF00) >> 8); - temp[1] = (byte)(ftr010C.Value.Minute & 0xFF); - sminute = System.Text.Encoding.ASCII.GetString(temp); - temp = new byte[2]; - temp[0] = (byte)((ftr010C.Value.Second & 0xFF00) >> 8); - temp[1] = (byte)(ftr010C.Value.Second & 0xFF); - ssecond = System.Text.Encoding.ASCII.GetString(temp); - - try - { - report.SCSI.MultiMediaDevice.Features.FirmwareDate = new DateTime(int.Parse(syear), int.Parse(smonth), - int.Parse(sday), int.Parse(shour), int.Parse(sminute), - int.Parse(ssecond), DateTimeKind.Utc); - - report.SCSI.MultiMediaDevice.Features.FirmwareDateSpecified = true; - } -#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - catch -#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body - { - } + report.SCSI.MultiMediaDevice.Features.FirmwareDateSpecified = true; } +#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body + catch { } +#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body } + } break; case 0x010D: + { + report.SCSI.MultiMediaDevice.Features.SupportsAACS = true; + Decoders.SCSI.MMC.Feature_010D? ftr010D = + Decoders.SCSI.MMC.Features.Decode_010D(desc.Data); + if(ftr010D.HasValue) { - report.SCSI.MultiMediaDevice.Features.SupportsAACS = true; - Decoders.SCSI.MMC.Feature_010D? ftr010D = Decoders.SCSI.MMC.Features.Decode_010D(desc.Data); - if(ftr010D.HasValue) + report.SCSI.MultiMediaDevice.Features.CanReadDriveAACSCertificate = + ftr010D.Value.RDC; + report.SCSI.MultiMediaDevice.Features.CanReadCPRM_MKB = ftr010D.Value.RMC; + report.SCSI.MultiMediaDevice.Features.CanWriteBusEncryptedBlocks = + ftr010D.Value.WBE; + report.SCSI.MultiMediaDevice.Features.SupportsBusEncryption = ftr010D.Value.BEC; + report.SCSI.MultiMediaDevice.Features.CanGenerateBindingNonce = ftr010D.Value.BNG; + + if(ftr010D.Value.BindNonceBlocks > 0) { - report.SCSI.MultiMediaDevice.Features.CanReadDriveAACSCertificate = ftr010D.Value.RDC; - report.SCSI.MultiMediaDevice.Features.CanReadCPRM_MKB = ftr010D.Value.RMC; - report.SCSI.MultiMediaDevice.Features.CanWriteBusEncryptedBlocks = ftr010D.Value.WBE; - report.SCSI.MultiMediaDevice.Features.SupportsBusEncryption = ftr010D.Value.BEC; - report.SCSI.MultiMediaDevice.Features.CanGenerateBindingNonce = ftr010D.Value.BNG; + report.SCSI.MultiMediaDevice.Features.BindingNonceBlocksSpecified = true; + report.SCSI.MultiMediaDevice.Features.BindingNonceBlocks = + ftr010D.Value.BindNonceBlocks; + } - if(ftr010D.Value.BindNonceBlocks > 0) - { - report.SCSI.MultiMediaDevice.Features.BindingNonceBlocksSpecified = true; - report.SCSI.MultiMediaDevice.Features.BindingNonceBlocks = ftr010D.Value.BindNonceBlocks; - } + if(ftr010D.Value.AGIDs > 0) + { + report.SCSI.MultiMediaDevice.Features.AGIDsSpecified = true; + report.SCSI.MultiMediaDevice.Features.AGIDs = ftr010D.Value.AGIDs; + } - if(ftr010D.Value.AGIDs > 0) - { - report.SCSI.MultiMediaDevice.Features.AGIDsSpecified = true; - report.SCSI.MultiMediaDevice.Features.AGIDs = ftr010D.Value.AGIDs; - } - - if(ftr010D.Value.AACSVersion > 0) - { - report.SCSI.MultiMediaDevice.Features.AACSVersionSpecified = true; - report.SCSI.MultiMediaDevice.Features.AACSVersion = ftr010D.Value.AACSVersion; - } + if(ftr010D.Value.AACSVersion > 0) + { + report.SCSI.MultiMediaDevice.Features.AACSVersionSpecified = true; + report.SCSI.MultiMediaDevice.Features.AACSVersion = ftr010D.Value.AACSVersion; } } + } break; case 0x010E: report.SCSI.MultiMediaDevice.Features.CanWriteCSSManagedDVD = true; @@ -621,100 +663,73 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } if(report.SCSI.MultiMediaDevice.Features.CanReadBD || - report.SCSI.MultiMediaDevice.Features.CanReadBDR || - report.SCSI.MultiMediaDevice.Features.CanReadBDRE1 || - report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 || - report.SCSI.MultiMediaDevice.Features.CanReadBDROM || - report.SCSI.MultiMediaDevice.Features.CanReadOldBDR || - report.SCSI.MultiMediaDevice.Features.CanReadOldBDRE || - report.SCSI.MultiMediaDevice.Features.CanReadOldBDROM) + report.SCSI.MultiMediaDevice.Features.CanReadBDR || + report.SCSI.MultiMediaDevice.Features.CanReadBDRE1 || + report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 || + report.SCSI.MultiMediaDevice.Features.CanReadBDROM || + report.SCSI.MultiMediaDevice.Features.CanReadOldBDR || + report.SCSI.MultiMediaDevice.Features.CanReadOldBDRE || + report.SCSI.MultiMediaDevice.Features.CanReadOldBDROM) { - if(!mediaTypes.Contains("BD-ROM")) - mediaTypes.Add("BD-ROM"); - if(!mediaTypes.Contains("BD-R")) - mediaTypes.Add("BD-R"); - if(!mediaTypes.Contains("BD-RE")) - mediaTypes.Add("BD-RE"); - if(!mediaTypes.Contains("BD-R LTH")) - mediaTypes.Add("BD-R LTH"); - if(!mediaTypes.Contains("BD-R XL")) - mediaTypes.Add("BD-R XL"); + if(!mediaTypes.Contains("BD-ROM")) mediaTypes.Add("BD-ROM"); + if(!mediaTypes.Contains("BD-R")) mediaTypes.Add("BD-R"); + if(!mediaTypes.Contains("BD-RE")) mediaTypes.Add("BD-RE"); + if(!mediaTypes.Contains("BD-R LTH")) mediaTypes.Add("BD-R LTH"); + if(!mediaTypes.Contains("BD-R XL")) mediaTypes.Add("BD-R XL"); } - if(report.SCSI.MultiMediaDevice.Features.CanReadCD || - report.SCSI.MultiMediaDevice.Features.MultiRead) + if(report.SCSI.MultiMediaDevice.Features.CanReadCD || report.SCSI.MultiMediaDevice.Features.MultiRead) { - if(!mediaTypes.Contains("CD-ROM")) - mediaTypes.Add("CD-ROM"); - if(!mediaTypes.Contains("Audio CD")) - mediaTypes.Add("Audio CD"); - if(!mediaTypes.Contains("CD-R")) - mediaTypes.Add("CD-R"); - if(!mediaTypes.Contains("CD-RW")) - mediaTypes.Add("CD-RW"); + if(!mediaTypes.Contains("CD-ROM")) mediaTypes.Add("CD-ROM"); + if(!mediaTypes.Contains("Audio CD")) mediaTypes.Add("Audio CD"); + if(!mediaTypes.Contains("CD-R")) mediaTypes.Add("CD-R"); + if(!mediaTypes.Contains("CD-RW")) mediaTypes.Add("CD-RW"); } if(report.SCSI.MultiMediaDevice.Features.CanReadCDMRW) { - if(!mediaTypes.Contains("CD-MRW")) - mediaTypes.Add("CD-MRW"); + if(!mediaTypes.Contains("CD-MRW")) mediaTypes.Add("CD-MRW"); } if(report.SCSI.MultiMediaDevice.Features.CanReadDDCD) { - if(!mediaTypes.Contains("DDCD-ROM")) - mediaTypes.Add("DDCD-ROM"); - if(!mediaTypes.Contains("DDCD-R")) - mediaTypes.Add("DDCD-R"); - if(!mediaTypes.Contains("DDCD-RW")) - mediaTypes.Add("DDCD-RW"); + if(!mediaTypes.Contains("DDCD-ROM")) mediaTypes.Add("DDCD-ROM"); + if(!mediaTypes.Contains("DDCD-R")) mediaTypes.Add("DDCD-R"); + if(!mediaTypes.Contains("DDCD-RW")) mediaTypes.Add("DDCD-RW"); } if(report.SCSI.MultiMediaDevice.Features.CanReadDVD || - report.SCSI.MultiMediaDevice.Features.DVDMultiRead || - report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusR || - report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRDL || - report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRW || - report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRWDL) + report.SCSI.MultiMediaDevice.Features.DVDMultiRead || + report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusR || + report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRDL || + report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRW || + report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRWDL) { - if(!mediaTypes.Contains("DVD-ROM")) - mediaTypes.Add("DVD-ROM"); - if(!mediaTypes.Contains("DVD-R")) - mediaTypes.Add("DVD-R"); - if(!mediaTypes.Contains("DVD-RW")) - mediaTypes.Add("DVD-RW"); - if(!mediaTypes.Contains("DVD+R")) - mediaTypes.Add("DVD+R"); - if(!mediaTypes.Contains("DVD+RW")) - mediaTypes.Add("DVD+RW"); - if(!mediaTypes.Contains("DVD-R DL")) - mediaTypes.Add("DVD-R DL"); - if(!mediaTypes.Contains("DVD+R DL")) - mediaTypes.Add("DVD+R DL"); + if(!mediaTypes.Contains("DVD-ROM")) mediaTypes.Add("DVD-ROM"); + if(!mediaTypes.Contains("DVD-R")) mediaTypes.Add("DVD-R"); + if(!mediaTypes.Contains("DVD-RW")) mediaTypes.Add("DVD-RW"); + if(!mediaTypes.Contains("DVD+R")) mediaTypes.Add("DVD+R"); + if(!mediaTypes.Contains("DVD+RW")) mediaTypes.Add("DVD+RW"); + if(!mediaTypes.Contains("DVD-R DL")) mediaTypes.Add("DVD-R DL"); + if(!mediaTypes.Contains("DVD+R DL")) mediaTypes.Add("DVD+R DL"); } if(report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW) { - if(!mediaTypes.Contains("DVD+MRW")) - mediaTypes.Add("DVD+MRW"); + if(!mediaTypes.Contains("DVD+MRW")) mediaTypes.Add("DVD+MRW"); } - if(report.SCSI.MultiMediaDevice.Features.CanReadHDDVD || - report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR) + report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR) { - if(!mediaTypes.Contains("HD DVD-ROM")) - mediaTypes.Add("HD DVD-ROM"); - if(!mediaTypes.Contains("HD DVD-R")) - mediaTypes.Add("HD DVD-R"); - if(!mediaTypes.Contains("HD DVD-RW")) - mediaTypes.Add("HD DVD-RW"); + if(!mediaTypes.Contains("HD DVD-ROM")) mediaTypes.Add("HD DVD-ROM"); + if(!mediaTypes.Contains("HD DVD-R")) mediaTypes.Add("HD DVD-R"); + if(!mediaTypes.Contains("HD DVD-RW")) mediaTypes.Add("HD DVD-RW"); } if(report.SCSI.MultiMediaDevice.Features.CanReadHDDVDRAM) { - if(!mediaTypes.Contains("HD DVD-RAM")) - mediaTypes.Add("HD DVD-RAM"); + if(!mediaTypes.Contains("HD DVD-RAM")) mediaTypes.Add("HD DVD-RAM"); } } @@ -729,14 +744,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI // Also don't get confident, some drives didn't know CD-RW but are able to read them if(mediaTypes.Count == 0 || mediaTypes.Contains("CD-ROM")) { - if(!mediaTypes.Contains("CD-ROM")) - mediaTypes.Add("CD-ROM"); - if(!mediaTypes.Contains("Audio CD")) - mediaTypes.Add("Audio CD"); - if(!mediaTypes.Contains("CD-R")) - mediaTypes.Add("CD-R"); - if(!mediaTypes.Contains("CD-RW")) - mediaTypes.Add("CD-RW"); + if(!mediaTypes.Contains("CD-ROM")) mediaTypes.Add("CD-ROM"); + if(!mediaTypes.Contains("Audio CD")) mediaTypes.Add("Audio CD"); + if(!mediaTypes.Contains("CD-R")) mediaTypes.Add("CD-R"); + if(!mediaTypes.Contains("CD-RW")) mediaTypes.Add("CD-RW"); } mediaTypes.Sort(); @@ -776,8 +787,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.Write("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if(!sense) - break; + if(!sense) break; leftRetries--; } @@ -792,8 +802,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.Write("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if(!sense) - break; + if(!sense) break; leftRetries--; } @@ -809,19 +818,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.Write("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if(!sense) - break; + if(!sense) break; leftRetries--; } mediaTest.MediaIsRecognized &= !sense; } - else - mediaTest.MediaIsRecognized = false; + else mediaTest.MediaIsRecognized = false; } - else - mediaTest.MediaIsRecognized = false; + else mediaTest.MediaIsRecognized = false; } if(mediaTest.MediaIsRecognized) @@ -834,8 +840,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!sense && !dev.Error) { mediaTest.SupportsReadCapacity = true; - mediaTest.Blocks = (ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + (buffer[3])) + 1; - mediaTest.BlockSize = (uint)((buffer[5] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + (buffer[7])); + mediaTest.Blocks = + (ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + (buffer[3])) + 1; + mediaTest.BlockSize = + (uint)((buffer[5] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + (buffer[7])); mediaTest.BlocksSpecified = true; mediaTest.BlockSizeSpecified = true; } @@ -849,7 +857,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Array.Copy(buffer, 0, temp, 0, 8); Array.Reverse(temp); mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1; - mediaTest.BlockSize = (uint)((buffer[5] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + (buffer[7])); + mediaTest.BlockSize = + (uint)((buffer[5] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + (buffer[7])); mediaTest.BlocksSpecified = true; mediaTest.BlockSizeSpecified = true; } @@ -857,54 +866,61 @@ namespace DiscImageChef.Core.Devices.Report.SCSI decMode = null; DicConsole.WriteLine("Querying SCSI MODE SENSE (10)..."); - sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration); + sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, + ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration); if(!sense && !dev.Error) { report.SCSI.SupportsModeSense10 = true; decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType); - if(debug) - mediaTest.ModeSense10Data = buffer; + if(debug) mediaTest.ModeSense10Data = buffer; } DicConsole.WriteLine("Querying SCSI MODE SENSE..."); sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration); if(!sense && !dev.Error) { report.SCSI.SupportsModeSense6 = true; - if(!decMode.HasValue) - decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType); - if(debug) - mediaTest.ModeSense6Data = buffer; + if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType); + if(debug) mediaTest.ModeSense6Data = buffer; } if(decMode.HasValue) { mediaTest.MediumType = (byte)decMode.Value.Header.MediumType; mediaTest.MediumTypeSpecified = true; - if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) + if(decMode.Value.Header.BlockDescriptors != null && + decMode.Value.Header.BlockDescriptors.Length > 0) { mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; mediaTest.DensitySpecified = true; } } - if(mediaType.StartsWith("CD-", StringComparison.Ordinal) || mediaType.StartsWith("DDCD-", StringComparison.Ordinal) || mediaType == "Audio CD") + if(mediaType.StartsWith("CD-", StringComparison.Ordinal) || + mediaType.StartsWith("DDCD-", StringComparison.Ordinal) || mediaType == "Audio CD") { mediaTest.CanReadTOCSpecified = true; mediaTest.CanReadFullTOCSpecified = true; DicConsole.WriteLine("Querying CD TOC..."); - mediaTest.CanReadTOC = !dev.ReadTocPmaAtip(out buffer, out senseBuffer, false, 0, 0, timeout, out duration); + mediaTest.CanReadTOC = + !dev.ReadTocPmaAtip(out buffer, out senseBuffer, false, 0, 0, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadTOC); if(debug) - DataFile.WriteTo("SCSI Report", "readtoc", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readtoc", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Querying CD Full TOC..."); - mediaTest.CanReadFullTOC = !dev.ReadRawToc(out buffer, out senseBuffer, 1, timeout, out duration); + mediaTest.CanReadFullTOC = + !dev.ReadRawToc(out buffer, out senseBuffer, 1, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadFullTOC); if(debug) - DataFile.WriteTo("SCSI Report", "readfulltoc", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readfulltoc", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } - if(mediaType.StartsWith("CD-R", StringComparison.Ordinal) || mediaType.StartsWith("DDCD-R", StringComparison.Ordinal)) + if(mediaType.StartsWith("CD-R", StringComparison.Ordinal) || + mediaType.StartsWith("DDCD-R", StringComparison.Ordinal)) { mediaTest.CanReadATIPSpecified = true; mediaTest.CanReadPMASpecified = true; @@ -912,78 +928,122 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaTest.CanReadATIP = !dev.ReadAtip(out buffer, out senseBuffer, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadATIP); if(debug) - DataFile.WriteTo("SCSI Report", "atip", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "atip", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Querying CD PMA..."); mediaTest.CanReadPMA = !dev.ReadPma(out buffer, out senseBuffer, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPMA); if(debug) - DataFile.WriteTo("SCSI Report", "pma", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "pma", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } - if(mediaType.StartsWith("DVD-", StringComparison.Ordinal) || mediaType.StartsWith("HD DVD-", StringComparison.Ordinal)) + if(mediaType.StartsWith("DVD-", StringComparison.Ordinal) || + mediaType.StartsWith("HD DVD-", StringComparison.Ordinal)) { mediaTest.CanReadPFISpecified = true; mediaTest.CanReadDMISpecified = true; DicConsole.WriteLine("Querying DVD PFI..."); - mediaTest.CanReadPFI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, timeout, out duration); + mediaTest.CanReadPFI = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.PhysicalInformation, 0, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPFI); if(debug) - DataFile.WriteTo("SCSI Report", "pfi", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "pfi", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Querying DVD DMI..."); - mediaTest.CanReadDMI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, timeout, out duration); + mediaTest.CanReadDMI = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DiscManufacturingInformation, 0, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDMI); if(debug) - DataFile.WriteTo("SCSI Report", "dmi", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "dmi", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaType == "DVD-ROM") { mediaTest.CanReadCMISpecified = true; DicConsole.WriteLine("Querying DVD CMI..."); - mediaTest.CanReadCMI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.CopyrightInformation, 0, timeout, out duration); + mediaTest.CanReadCMI = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.CopyrightInformation, 0, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadCMI); if(debug) - DataFile.WriteTo("SCSI Report", "cmi", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "cmi", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaType == "DVD-ROM" || mediaType == "HD DVD-ROM") { mediaTest.CanReadBCASpecified = true; DicConsole.WriteLine("Querying DVD BCA..."); - mediaTest.CanReadBCA = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.BurstCuttingArea, 0, timeout, out duration); + mediaTest.CanReadBCA = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.BurstCuttingArea, 0, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadBCA); if(debug) - DataFile.WriteTo("SCSI Report", "bca", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "bca", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); mediaTest.CanReadAACSSpecified = true; DicConsole.WriteLine("Querying DVD AACS..."); - mediaTest.CanReadAACS = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVD_AACS, 0, timeout, out duration); + mediaTest.CanReadAACS = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVD_AACS, 0, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadAACS); if(debug) - DataFile.WriteTo("SCSI Report", "aacs", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "aacs", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaType == "BD-ROM") { mediaTest.CanReadBCASpecified = true; DicConsole.WriteLine("Querying BD BCA..."); - mediaTest.CanReadBCA = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_BurstCuttingArea, 0, timeout, out duration); + mediaTest.CanReadBCA = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.BD_BurstCuttingArea, 0, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadBCA); if(debug) - DataFile.WriteTo("SCSI Report", "bdbca", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "bdbca", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaType == "DVD-RAM" || mediaType == "HD DVD-RAM") { mediaTest.CanReadDDSSpecified = true; mediaTest.CanReadSpareAreaInformationSpecified = true; - mediaTest.CanReadDDS = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_DDS, 0, timeout, out duration); + mediaTest.CanReadDDS = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDRAM_DDS, 0, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDDS); if(debug) - DataFile.WriteTo("SCSI Report", "dds", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); - mediaTest.CanReadSpareAreaInformation = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, 0, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadSpareAreaInformation); + DataFile.WriteTo("SCSI Report", "dds", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); + mediaTest.CanReadSpareAreaInformation = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, 0, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadSpareAreaInformation); if(debug) - DataFile.WriteTo("SCSI Report", "sai", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "sai", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaType.StartsWith("BD-R", StringComparison.Ordinal) && mediaType != "BD-ROM") @@ -991,25 +1051,40 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaTest.CanReadDDSSpecified = true; mediaTest.CanReadSpareAreaInformationSpecified = true; DicConsole.WriteLine("Querying BD DDS..."); - mediaTest.CanReadDDS = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_DDS, 0, timeout, out duration); + mediaTest.CanReadDDS = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.BD_DDS, 0, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDDS); if(debug) - DataFile.WriteTo("SCSI Report", "bddds", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "bddds", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Querying BD SAI..."); - mediaTest.CanReadSpareAreaInformation = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_SpareAreaInformation, 0, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadSpareAreaInformation); + mediaTest.CanReadSpareAreaInformation = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.BD_SpareAreaInformation, 0, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadSpareAreaInformation); if(debug) - DataFile.WriteTo("SCSI Report", "bdsai", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "bdsai", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaType == "DVD-R" || mediaType == "DVD-RW") { mediaTest.CanReadPRISpecified = true; DicConsole.WriteLine("Querying DVD PRI..."); - mediaTest.CanReadPRI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PreRecordedInfo, 0, timeout, out duration); + mediaTest.CanReadPRI = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.PreRecordedInfo, 0, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPRI); if(debug) - DataFile.WriteTo("SCSI Report", "pri", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "pri", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaType == "DVD-R" || mediaType == "DVD-RW" || mediaType == "HD DVD-R") @@ -1017,15 +1092,25 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaTest.CanReadMediaIDSpecified = true; mediaTest.CanReadRecordablePFISpecified = true; DicConsole.WriteLine("Querying DVD Media ID..."); - mediaTest.CanReadMediaID = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_MediaIdentifier, 0, timeout, out duration); + mediaTest.CanReadMediaID = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDR_MediaIdentifier, 0, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadMediaID); if(debug) - DataFile.WriteTo("SCSI Report", "mediaid", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "mediaid", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Querying DVD Embossed PFI..."); - mediaTest.CanReadRecordablePFI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_PhysicalInformation, 0, timeout, out duration); + mediaTest.CanReadRecordablePFI = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDR_PhysicalInformation, 0, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadRecordablePFI); if(debug) - DataFile.WriteTo("SCSI Report", "epfi", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "epfi", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaType.StartsWith("DVD+R", StringComparison.Ordinal) || mediaType == "DVD+MRW") @@ -1033,35 +1118,53 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaTest.CanReadADIPSpecified = true; mediaTest.CanReadDCBSpecified = true; DicConsole.WriteLine("Querying DVD ADIP..."); - mediaTest.CanReadADIP = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.ADIP, 0, timeout, out duration); + mediaTest.CanReadADIP = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.ADIP, 0, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadADIP); if(debug) - DataFile.WriteTo("SCSI Report", "adip", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "adip", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Querying DVD DCB..."); - mediaTest.CanReadDCB = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DCB, 0, timeout, out duration); + mediaTest.CanReadDCB = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DCB, 0, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDCB); if(debug) - DataFile.WriteTo("SCSI Report", "dcb", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "dcb", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaType == "HD DVD-ROM") { mediaTest.CanReadHDCMISpecified = true; DicConsole.WriteLine("Querying HD DVD CMI..."); - mediaTest.CanReadHDCMI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVD_CopyrightInformation, 0, timeout, out duration); + mediaTest.CanReadHDCMI = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.HDDVD_CopyrightInformation, 0, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadHDCMI); if(debug) - DataFile.WriteTo("SCSI Report", "hdcmi", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "hdcmi", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaType.EndsWith(" DL", StringComparison.Ordinal)) { mediaTest.CanReadLayerCapacitySpecified = true; DicConsole.WriteLine("Querying DVD Layer Capacity..."); - mediaTest.CanReadLayerCapacity = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_LayerCapacity, 0, timeout, out duration); + mediaTest.CanReadLayerCapacity = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDR_LayerCapacity, 0, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadLayerCapacity); if(debug) - DataFile.WriteTo("SCSI Report", "layer", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "layer", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaType.StartsWith("BD-R", StringComparison.Ordinal)) @@ -1069,15 +1172,24 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaTest.CanReadDiscInformationSpecified = true; mediaTest.CanReadPACSpecified = true; DicConsole.WriteLine("Querying BD Disc Information..."); - mediaTest.CanReadDiscInformation = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.DiscInformation, 0, timeout, out duration); + mediaTest.CanReadDiscInformation = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.DiscInformation, 0, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDiscInformation); if(debug) - DataFile.WriteTo("SCSI Report", "di", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "di", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Querying BD PAC..."); - mediaTest.CanReadPAC = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.PAC, 0, timeout, out duration); + mediaTest.CanReadPAC = + !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.PAC, 0, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPAC); if(debug) - DataFile.WriteTo("SCSI Report", "pac", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "pac", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } mediaTest.SupportsReadSpecified = true; @@ -1086,25 +1198,37 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaTest.SupportsRead16Specified = true; DicConsole.WriteLine("Trying SCSI READ (6)..."); - mediaTest.SupportsRead = !dev.Read6(out buffer, out senseBuffer, 0, 2048, timeout, out duration); + mediaTest.SupportsRead = + !dev.Read6(out buffer, out senseBuffer, 0, 2048, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead); if(debug) - DataFile.WriteTo("SCSI Report", "read6", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "read6", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + + ".bin", "read results", buffer); DicConsole.WriteLine("Trying SCSI READ (10)..."); - mediaTest.SupportsRead10 = !dev.Read10(out buffer, out senseBuffer, 0, false, true, false, false, 0, 2048, 0, 1, timeout, out duration); + mediaTest.SupportsRead10 = !dev.Read10(out buffer, out senseBuffer, 0, false, true, false, + false, 0, 2048, 0, 1, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead10); if(debug) - DataFile.WriteTo("SCSI Report", "read10", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "read10", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + + ".bin", "read results", buffer); DicConsole.WriteLine("Trying SCSI READ (12)..."); - mediaTest.SupportsRead12 = !dev.Read12(out buffer, out senseBuffer, 0, false, true, false, false, 0, 2048, 0, 1, false, timeout, out duration); + mediaTest.SupportsRead12 = !dev.Read12(out buffer, out senseBuffer, 0, false, true, false, + false, 0, 2048, 0, 1, false, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead12); if(debug) - DataFile.WriteTo("SCSI Report", "read12", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "read12", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + + ".bin", "read results", buffer); DicConsole.WriteLine("Trying SCSI READ (16)..."); - mediaTest.SupportsRead16 = !dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0, 2048, 0, 1, false, timeout, out duration); + mediaTest.SupportsRead16 = !dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0, + 2048, 0, 1, false, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead16); if(debug) - DataFile.WriteTo("SCSI Report", "read16", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "read16", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + + ".bin", "read results", buffer); if(debug) { @@ -1113,7 +1237,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { - DicConsole.Write("Do you have want to try Plextor vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): "); + DicConsole + .Write("Do you have want to try Plextor vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } @@ -1122,7 +1247,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } } - if(mediaType.StartsWith("CD-", StringComparison.Ordinal) || mediaType.StartsWith("DDCD-", StringComparison.Ordinal) || mediaType == "Audio CD") + if(mediaType.StartsWith("CD-", StringComparison.Ordinal) || + mediaType.StartsWith("DDCD-", StringComparison.Ordinal) || mediaType == "Audio CD") { mediaTest.CanReadC2PointersSpecified = true; mediaTest.CanReadCorrectedSubchannelSpecified = true; @@ -1141,38 +1267,76 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(mediaType == "Audio CD") { DicConsole.WriteLine("Trying SCSI READ CD..."); - mediaTest.SupportsReadCd = !dev.ReadCd(out buffer, out senseBuffer, 0, 2352, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); + mediaTest.SupportsReadCd = !dev.ReadCd(out buffer, out senseBuffer, 0, 2352, 1, + MmcSectorTypes.CDDA, false, false, false, + MmcHeaderCodes.None, true, false, + MmcErrorField.None, MmcSubchannel.None, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsReadCd); if(debug) - DataFile.WriteTo("SCSI Report", "readcd", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcd", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Trying SCSI READ CD MSF..."); - mediaTest.SupportsReadCdMsf = !dev.ReadCdMsf(out buffer, out senseBuffer, 0x00000200, 0x00000201, 2352, MmcSectorTypes.CDDA, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); + mediaTest.SupportsReadCdMsf = !dev.ReadCdMsf(out buffer, out senseBuffer, 0x00000200, + 0x00000201, 2352, MmcSectorTypes.CDDA, + false, false, MmcHeaderCodes.None, true, + false, MmcErrorField.None, + MmcSubchannel.None, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsReadCdMsf); if(debug) - DataFile.WriteTo("SCSI Report", "readcdmsf", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdmsf", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } else { DicConsole.WriteLine("Trying SCSI READ CD..."); - mediaTest.SupportsReadCd = !dev.ReadCd(out buffer, out senseBuffer, 0, 2048, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); + mediaTest.SupportsReadCd = !dev.ReadCd(out buffer, out senseBuffer, 0, 2048, 1, + MmcSectorTypes.AllTypes, false, false, false, + MmcHeaderCodes.None, true, false, + MmcErrorField.None, MmcSubchannel.None, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsReadCd); if(debug) - DataFile.WriteTo("SCSI Report", "readcd", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcd", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Trying SCSI READ CD MSF..."); - mediaTest.SupportsReadCdMsf = !dev.ReadCdMsf(out buffer, out senseBuffer, 0x00000200, 0x00000201, 2048, MmcSectorTypes.AllTypes, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); + mediaTest.SupportsReadCdMsf = !dev.ReadCdMsf(out buffer, out senseBuffer, 0x00000200, + 0x00000201, 2048, MmcSectorTypes.AllTypes, + false, false, MmcHeaderCodes.None, true, + false, MmcErrorField.None, + MmcSubchannel.None, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsReadCdMsf); if(debug) - DataFile.WriteTo("SCSI Report", "readcdmsf", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdmsf", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Trying SCSI READ CD full sector..."); - mediaTest.SupportsReadCdRaw = !dev.ReadCd(out buffer, out senseBuffer, 0, 2352, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); + mediaTest.SupportsReadCdRaw = !dev.ReadCd(out buffer, out senseBuffer, 0, 2352, 1, + MmcSectorTypes.AllTypes, false, false, true, + MmcHeaderCodes.AllHeaders, true, true, + MmcErrorField.None, MmcSubchannel.None, + timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsReadCdRaw); if(debug) - DataFile.WriteTo("SCSI Report", "readcdraw", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdraw", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Trying SCSI READ CD MSF full sector..."); - mediaTest.SupportsReadCdMsfRaw = !dev.ReadCdMsf(out buffer, out senseBuffer, 0x00000200, 0x00000201, 2352, MmcSectorTypes.AllTypes, false, false, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsReadCdMsfRaw); + mediaTest.SupportsReadCdMsfRaw = !dev.ReadCdMsf(out buffer, out senseBuffer, 0x00000200, + 0x00000201, 2352, + MmcSectorTypes.AllTypes, false, false, + MmcHeaderCodes.AllHeaders, true, true, + MmcErrorField.None, MmcSubchannel.None, + timeout, out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.SupportsReadCdMsfRaw); if(debug) - DataFile.WriteTo("SCSI Report", "readcdmsfraw", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdmsfraw", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaTest.SupportsReadCdRaw || mediaType == "Audio CD") @@ -1181,12 +1345,20 @@ namespace DiscImageChef.Core.Devices.Report.SCSI for(int i = -150; i < 0; i++) { if(mediaType == "Audio CD") - sense = dev.ReadCd(out buffer, out senseBuffer, (uint)i, 2352, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); + sense = dev.ReadCd(out buffer, out senseBuffer, (uint)i, 2352, 1, + MmcSectorTypes.CDDA, false, false, false, + MmcHeaderCodes.None, true, false, MmcErrorField.None, + MmcSubchannel.None, timeout, out duration); else - sense = dev.ReadCd(out buffer, out senseBuffer, (uint)i, 2352, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); + sense = dev.ReadCd(out buffer, out senseBuffer, (uint)i, 2352, 1, + MmcSectorTypes.AllTypes, false, false, true, + MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, + MmcSubchannel.None, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", sense); if(debug) - DataFile.WriteTo("SCSI Report", "leadin", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "leadin", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); if(!sense) { mediaTest.CanReadLeadIn = true; @@ -1196,151 +1368,389 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.WriteLine("Trying to read CD Lead-Out..."); if(mediaType == "Audio CD") - mediaTest.CanReadLeadOut = !dev.ReadCd(out buffer, out senseBuffer, (uint)(mediaTest.Blocks + 1), 2352, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); + mediaTest.CanReadLeadOut = !dev.ReadCd(out buffer, out senseBuffer, + (uint)(mediaTest.Blocks + 1), 2352, 1, + MmcSectorTypes.CDDA, false, false, false, + MmcHeaderCodes.None, true, false, + MmcErrorField.None, MmcSubchannel.None, + timeout, out duration); else - mediaTest.CanReadLeadOut = !dev.ReadCd(out buffer, out senseBuffer, (uint)(mediaTest.Blocks + 1), 2352, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); + mediaTest.CanReadLeadOut = !dev.ReadCd(out buffer, out senseBuffer, + (uint)(mediaTest.Blocks + 1), 2352, 1, + MmcSectorTypes.AllTypes, false, false, true, + MmcHeaderCodes.AllHeaders, true, true, + MmcErrorField.None, MmcSubchannel.None, + timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadLeadOut); if(debug) - DataFile.WriteTo("SCSI Report", "leadout", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "leadout", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaType == "Audio CD") { DicConsole.WriteLine("Trying to read C2 Pointers..."); - mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2646, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.None, timeout, out duration); + mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2646, 1, + MmcSectorTypes.CDDA, false, false, false, + MmcHeaderCodes.None, true, false, + MmcErrorField.C2Pointers, MmcSubchannel.None, + timeout, out duration); if(!mediaTest.CanReadC2Pointers) - mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2648, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.None, timeout, out duration); + mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2648, 1, + MmcSectorTypes.CDDA, false, false, false, + MmcHeaderCodes.None, true, false, + MmcErrorField.C2PointersAndBlock, + MmcSubchannel.None, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadC2Pointers); if(debug) - DataFile.WriteTo("SCSI Report", "readcdc2", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdc2", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Trying to read subchannels..."); - mediaTest.CanReadPQSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2368, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.Q16, timeout, out duration); + mediaTest.CanReadPQSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2368, 1, + MmcSectorTypes.CDDA, false, false, false, + MmcHeaderCodes.None, true, false, + MmcErrorField.None, MmcSubchannel.Q16, + timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPQSubchannel); if(debug) - DataFile.WriteTo("SCSI Report", "readcdpq", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); - mediaTest.CanReadRWSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.Raw, timeout, out duration); + DataFile.WriteTo("SCSI Report", "readcdpq", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); + mediaTest.CanReadRWSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1, + MmcSectorTypes.CDDA, false, false, false, + MmcHeaderCodes.None, true, false, + MmcErrorField.None, MmcSubchannel.Raw, + timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadRWSubchannel); if(debug) - DataFile.WriteTo("SCSI Report", "readcdrw", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); - mediaTest.CanReadCorrectedSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.RW, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadCorrectedSubchannel); + DataFile.WriteTo("SCSI Report", "readcdrw", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); + mediaTest.CanReadCorrectedSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, + 1, MmcSectorTypes.CDDA, false, false, + false, MmcHeaderCodes.None, true, + false, MmcErrorField.None, + MmcSubchannel.RW, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadCorrectedSubchannel); if(debug) - DataFile.WriteTo("SCSI Report", "readcdsub", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdsub", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Trying to read subchannels with C2 Pointers..."); - mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2662, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Q16, timeout, out duration); + mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2662, + 1, MmcSectorTypes.CDDA, false, false, + false, MmcHeaderCodes.None, true, + false, MmcErrorField.C2Pointers, + MmcSubchannel.Q16, timeout, + out duration); if(!mediaTest.CanReadPQSubchannelWithC2) - mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2664, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.Q16, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPQSubchannelWithC2); + mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, + 2664, 1, MmcSectorTypes.CDDA, + false, false, false, + MmcHeaderCodes.None, true, false, + MmcErrorField.C2PointersAndBlock, + MmcSubchannel.Q16, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadPQSubchannelWithC2); if(debug) - DataFile.WriteTo("SCSI Report", "readcdpqc2", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdpqc2", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); - mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Raw, timeout, out duration); + mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, + 1, MmcSectorTypes.CDDA, false, false, + false, MmcHeaderCodes.None, true, + false, MmcErrorField.C2Pointers, + MmcSubchannel.Raw, timeout, + out duration); if(!mediaTest.CanReadRWSubchannelWithC2) - mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.Raw, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadRWSubchannelWithC2); + mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, + 2714, 1, MmcSectorTypes.CDDA, + false, false, false, + MmcHeaderCodes.None, true, false, + MmcErrorField.C2PointersAndBlock, + MmcSubchannel.Raw, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadRWSubchannelWithC2); if(debug) - DataFile.WriteTo("SCSI Report", "readcdrwc2", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdrwc2", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); - mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.RW, timeout, out duration); + mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, + 2712, 1, MmcSectorTypes.CDDA, + false, false, false, + MmcHeaderCodes.None, true, + false, + MmcErrorField.C2Pointers, + MmcSubchannel.RW, timeout, + out duration); if(!mediaTest.CanReadCorrectedSubchannelWithC2) - mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.RW, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadCorrectedSubchannelWithC2); + mediaTest.CanReadCorrectedSubchannelWithC2 = + !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.CDDA, false, + false, false, MmcHeaderCodes.None, true, false, + MmcErrorField.C2PointersAndBlock, MmcSubchannel.RW, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadCorrectedSubchannelWithC2); if(debug) - DataFile.WriteTo("SCSI Report", "readcdsubc2", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdsubc2", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } else if(mediaTest.SupportsReadCdRaw) { DicConsole.WriteLine("Trying to read C2 Pointers..."); - mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2646, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2Pointers, MmcSubchannel.None, timeout, out duration); + mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2646, 1, + MmcSectorTypes.AllTypes, false, false, true, + MmcHeaderCodes.AllHeaders, true, true, + MmcErrorField.C2Pointers, MmcSubchannel.None, + timeout, out duration); if(!mediaTest.CanReadC2Pointers) - mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2648, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2PointersAndBlock, MmcSubchannel.None, timeout, out duration); + mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2648, 1, + MmcSectorTypes.AllTypes, false, false, + true, MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.C2PointersAndBlock, + MmcSubchannel.None, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadC2Pointers); if(debug) - DataFile.WriteTo("SCSI Report", "readcdc2", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdc2", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Trying to read subchannels..."); - mediaTest.CanReadPQSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2368, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.Q16, timeout, out duration); + mediaTest.CanReadPQSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2368, 1, + MmcSectorTypes.AllTypes, false, false, true, + MmcHeaderCodes.AllHeaders, true, true, + MmcErrorField.None, MmcSubchannel.Q16, + timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPQSubchannel); if(debug) - DataFile.WriteTo("SCSI Report", "readcdpq", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); - mediaTest.CanReadRWSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.Raw, timeout, out duration); + DataFile.WriteTo("SCSI Report", "readcdpq", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); + mediaTest.CanReadRWSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1, + MmcSectorTypes.AllTypes, false, false, true, + MmcHeaderCodes.AllHeaders, true, true, + MmcErrorField.None, MmcSubchannel.Raw, + timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadRWSubchannel); if(debug) - DataFile.WriteTo("SCSI Report", "readcdrw", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); - mediaTest.CanReadCorrectedSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.RW, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadCorrectedSubchannel); + DataFile.WriteTo("SCSI Report", "readcdrw", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); + mediaTest.CanReadCorrectedSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, + 1, MmcSectorTypes.AllTypes, false, + false, true, + MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.None, + MmcSubchannel.RW, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadCorrectedSubchannel); if(debug) - DataFile.WriteTo("SCSI Report", "readcdsub", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdsub", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Trying to read subchannels with C2 Pointers..."); - mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2662, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2Pointers, MmcSubchannel.Q16, timeout, out duration); + mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2662, + 1, MmcSectorTypes.AllTypes, false, + false, true, + MmcHeaderCodes.AllHeaders, true, true, + MmcErrorField.C2Pointers, + MmcSubchannel.Q16, timeout, + out duration); if(!mediaTest.CanReadPQSubchannelWithC2) - mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2664, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2PointersAndBlock, MmcSubchannel.Q16, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPQSubchannelWithC2); + mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, + 2664, 1, MmcSectorTypes.AllTypes, + false, false, true, + MmcHeaderCodes.AllHeaders, true, + true, + MmcErrorField.C2PointersAndBlock, + MmcSubchannel.Q16, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadPQSubchannelWithC2); if(debug) - DataFile.WriteTo("SCSI Report", "readcdpqc2", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdpqc2", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); - mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2Pointers, MmcSubchannel.Raw, timeout, out duration); + mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, + 1, MmcSectorTypes.AllTypes, false, + false, true, + MmcHeaderCodes.AllHeaders, true, true, + MmcErrorField.C2Pointers, + MmcSubchannel.Raw, timeout, + out duration); if(!mediaTest.CanReadRWSubchannelWithC2) - mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2PointersAndBlock, MmcSubchannel.Raw, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadRWSubchannelWithC2); + mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, + 2714, 1, MmcSectorTypes.AllTypes, + false, false, true, + MmcHeaderCodes.AllHeaders, true, + true, + MmcErrorField.C2PointersAndBlock, + MmcSubchannel.Raw, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadRWSubchannelWithC2); if(debug) - DataFile.WriteTo("SCSI Report", "readcdrwc2", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdrwc2", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); - mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2Pointers, MmcSubchannel.RW, timeout, out duration); + mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, + 2712, 1, + MmcSectorTypes.AllTypes, false, + false, true, + MmcHeaderCodes.AllHeaders, + true, true, + MmcErrorField.C2Pointers, + MmcSubchannel.RW, timeout, + out duration); if(!mediaTest.CanReadCorrectedSubchannelWithC2) - mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2PointersAndBlock, MmcSubchannel.RW, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadCorrectedSubchannelWithC2); + mediaTest.CanReadCorrectedSubchannelWithC2 = + !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.AllTypes, + false, false, true, MmcHeaderCodes.AllHeaders, true, true, + MmcErrorField.C2PointersAndBlock, MmcSubchannel.RW, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadCorrectedSubchannelWithC2); if(debug) - DataFile.WriteTo("SCSI Report", "readcdsubc2", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdsubc2", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } else { DicConsole.WriteLine("Trying to read C2 Pointers..."); - mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2342, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.None, timeout, out duration); + mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2342, 1, + MmcSectorTypes.AllTypes, false, false, false, + MmcHeaderCodes.None, true, false, + MmcErrorField.C2Pointers, MmcSubchannel.None, + timeout, out duration); if(!mediaTest.CanReadC2Pointers) - mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2344, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.None, timeout, out duration); + mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2344, 1, + MmcSectorTypes.AllTypes, false, false, + false, MmcHeaderCodes.None, true, false, + MmcErrorField.C2PointersAndBlock, + MmcSubchannel.None, timeout, + out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadC2Pointers); if(debug) - DataFile.WriteTo("SCSI Report", "readcdc2", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdc2", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Trying to read subchannels..."); - mediaTest.CanReadPQSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2064, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.Q16, timeout, out duration); + mediaTest.CanReadPQSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2064, 1, + MmcSectorTypes.AllTypes, false, false, + false, MmcHeaderCodes.None, true, false, + MmcErrorField.None, MmcSubchannel.Q16, + timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPQSubchannel); if(debug) - DataFile.WriteTo("SCSI Report", "readcdpq", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); - mediaTest.CanReadRWSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2144, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.Raw, timeout, out duration); + DataFile.WriteTo("SCSI Report", "readcdpq", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); + mediaTest.CanReadRWSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2144, 1, + MmcSectorTypes.AllTypes, false, false, + false, MmcHeaderCodes.None, true, false, + MmcErrorField.None, MmcSubchannel.Raw, + timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadRWSubchannel); if(debug) - DataFile.WriteTo("SCSI Report", "readcdrw", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); - mediaTest.CanReadCorrectedSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2144, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.RW, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadCorrectedSubchannel); + DataFile.WriteTo("SCSI Report", "readcdrw", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); + mediaTest.CanReadCorrectedSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2144, + 1, MmcSectorTypes.AllTypes, false, + false, false, MmcHeaderCodes.None, + true, false, MmcErrorField.None, + MmcSubchannel.RW, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadCorrectedSubchannel); if(debug) - DataFile.WriteTo("SCSI Report", "readcdsub", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdsub", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Trying to read subchannels with C2 Pointers..."); - mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2358, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Q16, timeout, out duration); + mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2358, + 1, MmcSectorTypes.AllTypes, false, + false, false, MmcHeaderCodes.None, + true, false, MmcErrorField.C2Pointers, + MmcSubchannel.Q16, timeout, + out duration); if(!mediaTest.CanReadPQSubchannelWithC2) - mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2360, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.Q16, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPQSubchannelWithC2); + mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, + 2360, 1, MmcSectorTypes.AllTypes, + false, false, false, + MmcHeaderCodes.None, true, false, + MmcErrorField.C2PointersAndBlock, + MmcSubchannel.Q16, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadPQSubchannelWithC2); if(debug) - DataFile.WriteTo("SCSI Report", "readcdpqc2", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdpqc2", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); - mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2438, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Raw, timeout, out duration); + mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2438, + 1, MmcSectorTypes.AllTypes, false, + false, false, MmcHeaderCodes.None, + true, false, MmcErrorField.C2Pointers, + MmcSubchannel.Raw, timeout, + out duration); if(!mediaTest.CanReadRWSubchannelWithC2) - mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2440, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.Raw, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadRWSubchannelWithC2); + mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, + 2440, 1, MmcSectorTypes.AllTypes, + false, false, false, + MmcHeaderCodes.None, true, false, + MmcErrorField.C2PointersAndBlock, + MmcSubchannel.Raw, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadRWSubchannelWithC2); if(debug) - DataFile.WriteTo("SCSI Report", "readcdrwc2", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdrwc2", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); - mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2438, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.RW, timeout, out duration); + mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, + 2438, 1, + MmcSectorTypes.AllTypes, false, + false, false, + MmcHeaderCodes.None, true, + false, + MmcErrorField.C2Pointers, + MmcSubchannel.RW, timeout, + out duration); if(!mediaTest.CanReadCorrectedSubchannelWithC2) - mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2440, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.RW, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadCorrectedSubchannelWithC2); + mediaTest.CanReadCorrectedSubchannelWithC2 = + !dev.ReadCd(out buffer, out senseBuffer, 0, 2440, 1, MmcSectorTypes.AllTypes, + false, false, false, MmcHeaderCodes.None, true, false, + MmcErrorField.C2PointersAndBlock, MmcSubchannel.RW, timeout, + out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.CanReadCorrectedSubchannelWithC2); if(debug) - DataFile.WriteTo("SCSI Report", "readcdsubc2", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readcdsubc2", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(debug) @@ -1350,7 +1760,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { - DicConsole.Write("Do you have want to try NEC vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): "); + DicConsole + .Write("Do you have want to try NEC vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } @@ -1363,7 +1774,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { - DicConsole.Write("Do you have want to try Pioneer vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): "); + DicConsole + .Write("Do you have want to try Pioneer vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } @@ -1376,10 +1788,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { mediaTest.SupportsPlextorReadCDDASpecified = true; DicConsole.WriteLine("Trying Plextor READ CD-DA..."); - mediaTest.SupportsPlextorReadCDDA = !dev.PlextorReadCdDa(out buffer, out senseBuffer, 0, 2352, 1, PlextorSubchannel.None, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsPlextorReadCDDA); + mediaTest.SupportsPlextorReadCDDA = + !dev.PlextorReadCdDa(out buffer, out senseBuffer, 0, 2352, 1, + PlextorSubchannel.None, timeout, out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.SupportsPlextorReadCDDA); if(debug) - DataFile.WriteTo("SCSI Report", "plextorreadcdda", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "plextorreadcdda", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(tryPioneer) @@ -1387,38 +1804,52 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaTest.SupportsPioneerReadCDDASpecified = true; mediaTest.SupportsPioneerReadCDDAMSFSpecified = true; DicConsole.WriteLine("Trying Pioneer READ CD-DA..."); - mediaTest.SupportsPioneerReadCDDA = !dev.PioneerReadCdDa(out buffer, out senseBuffer, 0, 2352, 1, PioneerSubchannel.None, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsPioneerReadCDDA); + mediaTest.SupportsPioneerReadCDDA = + !dev.PioneerReadCdDa(out buffer, out senseBuffer, 0, 2352, 1, + PioneerSubchannel.None, timeout, out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.SupportsPioneerReadCDDA); if(debug) - DataFile.WriteTo("SCSI Report", "pioneerreadcdda", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "pioneerreadcdda", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); DicConsole.WriteLine("Trying Pioneer READ CD-DA MSF..."); - mediaTest.SupportsPioneerReadCDDAMSF = !dev.PioneerReadCdDaMsf(out buffer, out senseBuffer, 0x00000200, 0x00000201, 2352, PioneerSubchannel.None, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsPioneerReadCDDAMSF); + mediaTest.SupportsPioneerReadCDDAMSF = + !dev.PioneerReadCdDaMsf(out buffer, out senseBuffer, 0x00000200, 0x00000201, 2352, + PioneerSubchannel.None, timeout, out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.SupportsPioneerReadCDDAMSF); if(debug) - DataFile.WriteTo("SCSI Report", "pioneerreadcddamsf", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "pioneerreadcddamsf", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(tryNEC) { mediaTest.SupportsNECReadCDDASpecified = true; DicConsole.WriteLine("Trying NEC READ CD-DA..."); - mediaTest.SupportsNECReadCDDA = !dev.NecReadCdDa(out buffer, out senseBuffer, 0, 1, timeout, out duration); + mediaTest.SupportsNECReadCDDA = + !dev.NecReadCdDa(out buffer, out senseBuffer, 0, 1, timeout, out duration); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsNECReadCDDA); if(debug) - DataFile.WriteTo("SCSI Report", "necreadcdda", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "necreadcdda", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } } mediaTest.LongBlockSize = mediaTest.BlockSize; DicConsole.WriteLine("Trying SCSI READ LONG (10)..."); - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 0xFFFF, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 0xFFFF, timeout, + out duration); if(sense && !dev.Error) { Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer); if(decSense.HasValue) { if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest && - decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) + decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) { mediaTest.SupportsReadLong = true; if(decSense.Value.InformationValid && decSense.Value.ILI) @@ -1437,7 +1868,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { - DicConsole.Write("Do you have want to try HL-DT-ST (aka LG) vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): "); + DicConsole + .Write("Do you have want to try HL-DT-ST (aka LG) vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } @@ -1449,7 +1881,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) { // DVDs - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 37856, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 37856, timeout, + out duration); if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; @@ -1462,10 +1895,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { mediaTest.SupportsPlextorReadRawDVDSpecified = true; DicConsole.WriteLine("Trying Plextor trick to raw read DVDs..."); - mediaTest.SupportsPlextorReadRawDVD = !dev.PlextorReadRawDvd(out buffer, out senseBuffer, 0, 1, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsPlextorReadRawDVD); + mediaTest.SupportsPlextorReadRawDVD = + !dev.PlextorReadRawDvd(out buffer, out senseBuffer, 0, 1, timeout, out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.SupportsPlextorReadRawDVD); if(debug) - DataFile.WriteTo("SCSI Report", "plextorrawdvd", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "plextorrawdvd", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); if(mediaTest.SupportsPlextorReadRawDVD) mediaTest.SupportsPlextorReadRawDVD = !ArrayHelpers.ArrayIsNullOrEmpty(buffer); } @@ -1474,10 +1911,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { mediaTest.SupportsHLDTSTReadRawDVDSpecified = true; DicConsole.WriteLine("Trying HL-DT-ST (aka LG) trick to raw read DVDs..."); - mediaTest.SupportsHLDTSTReadRawDVD = !dev.HlDtStReadRawDvd(out buffer, out senseBuffer, 0, 1, timeout, out duration); - DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsHLDTSTReadRawDVD); + mediaTest.SupportsHLDTSTReadRawDVD = + !dev.HlDtStReadRawDvd(out buffer, out senseBuffer, 0, 1, timeout, out duration); + DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", + !mediaTest.SupportsHLDTSTReadRawDVD); if(debug) - DataFile.WriteTo("SCSI Report", "hldtstrawdvd", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "hldtstrawdvd", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) @@ -1485,7 +1926,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { - DicConsole.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): "); + DicConsole + .Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } @@ -1495,12 +1937,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI for(ushort i = (ushort)mediaTest.BlockSize; i <= ushort.MaxValue; i++) { DicConsole.Write("\rTrying to READ LONG with a size of {0} bytes...", i); - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i, timeout, + out duration); if(!sense) { if(debug) { - FileStream bingo = new FileStream(string.Format("{0}_readlong.bin", mediaType), FileMode.Create); + FileStream bingo = + new FileStream(string.Format("{0}_readlong.bin", mediaType), + FileMode.Create); bingo.Write(buffer, 0, buffer.Length); bingo.Close(); } @@ -1509,24 +1954,30 @@ namespace DiscImageChef.Core.Devices.Report.SCSI break; } - if(i == ushort.MaxValue) - break; + if(i == ushort.MaxValue) break; } + DicConsole.WriteLine(); } } - if(debug && mediaTest.SupportsReadLong && mediaTest.LongBlockSizeSpecified && mediaTest.LongBlockSize != mediaTest.BlockSize) + if(debug && mediaTest.SupportsReadLong && mediaTest.LongBlockSizeSpecified && + mediaTest.LongBlockSize != mediaTest.BlockSize) { - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, (ushort)mediaTest.LongBlockSize, timeout, out duration); + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, + (ushort)mediaTest.LongBlockSize, timeout, out duration); if(!sense) - DataFile.WriteTo("SCSI Report", "readlong10", "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + ".bin", "read results", buffer); + DataFile.WriteTo("SCSI Report", "readlong10", + "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + + mediaType + ".bin", "read results", buffer); } } + mediaTests.Add(mediaTest); } + report.SCSI.MultiMediaDevice.TestedMedia = mediaTests.ToArray(); } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs b/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs index 4ed5c322..3e16b100 100644 --- a/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs +++ b/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs @@ -42,8 +42,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { internal static void Report(Device dev, ref DeviceReport report, bool debug) { - if(report == null) - return; + if(report == null) return; byte[] senseBuffer; byte[] buffer; @@ -83,21 +82,29 @@ namespace DiscImageChef.Core.Devices.Report.SCSI sense = dev.ReportDensitySupport(out buffer, out senseBuffer, false, false, timeout, out duration); if(!sense) { - Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dsh = Decoders.SCSI.SSC.DensitySupport.DecodeDensity(buffer); + Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dsh = + Decoders.SCSI.SSC.DensitySupport.DecodeDensity(buffer); if(dsh.HasValue) { - report.SCSI.SequentialDevice.SupportedDensities = new SupportedDensity[dsh.Value.descriptors.Length]; + report.SCSI.SequentialDevice.SupportedDensities = + new SupportedDensity[dsh.Value.descriptors.Length]; for(int i = 0; i < dsh.Value.descriptors.Length; i++) { report.SCSI.SequentialDevice.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm; report.SCSI.SequentialDevice.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity; - report.SCSI.SequentialDevice.SupportedDensities[i].DefaultDensity = dsh.Value.descriptors[i].defaultDensity; - report.SCSI.SequentialDevice.SupportedDensities[i].Description = dsh.Value.descriptors[i].description; - report.SCSI.SequentialDevice.SupportedDensities[i].Duplicate = dsh.Value.descriptors[i].duplicate; + report.SCSI.SequentialDevice.SupportedDensities[i].DefaultDensity = + dsh.Value.descriptors[i].defaultDensity; + report.SCSI.SequentialDevice.SupportedDensities[i].Description = + dsh.Value.descriptors[i].description; + report.SCSI.SequentialDevice.SupportedDensities[i].Duplicate = + dsh.Value.descriptors[i].duplicate; report.SCSI.SequentialDevice.SupportedDensities[i].Name = dsh.Value.descriptors[i].name; - report.SCSI.SequentialDevice.SupportedDensities[i].Organization = dsh.Value.descriptors[i].organization; - report.SCSI.SequentialDevice.SupportedDensities[i].PrimaryCode = dsh.Value.descriptors[i].primaryCode; - report.SCSI.SequentialDevice.SupportedDensities[i].SecondaryCode = dsh.Value.descriptors[i].secondaryCode; + report.SCSI.SequentialDevice.SupportedDensities[i].Organization = + dsh.Value.descriptors[i].organization; + report.SCSI.SequentialDevice.SupportedDensities[i].PrimaryCode = + dsh.Value.descriptors[i].primaryCode; + report.SCSI.SequentialDevice.SupportedDensities[i].SecondaryCode = + dsh.Value.descriptors[i].secondaryCode; report.SCSI.SequentialDevice.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks; report.SCSI.SequentialDevice.SupportedDensities[i].Width = dsh.Value.descriptors[i].width; report.SCSI.SequentialDevice.SupportedDensities[i].Writable = dsh.Value.descriptors[i].writable; @@ -109,23 +116,30 @@ namespace DiscImageChef.Core.Devices.Report.SCSI sense = dev.ReportDensitySupport(out buffer, out senseBuffer, true, false, timeout, out duration); if(!sense) { - Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? mtsh = Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(buffer); + Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? mtsh = + Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(buffer); if(mtsh.HasValue) { - report.SCSI.SequentialDevice.SupportedMediaTypes = new SupportedMedia[mtsh.Value.descriptors.Length]; + report.SCSI.SequentialDevice.SupportedMediaTypes = + new SupportedMedia[mtsh.Value.descriptors.Length]; for(int i = 0; i < mtsh.Value.descriptors.Length; i++) { - report.SCSI.SequentialDevice.SupportedMediaTypes[i].Description = mtsh.Value.descriptors[i].description; + report.SCSI.SequentialDevice.SupportedMediaTypes[i].Description = + mtsh.Value.descriptors[i].description; report.SCSI.SequentialDevice.SupportedMediaTypes[i].Length = mtsh.Value.descriptors[i].length; - report.SCSI.SequentialDevice.SupportedMediaTypes[i].MediumType = mtsh.Value.descriptors[i].mediumType; + report.SCSI.SequentialDevice.SupportedMediaTypes[i].MediumType = + mtsh.Value.descriptors[i].mediumType; report.SCSI.SequentialDevice.SupportedMediaTypes[i].Name = mtsh.Value.descriptors[i].name; - report.SCSI.SequentialDevice.SupportedMediaTypes[i].Organization = mtsh.Value.descriptors[i].organization; + report.SCSI.SequentialDevice.SupportedMediaTypes[i].Organization = + mtsh.Value.descriptors[i].organization; report.SCSI.SequentialDevice.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width; if(mtsh.Value.descriptors[i].densityCodes != null) { - report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes = new int[mtsh.Value.descriptors[i].densityCodes.Length]; + report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes = + new int[mtsh.Value.descriptors[i].densityCodes.Length]; for(int j = 0; j < mtsh.Value.descriptors.Length; j++) - report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes[j] = mtsh.Value.descriptors[i].densityCodes[j]; + report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes[j] = + mtsh.Value.descriptors[i].densityCodes[j]; } } } @@ -174,8 +188,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.Write("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if(!sense) - break; + if(!sense) break; leftRetries--; } @@ -190,19 +203,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.Write("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if(!sense) - break; + if(!sense) break; leftRetries--; } seqTest.MediaIsRecognized &= !sense; } - else - seqTest.MediaIsRecognized = false; + else seqTest.MediaIsRecognized = false; } - else - seqTest.MediaIsRecognized = false; + else seqTest.MediaIsRecognized = false; } if(seqTest.MediaIsRecognized) @@ -210,13 +220,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI decMode = null; DicConsole.WriteLine("Querying SCSI MODE SENSE (10)..."); - sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration); + sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, + ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration); if(!sense && !dev.Error) { report.SCSI.SupportsModeSense10 = true; decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType); - if(debug) - seqTest.ModeSense10Data = buffer; + if(debug) seqTest.ModeSense10Data = buffer; } DicConsole.WriteLine("Querying SCSI MODE SENSE..."); @@ -224,17 +234,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(!sense && !dev.Error) { report.SCSI.SupportsModeSense6 = true; - if(!decMode.HasValue) - decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType); - if(debug) - seqTest.ModeSense6Data = buffer; + if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType); + if(debug) seqTest.ModeSense6Data = buffer; } if(decMode.HasValue) { seqTest.MediumType = (byte)decMode.Value.Header.MediumType; seqTest.MediumTypeSpecified = true; - if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) + if(decMode.Value.Header.BlockDescriptors != null && + decMode.Value.Header.BlockDescriptors.Length > 0) { seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; seqTest.DensitySpecified = true; @@ -246,7 +255,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI sense = dev.ReportDensitySupport(out buffer, out senseBuffer, false, true, timeout, out duration); if(!sense) { - Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dsh = Decoders.SCSI.SSC.DensitySupport.DecodeDensity(buffer); + Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dsh = + Decoders.SCSI.SSC.DensitySupport.DecodeDensity(buffer); if(dsh.HasValue) { seqTest.SupportedDensities = new SupportedDensity[dsh.Value.descriptors.Length]; @@ -272,7 +282,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI sense = dev.ReportDensitySupport(out buffer, out senseBuffer, true, true, timeout, out duration); if(!sense) { - Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? mtsh = Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(buffer); + Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? mtsh = + Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(buffer); if(mtsh.HasValue) { seqTest.SupportedMediaTypes = new SupportedMedia[mtsh.Value.descriptors.Length]; @@ -286,9 +297,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI seqTest.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width; if(mtsh.Value.descriptors[i].densityCodes != null) { - seqTest.SupportedMediaTypes[i].DensityCodes = new int[mtsh.Value.descriptors[i].densityCodes.Length]; + seqTest.SupportedMediaTypes[i].DensityCodes = + new int[mtsh.Value.descriptors[i].densityCodes.Length]; for(int j = 0; j < mtsh.Value.descriptors.Length; j++) - seqTest.SupportedMediaTypes[i].DensityCodes[j] = mtsh.Value.descriptors[i].densityCodes[j]; + seqTest.SupportedMediaTypes[i].DensityCodes[j] = + mtsh.Value.descriptors[i].densityCodes[j]; } } } @@ -296,11 +309,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI seqTest.CanReadMediaSerialSpecified = true; DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER..."); - seqTest.CanReadMediaSerial = !dev.ReadMediaSerialNumber(out buffer, out senseBuffer, timeout, out duration); + seqTest.CanReadMediaSerial = + !dev.ReadMediaSerialNumber(out buffer, out senseBuffer, timeout, out duration); seqTests.Add(seqTest); } } + report.SCSI.SequentialDevice.TestedMedia = seqTests.ToArray(); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Report/SecureDigital.cs b/DiscImageChef.Core/Devices/Report/SecureDigital.cs index e247e2be..77860ac9 100644 --- a/DiscImageChef.Core/Devices/Report/SecureDigital.cs +++ b/DiscImageChef.Core/Devices/Report/SecureDigital.cs @@ -40,13 +40,10 @@ namespace DiscImageChef.Core.Devices.Report { public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable) { - if(report == null) - return; + if(report == null) return; - if(dev.Type == DeviceType.MMC) - report.MultiMediaCard = new mmcsdType(); - else if(dev.Type == DeviceType.SecureDigital) - report.SecureDigital = new mmcsdType(); + if(dev.Type == DeviceType.MMC) report.MultiMediaCard = new mmcsdType(); + else if(dev.Type == DeviceType.SecureDigital) report.SecureDigital = new mmcsdType(); DicConsole.WriteLine("Trying to get CID..."); bool sense = dev.ReadCID(out byte[] cid, out uint[] response, dev.Timeout, out double duration); @@ -77,8 +74,7 @@ namespace DiscImageChef.Core.Devices.Report report.MultiMediaCard.CID = cid; } } - else - DicConsole.WriteLine("Could not read CID..."); + else DicConsole.WriteLine("Could not read CID..."); DicConsole.WriteLine("Trying to get CSD..."); sense = dev.ReadCSD(out byte[] csd, out response, dev.Timeout, out duration); @@ -87,13 +83,10 @@ namespace DiscImageChef.Core.Devices.Report { DicConsole.WriteLine("CSD obtained correctly..."); - if(dev.Type == DeviceType.MMC) - report.MultiMediaCard.CSD = csd; - else if(dev.Type == DeviceType.SecureDigital) - report.SecureDigital.CSD = csd; + if(dev.Type == DeviceType.MMC) report.MultiMediaCard.CSD = csd; + else if(dev.Type == DeviceType.SecureDigital) report.SecureDigital.CSD = csd; } - else - DicConsole.WriteLine("Could not read CSD..."); + else DicConsole.WriteLine("Could not read CSD..."); if(dev.Type == DeviceType.MMC) { @@ -105,8 +98,7 @@ namespace DiscImageChef.Core.Devices.Report DicConsole.WriteLine("OCR obtained correctly..."); report.MultiMediaCard.OCR = ocr; } - else - DicConsole.WriteLine("Could not read OCR..."); + else DicConsole.WriteLine("Could not read OCR..."); DicConsole.WriteLine("Trying to get Extended CSD..."); sense = dev.ReadExtendedCSD(out byte[] ecsd, out response, dev.Timeout, out duration); @@ -116,8 +108,7 @@ namespace DiscImageChef.Core.Devices.Report DicConsole.WriteLine("Extended CSD obtained correctly..."); report.MultiMediaCard.ExtendedCSD = ecsd; } - else - DicConsole.WriteLine("Could not read Extended CSD..."); + else DicConsole.WriteLine("Could not read Extended CSD..."); } else if(dev.Type == DeviceType.SecureDigital) { @@ -129,8 +120,7 @@ namespace DiscImageChef.Core.Devices.Report DicConsole.WriteLine("OCR obtained correctly..."); report.SecureDigital.OCR = ocr; } - else - DicConsole.WriteLine("Could not read OCR..."); + else DicConsole.WriteLine("Could not read OCR..."); DicConsole.WriteLine("Trying to get SCR..."); sense = dev.ReadSCR(out byte[] scr, out response, dev.Timeout, out duration); @@ -140,10 +130,8 @@ namespace DiscImageChef.Core.Devices.Report DicConsole.WriteLine("SCR obtained correctly..."); report.SecureDigital.SCR = scr; } - else - DicConsole.WriteLine("Could not read SCR..."); + else DicConsole.WriteLine("Could not read SCR..."); } - } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Report/USB.cs b/DiscImageChef.Core/Devices/Report/USB.cs index f11cfb7a..ef7ceee2 100644 --- a/DiscImageChef.Core/Devices/Report/USB.cs +++ b/DiscImageChef.Core/Devices/Report/USB.cs @@ -41,8 +41,7 @@ namespace DiscImageChef.Core.Devices.Report { public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable) { - if(report == null) - return; + if(report == null) return; ConsoleKeyInfo pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) @@ -70,9 +69,8 @@ namespace DiscImageChef.Core.Devices.Report report.USB.RemovableMedia = pressedKey.Key == ConsoleKey.Y; removable = report.USB.RemovableMedia; - if(debug) - report.USB.Descriptors = dev.USBDescriptors; + if(debug) report.USB.Descriptors = dev.USBDescriptors; } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Scanning/ATA.cs b/DiscImageChef.Core/Devices/Scanning/ATA.cs index 5d458900..094d3d61 100644 --- a/DiscImageChef.Core/Devices/Scanning/ATA.cs +++ b/DiscImageChef.Core/Devices/Scanning/ATA.cs @@ -74,6 +74,7 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.ErrorWriteLine(ataReader.ErrorMessage); return results; } + uint blockSize = ataReader.LogicalBlockSize; // Check how many blocks to read, if error show and return if(ataReader.GetBlocksToRead(64)) @@ -81,6 +82,7 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.ErrorWriteLine(ataReader.ErrorMessage); return results; } + uint blocksToRead = ataReader.BlocksToRead; ushort cylinders = ataReader.Cylinders; byte heads = ataReader.Heads; @@ -115,10 +117,7 @@ namespace DiscImageChef.Core.Devices.Scanning byte seekSc = (byte)rnd.Next(sectors); aborted = false; - System.Console.CancelKeyPress += (sender, e) => - { - e.Cancel = aborted = true; - }; + System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; }; if(ataReader.IsLBA) { @@ -130,49 +129,28 @@ namespace DiscImageChef.Core.Devices.Scanning start = DateTime.UtcNow; for(ulong i = 0; i < results.blocks; i += blocksToRead) { - if(aborted) - break; + if(aborted) break; - if((results.blocks - i) < blocksToRead) - blocksToRead = (byte)(results.blocks - i); + if((results.blocks - i) < blocksToRead) blocksToRead = (byte)(results.blocks - i); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(currentSpeed > results.maxSpeed && currentSpeed != 0) - results.maxSpeed = currentSpeed; - if(currentSpeed < results.minSpeed && currentSpeed != 0) - results.minSpeed = currentSpeed; + if(currentSpeed > results.maxSpeed && currentSpeed != 0) results.maxSpeed = currentSpeed; + if(currentSpeed < results.minSpeed && currentSpeed != 0) results.minSpeed = currentSpeed; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator - DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.blocks, currentSpeed); + DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.blocks, + currentSpeed); bool error = ataReader.ReadBlocks(out cmdBuf, i, blocksToRead, out duration); if(!error) { - if(duration >= 500) - { - results.F += blocksToRead; - } - else if(duration >= 150) - { - results.E += blocksToRead; - } - else if(duration >= 50) - { - results.D += blocksToRead; - } - else if(duration >= 10) - { - results.C += blocksToRead; - } - else if(duration >= 3) - { - results.B += blocksToRead; - } - else - { - results.A += blocksToRead; - } + if(duration >= 500) { results.F += blocksToRead; } + else if(duration >= 150) { results.E += blocksToRead; } + else if(duration >= 50) { results.D += blocksToRead; } + else if(duration >= 10) { results.C += blocksToRead; } + else if(duration >= 3) { results.B += blocksToRead; } + else { results.A += blocksToRead; } mhddLog.Write(i, duration); ibgLog.Write(i, currentSpeed * 1024); @@ -180,12 +158,10 @@ namespace DiscImageChef.Core.Devices.Scanning else { results.errored += blocksToRead; - for(ulong b = i; b < i + blocksToRead; b++) - results.unreadableSectors.Add(b); - if(duration < 500) - mhddLog.Write(i, 65535); - else - mhddLog.Write(i, duration); + for(ulong b = i; b < i + blocksToRead; b++) results.unreadableSectors.Add(b); + + if(duration < 500) mhddLog.Write(i, 65535); + else mhddLog.Write(i, duration); ibgLog.Write(i, 0); } @@ -195,19 +171,21 @@ namespace DiscImageChef.Core.Devices.Scanning #pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values GC.Collect(); } + end = DateTime.UtcNow; DicConsole.WriteLine(); mhddLog.Close(); #pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values - ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(results.blocks + 1)) / 1024) / (results.processingTime / 1000), devicePath); + ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, + (((double)blockSize * (double)(results.blocks + 1)) / 1024) / + (results.processingTime / 1000), devicePath); #pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values if(ataReader.CanSeekLBA) { for(int i = 0; i < seekTimes; i++) { - if(aborted) - break; + if(aborted) break; seekPos = (uint)rnd.Next((int)results.blocks); @@ -216,10 +194,8 @@ namespace DiscImageChef.Core.Devices.Scanning ataReader.Seek(seekPos, out seekCur); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(seekCur > results.seekMax && seekCur != 0) - results.seekMax = seekCur; - if(seekCur < results.seekMin && seekCur != 0) - results.seekMin = seekCur; + if(seekCur > results.seekMax && seekCur != 0) results.seekMax = seekCur; + if(seekCur < results.seekMin && seekCur != 0) results.seekMin = seekCur; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator results.seekTotal += seekCur; @@ -241,8 +217,7 @@ namespace DiscImageChef.Core.Devices.Scanning { for(byte Sc = 1; Sc < sectors; Sc++) { - if(aborted) - break; + if(aborted) break; #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > results.maxSpeed && currentSpeed != 0) @@ -251,36 +226,19 @@ namespace DiscImageChef.Core.Devices.Scanning results.minSpeed = currentSpeed; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator - DicConsole.Write("\rReading cylinder {0} head {1} sector {2} ({3:F3} MiB/sec.)", Cy, Hd, Sc, currentSpeed); + DicConsole.Write("\rReading cylinder {0} head {1} sector {2} ({3:F3} MiB/sec.)", Cy, Hd, + Sc, currentSpeed); bool error = ataReader.ReadCHS(out cmdBuf, Cy, Hd, Sc, out duration); if(!error) { - if(duration >= 500) - { - results.F += blocksToRead; - } - else if(duration >= 150) - { - results.E += blocksToRead; - } - else if(duration >= 50) - { - results.D += blocksToRead; - } - else if(duration >= 10) - { - results.C += blocksToRead; - } - else if(duration >= 3) - { - results.B += blocksToRead; - } - else - { - results.A += blocksToRead; - } + if(duration >= 500) { results.F += blocksToRead; } + else if(duration >= 150) { results.E += blocksToRead; } + else if(duration >= 50) { results.D += blocksToRead; } + else if(duration >= 10) { results.C += blocksToRead; } + else if(duration >= 3) { results.B += blocksToRead; } + else { results.A += blocksToRead; } mhddLog.Write(currentBlock, duration); ibgLog.Write(currentBlock, currentSpeed * 1024); @@ -289,10 +247,8 @@ namespace DiscImageChef.Core.Devices.Scanning { results.errored += blocksToRead; results.unreadableSectors.Add(currentBlock); - if(duration < 500) - mhddLog.Write(currentBlock, 65535); - else - mhddLog.Write(currentBlock, duration); + if(duration < 500) mhddLog.Write(currentBlock, 65535); + else mhddLog.Write(currentBlock, duration); ibgLog.Write(currentBlock, 0); } @@ -306,33 +262,34 @@ namespace DiscImageChef.Core.Devices.Scanning } } } + end = DateTime.UtcNow; DicConsole.WriteLine(); mhddLog.Close(); #pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values - ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(results.blocks + 1)) / 1024) / (results.processingTime / 1000), devicePath); + ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, + (((double)blockSize * (double)(results.blocks + 1)) / 1024) / + (results.processingTime / 1000), devicePath); #pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values if(ataReader.CanSeek) { for(int i = 0; i < seekTimes; i++) { - if(aborted) - break; + if(aborted) break; seekCy = (ushort)rnd.Next(cylinders); seekHd = (byte)rnd.Next(heads); seekSc = (byte)rnd.Next(sectors); - DicConsole.Write("\rSeeking to cylinder {0}, head {1}, sector {2}...\t\t", seekCy, seekHd, seekSc); + DicConsole.Write("\rSeeking to cylinder {0}, head {1}, sector {2}...\t\t", seekCy, seekHd, + seekSc); ataReader.SeekCHS(seekCy, seekHd, seekSc, out seekCur); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(seekCur > results.seekMax && seekCur != 0) - results.seekMax = seekCur; - if(seekCur < results.seekMin && seekCur != 0) - results.seekMin = seekCur; + if(seekCur > results.seekMax && seekCur != 0) results.seekMax = seekCur; + if(seekCur < results.seekMin && seekCur != 0) results.seekMin = seekCur; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator results.seekTotal += seekCur; @@ -346,7 +303,8 @@ namespace DiscImageChef.Core.Devices.Scanning results.processingTime /= 1000; results.totalTime = (end - start).TotalSeconds; #pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values - results.avgSpeed = (((double)blockSize * (double)(results.blocks + 1)) / 1048576) / results.processingTime; + results.avgSpeed = (((double)blockSize * (double)(results.blocks + 1)) / 1048576) / + results.processingTime; #pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values results.seekTimes = seekTimes; @@ -357,4 +315,4 @@ namespace DiscImageChef.Core.Devices.Scanning return results; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Scanning/NVMe.cs b/DiscImageChef.Core/Devices/Scanning/NVMe.cs index 8140e0a9..9ad89d85 100644 --- a/DiscImageChef.Core/Devices/Scanning/NVMe.cs +++ b/DiscImageChef.Core/Devices/Scanning/NVMe.cs @@ -42,4 +42,4 @@ namespace DiscImageChef.Core.Devices.Scanning throw new NotImplementedException("NVMe devices not yet supported."); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Scanning/SCSI.cs b/DiscImageChef.Core/Devices/Scanning/SCSI.cs index f4e5fadf..62cb6fb4 100644 --- a/DiscImageChef.Core/Devices/Scanning/SCSI.cs +++ b/DiscImageChef.Core/Devices/Scanning/SCSI.cs @@ -70,8 +70,7 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if(!sense) - break; + if(!sense) break; leftRetries--; } @@ -90,15 +89,15 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if(!sense) - break; + if(!sense) break; leftRetries--; } if(sense) { - DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); return results; } } @@ -111,21 +110,22 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if(!sense) - break; + if(!sense) break; leftRetries--; } if(sense) { - DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); return results; } } else { - DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); return results; } } @@ -140,11 +140,11 @@ namespace DiscImageChef.Core.Devices.Scanning Reader scsiReader = null; if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.DirectAccess || - dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice || - dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.OCRWDevice || - dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.OpticalDevice || - dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.SimplifiedDevice || - dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.WriteOnceDevice) + dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice || + dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.OCRWDevice || + dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.OpticalDevice || + dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.SimplifiedDevice || + dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.WriteOnceDevice) { scsiReader = new Reader(dev, dev.Timeout, null, false); results.blocks = scsiReader.GetDeviceBlocks(); @@ -153,6 +153,7 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.ErrorWriteLine("Unable to read medium."); return results; } + blockSize = scsiReader.LogicalBlockSize; if(results.blocks != 0 && blockSize != 0) @@ -160,7 +161,7 @@ namespace DiscImageChef.Core.Devices.Scanning results.blocks++; #pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", - results.blocks, blockSize, results.blocks * (ulong)blockSize); + results.blocks, blockSize, results.blocks * (ulong)blockSize); #pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values } } @@ -183,7 +184,8 @@ namespace DiscImageChef.Core.Devices.Scanning if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) { - sense = dev.GetConfiguration(out cmdBuf, out senseBuf, 0, MmcGetConfigurationRt.Current, dev.Timeout, out duration); + sense = dev.GetConfiguration(out cmdBuf, out senseBuf, 0, MmcGetConfigurationRt.Current, dev.Timeout, + out duration); if(!sense) { Decoders.SCSI.MMC.Features.SeparatedFeatures ftr = Decoders.SCSI.MMC.Features.Separate(cmdBuf); @@ -198,8 +200,7 @@ namespace DiscImageChef.Core.Devices.Scanning case 0x000A: case 0x0020: case 0x0021: - case 0x0022: - break; + case 0x0022: break; default: compactDisc = false; break; @@ -212,12 +213,10 @@ namespace DiscImageChef.Core.Devices.Scanning // We discarded all discs that falsify a TOC before requesting a real TOC // No TOC, no CD (or an empty one) bool tocSense = dev.ReadRawToc(out cmdBuf, out senseBuf, 1, dev.Timeout, out duration); - if(!tocSense) - toc = Decoders.CD.FullTOC.Decode(cmdBuf); + if(!tocSense) toc = Decoders.CD.FullTOC.Decode(cmdBuf); } } - else - compactDisc = false; + else compactDisc = false; byte[] readBuffer; uint blocksToRead = 64; @@ -239,10 +238,7 @@ namespace DiscImageChef.Core.Devices.Scanning results.unreadableSectors = new List(); aborted = false; - System.Console.CancelKeyPress += (sender, e) => - { - e.Cancel = aborted = true; - }; + System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; }; bool readcd = false; @@ -254,11 +250,11 @@ namespace DiscImageChef.Core.Devices.Scanning return results; } - readcd = !dev.ReadCd(out readBuffer, out senseBuf, 0, 2352, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, - true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out duration); + readcd = !dev.ReadCd(out readBuffer, out senseBuf, 0, 2352, 1, MmcSectorTypes.AllTypes, false, false, + true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, + MmcSubchannel.None, dev.Timeout, out duration); - if(readcd) - DicConsole.WriteLine("Using MMC READ CD command."); + if(readcd) DicConsole.WriteLine("Using MMC READ CD command."); start = DateTime.UtcNow; @@ -266,14 +262,13 @@ namespace DiscImageChef.Core.Devices.Scanning { if(readcd) { - sense = dev.ReadCd(out readBuffer, out senseBuf, 0, 2352, blocksToRead, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, - true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out duration); - if(dev.Error) - blocksToRead /= 2; + sense = dev.ReadCd(out readBuffer, out senseBuf, 0, 2352, blocksToRead, MmcSectorTypes.AllTypes, + false, false, true, MmcHeaderCodes.AllHeaders, true, true, + MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out duration); + if(dev.Error) blocksToRead /= 2; } - if(!dev.Error || blocksToRead == 1) - break; + if(!dev.Error || blocksToRead == 1) break; } if(dev.Error) @@ -289,63 +284,43 @@ namespace DiscImageChef.Core.Devices.Scanning for(ulong i = 0; i < results.blocks; i += blocksToRead) { - if(aborted) - break; + if(aborted) break; double cmdDuration = 0; - if((results.blocks - i) < blocksToRead) - blocksToRead = (uint)(results.blocks - i); + if((results.blocks - i) < blocksToRead) blocksToRead = (uint)(results.blocks - i); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(currentSpeed > results.maxSpeed && currentSpeed != 0) - results.maxSpeed = currentSpeed; - if(currentSpeed < results.minSpeed && currentSpeed != 0) - results.minSpeed = currentSpeed; + if(currentSpeed > results.maxSpeed && currentSpeed != 0) results.maxSpeed = currentSpeed; + if(currentSpeed < results.minSpeed && currentSpeed != 0) results.minSpeed = currentSpeed; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.blocks, currentSpeed); if(readcd) { - sense = dev.ReadCd(out readBuffer, out senseBuf, (uint)i, 2352, blocksToRead, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, - true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out cmdDuration); + sense = dev.ReadCd(out readBuffer, out senseBuf, (uint)i, 2352, blocksToRead, + MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out cmdDuration); results.processingTime += cmdDuration; } if(!sense) { - if(cmdDuration >= 500) - { - results.F += blocksToRead; - } - else if(cmdDuration >= 150) - { - results.E += blocksToRead; - } - else if(cmdDuration >= 50) - { - results.D += blocksToRead; - } - else if(cmdDuration >= 10) - { - results.C += blocksToRead; - } - else if(cmdDuration >= 3) - { - results.B += blocksToRead; - } - else - { - results.A += blocksToRead; - } + if(cmdDuration >= 500) { results.F += blocksToRead; } + else if(cmdDuration >= 150) { results.E += blocksToRead; } + else if(cmdDuration >= 50) { results.D += blocksToRead; } + else if(cmdDuration >= 10) { results.C += blocksToRead; } + else if(cmdDuration >= 3) { results.B += blocksToRead; } + else { results.A += blocksToRead; } mhddLog.Write(i, cmdDuration); ibgLog.Write(i, currentSpeed * 1024); } else { - DicConsole.DebugWriteLine("Media-Scan", "READ CD error:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Scan", "READ CD error:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); Decoders.SCSI.FixedSense? senseDecoded = Decoders.SCSI.Sense.DecodeFixed(senseBuf); if(senseDecoded.HasValue) @@ -353,17 +328,15 @@ namespace DiscImageChef.Core.Devices.Scanning // TODO: This error happens when changing from track type afaik. Need to solve that more cleanly // LOGICAL BLOCK ADDRESS OUT OF RANGE if((senseDecoded.Value.ASC != 0x21 || senseDecoded.Value.ASCQ != 0x00) && - // ILLEGAL MODE FOR THIS TRACK (requesting sectors as-is, this is a firmware misconception when audio sectors - // are in a track where subchannel indicates data) - (senseDecoded.Value.ASC != 0x64 || senseDecoded.Value.ASCQ != 0x00)) + // ILLEGAL MODE FOR THIS TRACK (requesting sectors as-is, this is a firmware misconception when audio sectors + // are in a track where subchannel indicates data) + (senseDecoded.Value.ASC != 0x64 || senseDecoded.Value.ASCQ != 0x00)) { results.errored += blocksToRead; - for(ulong b = i; b < i + blocksToRead; b++) - results.unreadableSectors.Add(b); - if(cmdDuration < 500) - mhddLog.Write(i, 65535); - else - mhddLog.Write(i, cmdDuration); + for(ulong b = i; b < i + blocksToRead; b++) results.unreadableSectors.Add(b); + + if(cmdDuration < 500) mhddLog.Write(i, 65535); + else mhddLog.Write(i, cmdDuration); ibgLog.Write(i, 0); } @@ -371,12 +344,10 @@ namespace DiscImageChef.Core.Devices.Scanning else { results.errored += blocksToRead; - for(ulong b = i; b < i + blocksToRead; b++) - results.unreadableSectors.Add(b); - if(cmdDuration < 500) - mhddLog.Write(i, 65535); - else - mhddLog.Write(i, cmdDuration); + for(ulong b = i; b < i + blocksToRead; b++) results.unreadableSectors.Add(b); + + if(cmdDuration < 500) mhddLog.Write(i, 65535); + else mhddLog.Write(i, cmdDuration); ibgLog.Write(i, 0); } @@ -387,11 +358,14 @@ namespace DiscImageChef.Core.Devices.Scanning #pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values GC.Collect(); } + end = DateTime.UtcNow; DicConsole.WriteLine(); mhddLog.Close(); #pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values - ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(results.blocks + 1)) / 1024) / (results.processingTime / 1000), devicePath); + ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, + (((double)blockSize * (double)(results.blocks + 1)) / 1024) / + (results.processingTime / 1000), devicePath); #pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values } else @@ -405,19 +379,15 @@ namespace DiscImageChef.Core.Devices.Scanning for(ulong i = 0; i < results.blocks; i += blocksToRead) { - if(aborted) - break; + if(aborted) break; double cmdDuration = 0; - if((results.blocks - i) < blocksToRead) - blocksToRead = (uint)(results.blocks - i); + if((results.blocks - i) < blocksToRead) blocksToRead = (uint)(results.blocks - i); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(currentSpeed > results.maxSpeed && currentSpeed != 0) - results.maxSpeed = currentSpeed; - if(currentSpeed < results.minSpeed && currentSpeed != 0) - results.minSpeed = currentSpeed; + if(currentSpeed > results.maxSpeed && currentSpeed != 0) results.maxSpeed = currentSpeed; + if(currentSpeed < results.minSpeed && currentSpeed != 0) results.minSpeed = currentSpeed; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.blocks, currentSpeed); @@ -427,18 +397,12 @@ namespace DiscImageChef.Core.Devices.Scanning if(!sense && !dev.Error) { - if(cmdDuration >= 500) - results.F += blocksToRead; - else if(cmdDuration >= 150) - results.E += blocksToRead; - else if(cmdDuration >= 50) - results.D += blocksToRead; - else if(cmdDuration >= 10) - results.C += blocksToRead; - else if(cmdDuration >= 3) - results.B += blocksToRead; - else - results.A += blocksToRead; + if(cmdDuration >= 500) results.F += blocksToRead; + else if(cmdDuration >= 150) results.E += blocksToRead; + else if(cmdDuration >= 50) results.D += blocksToRead; + else if(cmdDuration >= 10) results.C += blocksToRead; + else if(cmdDuration >= 3) results.B += blocksToRead; + else results.A += blocksToRead; mhddLog.Write(i, cmdDuration); ibgLog.Write(i, currentSpeed * 1024); @@ -447,12 +411,10 @@ namespace DiscImageChef.Core.Devices.Scanning else { results.errored += blocksToRead; - for(ulong b = i; b < i + blocksToRead; b++) - results.unreadableSectors.Add(b); - if(cmdDuration < 500) - mhddLog.Write(i, 65535); - else - mhddLog.Write(i, cmdDuration); + for(ulong b = i; b < i + blocksToRead; b++) results.unreadableSectors.Add(b); + + if(cmdDuration < 500) mhddLog.Write(i, 65535); + else mhddLog.Write(i, cmdDuration); ibgLog.Write(i, 0); } @@ -465,7 +427,9 @@ namespace DiscImageChef.Core.Devices.Scanning DicConsole.WriteLine(); mhddLog.Close(); #pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values - ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(results.blocks + 1)) / 1024) / (results.processingTime / 1000), devicePath); + ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, + (((double)blockSize * (double)(results.blocks + 1)) / 1024) / + (results.processingTime / 1000), devicePath); #pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values } @@ -482,23 +446,18 @@ namespace DiscImageChef.Core.Devices.Scanning for(int i = 0; i < seekTimes; i++) { - if(aborted) - break; + if(aborted) break; seekPos = (uint)rnd.Next((int)results.blocks); DicConsole.Write("\rSeeking to sector {0}...\t\t", seekPos); - if(scsiReader.CanSeek) - scsiReader.Seek(seekPos, out seekCur); - else - scsiReader.ReadBlock(out readBuffer, seekPos, out seekCur); + if(scsiReader.CanSeek) scsiReader.Seek(seekPos, out seekCur); + else scsiReader.ReadBlock(out readBuffer, seekPos, out seekCur); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(seekCur > results.seekMax && seekCur != 0) - results.seekMax = seekCur; - if(seekCur < results.seekMin && seekCur != 0) - results.seekMin = seekCur; + if(seekCur > results.seekMax && seekCur != 0) results.seekMax = seekCur; + if(seekCur < results.seekMin && seekCur != 0) results.seekMin = seekCur; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator results.seekTotal += seekCur; @@ -517,4 +476,4 @@ namespace DiscImageChef.Core.Devices.Scanning return results; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Scanning/ScanResults.cs b/DiscImageChef.Core/Devices/Scanning/ScanResults.cs index f0b52624..9419f677 100644 --- a/DiscImageChef.Core/Devices/Scanning/ScanResults.cs +++ b/DiscImageChef.Core/Devices/Scanning/ScanResults.cs @@ -55,4 +55,4 @@ namespace DiscImageChef.Core.Devices.Scanning public ulong blocks; public ulong errored; } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Scanning/SecureDigital.cs b/DiscImageChef.Core/Devices/Scanning/SecureDigital.cs index fc23315d..61ac9a91 100644 --- a/DiscImageChef.Core/Devices/Scanning/SecureDigital.cs +++ b/DiscImageChef.Core/Devices/Scanning/SecureDigital.cs @@ -93,7 +93,9 @@ namespace DiscImageChef.Core.Devices.Scanning if(!sense) { csd = Decoders.SecureDigital.Decoders.DecodeCSD(cmdBuf); - results.blocks = (ulong)(csd.Structure == 0 ? (csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2) : (csd.Size + 1) * 1024); + results.blocks = (ulong)(csd.Structure == 0 + ? (csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2) + : (csd.Size + 1) * 1024); blockSize = (uint)Math.Pow(2, csd.ReadBlockLength); // Structure >=1 for SDHC/SDXC, so that's block addressed byteAddressed = csd.Structure == 0; @@ -110,13 +112,12 @@ namespace DiscImageChef.Core.Devices.Scanning while(true) { - sense = dev.Read(out cmdBuf, out response, 0, blockSize, blocksToRead, byteAddressed, timeout, out duration); + sense = dev.Read(out cmdBuf, out response, 0, blockSize, blocksToRead, byteAddressed, timeout, + out duration); - if(sense) - blocksToRead /= 2; + if(sense) blocksToRead /= 2; - if(!sense || blocksToRead == 1) - break; + if(!sense || blocksToRead == 1) break; } if(sense) @@ -152,10 +153,7 @@ namespace DiscImageChef.Core.Devices.Scanning uint seekPos = (uint)rnd.Next((int)results.blocks); aborted = false; - System.Console.CancelKeyPress += (sender, e) => - { - e.Cancel = aborted = true; - }; + System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; }; DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead); @@ -165,49 +163,28 @@ namespace DiscImageChef.Core.Devices.Scanning start = DateTime.UtcNow; for(ulong i = 0; i < results.blocks; i += blocksToRead) { - if(aborted) - break; + if(aborted) break; - if((results.blocks - i) < blocksToRead) - blocksToRead = (byte)(results.blocks - i); + if((results.blocks - i) < blocksToRead) blocksToRead = (byte)(results.blocks - i); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(currentSpeed > results.maxSpeed && currentSpeed != 0) - results.maxSpeed = currentSpeed; - if(currentSpeed < results.minSpeed && currentSpeed != 0) - results.minSpeed = currentSpeed; + if(currentSpeed > results.maxSpeed && currentSpeed != 0) results.maxSpeed = currentSpeed; + if(currentSpeed < results.minSpeed && currentSpeed != 0) results.minSpeed = currentSpeed; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.blocks, currentSpeed); - bool error = dev.Read(out cmdBuf, out response, (uint)i, blockSize, blocksToRead, byteAddressed, timeout, out duration); + bool error = dev.Read(out cmdBuf, out response, (uint)i, blockSize, blocksToRead, byteAddressed, + timeout, out duration); if(!error) { - if(duration >= 500) - { - results.F += blocksToRead; - } - else if(duration >= 150) - { - results.E += blocksToRead; - } - else if(duration >= 50) - { - results.D += blocksToRead; - } - else if(duration >= 10) - { - results.C += blocksToRead; - } - else if(duration >= 3) - { - results.B += blocksToRead; - } - else - { - results.A += blocksToRead; - } + if(duration >= 500) { results.F += blocksToRead; } + else if(duration >= 150) { results.E += blocksToRead; } + else if(duration >= 50) { results.D += blocksToRead; } + else if(duration >= 10) { results.C += blocksToRead; } + else if(duration >= 3) { results.B += blocksToRead; } + else { results.A += blocksToRead; } mhddLog.Write(i, duration); ibgLog.Write(i, currentSpeed * 1024); @@ -215,12 +192,10 @@ namespace DiscImageChef.Core.Devices.Scanning else { results.errored += blocksToRead; - for(ulong b = i; b < i + blocksToRead; b++) - results.unreadableSectors.Add(b); - if(duration < 500) - mhddLog.Write(i, 65535); - else - mhddLog.Write(i, duration); + for(ulong b = i; b < i + blocksToRead; b++) results.unreadableSectors.Add(b); + + if(duration < 500) mhddLog.Write(i, 65535); + else mhddLog.Write(i, duration); ibgLog.Write(i, 0); } @@ -230,29 +205,30 @@ namespace DiscImageChef.Core.Devices.Scanning #pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values GC.Collect(); } + end = DateTime.UtcNow; DicConsole.WriteLine(); mhddLog.Close(); #pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values - ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(results.blocks + 1)) / 1024) / (results.processingTime / 1000), devicePath); + ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, + (((double)blockSize * (double)(results.blocks + 1)) / 1024) / (results.processingTime / 1000), + devicePath); #pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values for(int i = 0; i < seekTimes; i++) { - if(aborted) - break; + if(aborted) break; seekPos = (uint)rnd.Next((int)results.blocks); DicConsole.Write("\rSeeking to sector {0}...\t\t", seekPos); - dev.Read(out cmdBuf, out response, (uint)seekPos, blockSize, blocksToRead, byteAddressed, timeout, out seekCur); + dev.Read(out cmdBuf, out response, (uint)seekPos, blockSize, blocksToRead, byteAddressed, timeout, + out seekCur); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - if(seekCur > results.seekMax && seekCur != 0) - results.seekMax = seekCur; - if(seekCur < results.seekMin && seekCur != 0) - results.seekMin = seekCur; + if(seekCur > results.seekMax && seekCur != 0) results.seekMax = seekCur; + if(seekCur < results.seekMin && seekCur != 0) results.seekMin = seekCur; #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator results.seekTotal += seekCur; @@ -271,4 +247,4 @@ namespace DiscImageChef.Core.Devices.Scanning return results; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Filesystems.cs b/DiscImageChef.Core/Filesystems.cs index 6ebf36be..18e3454d 100644 --- a/DiscImageChef.Core/Filesystems.cs +++ b/DiscImageChef.Core/Filesystems.cs @@ -47,9 +47,8 @@ namespace DiscImageChef.Core foreach(Filesystem _plugin in plugins.PluginsList.Values) { - if(_plugin.Identify(imagePlugin, partition)) - id_plugins.Add(_plugin.Name.ToLower()); + if(_plugin.Identify(imagePlugin, partition)) id_plugins.Add(_plugin.Name.ToLower()); } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/ImageFormat.cs b/DiscImageChef.Core/ImageFormat.cs index 25541739..5f11a3ba 100644 --- a/DiscImageChef.Core/ImageFormat.cs +++ b/DiscImageChef.Core/ImageFormat.cs @@ -64,10 +64,8 @@ namespace DiscImageChef.Core } } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - catch -#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body - { - } + catch { } +#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body } } @@ -88,27 +86,18 @@ namespace DiscImageChef.Core } } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - catch + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body - { - } } } } // Still not recognized - if(_imageFormat == null) - { - return null; - } + if(_imageFormat == null) { return null; } return _imageFormat; } - catch - { - return null; - } + catch { return null; } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Core/Logging/DumpLog.cs b/DiscImageChef.Core/Logging/DumpLog.cs index 5fdf6134..6cbb9dab 100644 --- a/DiscImageChef.Core/Logging/DumpLog.cs +++ b/DiscImageChef.Core/Logging/DumpLog.cs @@ -54,21 +54,22 @@ namespace DiscImageChef.Core.Logging Type monoRunType = Type.GetType("Mono.Runtime"); logSw.WriteLine("################# System information #################"); - logSw.WriteLine("{0} {1} ({2}-bit)", Interop.DetectOS.GetPlatformName(platId, platVer), platVer, Environment.Is64BitOperatingSystem ? 64 : 32); + logSw.WriteLine("{0} {1} ({2}-bit)", Interop.DetectOS.GetPlatformName(platId, platVer), platVer, + Environment.Is64BitOperatingSystem ? 64 : 32); if(monoRunType != null) { string monoVer = "unknown version"; - MethodInfo monoDisplayName = monoRunType.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static); - if(monoDisplayName != null) - monoVer = (string)monoDisplayName.Invoke(null, null); + MethodInfo monoDisplayName = + monoRunType.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static); + if(monoDisplayName != null) monoVer = (string)monoDisplayName.Invoke(null, null); logSw.WriteLine("Mono {0}", monoVer); } - else - logSw.WriteLine(".NET Framework {0}", Environment.Version); + else logSw.WriteLine(".NET Framework {0}", Environment.Version); logSw.WriteLine(); logSw.WriteLine("################# Program information ################"); - logSw.WriteLine("DiscImageChef {0} running in {1}-bit", Version.GetVersion(), Environment.Is64BitProcess ? 64 : 32); + logSw.WriteLine("DiscImageChef {0} running in {1}-bit", Version.GetVersion(), + Environment.Is64BitProcess ? 64 : 32); #if DEBUG logSw.WriteLine("DEBUG version"); #endif @@ -131,4 +132,4 @@ namespace DiscImageChef.Core.Logging } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Logging/IBGLog.cs b/DiscImageChef.Core/Logging/IBGLog.cs index 1ff5afe4..69bb0217 100644 --- a/DiscImageChef.Core/Logging/IBGLog.cs +++ b/DiscImageChef.Core/Logging/IBGLog.cs @@ -209,9 +209,9 @@ namespace DiscImageChef.Core.Logging ibgStartSet = true; } - ibgSb.AppendFormat("{0:0.00},{1},{2:0},0", ibgIntSpeed / ibgSnaps / ibgDivider, ibgIntSector, ibgSampleRate).AppendLine(); - if((ibgIntSpeed / ibgSnaps / ibgDivider) > ibgMaxSpeed) - ibgMaxSpeed = ibgIntSpeed / ibgDivider; + ibgSb.AppendFormat("{0:0.00},{1},{2:0},0", ibgIntSpeed / ibgSnaps / ibgDivider, ibgIntSector, + ibgSampleRate).AppendLine(); + if((ibgIntSpeed / ibgSnaps / ibgDivider) > ibgMaxSpeed) ibgMaxSpeed = ibgIntSpeed / ibgDivider; ibgDatePoint = DateTime.Now; ibgIntSpeed = 0; @@ -222,19 +222,17 @@ namespace DiscImageChef.Core.Logging } } - public void Close(Device dev, ulong blocks, ulong blockSize, double totalSeconds, double currentSpeed, double averageSpeed, string devicePath) + public void Close(Device dev, ulong blocks, ulong blockSize, double totalSeconds, double currentSpeed, + double averageSpeed, string devicePath) { if(ibgFs != null) { StringBuilder ibgHeader = new StringBuilder(); string ibgBusType; - if(dev.IsUSB) - ibgBusType = "USB"; - else if(dev.IsFireWire) - ibgBusType = "FireWire"; - else - ibgBusType = dev.Type.ToString(); + if(dev.IsUSB) ibgBusType = "USB"; + else if(dev.IsFireWire) ibgBusType = "FireWire"; + else ibgBusType = dev.Type.ToString(); ibgHeader.AppendLine("IBGD"); ibgHeader.AppendLine(); @@ -246,8 +244,8 @@ namespace DiscImageChef.Core.Logging ibgHeader.AppendFormat("SAMPLE_RATE={0}", 100).AppendLine(); ibgHeader.AppendLine(); - ibgHeader.AppendFormat("DEVICE=[0:0:0] {0} {1} ({2}) ({3})", - dev.Manufacturer, dev.Model, devicePath, ibgBusType).AppendLine(); + ibgHeader.AppendFormat("DEVICE=[0:0:0] {0} {1} ({2}) ({3})", dev.Manufacturer, dev.Model, devicePath, + ibgBusType).AppendLine(); ibgHeader.AppendLine("DEVICE_ADDRESS=0:0:0"); ibgHeader.AppendFormat("DEVICE_MAKEMODEL={0} {1}", dev.Manufacturer, dev.Model).AppendLine(); ibgHeader.AppendFormat("DEVICE_FIRMWAREVERSION={0}", dev.Revision).AppendLine(); @@ -270,7 +268,8 @@ namespace DiscImageChef.Core.Logging ibgHeader.AppendLine(); ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_START={0:0.00}", ibgStartSpeed).AppendLine(); ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_END={0:0.00}", currentSpeed / ibgDivider).AppendLine(); - ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_AVERAGE={0:0.00}", averageSpeed / ibgDivider).AppendLine(); + ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_AVERAGE={0:0.00}", averageSpeed / ibgDivider) + .AppendLine(); ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_MAX={0:0.00}", ibgMaxSpeed).AppendLine(); ibgHeader.AppendFormat(ibgCulture, "VERIFY_TIME_TAKEN={0:0}", Math.Floor(totalSeconds)).AppendLine(); ibgHeader.AppendLine("[END_CONFIGURATION]"); @@ -290,6 +289,4 @@ namespace DiscImageChef.Core.Logging } } } -} - - +} \ No newline at end of file diff --git a/DiscImageChef.Core/Logging/MHDDLog.cs b/DiscImageChef.Core/Logging/MHDDLog.cs index 2ae67725..f1a0e665 100644 --- a/DiscImageChef.Core/Logging/MHDDLog.cs +++ b/DiscImageChef.Core/Logging/MHDDLog.cs @@ -83,8 +83,10 @@ namespace DiscImageChef.Core.Logging fw = string.Format("F/W: {0}", dev.Revision); sn = string.Format("S/N: {0}", dev.Serial); sectors = string.Format(new System.Globalization.CultureInfo("en-US"), "SECTORS: {0:n0}", blocks); - sectorsize = string.Format(new System.Globalization.CultureInfo("en-US"), "SECTOR SIZE: {0:n0} bytes", blockSize); - scanblocksize = string.Format(new System.Globalization.CultureInfo("en-US"), "SCAN BLOCK SIZE: {0:n0} sectors", blocksToRead); + sectorsize = string.Format(new System.Globalization.CultureInfo("en-US"), "SECTOR SIZE: {0:n0} bytes", + blockSize); + scanblocksize = string.Format(new System.Globalization.CultureInfo("en-US"), + "SCAN BLOCK SIZE: {0:n0} sectors", blocksToRead); ver = "VER:2 "; byte[] deviceBytes = Encoding.ASCII.GetBytes(device); @@ -96,11 +98,10 @@ namespace DiscImageChef.Core.Logging byte[] scanblocksizeBytes = Encoding.ASCII.GetBytes(scanblocksize); byte[] verBytes = Encoding.ASCII.GetBytes(ver); - uint Pointer = (uint)(deviceBytes.Length + modeBytes.Length + fwBytes.Length + - snBytes.Length + sectorsBytes.Length + sectorsizeBytes.Length + - scanblocksizeBytes.Length + verBytes.Length + - 2 * 9 + // New lines - 4); // Pointer + uint Pointer = (uint)(deviceBytes.Length + modeBytes.Length + fwBytes.Length + snBytes.Length + + sectorsBytes.Length + sectorsizeBytes.Length + scanblocksizeBytes.Length + + verBytes.Length + 2 * 9 + // New lines + 4); // Pointer byte[] newLine = new byte[2]; newLine[0] = 0x0D; @@ -141,10 +142,7 @@ namespace DiscImageChef.Core.Logging public void Close() { - if(mhddFs != null) - mhddFs.Close(); + if(mhddFs != null) mhddFs.Close(); } } -} - - +} \ No newline at end of file diff --git a/DiscImageChef.Core/Partitions.cs b/DiscImageChef.Core/Partitions.cs index da846181..19870c58 100644 --- a/DiscImageChef.Core/Partitions.cs +++ b/DiscImageChef.Core/Partitions.cs @@ -59,9 +59,11 @@ namespace DiscImageChef.Core if(_partplugin.GetInformation(image, out List _partitions, imagePartition.Start)) { partitions.AddRange(_partitions); - DicConsole.DebugWriteLine("Partitions", "Found {0} @ {1}", _partplugin.Name, imagePartition.Start); + DicConsole.DebugWriteLine("Partitions", "Found {0} @ {1}", _partplugin.Name, + imagePartition.Start); } } + checkedLocations.Add(imagePartition.Start); } } @@ -96,7 +98,8 @@ namespace DiscImageChef.Core DicConsole.DebugWriteLine("Partitions", "Trying {0} @ {1}", _partplugin.Name, partitions[0].Start); if(_partplugin.GetInformation(image, out List _partitions, partitions[0].Start)) { - DicConsole.DebugWriteLine("Partitions", "Found {0} @ {1}", _partplugin.Name, partitions[0].Start); + DicConsole.DebugWriteLine("Partitions", "Found {0} @ {1}", _partplugin.Name, + partitions[0].Start); childs.AddRange(_partitions); } } @@ -111,10 +114,8 @@ namespace DiscImageChef.Core foreach(Partition child in childs) { - if(checkedLocations.Contains(child.Start)) - childPartitions.Add(child); - else - partitions.Add(child); + if(checkedLocations.Contains(child.Start)) childPartitions.Add(child); + else partitions.Add(child); } } else @@ -132,39 +133,31 @@ namespace DiscImageChef.Core { List startLocations = new List(); - foreach(Partition detectedPartition in childPartitions) - startLocations.Add(detectedPartition.Start); + foreach(Partition detectedPartition in childPartitions) startLocations.Add(detectedPartition.Start); foreach(Partition imagePartition in image.GetPartitions()) { - if(!startLocations.Contains(imagePartition.Start)) - childPartitions.Add(imagePartition); + if(!startLocations.Contains(imagePartition.Start)) childPartitions.Add(imagePartition); } } - Partition[] childArray = childPartitions.OrderBy(part => part.Start).ThenBy(part => part.Length).ThenBy(part => part.Scheme).ToArray(); + Partition[] childArray = childPartitions + .OrderBy(part => part.Start).ThenBy(part => part.Length).ThenBy(part => part.Scheme).ToArray(); - for(long i = 0; i < childArray.LongLength; i++) - childArray[i].Sequence = (ulong)i; + for(long i = 0; i < childArray.LongLength; i++) childArray[i].Sequence = (ulong)i; return childArray.ToList(); } public static void AddSchemesToStats(List partitions) { - if(partitions == null || partitions.Count == 0) - return; - + if(partitions == null || partitions.Count == 0) return; + List schemes = new List(); - foreach(Partition part in partitions) - { - if(!schemes.Contains(part.Scheme)) - schemes.Add(part.Scheme); - } + foreach(Partition part in partitions) { if(!schemes.Contains(part.Scheme)) schemes.Add(part.Scheme); } - foreach(string scheme in schemes) - Statistics.AddPartition(scheme); + foreach(string scheme in schemes) Statistics.AddPartition(scheme); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/PluginBase.cs b/DiscImageChef.Core/PluginBase.cs index 1bda3526..52a22419 100644 --- a/DiscImageChef.Core/PluginBase.cs +++ b/DiscImageChef.Core/PluginBase.cs @@ -70,10 +70,7 @@ namespace DiscImageChef.Core RegisterImagePlugin(plugin); } } - catch(Exception exception) - { - DicConsole.ErrorWriteLine("Exception {0}", exception); - } + catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); } } assembly = Assembly.GetAssembly(typeof(PartPlugin)); @@ -88,10 +85,7 @@ namespace DiscImageChef.Core RegisterPartPlugin(plugin); } } - catch(Exception exception) - { - DicConsole.ErrorWriteLine("Exception {0}", exception); - } + catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); } } assembly = Assembly.GetAssembly(typeof(Filesystem)); @@ -104,16 +98,13 @@ namespace DiscImageChef.Core { Filesystem plugin; if(encoding != null) - plugin = (Filesystem)type.GetConstructor(new Type[] { encoding.GetType() }).Invoke(new object[] { encoding }); - else - plugin = (Filesystem)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { }); + plugin = (Filesystem)type.GetConstructor(new Type[] {encoding.GetType()}) + .Invoke(new object[] {encoding}); + else plugin = (Filesystem)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { }); RegisterPlugin(plugin); } } - catch(Exception exception) - { - DicConsole.ErrorWriteLine("Exception {0}", exception); - } + catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); } } } @@ -127,10 +118,7 @@ namespace DiscImageChef.Core void RegisterPlugin(Filesystem plugin) { - if(!PluginsList.ContainsKey(plugin.Name.ToLower())) - { - PluginsList.Add(plugin.Name.ToLower(), plugin); - } + if(!PluginsList.ContainsKey(plugin.Name.ToLower())) { PluginsList.Add(plugin.Name.ToLower(), plugin); } } void RegisterPartPlugin(PartPlugin partplugin) @@ -141,5 +129,4 @@ namespace DiscImageChef.Core } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Core/Properties/AssemblyInfo.cs b/DiscImageChef.Core/Properties/AssemblyInfo.cs index 3915eb01..2f2797f5 100644 --- a/DiscImageChef.Core/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Core/Properties/AssemblyInfo.cs @@ -54,4 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Core/Remote.cs b/DiscImageChef.Core/Remote.cs index bf46757c..cc9d1c7d 100644 --- a/DiscImageChef.Core/Remote.cs +++ b/DiscImageChef.Core/Remote.cs @@ -51,11 +51,13 @@ namespace DiscImageChef.Core #endif MemoryStream xmlStream = new MemoryStream(); - System.Xml.Serialization.XmlSerializer xmlSer = new System.Xml.Serialization.XmlSerializer(typeof(Metadata.DeviceReport)); + System.Xml.Serialization.XmlSerializer xmlSer = + new System.Xml.Serialization.XmlSerializer(typeof(Metadata.DeviceReport)); xmlSer.Serialize(xmlStream, report); xmlStream.Seek(0, SeekOrigin.Begin); WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadreport"); - ((HttpWebRequest)request).UserAgent = string.Format("DiscImageChef {0}", typeof(Version).Assembly.GetName().Version); + ((HttpWebRequest)request).UserAgent = + string.Format("DiscImageChef {0}", typeof(Version).Assembly.GetName().Version); request.Method = "POST"; request.ContentLength = xmlStream.Length; request.ContentType = "application/xml"; @@ -64,8 +66,7 @@ namespace DiscImageChef.Core reqStream.Close(); WebResponse response = request.GetResponse(); - if(((HttpWebResponse)response).StatusCode != HttpStatusCode.OK) - return; + if(((HttpWebResponse)response).StatusCode != HttpStatusCode.OK) return; Stream data = response.GetResponseStream(); StreamReader reader = new StreamReader(data); @@ -90,4 +91,4 @@ namespace DiscImageChef.Core submitThread.Start(); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Sidecar/AudioMedia.cs b/DiscImageChef.Core/Sidecar/AudioMedia.cs index 6a5794c3..da03c0da 100644 --- a/DiscImageChef.Core/Sidecar/AudioMedia.cs +++ b/DiscImageChef.Core/Sidecar/AudioMedia.cs @@ -40,25 +40,23 @@ namespace DiscImageChef.Core public static partial class Sidecar { // TODO: Complete it - static void AudioMedia(ImagePlugin image, System.Guid filterId, string imagePath, FileInfo fi, PluginBase plugins, List imgChecksums, ref CICMMetadataType sidecar) + static void AudioMedia(ImagePlugin image, System.Guid filterId, string imagePath, FileInfo fi, + PluginBase plugins, List imgChecksums, ref CICMMetadataType sidecar) { - sidecar.AudioMedia = new [] + sidecar.AudioMedia = new[] { - new AudioMediaType - { - Checksums = imgChecksums.ToArray(), - Image = new ImageType - { - format = image.GetImageFormat(), - offset = 0, - offsetSpecified = true, - Value = Path.GetFileName(imagePath) - }, - Size = fi.Length, - Sequence = new SequenceType - { - MediaTitle = image.GetImageName() - } + new AudioMediaType + { + Checksums = imgChecksums.ToArray(), + Image = new ImageType + { + format = image.GetImageFormat(), + offset = 0, + offsetSpecified = true, + Value = Path.GetFileName(imagePath) + }, + Size = fi.Length, + Sequence = new SequenceType {MediaTitle = image.GetImageName()} } }; @@ -74,4 +72,4 @@ namespace DiscImageChef.Core } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Sidecar/BlockMedia.cs b/DiscImageChef.Core/Sidecar/BlockMedia.cs index f0dfaff7..9137c9ca 100644 --- a/DiscImageChef.Core/Sidecar/BlockMedia.cs +++ b/DiscImageChef.Core/Sidecar/BlockMedia.cs @@ -47,25 +47,23 @@ namespace DiscImageChef.Core { public static partial class Sidecar { - static void BlockMedia(ImagePlugin image, System.Guid filterId, string imagePath, FileInfo fi, PluginBase plugins, List imgChecksums, ref CICMMetadataType sidecar) + static void BlockMedia(ImagePlugin image, System.Guid filterId, string imagePath, FileInfo fi, + PluginBase plugins, List imgChecksums, ref CICMMetadataType sidecar) { sidecar.BlockMedia = new[] { - new BlockMediaType - { - Checksums = imgChecksums.ToArray(), - Image = new ImageType - { - format = image.GetImageFormat(), - offset = 0, - offsetSpecified = true, - Value = Path.GetFileName(imagePath) - }, - Size = fi.Length, - Sequence = new SequenceType - { - MediaTitle = image.GetImageName() - } + new BlockMediaType + { + Checksums = imgChecksums.ToArray(), + Image = new ImageType + { + format = image.GetImageFormat(), + offset = 0, + offsetSpecified = true, + Value = Path.GetFileName(imagePath) + }, + Size = fi.Length, + Sequence = new SequenceType {MediaTitle = image.GetImageName()} } }; @@ -89,7 +87,8 @@ namespace DiscImageChef.Core { Identify = new DumpType { - Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY)).ToArray(), + Checksums = + Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY)).ToArray(), Size = image.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY).Length } }; @@ -99,7 +98,8 @@ namespace DiscImageChef.Core { Identify = new DumpType { - Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.ATA_IDENTIFY)).ToArray(), + Checksums = + Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.ATA_IDENTIFY)).ToArray(), Size = image.ReadDiskTag(MediaTagType.ATA_IDENTIFY).Length } }; @@ -108,11 +108,7 @@ namespace DiscImageChef.Core byte[] cis = image.ReadDiskTag(MediaTagType.PCMCIA_CIS); sidecar.BlockMedia[0].PCMCIA = new PCMCIAType { - CIS = new DumpType - { - Checksums = Checksum.GetChecksums(cis).ToArray(), - Size = cis.Length - } + CIS = new DumpType {Checksums = Checksum.GetChecksums(cis).ToArray(), Size = cis.Length} }; Tuple[] tuples = CIS.GetTuples(cis); if(tuples != null) @@ -121,7 +117,8 @@ namespace DiscImageChef.Core { if(tuple.Code == TupleCodes.CISTPL_MANFID) { - ManufacturerIdentificationTuple manfid = CIS.DecodeManufacturerIdentificationTuple(tuple); + ManufacturerIdentificationTuple manfid = + CIS.DecodeManufacturerIdentificationTuple(tuple); if(manfid != null) { @@ -139,19 +136,22 @@ namespace DiscImageChef.Core { sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer; sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product; - sidecar.BlockMedia[0].PCMCIA.Compliance = string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion); + sidecar.BlockMedia[0].PCMCIA.Compliance = + string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion); sidecar.BlockMedia[0].PCMCIA.AdditionalInformation = vers.AdditionalInformation; } } } } + break; case MediaTagType.SCSI_INQUIRY: sidecar.BlockMedia[0].SCSI = new SCSIType { Inquiry = new DumpType { - Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.SCSI_INQUIRY)).ToArray(), + Checksums = + Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.SCSI_INQUIRY)).ToArray(), Size = image.ReadDiskTag(MediaTagType.SCSI_INQUIRY).Length } }; @@ -224,7 +224,8 @@ namespace DiscImageChef.Core sidecar.BlockMedia[0].MultiMediaCard = new MultiMediaCardType(); sidecar.BlockMedia[0].MultiMediaCard.ExtendedCSD = new DumpType { - Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.MMC_ExtendedCSD)).ToArray(), + Checksums = + Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.MMC_ExtendedCSD)).ToArray(), Size = image.ReadDiskTag(MediaTagType.MMC_ExtendedCSD).Length }; break; @@ -332,17 +333,13 @@ namespace DiscImageChef.Core } } - if(lstFs.Count > 0) - sidecar.BlockMedia[0].FileSystemInformation[i].FileSystems = lstFs.ToArray(); + if(lstFs.Count > 0) sidecar.BlockMedia[0].FileSystemInformation[i].FileSystems = lstFs.ToArray(); } } else { - sidecar.BlockMedia[0].FileSystemInformation[0] = new PartitionType - { - StartSector = 0, - EndSector = (int)(image.GetSectors() - 1) - }; + sidecar.BlockMedia[0].FileSystemInformation[0] = + new PartitionType {StartSector = 0, EndSector = (int)(image.GetSectors() - 1)}; Partition wholePart = new Partition { @@ -372,8 +369,7 @@ namespace DiscImageChef.Core } } - if(lstFs.Count > 0) - sidecar.BlockMedia[0].FileSystemInformation[0].FileSystems = lstFs.ToArray(); + if(lstFs.Count > 0) sidecar.BlockMedia[0].FileSystemInformation[0].FileSystems = lstFs.ToArray(); } if(image.ImageInfo.cylinders > 0 && image.ImageInfo.heads > 0 && image.ImageInfo.sectorsPerTrack > 0) @@ -388,10 +384,12 @@ namespace DiscImageChef.Core if(image.ImageInfo.readableMediaTags.Contains(MediaTagType.ATA_IDENTIFY)) { - Decoders.ATA.Identify.IdentifyDevice? ataId = Decoders.ATA.Identify.Decode(image.ReadDiskTag(MediaTagType.ATA_IDENTIFY)); + Decoders.ATA.Identify.IdentifyDevice? ataId = + Decoders.ATA.Identify.Decode(image.ReadDiskTag(MediaTagType.ATA_IDENTIFY)); if(ataId.HasValue) { - if(ataId.Value.CurrentCylinders > 0 && ataId.Value.CurrentHeads > 0 && ataId.Value.CurrentSectorsPerTrack > 0) + if(ataId.Value.CurrentCylinders > 0 && ataId.Value.CurrentHeads > 0 && + ataId.Value.CurrentSectorsPerTrack > 0) { sidecar.BlockMedia[0].CylindersSpecified = true; sidecar.BlockMedia[0].HeadsSpecified = true; @@ -414,7 +412,7 @@ namespace DiscImageChef.Core // TODO: This is more of a hack, redo it planned for >4.0 string trkFormat = null; - + switch(image.ImageInfo.mediaType) { case MediaType.Apple32SS: @@ -506,10 +504,8 @@ namespace DiscImageChef.Core break; case MediaType.SHARP_525: case MediaType.SHARP_525_9: - case MediaType.SHARP_35: - break; - case MediaType.SHARP_35_9: - break; + case MediaType.SHARP_35: break; + case MediaType.SHARP_35_9: break; case MediaType.ECMA_99_15: case MediaType.ECMA_99_26: case MediaType.ECMA_100: @@ -536,7 +532,7 @@ namespace DiscImageChef.Core #region SuperCardPro string scpFilePath = Path.Combine(Path.GetDirectoryName(imagePath), - Path.GetFileNameWithoutExtension(imagePath) + ".scp"); + Path.GetFileNameWithoutExtension(imagePath) + ".scp"); if(File.Exists(scpFilePath)) { @@ -546,14 +542,8 @@ namespace DiscImageChef.Core if(image.ImageInfo.heads <= 2 && scpImage.IdentifyImage(scpFilter)) { - - try - { - scpImage.OpenImage(scpFilter); - } - catch(NotImplementedException) - { - } + try { scpImage.OpenImage(scpFilter); } + catch(NotImplementedException) { } if((image.ImageInfo.heads == 2 && scpImage.header.heads == 0) || (image.ImageInfo.heads == 1 && (scpImage.header.heads == 1 || scpImage.header.heads == 2))) @@ -603,22 +593,22 @@ namespace DiscImageChef.Core scpBlockTrackTypes.OrderBy(t => t.Cylinder).ThenBy(t => t.Head).ToArray(); } else - DicConsole.ErrorWriteLine( - "SuperCardPro image do not contain same number of tracks ({0}) than disk image ({1}), ignoring...", - scpImage.header.end + 1, image.ImageInfo.cylinders); + DicConsole + .ErrorWriteLine("SuperCardPro image do not contain same number of tracks ({0}) than disk image ({1}), ignoring...", + scpImage.header.end + 1, image.ImageInfo.cylinders); } else - DicConsole.ErrorWriteLine( - "SuperCardPro image do not contain same number of heads ({0}) than disk image ({1}), ignoring...", - 2, image.ImageInfo.heads); + DicConsole + .ErrorWriteLine("SuperCardPro image do not contain same number of heads ({0}) than disk image ({1}), ignoring...", + 2, image.ImageInfo.heads); } } #endregion - + #region KryoFlux string kfFile = null; string basename = Path.Combine(Path.GetDirectoryName(imagePath), - Path.GetFileNameWithoutExtension(imagePath)); + Path.GetFileNameWithoutExtension(imagePath)); bool kfDir = false; if(Directory.Exists(basename)) @@ -630,10 +620,8 @@ namespace DiscImageChef.Core kfDir = true; } } - else if(File.Exists(basename + "00.0.raw")) - kfFile = basename + "00.0.raw"; - else if(File.Exists(basename + "00.1.raw")) - kfFile = basename + "00.1.raw"; + else if(File.Exists(basename + "00.0.raw")) kfFile = basename + "00.0.raw"; + else if(File.Exists(basename + "00.1.raw")) kfFile = basename + "00.1.raw"; if(kfFile != null) { @@ -642,20 +630,15 @@ namespace DiscImageChef.Core kfFilter.Open(kfFile); if(image.ImageInfo.heads <= 2 && kfImage.IdentifyImage(kfFilter)) { - try - { - kfImage.OpenImage(kfFilter); - } - catch(NotImplementedException) - { - } + try { kfImage.OpenImage(kfFilter); } + catch(NotImplementedException) { } if(kfImage.ImageInfo.heads == image.ImageInfo.heads) { if(kfImage.ImageInfo.cylinders >= image.ImageInfo.cylinders) { List kfBlockTrackTypes = new List(); - + long currentSector = 0; foreach(KeyValuePair kvp in kfImage.tracks) @@ -667,7 +650,8 @@ namespace DiscImageChef.Core kfBlockTrackType.Image.format = kfImage.GetImageFormat(); kfBlockTrackType.Image.Value = kfDir - ? Path.Combine(Path.GetFileName(Path.GetDirectoryName(kvp.Value.GetBasePath())), kvp.Value.GetFilename()) + ? Path.Combine(Path.GetFileName(Path.GetDirectoryName(kvp.Value.GetBasePath())), + kvp.Value.GetFilename()) : kvp.Value.GetFilename(); kfBlockTrackType.Image.offset = 0; @@ -695,21 +679,21 @@ namespace DiscImageChef.Core kfBlockTrackTypes.OrderBy(t => t.Cylinder).ThenBy(t => t.Head).ToArray(); } else - DicConsole.ErrorWriteLine( - "KryoFlux image do not contain same number of tracks ({0}) than disk image ({1}), ignoring...", - kfImage.ImageInfo.cylinders, image.ImageInfo.cylinders); + DicConsole + .ErrorWriteLine("KryoFlux image do not contain same number of tracks ({0}) than disk image ({1}), ignoring...", + kfImage.ImageInfo.cylinders, image.ImageInfo.cylinders); } else - DicConsole.ErrorWriteLine( - "KryoFluximage do not contain same number of heads ({0}) than disk image ({1}), ignoring...", - kfImage.ImageInfo.heads, image.ImageInfo.heads); + DicConsole + .ErrorWriteLine("KryoFluximage do not contain same number of heads ({0}) than disk image ({1}), ignoring...", + kfImage.ImageInfo.heads, image.ImageInfo.heads); } } #endregion #region DiscFerret string dfiFilePath = Path.Combine(Path.GetDirectoryName(imagePath), - Path.GetFileNameWithoutExtension(imagePath) + ".dfi"); + Path.GetFileNameWithoutExtension(imagePath) + ".dfi"); if(File.Exists(dfiFilePath)) { @@ -719,14 +703,8 @@ namespace DiscImageChef.Core if(dfiImage.IdentifyImage(dfiFilter)) { - - try - { - dfiImage.OpenImage(dfiFilter); - } - catch(NotImplementedException) - { - } + try { dfiImage.OpenImage(dfiFilter); } + catch(NotImplementedException) { } if(image.ImageInfo.heads == dfiImage.ImageInfo.heads) { @@ -755,7 +733,8 @@ namespace DiscImageChef.Core dfiBlockTrackType.Format = trkFormat; } - if(dfiImage.trackOffsets.TryGetValue(t, out long offset) && dfiImage.trackLengths.TryGetValue(t, out long length)) + if(dfiImage.trackOffsets.TryGetValue(t, out long offset) && + dfiImage.trackLengths.TryGetValue(t, out long length)) { dfiBlockTrackType.Image.offset = offset; byte[] trackContents = new byte[length]; @@ -772,18 +751,19 @@ namespace DiscImageChef.Core dfiBlockTrackTypes.OrderBy(t => t.Cylinder).ThenBy(t => t.Head).ToArray(); } else - DicConsole.ErrorWriteLine( - "DiscFerret image do not contain same number of tracks ({0}) than disk image ({1}), ignoring...", - dfiImage.ImageInfo.cylinders, image.ImageInfo.cylinders); + DicConsole + .ErrorWriteLine("DiscFerret image do not contain same number of tracks ({0}) than disk image ({1}), ignoring...", + dfiImage.ImageInfo.cylinders, image.ImageInfo.cylinders); } else - DicConsole.ErrorWriteLine( - "DiscFerret image do not contain same number of heads ({0}) than disk image ({1}), ignoring...", - dfiImage.ImageInfo.heads, image.ImageInfo.heads); + DicConsole + .ErrorWriteLine("DiscFerret image do not contain same number of heads ({0}) than disk image ({1}), ignoring...", + dfiImage.ImageInfo.heads, image.ImageInfo.heads); } } #endregion + // TODO: Implement support for getting CHS from SCSI mode pages } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Sidecar/BlockTape.cs b/DiscImageChef.Core/Sidecar/BlockTape.cs index d5f13376..3eb8065d 100644 --- a/DiscImageChef.Core/Sidecar/BlockTape.cs +++ b/DiscImageChef.Core/Sidecar/BlockTape.cs @@ -43,36 +43,26 @@ namespace DiscImageChef.Core CICMMetadataType sidecar = new CICMMetadataType { BlockMedia = new[] - { - new BlockMediaType - { - Image = new ImageType - { - format = "Directory", - offsetSpecified = false, - Value = folderName - }, - Sequence = new SequenceType - { - MediaTitle = folderName, - MediaSequence = 1, - TotalMedia = 1 - }, - PhysicalBlockSize = (int)blockSize, - LogicalBlockSize = (int)blockSize, - TapeInformation = new [] - { - new TapePartitionType - { - Image = new ImageType - { - format = "Directory", - offsetSpecified = false, - Value = folderName - } - } - } - } + { + new BlockMediaType + { + Image = new ImageType {format = "Directory", offsetSpecified = false, Value = folderName}, + Sequence = new SequenceType {MediaTitle = folderName, MediaSequence = 1, TotalMedia = 1}, + PhysicalBlockSize = (int)blockSize, + LogicalBlockSize = (int)blockSize, + TapeInformation = new[] + { + new TapePartitionType + { + Image = new ImageType + { + format = "Directory", + offsetSpecified = false, + Value = folderName + } + } + } + } } }; @@ -112,14 +102,16 @@ namespace DiscImageChef.Core { sector = new byte[sectorsToRead * blockSize]; fs.Read(sector, 0, sector.Length); - UpdateProgress2(string.Format("Hashing block {0} of {1} on file {2} of {3}", doneSectors, sectors, i + 1, files.Count), doneSectors, sectors); + UpdateProgress2(string.Format("Hashing block {0} of {1} on file {2} of {3}", doneSectors, sectors, i + 1, files.Count), + doneSectors, sectors); doneSectors += sectorsToRead; } else { sector = new byte[(uint)(sectors - doneSectors) * blockSize]; fs.Read(sector, 0, sector.Length); - UpdateProgress2(string.Format("Hashing block {0} of {1} on file {2} of {3}", doneSectors, sectors, i + 1, files.Count), doneSectors, sectors); + UpdateProgress2(string.Format("Hashing block {0} of {1} on file {2} of {3}", doneSectors, sectors, i + 1, files.Count), + doneSectors, sectors); doneSectors += (sectors - doneSectors); } @@ -150,32 +142,19 @@ namespace DiscImageChef.Core { sidecar.BlockMedia[0].DiskType = "Quarter-inch cartridge"; - if(totalSize <= 20 * 1048576) - sidecar.BlockMedia[0].DiskSubType = "QIC-11"; - else if(totalSize <= 40 * 1048576) - sidecar.BlockMedia[0].DiskSubType = "QIC-40"; - else if(totalSize <= 60 * 1048576) - sidecar.BlockMedia[0].DiskSubType = "QIC-24"; - else if(totalSize <= 80 * 1048576) - sidecar.BlockMedia[0].DiskSubType = "QIC-80"; - else if(totalSize <= 120 * 1048576) - sidecar.BlockMedia[0].DiskSubType = "QIC-120"; - else if(totalSize <= 150 * 1048576) - sidecar.BlockMedia[0].DiskSubType = "QIC-150"; - else if(totalSize <= 320 * 1048576) - sidecar.BlockMedia[0].DiskSubType = "QIC-320"; - else if(totalSize <= 340 * 1048576) - sidecar.BlockMedia[0].DiskSubType = "QIC-3010"; - else if(totalSize <= 525 * 1048576) - sidecar.BlockMedia[0].DiskSubType = "QIC-525"; - else if(totalSize <= 670 * 1048576) - sidecar.BlockMedia[0].DiskSubType = "QIC-3020"; - else if(totalSize <= 1200 * 1048576) - sidecar.BlockMedia[0].DiskSubType = "QIC-3080"; - else if(totalSize <= 1350 * 1048576) - sidecar.BlockMedia[0].DiskSubType = "QIC-1350"; - else if(totalSize <= (long)4000 * 1048576) - sidecar.BlockMedia[0].DiskSubType = "QIC-3095"; + if(totalSize <= 20 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-11"; + else if(totalSize <= 40 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-40"; + else if(totalSize <= 60 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-24"; + else if(totalSize <= 80 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-80"; + else if(totalSize <= 120 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-120"; + else if(totalSize <= 150 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-150"; + else if(totalSize <= 320 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-320"; + else if(totalSize <= 340 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3010"; + else if(totalSize <= 525 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-525"; + else if(totalSize <= 670 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3020"; + else if(totalSize <= 1200 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3080"; + else if(totalSize <= 1350 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-1350"; + else if(totalSize <= (long)4000 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3095"; else { sidecar.BlockMedia[0].DiskType = "Unknown tape"; @@ -191,4 +170,4 @@ namespace DiscImageChef.Core return sidecar; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Sidecar/Events.cs b/DiscImageChef.Core/Sidecar/Events.cs index 19935dc6..37ae8b4c 100644 --- a/DiscImageChef.Core/Sidecar/Events.cs +++ b/DiscImageChef.Core/Sidecar/Events.cs @@ -44,8 +44,7 @@ namespace DiscImageChef.Core public static void InitProgress() { - if(InitProgressEvent != null) - InitProgressEvent(); + if(InitProgressEvent != null) InitProgressEvent(); } public static void UpdateProgress(string text, long current, long maximum) @@ -56,14 +55,12 @@ namespace DiscImageChef.Core public static void EndProgress() { - if(EndProgressEvent != null) - EndProgressEvent(); + if(EndProgressEvent != null) EndProgressEvent(); } public static void InitProgress2() { - if(InitProgressEvent2 != null) - InitProgressEvent2(); + if(InitProgressEvent2 != null) InitProgressEvent2(); } public static void UpdateProgress2(string text, long current, long maximum) @@ -74,14 +71,12 @@ namespace DiscImageChef.Core public static void EndProgress2() { - if(EndProgressEvent2 != null) - EndProgressEvent2(); + if(EndProgressEvent2 != null) EndProgressEvent2(); } public static void UpdateStatus(string text, params object[] args) { - if(UpdateStatusEvent != null) - UpdateStatusEvent(string.Format(text, args)); + if(UpdateStatusEvent != null) UpdateStatusEvent(string.Format(text, args)); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Sidecar/Helpers.cs b/DiscImageChef.Core/Sidecar/Helpers.cs index 50101faa..019ad054 100644 --- a/DiscImageChef.Core/Sidecar/Helpers.cs +++ b/DiscImageChef.Core/Sidecar/Helpers.cs @@ -84,4 +84,4 @@ namespace DiscImageChef.Core return string.Format("{3}:{0:D2}:{1:D2}:{2:D2}", m, s, f, h); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Sidecar/LinearMedia.cs b/DiscImageChef.Core/Sidecar/LinearMedia.cs index b55b224a..fa6c3e50 100644 --- a/DiscImageChef.Core/Sidecar/LinearMedia.cs +++ b/DiscImageChef.Core/Sidecar/LinearMedia.cs @@ -40,23 +40,24 @@ namespace DiscImageChef.Core public static partial class Sidecar { // TODO: Complete it - static void LinearMedia(ImagePlugin image, System.Guid filterId, string imagePath, FileInfo fi, PluginBase plugins, List imgChecksums, ref CICMMetadataType sidecar) + static void LinearMedia(ImagePlugin image, System.Guid filterId, string imagePath, FileInfo fi, + PluginBase plugins, List imgChecksums, ref CICMMetadataType sidecar) { - sidecar.LinearMedia = new [] + sidecar.LinearMedia = new[] { - new LinearMediaType - { - Checksums = imgChecksums.ToArray(), - Image = new ImageType - { - format = image.GetImageFormat(), - offset = 0, - offsetSpecified = true, - Value = Path.GetFileName(imagePath) - }, - Size = fi.Length + new LinearMediaType + { + Checksums = imgChecksums.ToArray(), + Image = new ImageType + { + format = image.GetImageFormat(), + offset = 0, + offsetSpecified = true, + Value = Path.GetFileName(imagePath) + }, + Size = fi.Length } }; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Sidecar/OpticalDisc.cs b/DiscImageChef.Core/Sidecar/OpticalDisc.cs index ea99cb89..3494fbb1 100644 --- a/DiscImageChef.Core/Sidecar/OpticalDisc.cs +++ b/DiscImageChef.Core/Sidecar/OpticalDisc.cs @@ -41,25 +41,23 @@ namespace DiscImageChef.Core { public static partial class Sidecar { - static void OpticalDisc(ImagePlugin image, System.Guid filterId, string imagePath, FileInfo fi, PluginBase plugins, List imgChecksums, ref CICMMetadataType sidecar) + static void OpticalDisc(ImagePlugin image, System.Guid filterId, string imagePath, FileInfo fi, + PluginBase plugins, List imgChecksums, ref CICMMetadataType sidecar) { sidecar.OpticalDisc = new[] { - new OpticalDiscType - { - Checksums = imgChecksums.ToArray(), - Image = new ImageType - { - format = image.GetImageFormat(), - offset = 0, - offsetSpecified = true, - Value = Path.GetFileName(imagePath) - }, - Size = fi.Length, - Sequence = new SequenceType - { - MediaTitle = image.GetImageName() - } + new OpticalDiscType + { + Checksums = imgChecksums.ToArray(), + Image = new ImageType + { + format = image.GetImageFormat(), + offset = 0, + offsetSpecified = true, + Value = Path.GetFileName(imagePath) + }, + Size = fi.Length, + Sequence = new SequenceType {MediaTitle = image.GetImageName()} } }; @@ -86,13 +84,12 @@ namespace DiscImageChef.Core Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.CD_ATIP)).ToArray(), Size = image.ReadDiskTag(MediaTagType.CD_ATIP).Length }; - Decoders.CD.ATIP.CDATIP? atip = Decoders.CD.ATIP.Decode(image.ReadDiskTag(MediaTagType.CD_ATIP)); + Decoders.CD.ATIP.CDATIP? + atip = Decoders.CD.ATIP.Decode(image.ReadDiskTag(MediaTagType.CD_ATIP)); if(atip.HasValue) { - if(atip.Value.DDCD) - dskType = atip.Value.DiscType ? MediaType.DDCDRW : MediaType.DDCDR; - else - dskType = atip.Value.DiscType ? MediaType.CDRW : MediaType.CDR; + if(atip.Value.DDCD) dskType = atip.Value.DiscType ? MediaType.DDCDRW : MediaType.DDCDR; + else dskType = atip.Value.DiscType ? MediaType.CDRW : MediaType.CDR; } break; case MediaTagType.DVD_BCA: @@ -115,7 +112,8 @@ namespace DiscImageChef.Core Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.DVD_CMI)).ToArray(), Size = image.ReadDiskTag(MediaTagType.DVD_CMI).Length }; - Decoders.DVD.CSS_CPRM.LeadInCopyright? cmi = Decoders.DVD.CSS_CPRM.DecodeLeadInCopyright(image.ReadDiskTag(MediaTagType.DVD_CMI)); + Decoders.DVD.CSS_CPRM.LeadInCopyright? cmi = + Decoders.DVD.CSS_CPRM.DecodeLeadInCopyright(image.ReadDiskTag(MediaTagType.DVD_CMI)); if(cmi.HasValue) { switch(cmi.Value.CopyrightType) @@ -131,6 +129,7 @@ namespace DiscImageChef.Core break; } } + break; case MediaTagType.DVD_DMI: sidecar.OpticalDisc[0].DMI = new DumpType @@ -141,15 +140,12 @@ namespace DiscImageChef.Core if(Decoders.Xbox.DMI.IsXbox(image.ReadDiskTag(MediaTagType.DVD_DMI))) { dskType = MediaType.XGD; - sidecar.OpticalDisc[0].Dimensions = new DimensionsType { Diameter = 120 }; + sidecar.OpticalDisc[0].Dimensions = new DimensionsType {Diameter = 120}; } else if(Decoders.Xbox.DMI.IsXbox360(image.ReadDiskTag(MediaTagType.DVD_DMI))) { dskType = MediaType.XGD2; - sidecar.OpticalDisc[0].Dimensions = new DimensionsType - { - Diameter = 120 - }; + sidecar.OpticalDisc[0].Dimensions = new DimensionsType {Diameter = 120}; } break; case MediaTagType.DVD_PFI: @@ -158,12 +154,11 @@ namespace DiscImageChef.Core Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.DVD_PFI)).ToArray(), Size = image.ReadDiskTag(MediaTagType.DVD_PFI).Length }; - Decoders.DVD.PFI.PhysicalFormatInformation? pfi = Decoders.DVD.PFI.Decode(image.ReadDiskTag(MediaTagType.DVD_PFI)); + Decoders.DVD.PFI.PhysicalFormatInformation? pfi = + Decoders.DVD.PFI.Decode(image.ReadDiskTag(MediaTagType.DVD_PFI)); if(pfi.HasValue) { - if(dskType != MediaType.XGD && - dskType != MediaType.XGD2 && - dskType != MediaType.XGD3) + if(dskType != MediaType.XGD && dskType != MediaType.XGD2 && dskType != MediaType.XGD3) { switch(pfi.Value.DiskCategory) { @@ -211,22 +206,21 @@ namespace DiscImageChef.Core break; } - if(dskType == MediaType.DVDR && pfi.Value.PartVersion == 6) - dskType = MediaType.DVDRDL; + if(dskType == MediaType.DVDR && pfi.Value.PartVersion == 6) dskType = MediaType.DVDRDL; if(dskType == MediaType.DVDRW && pfi.Value.PartVersion == 3) dskType = MediaType.DVDRWDL; if(dskType == MediaType.GOD && pfi.Value.DiscSize == Decoders.DVD.DVDSize.OneTwenty) dskType = MediaType.WOD; sidecar.OpticalDisc[0].Dimensions = new DimensionsType(); - if(dskType == MediaType.UMD) - sidecar.OpticalDisc[0].Dimensions.Diameter = 60; + if(dskType == MediaType.UMD) sidecar.OpticalDisc[0].Dimensions.Diameter = 60; else if(pfi.Value.DiscSize == Decoders.DVD.DVDSize.Eighty) sidecar.OpticalDisc[0].Dimensions.Diameter = 80; else if(pfi.Value.DiscSize == Decoders.DVD.DVDSize.OneTwenty) sidecar.OpticalDisc[0].Dimensions.Diameter = 120; } } + break; case MediaTagType.CD_PMA: sidecar.OpticalDisc[0].PMA = new DumpType @@ -243,10 +237,7 @@ namespace DiscImageChef.Core List sessions = image.GetSessions(); sidecar.OpticalDisc[0].Sessions = sessions != null ? sessions.Count : 1; } - catch - { - sidecar.OpticalDisc[0].Sessions = 1; - } + catch { sidecar.OpticalDisc[0].Sessions = 1; } List tracks = image.GetTracks(); List trksLst = null; @@ -297,24 +288,21 @@ namespace DiscImageChef.Core xmlTrk.TrackType1 = TrackTypeTrackType.mode1; break; } + break; } - xmlTrk.Sequence = new TrackSequenceType - { - Session = trk.TrackSession, - TrackNumber = (int)trk.TrackSequence - }; + + xmlTrk.Sequence = + new TrackSequenceType {Session = trk.TrackSession, TrackNumber = (int)trk.TrackSequence}; xmlTrk.StartSector = (long)trk.TrackStartSector; xmlTrk.EndSector = (long)trk.TrackEndSector; if(trk.Indexes != null && trk.Indexes.ContainsKey(0)) { - if(trk.Indexes.TryGetValue(0, out ulong idx0)) - xmlTrk.StartSector = (long)idx0; + if(trk.Indexes.TryGetValue(0, out ulong idx0)) xmlTrk.StartSector = (long)idx0; } - if(sidecar.OpticalDisc[0].DiscType == "CD" || - sidecar.OpticalDisc[0].DiscType == "GD") + if(sidecar.OpticalDisc[0].DiscType == "CD" || sidecar.OpticalDisc[0].DiscType == "GD") { xmlTrk.StartMSF = LbaToMsf(xmlTrk.StartSector); xmlTrk.EndMSF = LbaToMsf(xmlTrk.EndSector); @@ -325,11 +313,7 @@ namespace DiscImageChef.Core xmlTrk.EndMSF = DdcdLbaToMsf(xmlTrk.EndSector); } - xmlTrk.Image = new ImageType - { - Value = Path.GetFileName(trk.TrackFile), - format = trk.TrackFileType - }; + xmlTrk.Image = new ImageType {Value = Path.GetFileName(trk.TrackFile), format = trk.TrackFileType}; if(trk.TrackFileOffset > 0) { @@ -369,14 +353,18 @@ namespace DiscImageChef.Core if((sectors - doneSectors) >= sectorsToRead) { - sector = image.ReadSectorsLong(doneSectors, sectorsToRead, (uint)xmlTrk.Sequence.TrackNumber); - UpdateProgress2("Hashings sector {0} of {1}", (long)doneSectors, (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); + sector = image.ReadSectorsLong(doneSectors, sectorsToRead, + (uint)xmlTrk.Sequence.TrackNumber); + UpdateProgress2("Hashings sector {0} of {1}", (long)doneSectors, + (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); doneSectors += sectorsToRead; } else { - sector = image.ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors), (uint)xmlTrk.Sequence.TrackNumber); - UpdateProgress2("Hashings sector {0} of {1}", (long)doneSectors, (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); + sector = image.ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors), + (uint)xmlTrk.Sequence.TrackNumber); + UpdateProgress2("Hashings sector {0} of {1}", (long)doneSectors, + (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); doneSectors += (sectors - doneSectors); } @@ -394,10 +382,7 @@ namespace DiscImageChef.Core { xmlTrk.SubChannel = new SubChannelType { - Image = new ImageType - { - Value = trk.TrackSubchannelFile - }, + Image = new ImageType {Value = trk.TrackSubchannelFile}, // TODO: Packed subchannel has different size? Size = (xmlTrk.EndSector - xmlTrk.StartSector + 1) * 96 }; @@ -436,14 +421,19 @@ namespace DiscImageChef.Core if((sectors - doneSectors) >= sectorsToRead) { - sector = image.ReadSectorsTag(doneSectors, sectorsToRead, (uint)xmlTrk.Sequence.TrackNumber, SectorTagType.CDSectorSubchannel); - UpdateProgress2("Hashings subchannel sector {0} of {1}", (long)doneSectors, (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); + sector = image.ReadSectorsTag(doneSectors, sectorsToRead, (uint)xmlTrk.Sequence.TrackNumber, + SectorTagType.CDSectorSubchannel); + UpdateProgress2("Hashings subchannel sector {0} of {1}", (long)doneSectors, + (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); doneSectors += sectorsToRead; } else { - sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors), (uint)xmlTrk.Sequence.TrackNumber, SectorTagType.CDSectorSubchannel); - UpdateProgress2("Hashings subchannel sector {0} of {1}", (long)doneSectors, (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); + sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors), + (uint)xmlTrk.Sequence.TrackNumber, + SectorTagType.CDSectorSubchannel); + UpdateProgress2("Hashings subchannel sector {0} of {1}", (long)doneSectors, + (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); doneSectors += (sectors - doneSectors); } @@ -460,7 +450,8 @@ namespace DiscImageChef.Core // For fast debugging, skip checksum //skipChecksum: - UpdateStatus("Checking filesystems on track {0} from sector {1} to {2}", xmlTrk.Sequence.TrackNumber, xmlTrk.StartSector, xmlTrk.EndSector); + UpdateStatus("Checking filesystems on track {0} from sector {1} to {2}", xmlTrk.Sequence.TrackNumber, + xmlTrk.StartSector, xmlTrk.EndSector); List partitions = Partitions.GetAll(image); Partitions.AddSchemesToStats(partitions); @@ -492,12 +483,10 @@ namespace DiscImageChef.Core lstFs.Add(_plugin.XmlFSType); Statistics.AddFilesystem(_plugin.XmlFSType.Type); - if(_plugin.XmlFSType.Type == "Opera") - dskType = MediaType.ThreeDO; + if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO; if(_plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2; - if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") - dskType = MediaType.WOD; + if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD; if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD; } @@ -510,8 +499,7 @@ namespace DiscImageChef.Core } } - if(lstFs.Count > 0) - xmlTrk.FileSystemInformation[i].FileSystems = lstFs.ToArray(); + if(lstFs.Count > 0) xmlTrk.FileSystemInformation[i].FileSystems = lstFs.ToArray(); } } else @@ -541,14 +529,10 @@ namespace DiscImageChef.Core lstFs.Add(_plugin.XmlFSType); Statistics.AddFilesystem(_plugin.XmlFSType.Type); - if(_plugin.XmlFSType.Type == "Opera") - dskType = MediaType.ThreeDO; - if(_plugin.XmlFSType.Type == "PC Engine filesystem") - dskType = MediaType.SuperCDROM2; - if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") - dskType = MediaType.WOD; - if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") - dskType = MediaType.GOD; + if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO; + if(_plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2; + if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD; + if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD; } } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body @@ -559,21 +543,21 @@ namespace DiscImageChef.Core } } - if(lstFs.Count > 0) - xmlTrk.FileSystemInformation[0].FileSystems = lstFs.ToArray(); + if(lstFs.Count > 0) xmlTrk.FileSystemInformation[0].FileSystems = lstFs.ToArray(); } trksLst.Add(xmlTrk); } + EndProgress(); - if(trksLst != null) - sidecar.OpticalDisc[0].Track = trksLst.ToArray(); + if(trksLst != null) sidecar.OpticalDisc[0].Track = trksLst.ToArray(); // All XGD3 all have the same number of blocks if(dskType == MediaType.XGD2 && sidecar.OpticalDisc[0].Track.Length == 1) { - ulong blocks = (ulong)(sidecar.OpticalDisc[0].Track[0].EndSector - sidecar.OpticalDisc[0].Track[0].StartSector + 1); + ulong blocks = (ulong)(sidecar.OpticalDisc[0].Track[0].EndSector - + sidecar.OpticalDisc[0].Track[0].StartSector + 1); if(blocks == 25063 || // Locked (or non compatible drive) blocks == 4229664 || // Xtreme unlock blocks == 4246304) // Wxripper unlock @@ -594,14 +578,7 @@ namespace DiscImageChef.Core { new DumpHardwareType { - Extents = new[] - { - new ExtentType - { - Start = 0, - End = image.ImageInfo.sectors - } - }, + Extents = new[] {new ExtentType {Start = 0, End = image.ImageInfo.sectors}}, Manufacturer = image.ImageInfo.driveManufacturer, Model = image.ImageInfo.driveModel, Firmware = image.ImageInfo.driveFirmwareRevision, @@ -616,4 +593,4 @@ namespace DiscImageChef.Core } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Sidecar/Sidecar.cs b/DiscImageChef.Core/Sidecar/Sidecar.cs index ddd63ca9..87f166b4 100644 --- a/DiscImageChef.Core/Sidecar/Sidecar.cs +++ b/DiscImageChef.Core/Sidecar/Sidecar.cs @@ -39,7 +39,8 @@ namespace DiscImageChef.Core { public static partial class Sidecar { - public static CICMMetadataType Create(ImagePlugin image, string imagePath, System.Guid filterId, System.Text.Encoding encoding) + public static CICMMetadataType Create(ImagePlugin image, string imagePath, System.Guid filterId, + System.Text.Encoding encoding) { CICMMetadataType sidecar = new CICMMetadataType(); PluginBase plugins = new PluginBase(); @@ -102,4 +103,4 @@ namespace DiscImageChef.Core return sidecar; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/Statistics.cs b/DiscImageChef.Core/Statistics.cs index adc30328..6fa52cb7 100644 --- a/DiscImageChef.Core/Statistics.cs +++ b/DiscImageChef.Core/Statistics.cs @@ -54,14 +54,17 @@ namespace DiscImageChef.Core AllStats = new Stats(); CurrentStats = new Stats() { - OperatingSystems = new List - { - new OsStats { name = Interop.DetectOS.GetRealPlatformID().ToString(), Value = 1, version = Interop.DetectOS.GetVersion() } - }, - Versions = new List - { - new NameValueStats{ name = Version.GetVersion(), Value = 1 } - } + OperatingSystems = + new List + { + new OsStats + { + name = Interop.DetectOS.GetRealPlatformID().ToString(), + Value = 1, + version = Interop.DetectOS.GetVersion() + } + }, + Versions = new List {new NameValueStats {name = Version.GetVersion(), Value = 1}} }; XmlSerializer xs = new XmlSerializer(AllStats.GetType()); StreamReader sr = new StreamReader(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml")); @@ -73,14 +76,17 @@ namespace DiscImageChef.Core AllStats = new Stats(); CurrentStats = new Stats() { - OperatingSystems = new List - { - new OsStats { name = Interop.DetectOS.GetRealPlatformID().ToString(), Value = 1, version = Interop.DetectOS.GetVersion() } - }, - Versions = new List - { - new NameValueStats{ name = Version.GetVersion(), Value = 1 } - } + OperatingSystems = + new List + { + new OsStats + { + name = Interop.DetectOS.GetRealPlatformID().ToString(), + Value = 1, + version = Interop.DetectOS.GetVersion() + } + }, + Versions = new List {new NameValueStats {name = Version.GetVersion(), Value = 1}} }; } else @@ -101,7 +107,8 @@ namespace DiscImageChef.Core OsStats old = null; foreach(OsStats nvs in AllStats.OperatingSystems) { - if(nvs.name == Interop.DetectOS.GetRealPlatformID().ToString() && nvs.version == Interop.DetectOS.GetVersion()) + if(nvs.name == Interop.DetectOS.GetRealPlatformID().ToString() && + nvs.version == Interop.DetectOS.GetVersion()) { count = nvs.Value + 1; old = nvs; @@ -109,14 +116,17 @@ namespace DiscImageChef.Core } } - if(old != null) - AllStats.OperatingSystems.Remove(old); + if(old != null) AllStats.OperatingSystems.Remove(old); count++; - AllStats.OperatingSystems.Add(new OsStats { name = Interop.DetectOS.GetRealPlatformID().ToString(), Value = count, version = Interop.DetectOS.GetVersion() }); + AllStats.OperatingSystems.Add(new OsStats + { + name = Interop.DetectOS.GetRealPlatformID().ToString(), + Value = count, + version = Interop.DetectOS.GetVersion() + }); } - else if(CurrentStats != null) - AllStats.OperatingSystems = CurrentStats.OperatingSystems; + else if(CurrentStats != null) AllStats.OperatingSystems = CurrentStats.OperatingSystems; if(AllStats.Versions != null) { @@ -133,16 +143,15 @@ namespace DiscImageChef.Core } } - if(old != null) - AllStats.Versions.Remove(old); + if(old != null) AllStats.Versions.Remove(old); count++; - AllStats.Versions.Add(new NameValueStats { name = Version.GetVersion(), Value = count }); + AllStats.Versions.Add(new NameValueStats {name = Version.GetVersion(), Value = count}); } - else if(CurrentStats != null) - AllStats.Versions = CurrentStats.Versions; - - FileStream fs = new FileStream(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"), FileMode.Create); + else if(CurrentStats != null) AllStats.Versions = CurrentStats.Versions; + + FileStream fs = new FileStream(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"), + FileMode.Create); XmlSerializer xs = new XmlSerializer(AllStats.GetType()); xs.Serialize(fs, AllStats); fs.Close(); @@ -157,8 +166,7 @@ namespace DiscImageChef.Core fs.Close(); } - if(Settings.Settings.Current.Stats.ShareStats) - SubmitStats(); + if(Settings.Settings.Current.Stats.ShareStats) SubmitStats(); } } @@ -166,18 +174,18 @@ namespace DiscImageChef.Core { Thread submitThread = new Thread(() => { - if(submitStatsLock) - return; + if(submitStatsLock) return; + submitStatsLock = true; - var statsFiles = Directory.EnumerateFiles(Settings.Settings.StatsPath, "PartialStats_*.xml", SearchOption.TopDirectoryOnly); + var statsFiles = Directory.EnumerateFiles(Settings.Settings.StatsPath, "PartialStats_*.xml", + SearchOption.TopDirectoryOnly); foreach(string statsFile in statsFiles) { try { - if(!File.Exists(statsFile)) - continue; + if(!File.Exists(statsFile)) continue; Stats stats = new Stats(); @@ -194,7 +202,8 @@ namespace DiscImageChef.Core fs.Seek(0, SeekOrigin.Begin); WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadstats"); - ((HttpWebRequest)request).UserAgent = string.Format("DiscImageChef {0}", typeof(Version).Assembly.GetName().Version); + ((HttpWebRequest)request).UserAgent = + string.Format("DiscImageChef {0}", typeof(Version).Assembly.GetName().Version); request.Method = "POST"; request.ContentLength = fs.Length; request.ContentType = "application/xml"; @@ -203,8 +212,7 @@ namespace DiscImageChef.Core reqStream.Close(); WebResponse response = request.GetResponse(); - if(((HttpWebResponse)response).StatusCode != HttpStatusCode.OK) - return; + if(((HttpWebResponse)response).StatusCode != HttpStatusCode.OK) return; Stream data = response.GetResponseStream(); StreamReader reader = new StreamReader(data); @@ -213,8 +221,7 @@ namespace DiscImageChef.Core data.Close(); response.Close(); fs.Close(); - if(responseFromServer == "ok") - File.Delete(statsFile); + if(responseFromServer == "ok") File.Delete(statsFile); } catch(WebException) { @@ -241,11 +248,9 @@ namespace DiscImageChef.Core { if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.DeviceStats) { - if(AllStats.Commands == null) - AllStats.Commands = new CommandsStats(); + if(AllStats.Commands == null) AllStats.Commands = new CommandsStats(); - if(CurrentStats.Commands == null) - CurrentStats.Commands = new CommandsStats(); + if(CurrentStats.Commands == null) CurrentStats.Commands = new CommandsStats(); switch(command) { @@ -333,10 +338,8 @@ namespace DiscImageChef.Core { if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.FilesystemStats) { - if(AllStats.Filesystems == null) - AllStats.Filesystems = new List(); - if(CurrentStats.Filesystems == null) - CurrentStats.Filesystems = new List(); + if(AllStats.Filesystems == null) AllStats.Filesystems = new List(); + if(CurrentStats.Filesystems == null) CurrentStats.Filesystems = new List(); NameValueStats old = null; foreach(NameValueStats nvs in AllStats.Filesystems) @@ -392,10 +395,8 @@ namespace DiscImageChef.Core { if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.PartitionStats) { - if(AllStats.Partitions == null) - AllStats.Partitions = new List(); - if(CurrentStats.Partitions == null) - CurrentStats.Partitions = new List(); + if(AllStats.Partitions == null) AllStats.Partitions = new List(); + if(CurrentStats.Partitions == null) CurrentStats.Partitions = new List(); NameValueStats old = null; foreach(NameValueStats nvs in AllStats.Partitions) @@ -451,10 +452,8 @@ namespace DiscImageChef.Core { if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.FilterStats) { - if(AllStats.Filters == null) - AllStats.Filters = new List(); - if(CurrentStats.Filters == null) - CurrentStats.Filters = new List(); + if(AllStats.Filters == null) AllStats.Filters = new List(); + if(CurrentStats.Filters == null) CurrentStats.Filters = new List(); NameValueStats old = null; foreach(NameValueStats nvs in AllStats.Filters) @@ -510,10 +509,8 @@ namespace DiscImageChef.Core { if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaImageStats) { - if(AllStats.MediaImages == null) - AllStats.MediaImages = new List(); - if(CurrentStats.MediaImages == null) - CurrentStats.MediaImages = new List(); + if(AllStats.MediaImages == null) AllStats.MediaImages = new List(); + if(CurrentStats.MediaImages == null) CurrentStats.MediaImages = new List(); NameValueStats old = null; foreach(NameValueStats nvs in AllStats.MediaImages) @@ -569,25 +566,18 @@ namespace DiscImageChef.Core { if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.DeviceStats) { - if(AllStats.Devices == null) - AllStats.Devices = new List(); - if(CurrentStats.Devices == null) - CurrentStats.Devices = new List(); + if(AllStats.Devices == null) AllStats.Devices = new List(); + if(CurrentStats.Devices == null) CurrentStats.Devices = new List(); string deviceBus; - if(dev.IsUSB) - deviceBus = "USB"; - else if(dev.IsFireWire) - deviceBus = "FireWire"; - else - deviceBus = dev.Type.ToString(); + if(dev.IsUSB) deviceBus = "USB"; + else if(dev.IsFireWire) deviceBus = "FireWire"; + else deviceBus = dev.Type.ToString(); DeviceStats old = null; foreach(DeviceStats ds in AllStats.Devices) { - if(ds.Manufacturer == dev.Manufacturer && - ds.Model == dev.Model && - ds.Revision == dev.Revision && + if(ds.Manufacturer == dev.Manufacturer && ds.Model == dev.Model && ds.Revision == dev.Revision && ds.Bus == deviceBus) { old = ds; @@ -595,8 +585,7 @@ namespace DiscImageChef.Core } } - if(old != null) - AllStats.Devices.Remove(old); + if(old != null) AllStats.Devices.Remove(old); DeviceStats nw = new DeviceStats(); nw.Model = dev.Model; @@ -609,18 +598,15 @@ namespace DiscImageChef.Core old = null; foreach(DeviceStats ds in CurrentStats.Devices) { - if(ds.Manufacturer == dev.Manufacturer && - ds.Model == dev.Model && - ds.Revision == dev.Revision && - ds.Bus == deviceBus) + if(ds.Manufacturer == dev.Manufacturer && ds.Model == dev.Model && ds.Revision == dev.Revision && + ds.Bus == deviceBus) { old = ds; break; } } - if(old != null) - CurrentStats.Devices.Remove(old); + if(old != null) CurrentStats.Devices.Remove(old); nw = new DeviceStats(); nw.Model = dev.Model; @@ -636,10 +622,8 @@ namespace DiscImageChef.Core { if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaStats) { - if(AllStats.Medias == null) - AllStats.Medias = new List(); - if(CurrentStats.Medias == null) - CurrentStats.Medias = new List(); + if(AllStats.Medias == null) AllStats.Medias = new List(); + if(CurrentStats.Medias == null) CurrentStats.Medias = new List(); MediaStats old = null; foreach(MediaStats ms in AllStats.Medias) @@ -695,7 +679,8 @@ namespace DiscImageChef.Core } } - public static void AddBenchmark(Dictionary checksums, double entropy, double all, double sequential, long maxMemory, long minMemory) + public static void AddBenchmark(Dictionary checksums, double entropy, double all, + double sequential, long maxMemory, long minMemory) { if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.BenchmarkStats) { @@ -771,7 +756,8 @@ namespace DiscImageChef.Core } } - public static void AddMediaScan(long lessThan3ms, long lessThan10ms, long lessThan50ms, long lessThan150ms, long lessThan500ms, long moreThan500ms, long total, long error, long correct) + public static void AddMediaScan(long lessThan3ms, long lessThan10ms, long lessThan50ms, long lessThan150ms, + long lessThan500ms, long moreThan500ms, long total, long error, long correct) { if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaScanStats) { @@ -811,5 +797,4 @@ namespace DiscImageChef.Core } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Core/Version.cs b/DiscImageChef.Core/Version.cs index 088709fa..2895b424 100644 --- a/DiscImageChef.Core/Version.cs +++ b/DiscImageChef.Core/Version.cs @@ -52,4 +52,4 @@ namespace DiscImageChef.Core return typeof(Version).Assembly.GetName().Version.ToString(); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Core/packages.config b/DiscImageChef.Core/packages.config index 57bc9eb2..34d816c3 100644 --- a/DiscImageChef.Core/packages.config +++ b/DiscImageChef.Core/packages.config @@ -1,4 +1,5 @@  + - + \ No newline at end of file diff --git a/DiscImageChef.Decoders/ATA/Identify.cs b/DiscImageChef.Decoders/ATA/Identify.cs index 90a64bf0..53d42104 100644 --- a/DiscImageChef.Decoders/ATA/Identify.cs +++ b/DiscImageChef.Decoders/ATA/Identify.cs @@ -121,8 +121,7 @@ namespace DiscImageChef.Decoders.ATA /// Words 10 to 19 /// Device serial number, right justified, padded with spaces /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string SerialNumber; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] public string SerialNumber; /// /// Word 20 /// Manufacturer defined @@ -148,14 +147,12 @@ namespace DiscImageChef.Decoders.ATA /// Words 23 to 26 /// Firmware revision, left justified, padded with spaces /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] - public string FirmwareRevision; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] public string FirmwareRevision; /// /// Words 27 to 46 /// Model number, left justified, padded with spaces /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] - public string Model; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] public string Model; /// /// Word 47 bits 7 to 0 /// Maximum number of sectors that can be transferred per @@ -562,8 +559,7 @@ namespace DiscImageChef.Decoders.ATA /// Words 121 to 125 /// Reserved /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public ushort[] ReservedWords121; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public ushort[] ReservedWords121; /// /// Word 126 @@ -589,8 +585,7 @@ namespace DiscImageChef.Decoders.ATA /// /// Words 129 to 159 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] - public ushort[] ReservedWords129; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] public ushort[] ReservedWords129; /// /// Word 160 @@ -606,8 +601,7 @@ namespace DiscImageChef.Decoders.ATA /// Words 161 to 167 /// Reserved for CFA /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] - public ushort[] ReservedCFA; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public ushort[] ReservedCFA; /// /// Word 168 @@ -624,8 +618,7 @@ namespace DiscImageChef.Decoders.ATA /// Words 170 to 173 /// Additional product identifier /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] - public string AdditionalPID; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] public string AdditionalPID; /// /// Word 174 @@ -642,14 +635,12 @@ namespace DiscImageChef.Decoders.ATA /// Words 176 to 195 /// Current media serial number /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] - public string MediaSerial; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] public string MediaSerial; /// /// Words 196 to 205 /// Current media manufacturer /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string MediaManufacturer; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] public string MediaManufacturer; /// /// Word 206 @@ -762,8 +753,7 @@ namespace DiscImageChef.Decoders.ATA /// Words 224 to 229 /// Reserved for CE-ATA /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public ushort[] ReservedCEATA224; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public ushort[] ReservedCEATA224; /// /// Words 230 to 233 @@ -785,8 +775,7 @@ namespace DiscImageChef.Decoders.ATA /// /// Words 236 to 254 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] - public ushort[] ReservedWords; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] public ushort[] ReservedWords; /// /// Word 255 bits 7 to 0 @@ -1848,12 +1837,12 @@ namespace DiscImageChef.Decoders.ATA public static IdentifyDevice? Decode(byte[] IdentifyDeviceResponse) { - if(IdentifyDeviceResponse == null) - return null; + if(IdentifyDeviceResponse == null) return null; if(IdentifyDeviceResponse.Length != 512) { - DicConsole.DebugWriteLine("ATA/ATAPI IDENTIFY decoder", "IDENTIFY response is different than 512 bytes, not decoding."); + DicConsole.DebugWriteLine("ATA/ATAPI IDENTIFY decoder", + "IDENTIFY response is different than 512 bytes, not decoding."); return null; } @@ -1877,8 +1866,7 @@ namespace DiscImageChef.Decoders.ATA public static string Prettify(byte[] IdentifyDeviceResponse) { - if(IdentifyDeviceResponse.Length != 512) - return null; + if(IdentifyDeviceResponse.Length != 512) return null; IdentifyDevice? decoded = Decode(IdentifyDeviceResponse); return Prettify(decoded); @@ -1886,8 +1874,7 @@ namespace DiscImageChef.Decoders.ATA public static string Prettify(IdentifyDevice? IdentifyDeviceResponse) { - if(IdentifyDeviceResponse == null) - return null; + if(IdentifyDeviceResponse == null) return null; StringBuilder sb = new StringBuilder(); @@ -1912,31 +1899,25 @@ namespace DiscImageChef.Decoders.ATA } } - if(atapi && !cfa) - sb.AppendLine("ATAPI device"); - else if(!atapi && cfa) - sb.AppendLine("CompactFlash device"); - else - sb.AppendLine("ATA device"); + if(atapi && !cfa) sb.AppendLine("ATAPI device"); + else if(!atapi && cfa) sb.AppendLine("CompactFlash device"); + else sb.AppendLine("ATA device"); - if(ATAID.Model != "") - sb.AppendFormat("Model: {0}", ATAID.Model).AppendLine(); + if(ATAID.Model != "") sb.AppendFormat("Model: {0}", ATAID.Model).AppendLine(); if(ATAID.FirmwareRevision != "") sb.AppendFormat("Firmware revision: {0}", ATAID.FirmwareRevision).AppendLine(); - if(ATAID.SerialNumber != "") - sb.AppendFormat("Serial #: {0}", ATAID.SerialNumber).AppendLine(); + if(ATAID.SerialNumber != "") sb.AppendFormat("Serial #: {0}", ATAID.SerialNumber).AppendLine(); if(ATAID.AdditionalPID != "") sb.AppendFormat("Additional product ID: {0}", ATAID.AdditionalPID).AppendLine(); if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && - !ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeClear)) + !ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeClear)) { if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.MediaSerial)) { if(ATAID.MediaManufacturer != "") sb.AppendFormat("Media manufacturer: {0}", ATAID.MediaManufacturer).AppendLine(); - if(ATAID.MediaSerial != "") - sb.AppendFormat("Media serial #: {0}", ATAID.MediaSerial).AppendLine(); + if(ATAID.MediaSerial != "") sb.AppendFormat("Media serial #: {0}", ATAID.MediaSerial).AppendLine(); } if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.WWN)) @@ -1945,27 +1926,34 @@ namespace DiscImageChef.Decoders.ATA } } - bool ata1 = false, ata2 = false, ata3 = false, ata4 = false, ata5 = false, ata6 = false, ata7 = false, acs = false, acs2 = false, acs3 = false, acs4 = false; + bool ata1 = false, + ata2 = false, + ata3 = false, + ata4 = false, + ata5 = false, + ata6 = false, + ata7 = false, + acs = false, + acs2 = false, + acs3 = false, + acs4 = false; if((ushort)ATAID.MajorVersion == 0x0000 || (ushort)ATAID.MajorVersion == 0xFFFF) { // Obsolete in ATA-2, if present, device supports ATA-1 ata1 |= ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.FastIDE) || - ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.SlowIDE) || - ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.UltraFastIDE); + ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.SlowIDE) || + ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.UltraFastIDE); ata2 |= ATAID.ExtendedIdentify.HasFlag(ExtendedIdentifyBit.Words64to70Valid); - if(!ata1 && !ata2 && !atapi && !cfa) - ata2 = true; + if(!ata1 && !ata2 && !atapi && !cfa) ata2 = true; ata4 |= atapi; ata3 |= cfa; - if(cfa && ata1) - ata1 = false; - if(cfa && ata2) - ata2 = false; + if(cfa && ata1) ata1 = false; + if(cfa && ata2) ata2 = false; ata5 |= ATAID.Signature == 0xA5; } @@ -1991,78 +1979,67 @@ namespace DiscImageChef.Decoders.ATA { sb.Append("ATA-1 "); maxatalevel = 1; - if(minatalevel > 1) - minatalevel = 1; + if(minatalevel > 1) minatalevel = 1; } if(ata2) { sb.Append("ATA-2 "); maxatalevel = 2; - if(minatalevel > 2) - minatalevel = 2; + if(minatalevel > 2) minatalevel = 2; } if(ata3) { sb.Append("ATA-3 "); maxatalevel = 3; - if(minatalevel > 3) - minatalevel = 3; + if(minatalevel > 3) minatalevel = 3; } if(ata4) { sb.Append("ATA/ATAPI-4 "); maxatalevel = 4; - if(minatalevel > 4) - minatalevel = 4; + if(minatalevel > 4) minatalevel = 4; } if(ata5) { sb.Append("ATA/ATAPI-5 "); maxatalevel = 5; - if(minatalevel > 5) - minatalevel = 5; + if(minatalevel > 5) minatalevel = 5; } if(ata6) { sb.Append("ATA/ATAPI-6 "); maxatalevel = 6; - if(minatalevel > 6) - minatalevel = 6; + if(minatalevel > 6) minatalevel = 6; } if(ata7) { sb.Append("ATA/ATAPI-7 "); maxatalevel = 7; - if(minatalevel > 7) - minatalevel = 7; + if(minatalevel > 7) minatalevel = 7; } if(acs) { sb.Append("ATA8-ACS "); maxatalevel = 8; - if(minatalevel > 8) - minatalevel = 8; + if(minatalevel > 8) minatalevel = 8; } if(acs2) { sb.Append("ATA8-ACS2 "); maxatalevel = 9; - if(minatalevel > 9) - minatalevel = 9; + if(minatalevel > 9) minatalevel = 9; } if(acs3) { sb.Append("ATA8-ACS3 "); maxatalevel = 10; - if(minatalevel > 10) - minatalevel = 10; + if(minatalevel > 10) minatalevel = 10; } if(acs4) { sb.Append("ATA8-ACS4 "); maxatalevel = 11; - if(minatalevel > 11) - minatalevel = 11; + if(minatalevel > 11) minatalevel = 11; } sb.AppendLine(); @@ -2223,35 +2200,27 @@ namespace DiscImageChef.Decoders.ATA { case 0x0: sb.Append("Parallel ATA device: "); - if((ATAID.TransportMajorVersion & 0x0002) == 0x0002) - sb.Append("ATA/ATAPI-7 "); - if((ATAID.TransportMajorVersion & 0x0001) == 0x0001) - sb.Append("ATA8-APT "); + if((ATAID.TransportMajorVersion & 0x0002) == 0x0002) sb.Append("ATA/ATAPI-7 "); + if((ATAID.TransportMajorVersion & 0x0001) == 0x0001) sb.Append("ATA8-APT "); sb.AppendLine(); break; case 0x1: sb.Append("Serial ATA device: "); - if((ATAID.TransportMajorVersion & 0x0001) == 0x0001) - sb.Append("ATA8-AST "); - if((ATAID.TransportMajorVersion & 0x0002) == 0x0002) - sb.Append("SATA 1.0a "); - if((ATAID.TransportMajorVersion & 0x0004) == 0x0004) - sb.Append("SATA II Extensions "); - if((ATAID.TransportMajorVersion & 0x0008) == 0x0008) - sb.Append("SATA 2.5 "); - if((ATAID.TransportMajorVersion & 0x0010) == 0x0010) - sb.Append("SATA 2.6 "); - if((ATAID.TransportMajorVersion & 0x0020) == 0x0020) - sb.Append("SATA 3.0 "); - if((ATAID.TransportMajorVersion & 0x0040) == 0x0040) - sb.Append("SATA 3.1 "); + if((ATAID.TransportMajorVersion & 0x0001) == 0x0001) sb.Append("ATA8-AST "); + if((ATAID.TransportMajorVersion & 0x0002) == 0x0002) sb.Append("SATA 1.0a "); + if((ATAID.TransportMajorVersion & 0x0004) == 0x0004) sb.Append("SATA II Extensions "); + if((ATAID.TransportMajorVersion & 0x0008) == 0x0008) sb.Append("SATA 2.5 "); + if((ATAID.TransportMajorVersion & 0x0010) == 0x0010) sb.Append("SATA 2.6 "); + if((ATAID.TransportMajorVersion & 0x0020) == 0x0020) sb.Append("SATA 3.0 "); + if((ATAID.TransportMajorVersion & 0x0040) == 0x0040) sb.Append("SATA 3.1 "); sb.AppendLine(); break; case 0xE: sb.AppendLine("SATA Express device"); break; default: - sb.AppendFormat("Unknown transport type 0x{0:X1}", (ATAID.TransportMajorVersion & 0xF000) >> 12).AppendLine(); + sb.AppendFormat("Unknown transport type 0x{0:X1}", (ATAID.TransportMajorVersion & 0xF000) >> 12) + .AppendLine(); break; } @@ -2324,7 +2293,8 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine("ATAPI Unknown or no device type"); break; default: - sb.AppendFormat("ATAPI Unknown device type field value 0x{0:X2}", ((ushort)ATAID.GeneralConfiguration & 0x1F00) >> 8).AppendLine(); + sb.AppendFormat("ATAPI Unknown device type field value 0x{0:X2}", + ((ushort)ATAID.GeneralConfiguration & 0x1F00) >> 8).AppendLine(); break; } @@ -2341,7 +2311,8 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine("Device shall set DRQ within 50 µs of receiving PACKET"); break; default: - sb.AppendFormat("Unknown ATAPI DRQ behaviour code {0}", ((ushort)ATAID.GeneralConfiguration & 0x60) >> 5).AppendLine(); + sb.AppendFormat("Unknown ATAPI DRQ behaviour code {0}", + ((ushort)ATAID.GeneralConfiguration & 0x60) >> 5).AppendLine(); break; } @@ -2355,7 +2326,8 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine("ATAPI device uses 16 byte command packet"); break; default: - sb.AppendFormat("Unknown ATAPI packet size code {0}", (ushort)ATAID.GeneralConfiguration & 0x03).AppendLine(); + sb.AppendFormat("Unknown ATAPI packet size code {0}", (ushort)ATAID.GeneralConfiguration & 0x03) + .AppendLine(); break; } } @@ -2407,13 +2379,10 @@ namespace DiscImageChef.Decoders.ATA } } - if(ATAID.NominalRotationRate != 0x0000 && - ATAID.NominalRotationRate != 0xFFFF) + if(ATAID.NominalRotationRate != 0x0000 && ATAID.NominalRotationRate != 0xFFFF) { - if(ATAID.NominalRotationRate == 0x0001) - sb.AppendLine("Device does not rotate."); - else - sb.AppendFormat("Device rotate at {0} rpm", ATAID.NominalRotationRate).AppendLine(); + if(ATAID.NominalRotationRate == 0x0001) sb.AppendLine("Device does not rotate."); + else sb.AppendFormat("Device rotate at {0} rpm", ATAID.NominalRotationRate).AppendLine(); } uint logicalsectorsize = 0; @@ -2421,27 +2390,23 @@ namespace DiscImageChef.Decoders.ATA { uint physicalsectorsize; - if((ATAID.PhysLogSectorSize & 0x8000) == 0x0000 && - (ATAID.PhysLogSectorSize & 0x4000) == 0x4000) + if((ATAID.PhysLogSectorSize & 0x8000) == 0x0000 && (ATAID.PhysLogSectorSize & 0x4000) == 0x4000) { if((ATAID.PhysLogSectorSize & 0x1000) == 0x1000) { - if(ATAID.LogicalSectorWords <= 255 || ATAID.LogicalAlignment == 0xFFFF) - logicalsectorsize = 512; - else - logicalsectorsize = ATAID.LogicalSectorWords * 2; + if(ATAID.LogicalSectorWords <= 255 || ATAID.LogicalAlignment == 0xFFFF) logicalsectorsize = 512; + else logicalsectorsize = ATAID.LogicalSectorWords * 2; } - else - logicalsectorsize = 512; + else logicalsectorsize = 512; if((ATAID.PhysLogSectorSize & 0x2000) == 0x2000) { #pragma warning disable IDE0004 // Remove Unnecessary Cast - physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, (double)(ATAID.PhysLogSectorSize & 0xF)); + physicalsectorsize = + logicalsectorsize * (uint)Math.Pow(2, (double)(ATAID.PhysLogSectorSize & 0xF)); #pragma warning restore IDE0004 // Remove Unnecessary Cast } - else - physicalsectorsize = logicalsectorsize; + else physicalsectorsize = logicalsectorsize; } else { @@ -2452,29 +2417,33 @@ namespace DiscImageChef.Decoders.ATA sb.AppendFormat("Physical sector size: {0} bytes", physicalsectorsize).AppendLine(); sb.AppendFormat("Logical sector size: {0} bytes", logicalsectorsize).AppendLine(); - if((logicalsectorsize != physicalsectorsize) && - (ATAID.LogicalAlignment & 0x8000) == 0x0000 && - (ATAID.LogicalAlignment & 0x4000) == 0x4000) + if((logicalsectorsize != physicalsectorsize) && (ATAID.LogicalAlignment & 0x8000) == 0x0000 && + (ATAID.LogicalAlignment & 0x4000) == 0x4000) { - sb.AppendFormat("Logical sector starts at offset {0} from physical sector", ATAID.LogicalAlignment & 0x3FFF).AppendLine(); + sb.AppendFormat("Logical sector starts at offset {0} from physical sector", + ATAID.LogicalAlignment & 0x3FFF).AppendLine(); } if(minatalevel <= 5) { if(ATAID.CurrentCylinders > 0 && ATAID.CurrentHeads > 0 && ATAID.CurrentSectorsPerTrack > 0) { - sb.AppendFormat("Cylinders: {0} max., {1} current", ATAID.Cylinders, ATAID.CurrentCylinders).AppendLine(); + sb.AppendFormat("Cylinders: {0} max., {1} current", ATAID.Cylinders, ATAID.CurrentCylinders) + .AppendLine(); sb.AppendFormat("Heads: {0} max., {1} current", ATAID.Heads, ATAID.CurrentHeads).AppendLine(); - sb.AppendFormat("Sectors per track: {0} max., {1} current", ATAID.SectorsPerTrack, ATAID.CurrentSectorsPerTrack).AppendLine(); - sb.AppendFormat("Sectors addressable in CHS mode: {0} max., {1} current", ATAID.Cylinders * ATAID.Heads * ATAID.SectorsPerTrack, - ATAID.CurrentSectors).AppendLine(); + sb.AppendFormat("Sectors per track: {0} max., {1} current", ATAID.SectorsPerTrack, + ATAID.CurrentSectorsPerTrack).AppendLine(); + sb.AppendFormat("Sectors addressable in CHS mode: {0} max., {1} current", + ATAID.Cylinders * ATAID.Heads * ATAID.SectorsPerTrack, ATAID.CurrentSectors) + .AppendLine(); } else { sb.AppendFormat("Cylinders: {0}", ATAID.Cylinders).AppendLine(); sb.AppendFormat("Heads: {0}", ATAID.Heads).AppendLine(); sb.AppendFormat("Sectors per track: {0}", ATAID.SectorsPerTrack).AppendLine(); - sb.AppendFormat("Sectors addressable in CHS mode: {0}", ATAID.Cylinders * ATAID.Heads * ATAID.SectorsPerTrack).AppendLine(); + sb.AppendFormat("Sectors addressable in CHS mode: {0}", + ATAID.Cylinders * ATAID.Heads * ATAID.SectorsPerTrack).AppendLine(); } } @@ -2491,13 +2460,17 @@ namespace DiscImageChef.Decoders.ATA if(minatalevel <= 5) { if(ATAID.CurrentSectors > 0) - sb.AppendFormat("Device size in CHS mode: {0} bytes, {1} Mb, {2} MiB", (ulong)ATAID.CurrentSectors * logicalsectorsize, - ((ulong)ATAID.CurrentSectors * logicalsectorsize) / 1000 / 1000, ((ulong)ATAID.CurrentSectors * 512) / 1024 / 1024).AppendLine(); + sb.AppendFormat("Device size in CHS mode: {0} bytes, {1} Mb, {2} MiB", + (ulong)ATAID.CurrentSectors * logicalsectorsize, + ((ulong)ATAID.CurrentSectors * logicalsectorsize) / 1000 / 1000, + ((ulong)ATAID.CurrentSectors * 512) / 1024 / 1024).AppendLine(); else { ulong currentSectors = (ulong)(ATAID.Cylinders * ATAID.Heads * ATAID.SectorsPerTrack); - sb.AppendFormat("Device size in CHS mode: {0} bytes, {1} Mb, {2} MiB", currentSectors * logicalsectorsize, - (currentSectors * logicalsectorsize) / 1000 / 1000, (currentSectors * 512) / 1024 / 1024).AppendLine(); + sb.AppendFormat("Device size in CHS mode: {0} bytes, {1} Mb, {2} MiB", + currentSectors * logicalsectorsize, + (currentSectors * logicalsectorsize) / 1000 / 1000, + (currentSectors * 512) / 1024 / 1024).AppendLine(); } } @@ -2505,18 +2478,24 @@ namespace DiscImageChef.Decoders.ATA { if((((ulong)ATAID.LBASectors * logicalsectorsize) / 1024 / 1024) > 1000000) { - sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", (ulong)ATAID.LBASectors * logicalsectorsize, - ((ulong)ATAID.LBASectors * logicalsectorsize) / 1000 / 1000 / 1000 / 1000, ((ulong)ATAID.LBASectors * 512) / 1024 / 1024 / 1024 / 1024).AppendLine(); + sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", + (ulong)ATAID.LBASectors * logicalsectorsize, + ((ulong)ATAID.LBASectors * logicalsectorsize) / 1000 / 1000 / 1000 / 1000, + ((ulong)ATAID.LBASectors * 512) / 1024 / 1024 / 1024 / 1024).AppendLine(); } else if((((ulong)ATAID.LBASectors * logicalsectorsize) / 1024 / 1024) > 1000) { - sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", (ulong)ATAID.LBASectors * logicalsectorsize, - ((ulong)ATAID.LBASectors * logicalsectorsize) / 1000 / 1000 / 1000, ((ulong)ATAID.LBASectors * 512) / 1024 / 1024 / 1024).AppendLine(); + sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", + (ulong)ATAID.LBASectors * logicalsectorsize, + ((ulong)ATAID.LBASectors * logicalsectorsize) / 1000 / 1000 / 1000, + ((ulong)ATAID.LBASectors * 512) / 1024 / 1024 / 1024).AppendLine(); } else { - sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Mb, {2} MiB", (ulong)ATAID.LBASectors * logicalsectorsize, - ((ulong)ATAID.LBASectors * logicalsectorsize) / 1000 / 1000, ((ulong)ATAID.LBASectors * 512) / 1024 / 1024).AppendLine(); + sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Mb, {2} MiB", + (ulong)ATAID.LBASectors * logicalsectorsize, + ((ulong)ATAID.LBASectors * logicalsectorsize) / 1000 / 1000, + ((ulong)ATAID.LBASectors * 512) / 1024 / 1024).AppendLine(); } } @@ -2526,54 +2505,65 @@ namespace DiscImageChef.Decoders.ATA { if(((ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024) > 1000000) { - sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", ATAID.ExtendedUserSectors * logicalsectorsize, - (ATAID.ExtendedUserSectors * logicalsectorsize) / 1000 / 1000 / 1000 / 1000, (ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024).AppendLine(); + sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", + ATAID.ExtendedUserSectors * logicalsectorsize, + (ATAID.ExtendedUserSectors * logicalsectorsize) / 1000 / 1000 / 1000 / 1000, + (ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024) + .AppendLine(); } else if(((ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024) > 1000) { - sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", ATAID.ExtendedUserSectors * logicalsectorsize, - (ATAID.ExtendedUserSectors * logicalsectorsize) / 1000 / 1000 / 1000, (ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024 / 1024).AppendLine(); + sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", + ATAID.ExtendedUserSectors * logicalsectorsize, + (ATAID.ExtendedUserSectors * logicalsectorsize) / 1000 / 1000 / 1000, + (ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024 / 1024) + .AppendLine(); } else { - sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Mb, {2} MiB", ATAID.ExtendedUserSectors * logicalsectorsize, - (ATAID.ExtendedUserSectors * logicalsectorsize) / 1000 / 1000, (ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024).AppendLine(); + sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Mb, {2} MiB", + ATAID.ExtendedUserSectors * logicalsectorsize, + (ATAID.ExtendedUserSectors * logicalsectorsize) / 1000 / 1000, + (ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024).AppendLine(); } } else { if(((ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024) > 1000000) { - sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", ATAID.LBA48Sectors * logicalsectorsize, - (ATAID.LBA48Sectors * logicalsectorsize) / 1000 / 1000 / 1000 / 1000, (ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024).AppendLine(); + sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", + ATAID.LBA48Sectors * logicalsectorsize, + (ATAID.LBA48Sectors * logicalsectorsize) / 1000 / 1000 / 1000 / 1000, + (ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024) + .AppendLine(); } else if(((ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024) > 1000) { - sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", ATAID.LBA48Sectors * logicalsectorsize, - (ATAID.LBA48Sectors * logicalsectorsize) / 1000 / 1000 / 1000, (ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024).AppendLine(); + sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", + ATAID.LBA48Sectors * logicalsectorsize, + (ATAID.LBA48Sectors * logicalsectorsize) / 1000 / 1000 / 1000, + (ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024).AppendLine(); } else { - sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Mb, {2} MiB", ATAID.LBA48Sectors * logicalsectorsize, - (ATAID.LBA48Sectors * logicalsectorsize) / 1000 / 1000, (ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024).AppendLine(); + sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Mb, {2} MiB", + ATAID.LBA48Sectors * logicalsectorsize, + (ATAID.LBA48Sectors * logicalsectorsize) / 1000 / 1000, + (ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024).AppendLine(); } } } if(ata1 || cfa) { - if(cfa) - { - sb.AppendFormat("{0} sectors in card", ATAID.SectorsPerCard).AppendLine(); - } + if(cfa) { sb.AppendFormat("{0} sectors in card", ATAID.SectorsPerCard).AppendLine(); } if(ATAID.UnformattedBPT > 0) sb.AppendFormat("{0} bytes per unformatted track", ATAID.UnformattedBPT).AppendLine(); if(ATAID.UnformattedBPS > 0) sb.AppendFormat("{0} bytes per unformatted sector", ATAID.UnformattedBPS).AppendLine(); } } - if((ushort)ATAID.SpecificConfiguration != 0x0000 && - (ushort)ATAID.SpecificConfiguration != 0xFFFF) + if((ushort)ATAID.SpecificConfiguration != 0x0000 && (ushort)ATAID.SpecificConfiguration != 0xFFFF) { switch(ATAID.SpecificConfiguration) { @@ -2590,28 +2580,33 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine("Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is complete."); break; default: - sb.AppendFormat("Unknown device specific configuration 0x{0:X4}", (ushort)ATAID.SpecificConfiguration).AppendLine(); + sb.AppendFormat("Unknown device specific configuration 0x{0:X4}", + (ushort)ATAID.SpecificConfiguration).AppendLine(); break; } } // Obsolete since ATA-2, however, it is yet used in ATA-8 devices - if(ATAID.BufferSize != 0x0000 && ATAID.BufferSize != 0xFFFF && - ATAID.BufferType != 0x0000 && ATAID.BufferType != 0xFFFF) + if(ATAID.BufferSize != 0x0000 && ATAID.BufferSize != 0xFFFF && ATAID.BufferType != 0x0000 && + ATAID.BufferType != 0xFFFF) { switch(ATAID.BufferType) { case 1: - sb.AppendFormat("{0} KiB of single ported single sector buffer", (ATAID.BufferSize * 512) / 1024).AppendLine(); + sb.AppendFormat("{0} KiB of single ported single sector buffer", + (ATAID.BufferSize * 512) / 1024).AppendLine(); break; case 2: - sb.AppendFormat("{0} KiB of dual ported multi sector buffer", (ATAID.BufferSize * 512) / 1024).AppendLine(); + sb.AppendFormat("{0} KiB of dual ported multi sector buffer", (ATAID.BufferSize * 512) / 1024) + .AppendLine(); break; case 3: - sb.AppendFormat("{0} KiB of dual ported multi sector buffer with read caching", (ATAID.BufferSize * 512) / 1024).AppendLine(); + sb.AppendFormat("{0} KiB of dual ported multi sector buffer with read caching", + (ATAID.BufferSize * 512) / 1024).AppendLine(); break; default: - sb.AppendFormat("{0} KiB of unknown type {1} buffer", (ATAID.BufferSize * 512) / 1024, ATAID.BufferType).AppendLine(); + sb.AppendFormat("{0} KiB of unknown type {1} buffer", (ATAID.BufferSize * 512) / 1024, + ATAID.BufferType).AppendLine(); break; } } @@ -2627,11 +2622,9 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.Capabilities.HasFlag(CapabilitiesBit.IORDY)) { sb.AppendLine().Append("IORDY is supported"); - if(ATAID.Capabilities.HasFlag(CapabilitiesBit.CanDisableIORDY)) - sb.Append(" and can be disabled"); + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.CanDisableIORDY)) sb.Append(" and can be disabled"); } - if(ATAID.Capabilities.HasFlag(CapabilitiesBit.DMASupport)) - sb.AppendLine().Append("DMA is supported"); + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.DMASupport)) sb.AppendLine().Append("DMA is supported"); if(ATAID.Capabilities2.HasFlag(CapabilitiesBit2.MustBeSet) && !ATAID.Capabilities2.HasFlag(CapabilitiesBit2.MustBeClear)) @@ -2642,14 +2635,18 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.MultipleValid)) { - sb.AppendLine().AppendFormat("A maximum of {0} sectors can be transferred per interrupt on READ/WRITE MULTIPLE", ATAID.MultipleSectorNumber); - sb.AppendLine().AppendFormat("Device supports setting a maximum of {0} sectors", ATAID.MultipleMaxSectors); + sb.AppendLine() + .AppendFormat("A maximum of {0} sectors can be transferred per interrupt on READ/WRITE MULTIPLE", + ATAID.MultipleSectorNumber); + sb.AppendLine().AppendFormat("Device supports setting a maximum of {0} sectors", + ATAID.MultipleMaxSectors); } if(ATAID.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment1) || - ATAID.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment0)) + ATAID.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment0)) { - sb.AppendLine().AppendFormat("Long Physical Alignment setting is {0}", (ushort)ATAID.Capabilities & 0x03); + sb.AppendLine().AppendFormat("Long Physical Alignment setting is {0}", + (ushort)ATAID.Capabilities & 0x03); } if(ata1) @@ -2677,38 +2674,14 @@ namespace DiscImageChef.Decoders.ATA } sb.AppendLine().Append("Advanced PIO: "); - if(ATAID.APIOSupported.HasFlag(TransferMode.Mode0)) - { - sb.Append("PIO0 "); - } - if(ATAID.APIOSupported.HasFlag(TransferMode.Mode1)) - { - sb.Append("PIO1 "); - } - if(ATAID.APIOSupported.HasFlag(TransferMode.Mode2)) - { - sb.Append("PIO2 "); - } - if(ATAID.APIOSupported.HasFlag(TransferMode.Mode3)) - { - sb.Append("PIO3 "); - } - if(ATAID.APIOSupported.HasFlag(TransferMode.Mode4)) - { - sb.Append("PIO4 "); - } - if(ATAID.APIOSupported.HasFlag(TransferMode.Mode5)) - { - sb.Append("PIO5 "); - } - if(ATAID.APIOSupported.HasFlag(TransferMode.Mode6)) - { - sb.Append("PIO6 "); - } - if(ATAID.APIOSupported.HasFlag(TransferMode.Mode7)) - { - sb.Append("PIO7 "); - } + if(ATAID.APIOSupported.HasFlag(TransferMode.Mode0)) { sb.Append("PIO0 "); } + if(ATAID.APIOSupported.HasFlag(TransferMode.Mode1)) { sb.Append("PIO1 "); } + if(ATAID.APIOSupported.HasFlag(TransferMode.Mode2)) { sb.Append("PIO2 "); } + if(ATAID.APIOSupported.HasFlag(TransferMode.Mode3)) { sb.Append("PIO3 "); } + if(ATAID.APIOSupported.HasFlag(TransferMode.Mode4)) { sb.Append("PIO4 "); } + if(ATAID.APIOSupported.HasFlag(TransferMode.Mode5)) { sb.Append("PIO5 "); } + if(ATAID.APIOSupported.HasFlag(TransferMode.Mode6)) { sb.Append("PIO6 "); } + if(ATAID.APIOSupported.HasFlag(TransferMode.Mode7)) { sb.Append("PIO7 "); } if(minatalevel <= 3 && !atapi) { @@ -2716,50 +2689,42 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.DMASupported.HasFlag(TransferMode.Mode0)) { sb.Append("DMA0 "); - if(ATAID.DMAActive.HasFlag(TransferMode.Mode0)) - sb.Append("(active) "); + if(ATAID.DMAActive.HasFlag(TransferMode.Mode0)) sb.Append("(active) "); } if(ATAID.DMASupported.HasFlag(TransferMode.Mode1)) { sb.Append("DMA1 "); - if(ATAID.DMAActive.HasFlag(TransferMode.Mode1)) - sb.Append("(active) "); + if(ATAID.DMAActive.HasFlag(TransferMode.Mode1)) sb.Append("(active) "); } if(ATAID.DMASupported.HasFlag(TransferMode.Mode2)) { sb.Append("DMA2 "); - if(ATAID.DMAActive.HasFlag(TransferMode.Mode2)) - sb.Append("(active) "); + if(ATAID.DMAActive.HasFlag(TransferMode.Mode2)) sb.Append("(active) "); } if(ATAID.DMASupported.HasFlag(TransferMode.Mode3)) { sb.Append("DMA3 "); - if(ATAID.DMAActive.HasFlag(TransferMode.Mode3)) - sb.Append("(active) "); + if(ATAID.DMAActive.HasFlag(TransferMode.Mode3)) sb.Append("(active) "); } if(ATAID.DMASupported.HasFlag(TransferMode.Mode4)) { sb.Append("DMA4 "); - if(ATAID.DMAActive.HasFlag(TransferMode.Mode4)) - sb.Append("(active) "); + if(ATAID.DMAActive.HasFlag(TransferMode.Mode4)) sb.Append("(active) "); } if(ATAID.DMASupported.HasFlag(TransferMode.Mode5)) { sb.Append("DMA5 "); - if(ATAID.DMAActive.HasFlag(TransferMode.Mode5)) - sb.Append("(active) "); + if(ATAID.DMAActive.HasFlag(TransferMode.Mode5)) sb.Append("(active) "); } if(ATAID.DMASupported.HasFlag(TransferMode.Mode6)) { sb.Append("DMA6 "); - if(ATAID.DMAActive.HasFlag(TransferMode.Mode6)) - sb.Append("(active) "); + if(ATAID.DMAActive.HasFlag(TransferMode.Mode6)) sb.Append("(active) "); } if(ATAID.DMASupported.HasFlag(TransferMode.Mode7)) { sb.Append("DMA7 "); - if(ATAID.DMAActive.HasFlag(TransferMode.Mode7)) - sb.Append("(active) "); + if(ATAID.DMAActive.HasFlag(TransferMode.Mode7)) sb.Append("(active) "); } } @@ -2767,116 +2732,103 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.MDMASupported.HasFlag(TransferMode.Mode0)) { sb.Append("MDMA0 "); - if(ATAID.MDMAActive.HasFlag(TransferMode.Mode0)) - sb.Append("(active) "); + if(ATAID.MDMAActive.HasFlag(TransferMode.Mode0)) sb.Append("(active) "); } if(ATAID.MDMASupported.HasFlag(TransferMode.Mode1)) { sb.Append("MDMA1 "); - if(ATAID.MDMAActive.HasFlag(TransferMode.Mode1)) - sb.Append("(active) "); + if(ATAID.MDMAActive.HasFlag(TransferMode.Mode1)) sb.Append("(active) "); } if(ATAID.MDMASupported.HasFlag(TransferMode.Mode2)) { sb.Append("MDMA2 "); - if(ATAID.MDMAActive.HasFlag(TransferMode.Mode2)) - sb.Append("(active) "); + if(ATAID.MDMAActive.HasFlag(TransferMode.Mode2)) sb.Append("(active) "); } if(ATAID.MDMASupported.HasFlag(TransferMode.Mode3)) { sb.Append("MDMA3 "); - if(ATAID.MDMAActive.HasFlag(TransferMode.Mode3)) - sb.Append("(active) "); + if(ATAID.MDMAActive.HasFlag(TransferMode.Mode3)) sb.Append("(active) "); } if(ATAID.MDMASupported.HasFlag(TransferMode.Mode4)) { sb.Append("MDMA4 "); - if(ATAID.MDMAActive.HasFlag(TransferMode.Mode4)) - sb.Append("(active) "); + if(ATAID.MDMAActive.HasFlag(TransferMode.Mode4)) sb.Append("(active) "); } if(ATAID.MDMASupported.HasFlag(TransferMode.Mode5)) { sb.Append("MDMA5 "); - if(ATAID.MDMAActive.HasFlag(TransferMode.Mode5)) - sb.Append("(active) "); + if(ATAID.MDMAActive.HasFlag(TransferMode.Mode5)) sb.Append("(active) "); } if(ATAID.MDMASupported.HasFlag(TransferMode.Mode6)) { sb.Append("MDMA6 "); - if(ATAID.MDMAActive.HasFlag(TransferMode.Mode6)) - sb.Append("(active) "); + if(ATAID.MDMAActive.HasFlag(TransferMode.Mode6)) sb.Append("(active) "); } if(ATAID.MDMASupported.HasFlag(TransferMode.Mode7)) { sb.Append("MDMA7 "); - if(ATAID.MDMAActive.HasFlag(TransferMode.Mode7)) - sb.Append("(active) "); + if(ATAID.MDMAActive.HasFlag(TransferMode.Mode7)) sb.Append("(active) "); } sb.AppendLine().Append("Ultra DMA: "); if(ATAID.UDMASupported.HasFlag(TransferMode.Mode0)) { sb.Append("UDMA0 "); - if(ATAID.UDMAActive.HasFlag(TransferMode.Mode0)) - sb.Append("(active) "); + if(ATAID.UDMAActive.HasFlag(TransferMode.Mode0)) sb.Append("(active) "); } if(ATAID.UDMASupported.HasFlag(TransferMode.Mode1)) { sb.Append("UDMA1 "); - if(ATAID.UDMAActive.HasFlag(TransferMode.Mode1)) - sb.Append("(active) "); + if(ATAID.UDMAActive.HasFlag(TransferMode.Mode1)) sb.Append("(active) "); } if(ATAID.UDMASupported.HasFlag(TransferMode.Mode2)) { sb.Append("UDMA2 "); - if(ATAID.UDMAActive.HasFlag(TransferMode.Mode2)) - sb.Append("(active) "); + if(ATAID.UDMAActive.HasFlag(TransferMode.Mode2)) sb.Append("(active) "); } if(ATAID.UDMASupported.HasFlag(TransferMode.Mode3)) { sb.Append("UDMA3 "); - if(ATAID.UDMAActive.HasFlag(TransferMode.Mode3)) - sb.Append("(active) "); + if(ATAID.UDMAActive.HasFlag(TransferMode.Mode3)) sb.Append("(active) "); } if(ATAID.UDMASupported.HasFlag(TransferMode.Mode4)) { sb.Append("UDMA4 "); - if(ATAID.UDMAActive.HasFlag(TransferMode.Mode4)) - sb.Append("(active) "); + if(ATAID.UDMAActive.HasFlag(TransferMode.Mode4)) sb.Append("(active) "); } if(ATAID.UDMASupported.HasFlag(TransferMode.Mode5)) { sb.Append("UDMA5 "); - if(ATAID.UDMAActive.HasFlag(TransferMode.Mode5)) - sb.Append("(active) "); + if(ATAID.UDMAActive.HasFlag(TransferMode.Mode5)) sb.Append("(active) "); } if(ATAID.UDMASupported.HasFlag(TransferMode.Mode6)) { sb.Append("UDMA6 "); - if(ATAID.UDMAActive.HasFlag(TransferMode.Mode6)) - sb.Append("(active) "); + if(ATAID.UDMAActive.HasFlag(TransferMode.Mode6)) sb.Append("(active) "); } if(ATAID.UDMASupported.HasFlag(TransferMode.Mode7)) { sb.Append("UDMA7 "); - if(ATAID.UDMAActive.HasFlag(TransferMode.Mode7)) - sb.Append("(active) "); + if(ATAID.UDMAActive.HasFlag(TransferMode.Mode7)) sb.Append("(active) "); } if(ATAID.MinMDMACycleTime != 0 && ATAID.RecMDMACycleTime != 0) { - sb.AppendLine().AppendFormat("At minimum {0} ns. transfer cycle time per word in MDMA, " + - "{1} ns. recommended", ATAID.MinMDMACycleTime, ATAID.RecMDMACycleTime); + sb.AppendLine() + .AppendFormat("At minimum {0} ns. transfer cycle time per word in MDMA, " + "{1} ns. recommended", + ATAID.MinMDMACycleTime, ATAID.RecMDMACycleTime); } if(ATAID.MinPIOCycleTimeNoFlow != 0) { - sb.AppendLine().AppendFormat("At minimum {0} ns. transfer cycle time per word in PIO, " + - "without flow control", ATAID.MinPIOCycleTimeNoFlow); + sb.AppendLine() + .AppendFormat("At minimum {0} ns. transfer cycle time per word in PIO, " + "without flow control", + ATAID.MinPIOCycleTimeNoFlow); } if(ATAID.MinPIOCycleTimeFlow != 0) { - sb.AppendLine().AppendFormat("At minimum {0} ns. transfer cycle time per word in PIO, " + - "with IORDY flow control", ATAID.MinPIOCycleTimeFlow); + sb.AppendLine() + .AppendFormat("At minimum {0} ns. transfer cycle time per word in PIO, " + "with IORDY flow control", + ATAID.MinPIOCycleTimeFlow); } if(ATAID.MaxQueueDepth != 0) @@ -2887,9 +2839,11 @@ namespace DiscImageChef.Decoders.ATA if(atapi) { if(ATAID.PacketBusRelease != 0) - sb.AppendLine().AppendFormat("{0} ns. typical to release bus from receipt of PACKET", ATAID.PacketBusRelease); + sb.AppendLine().AppendFormat("{0} ns. typical to release bus from receipt of PACKET", + ATAID.PacketBusRelease); if(ATAID.ServiceBusyClear != 0) - sb.AppendLine().AppendFormat("{0} ns. typical to clear BSY bit from receipt of SERVICE", ATAID.ServiceBusyClear); + sb.AppendLine().AppendFormat("{0} ns. typical to clear BSY bit from receipt of SERVICE", + ATAID.ServiceBusyClear); } if(((ATAID.TransportMajorVersion & 0xF000) >> 12) == 0x1 || @@ -2943,7 +2897,7 @@ namespace DiscImageChef.Decoders.ATA if(!ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.Clear)) { if(!ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear) && - ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQ)) + ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQ)) { if(ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.NCQMgmt)) { @@ -2973,7 +2927,8 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.InterseekDelay != 0x0000 && ATAID.InterseekDelay != 0xFFFF) { - sb.AppendLine().AppendFormat("{0} microseconds of interseek delay for ISO-7779 accoustic testing", ATAID.InterseekDelay); + sb.AppendLine().AppendFormat("{0} microseconds of interseek delay for ISO-7779 accoustic testing", + ATAID.InterseekDelay); } if((ushort)ATAID.DeviceFormFactor != 0x0000 && (ushort)ATAID.DeviceFormFactor != 0xFFFF) @@ -2996,7 +2951,8 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().Append("Device nominal size is smaller than 1.8\""); break; default: - sb.AppendLine().AppendFormat("Device nominal size field value {0} is unknown", ATAID.DeviceFormFactor); + sb.AppendLine().AppendFormat("Device nominal size field value {0} is unknown", + ATAID.DeviceFormFactor); break; } } @@ -3017,7 +2973,8 @@ namespace DiscImageChef.Decoders.ATA if((ATAID.CFAPowerMode & 0x1000) == 0x1000) sb.AppendLine().Append("CompactFlash power mode 1 is disabled"); - sb.AppendLine().AppendFormat("CompactFlash device uses a maximum of {0} mA", (ATAID.CFAPowerMode & 0x0FFF)); + sb.AppendLine().AppendFormat("CompactFlash device uses a maximum of {0} mA", + (ATAID.CFAPowerMode & 0x0FFF)); } } @@ -3027,125 +2984,107 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.CommandSet.HasFlag(CommandSetBit.Nop)) { sb.AppendLine().Append("NOP is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Nop)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Nop)) sb.Append(" and enabled"); } if(ATAID.CommandSet.HasFlag(CommandSetBit.ReadBuffer)) { sb.AppendLine().Append("READ BUFFER is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.ReadBuffer)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.ReadBuffer)) sb.Append(" and enabled"); } if(ATAID.CommandSet.HasFlag(CommandSetBit.WriteBuffer)) { sb.AppendLine().Append("WRITE BUFFER is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.WriteBuffer)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.WriteBuffer)) sb.Append(" and enabled"); } if(ATAID.CommandSet.HasFlag(CommandSetBit.HPA)) { sb.AppendLine().Append("Host Protected Area is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.HPA)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.HPA)) sb.Append(" and enabled"); } if(ATAID.CommandSet.HasFlag(CommandSetBit.DeviceReset)) { sb.AppendLine().Append("DEVICE RESET is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.DeviceReset)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.DeviceReset)) sb.Append(" and enabled"); } if(ATAID.CommandSet.HasFlag(CommandSetBit.Service)) { sb.AppendLine().Append("SERVICE interrupt is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Service)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Service)) sb.Append(" and enabled"); } if(ATAID.CommandSet.HasFlag(CommandSetBit.Release)) { sb.AppendLine().Append("Release is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Release)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Release)) sb.Append(" and enabled"); } if(ATAID.CommandSet.HasFlag(CommandSetBit.LookAhead)) { sb.AppendLine().Append("Look-ahead read is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.LookAhead)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.LookAhead)) sb.Append(" and enabled"); } if(ATAID.CommandSet.HasFlag(CommandSetBit.WriteCache)) { sb.AppendLine().Append("Write cache is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.WriteCache)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.WriteCache)) sb.Append(" and enabled"); } if(ATAID.CommandSet.HasFlag(CommandSetBit.Packet)) { sb.AppendLine().Append("PACKET is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Packet)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Packet)) sb.Append(" and enabled"); } if(ATAID.CommandSet.HasFlag(CommandSetBit.PowerManagement)) { sb.AppendLine().Append("Power management is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.PowerManagement)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.PowerManagement)) sb.Append(" and enabled"); } if(ATAID.CommandSet.HasFlag(CommandSetBit.RemovableMedia)) { sb.AppendLine().Append("Removable media feature set is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.RemovableMedia)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.RemovableMedia)) sb.Append(" and enabled"); } if(ATAID.CommandSet.HasFlag(CommandSetBit.SecurityMode)) { sb.AppendLine().Append("Security mode is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.SecurityMode)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.SecurityMode)) sb.Append(" and enabled"); } if(ATAID.Capabilities.HasFlag(CapabilitiesBit.LBASupport)) sb.AppendLine().Append("28-bit LBA is supported"); if(ATAID.CommandSet2.HasFlag(CommandSetBit2.MustBeSet) && - !ATAID.CommandSet2.HasFlag(CommandSetBit2.MustBeClear)) + !ATAID.CommandSet2.HasFlag(CommandSetBit2.MustBeClear)) { if(ATAID.CommandSet2.HasFlag(CommandSetBit2.LBA48)) { sb.AppendLine().Append("48-bit LBA is supported"); - if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.LBA48)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.LBA48)) sb.Append(" and enabled"); } if(ATAID.CommandSet2.HasFlag(CommandSetBit2.FlushCache)) { sb.AppendLine().Append("FLUSH CACHE is supported"); - if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCache)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCache)) sb.Append(" and enabled"); } if(ATAID.CommandSet2.HasFlag(CommandSetBit2.FlushCacheExt)) { sb.AppendLine().Append("FLUSH CACHE EXT is supported"); - if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCacheExt)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCacheExt)) sb.Append(" and enabled"); } if(ATAID.CommandSet2.HasFlag(CommandSetBit2.DCO)) { sb.AppendLine().Append("Device Configuration Overlay feature set is supported"); - if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.DCO)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.DCO)) sb.Append(" and enabled"); } if(ATAID.CommandSet2.HasFlag(CommandSetBit2.AAM)) { sb.AppendLine().Append("Automatic Acoustic Management is supported"); if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.AAM)) { - sb.AppendFormat(" and enabled with value {0} (vendor recommends {1}", - ATAID.CurrentAAM, ATAID.RecommendedAAM); + sb.AppendFormat(" and enabled with value {0} (vendor recommends {1}", ATAID.CurrentAAM, + ATAID.RecommendedAAM); } } if(ATAID.CommandSet2.HasFlag(CommandSetBit2.SetMax)) { sb.AppendLine().Append("SET MAX security extension is supported"); - if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.SetMax)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.SetMax)) sb.Append(" and enabled"); } if(ATAID.CommandSet2.HasFlag(CommandSetBit2.AddressOffsetReservedAreaBoot)) { @@ -3160,8 +3099,7 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.CommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby)) { sb.AppendLine().Append("Power-up in standby is supported"); - if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby)) sb.Append(" and enabled"); } if(ATAID.CommandSet2.HasFlag(CommandSetBit2.RemovableNotification)) { @@ -3180,28 +3118,24 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.CommandSet2.HasFlag(CommandSetBit2.CompactFlash)) { sb.AppendLine().Append("CompactFlash feature set is supported"); - if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.CompactFlash)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.CompactFlash)) sb.Append(" and enabled"); } if(ATAID.CommandSet2.HasFlag(CommandSetBit2.RWQueuedDMA)) { sb.AppendLine().Append("READ DMA QUEUED and WRITE DMA QUEUED are supported"); - if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.RWQueuedDMA)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.RWQueuedDMA)) sb.Append(" and enabled"); } if(ATAID.CommandSet2.HasFlag(CommandSetBit2.DownloadMicrocode)) { sb.AppendLine().Append("DOWNLOAD MICROCODE is supported"); - if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.DownloadMicrocode)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.DownloadMicrocode)) sb.Append(" and enabled"); } } if(ATAID.CommandSet.HasFlag(CommandSetBit.SMART)) { sb.AppendLine().Append("S.M.A.R.T. is supported"); - if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.SMART)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.SMART)) sb.Append(" and enabled"); } if(ATAID.SCTCommandTransport.HasFlag(SCTCommandTransportBit.Supported)) @@ -3213,20 +3147,17 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.CommandSet3.HasFlag(CommandSetBit3.SMARTSelfTest)) { sb.AppendLine().Append("S.M.A.R.T. self-testing is supported"); - if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTSelfTest)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTSelfTest)) sb.Append(" and enabled"); } if(ATAID.CommandSet3.HasFlag(CommandSetBit3.SMARTLog)) { sb.AppendLine().Append("S.M.A.R.T. error logging is supported"); - if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTLog)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTLog)) sb.Append(" and enabled"); } if(ATAID.CommandSet3.HasFlag(CommandSetBit3.IdleImmediate)) { sb.AppendLine().Append("IDLE IMMEDIATE with UNLOAD FEATURE is supported"); - if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.IdleImmediate)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.IdleImmediate)) sb.Append(" and enabled"); } if(ATAID.CommandSet3.HasFlag(CommandSetBit3.WriteURG)) { @@ -3243,73 +3174,62 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.CommandSet3.HasFlag(CommandSetBit3.FUAWriteQ)) { sb.AppendLine().Append("WRITE DMA QUEUED FUA EXT is supported"); - if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWriteQ)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWriteQ)) sb.Append(" and enabled"); } if(ATAID.CommandSet3.HasFlag(CommandSetBit3.FUAWrite)) { sb.AppendLine().Append("WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported"); - if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWrite)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWrite)) sb.Append(" and enabled"); } if(ATAID.CommandSet3.HasFlag(CommandSetBit3.GPL)) { sb.AppendLine().Append("General Purpose Logging is supported"); - if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.GPL)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.GPL)) sb.Append(" and enabled"); } if(ATAID.CommandSet3.HasFlag(CommandSetBit3.Streaming)) { sb.AppendLine().Append("Streaming feature set is supported"); - if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.Streaming)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.Streaming)) sb.Append(" and enabled"); } if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MCPT)) { sb.AppendLine().Append("Media Card Pass Through command set is supported"); - if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.MCPT)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.MCPT)) sb.Append(" and enabled"); } if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MediaSerial)) { sb.AppendLine().Append("Media Serial is supported"); - if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.MediaSerial)) - sb.Append(" and valid"); + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.MediaSerial)) sb.Append(" and valid"); } } if(ATAID.CommandSet4.HasFlag(CommandSetBit4.MustBeSet) && - !ATAID.CommandSet4.HasFlag(CommandSetBit4.MustBeClear)) + !ATAID.CommandSet4.HasFlag(CommandSetBit4.MustBeClear)) { if(ATAID.CommandSet4.HasFlag(CommandSetBit4.DSN)) { sb.AppendLine().Append("DSN feature set is supported"); - if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.DSN)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.DSN)) sb.Append(" and enabled"); } if(ATAID.CommandSet4.HasFlag(CommandSetBit4.AMAC)) { sb.AppendLine().Append("Accessible Max Address Configuration is supported"); - if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.AMAC)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.AMAC)) sb.Append(" and enabled"); } if(ATAID.CommandSet4.HasFlag(CommandSetBit4.ExtPowerCond)) { sb.AppendLine().Append("Extended Power Conditions are supported"); - if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtPowerCond)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtPowerCond)) sb.Append(" and enabled"); } if(ATAID.CommandSet4.HasFlag(CommandSetBit4.ExtStatusReport)) { sb.AppendLine().Append("Extended Status Reporting is supported"); - if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtStatusReport)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtStatusReport)) sb.Append(" and enabled"); } if(ATAID.CommandSet4.HasFlag(CommandSetBit4.FreeFallControl)) { sb.AppendLine().Append("Free-fall control feature set is supported"); - if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.FreeFallControl)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.FreeFallControl)) sb.Append(" and enabled"); } if(ATAID.CommandSet4.HasFlag(CommandSetBit4.SegmentedDownloadMicrocode)) { @@ -3320,20 +3240,17 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.CommandSet4.HasFlag(CommandSetBit4.RWDMAExtGpl)) { sb.AppendLine().Append("READ/WRITE DMA EXT GPL are supported"); - if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.RWDMAExtGpl)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.RWDMAExtGpl)) sb.Append(" and enabled"); } if(ATAID.CommandSet4.HasFlag(CommandSetBit4.WriteUnc)) { sb.AppendLine().Append("WRITE UNCORRECTABLE is supported"); - if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WriteUnc)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WriteUnc)) sb.Append(" and enabled"); } if(ATAID.CommandSet4.HasFlag(CommandSetBit4.WRV)) { sb.AppendLine().Append("Write/Read/Verify is supported"); - if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV)) sb.Append(" and enabled"); sb.AppendLine().AppendFormat("{0} sectors for Write/Read/Verify mode 2", ATAID.WRVSectorCountMode2); sb.AppendLine().AppendFormat("{0} sectors for Write/Read/Verify mode 3", ATAID.WRVSectorCountMode3); if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV)) @@ -3342,8 +3259,7 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.CommandSet4.HasFlag(CommandSetBit4.DT1825)) { sb.AppendLine().Append("DT1825 is supported"); - if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.DT1825)) - sb.Append(" and enabled"); + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.DT1825)) sb.Append(" and enabled"); } } if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.BlockErase)) @@ -3355,7 +3271,8 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.CommandSet5.HasFlag(CommandSetBit5.DeviceConfDMA)) { - sb.AppendLine().Append("DEVICE CONFIGURATION IDENTIFY DMA and DEVICE CONFIGURATION SET DMA are supported"); + sb.AppendLine() + .Append("DEVICE CONFIGURATION IDENTIFY DMA and DEVICE CONFIGURATION SET DMA are supported"); } if(ATAID.CommandSet5.HasFlag(CommandSetBit5.ReadBufferDMA)) { @@ -3408,18 +3325,14 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().Append("Device's write cache is non-volatile"); } if(ATAID.CommandSet5.HasFlag(CommandSetBit5.ZonedBit0) || - ATAID.CommandSet5.HasFlag(CommandSetBit5.ZonedBit1)) - { - sb.AppendLine().Append("Device is zoned"); - } + ATAID.CommandSet5.HasFlag(CommandSetBit5.ZonedBit1)) { sb.AppendLine().Append("Device is zoned"); } if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.Sanitize)) { sb.AppendLine().Append("Sanitize feature set is supported"); if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.SanitizeCommands)) sb.AppendLine().Append("Sanitize commands are specified by ACS-3 or higher"); - else - sb.AppendLine().Append("Sanitize commands are specified by ACS-2"); + else sb.AppendLine().Append("Sanitize commands are specified by ACS-2"); if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.SanitizeAntifreeze)) sb.AppendLine().Append("SANITIZE ANTIFREEZE LOCK EXT is supported"); @@ -3428,13 +3341,13 @@ namespace DiscImageChef.Decoders.ATA if(!ata1 && maxatalevel >= 8) { if(ATAID.TrustedComputing.HasFlag(TrustedComputingBit.Set) && - !ATAID.TrustedComputing.HasFlag(TrustedComputingBit.Clear) && - ATAID.TrustedComputing.HasFlag(TrustedComputingBit.TrustedComputing)) + !ATAID.TrustedComputing.HasFlag(TrustedComputingBit.Clear) && + ATAID.TrustedComputing.HasFlag(TrustedComputingBit.TrustedComputing)) sb.AppendLine().Append("Trusted Computing feature set is supported"); } if(((ATAID.TransportMajorVersion & 0xF000) >> 12) == 0x1 || - ((ATAID.TransportMajorVersion & 0xF000) >> 12) == 0xE) + ((ATAID.TransportMajorVersion & 0xF000) >> 12) == 0xE) { if(!ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear)) { @@ -3459,20 +3372,17 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.DMASetup)) { sb.AppendLine().Append("DMA Setup auto-activation is supported"); - if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.DMASetup)) - sb.Append(" and enabled"); + if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.DMASetup)) sb.Append(" and enabled"); } if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.InitPowerMgmt)) { sb.AppendLine().Append("Device-initiated power management is supported"); - if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InitPowerMgmt)) - sb.Append(" and enabled"); + if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InitPowerMgmt)) sb.Append(" and enabled"); } if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.InOrderData)) { sb.AppendLine().Append("In-order data delivery is supported"); - if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InOrderData)) - sb.Append(" and enabled"); + if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InOrderData)) sb.Append(" and enabled"); } if(!atapi) { @@ -3506,7 +3416,6 @@ namespace DiscImageChef.Decoders.ATA { sb.AppendLine().Append("Automatic Partial to Slumber transitions are enabled"); } - } } if((ATAID.RemovableStatusSet & 0x03) > 0) @@ -3519,11 +3428,11 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().AppendFormat("Free-fall sensitivity set to {0}", ATAID.FreeFallSensitivity); } - if(ATAID.DataSetMgmt.HasFlag(DataSetMgmtBit.Trim)) - sb.AppendLine().Append("TRIM is supported"); + if(ATAID.DataSetMgmt.HasFlag(DataSetMgmtBit.Trim)) sb.AppendLine().Append("TRIM is supported"); if(ATAID.DataSetMgmtSize > 0) { - sb.AppendLine().AppendFormat("DATA SET MANAGEMENT can receive a maximum of {0} blocks of 512 bytes", ATAID.DataSetMgmtSize); + sb.AppendLine().AppendFormat("DATA SET MANAGEMENT can receive a maximum of {0} blocks of 512 bytes", + ATAID.DataSetMgmtSize); } sb.AppendLine().AppendLine(); @@ -3533,42 +3442,36 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Enabled)) { sb.AppendLine("Security is enabled"); - if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Locked)) - sb.AppendLine("Security is locked"); - else - sb.AppendLine("Security is not locked"); + if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Locked)) sb.AppendLine("Security is locked"); + else sb.AppendLine("Security is not locked"); - if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Frozen)) - sb.AppendLine("Security is frozen"); - else - sb.AppendLine("Security is not frozen"); + if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Frozen)) sb.AppendLine("Security is frozen"); + else sb.AppendLine("Security is not frozen"); if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Expired)) sb.AppendLine("Security count has expired"); - else - sb.AppendLine("Security count has notexpired"); + else sb.AppendLine("Security count has notexpired"); if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Maximum)) sb.AppendLine("Security level is maximum"); - else - sb.AppendLine("Security level is high"); + else sb.AppendLine("Security level is high"); } - else - sb.AppendLine("Security is not enabled"); + else sb.AppendLine("Security is not enabled"); if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced)) sb.AppendLine("Supports enhanced security erase"); sb.AppendFormat("{0} minutes to complete secure erase", ATAID.SecurityEraseTime * 2).AppendLine(); if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced)) - sb.AppendFormat("{0} minutes to complete enhanced secure erase", ATAID.EnhancedSecurityEraseTime * 2).AppendLine(); + sb.AppendFormat("{0} minutes to complete enhanced secure erase", + ATAID.EnhancedSecurityEraseTime * 2).AppendLine(); sb.AppendFormat("Master password revision code: {0}", ATAID.MasterPasswordRevisionCode).AppendLine(); } if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && - !ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeClear) && - ATAID.CommandSet3.HasFlag(CommandSetBit3.Streaming)) + !ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeClear) && + ATAID.CommandSet3.HasFlag(CommandSetBit3.Streaming)) { sb.AppendLine().AppendLine("Streaming:"); sb.AppendFormat("Minimum request size is {0}", ATAID.StreamMinReqSize); @@ -3600,13 +3503,13 @@ namespace DiscImageChef.Decoders.ATA if((ATAID.NVCacheCaps & 0x0001) == 0x0001) { sb.Append("Power mode feature set is supported"); - if((ATAID.NVCacheCaps & 0x0002) == 0x0002) - sb.Append(" and enabled"); + if((ATAID.NVCacheCaps & 0x0002) == 0x0002) sb.Append(" and enabled"); sb.AppendLine(); sb.AppendLine().AppendFormat("Version {0}", (ATAID.NVCacheCaps & 0x0F00) >> 8).AppendLine(); } - sb.AppendLine().AppendFormat("Non-Volatile Cache is {0} bytes", ATAID.NVCacheSize * logicalsectorsize).AppendLine(); + sb.AppendLine().AppendFormat("Non-Volatile Cache is {0} bytes", ATAID.NVCacheSize * logicalsectorsize) + .AppendLine(); } #if DEBUG @@ -3644,6 +3547,7 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.ReservedCFA[i] != 0x0000 && ATAID.ReservedCFA[i] != 0xFFFF) sb.AppendFormat("Word {1} (CFA): 0x{0:X4}", ATAID.ReservedCFA[i], 161 + i).AppendLine(); } + if(ATAID.ReservedWord174 != 0x0000 && ATAID.ReservedWord174 != 0xFFFF) sb.AppendFormat("Word 174: 0x{0:X4}", ATAID.ReservedWord174).AppendLine(); if(ATAID.ReservedWord175 != 0x0000 && ATAID.ReservedWord175 != 0xFFFF) @@ -3704,5 +3608,4 @@ namespace DiscImageChef.Decoders.ATA return outStr.Trim(); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/ATA/Registers.cs b/DiscImageChef.Decoders/ATA/Registers.cs index 5d46c92c..965daec3 100644 --- a/DiscImageChef.Decoders/ATA/Registers.cs +++ b/DiscImageChef.Decoders/ATA/Registers.cs @@ -100,5 +100,4 @@ namespace DiscImageChef.Decoders.ATA public byte deviceHead; public byte command; } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Blu-ray/BCA.cs b/DiscImageChef.Decoders/Blu-ray/BCA.cs index 0008e3d4..a9684fbe 100644 --- a/DiscImageChef.Decoders/Blu-ray/BCA.cs +++ b/DiscImageChef.Decoders/Blu-ray/BCA.cs @@ -56,12 +56,12 @@ namespace DiscImageChef.Decoders.Bluray #region Public methods public static BurstCuttingArea? Decode(byte[] BCAResponse) { - if(BCAResponse == null) - return null; + if(BCAResponse == null) return null; if(BCAResponse.Length != 68) { - DicConsole.DebugWriteLine("BD BCA decoder", "Found incorrect Blu-ray BCA size ({0} bytes)", BCAResponse.Length); + DicConsole.DebugWriteLine("BD BCA decoder", "Found incorrect Blu-ray BCA size ({0} bytes)", + BCAResponse.Length); return null; } @@ -80,18 +80,15 @@ namespace DiscImageChef.Decoders.Bluray public static string Prettify(BurstCuttingArea? BCAResponse) { - if(BCAResponse == null) - return null; + if(BCAResponse == null) return null; BurstCuttingArea response = BCAResponse.Value; StringBuilder sb = new StringBuilder(); #if DEBUG - if(response.Reserved1 != 0) - sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); - if(response.Reserved2 != 0) - sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); + if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); + if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); #endif sb.AppendFormat("Blu-ray Burst Cutting Area in hex follows:"); @@ -132,5 +129,4 @@ namespace DiscImageChef.Decoders.Bluray } #endregion Public structures } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Blu-ray/Cartridge.cs b/DiscImageChef.Decoders/Blu-ray/Cartridge.cs index 7819b96d..b14ad355 100644 --- a/DiscImageChef.Decoders/Blu-ray/Cartridge.cs +++ b/DiscImageChef.Decoders/Blu-ray/Cartridge.cs @@ -56,12 +56,13 @@ namespace DiscImageChef.Decoders.Bluray #region Public methods public static CartridgeStatus? Decode(byte[] CSResponse) { - if(CSResponse == null) - return null; + if(CSResponse == null) return null; if(CSResponse.Length != 8) { - DicConsole.DebugWriteLine("BD Cartridge Status decoder", "Found incorrect Blu-ray Cartridge Status size ({0} bytes)", CSResponse.Length); + DicConsole.DebugWriteLine("BD Cartridge Status decoder", + "Found incorrect Blu-ray Cartridge Status size ({0} bytes)", + CSResponse.Length); return null; } @@ -86,47 +87,35 @@ namespace DiscImageChef.Decoders.Bluray public static string Prettify(CartridgeStatus? CSResponse) { - if(CSResponse == null) - return null; + if(CSResponse == null) return null; CartridgeStatus response = CSResponse.Value; StringBuilder sb = new StringBuilder(); #if DEBUG - if(response.Reserved1 != 0) - sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); - if(response.Reserved2 != 0) - sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); - if(response.Reserved3 != 0) - sb.AppendFormat("Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine(); - if(response.Reserved4 != 0) - sb.AppendFormat("Reserved4 = 0x{0:X8}", response.Reserved4).AppendLine(); - if(response.Reserved5 != 0) - sb.AppendFormat("Reserved5 = 0x{0:X8}", response.Reserved5).AppendLine(); - if(response.Reserved6 != 0) - sb.AppendFormat("Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine(); - if(response.Reserved7 != 0) - sb.AppendFormat("Reserved7 = 0x{0:X8}", response.Reserved7).AppendLine(); + if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); + if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); + if(response.Reserved3 != 0) sb.AppendFormat("Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine(); + if(response.Reserved4 != 0) sb.AppendFormat("Reserved4 = 0x{0:X8}", response.Reserved4).AppendLine(); + if(response.Reserved5 != 0) sb.AppendFormat("Reserved5 = 0x{0:X8}", response.Reserved5).AppendLine(); + if(response.Reserved6 != 0) sb.AppendFormat("Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine(); + if(response.Reserved7 != 0) sb.AppendFormat("Reserved7 = 0x{0:X8}", response.Reserved7).AppendLine(); #endif if(response.Cartridge) { sb.AppendLine("Media is inserted in a cartridge"); - if(response.OUT) - sb.AppendLine("Media has been taken out, or inserted in, the cartridge"); - if(response.CWP) - sb.AppendLine("Media is write protected"); + if(response.OUT) sb.AppendLine("Media has been taken out, or inserted in, the cartridge"); + if(response.CWP) sb.AppendLine("Media is write protected"); } else { sb.AppendLine("Media is not in a cartridge"); #if DEBUG - if(response.OUT) - sb.AppendLine("Media has out bit marked, shouldn't"); - if(response.CWP) - sb.AppendLine("Media has write protection bit marked, shouldn't"); + if(response.OUT) sb.AppendLine("Media has out bit marked, shouldn't"); + if(response.CWP) sb.AppendLine("Media has write protection bit marked, shouldn't"); #endif } return sb.ToString(); @@ -199,5 +188,4 @@ namespace DiscImageChef.Decoders.Bluray } #endregion Public structures } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Blu-ray/DDS.cs b/DiscImageChef.Decoders/Blu-ray/DDS.cs index 74fb347a..cf29a2ad 100644 --- a/DiscImageChef.Decoders/Blu-ray/DDS.cs +++ b/DiscImageChef.Decoders/Blu-ray/DDS.cs @@ -63,8 +63,7 @@ namespace DiscImageChef.Decoders.Bluray #region Public methods public static DiscDefinitionStructure? Decode(byte[] DDSResponse) { - if(DDSResponse == null) - return null; + if(DDSResponse == null) return null; DiscDefinitionStructure decoded = new DiscDefinitionStructure(); @@ -76,10 +75,11 @@ namespace DiscImageChef.Decoders.Bluray decoded.Signature = BigEndianBitConverter.ToUInt16(DDSResponse, 4); if(decoded.Signature != DDSIdentifier) { - DicConsole.DebugWriteLine("BD DDS decoder", "Found incorrect DDS signature (0x{0:X4})", decoded.Signature); + DicConsole.DebugWriteLine("BD DDS decoder", "Found incorrect DDS signature (0x{0:X4})", + decoded.Signature); return null; - } + decoded.Format = DDSResponse[6]; decoded.Reserved3 = DDSResponse[7]; decoded.UpdateCount = BigEndianBitConverter.ToUInt32(DDSResponse, 8); @@ -109,8 +109,7 @@ namespace DiscImageChef.Decoders.Bluray public static string Prettify(DiscDefinitionStructure? DDSResponse) { - if(DDSResponse == null) - return null; + if(DDSResponse == null) return null; DiscDefinitionStructure response = DDSResponse.Value; @@ -134,24 +133,15 @@ namespace DiscImageChef.Decoders.Bluray sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.DiscTypeSpecificData, 80)); #if DEBUG - if(response.Reserved1 != 0) - sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); - if(response.Reserved2 != 0) - sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); - if(response.Reserved3 != 0) - sb.AppendFormat("Reserved3 = 0x{0:X2}", response.Reserved3).AppendLine(); - if(response.Reserved4 != 0) - sb.AppendFormat("Reserved4 = 0x{0:X16}", response.Reserved4).AppendLine(); - if(response.Reserved5 != 0) - sb.AppendFormat("Reserved5 = 0x{0:X8}", response.Reserved5).AppendLine(); - if(response.Reserved6 != 0) - sb.AppendFormat("Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine(); - if(response.Reserved7 != 0) - sb.AppendFormat("Reserved7 = 0x{0:X2}", response.Reserved7).AppendLine(); - if(response.Reserved8 != 0) - sb.AppendFormat("Reserved8 = 0x{0:X2}", response.Reserved8).AppendLine(); - if(response.Reserved9 != 0) - sb.AppendFormat("Reserved9 = 0x{0:X8}", response.Reserved9).AppendLine(); + if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); + if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); + if(response.Reserved3 != 0) sb.AppendFormat("Reserved3 = 0x{0:X2}", response.Reserved3).AppendLine(); + if(response.Reserved4 != 0) sb.AppendFormat("Reserved4 = 0x{0:X16}", response.Reserved4).AppendLine(); + if(response.Reserved5 != 0) sb.AppendFormat("Reserved5 = 0x{0:X8}", response.Reserved5).AppendLine(); + if(response.Reserved6 != 0) sb.AppendFormat("Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine(); + if(response.Reserved7 != 0) sb.AppendFormat("Reserved7 = 0x{0:X2}", response.Reserved7).AppendLine(); + if(response.Reserved8 != 0) sb.AppendFormat("Reserved8 = 0x{0:X2}", response.Reserved8).AppendLine(); + if(response.Reserved9 != 0) sb.AppendFormat("Reserved9 = 0x{0:X8}", response.Reserved9).AppendLine(); #endif return sb.ToString(); @@ -294,5 +284,4 @@ namespace DiscImageChef.Decoders.Bluray } #endregion Public structures } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Blu-ray/DI.cs b/DiscImageChef.Decoders/Blu-ray/DI.cs index da1c680c..e7546df0 100644 --- a/DiscImageChef.Decoders/Blu-ray/DI.cs +++ b/DiscImageChef.Decoders/Blu-ray/DI.cs @@ -68,12 +68,13 @@ namespace DiscImageChef.Decoders.Bluray #region Public methods public static DiscInformation? Decode(byte[] DIResponse) { - if(DIResponse == null) - return null; + if(DIResponse == null) return null; if(DIResponse.Length != 4100) { - DicConsole.DebugWriteLine("BD Disc Information decoder", "Found incorrect Blu-ray Disc Information size ({0} bytes)", DIResponse.Length); + DicConsole.DebugWriteLine("BD Disc Information decoder", + "Found incorrect Blu-ray Disc Information size ({0} bytes)", + DIResponse.Length); return null; } @@ -90,14 +91,12 @@ namespace DiscImageChef.Decoders.Bluray while(true) { - if(offset >= 100) - break; + if(offset >= 100) break; DiscInformationUnits unit = new DiscInformationUnits(); unit.Signature = BigEndianBitConverter.ToUInt16(DIResponse, 0 + offset); - if(unit.Signature != DIUIdentifier) - break; + if(unit.Signature != DIUIdentifier) break; unit.Format = DIResponse[2 + offset]; unit.UnitsPerBlock = DIResponse[3 + offset]; @@ -111,29 +110,31 @@ namespace DiscImageChef.Decoders.Bluray switch(Encoding.ASCII.GetString(unit.DiscTypeIdentifier)) { case DiscTypeBDROM: - { - unit.FormatDependentContents = new byte[52]; - Array.Copy(DIResponse, 12 + offset, unit.DiscTypeIdentifier, 0, 52); - break; - } + { + unit.FormatDependentContents = new byte[52]; + Array.Copy(DIResponse, 12 + offset, unit.DiscTypeIdentifier, 0, 52); + break; + } case DiscTypeBDRE: case DiscTypeBDR: - { - unit.FormatDependentContents = new byte[88]; - Array.Copy(DIResponse, 12 + offset, unit.DiscTypeIdentifier, 0, 88); - unit.ManufacturerID = new byte[6]; - Array.Copy(DIResponse, 100 + offset, unit.ManufacturerID, 0, 6); - unit.MediaTypeID = new byte[3]; - Array.Copy(DIResponse, 106 + offset, unit.MediaTypeID, 0, 3); - unit.TimeStamp = BigEndianBitConverter.ToUInt16(DIResponse, 109 + offset); - unit.ProductRevisionNumber = DIResponse[111 + offset]; - break; - } + { + unit.FormatDependentContents = new byte[88]; + Array.Copy(DIResponse, 12 + offset, unit.DiscTypeIdentifier, 0, 88); + unit.ManufacturerID = new byte[6]; + Array.Copy(DIResponse, 100 + offset, unit.ManufacturerID, 0, 6); + unit.MediaTypeID = new byte[3]; + Array.Copy(DIResponse, 106 + offset, unit.MediaTypeID, 0, 3); + unit.TimeStamp = BigEndianBitConverter.ToUInt16(DIResponse, 109 + offset); + unit.ProductRevisionNumber = DIResponse[111 + offset]; + break; + } default: - { - DicConsole.DebugWriteLine("BD Disc Information decoder", "Found unknown disc type identifier \"{0}\"", Encoding.ASCII.GetString(unit.DiscTypeIdentifier)); - break; - } + { + DicConsole.DebugWriteLine("BD Disc Information decoder", + "Found unknown disc type identifier \"{0}\"", + Encoding.ASCII.GetString(unit.DiscTypeIdentifier)); + break; + } } units.Add(unit); @@ -144,8 +145,7 @@ namespace DiscImageChef.Decoders.Bluray if(units.Count > 0) { decoded.Units = new DiscInformationUnits[units.Count]; - for(int i = 0; i < units.Count; i++) - decoded.Units[i] = units[i]; + for(int i = 0; i < units.Count; i++) decoded.Units[i] = units[i]; } return decoded; @@ -153,8 +153,7 @@ namespace DiscImageChef.Decoders.Bluray public static string Prettify(DiscInformation? DIResponse) { - if(DIResponse == null) - return null; + if(DIResponse == null) return null; DiscInformation response = DIResponse.Value; @@ -168,13 +167,16 @@ namespace DiscImageChef.Decoders.Bluray if(Encoding.ASCII.GetString(unit.DiscTypeIdentifier) != DiscTypeBDROM) sb.AppendFormat("Legacy value: 0x{0:X2}", unit.Legacy).AppendLine(); sb.AppendFormat("DI Unit is {0} bytes", unit.Length).AppendLine(); - sb.AppendFormat("Disc type identifier: \"{0}\"", Encoding.ASCII.GetString(unit.DiscTypeIdentifier)).AppendLine(); + sb.AppendFormat("Disc type identifier: \"{0}\"", Encoding.ASCII.GetString(unit.DiscTypeIdentifier)) + .AppendLine(); sb.AppendFormat("Disc size/class/version: {0}", unit.DiscSizeClassVersion).AppendLine(); if(Encoding.ASCII.GetString(unit.DiscTypeIdentifier) == DiscTypeBDR || - Encoding.ASCII.GetString(unit.DiscTypeIdentifier) == DiscTypeBDRE) + Encoding.ASCII.GetString(unit.DiscTypeIdentifier) == DiscTypeBDRE) { - sb.AppendFormat("Disc manufacturer ID: \"{0}\"", Encoding.ASCII.GetString(unit.ManufacturerID)).AppendLine(); - sb.AppendFormat("Disc media type ID: \"{0}\"", Encoding.ASCII.GetString(unit.MediaTypeID)).AppendLine(); + sb.AppendFormat("Disc manufacturer ID: \"{0}\"", Encoding.ASCII.GetString(unit.ManufacturerID)) + .AppendLine(); + sb.AppendFormat("Disc media type ID: \"{0}\"", Encoding.ASCII.GetString(unit.MediaTypeID)) + .AppendLine(); sb.AppendFormat("Disc timestamp: 0x{0:X2}", unit.TimeStamp).AppendLine(); sb.AppendFormat("Disc product revison number: {0}", unit.ProductRevisionNumber).AppendLine(); } @@ -292,5 +294,4 @@ namespace DiscImageChef.Decoders.Bluray } #endregion Public structures } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Blu-ray/Spare.cs b/DiscImageChef.Decoders/Blu-ray/Spare.cs index f873e73a..5fc35712 100644 --- a/DiscImageChef.Decoders/Blu-ray/Spare.cs +++ b/DiscImageChef.Decoders/Blu-ray/Spare.cs @@ -56,12 +56,13 @@ namespace DiscImageChef.Decoders.Bluray #region Public methods public static SpareAreaInformation? Decode(byte[] SAIResponse) { - if(SAIResponse == null) - return null; + if(SAIResponse == null) return null; if(SAIResponse.Length != 16) { - DicConsole.DebugWriteLine("BD Spare Area Information decoder", "Found incorrect Blu-ray Spare Area Information size ({0} bytes)", SAIResponse.Length); + DicConsole.DebugWriteLine("BD Spare Area Information decoder", + "Found incorrect Blu-ray Spare Area Information size ({0} bytes)", + SAIResponse.Length); return null; } @@ -81,20 +82,16 @@ namespace DiscImageChef.Decoders.Bluray public static string Prettify(SpareAreaInformation? SAIResponse) { - if(SAIResponse == null) - return null; + if(SAIResponse == null) return null; SpareAreaInformation response = SAIResponse.Value; StringBuilder sb = new StringBuilder(); #if DEBUG - if(response.Reserved1 != 0) - sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); - if(response.Reserved2 != 0) - sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); - if(response.Reserved3 != 0) - sb.AppendFormat("Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine(); + if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); + if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); + if(response.Reserved3 != 0) sb.AppendFormat("Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine(); #endif sb.AppendFormat("{0} free spare blocks", response.FreeSpareBlocks).AppendLine(); sb.AppendFormat("{0} allocated spare blocks", response.AllocatedSpareBlocks).AppendLine(); @@ -144,5 +141,4 @@ namespace DiscImageChef.Decoders.Bluray } #endregion Public structures } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/CD/ATIP.cs b/DiscImageChef.Decoders/CD/ATIP.cs index b999a8ee..c8b13628 100644 --- a/DiscImageChef.Decoders/CD/ATIP.cs +++ b/DiscImageChef.Decoders/CD/ATIP.cs @@ -219,8 +219,7 @@ namespace DiscImageChef.Decoders.CD public static CDATIP? Decode(byte[] CDATIPResponse) { - if(CDATIPResponse == null) - return null; + if(CDATIPResponse == null) return null; CDATIP decoded = new CDATIP(); @@ -228,7 +227,9 @@ namespace DiscImageChef.Decoders.CD if(CDATIPResponse.Length != 32 && CDATIPResponse.Length != 28) { - DicConsole.DebugWriteLine("CD ATIP decoder", "Expected CD ATIP size (32 bytes) is not received size ({0} bytes), not decoding", CDATIPResponse.Length); + DicConsole.DebugWriteLine("CD ATIP decoder", + "Expected CD ATIP size (32 bytes) is not received size ({0} bytes), not decoding", + CDATIPResponse.Length); return null; } @@ -283,8 +284,7 @@ namespace DiscImageChef.Decoders.CD public static string Prettify(CDATIP? CDATIPResponse) { - if(CDATIPResponse == null) - return null; + if(CDATIPResponse == null) return null; CDATIP response = CDATIPResponse.Value; @@ -293,10 +293,8 @@ namespace DiscImageChef.Decoders.CD if(response.DDCD) { sb.AppendFormat("Indicative Target Writing Power: 0x{0:X2}", response.ITWP).AppendLine(); - if(response.DiscType) - sb.AppendLine("Disc is DDCD-RW"); - else - sb.AppendLine("Disc is DDCD-R"); + if(response.DiscType) sb.AppendLine("Disc is DDCD-RW"); + else sb.AppendLine("Disc is DDCD-R"); switch(response.ReferenceSpeed) { case 2: @@ -309,9 +307,16 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("Reference speed set is unknown: {0}", response.ReferenceSpeed).AppendLine(); break; } - sb.AppendFormat("ATIP Start time of Lead-in: 0x{0:X6}", (response.LeadInStartMin << 16) + (response.LeadInStartSec << 8) + response.LeadInStartFrame).AppendLine(); - sb.AppendFormat("ATIP Last possible start time of Lead-out: 0x{0:X6}", (response.LeadOutStartMin << 16) + (response.LeadOutStartSec << 8) + response.LeadOutStartFrame).AppendLine(); - sb.AppendFormat("S4 value: 0x{0:X6}", (response.S4Values[0] << 16) + (response.S4Values[1] << 8) + response.S4Values[2]).AppendLine(); + + sb.AppendFormat("ATIP Start time of Lead-in: 0x{0:X6}", + (response.LeadInStartMin << 16) + (response.LeadInStartSec << 8) + + response.LeadInStartFrame).AppendLine(); + sb.AppendFormat("ATIP Last possible start time of Lead-out: 0x{0:X6}", + (response.LeadOutStartMin << 16) + (response.LeadOutStartSec << 8) + + response.LeadOutStartFrame).AppendLine(); + sb.AppendFormat("S4 value: 0x{0:X6}", + (response.S4Values[0] << 16) + (response.S4Values[1] << 8) + response.S4Values[2]) + .AppendLine(); } else { @@ -354,7 +359,8 @@ namespace DiscImageChef.Decoders.CD sb.AppendLine("Reference speed is 2x"); break; default: - sb.AppendFormat("Reference speed set is unknown: {0}", response.ReferenceSpeed).AppendLine(); + sb.AppendFormat("Reference speed set is unknown: {0}", response.ReferenceSpeed) + .AppendLine(); break; } } @@ -393,21 +399,30 @@ namespace DiscImageChef.Decoders.CD } } - if(response.URU) - sb.AppendLine("Disc use is unrestricted"); - else - sb.AppendLine("Disc use is restricted"); + if(response.URU) sb.AppendLine("Disc use is unrestricted"); + else sb.AppendLine("Disc use is restricted"); - sb.AppendFormat("ATIP Start time of Lead-in: {0}:{1:D2}:{2:D2}", response.LeadInStartMin, response.LeadInStartSec, response.LeadInStartFrame).AppendLine(); - sb.AppendFormat("ATIP Last possible start time of Lead-out: {0}:{1:D2}:{2:D2}", response.LeadOutStartMin, response.LeadOutStartSec, response.LeadOutStartFrame).AppendLine(); + sb.AppendFormat("ATIP Start time of Lead-in: {0}:{1:D2}:{2:D2}", response.LeadInStartMin, + response.LeadInStartSec, response.LeadInStartFrame).AppendLine(); + sb.AppendFormat("ATIP Last possible start time of Lead-out: {0}:{1:D2}:{2:D2}", + response.LeadOutStartMin, response.LeadOutStartSec, response.LeadOutStartFrame) + .AppendLine(); if(response.A1Valid) - sb.AppendFormat("A1 value: 0x{0:X6}", (response.A1Values[0] << 16) + (response.A1Values[1] << 8) + response.A1Values[2]).AppendLine(); + sb.AppendFormat("A1 value: 0x{0:X6}", + (response.A1Values[0] << 16) + (response.A1Values[1] << 8) + response.A1Values[2]) + .AppendLine(); if(response.A2Valid) - sb.AppendFormat("A2 value: 0x{0:X6}", (response.A2Values[0] << 16) + (response.A2Values[1] << 8) + response.A2Values[2]).AppendLine(); + sb.AppendFormat("A2 value: 0x{0:X6}", + (response.A2Values[0] << 16) + (response.A2Values[1] << 8) + response.A2Values[2]) + .AppendLine(); if(response.A3Valid) - sb.AppendFormat("A3 value: 0x{0:X6}", (response.A3Values[0] << 16) + (response.A3Values[1] << 8) + response.A3Values[2]).AppendLine(); + sb.AppendFormat("A3 value: 0x{0:X6}", + (response.A3Values[0] << 16) + (response.A3Values[1] << 8) + response.A3Values[2]) + .AppendLine(); if(response.S4Values != null) - sb.AppendFormat("S4 value: 0x{0:X6}", (response.S4Values[0] << 16) + (response.S4Values[1] << 8) + response.S4Values[2]).AppendLine(); + sb.AppendFormat("S4 value: 0x{0:X6}", + (response.S4Values[0] << 16) + (response.S4Values[1] << 8) + response.S4Values[2]) + .AppendLine(); } if(response.LeadInStartMin == 97) @@ -416,20 +431,16 @@ namespace DiscImageChef.Decoders.CD int frm = response.LeadInStartFrame - type; string manufacturer = ""; - if(response.DiscType) - sb.AppendLine("Disc uses phase change"); + if(response.DiscType) sb.AppendLine("Disc uses phase change"); else { - if(type < 5) - sb.AppendLine("Disc uses long strategy type dye (Cyanine, AZO, etc...)"); - else - sb.AppendLine("Disc uses short strategy type dye (Phthalocyanine, etc...)"); + if(type < 5) sb.AppendLine("Disc uses long strategy type dye (Cyanine, AZO, etc...)"); + else sb.AppendLine("Disc uses short strategy type dye (Phthalocyanine, etc...)"); } manufacturer = ManufacturerFromATIP(response.LeadInStartSec, frm); - if(manufacturer != "") - sb.AppendFormat("Disc manufactured by: {0}", manufacturer).AppendLine(); + if(manufacturer != "") sb.AppendFormat("Disc manufactured by: {0}", manufacturer).AppendLine(); } return sb.ToString(); @@ -446,285 +457,198 @@ namespace DiscImageChef.Decoders.CD switch(sec) { case 15: - if(frm == 00) - return "TDK Corporation"; - if(frm == 10) - return "Ritek Co."; - if(frm == 20) - return "Mitsubishi Chemical Corporation"; - if(frm == 30) - return "NAN-YA Plastics Corporation"; + if(frm == 00) return "TDK Corporation"; + if(frm == 10) return "Ritek Co."; + if(frm == 20) return "Mitsubishi Chemical Corporation"; + if(frm == 30) return "NAN-YA Plastics Corporation"; + break; case 16: - if(frm == 20) - return "Shenzen SG&Gast Digital Optical Discs"; - if(frm == 30) - return "Grand Advance Technology Ltd."; + if(frm == 20) return "Shenzen SG&Gast Digital Optical Discs"; + if(frm == 30) return "Grand Advance Technology Ltd."; + break; case 17: - if(frm == 00) - return "Moser Baer India Limited"; + if(frm == 00) return "Moser Baer India Limited"; + break; case 18: - if(frm == 10) - return "Wealth Fair Investment Ltd."; - if(frm == 60) - return "Taroko International Co. Ltd."; + if(frm == 10) return "Wealth Fair Investment Ltd."; + if(frm == 60) return "Taroko International Co. Ltd."; + break; case 20: - if(frm == 10) - return "CDA Datenträger Albrechts GmbH"; + if(frm == 10) return "CDA Datenträger Albrechts GmbH"; + break; case 21: - if(frm == 10) - return "Grupo Condor S.L."; - if(frm == 30) - return "Bestdisc Technology Corporation"; - if(frm == 40) - return "Optical Disc Manufacturing Equipment"; - if(frm == 50) - return "Sound Sound Multi-Media Development Ltd."; + if(frm == 10) return "Grupo Condor S.L."; + if(frm == 30) return "Bestdisc Technology Corporation"; + if(frm == 40) return "Optical Disc Manufacturing Equipment"; + if(frm == 50) return "Sound Sound Multi-Media Development Ltd."; + break; case 22: - if(frm == 00) - return "Woongjin Media Corp."; - if(frm == 10) - return "Seantram Technology Inc."; - if(frm == 20) - return "Advanced Digital Media"; - if(frm == 30) - return "EXIMPO"; - if(frm == 40) - return "CIS Technology Inc."; - if(frm == 50) - return "Hong Kong Digital Technology Co., Ltd."; - if(frm == 60) - return "Acer Media Technology, Inc."; + if(frm == 00) return "Woongjin Media Corp."; + if(frm == 10) return "Seantram Technology Inc."; + if(frm == 20) return "Advanced Digital Media"; + if(frm == 30) return "EXIMPO"; + if(frm == 40) return "CIS Technology Inc."; + if(frm == 50) return "Hong Kong Digital Technology Co., Ltd."; + if(frm == 60) return "Acer Media Technology, Inc."; + break; case 23: - if(frm == 00) - return "Matsushita Electric Industrial Co., Ltd."; - if(frm == 10) - return "Doremi Media Co., Ltd."; - if(frm == 20) - return "Nacar Media s.r.l."; - if(frm == 30) - return "Audio Distributors Co., Ltd."; - if(frm == 40) - return "Victor Company of Japan, Ltd."; - if(frm == 50) - return "Optrom Inc."; - if(frm == 60) - return "Customer Pressing Oosterhout"; + if(frm == 00) return "Matsushita Electric Industrial Co., Ltd."; + if(frm == 10) return "Doremi Media Co., Ltd."; + if(frm == 20) return "Nacar Media s.r.l."; + if(frm == 30) return "Audio Distributors Co., Ltd."; + if(frm == 40) return "Victor Company of Japan, Ltd."; + if(frm == 50) return "Optrom Inc."; + if(frm == 60) return "Customer Pressing Oosterhout"; + break; case 24: - if(frm == 00) - return "Taiyo Yuden Company Ltd."; - if(frm == 10) - return "SONY Corporation"; - if(frm == 20) - return "Computer Support Italy s.r.l."; - if(frm == 30) - return "Unitech Japan Inc."; - if(frm == 40) - return "kdg mediatech AG"; - if(frm == 50) - return "Guann Yinn Co., Ltd."; - if(frm == 60) - return "Harmonic Hall Optical Disc Ltd."; + if(frm == 00) return "Taiyo Yuden Company Ltd."; + if(frm == 10) return "SONY Corporation"; + if(frm == 20) return "Computer Support Italy s.r.l."; + if(frm == 30) return "Unitech Japan Inc."; + if(frm == 40) return "kdg mediatech AG"; + if(frm == 50) return "Guann Yinn Co., Ltd."; + if(frm == 60) return "Harmonic Hall Optical Disc Ltd."; + break; case 25: - if(frm == 00) - return "MPO"; - if(frm == 20) - return "Hitachi Maxell, Ltd."; - if(frm == 30) - return "Infodisc Technology Co. Ltd."; - if(frm == 40) - return "Vivastar AG"; - if(frm == 50) - return "AMS Technology Inc."; - if(frm == 60) - return "Xcitec Inc."; + if(frm == 00) return "MPO"; + if(frm == 20) return "Hitachi Maxell, Ltd."; + if(frm == 30) return "Infodisc Technology Co. Ltd."; + if(frm == 40) return "Vivastar AG"; + if(frm == 50) return "AMS Technology Inc."; + if(frm == 60) return "Xcitec Inc."; + break; case 26: - if(frm == 00) - return "Fornet International Pte Ltd."; - if(frm == 10) - return "POSTECH Corporation"; - if(frm == 20) - return "SKC Co., Ltd."; - if(frm == 30) - return "Optical Disc Corporation"; - if(frm == 40) - return "FUJI Photo Film Co., Ltd."; - if(frm == 50) - return "Lead Data Inc."; - if(frm == 60) - return "CMC Magnetics Corporation"; + if(frm == 00) return "Fornet International Pte Ltd."; + if(frm == 10) return "POSTECH Corporation"; + if(frm == 20) return "SKC Co., Ltd."; + if(frm == 30) return "Optical Disc Corporation"; + if(frm == 40) return "FUJI Photo Film Co., Ltd."; + if(frm == 50) return "Lead Data Inc."; + if(frm == 60) return "CMC Magnetics Corporation"; + break; case 27: - if(frm == 00) - return "Digital Storage Technology Co., Ltd."; - if(frm == 10) - return "Plasmon Data systems Ltd."; - if(frm == 20) - return "Princo Corporation"; - if(frm == 30) - return "Pioneer Video Corporation"; - if(frm == 40) - return "Kodak Japan Ltd."; - if(frm == 50) - return "Mitsui Chemicals, Inc."; - if(frm == 60) - return "Ricoh Company Ltd."; + if(frm == 00) return "Digital Storage Technology Co., Ltd."; + if(frm == 10) return "Plasmon Data systems Ltd."; + if(frm == 20) return "Princo Corporation"; + if(frm == 30) return "Pioneer Video Corporation"; + if(frm == 40) return "Kodak Japan Ltd."; + if(frm == 50) return "Mitsui Chemicals, Inc."; + if(frm == 60) return "Ricoh Company Ltd."; + break; case 28: - if(frm == 00) - return "Opti.Me.S. S.p.A."; - if(frm == 10) - return "Gigastore Corporation"; - if(frm == 20) - return "Multi Media Masters & Machinary SA"; - if(frm == 30) - return "Auvistar Industry Co., Ltd."; - if(frm == 40) - return "King Pro Mediatek Inc."; - if(frm == 50) - return "Delphi Technology Inc."; - if(frm == 60) - return "Friendly CD-Tek Co."; + if(frm == 00) return "Opti.Me.S. S.p.A."; + if(frm == 10) return "Gigastore Corporation"; + if(frm == 20) return "Multi Media Masters & Machinary SA"; + if(frm == 30) return "Auvistar Industry Co., Ltd."; + if(frm == 40) return "King Pro Mediatek Inc."; + if(frm == 50) return "Delphi Technology Inc."; + if(frm == 60) return "Friendly CD-Tek Co."; + break; case 29: - if(frm == 00) - return "Taeil Media Co., Ltd."; - if(frm == 10) - return "Vanguard Disc Inc."; - if(frm == 20) - return "Unidisc Technology Co., Ltd."; - if(frm == 30) - return "Hile Optical Disc Technology Corp."; - if(frm == 40) - return "Viva Magnetics Ltd."; - if(frm == 50) - return "General Magnetics Ltd."; + if(frm == 00) return "Taeil Media Co., Ltd."; + if(frm == 10) return "Vanguard Disc Inc."; + if(frm == 20) return "Unidisc Technology Co., Ltd."; + if(frm == 30) return "Hile Optical Disc Technology Corp."; + if(frm == 40) return "Viva Magnetics Ltd."; + if(frm == 50) return "General Magnetics Ltd."; + break; case 30: - if(frm == 10) - return "CDA Datenträger Albrechts GmbH"; + if(frm == 10) return "CDA Datenträger Albrechts GmbH"; + break; case 31: - if(frm == 00) - return "Ritek Co."; - if(frm == 30) - return "Grand Advance Technology Ltd."; + if(frm == 00) return "Ritek Co."; + if(frm == 30) return "Grand Advance Technology Ltd."; + break; case 32: - if(frm == 00) - return "TDK Corporation"; - if(frm == 10) - return "Prodisc Technology Inc."; + if(frm == 00) return "TDK Corporation"; + if(frm == 10) return "Prodisc Technology Inc."; + break; case 34: - if(frm == 20) - return "Mitsubishi Chemical Corporation"; + if(frm == 20) return "Mitsubishi Chemical Corporation"; + break; case 42: - if(frm == 20) - return "Advanced Digital Media"; + if(frm == 20) return "Advanced Digital Media"; + break; case 45: - if(frm == 00) - return "Fornet International Pte Ltd."; - if(frm == 10) - return "Unitech Japan Inc."; - if(frm == 20) - return "Acer Media Technology, Inc."; - if(frm == 40) - return "CIS Technology Inc."; - if(frm == 50) - return "Guann Yinn Co., Ltd."; - if(frm == 60) - return "Xcitec Inc."; + if(frm == 00) return "Fornet International Pte Ltd."; + if(frm == 10) return "Unitech Japan Inc."; + if(frm == 20) return "Acer Media Technology, Inc."; + if(frm == 40) return "CIS Technology Inc."; + if(frm == 50) return "Guann Yinn Co., Ltd."; + if(frm == 60) return "Xcitec Inc."; + break; case 46: - if(frm == 00) - return "Taiyo Yuden Company Ltd."; - if(frm == 10) - return "Hong Kong Digital Technology Co., Ltd."; - if(frm == 20) - return "Multi Media Masters & Machinary SA"; - if(frm == 30) - return "Computer Support Italy s.r.l."; - if(frm == 40) - return "FUJI Photo Film Co., Ltd."; - if(frm == 50) - return "Auvistar Industry Co., Ltd."; - if(frm == 60) - return "CMC Magnetics Corporation"; + if(frm == 00) return "Taiyo Yuden Company Ltd."; + if(frm == 10) return "Hong Kong Digital Technology Co., Ltd."; + if(frm == 20) return "Multi Media Masters & Machinary SA"; + if(frm == 30) return "Computer Support Italy s.r.l."; + if(frm == 40) return "FUJI Photo Film Co., Ltd."; + if(frm == 50) return "Auvistar Industry Co., Ltd."; + if(frm == 60) return "CMC Magnetics Corporation"; + break; case 47: - if(frm == 10) - return "Hitachi Maxell, Ltd."; - if(frm == 20) - return "Princo Corporation"; - if(frm == 40) - return "POSTECH Corporation"; - if(frm == 50) - return "Ritek Co."; - if(frm == 60) - return "Prodisc Technology Inc."; + if(frm == 10) return "Hitachi Maxell, Ltd."; + if(frm == 20) return "Princo Corporation"; + if(frm == 40) return "POSTECH Corporation"; + if(frm == 50) return "Ritek Co."; + if(frm == 60) return "Prodisc Technology Inc."; + break; case 48: - if(frm == 00) - return "Ricoh Company Ltd."; - if(frm == 10) - return "Kodak Japan Ltd."; - if(frm == 20) - return "Plasmon Data systems Ltd."; - if(frm == 30) - return "Pioneer Video Corporation"; - if(frm == 40) - return "Digital Storage Technology Co., Ltd."; - if(frm == 50) - return "Mitsui Chemicals, Inc."; - if(frm == 60) - return "Lead Data Inc."; + if(frm == 00) return "Ricoh Company Ltd."; + if(frm == 10) return "Kodak Japan Ltd."; + if(frm == 20) return "Plasmon Data systems Ltd."; + if(frm == 30) return "Pioneer Video Corporation"; + if(frm == 40) return "Digital Storage Technology Co., Ltd."; + if(frm == 50) return "Mitsui Chemicals, Inc."; + if(frm == 60) return "Lead Data Inc."; + break; case 49: - if(frm == 00) - return "TDK Corporation"; - if(frm == 10) - return "Gigastore Corporation"; - if(frm == 20) - return "King Pro Mediatek Inc."; - if(frm == 30) - return "Opti.Me.S. S.p.A."; - if(frm == 40) - return "Victor Company of Japan, Ltd."; - if(frm == 60) - return "Matsushita Electric Industrial Co., Ltd."; + if(frm == 00) return "TDK Corporation"; + if(frm == 10) return "Gigastore Corporation"; + if(frm == 20) return "King Pro Mediatek Inc."; + if(frm == 30) return "Opti.Me.S. S.p.A."; + if(frm == 40) return "Victor Company of Japan, Ltd."; + if(frm == 60) return "Matsushita Electric Industrial Co., Ltd."; + break; case 50: - if(frm == 10) - return "Vanguard Disc Inc."; - if(frm == 20) - return "Mitsubishi Chemical Corporation"; - if(frm == 30) - return "CDA Datenträger Albrechts GmbH"; + if(frm == 10) return "Vanguard Disc Inc."; + if(frm == 20) return "Mitsubishi Chemical Corporation"; + if(frm == 30) return "CDA Datenträger Albrechts GmbH"; + break; case 51: - if(frm == 10) - return "Grand Advance Technology Ltd."; - if(frm == 20) - return "Infodisc Technology Co. Ltd."; - if(frm == 50) - return "Hile Optical Disc Technology Corp."; + if(frm == 10) return "Grand Advance Technology Ltd."; + if(frm == 20) return "Infodisc Technology Co. Ltd."; + if(frm == 50) return "Hile Optical Disc Technology Corp."; + break; } return ""; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs b/DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs index 3c7e1439..725baad8 100644 --- a/DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs +++ b/DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs @@ -187,8 +187,7 @@ namespace DiscImageChef.Decoders.CD public static CDText? Decode(byte[] CDTextResponse) { - if(CDTextResponse == null) - return null; + if(CDTextResponse == null) return null; CDText decoded = new CDText(); @@ -199,12 +198,13 @@ namespace DiscImageChef.Decoders.CD decoded.Reserved2 = CDTextResponse[3]; decoded.DataPacks = new CDTextPack[(decoded.DataLength - 2) / 18]; - if(decoded.DataLength == 2) - return null; + if(decoded.DataLength == 2) return null; if(decoded.DataLength + 2 != CDTextResponse.Length) { - DicConsole.DebugWriteLine("CD-TEXT decoder", "Expected CD-TEXT size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDTextResponse.Length); + DicConsole.DebugWriteLine("CD-TEXT decoder", + "Expected CD-TEXT size ({0} bytes) is not received size ({1} bytes), not decoding", + decoded.DataLength + 2, CDTextResponse.Length); return null; } @@ -226,17 +226,14 @@ namespace DiscImageChef.Decoders.CD public static string Prettify(CDText? CDTextResponse) { - if(CDTextResponse == null) - return null; + if(CDTextResponse == null) return null; CDText response = CDTextResponse.Value; StringBuilder sb = new StringBuilder(); #if DEBUG - if(response.Reserved1 != 0) - sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); - if(response.Reserved2 != 0) - sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); + if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); + if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); #endif foreach(CDTextPack descriptor in response.DataPacks) @@ -245,110 +242,97 @@ namespace DiscImageChef.Decoders.CD { // Ignore NOPs if((descriptor.HeaderID1 & 0x80) != 0) - sb.AppendFormat("Incorrect CD-Text pack type {0}, not decoding", descriptor.HeaderID1).AppendLine(); + sb.AppendFormat("Incorrect CD-Text pack type {0}, not decoding", descriptor.HeaderID1) + .AppendLine(); } else { switch(descriptor.HeaderID1) { case 0x80: - { - sb.Append("CD-Text pack contains title for "); - if(descriptor.HeaderID2 == 0x00) - sb.AppendLine("album"); - else - sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); - break; - } + { + sb.Append("CD-Text pack contains title for "); + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("album"); + else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); + break; + } case 0x81: - { - sb.Append("CD-Text pack contains performer for "); - if(descriptor.HeaderID2 == 0x00) - sb.AppendLine("album"); - else - sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); - break; - } + { + sb.Append("CD-Text pack contains performer for "); + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("album"); + else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); + break; + } case 0x82: - { - sb.Append("CD-Text pack contains songwriter for "); - if(descriptor.HeaderID2 == 0x00) - sb.AppendLine("album"); - else - sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); - break; - } + { + sb.Append("CD-Text pack contains songwriter for "); + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("album"); + else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); + break; + } case 0x83: - { - if(descriptor.HeaderID2 == 0x00) - sb.AppendLine("album"); - else - sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); - break; - } + { + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("album"); + else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); + break; + } case 0x84: - { - sb.Append("CD-Text pack contains arranger for "); - if(descriptor.HeaderID2 == 0x00) - sb.AppendLine("album"); - else - sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); - break; - } + { + sb.Append("CD-Text pack contains arranger for "); + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("album"); + else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); + break; + } case 0x85: - { - sb.Append("CD-Text pack contains content provider's message for "); - if(descriptor.HeaderID2 == 0x00) - sb.AppendLine("album"); - else - sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); - break; - } + { + sb.Append("CD-Text pack contains content provider's message for "); + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("album"); + else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); + break; + } case 0x86: - { - sb.AppendLine("CD-Text pack contains disc identification information"); - break; - } + { + sb.AppendLine("CD-Text pack contains disc identification information"); + break; + } case 0x87: - { - sb.AppendLine("CD-Text pack contains genre identification information"); - break; - } + { + sb.AppendLine("CD-Text pack contains genre identification information"); + break; + } case 0x88: - { - sb.AppendLine("CD-Text pack contains table of contents information"); - break; - } + { + sb.AppendLine("CD-Text pack contains table of contents information"); + break; + } case 0x89: - { - sb.AppendLine("CD-Text pack contains second table of contents information"); - break; - } + { + sb.AppendLine("CD-Text pack contains second table of contents information"); + break; + } case 0x8A: case 0x8B: case 0x8C: - { - sb.AppendLine("CD-Text pack contains reserved data"); - break; - } + { + sb.AppendLine("CD-Text pack contains reserved data"); + break; + } case 0x8D: - { - sb.AppendLine("CD-Text pack contains data reserved for content provider only"); - break; - } + { + sb.AppendLine("CD-Text pack contains data reserved for content provider only"); + break; + } case 0x8E: - { - if(descriptor.HeaderID2 == 0x00) - sb.AppendLine("CD-Text pack contains UPC"); - else - sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); - break; - } + { + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("CD-Text pack contains UPC"); + else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); + break; + } case 0x8F: - { - sb.AppendLine("CD-Text pack contains size block information"); - break; - } + { + sb.AppendLine("CD-Text pack contains size block information"); + break; + } } switch(descriptor.HeaderID1) @@ -362,19 +346,22 @@ namespace DiscImageChef.Decoders.CD case 0x86: case 0x87: case 0x8E: - { - if(descriptor.DBCC) - sb.AppendLine("Double Byte Character Code is used"); - sb.AppendFormat("Block number {0}", descriptor.BlockNumber).AppendLine(); - sb.AppendFormat("Character position {0}", descriptor.CharacterPosition).AppendLine(); - sb.AppendFormat("Text field: \"{0}\"", StringHandlers.CToString(descriptor.TextDataField, Encoding.GetEncoding("iso-8859-1"))).AppendLine(); - break; - } + { + if(descriptor.DBCC) sb.AppendLine("Double Byte Character Code is used"); + sb.AppendFormat("Block number {0}", descriptor.BlockNumber).AppendLine(); + sb.AppendFormat("Character position {0}", descriptor.CharacterPosition).AppendLine(); + sb.AppendFormat("Text field: \"{0}\"", + StringHandlers.CToString(descriptor.TextDataField, + Encoding.GetEncoding("iso-8859-1"))).AppendLine(); + break; + } default: - { - sb.AppendFormat("Binary contents: {0}", PrintHex.ByteArrayToHexArrayString(descriptor.TextDataField, 28)).AppendLine(); - break; - } + { + sb.AppendFormat("Binary contents: {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.TextDataField, 28)) + .AppendLine(); + break; + } } sb.AppendFormat("CRC: 0x{0:X4}", descriptor.CRC).AppendLine(); @@ -390,5 +377,4 @@ namespace DiscImageChef.Decoders.CD return Prettify(decoded); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/CD/Enums.cs b/DiscImageChef.Decoders/CD/Enums.cs index 420a4260..7e9392c5 100644 --- a/DiscImageChef.Decoders/CD/Enums.cs +++ b/DiscImageChef.Decoders/CD/Enums.cs @@ -95,5 +95,4 @@ namespace DiscImageChef.Decoders.CD /// ReservedMask = 0x0C } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/CD/FullTOC.cs b/DiscImageChef.Decoders/CD/FullTOC.cs index cebddb7c..a8788826 100644 --- a/DiscImageChef.Decoders/CD/FullTOC.cs +++ b/DiscImageChef.Decoders/CD/FullTOC.cs @@ -147,8 +147,7 @@ namespace DiscImageChef.Decoders.CD public static CDFullTOC? Decode(byte[] CDFullTOCResponse) { - if(CDFullTOCResponse == null) - return null; + if(CDFullTOCResponse == null) return null; CDFullTOC decoded = new CDFullTOC(); @@ -161,7 +160,9 @@ namespace DiscImageChef.Decoders.CD if(decoded.DataLength + 2 != CDFullTOCResponse.Length) { - DicConsole.DebugWriteLine("CD full TOC decoder", "Expected CDFullTOC size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDFullTOCResponse.Length); + DicConsole.DebugWriteLine("CD full TOC decoder", + "Expected CDFullTOC size ({0} bytes) is not received size ({1} bytes), not decoding", + decoded.DataLength + 2, CDFullTOCResponse.Length); return null; } @@ -188,8 +189,7 @@ namespace DiscImageChef.Decoders.CD public static string Prettify(CDFullTOC? CDFullTOCResponse) { - if(CDFullTOCResponse == null) - return null; + if(CDFullTOCResponse == null) return null; CDFullTOC response = CDFullTOCResponse.Value; @@ -202,8 +202,8 @@ namespace DiscImageChef.Decoders.CD foreach(TrackDataDescriptor descriptor in response.TrackDescriptors) { if((descriptor.CONTROL & 0x08) == 0x08 || - (descriptor.ADR != 1 && descriptor.ADR != 5 && descriptor.ADR != 4 && descriptor.ADR != 6) || - descriptor.TNO != 0) + (descriptor.ADR != 1 && descriptor.ADR != 5 && descriptor.ADR != 4 && descriptor.ADR != 6) || + descriptor.TNO != 0) { sb.AppendLine("Unknown TOC entry format, printing values as-is"); sb.AppendFormat("SessionNumber = {0}", descriptor.SessionNumber).AppendLine(); @@ -232,308 +232,365 @@ namespace DiscImageChef.Decoders.CD { case 1: case 4: + { + switch(descriptor.POINT) { - switch(descriptor.POINT) + case 0xA0: { - case 0xA0: + if(descriptor.ADR == 4) + { + sb.AppendFormat("First video track number: {0}", descriptor.PMIN).AppendLine(); + switch(descriptor.PSEC) { - if(descriptor.ADR == 4) - { - sb.AppendFormat("First video track number: {0}", descriptor.PMIN).AppendLine(); - switch(descriptor.PSEC) - { - case 0x10: - sb.AppendLine("CD-V single in NTSC format with digital stereo sound"); - break; - case 0x11: - sb.AppendLine("CD-V single in NTSC format with digital bilingual sound"); - break; - case 0x12: - sb.AppendLine("CD-V disc in NTSC format with digital stereo sound"); - break; - case 0x13: - sb.AppendLine("CD-V disc in NTSC format with digital bilingual sound"); - break; - case 0x20: - sb.AppendLine("CD-V single in PAL format with digital stereo sound"); - break; - case 0x21: - sb.AppendLine("CD-V single in PAL format with digital bilingual sound"); - break; - case 0x22: - sb.AppendLine("CD-V disc in PAL format with digital stereo sound"); - break; - case 0x23: - sb.AppendLine("CD-V disc in PAL format with digital bilingual sound"); - break; - } - } - else - { - sb.AppendFormat("First track number: {0} (", descriptor.PMIN); - switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) - { - case TOC_CONTROL.TwoChanNoPreEmph: - sb.Append(StereoNoPre); - break; - case TOC_CONTROL.TwoChanPreEmph: - sb.Append(StereoPreEm); - break; - case TOC_CONTROL.FourChanNoPreEmph: - sb.Append(QuadNoPreEm); - break; - case TOC_CONTROL.FourChanPreEmph: - sb.Append(QuadPreEmph); - break; - case TOC_CONTROL.DataTrack: - sb.Append(DataUnintrp); - break; - case TOC_CONTROL.DataTrackIncremental: - sb.Append(DataIncrtly); - break; - } - sb.AppendLine(")"); - sb.AppendFormat("Disc type: {0}", descriptor.PSEC).AppendLine(); - //sb.AppendFormat("Absolute time: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); - } - break; + case 0x10: + sb.AppendLine("CD-V single in NTSC format with digital stereo sound"); + break; + case 0x11: + sb.AppendLine("CD-V single in NTSC format with digital bilingual sound"); + break; + case 0x12: + sb.AppendLine("CD-V disc in NTSC format with digital stereo sound"); + break; + case 0x13: + sb.AppendLine("CD-V disc in NTSC format with digital bilingual sound"); + break; + case 0x20: + sb.AppendLine("CD-V single in PAL format with digital stereo sound"); + break; + case 0x21: + sb.AppendLine("CD-V single in PAL format with digital bilingual sound"); + break; + case 0x22: + sb.AppendLine("CD-V disc in PAL format with digital stereo sound"); + break; + case 0x23: + sb.AppendLine("CD-V disc in PAL format with digital bilingual sound"); + break; } - case 0xA1: + } + else + { + sb.AppendFormat("First track number: {0} (", descriptor.PMIN); + switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) { - if(descriptor.ADR == 4) - sb.AppendFormat("Last video track number: {0}", descriptor.PMIN).AppendLine(); - else - { - sb.AppendFormat("Last track number: {0} (", descriptor.PMIN); - switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) - { - case TOC_CONTROL.TwoChanNoPreEmph: - sb.Append(StereoNoPre); - break; - case TOC_CONTROL.TwoChanPreEmph: - sb.Append(StereoPreEm); - break; - case TOC_CONTROL.FourChanNoPreEmph: - sb.Append(QuadNoPreEm); - break; - case TOC_CONTROL.FourChanPreEmph: - sb.Append(QuadPreEmph); - break; - case TOC_CONTROL.DataTrack: - sb.Append(DataUnintrp); - break; - case TOC_CONTROL.DataTrackIncremental: - sb.Append(DataIncrtly); - break; - } - sb.AppendLine(")"); - } - //sb.AppendFormat("Absolute time: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); - break; + case TOC_CONTROL.TwoChanNoPreEmph: + sb.Append(StereoNoPre); + break; + case TOC_CONTROL.TwoChanPreEmph: + sb.Append(StereoPreEm); + break; + case TOC_CONTROL.FourChanNoPreEmph: + sb.Append(QuadNoPreEm); + break; + case TOC_CONTROL.FourChanPreEmph: + sb.Append(QuadPreEmph); + break; + case TOC_CONTROL.DataTrack: + sb.Append(DataUnintrp); + break; + case TOC_CONTROL.DataTrackIncremental: + sb.Append(DataIncrtly); + break; } - case 0xA2: + + sb.AppendLine(")"); + sb.AppendFormat("Disc type: {0}", descriptor.PSEC).AppendLine(); + //sb.AppendFormat("Absolute time: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); + } + + break; + } + case 0xA1: + { + if(descriptor.ADR == 4) + sb.AppendFormat("Last video track number: {0}", descriptor.PMIN).AppendLine(); + else + { + sb.AppendFormat("Last track number: {0} (", descriptor.PMIN); + switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) { + case TOC_CONTROL.TwoChanNoPreEmph: + sb.Append(StereoNoPre); + break; + case TOC_CONTROL.TwoChanPreEmph: + sb.Append(StereoPreEm); + break; + case TOC_CONTROL.FourChanNoPreEmph: + sb.Append(QuadNoPreEm); + break; + case TOC_CONTROL.FourChanPreEmph: + sb.Append(QuadPreEmph); + break; + case TOC_CONTROL.DataTrack: + sb.Append(DataUnintrp); + break; + case TOC_CONTROL.DataTrackIncremental: + sb.Append(DataIncrtly); + break; + } + + sb.AppendLine(")"); + } + //sb.AppendFormat("Absolute time: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); + break; + } + case 0xA2: + { + if(descriptor.PHOUR > 0) + sb.AppendFormat("Lead-out start position: {3:D2}:{0:D2}:{1:D2}:{2:D2}", + descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, + descriptor.PHOUR).AppendLine(); + else + sb.AppendFormat("Lead-out start position: {0:D2}:{1:D2}:{2:D2}", + descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME) + .AppendLine(); + //sb.AppendFormat("Absolute time: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); + + switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) + { + case TOC_CONTROL.TwoChanNoPreEmph: + case TOC_CONTROL.TwoChanPreEmph: + case TOC_CONTROL.FourChanNoPreEmph: + case TOC_CONTROL.FourChanPreEmph: + sb.AppendLine("Lead-out is audio type"); + break; + case TOC_CONTROL.DataTrack: + case TOC_CONTROL.DataTrackIncremental: + sb.AppendLine("Lead-out is data type"); + break; + } + + break; + } + case 0xF0: + { + sb.AppendFormat("Book type: 0x{0:X2}", descriptor.PMIN); + sb.AppendFormat("Material type: 0x{0:X2}", descriptor.PSEC); + sb.AppendFormat("Moment of inertia: 0x{0:X2}", descriptor.PFRAME); + if(descriptor.PHOUR > 0) + sb.AppendFormat("Absolute time: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, + descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); + else + sb.AppendFormat("Absolute time: {0:D2}:{1:D2}:{2:D2}", descriptor.Min, + descriptor.Sec, descriptor.Frame).AppendLine(); + break; + } + default: + { + if(descriptor.POINT >= 0x01 && descriptor.POINT <= 0x63) + { + if(descriptor.ADR == 4) + sb.AppendFormat("Video track {3} starts at: {0:D2}:{1:D2}:{2:D2}", + descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, + descriptor.POINT).AppendLine(); + else + { + string type = "Audio"; + + if((TOC_CONTROL)(descriptor.CONTROL & 0x0D) == TOC_CONTROL.DataTrack || + (TOC_CONTROL)(descriptor.CONTROL & 0x0D) == + TOC_CONTROL.DataTrackIncremental) type = "Data"; + if(descriptor.PHOUR > 0) - sb.AppendFormat("Lead-out start position: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.PHOUR).AppendLine(); + sb.AppendFormat("{5} track {3} starts at: {4:D2}:{0:D2}:{1:D2}:{2:D2} (", + descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, + descriptor.POINT, descriptor.PHOUR, type); else - sb.AppendFormat("Lead-out start position: {0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME).AppendLine(); - //sb.AppendFormat("Absolute time: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); + sb.AppendFormat("{4} track {3} starts at: {0:D2}:{1:D2}:{2:D2} (", + descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, + descriptor.POINT, type); switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) { case TOC_CONTROL.TwoChanNoPreEmph: + sb.Append(StereoNoPre); + break; case TOC_CONTROL.TwoChanPreEmph: + sb.Append(StereoPreEm); + break; case TOC_CONTROL.FourChanNoPreEmph: + sb.Append(QuadNoPreEm); + break; case TOC_CONTROL.FourChanPreEmph: - sb.AppendLine("Lead-out is audio type"); + sb.Append(QuadPreEmph); break; case TOC_CONTROL.DataTrack: + sb.Append(DataUnintrp); + break; case TOC_CONTROL.DataTrackIncremental: - sb.AppendLine("Lead-out is data type"); + sb.Append(DataIncrtly); break; } - break; - } - case 0xF0: - { - sb.AppendFormat("Book type: 0x{0:X2}", descriptor.PMIN); - sb.AppendFormat("Material type: 0x{0:X2}", descriptor.PSEC); - sb.AppendFormat("Moment of inertia: 0x{0:X2}", descriptor.PFRAME); - if(descriptor.PHOUR > 0) - sb.AppendFormat("Absolute time: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); - else - sb.AppendFormat("Absolute time: {0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame).AppendLine(); - break; - } - default: - { - if(descriptor.POINT >= 0x01 && descriptor.POINT <= 0x63) - { - if(descriptor.ADR == 4) - sb.AppendFormat("Video track {3} starts at: {0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.POINT).AppendLine(); - else - { - string type = "Audio"; - if((TOC_CONTROL)(descriptor.CONTROL & 0x0D) == TOC_CONTROL.DataTrack || - (TOC_CONTROL)(descriptor.CONTROL & 0x0D) == TOC_CONTROL.DataTrackIncremental) - type = "Data"; - - if(descriptor.PHOUR > 0) - sb.AppendFormat("{5} track {3} starts at: {4:D2}:{0:D2}:{1:D2}:{2:D2} (", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.POINT, descriptor.PHOUR, type); - else - sb.AppendFormat("{4} track {3} starts at: {0:D2}:{1:D2}:{2:D2} (", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.POINT, type); - - switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) - { - case TOC_CONTROL.TwoChanNoPreEmph: - sb.Append(StereoNoPre); - break; - case TOC_CONTROL.TwoChanPreEmph: - sb.Append(StereoPreEm); - break; - case TOC_CONTROL.FourChanNoPreEmph: - sb.Append(QuadNoPreEm); - break; - case TOC_CONTROL.FourChanPreEmph: - sb.Append(QuadPreEmph); - break; - case TOC_CONTROL.DataTrack: - sb.Append(DataUnintrp); - break; - case TOC_CONTROL.DataTrackIncremental: - sb.Append(DataIncrtly); - break; - } - sb.AppendLine(")"); - } - //sb.AppendFormat("Absolute time: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); - } - else - { - sb.AppendFormat("ADR = {0}", descriptor.ADR).AppendLine(); - sb.AppendFormat("CONTROL = {0}", descriptor.CONTROL).AppendLine(); - sb.AppendFormat("TNO = {0}", descriptor.TNO).AppendLine(); - sb.AppendFormat("POINT = {0}", descriptor.POINT).AppendLine(); - sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine(); - sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine(); - sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine(); - sb.AppendFormat("HOUR = {0}", descriptor.HOUR).AppendLine(); - sb.AppendFormat("PHOUR = {0}", descriptor.PHOUR).AppendLine(); - sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine(); - sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine(); - sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine(); - } - break; + sb.AppendLine(")"); } + //sb.AppendFormat("Absolute time: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); + } + else + { + sb.AppendFormat("ADR = {0}", descriptor.ADR).AppendLine(); + sb.AppendFormat("CONTROL = {0}", descriptor.CONTROL).AppendLine(); + sb.AppendFormat("TNO = {0}", descriptor.TNO).AppendLine(); + sb.AppendFormat("POINT = {0}", descriptor.POINT).AppendLine(); + sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine(); + sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine(); + sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine(); + sb.AppendFormat("HOUR = {0}", descriptor.HOUR).AppendLine(); + sb.AppendFormat("PHOUR = {0}", descriptor.PHOUR).AppendLine(); + sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine(); + sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine(); + sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine(); + } + + break; } - break; } + + break; + } case 5: + { + switch(descriptor.POINT) { - switch(descriptor.POINT) + case 0xB0: { - case 0xB0: - { - if(descriptor.PHOUR > 0) - { - sb.AppendFormat("Start of next possible program in the recordable area of the disc: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); - sb.AppendFormat("Maximum start of outermost Lead-out in the recordable area of the disc: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.PHOUR).AppendLine(); - } - else - { - sb.AppendFormat("Start of next possible program in the recordable area of the disc: {0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame).AppendLine(); - sb.AppendFormat("Maximum start of outermost Lead-out in the recordable area of the disc: {0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME).AppendLine(); - } - break; - } - case 0xB1: - { - sb.AppendFormat("Number of skip interval pointers: {0}", descriptor.PMIN).AppendLine(); - sb.AppendFormat("Number of skip track pointers: {0}", descriptor.PSEC).AppendLine(); - break; - } - case 0xB2: - case 0xB3: - case 0xB4: - { - sb.AppendFormat("Skip track {0}", descriptor.Min).AppendLine(); - sb.AppendFormat("Skip track {0}", descriptor.Sec).AppendLine(); - sb.AppendFormat("Skip track {0}", descriptor.Frame).AppendLine(); - sb.AppendFormat("Skip track {0}", descriptor.Zero).AppendLine(); - sb.AppendFormat("Skip track {0}", descriptor.PMIN).AppendLine(); - sb.AppendFormat("Skip track {0}", descriptor.PSEC).AppendLine(); - sb.AppendFormat("Skip track {0}", descriptor.PFRAME).AppendLine(); - break; - } - case 0xC0: - { - sb.AppendFormat("Optimum recording power: 0x{0:X2}", descriptor.Min).AppendLine(); - if(descriptor.PHOUR > 0) - sb.AppendFormat("Start time of the first Lead-in area in the disc: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.PHOUR).AppendLine(); - else - sb.AppendFormat("Start time of the first Lead-in area in the disc: {0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME).AppendLine(); - break; - } - case 0xC1: - { - sb.AppendFormat("Copy of information of A1 from ATIP found"); - sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine(); - sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine(); - sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine(); - sb.AppendFormat("Zero = {0}", descriptor.Zero).AppendLine(); - sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine(); - sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine(); - sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine(); - break; - } - case 0xCF: - { - if(descriptor.PHOUR > 0) - { - sb.AppendFormat("Start position of outer part lead-in area: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.PHOUR).AppendLine(); - sb.AppendFormat("Stop position of inner part lead-out area: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); - } - else - { - sb.AppendFormat("Start position of outer part lead-in area: {0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME).AppendLine(); - sb.AppendFormat("Stop position of inner part lead-out area: {0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame).AppendLine(); - } - break; - } - default: - { - if(descriptor.POINT >= 0x01 && descriptor.POINT <= 0x40) - { - sb.AppendFormat("Start time for interval that should be skipped: {0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME).AppendLine(); - sb.AppendFormat("Ending time for interval that should be skipped: {0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame).AppendLine(); - } - else - { - sb.AppendFormat("ADR = {0}", descriptor.ADR).AppendLine(); - sb.AppendFormat("CONTROL = {0}", descriptor.CONTROL).AppendLine(); - sb.AppendFormat("TNO = {0}", descriptor.TNO).AppendLine(); - sb.AppendFormat("POINT = {0}", descriptor.POINT).AppendLine(); - sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine(); - sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine(); - sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine(); - sb.AppendFormat("HOUR = {0}", descriptor.HOUR).AppendLine(); - sb.AppendFormat("PHOUR = {0}", descriptor.PHOUR).AppendLine(); - sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine(); - sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine(); - sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine(); - } - break; - } + if(descriptor.PHOUR > 0) + { + sb + .AppendFormat("Start of next possible program in the recordable area of the disc: {3:D2}:{0:D2}:{1:D2}:{2:D2}", + descriptor.Min, descriptor.Sec, descriptor.Frame, + descriptor.HOUR).AppendLine(); + sb + .AppendFormat("Maximum start of outermost Lead-out in the recordable area of the disc: {3:D2}:{0:D2}:{1:D2}:{2:D2}", + descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, + descriptor.PHOUR).AppendLine(); + } + else + { + sb + .AppendFormat("Start of next possible program in the recordable area of the disc: {0:D2}:{1:D2}:{2:D2}", + descriptor.Min, descriptor.Sec, descriptor.Frame) + .AppendLine(); + sb + .AppendFormat("Maximum start of outermost Lead-out in the recordable area of the disc: {0:D2}:{1:D2}:{2:D2}", + descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME) + .AppendLine(); + } + break; + } + case 0xB1: + { + sb.AppendFormat("Number of skip interval pointers: {0}", descriptor.PMIN) + .AppendLine(); + sb.AppendFormat("Number of skip track pointers: {0}", descriptor.PSEC).AppendLine(); + break; + } + case 0xB2: + case 0xB3: + case 0xB4: + { + sb.AppendFormat("Skip track {0}", descriptor.Min).AppendLine(); + sb.AppendFormat("Skip track {0}", descriptor.Sec).AppendLine(); + sb.AppendFormat("Skip track {0}", descriptor.Frame).AppendLine(); + sb.AppendFormat("Skip track {0}", descriptor.Zero).AppendLine(); + sb.AppendFormat("Skip track {0}", descriptor.PMIN).AppendLine(); + sb.AppendFormat("Skip track {0}", descriptor.PSEC).AppendLine(); + sb.AppendFormat("Skip track {0}", descriptor.PFRAME).AppendLine(); + break; + } + case 0xC0: + { + sb.AppendFormat("Optimum recording power: 0x{0:X2}", descriptor.Min).AppendLine(); + if(descriptor.PHOUR > 0) + sb + .AppendFormat("Start time of the first Lead-in area in the disc: {3:D2}:{0:D2}:{1:D2}:{2:D2}", + descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, + descriptor.PHOUR).AppendLine(); + else + sb + .AppendFormat("Start time of the first Lead-in area in the disc: {0:D2}:{1:D2}:{2:D2}", + descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME) + .AppendLine(); + break; + } + case 0xC1: + { + sb.AppendFormat("Copy of information of A1 from ATIP found"); + sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine(); + sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine(); + sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine(); + sb.AppendFormat("Zero = {0}", descriptor.Zero).AppendLine(); + sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine(); + sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine(); + sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine(); + break; + } + case 0xCF: + { + if(descriptor.PHOUR > 0) + { + sb + .AppendFormat("Start position of outer part lead-in area: {3:D2}:{0:D2}:{1:D2}:{2:D2}", + descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, + descriptor.PHOUR).AppendLine(); + sb + .AppendFormat("Stop position of inner part lead-out area: {3:D2}:{0:D2}:{1:D2}:{2:D2}", + descriptor.Min, descriptor.Sec, descriptor.Frame, + descriptor.HOUR).AppendLine(); + } + else + { + sb + .AppendFormat("Start position of outer part lead-in area: {0:D2}:{1:D2}:{2:D2}", + descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME) + .AppendLine(); + sb + .AppendFormat("Stop position of inner part lead-out area: {0:D2}:{1:D2}:{2:D2}", + descriptor.Min, descriptor.Sec, descriptor.Frame) + .AppendLine(); + } + break; + } + default: + { + if(descriptor.POINT >= 0x01 && descriptor.POINT <= 0x40) + { + sb + .AppendFormat("Start time for interval that should be skipped: {0:D2}:{1:D2}:{2:D2}", + descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME) + .AppendLine(); + sb + .AppendFormat("Ending time for interval that should be skipped: {0:D2}:{1:D2}:{2:D2}", + descriptor.Min, descriptor.Sec, descriptor.Frame) + .AppendLine(); + } + else + { + sb.AppendFormat("ADR = {0}", descriptor.ADR).AppendLine(); + sb.AppendFormat("CONTROL = {0}", descriptor.CONTROL).AppendLine(); + sb.AppendFormat("TNO = {0}", descriptor.TNO).AppendLine(); + sb.AppendFormat("POINT = {0}", descriptor.POINT).AppendLine(); + sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine(); + sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine(); + sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine(); + sb.AppendFormat("HOUR = {0}", descriptor.HOUR).AppendLine(); + sb.AppendFormat("PHOUR = {0}", descriptor.PHOUR).AppendLine(); + sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine(); + sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine(); + sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine(); + } + break; } - break; } + + break; + } case 6: - { - uint id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame); - sb.AppendFormat("Disc ID: {0:X6}", id & 0x00FFFFFF).AppendLine(); - break; - } + { + uint id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame); + sb.AppendFormat("Disc ID: {0:X6}", id & 0x00FFFFFF).AppendLine(); + break; + } } } } @@ -547,5 +604,4 @@ namespace DiscImageChef.Decoders.CD return Prettify(decoded); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/CD/PMA.cs b/DiscImageChef.Decoders/CD/PMA.cs index c8f9fa58..ce5f6391 100644 --- a/DiscImageChef.Decoders/CD/PMA.cs +++ b/DiscImageChef.Decoders/CD/PMA.cs @@ -134,8 +134,7 @@ namespace DiscImageChef.Decoders.CD public static CDPMA? Decode(byte[] CDPMAResponse) { - if(CDPMAResponse == null) - return null; + if(CDPMAResponse == null) return null; CDPMA decoded = new CDPMA(); @@ -148,7 +147,9 @@ namespace DiscImageChef.Decoders.CD if(decoded.DataLength + 2 != CDPMAResponse.Length) { - DicConsole.DebugWriteLine("CD PMA decoder", "Expected CDPMA size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDPMAResponse.Length); + DicConsole.DebugWriteLine("CD PMA decoder", + "Expected CDPMA size ({0} bytes) is not received size ({1} bytes), not decoding", + decoded.DataLength + 2, CDPMAResponse.Length); return null; } @@ -174,25 +175,21 @@ namespace DiscImageChef.Decoders.CD public static string Prettify(CDPMA? CDPMAResponse) { - if(CDPMAResponse == null) - return null; + if(CDPMAResponse == null) return null; CDPMA response = CDPMAResponse.Value; StringBuilder sb = new StringBuilder(); #if DEBUG - if(response.Reserved1 != 0) - sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); - if(response.Reserved2 != 0) - sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); + if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); + if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); #endif foreach(CDPMADescriptors descriptor in response.PMADescriptors) { #if DEBUG - if(descriptor.Reserved != 0) - sb.AppendFormat("Reserved = 0x{0:X2}", descriptor.Reserved).AppendLine(); + if(descriptor.Reserved != 0) sb.AppendFormat("Reserved = 0x{0:X2}", descriptor.Reserved).AppendLine(); #endif switch(descriptor.ADR) @@ -222,19 +219,24 @@ namespace DiscImageChef.Decoders.CD sb.Append(" (Data track, recorded incrementally)"); break; } + if(descriptor.PHOUR > 0) - sb.AppendFormat(" starts at {3}:{0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.PHOUR); + sb.AppendFormat(" starts at {3}:{0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, + descriptor.PFRAME, descriptor.PHOUR); else - sb.AppendFormat(" starts at {0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME); + sb.AppendFormat(" starts at {0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, + descriptor.PFRAME); if(descriptor.PHOUR > 0) - sb.AppendFormat(" and ends at {3}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR); + sb.AppendFormat(" and ends at {3}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, + descriptor.Frame, descriptor.HOUR); else - sb.AppendFormat(" and ends at {0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame); + sb.AppendFormat(" and ends at {0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, + descriptor.Frame); sb.AppendLine(); } - else - goto default; + else goto default; + break; case 2: uint id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame); @@ -242,58 +244,50 @@ namespace DiscImageChef.Decoders.CD break; case 3: sb.AppendFormat("Skip track assignment {0} says that tracks ", descriptor.POINT); - if(descriptor.Min > 0) - sb.AppendFormat("{0} ", descriptor.Min); - if(descriptor.Sec > 0) - sb.AppendFormat("{0} ", descriptor.Sec); - if(descriptor.Frame > 0) - sb.AppendFormat("{0} ", descriptor.Frame); - if(descriptor.PMIN > 0) - sb.AppendFormat("{0} ", descriptor.PMIN); - if(descriptor.PSEC > 0) - sb.AppendFormat("{0} ", descriptor.PSEC); - if(descriptor.PFRAME > 0) - sb.AppendFormat("{0} ", descriptor.PFRAME); + if(descriptor.Min > 0) sb.AppendFormat("{0} ", descriptor.Min); + if(descriptor.Sec > 0) sb.AppendFormat("{0} ", descriptor.Sec); + if(descriptor.Frame > 0) sb.AppendFormat("{0} ", descriptor.Frame); + if(descriptor.PMIN > 0) sb.AppendFormat("{0} ", descriptor.PMIN); + if(descriptor.PSEC > 0) sb.AppendFormat("{0} ", descriptor.PSEC); + if(descriptor.PFRAME > 0) sb.AppendFormat("{0} ", descriptor.PFRAME); sb.AppendLine("should be skipped"); break; case 4: sb.AppendFormat("Unskip track assignment {0} says that tracks ", descriptor.POINT); - if(descriptor.Min > 0) - sb.AppendFormat("{0} ", descriptor.Min); - if(descriptor.Sec > 0) - sb.AppendFormat("{0} ", descriptor.Sec); - if(descriptor.Frame > 0) - sb.AppendFormat("{0} ", descriptor.Frame); - if(descriptor.PMIN > 0) - sb.AppendFormat("{0} ", descriptor.PMIN); - if(descriptor.PSEC > 0) - sb.AppendFormat("{0} ", descriptor.PSEC); - if(descriptor.PFRAME > 0) - sb.AppendFormat("{0} ", descriptor.PFRAME); + if(descriptor.Min > 0) sb.AppendFormat("{0} ", descriptor.Min); + if(descriptor.Sec > 0) sb.AppendFormat("{0} ", descriptor.Sec); + if(descriptor.Frame > 0) sb.AppendFormat("{0} ", descriptor.Frame); + if(descriptor.PMIN > 0) sb.AppendFormat("{0} ", descriptor.PMIN); + if(descriptor.PSEC > 0) sb.AppendFormat("{0} ", descriptor.PSEC); + if(descriptor.PFRAME > 0) sb.AppendFormat("{0} ", descriptor.PFRAME); sb.AppendLine("should not be skipped"); break; case 5: sb.AppendFormat("Skip time interval assignment {0} says that from ", descriptor.POINT); if(descriptor.PHOUR > 0) - sb.AppendFormat("{3}:{0:D2}:{1:D2}:{2:D2} to ", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.PHOUR); + sb.AppendFormat("{3}:{0:D2}:{1:D2}:{2:D2} to ", descriptor.PMIN, descriptor.PSEC, + descriptor.PFRAME, descriptor.PHOUR); else - sb.AppendFormat("{0:D2}:{1:D2}:{2:D2} to ", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME); + sb.AppendFormat("{0:D2}:{1:D2}:{2:D2} to ", descriptor.PMIN, descriptor.PSEC, + descriptor.PFRAME); if(descriptor.PHOUR > 0) - sb.AppendFormat("{3}:{0:D2}:{1:D2}:{2:D2} ", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR); - else - sb.AppendFormat("{0:D2}:{1:D2}:{2:D2} ", descriptor.Min, descriptor.Sec, descriptor.Frame); + sb.AppendFormat("{3}:{0:D2}:{1:D2}:{2:D2} ", descriptor.Min, descriptor.Sec, + descriptor.Frame, descriptor.HOUR); + else sb.AppendFormat("{0:D2}:{1:D2}:{2:D2} ", descriptor.Min, descriptor.Sec, descriptor.Frame); sb.AppendLine("should be skipped"); break; case 6: sb.AppendFormat("Unskip time interval assignment {0} says that from ", descriptor.POINT); if(descriptor.PHOUR > 0) - sb.AppendFormat("{3}:{0:D2}:{1:D2}:{2:D2} to ", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.PHOUR); + sb.AppendFormat("{3}:{0:D2}:{1:D2}:{2:D2} to ", descriptor.PMIN, descriptor.PSEC, + descriptor.PFRAME, descriptor.PHOUR); else - sb.AppendFormat("{0:D2}:{1:D2}:{2:D2} to ", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME); + sb.AppendFormat("{0:D2}:{1:D2}:{2:D2} to ", descriptor.PMIN, descriptor.PSEC, + descriptor.PFRAME); if(descriptor.PHOUR > 0) - sb.AppendFormat("{3}:{0:D2}:{1:D2}:{2:D2} ", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR); - else - sb.AppendFormat("{0:D2}:{1:D2}:{2:D2} ", descriptor.Min, descriptor.Sec, descriptor.Frame); + sb.AppendFormat("{3}:{0:D2}:{1:D2}:{2:D2} ", descriptor.Min, descriptor.Sec, + descriptor.Frame, descriptor.HOUR); + else sb.AppendFormat("{0:D2}:{1:D2}:{2:D2} ", descriptor.Min, descriptor.Sec, descriptor.Frame); sb.AppendLine("should not be skipped"); break; default: @@ -323,5 +317,4 @@ namespace DiscImageChef.Decoders.CD return Prettify(decoded); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/CD/Sector.cs b/DiscImageChef.Decoders/CD/Sector.cs index a8ec08ba..646adfcd 100644 --- a/DiscImageChef.Decoders/CD/Sector.cs +++ b/DiscImageChef.Decoders/CD/Sector.cs @@ -39,177 +39,155 @@ namespace DiscImageChef.Decoders.CD { public static readonly byte[] ScrambleTable = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x60, - 0x00, 0x28, 0x00, 0x1E, 0x80, 0x08, 0x60, 0x06, 0xA8, 0x02, 0xFE, 0x81, 0x80, 0x60, 0x60, 0x28, - 0x28, 0x1E, 0x9E, 0x88, 0x68, 0x66, 0xAE, 0xAA, 0xFC, 0x7F, 0x01, 0xE0, 0x00, 0x48, 0x00, 0x36, - 0x80, 0x16, 0xE0, 0x0E, 0xC8, 0x04, 0x56, 0x83, 0x7E, 0xE1, 0xE0, 0x48, 0x48, 0x36, 0xB6, 0x96, - 0xF6, 0xEE, 0xC6, 0xCC, 0x52, 0xD5, 0xFD, 0x9F, 0x01, 0xA8, 0x00, 0x7E, 0x80, 0x20, 0x60, 0x18, - 0x28, 0x0A, 0x9E, 0x87, 0x28, 0x62, 0x9E, 0xA9, 0xA8, 0x7E, 0xFE, 0xA0, 0x40, 0x78, 0x30, 0x22, - 0x94, 0x19, 0xAF, 0x4A, 0xFC, 0x37, 0x01, 0xD6, 0x80, 0x5E, 0xE0, 0x38, 0x48, 0x12, 0xB6, 0x8D, - 0xB6, 0xE5, 0xB6, 0xCB, 0x36, 0xD7, 0x56, 0xDE, 0xBE, 0xD8, 0x70, 0x5A, 0xA4, 0x3B, 0x3B, 0x53, - 0x53, 0x7D, 0xFD, 0xE1, 0x81, 0x88, 0x60, 0x66, 0xA8, 0x2A, 0xFE, 0x9F, 0x00, 0x68, 0x00, 0x2E, - 0x80, 0x1C, 0x60, 0x09, 0xE8, 0x06, 0xCE, 0x82, 0xD4, 0x61, 0x9F, 0x68, 0x68, 0x2E, 0xAE, 0x9C, - 0x7C, 0x69, 0xE1, 0xEE, 0xC8, 0x4C, 0x56, 0xB5, 0xFE, 0xF7, 0x00, 0x46, 0x80, 0x32, 0xE0, 0x15, - 0x88, 0x0F, 0x26, 0x84, 0x1A, 0xE3, 0x4B, 0x09, 0xF7, 0x46, 0xC6, 0xB2, 0xD2, 0xF5, 0x9D, 0x87, - 0x29, 0xA2, 0x9E, 0xF9, 0xA8, 0x42, 0xFE, 0xB1, 0x80, 0x74, 0x60, 0x27, 0x68, 0x1A, 0xAE, 0x8B, - 0x3C, 0x67, 0x51, 0xEA, 0xBC, 0x4F, 0x31, 0xF4, 0x14, 0x47, 0x4F, 0x72, 0xB4, 0x25, 0xB7, 0x5B, - 0x36, 0xBB, 0x56, 0xF3, 0x7E, 0xC5, 0xE0, 0x53, 0x08, 0x3D, 0xC6, 0x91, 0x92, 0xEC, 0x6D, 0x8D, - 0xED, 0xA5, 0x8D, 0xBB, 0x25, 0xB3, 0x5B, 0x35, 0xFB, 0x57, 0x03, 0x7E, 0x81, 0xE0, 0x60, 0x48, - 0x28, 0x36, 0x9E, 0x96, 0xE8, 0x6E, 0xCE, 0xAC, 0x54, 0x7D, 0xFF, 0x61, 0x80, 0x28, 0x60, 0x1E, - 0xA8, 0x08, 0x7E, 0x86, 0xA0, 0x62, 0xF8, 0x29, 0x82, 0x9E, 0xE1, 0xA8, 0x48, 0x7E, 0xB6, 0xA0, - 0x76, 0xF8, 0x26, 0xC2, 0x9A, 0xD1, 0xAB, 0x1C, 0x7F, 0x49, 0xE0, 0x36, 0xC8, 0x16, 0xD6, 0x8E, - 0xDE, 0xE4, 0x58, 0x4B, 0x7A, 0xB7, 0x63, 0x36, 0xA9, 0xD6, 0xFE, 0xDE, 0xC0, 0x58, 0x50, 0x3A, - 0xBC, 0x13, 0x31, 0xCD, 0xD4, 0x55, 0x9F, 0x7F, 0x28, 0x20, 0x1E, 0x98, 0x08, 0x6A, 0x86, 0xAF, - 0x22, 0xFC, 0x19, 0x81, 0xCA, 0xE0, 0x57, 0x08, 0x3E, 0x86, 0x90, 0x62, 0xEC, 0x29, 0x8D, 0xDE, - 0xE5, 0x98, 0x4B, 0x2A, 0xB7, 0x5F, 0x36, 0xB8, 0x16, 0xF2, 0x8E, 0xC5, 0xA4, 0x53, 0x3B, 0x7D, - 0xD3, 0x61, 0x9D, 0xE8, 0x69, 0x8E, 0xAE, 0xE4, 0x7C, 0x4B, 0x61, 0xF7, 0x68, 0x46, 0xAE, 0xB2, - 0xFC, 0x75, 0x81, 0xE7, 0x20, 0x4A, 0x98, 0x37, 0x2A, 0x96, 0x9F, 0x2E, 0xE8, 0x1C, 0x4E, 0x89, - 0xF4, 0x66, 0xC7, 0x6A, 0xD2, 0xAF, 0x1D, 0xBC, 0x09, 0xB1, 0xC6, 0xF4, 0x52, 0xC7, 0x7D, 0x92, - 0xA1, 0xAD, 0xB8, 0x7D, 0xB2, 0xA1, 0xB5, 0xB8, 0x77, 0x32, 0xA6, 0x95, 0xBA, 0xEF, 0x33, 0x0C, - 0x15, 0xC5, 0xCF, 0x13, 0x14, 0x0D, 0xCF, 0x45, 0x94, 0x33, 0x2F, 0x55, 0xDC, 0x3F, 0x19, 0xD0, - 0x0A, 0xDC, 0x07, 0x19, 0xC2, 0x8A, 0xD1, 0xA7, 0x1C, 0x7A, 0x89, 0xE3, 0x26, 0xC9, 0xDA, 0xD6, - 0xDB, 0x1E, 0xDB, 0x48, 0x5B, 0x76, 0xBB, 0x66, 0xF3, 0x6A, 0xC5, 0xEF, 0x13, 0x0C, 0x0D, 0xC5, - 0xC5, 0x93, 0x13, 0x2D, 0xCD, 0xDD, 0x95, 0x99, 0xAF, 0x2A, 0xFC, 0x1F, 0x01, 0xC8, 0x00, 0x56, - 0x80, 0x3E, 0xE0, 0x10, 0x48, 0x0C, 0x36, 0x85, 0xD6, 0xE3, 0x1E, 0xC9, 0xC8, 0x56, 0xD6, 0xBE, - 0xDE, 0xF0, 0x58, 0x44, 0x3A, 0xB3, 0x53, 0x35, 0xFD, 0xD7, 0x01, 0x9E, 0x80, 0x68, 0x60, 0x2E, - 0xA8, 0x1C, 0x7E, 0x89, 0xE0, 0x66, 0xC8, 0x2A, 0xD6, 0x9F, 0x1E, 0xE8, 0x08, 0x4E, 0x86, 0xB4, - 0x62, 0xF7, 0x69, 0x86, 0xAE, 0xE2, 0xFC, 0x49, 0x81, 0xF6, 0xE0, 0x46, 0xC8, 0x32, 0xD6, 0x95, - 0x9E, 0xEF, 0x28, 0x4C, 0x1E, 0xB5, 0xC8, 0x77, 0x16, 0xA6, 0x8E, 0xFA, 0xE4, 0x43, 0x0B, 0x71, - 0xC7, 0x64, 0x52, 0xAB, 0x7D, 0xBF, 0x61, 0xB0, 0x28, 0x74, 0x1E, 0xA7, 0x48, 0x7A, 0xB6, 0xA3, - 0x36, 0xF9, 0xD6, 0xC2, 0xDE, 0xD1, 0x98, 0x5C, 0x6A, 0xB9, 0xEF, 0x32, 0xCC, 0x15, 0x95, 0xCF, - 0x2F, 0x14, 0x1C, 0x0F, 0x49, 0xC4, 0x36, 0xD3, 0x56, 0xDD, 0xFE, 0xD9, 0x80, 0x5A, 0xE0, 0x3B, - 0x08, 0x13, 0x46, 0x8D, 0xF2, 0xE5, 0x85, 0x8B, 0x23, 0x27, 0x59, 0xDA, 0xBA, 0xDB, 0x33, 0x1B, - 0x55, 0xCB, 0x7F, 0x17, 0x60, 0x0E, 0xA8, 0x04, 0x7E, 0x83, 0x60, 0x61, 0xE8, 0x28, 0x4E, 0x9E, - 0xB4, 0x68, 0x77, 0x6E, 0xA6, 0xAC, 0x7A, 0xFD, 0xE3, 0x01, 0x89, 0xC0, 0x66, 0xD0, 0x2A, 0xDC, - 0x1F, 0x19, 0xC8, 0x0A, 0xD6, 0x87, 0x1E, 0xE2, 0x88, 0x49, 0xA6, 0xB6, 0xFA, 0xF6, 0xC3, 0x06, - 0xD1, 0xC2, 0xDC, 0x51, 0x99, 0xFC, 0x6A, 0xC1, 0xEF, 0x10, 0x4C, 0x0C, 0x35, 0xC5, 0xD7, 0x13, - 0x1E, 0x8D, 0xC8, 0x65, 0x96, 0xAB, 0x2E, 0xFF, 0x5C, 0x40, 0x39, 0xF0, 0x12, 0xC4, 0x0D, 0x93, - 0x45, 0xAD, 0xF3, 0x3D, 0x85, 0xD1, 0xA3, 0x1C, 0x79, 0xC9, 0xE2, 0xD6, 0xC9, 0x9E, 0xD6, 0xE8, - 0x5E, 0xCE, 0xB8, 0x54, 0x72, 0xBF, 0x65, 0xB0, 0x2B, 0x34, 0x1F, 0x57, 0x48, 0x3E, 0xB6, 0x90, - 0x76, 0xEC, 0x26, 0xCD, 0xDA, 0xD5, 0x9B, 0x1F, 0x2B, 0x48, 0x1F, 0x76, 0x88, 0x26, 0xE6, 0x9A, - 0xCA, 0xEB, 0x17, 0x0F, 0x4E, 0x84, 0x34, 0x63, 0x57, 0x69, 0xFE, 0xAE, 0xC0, 0x7C, 0x50, 0x21, - 0xFC, 0x18, 0x41, 0xCA, 0xB0, 0x57, 0x34, 0x3E, 0x97, 0x50, 0x6E, 0xBC, 0x2C, 0x71, 0xDD, 0xE4, - 0x59, 0x8B, 0x7A, 0xE7, 0x63, 0x0A, 0xA9, 0xC7, 0x3E, 0xD2, 0x90, 0x5D, 0xAC, 0x39, 0xBD, 0xD2, - 0xF1, 0x9D, 0x84, 0x69, 0xA3, 0x6E, 0xF9, 0xEC, 0x42, 0xCD, 0xF1, 0x95, 0x84, 0x6F, 0x23, 0x6C, - 0x19, 0xED, 0xCA, 0xCD, 0x97, 0x15, 0xAE, 0x8F, 0x3C, 0x64, 0x11, 0xEB, 0x4C, 0x4F, 0x75, 0xF4, - 0x27, 0x07, 0x5A, 0x82, 0xBB, 0x21, 0xB3, 0x58, 0x75, 0xFA, 0xA7, 0x03, 0x3A, 0x81, 0xD3, 0x20, - 0x5D, 0xD8, 0x39, 0x9A, 0x92, 0xEB, 0x2D, 0x8F, 0x5D, 0xA4, 0x39, 0xBB, 0x52, 0xF3, 0x7D, 0x85, - 0xE1, 0xA3, 0x08, 0x79, 0xC6, 0xA2, 0xD2, 0xF9, 0x9D, 0x82, 0xE9, 0xA1, 0x8E, 0xF8, 0x64, 0x42, - 0xAB, 0x71, 0xBF, 0x64, 0x70, 0x2B, 0x64, 0x1F, 0x6B, 0x48, 0x2F, 0x76, 0x9C, 0x26, 0xE9, 0xDA, - 0xCE, 0xDB, 0x14, 0x5B, 0x4F, 0x7B, 0x74, 0x23, 0x67, 0x59, 0xEA, 0xBA, 0xCF, 0x33, 0x14, 0x15, - 0xCF, 0x4F, 0x14, 0x34, 0x0F, 0x57, 0x44, 0x3E, 0xB3, 0x50, 0x75, 0xFC, 0x27, 0x01, 0xDA, 0x80, - 0x5B, 0x20, 0x3B, 0x58, 0x13, 0x7A, 0x8D, 0xE3, 0x25, 0x89, 0xDB, 0x26, 0xDB, 0x5A, 0xDB, 0x7B, - 0x1B, 0x63, 0x4B, 0x69, 0xF7, 0x6E, 0xC6, 0xAC, 0x52, 0xFD, 0xFD, 0x81, 0x81, 0xA0, 0x60, 0x78, - 0x28, 0x22, 0x9E, 0x99, 0xA8, 0x6A, 0xFE, 0xAF, 0x00, 0x7C, 0x00, 0x21, 0xC0, 0x18, 0x50, 0x0A, - 0xBC, 0x07, 0x31, 0xC2, 0x94, 0x51, 0xAF, 0x7C, 0x7C, 0x21, 0xE1, 0xD8, 0x48, 0x5A, 0xB6, 0xBB, - 0x36, 0xF3, 0x56, 0xC5, 0xFE, 0xD3, 0x00, 0x5D, 0xC0, 0x39, 0x90, 0x12, 0xEC, 0x0D, 0x8D, 0xC5, - 0xA5, 0x93, 0x3B, 0x2D, 0xD3, 0x5D, 0x9D, 0xF9, 0xA9, 0x82, 0xFE, 0xE1, 0x80, 0x48, 0x60, 0x36, - 0xA8, 0x16, 0xFE, 0x8E, 0xC0, 0x64, 0x50, 0x2B, 0x7C, 0x1F, 0x61, 0xC8, 0x28, 0x56, 0x9E, 0xBE, - 0xE8, 0x70, 0x4E, 0xA4, 0x34, 0x7B, 0x57, 0x63, 0x7E, 0xA9, 0xE0, 0x7E, 0xC8, 0x20, 0x56, 0x98, - 0x3E, 0xEA, 0x90, 0x4F, 0x2C, 0x34, 0x1D, 0xD7, 0x49, 0x9E, 0xB6, 0xE8, 0x76, 0xCE, 0xA6, 0xD4, - 0x7A, 0xDF, 0x63, 0x18, 0x29, 0xCA, 0x9E, 0xD7, 0x28, 0x5E, 0x9E, 0xB8, 0x68, 0x72, 0xAE, 0xA5, - 0xBC, 0x7B, 0x31, 0xE3, 0x54, 0x49, 0xFF, 0x76, 0xC0, 0x26, 0xD0, 0x1A, 0xDC, 0x0B, 0x19, 0xC7, - 0x4A, 0xD2, 0xB7, 0x1D, 0xB6, 0x89, 0xB6, 0xE6, 0xF6, 0xCA, 0xC6, 0xD7, 0x12, 0xDE, 0x8D, 0x98, - 0x65, 0xAA, 0xAB, 0x3F, 0x3F, 0x50, 0x10, 0x3C, 0x0C, 0x11, 0xC5, 0xCC, 0x53, 0x15, 0xFD, 0xCF, - 0x01, 0x94, 0x00, 0x6F, 0x40, 0x2C, 0x30, 0x1D, 0xD4, 0x09, 0x9F, 0x46, 0xE8, 0x32, 0xCE, 0x95, - 0x94, 0x6F, 0x2F, 0x6C, 0x1C, 0x2D, 0xC9, 0xDD, 0x96, 0xD9, 0xAE, 0xDA, 0xFC, 0x5B, 0x01, 0xFB, - 0x40, 0x43, 0x70, 0x31, 0xE4, 0x14, 0x4B, 0x4F, 0x77, 0x74, 0x26, 0xA7, 0x5A, 0xFA, 0xBB, 0x03, - 0x33, 0x41, 0xD5, 0xF0, 0x5F, 0x04, 0x38, 0x03, 0x52, 0x81, 0xFD, 0xA0, 0x41, 0xB8, 0x30, 0x72, - 0x94, 0x25, 0xAF, 0x5B, 0x3C, 0x3B, 0x51, 0xD3, 0x7C, 0x5D, 0xE1, 0xF9, 0x88, 0x42, 0xE6, 0xB1, - 0x8A, 0xF4, 0x67, 0x07, 0x6A, 0x82, 0xAF, 0x21, 0xBC, 0x18, 0x71, 0xCA, 0xA4, 0x57, 0x3B, 0x7E, - 0x93, 0x60, 0x6D, 0xE8, 0x2D, 0x8E, 0x9D, 0xA4, 0x69, 0xBB, 0x6E, 0xF3, 0x6C, 0x45, 0xED, 0xF3, - 0x0D, 0x85, 0xC5, 0xA3, 0x13, 0x39, 0xCD, 0xD2, 0xD5, 0x9D, 0x9F, 0x29, 0xA8, 0x1E, 0xFE, 0x88, - 0x40, 0x66, 0xB0, 0x2A, 0xF4, 0x1F, 0x07, 0x48, 0x02, 0xB6, 0x81, 0xB6, 0xE0, 0x76, 0xC8, 0x26, - 0xD6, 0x9A, 0xDE, 0xEB, 0x18, 0x4F, 0x4A, 0xB4, 0x37, 0x37, 0x56, 0x96, 0xBE, 0xEE, 0xF0, 0x4C, - 0x44, 0x35, 0xF3, 0x57, 0x05, 0xFE, 0x83, 0x00, 0x61, 0xC0, 0x28, 0x50, 0x1E, 0xBC, 0x08, 0x71, - 0xC6, 0xA4, 0x52, 0xFB, 0x7D, 0x83, 0x61, 0xA1, 0xE8, 0x78, 0x4E, 0xA2, 0xB4, 0x79, 0xB7, 0x62, - 0xF6, 0xA9, 0x86, 0xFE, 0xE2, 0xC0, 0x49, 0x90, 0x36, 0xEC, 0x16, 0xCD, 0xCE, 0xD5, 0x94, 0x5F, - 0x2F, 0x78, 0x1C, 0x22, 0x89, 0xD9, 0xA6, 0xDA, 0xFA, 0xDB, 0x03, 0x1B, 0x41, 0xCB, 0x70, 0x57, - 0x64, 0x3E, 0xAB, 0x50, 0x7F, 0x7C, 0x20, 0x21, 0xD8, 0x18, 0x5A, 0x8A, 0xBB, 0x27, 0x33, 0x5A, - 0x95, 0xFB, 0x2F, 0x03, 0x5C, 0x01, 0xF9, 0xC0, 0x42, 0xD0, 0x31, 0x9C, 0x14, 0x69, 0xCF, 0x6E, - 0xD4, 0x2C, 0x5F, 0x5D, 0xF8, 0x39, 0x82, 0x92, 0xE1, 0xAD, 0x88, 0x7D, 0xA6, 0xA1, 0xBA, 0xF8, - 0x73, 0x02, 0xA5, 0xC1, 0xBB, 0x10, 0x73, 0x4C, 0x25, 0xF5, 0xDB, 0x07, 0x1B, 0x42, 0x8B, 0x71, - 0xA7, 0x64, 0x7A, 0xAB, 0x63, 0x3F, 0x69, 0xD0, 0x2E, 0xDC, 0x1C, 0x59, 0xC9, 0xFA, 0xD6, 0xC3, - 0x1E, 0xD1, 0xC8, 0x5C, 0x56, 0xB9, 0xFE, 0xF2, 0xC0, 0x45, 0x90, 0x33, 0x2C, 0x15, 0xDD, 0xCF, - 0x19, 0x94, 0x0A, 0xEF, 0x47, 0x0C, 0x32, 0x85, 0xD5, 0xA3, 0x1F, 0x39, 0xC8, 0x12, 0xD6, 0x8D, - 0x9E, 0xE5, 0xA8, 0x4B, 0x3E, 0xB7, 0x50, 0x76, 0xBC, 0x26, 0xF1, 0xDA, 0xC4, 0x5B, 0x13, 0x7B, - 0x4D, 0xE3, 0x75, 0x89, 0xE7, 0x26, 0xCA, 0x9A, 0xD7, 0x2B, 0x1E, 0x9F, 0x48, 0x68, 0x36, 0xAE, - 0x96, 0xFC, 0x6E, 0xC1, 0xEC, 0x50, 0x4D, 0xFC, 0x35, 0x81, 0xD7, 0x20, 0x5E, 0x98, 0x38, 0x6A, - 0x92, 0xAF, 0x2D, 0xBC, 0x1D, 0xB1, 0xC9, 0xB4, 0x56, 0xF7, 0x7E, 0xC6, 0xA0, 0x52, 0xF8, 0x3D, - 0x82, 0x91, 0xA1, 0xAC, 0x78, 0x7D, 0xE2, 0xA1, 0x89, 0xB8, 0x66, 0xF2, 0xAA, 0xC5, 0xBF, 0x13, - 0x30, 0x0D, 0xD4, 0x05, 0x9F, 0x43, 0x28, 0x31, 0xDE, 0x94, 0x58, 0x6F, 0x7A, 0xAC, 0x23, 0x3D, - 0xD9, 0xD1, 0x9A, 0xDC, 0x6B, 0x19, 0xEF, 0x4A, 0xCC, 0x37, 0x15, 0xD6, 0x8F, 0x1E, 0xE4, 0x08, - 0x4B, 0x46, 0xB7, 0x72, 0xF6, 0xA5, 0x86, 0xFB, 0x22, 0xC3, 0x59, 0x91, 0xFA, 0xEC, 0x43, 0x0D, - 0xF1, 0xC5, 0x84, 0x53, 0x23, 0x7D, 0xD9, 0xE1, 0x9A, 0xC8, 0x6B, 0x16, 0xAF, 0x4E, 0xFC, 0x34, - 0x41, 0xD7, 0x70, 0x5E, 0xA4, 0x38, 0x7B, 0x52, 0xA3, 0x7D, 0xB9, 0xE1, 0xB2, 0xC8, 0x75, 0x96, - 0xA7, 0x2E, 0xFA, 0x9C, 0x43, 0x29, 0xF1, 0xDE, 0xC4, 0x58, 0x53, 0x7A, 0xBD, 0xE3, 0x31, 0x89, - 0xD4, 0x66, 0xDF, 0x6A, 0xD8, 0x2F, 0x1A, 0x9C, 0x0B, 0x29, 0xC7, 0x5E, 0xD2, 0xB8, 0x5D, 0xB2, - 0xB9, 0xB5, 0xB2, 0xF7, 0x35, 0x86, 0x97, 0x22, 0xEE, 0x99, 0x8C, 0x6A, 0xE5, 0xEF, 0x0B, 0x0C, - 0x07, 0x45, 0xC2, 0xB3, 0x11, 0xB5, 0xCC, 0x77, 0x15, 0xE6, 0x8F, 0x0A, 0xE4, 0x07, 0x0B, 0x42, - 0x87, 0x71, 0xA2, 0xA4, 0x79, 0xBB, 0x62, 0xF3, 0x69, 0x85, 0xEE, 0xE3, 0x0C, 0x49, 0xC5, 0xF6, - 0xD3, 0x06, 0xDD, 0xC2, 0xD9, 0x91, 0x9A, 0xEC, 0x6B, 0x0D, 0xEF, 0x45, 0x8C, 0x33, 0x25, 0xD5, - 0xDB, 0x1F, 0x1B, 0x48, 0x0B, 0x76, 0x87, 0x66, 0xE2, 0xAA, 0xC9, 0xBF, 0x16, 0xF0, 0x0E, 0xC4, - 0x04, 0x53, 0x43, 0x7D, 0xF1, 0xE1, 0x84, 0x48, 0x63, 0x76, 0xA9, 0xE6, 0xFE, 0xCA, 0xC0, 0x57, - 0x10, 0x3E, 0x8C, 0x10, 0x65, 0xCC, 0x2B, 0x15, 0xDF, 0x4F, 0x18, 0x34, 0x0A, 0x97, 0x47, 0x2E, - 0xB2, 0x9C, 0x75, 0xA9, 0xE7, 0x3E, 0xCA, 0x90, 0x57, 0x2C, 0x3E, 0x9D, 0xD0, 0x69, 0x9C, 0x2E, - 0xE9, 0xDC, 0x4E, 0xD9, 0xF4, 0x5A, 0xC7, 0x7B, 0x12, 0xA3, 0x4D, 0xB9, 0xF5, 0xB2, 0xC7, 0x35, - 0x92, 0x97, 0x2D, 0xAE, 0x9D, 0xBC, 0x69, 0xB1, 0xEE, 0xF4, 0x4C, 0x47, 0x75, 0xF2, 0xA7, 0x05, - 0xBA, 0x83, 0x33, 0x21, 0xD5, 0xD8, 0x5F, 0x1A, 0xB8, 0x0B, 0x32, 0x87, 0x55, 0xA2, 0xBF, 0x39, - 0xB0, 0x12, 0xF4, 0x0D, 0x87, 0x45, 0xA2, 0xB3, 0x39, 0xB5, 0xD2, 0xF7, 0x1D, 0x86, 0x89, 0xA2, - 0xE6, 0xF9, 0x8A, 0xC2, 0xE7, 0x11, 0x8A, 0x8C, 0x67, 0x25, 0xEA, 0x9B, 0x0F, 0x2B, 0x44, 0x1F, - 0x73, 0x48, 0x25, 0xF6, 0x9B, 0x06, 0xEB, 0x42, 0xCF, 0x71, 0x94, 0x24, 0x6F, 0x5B, 0x6C, 0x3B, - 0x6D, 0xD3, 0x6D, 0x9D, 0xED, 0xA9, 0x8D, 0xBE, 0xE5, 0xB0, 0x4B, 0x34, 0x37, 0x57, 0x56, 0xBE, - 0xBE, 0xF0, 0x70, 0x44, 0x24, 0x33, 0x5B, 0x55, 0xFB, 0x7F, 0x03, 0x60, 0x01, 0xE8, 0x00, 0x4E, - 0x80, 0x34, 0x60, 0x17, 0x68, 0x0E, 0xAE, 0x84, 0x7C, 0x63, 0x61, 0xE9, 0xE8, 0x4E, 0xCE, 0xB4, - 0x54, 0x77, 0x7F, 0x66, 0xA0, 0x2A, 0xF8, 0x1F, 0x02, 0x88, 0x01, 0xA6, 0x80, 0x7A, 0xE0, 0x23, - 0x08, 0x19, 0xC6, 0x8A, 0xD2, 0xE7, 0x1D, 0x8A, 0x89, 0xA7, 0x26, 0xFA, 0x9A, 0xC3, 0x2B, 0x11, - 0xDF, 0x4C, 0x58, 0x35, 0xFA, 0x97, 0x03, 0x2E, 0x81, 0xDC, 0x60, 0x59, 0xE8, 0x3A, 0xCE, 0x93, - 0x14, 0x6D, 0xCF, 0x6D, 0x94, 0x2D, 0xAF, 0x5D, 0xBC, 0x39, 0xB1, 0xD2, 0xF4, 0x5D, 0x87, 0x79, - 0xA2, 0xA2, 0xF9, 0xB9, 0x82, 0xF2, 0xE1, 0x85, 0x88, 0x63, 0x26, 0xA9, 0xDA, 0xFE, 0xDB, 0x00, - 0x5B, 0x40, 0x3B, 0x70, 0x13, 0x64, 0x0D, 0xEB, 0x45, 0x8F, 0x73, 0x24, 0x25, 0xDB, 0x5B, 0x1B, - 0x7B, 0x4B, 0x63, 0x77, 0x69, 0xE6, 0xAE, 0xCA, 0xFC, 0x57, 0x01, 0xFE, 0x80, 0x40, 0x60, 0x30, - 0x28, 0x14, 0x1E, 0x8F, 0x48, 0x64, 0x36, 0xAB, 0x56, 0xFF, 0x7E, 0xC0, 0x20, 0x50, 0x18, 0x3C, - 0x0A, 0x91, 0xC7, 0x2C, 0x52, 0x9D, 0xFD, 0xA9, 0x81, 0xBE, 0xE0, 0x70, 0x48, 0x24, 0x36, 0x9B, - 0x56, 0xEB, 0x7E, 0xCF, 0x60, 0x54, 0x28, 0x3F, 0x5E, 0x90, 0x38, 0x6C, 0x12, 0xAD, 0xCD, 0xBD, - 0x95, 0xB1, 0xAF, 0x34, 0x7C, 0x17, 0x61, 0xCE, 0xA8, 0x54, 0x7E, 0xBF, 0x60, 0x70, 0x28, 0x24, - 0x1E, 0x9B, 0x48, 0x6B, 0x76, 0xAF, 0x66, 0xFC, 0x2A, 0xC1, 0xDF, 0x10, 0x58, 0x0C, 0x3A, 0x85, - 0xD3, 0x23, 0x1D, 0xD9, 0xC9, 0x9A, 0xD6, 0xEB, 0x1E, 0xCF, 0x48, 0x54, 0x36, 0xBF, 0x56, 0xF0, - 0x3E, 0xC4, 0x10, 0x53, 0x4C, 0x3D, 0xF5, 0xD1, 0x87, 0x1C, 0x62, 0x89, 0xE9, 0xA6, 0xCE, 0xFA, - 0xD4, 0x43, 0x1F, 0x71, 0xC8, 0x24, 0x56, 0x9B, 0x7E, 0xEB, 0x60, 0x4F, 0x68, 0x34, 0x2E, 0x97, - 0x5C, 0x6E, 0xB9, 0xEC, 0x72, 0xCD, 0xE5, 0x95, 0x8B, 0x2F, 0x27, 0x5C, 0x1A, 0xB9, 0xCB, 0x32, - 0xD7, 0x55, 0x9E, 0xBF, 0x28, 0x70, 0x1E, 0xA4, 0x08, 0x7B, 0x46, 0xA3, 0x72, 0xF9, 0xE5, 0x82, - 0xCB, 0x21, 0x97, 0x58, 0x6E, 0xBA, 0xAC, 0x73, 0x3D, 0xE5, 0xD1, 0x8B, 0x1C, 0x67, 0x49, 0xEA, - 0xB6, 0xCF, 0x36, 0xD4, 0x16, 0xDF, 0x4E, 0xD8, 0x34, 0x5A, 0x97, 0x7B, 0x2E, 0xA3, 0x5C, 0x79, - 0xF9, 0xE2, 0xC2, 0xC9, 0x91, 0x96, 0xEC, 0x6E, 0xCD, 0xEC, 0x55, 0x8D, 0xFF, 0x25, 0x80, 0x1B, - 0x20, 0x0B, 0x58, 0x07, 0x7A, 0x82, 0xA3, 0x21, 0xB9, 0xD8, 0x72, 0xDA, 0xA5, 0x9B, 0x3B, 0x2B, - 0x53, 0x5F, 0x7D, 0xF8, 0x21, 0x82, 0x98, 0x61, 0xAA, 0xA8, 0x7F, 0x3E, 0xA0, 0x10, 0x78, 0x0C, - 0x22, 0x85, 0xD9, 0xA3, 0x1A, 0xF9, 0xCB, 0x02, 0xD7, 0x41, 0x9E, 0xB0, 0x68, 0x74, 0x2E, 0xA7, - 0x5C, 0x7A, 0xB9, 0xE3, 0x32, 0xC9, 0xD5, 0x96, 0xDF, 0x2E, 0xD8, 0x1C, 0x5A, 0x89, 0xFB, 0x26, - 0xC3, 0x5A, 0xD1, 0xFB, 0x1C, 0x43, 0x49, 0xF1, 0xF6, 0xC4, 0x46, 0xD3, 0x72, 0xDD, 0xE5, 0x99 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x60, 0x00, 0x28, + 0x00, 0x1E, 0x80, 0x08, 0x60, 0x06, 0xA8, 0x02, 0xFE, 0x81, 0x80, 0x60, 0x60, 0x28, 0x28, 0x1E, 0x9E, 0x88, + 0x68, 0x66, 0xAE, 0xAA, 0xFC, 0x7F, 0x01, 0xE0, 0x00, 0x48, 0x00, 0x36, 0x80, 0x16, 0xE0, 0x0E, 0xC8, 0x04, + 0x56, 0x83, 0x7E, 0xE1, 0xE0, 0x48, 0x48, 0x36, 0xB6, 0x96, 0xF6, 0xEE, 0xC6, 0xCC, 0x52, 0xD5, 0xFD, 0x9F, + 0x01, 0xA8, 0x00, 0x7E, 0x80, 0x20, 0x60, 0x18, 0x28, 0x0A, 0x9E, 0x87, 0x28, 0x62, 0x9E, 0xA9, 0xA8, 0x7E, + 0xFE, 0xA0, 0x40, 0x78, 0x30, 0x22, 0x94, 0x19, 0xAF, 0x4A, 0xFC, 0x37, 0x01, 0xD6, 0x80, 0x5E, 0xE0, 0x38, + 0x48, 0x12, 0xB6, 0x8D, 0xB6, 0xE5, 0xB6, 0xCB, 0x36, 0xD7, 0x56, 0xDE, 0xBE, 0xD8, 0x70, 0x5A, 0xA4, 0x3B, + 0x3B, 0x53, 0x53, 0x7D, 0xFD, 0xE1, 0x81, 0x88, 0x60, 0x66, 0xA8, 0x2A, 0xFE, 0x9F, 0x00, 0x68, 0x00, 0x2E, + 0x80, 0x1C, 0x60, 0x09, 0xE8, 0x06, 0xCE, 0x82, 0xD4, 0x61, 0x9F, 0x68, 0x68, 0x2E, 0xAE, 0x9C, 0x7C, 0x69, + 0xE1, 0xEE, 0xC8, 0x4C, 0x56, 0xB5, 0xFE, 0xF7, 0x00, 0x46, 0x80, 0x32, 0xE0, 0x15, 0x88, 0x0F, 0x26, 0x84, + 0x1A, 0xE3, 0x4B, 0x09, 0xF7, 0x46, 0xC6, 0xB2, 0xD2, 0xF5, 0x9D, 0x87, 0x29, 0xA2, 0x9E, 0xF9, 0xA8, 0x42, + 0xFE, 0xB1, 0x80, 0x74, 0x60, 0x27, 0x68, 0x1A, 0xAE, 0x8B, 0x3C, 0x67, 0x51, 0xEA, 0xBC, 0x4F, 0x31, 0xF4, + 0x14, 0x47, 0x4F, 0x72, 0xB4, 0x25, 0xB7, 0x5B, 0x36, 0xBB, 0x56, 0xF3, 0x7E, 0xC5, 0xE0, 0x53, 0x08, 0x3D, + 0xC6, 0x91, 0x92, 0xEC, 0x6D, 0x8D, 0xED, 0xA5, 0x8D, 0xBB, 0x25, 0xB3, 0x5B, 0x35, 0xFB, 0x57, 0x03, 0x7E, + 0x81, 0xE0, 0x60, 0x48, 0x28, 0x36, 0x9E, 0x96, 0xE8, 0x6E, 0xCE, 0xAC, 0x54, 0x7D, 0xFF, 0x61, 0x80, 0x28, + 0x60, 0x1E, 0xA8, 0x08, 0x7E, 0x86, 0xA0, 0x62, 0xF8, 0x29, 0x82, 0x9E, 0xE1, 0xA8, 0x48, 0x7E, 0xB6, 0xA0, + 0x76, 0xF8, 0x26, 0xC2, 0x9A, 0xD1, 0xAB, 0x1C, 0x7F, 0x49, 0xE0, 0x36, 0xC8, 0x16, 0xD6, 0x8E, 0xDE, 0xE4, + 0x58, 0x4B, 0x7A, 0xB7, 0x63, 0x36, 0xA9, 0xD6, 0xFE, 0xDE, 0xC0, 0x58, 0x50, 0x3A, 0xBC, 0x13, 0x31, 0xCD, + 0xD4, 0x55, 0x9F, 0x7F, 0x28, 0x20, 0x1E, 0x98, 0x08, 0x6A, 0x86, 0xAF, 0x22, 0xFC, 0x19, 0x81, 0xCA, 0xE0, + 0x57, 0x08, 0x3E, 0x86, 0x90, 0x62, 0xEC, 0x29, 0x8D, 0xDE, 0xE5, 0x98, 0x4B, 0x2A, 0xB7, 0x5F, 0x36, 0xB8, + 0x16, 0xF2, 0x8E, 0xC5, 0xA4, 0x53, 0x3B, 0x7D, 0xD3, 0x61, 0x9D, 0xE8, 0x69, 0x8E, 0xAE, 0xE4, 0x7C, 0x4B, + 0x61, 0xF7, 0x68, 0x46, 0xAE, 0xB2, 0xFC, 0x75, 0x81, 0xE7, 0x20, 0x4A, 0x98, 0x37, 0x2A, 0x96, 0x9F, 0x2E, + 0xE8, 0x1C, 0x4E, 0x89, 0xF4, 0x66, 0xC7, 0x6A, 0xD2, 0xAF, 0x1D, 0xBC, 0x09, 0xB1, 0xC6, 0xF4, 0x52, 0xC7, + 0x7D, 0x92, 0xA1, 0xAD, 0xB8, 0x7D, 0xB2, 0xA1, 0xB5, 0xB8, 0x77, 0x32, 0xA6, 0x95, 0xBA, 0xEF, 0x33, 0x0C, + 0x15, 0xC5, 0xCF, 0x13, 0x14, 0x0D, 0xCF, 0x45, 0x94, 0x33, 0x2F, 0x55, 0xDC, 0x3F, 0x19, 0xD0, 0x0A, 0xDC, + 0x07, 0x19, 0xC2, 0x8A, 0xD1, 0xA7, 0x1C, 0x7A, 0x89, 0xE3, 0x26, 0xC9, 0xDA, 0xD6, 0xDB, 0x1E, 0xDB, 0x48, + 0x5B, 0x76, 0xBB, 0x66, 0xF3, 0x6A, 0xC5, 0xEF, 0x13, 0x0C, 0x0D, 0xC5, 0xC5, 0x93, 0x13, 0x2D, 0xCD, 0xDD, + 0x95, 0x99, 0xAF, 0x2A, 0xFC, 0x1F, 0x01, 0xC8, 0x00, 0x56, 0x80, 0x3E, 0xE0, 0x10, 0x48, 0x0C, 0x36, 0x85, + 0xD6, 0xE3, 0x1E, 0xC9, 0xC8, 0x56, 0xD6, 0xBE, 0xDE, 0xF0, 0x58, 0x44, 0x3A, 0xB3, 0x53, 0x35, 0xFD, 0xD7, + 0x01, 0x9E, 0x80, 0x68, 0x60, 0x2E, 0xA8, 0x1C, 0x7E, 0x89, 0xE0, 0x66, 0xC8, 0x2A, 0xD6, 0x9F, 0x1E, 0xE8, + 0x08, 0x4E, 0x86, 0xB4, 0x62, 0xF7, 0x69, 0x86, 0xAE, 0xE2, 0xFC, 0x49, 0x81, 0xF6, 0xE0, 0x46, 0xC8, 0x32, + 0xD6, 0x95, 0x9E, 0xEF, 0x28, 0x4C, 0x1E, 0xB5, 0xC8, 0x77, 0x16, 0xA6, 0x8E, 0xFA, 0xE4, 0x43, 0x0B, 0x71, + 0xC7, 0x64, 0x52, 0xAB, 0x7D, 0xBF, 0x61, 0xB0, 0x28, 0x74, 0x1E, 0xA7, 0x48, 0x7A, 0xB6, 0xA3, 0x36, 0xF9, + 0xD6, 0xC2, 0xDE, 0xD1, 0x98, 0x5C, 0x6A, 0xB9, 0xEF, 0x32, 0xCC, 0x15, 0x95, 0xCF, 0x2F, 0x14, 0x1C, 0x0F, + 0x49, 0xC4, 0x36, 0xD3, 0x56, 0xDD, 0xFE, 0xD9, 0x80, 0x5A, 0xE0, 0x3B, 0x08, 0x13, 0x46, 0x8D, 0xF2, 0xE5, + 0x85, 0x8B, 0x23, 0x27, 0x59, 0xDA, 0xBA, 0xDB, 0x33, 0x1B, 0x55, 0xCB, 0x7F, 0x17, 0x60, 0x0E, 0xA8, 0x04, + 0x7E, 0x83, 0x60, 0x61, 0xE8, 0x28, 0x4E, 0x9E, 0xB4, 0x68, 0x77, 0x6E, 0xA6, 0xAC, 0x7A, 0xFD, 0xE3, 0x01, + 0x89, 0xC0, 0x66, 0xD0, 0x2A, 0xDC, 0x1F, 0x19, 0xC8, 0x0A, 0xD6, 0x87, 0x1E, 0xE2, 0x88, 0x49, 0xA6, 0xB6, + 0xFA, 0xF6, 0xC3, 0x06, 0xD1, 0xC2, 0xDC, 0x51, 0x99, 0xFC, 0x6A, 0xC1, 0xEF, 0x10, 0x4C, 0x0C, 0x35, 0xC5, + 0xD7, 0x13, 0x1E, 0x8D, 0xC8, 0x65, 0x96, 0xAB, 0x2E, 0xFF, 0x5C, 0x40, 0x39, 0xF0, 0x12, 0xC4, 0x0D, 0x93, + 0x45, 0xAD, 0xF3, 0x3D, 0x85, 0xD1, 0xA3, 0x1C, 0x79, 0xC9, 0xE2, 0xD6, 0xC9, 0x9E, 0xD6, 0xE8, 0x5E, 0xCE, + 0xB8, 0x54, 0x72, 0xBF, 0x65, 0xB0, 0x2B, 0x34, 0x1F, 0x57, 0x48, 0x3E, 0xB6, 0x90, 0x76, 0xEC, 0x26, 0xCD, + 0xDA, 0xD5, 0x9B, 0x1F, 0x2B, 0x48, 0x1F, 0x76, 0x88, 0x26, 0xE6, 0x9A, 0xCA, 0xEB, 0x17, 0x0F, 0x4E, 0x84, + 0x34, 0x63, 0x57, 0x69, 0xFE, 0xAE, 0xC0, 0x7C, 0x50, 0x21, 0xFC, 0x18, 0x41, 0xCA, 0xB0, 0x57, 0x34, 0x3E, + 0x97, 0x50, 0x6E, 0xBC, 0x2C, 0x71, 0xDD, 0xE4, 0x59, 0x8B, 0x7A, 0xE7, 0x63, 0x0A, 0xA9, 0xC7, 0x3E, 0xD2, + 0x90, 0x5D, 0xAC, 0x39, 0xBD, 0xD2, 0xF1, 0x9D, 0x84, 0x69, 0xA3, 0x6E, 0xF9, 0xEC, 0x42, 0xCD, 0xF1, 0x95, + 0x84, 0x6F, 0x23, 0x6C, 0x19, 0xED, 0xCA, 0xCD, 0x97, 0x15, 0xAE, 0x8F, 0x3C, 0x64, 0x11, 0xEB, 0x4C, 0x4F, + 0x75, 0xF4, 0x27, 0x07, 0x5A, 0x82, 0xBB, 0x21, 0xB3, 0x58, 0x75, 0xFA, 0xA7, 0x03, 0x3A, 0x81, 0xD3, 0x20, + 0x5D, 0xD8, 0x39, 0x9A, 0x92, 0xEB, 0x2D, 0x8F, 0x5D, 0xA4, 0x39, 0xBB, 0x52, 0xF3, 0x7D, 0x85, 0xE1, 0xA3, + 0x08, 0x79, 0xC6, 0xA2, 0xD2, 0xF9, 0x9D, 0x82, 0xE9, 0xA1, 0x8E, 0xF8, 0x64, 0x42, 0xAB, 0x71, 0xBF, 0x64, + 0x70, 0x2B, 0x64, 0x1F, 0x6B, 0x48, 0x2F, 0x76, 0x9C, 0x26, 0xE9, 0xDA, 0xCE, 0xDB, 0x14, 0x5B, 0x4F, 0x7B, + 0x74, 0x23, 0x67, 0x59, 0xEA, 0xBA, 0xCF, 0x33, 0x14, 0x15, 0xCF, 0x4F, 0x14, 0x34, 0x0F, 0x57, 0x44, 0x3E, + 0xB3, 0x50, 0x75, 0xFC, 0x27, 0x01, 0xDA, 0x80, 0x5B, 0x20, 0x3B, 0x58, 0x13, 0x7A, 0x8D, 0xE3, 0x25, 0x89, + 0xDB, 0x26, 0xDB, 0x5A, 0xDB, 0x7B, 0x1B, 0x63, 0x4B, 0x69, 0xF7, 0x6E, 0xC6, 0xAC, 0x52, 0xFD, 0xFD, 0x81, + 0x81, 0xA0, 0x60, 0x78, 0x28, 0x22, 0x9E, 0x99, 0xA8, 0x6A, 0xFE, 0xAF, 0x00, 0x7C, 0x00, 0x21, 0xC0, 0x18, + 0x50, 0x0A, 0xBC, 0x07, 0x31, 0xC2, 0x94, 0x51, 0xAF, 0x7C, 0x7C, 0x21, 0xE1, 0xD8, 0x48, 0x5A, 0xB6, 0xBB, + 0x36, 0xF3, 0x56, 0xC5, 0xFE, 0xD3, 0x00, 0x5D, 0xC0, 0x39, 0x90, 0x12, 0xEC, 0x0D, 0x8D, 0xC5, 0xA5, 0x93, + 0x3B, 0x2D, 0xD3, 0x5D, 0x9D, 0xF9, 0xA9, 0x82, 0xFE, 0xE1, 0x80, 0x48, 0x60, 0x36, 0xA8, 0x16, 0xFE, 0x8E, + 0xC0, 0x64, 0x50, 0x2B, 0x7C, 0x1F, 0x61, 0xC8, 0x28, 0x56, 0x9E, 0xBE, 0xE8, 0x70, 0x4E, 0xA4, 0x34, 0x7B, + 0x57, 0x63, 0x7E, 0xA9, 0xE0, 0x7E, 0xC8, 0x20, 0x56, 0x98, 0x3E, 0xEA, 0x90, 0x4F, 0x2C, 0x34, 0x1D, 0xD7, + 0x49, 0x9E, 0xB6, 0xE8, 0x76, 0xCE, 0xA6, 0xD4, 0x7A, 0xDF, 0x63, 0x18, 0x29, 0xCA, 0x9E, 0xD7, 0x28, 0x5E, + 0x9E, 0xB8, 0x68, 0x72, 0xAE, 0xA5, 0xBC, 0x7B, 0x31, 0xE3, 0x54, 0x49, 0xFF, 0x76, 0xC0, 0x26, 0xD0, 0x1A, + 0xDC, 0x0B, 0x19, 0xC7, 0x4A, 0xD2, 0xB7, 0x1D, 0xB6, 0x89, 0xB6, 0xE6, 0xF6, 0xCA, 0xC6, 0xD7, 0x12, 0xDE, + 0x8D, 0x98, 0x65, 0xAA, 0xAB, 0x3F, 0x3F, 0x50, 0x10, 0x3C, 0x0C, 0x11, 0xC5, 0xCC, 0x53, 0x15, 0xFD, 0xCF, + 0x01, 0x94, 0x00, 0x6F, 0x40, 0x2C, 0x30, 0x1D, 0xD4, 0x09, 0x9F, 0x46, 0xE8, 0x32, 0xCE, 0x95, 0x94, 0x6F, + 0x2F, 0x6C, 0x1C, 0x2D, 0xC9, 0xDD, 0x96, 0xD9, 0xAE, 0xDA, 0xFC, 0x5B, 0x01, 0xFB, 0x40, 0x43, 0x70, 0x31, + 0xE4, 0x14, 0x4B, 0x4F, 0x77, 0x74, 0x26, 0xA7, 0x5A, 0xFA, 0xBB, 0x03, 0x33, 0x41, 0xD5, 0xF0, 0x5F, 0x04, + 0x38, 0x03, 0x52, 0x81, 0xFD, 0xA0, 0x41, 0xB8, 0x30, 0x72, 0x94, 0x25, 0xAF, 0x5B, 0x3C, 0x3B, 0x51, 0xD3, + 0x7C, 0x5D, 0xE1, 0xF9, 0x88, 0x42, 0xE6, 0xB1, 0x8A, 0xF4, 0x67, 0x07, 0x6A, 0x82, 0xAF, 0x21, 0xBC, 0x18, + 0x71, 0xCA, 0xA4, 0x57, 0x3B, 0x7E, 0x93, 0x60, 0x6D, 0xE8, 0x2D, 0x8E, 0x9D, 0xA4, 0x69, 0xBB, 0x6E, 0xF3, + 0x6C, 0x45, 0xED, 0xF3, 0x0D, 0x85, 0xC5, 0xA3, 0x13, 0x39, 0xCD, 0xD2, 0xD5, 0x9D, 0x9F, 0x29, 0xA8, 0x1E, + 0xFE, 0x88, 0x40, 0x66, 0xB0, 0x2A, 0xF4, 0x1F, 0x07, 0x48, 0x02, 0xB6, 0x81, 0xB6, 0xE0, 0x76, 0xC8, 0x26, + 0xD6, 0x9A, 0xDE, 0xEB, 0x18, 0x4F, 0x4A, 0xB4, 0x37, 0x37, 0x56, 0x96, 0xBE, 0xEE, 0xF0, 0x4C, 0x44, 0x35, + 0xF3, 0x57, 0x05, 0xFE, 0x83, 0x00, 0x61, 0xC0, 0x28, 0x50, 0x1E, 0xBC, 0x08, 0x71, 0xC6, 0xA4, 0x52, 0xFB, + 0x7D, 0x83, 0x61, 0xA1, 0xE8, 0x78, 0x4E, 0xA2, 0xB4, 0x79, 0xB7, 0x62, 0xF6, 0xA9, 0x86, 0xFE, 0xE2, 0xC0, + 0x49, 0x90, 0x36, 0xEC, 0x16, 0xCD, 0xCE, 0xD5, 0x94, 0x5F, 0x2F, 0x78, 0x1C, 0x22, 0x89, 0xD9, 0xA6, 0xDA, + 0xFA, 0xDB, 0x03, 0x1B, 0x41, 0xCB, 0x70, 0x57, 0x64, 0x3E, 0xAB, 0x50, 0x7F, 0x7C, 0x20, 0x21, 0xD8, 0x18, + 0x5A, 0x8A, 0xBB, 0x27, 0x33, 0x5A, 0x95, 0xFB, 0x2F, 0x03, 0x5C, 0x01, 0xF9, 0xC0, 0x42, 0xD0, 0x31, 0x9C, + 0x14, 0x69, 0xCF, 0x6E, 0xD4, 0x2C, 0x5F, 0x5D, 0xF8, 0x39, 0x82, 0x92, 0xE1, 0xAD, 0x88, 0x7D, 0xA6, 0xA1, + 0xBA, 0xF8, 0x73, 0x02, 0xA5, 0xC1, 0xBB, 0x10, 0x73, 0x4C, 0x25, 0xF5, 0xDB, 0x07, 0x1B, 0x42, 0x8B, 0x71, + 0xA7, 0x64, 0x7A, 0xAB, 0x63, 0x3F, 0x69, 0xD0, 0x2E, 0xDC, 0x1C, 0x59, 0xC9, 0xFA, 0xD6, 0xC3, 0x1E, 0xD1, + 0xC8, 0x5C, 0x56, 0xB9, 0xFE, 0xF2, 0xC0, 0x45, 0x90, 0x33, 0x2C, 0x15, 0xDD, 0xCF, 0x19, 0x94, 0x0A, 0xEF, + 0x47, 0x0C, 0x32, 0x85, 0xD5, 0xA3, 0x1F, 0x39, 0xC8, 0x12, 0xD6, 0x8D, 0x9E, 0xE5, 0xA8, 0x4B, 0x3E, 0xB7, + 0x50, 0x76, 0xBC, 0x26, 0xF1, 0xDA, 0xC4, 0x5B, 0x13, 0x7B, 0x4D, 0xE3, 0x75, 0x89, 0xE7, 0x26, 0xCA, 0x9A, + 0xD7, 0x2B, 0x1E, 0x9F, 0x48, 0x68, 0x36, 0xAE, 0x96, 0xFC, 0x6E, 0xC1, 0xEC, 0x50, 0x4D, 0xFC, 0x35, 0x81, + 0xD7, 0x20, 0x5E, 0x98, 0x38, 0x6A, 0x92, 0xAF, 0x2D, 0xBC, 0x1D, 0xB1, 0xC9, 0xB4, 0x56, 0xF7, 0x7E, 0xC6, + 0xA0, 0x52, 0xF8, 0x3D, 0x82, 0x91, 0xA1, 0xAC, 0x78, 0x7D, 0xE2, 0xA1, 0x89, 0xB8, 0x66, 0xF2, 0xAA, 0xC5, + 0xBF, 0x13, 0x30, 0x0D, 0xD4, 0x05, 0x9F, 0x43, 0x28, 0x31, 0xDE, 0x94, 0x58, 0x6F, 0x7A, 0xAC, 0x23, 0x3D, + 0xD9, 0xD1, 0x9A, 0xDC, 0x6B, 0x19, 0xEF, 0x4A, 0xCC, 0x37, 0x15, 0xD6, 0x8F, 0x1E, 0xE4, 0x08, 0x4B, 0x46, + 0xB7, 0x72, 0xF6, 0xA5, 0x86, 0xFB, 0x22, 0xC3, 0x59, 0x91, 0xFA, 0xEC, 0x43, 0x0D, 0xF1, 0xC5, 0x84, 0x53, + 0x23, 0x7D, 0xD9, 0xE1, 0x9A, 0xC8, 0x6B, 0x16, 0xAF, 0x4E, 0xFC, 0x34, 0x41, 0xD7, 0x70, 0x5E, 0xA4, 0x38, + 0x7B, 0x52, 0xA3, 0x7D, 0xB9, 0xE1, 0xB2, 0xC8, 0x75, 0x96, 0xA7, 0x2E, 0xFA, 0x9C, 0x43, 0x29, 0xF1, 0xDE, + 0xC4, 0x58, 0x53, 0x7A, 0xBD, 0xE3, 0x31, 0x89, 0xD4, 0x66, 0xDF, 0x6A, 0xD8, 0x2F, 0x1A, 0x9C, 0x0B, 0x29, + 0xC7, 0x5E, 0xD2, 0xB8, 0x5D, 0xB2, 0xB9, 0xB5, 0xB2, 0xF7, 0x35, 0x86, 0x97, 0x22, 0xEE, 0x99, 0x8C, 0x6A, + 0xE5, 0xEF, 0x0B, 0x0C, 0x07, 0x45, 0xC2, 0xB3, 0x11, 0xB5, 0xCC, 0x77, 0x15, 0xE6, 0x8F, 0x0A, 0xE4, 0x07, + 0x0B, 0x42, 0x87, 0x71, 0xA2, 0xA4, 0x79, 0xBB, 0x62, 0xF3, 0x69, 0x85, 0xEE, 0xE3, 0x0C, 0x49, 0xC5, 0xF6, + 0xD3, 0x06, 0xDD, 0xC2, 0xD9, 0x91, 0x9A, 0xEC, 0x6B, 0x0D, 0xEF, 0x45, 0x8C, 0x33, 0x25, 0xD5, 0xDB, 0x1F, + 0x1B, 0x48, 0x0B, 0x76, 0x87, 0x66, 0xE2, 0xAA, 0xC9, 0xBF, 0x16, 0xF0, 0x0E, 0xC4, 0x04, 0x53, 0x43, 0x7D, + 0xF1, 0xE1, 0x84, 0x48, 0x63, 0x76, 0xA9, 0xE6, 0xFE, 0xCA, 0xC0, 0x57, 0x10, 0x3E, 0x8C, 0x10, 0x65, 0xCC, + 0x2B, 0x15, 0xDF, 0x4F, 0x18, 0x34, 0x0A, 0x97, 0x47, 0x2E, 0xB2, 0x9C, 0x75, 0xA9, 0xE7, 0x3E, 0xCA, 0x90, + 0x57, 0x2C, 0x3E, 0x9D, 0xD0, 0x69, 0x9C, 0x2E, 0xE9, 0xDC, 0x4E, 0xD9, 0xF4, 0x5A, 0xC7, 0x7B, 0x12, 0xA3, + 0x4D, 0xB9, 0xF5, 0xB2, 0xC7, 0x35, 0x92, 0x97, 0x2D, 0xAE, 0x9D, 0xBC, 0x69, 0xB1, 0xEE, 0xF4, 0x4C, 0x47, + 0x75, 0xF2, 0xA7, 0x05, 0xBA, 0x83, 0x33, 0x21, 0xD5, 0xD8, 0x5F, 0x1A, 0xB8, 0x0B, 0x32, 0x87, 0x55, 0xA2, + 0xBF, 0x39, 0xB0, 0x12, 0xF4, 0x0D, 0x87, 0x45, 0xA2, 0xB3, 0x39, 0xB5, 0xD2, 0xF7, 0x1D, 0x86, 0x89, 0xA2, + 0xE6, 0xF9, 0x8A, 0xC2, 0xE7, 0x11, 0x8A, 0x8C, 0x67, 0x25, 0xEA, 0x9B, 0x0F, 0x2B, 0x44, 0x1F, 0x73, 0x48, + 0x25, 0xF6, 0x9B, 0x06, 0xEB, 0x42, 0xCF, 0x71, 0x94, 0x24, 0x6F, 0x5B, 0x6C, 0x3B, 0x6D, 0xD3, 0x6D, 0x9D, + 0xED, 0xA9, 0x8D, 0xBE, 0xE5, 0xB0, 0x4B, 0x34, 0x37, 0x57, 0x56, 0xBE, 0xBE, 0xF0, 0x70, 0x44, 0x24, 0x33, + 0x5B, 0x55, 0xFB, 0x7F, 0x03, 0x60, 0x01, 0xE8, 0x00, 0x4E, 0x80, 0x34, 0x60, 0x17, 0x68, 0x0E, 0xAE, 0x84, + 0x7C, 0x63, 0x61, 0xE9, 0xE8, 0x4E, 0xCE, 0xB4, 0x54, 0x77, 0x7F, 0x66, 0xA0, 0x2A, 0xF8, 0x1F, 0x02, 0x88, + 0x01, 0xA6, 0x80, 0x7A, 0xE0, 0x23, 0x08, 0x19, 0xC6, 0x8A, 0xD2, 0xE7, 0x1D, 0x8A, 0x89, 0xA7, 0x26, 0xFA, + 0x9A, 0xC3, 0x2B, 0x11, 0xDF, 0x4C, 0x58, 0x35, 0xFA, 0x97, 0x03, 0x2E, 0x81, 0xDC, 0x60, 0x59, 0xE8, 0x3A, + 0xCE, 0x93, 0x14, 0x6D, 0xCF, 0x6D, 0x94, 0x2D, 0xAF, 0x5D, 0xBC, 0x39, 0xB1, 0xD2, 0xF4, 0x5D, 0x87, 0x79, + 0xA2, 0xA2, 0xF9, 0xB9, 0x82, 0xF2, 0xE1, 0x85, 0x88, 0x63, 0x26, 0xA9, 0xDA, 0xFE, 0xDB, 0x00, 0x5B, 0x40, + 0x3B, 0x70, 0x13, 0x64, 0x0D, 0xEB, 0x45, 0x8F, 0x73, 0x24, 0x25, 0xDB, 0x5B, 0x1B, 0x7B, 0x4B, 0x63, 0x77, + 0x69, 0xE6, 0xAE, 0xCA, 0xFC, 0x57, 0x01, 0xFE, 0x80, 0x40, 0x60, 0x30, 0x28, 0x14, 0x1E, 0x8F, 0x48, 0x64, + 0x36, 0xAB, 0x56, 0xFF, 0x7E, 0xC0, 0x20, 0x50, 0x18, 0x3C, 0x0A, 0x91, 0xC7, 0x2C, 0x52, 0x9D, 0xFD, 0xA9, + 0x81, 0xBE, 0xE0, 0x70, 0x48, 0x24, 0x36, 0x9B, 0x56, 0xEB, 0x7E, 0xCF, 0x60, 0x54, 0x28, 0x3F, 0x5E, 0x90, + 0x38, 0x6C, 0x12, 0xAD, 0xCD, 0xBD, 0x95, 0xB1, 0xAF, 0x34, 0x7C, 0x17, 0x61, 0xCE, 0xA8, 0x54, 0x7E, 0xBF, + 0x60, 0x70, 0x28, 0x24, 0x1E, 0x9B, 0x48, 0x6B, 0x76, 0xAF, 0x66, 0xFC, 0x2A, 0xC1, 0xDF, 0x10, 0x58, 0x0C, + 0x3A, 0x85, 0xD3, 0x23, 0x1D, 0xD9, 0xC9, 0x9A, 0xD6, 0xEB, 0x1E, 0xCF, 0x48, 0x54, 0x36, 0xBF, 0x56, 0xF0, + 0x3E, 0xC4, 0x10, 0x53, 0x4C, 0x3D, 0xF5, 0xD1, 0x87, 0x1C, 0x62, 0x89, 0xE9, 0xA6, 0xCE, 0xFA, 0xD4, 0x43, + 0x1F, 0x71, 0xC8, 0x24, 0x56, 0x9B, 0x7E, 0xEB, 0x60, 0x4F, 0x68, 0x34, 0x2E, 0x97, 0x5C, 0x6E, 0xB9, 0xEC, + 0x72, 0xCD, 0xE5, 0x95, 0x8B, 0x2F, 0x27, 0x5C, 0x1A, 0xB9, 0xCB, 0x32, 0xD7, 0x55, 0x9E, 0xBF, 0x28, 0x70, + 0x1E, 0xA4, 0x08, 0x7B, 0x46, 0xA3, 0x72, 0xF9, 0xE5, 0x82, 0xCB, 0x21, 0x97, 0x58, 0x6E, 0xBA, 0xAC, 0x73, + 0x3D, 0xE5, 0xD1, 0x8B, 0x1C, 0x67, 0x49, 0xEA, 0xB6, 0xCF, 0x36, 0xD4, 0x16, 0xDF, 0x4E, 0xD8, 0x34, 0x5A, + 0x97, 0x7B, 0x2E, 0xA3, 0x5C, 0x79, 0xF9, 0xE2, 0xC2, 0xC9, 0x91, 0x96, 0xEC, 0x6E, 0xCD, 0xEC, 0x55, 0x8D, + 0xFF, 0x25, 0x80, 0x1B, 0x20, 0x0B, 0x58, 0x07, 0x7A, 0x82, 0xA3, 0x21, 0xB9, 0xD8, 0x72, 0xDA, 0xA5, 0x9B, + 0x3B, 0x2B, 0x53, 0x5F, 0x7D, 0xF8, 0x21, 0x82, 0x98, 0x61, 0xAA, 0xA8, 0x7F, 0x3E, 0xA0, 0x10, 0x78, 0x0C, + 0x22, 0x85, 0xD9, 0xA3, 0x1A, 0xF9, 0xCB, 0x02, 0xD7, 0x41, 0x9E, 0xB0, 0x68, 0x74, 0x2E, 0xA7, 0x5C, 0x7A, + 0xB9, 0xE3, 0x32, 0xC9, 0xD5, 0x96, 0xDF, 0x2E, 0xD8, 0x1C, 0x5A, 0x89, 0xFB, 0x26, 0xC3, 0x5A, 0xD1, 0xFB, + 0x1C, 0x43, 0x49, 0xF1, 0xF6, 0xC4, 0x46, 0xD3, 0x72, 0xDD, 0xE5, 0x99 }; - public static readonly byte[] SyncMark = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 }; + public static readonly byte[] SyncMark = + {0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00}; public static byte[] Scramble(byte[] sector) { - if(sector == null || sector.Length < 2352) - return sector; + if(sector == null || sector.Length < 2352) return sector; byte[] sync = new byte[12]; Array.Copy(sector, 0, sync, 0, 12); - if(!SyncMark.SequenceEqual(sync)) - return sector; + if(!SyncMark.SequenceEqual(sync)) return sector; byte[] scrambled = new byte[sector.Length]; - for(int i = 0; i < 2352; i++) - scrambled[i] = (byte)(sector[i] ^ ScrambleTable[i]); + for(int i = 0; i < 2352; i++) scrambled[i] = (byte)(sector[i] ^ ScrambleTable[i]); - if(sector.Length > 2352) - { - for(int i = 2352; i < sector.Length; i++) - scrambled[i] = sector[i]; - } + if(sector.Length > 2352) { for(int i = 2352; i < sector.Length; i++) scrambled[i] = sector[i]; } return scrambled; } diff --git a/DiscImageChef.Decoders/CD/Session.cs b/DiscImageChef.Decoders/CD/Session.cs index 7acfa756..c95e5ebe 100644 --- a/DiscImageChef.Decoders/CD/Session.cs +++ b/DiscImageChef.Decoders/CD/Session.cs @@ -109,8 +109,7 @@ namespace DiscImageChef.Decoders.CD public static CDSessionInfo? Decode(byte[] CDSessionInfoResponse) { - if(CDSessionInfoResponse == null) - return null; + if(CDSessionInfoResponse == null) return null; CDSessionInfo decoded = new CDSessionInfo(); @@ -123,7 +122,9 @@ namespace DiscImageChef.Decoders.CD if(decoded.DataLength + 2 != CDSessionInfoResponse.Length) { - DicConsole.DebugWriteLine("CD Session Info decoder", "Expected CDSessionInfo size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDSessionInfoResponse.Length); + DicConsole.DebugWriteLine("CD Session Info decoder", + "Expected CDSessionInfo size ({0} bytes) is not received size ({1} bytes), not decoding", + decoded.DataLength + 2, CDSessionInfoResponse.Length); return null; } @@ -134,7 +135,8 @@ namespace DiscImageChef.Decoders.CD decoded.TrackDescriptors[i].CONTROL = (byte)(CDSessionInfoResponse[1 + i * 8 + 4] & 0x0F); decoded.TrackDescriptors[i].TrackNumber = CDSessionInfoResponse[2 + i * 8 + 4]; decoded.TrackDescriptors[i].Reserved2 = CDSessionInfoResponse[3 + i * 8 + 4]; - decoded.TrackDescriptors[i].TrackStartAddress = BigEndianBitConverter.ToUInt32(CDSessionInfoResponse, 4 + i * 8 + 4); + decoded.TrackDescriptors[i].TrackStartAddress = + BigEndianBitConverter.ToUInt32(CDSessionInfoResponse, 4 + i * 8 + 4); } return decoded; @@ -142,8 +144,7 @@ namespace DiscImageChef.Decoders.CD public static string Prettify(CDSessionInfo? CDSessionInfoResponse) { - if(CDSessionInfoResponse == null) - return null; + if(CDSessionInfoResponse == null) return null; CDSessionInfo response = CDSessionInfoResponse.Value; @@ -153,11 +154,12 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("Last complete session number: {0}", response.LastCompleteSession).AppendLine(); foreach(TrackDataDescriptor descriptor in response.TrackDescriptors) { - sb.AppendFormat("First track number in last complete session: {0}", descriptor.TrackNumber).AppendLine(); + sb.AppendFormat("First track number in last complete session: {0}", descriptor.TrackNumber) + .AppendLine(); sb.AppendFormat("Track starts at LBA {0}, or MSF {1:X2}:{2:X2}:{3:X2}", descriptor.TrackStartAddress, - (descriptor.TrackStartAddress & 0x0000FF00) >> 8, - (descriptor.TrackStartAddress & 0x00FF0000) >> 16, - (descriptor.TrackStartAddress & 0xFF000000) >> 24).AppendLine(); + (descriptor.TrackStartAddress & 0x0000FF00) >> 8, + (descriptor.TrackStartAddress & 0x00FF0000) >> 16, + (descriptor.TrackStartAddress & 0xFF000000) >> 24).AppendLine(); switch((TOC_ADR)descriptor.ADR) { @@ -201,10 +203,9 @@ namespace DiscImageChef.Decoders.CD break; } - if((descriptor.CONTROL & (byte)TOC_CONTROL.CopyPermissionMask) == (byte)TOC_CONTROL.CopyPermissionMask) - sb.AppendLine("Digital copy of track is permitted"); - else - sb.AppendLine("Digital copy of track is prohibited"); + if((descriptor.CONTROL & (byte)TOC_CONTROL.CopyPermissionMask) == + (byte)TOC_CONTROL.CopyPermissionMask) sb.AppendLine("Digital copy of track is permitted"); + else sb.AppendLine("Digital copy of track is prohibited"); #if DEBUG if(descriptor.Reserved1 != 0) @@ -226,5 +227,4 @@ namespace DiscImageChef.Decoders.CD return Prettify(decoded); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/CD/TOC.cs b/DiscImageChef.Decoders/CD/TOC.cs index 37f2cb1b..5643382c 100644 --- a/DiscImageChef.Decoders/CD/TOC.cs +++ b/DiscImageChef.Decoders/CD/TOC.cs @@ -111,8 +111,7 @@ namespace DiscImageChef.Decoders.CD public static CDTOC? Decode(byte[] CDTOCResponse) { - if(CDTOCResponse == null) - return null; + if(CDTOCResponse == null) return null; CDTOC decoded = new CDTOC(); @@ -125,7 +124,9 @@ namespace DiscImageChef.Decoders.CD if(decoded.DataLength + 2 != CDTOCResponse.Length) { - DicConsole.DebugWriteLine("CD TOC decoder", "Expected CDTOC size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDTOCResponse.Length); + DicConsole.DebugWriteLine("CD TOC decoder", + "Expected CDTOC size ({0} bytes) is not received size ({1} bytes), not decoding", + decoded.DataLength + 2, CDTOCResponse.Length); return null; } @@ -136,7 +137,8 @@ namespace DiscImageChef.Decoders.CD decoded.TrackDescriptors[i].CONTROL = (byte)(CDTOCResponse[1 + i * 8 + 4] & 0x0F); decoded.TrackDescriptors[i].TrackNumber = CDTOCResponse[2 + i * 8 + 4]; decoded.TrackDescriptors[i].Reserved2 = CDTOCResponse[3 + i * 8 + 4]; - decoded.TrackDescriptors[i].TrackStartAddress = BigEndianBitConverter.ToUInt32(CDTOCResponse, 4 + i * 8 + 4); + decoded.TrackDescriptors[i].TrackStartAddress = + BigEndianBitConverter.ToUInt32(CDTOCResponse, 4 + i * 8 + 4); } return decoded; @@ -144,8 +146,7 @@ namespace DiscImageChef.Decoders.CD public static string Prettify(CDTOC? CDTOCResponse) { - if(CDTOCResponse == null) - return null; + if(CDTOCResponse == null) return null; CDTOC response = CDTOCResponse.Value; @@ -155,14 +156,12 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("Last track number in last complete session: {0}", response.LastTrack).AppendLine(); foreach(CDTOCTrackDataDescriptor descriptor in response.TrackDescriptors) { - if(descriptor.TrackNumber == 0xAA) - sb.AppendLine("Track number: Lead-Out"); - else - sb.AppendFormat("Track number: {0}", descriptor.TrackNumber).AppendLine(); + if(descriptor.TrackNumber == 0xAA) sb.AppendLine("Track number: Lead-Out"); + else sb.AppendFormat("Track number: {0}", descriptor.TrackNumber).AppendLine(); sb.AppendFormat("Track starts at LBA {0}, or MSF {1:X2}:{2:X2}:{3:X2}", descriptor.TrackStartAddress, - (descriptor.TrackStartAddress & 0x0000FF00) >> 8, - (descriptor.TrackStartAddress & 0x00FF0000) >> 16, - (descriptor.TrackStartAddress & 0xFF000000) >> 24).AppendLine(); + (descriptor.TrackStartAddress & 0x0000FF00) >> 8, + (descriptor.TrackStartAddress & 0x00FF0000) >> 16, + (descriptor.TrackStartAddress & 0xFF000000) >> 24).AppendLine(); switch((TOC_ADR)descriptor.ADR) { @@ -212,10 +211,9 @@ namespace DiscImageChef.Decoders.CD break; } - if((descriptor.CONTROL & (byte)TOC_CONTROL.CopyPermissionMask) == (byte)TOC_CONTROL.CopyPermissionMask) - sb.AppendLine("Digital copy of track is permitted"); - else - sb.AppendLine("Digital copy of track is prohibited"); + if((descriptor.CONTROL & (byte)TOC_CONTROL.CopyPermissionMask) == + (byte)TOC_CONTROL.CopyPermissionMask) sb.AppendLine("Digital copy of track is permitted"); + else sb.AppendLine("Digital copy of track is prohibited"); #if DEBUG if(descriptor.Reserved1 != 0) @@ -237,5 +235,4 @@ namespace DiscImageChef.Decoders.CD return Prettify(decoded); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/AACS.cs b/DiscImageChef.Decoders/DVD/AACS.cs index 36f5cb80..6deab609 100644 --- a/DiscImageChef.Decoders/DVD/AACS.cs +++ b/DiscImageChef.Decoders/DVD/AACS.cs @@ -74,5 +74,4 @@ namespace DiscImageChef.Decoders.DVD public byte[] CopyrightInformation; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/ADIP.cs b/DiscImageChef.Decoders/DVD/ADIP.cs index 04de07ee..90aed4b7 100644 --- a/DiscImageChef.Decoders/DVD/ADIP.cs +++ b/DiscImageChef.Decoders/DVD/ADIP.cs @@ -74,5 +74,4 @@ namespace DiscImageChef.Decoders.DVD public byte[] ADIP; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/BCA.cs b/DiscImageChef.Decoders/DVD/BCA.cs index cc9d8217..617f5a42 100644 --- a/DiscImageChef.Decoders/DVD/BCA.cs +++ b/DiscImageChef.Decoders/DVD/BCA.cs @@ -74,5 +74,4 @@ namespace DiscImageChef.Decoders.DVD public byte[] BCA; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/CPRM.cs b/DiscImageChef.Decoders/DVD/CPRM.cs index 944e5797..c3bd3c1f 100644 --- a/DiscImageChef.Decoders/DVD/CPRM.cs +++ b/DiscImageChef.Decoders/DVD/CPRM.cs @@ -98,5 +98,4 @@ namespace DiscImageChef.Decoders.DVD public byte[] MediaKeyBlock; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/CSS&CPRM.cs b/DiscImageChef.Decoders/DVD/CSS&CPRM.cs index fbc1acf4..ceaa61f6 100644 --- a/DiscImageChef.Decoders/DVD/CSS&CPRM.cs +++ b/DiscImageChef.Decoders/DVD/CSS&CPRM.cs @@ -117,11 +117,9 @@ namespace DiscImageChef.Decoders.DVD public static LeadInCopyright? DecodeLeadInCopyright(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 8) - return null; + if(response.Length != 8) return null; LeadInCopyright cmi = new LeadInCopyright(); @@ -138,8 +136,7 @@ namespace DiscImageChef.Decoders.DVD public static string PrettifyLeadInCopyright(LeadInCopyright? cmi) { - if(cmi == null) - return null; + if(cmi == null) return null; LeadInCopyright decoded = cmi.Value; StringBuilder sb = new StringBuilder(); @@ -163,32 +160,21 @@ namespace DiscImageChef.Decoders.DVD break; } - if(decoded.CopyrightType == 0) - return sb.ToString(); + if(decoded.CopyrightType == 0) return sb.ToString(); - if(decoded.RegionInformation == 0xFF) - sb.AppendLine("Disc cannot be played in any region at all."); - else if(decoded.RegionInformation == 0x00) - sb.AppendLine("Disc can be played in any region."); + if(decoded.RegionInformation == 0xFF) sb.AppendLine("Disc cannot be played in any region at all."); + else if(decoded.RegionInformation == 0x00) sb.AppendLine("Disc can be played in any region."); else { sb.Append("Disc can be played in the following regions:"); - if((decoded.RegionInformation & 0x01) != 0x01) - sb.Append(" 0"); - if((decoded.RegionInformation & 0x02) != 0x02) - sb.Append(" 1"); - if((decoded.RegionInformation & 0x04) != 0x04) - sb.Append(" 2"); - if((decoded.RegionInformation & 0x08) != 0x08) - sb.Append(" 3"); - if((decoded.RegionInformation & 0x10) != 0x10) - sb.Append(" 4"); - if((decoded.RegionInformation & 0x20) != 0x20) - sb.Append(" 5"); - if((decoded.RegionInformation & 0x40) != 0x40) - sb.Append(" 6"); - if((decoded.RegionInformation & 0x80) != 0x80) - sb.Append(" 7"); + if((decoded.RegionInformation & 0x01) != 0x01) sb.Append(" 0"); + if((decoded.RegionInformation & 0x02) != 0x02) sb.Append(" 1"); + if((decoded.RegionInformation & 0x04) != 0x04) sb.Append(" 2"); + if((decoded.RegionInformation & 0x08) != 0x08) sb.Append(" 3"); + if((decoded.RegionInformation & 0x10) != 0x10) sb.Append(" 4"); + if((decoded.RegionInformation & 0x20) != 0x20) sb.Append(" 5"); + if((decoded.RegionInformation & 0x40) != 0x40) sb.Append(" 6"); + if((decoded.RegionInformation & 0x80) != 0x80) sb.Append(" 7"); } return sb.ToString(); @@ -199,5 +185,4 @@ namespace DiscImageChef.Decoders.DVD return PrettifyLeadInCopyright(DecodeLeadInCopyright(response)); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/Cartridge.cs b/DiscImageChef.Decoders/DVD/Cartridge.cs index 58c51e71..e228fe77 100644 --- a/DiscImageChef.Decoders/DVD/Cartridge.cs +++ b/DiscImageChef.Decoders/DVD/Cartridge.cs @@ -122,11 +122,9 @@ namespace DiscImageChef.Decoders.DVD public static MediumStatus? Decode(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 8) - return null; + if(response.Length != 8) return null; MediumStatus status = new MediumStatus(); @@ -149,22 +147,18 @@ namespace DiscImageChef.Decoders.DVD public static string Prettify(MediumStatus? status) { - if(status == null) - return null; + if(status == null) return null; MediumStatus decoded = status.Value; StringBuilder sb = new StringBuilder(); - if(decoded.PWP) - sb.AppendLine("Disc surface is set to write protected status"); + if(decoded.PWP) sb.AppendLine("Disc surface is set to write protected status"); if(decoded.Cartridge) { sb.AppendLine("Disc comes in a cartridge"); - if(decoded.OUT) - sb.AppendLine("Disc has been extracted from the cartridge"); - if(decoded.CWP) - sb.AppendLine("Cartridge is set to write protected"); + if(decoded.OUT) sb.AppendLine("Disc has been extracted from the cartridge"); + if(decoded.CWP) sb.AppendLine("Cartridge is set to write protected"); } switch(decoded.DiscType) @@ -184,8 +178,7 @@ namespace DiscImageChef.Decoders.DVD { switch(decoded.RAMSWI) { - case 0: - break; + case 0: break; case 1: sb.AppendLine("Disc is write inhibited because it has been extracted from the cartridge"); break; @@ -193,7 +186,8 @@ namespace DiscImageChef.Decoders.DVD sb.AppendLine("Disc is write inhibited for an unspecified reason"); break; default: - sb.AppendFormat("Disc has unknown reason {0} for write inhibition", decoded.RAMSWI).AppendLine(); + sb.AppendFormat("Disc has unknown reason {0} for write inhibition", decoded.RAMSWI) + .AppendLine(); break; } } @@ -206,5 +200,4 @@ namespace DiscImageChef.Decoders.DVD return Prettify(Decode(response)); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/DDS.cs b/DiscImageChef.Decoders/DVD/DDS.cs index fa76580a..120887e8 100644 --- a/DiscImageChef.Decoders/DVD/DDS.cs +++ b/DiscImageChef.Decoders/DVD/DDS.cs @@ -196,18 +196,15 @@ namespace DiscImageChef.Decoders.DVD public static DiscDefinitionStructure? Decode(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 2052) - return null; + if(response.Length != 2052) return null; DiscDefinitionStructure dds = new DiscDefinitionStructure(); dds.Identifier = (ushort)((response[4] << 8) + response[5]); - if(dds.Identifier != 0x0A0A) - return null; + if(dds.Identifier != 0x0A0A) return null; // Common to both DVD-RAM versions dds.DataLength = (ushort)((response[0] << 8) + response[1]); @@ -252,7 +249,8 @@ namespace DiscImageChef.Decoders.DVD dds.StartLSNForZone = new uint[dds.Zones]; for(int i = 0; i < dds.Zones; i++) - dds.StartLSNForZone[i] = (uint)((response[260 + i * 4 + 1] << 16) + (response[260 + i * 4 + 2] << 8) + response[260 + i * 4 + 3]); + dds.StartLSNForZone[i] = (uint)((response[260 + i * 4 + 1] << 16) + + (response[260 + i * 4 + 2] << 8) + response[260 + i * 4 + 3]); } return dds; @@ -260,8 +258,7 @@ namespace DiscImageChef.Decoders.DVD public static string Prettify(DiscDefinitionStructure? dds) { - if(dds == null) - return null; + if(dds == null) return null; DiscDefinitionStructure decoded = dds.Value; StringBuilder sb = new StringBuilder(); @@ -271,17 +268,13 @@ namespace DiscImageChef.Decoders.DVD sb.AppendLine("Formatting in progress."); if(decoded.Groups == 24) { - if(decoded.PartialCertification) - sb.AppendLine("Formatting is only using partial certification"); - if(decoded.FormattingOnlyAGroup) - sb.AppendLine("Only a group is being formatted"); + if(decoded.PartialCertification) sb.AppendLine("Formatting is only using partial certification"); + if(decoded.FormattingOnlyAGroup) sb.AppendLine("Only a group is being formatted"); } } - if(decoded.UserCertification) - sb.AppendLine("Disc has been certified by an user"); - if(decoded.ManufacturerCertification) - sb.AppendLine("Disc has been certified by a manufacturer"); + if(decoded.UserCertification) sb.AppendLine("Disc has been certified by an user"); + if(decoded.ManufacturerCertification) sb.AppendLine("Disc has been certified by a manufacturer"); sb.AppendFormat("DDS has been updated {0} times", decoded.UpdateCount).AppendLine(); @@ -303,7 +296,8 @@ namespace DiscImageChef.Decoders.DVD if(decoded.Groups == 1) { sb.AppendFormat("Disc has {0} zones", decoded.Zones).AppendLine(); - sb.AppendFormat("Primary Spare Area stats at PSN {0:X}h and ends at PSN {1:X}h, inclusively", decoded.SpareAreaFirstPSN, decoded.SpareAreaLastPSN).AppendLine(); + sb.AppendFormat("Primary Spare Area stats at PSN {0:X}h and ends at PSN {1:X}h, inclusively", + decoded.SpareAreaFirstPSN, decoded.SpareAreaLastPSN).AppendLine(); sb.AppendFormat("LSN 0 is at PSN {0:X}h", decoded.LSN0Location).AppendLine(); for(int i = 0; i < decoded.StartLSNForZone.Length; i++) @@ -318,5 +312,4 @@ namespace DiscImageChef.Decoders.DVD return Prettify(Decode(response)); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/DMI.cs b/DiscImageChef.Decoders/DVD/DMI.cs index f9ac62e0..4b43af82 100644 --- a/DiscImageChef.Decoders/DVD/DMI.cs +++ b/DiscImageChef.Decoders/DVD/DMI.cs @@ -74,5 +74,4 @@ namespace DiscImageChef.Decoders.DVD public byte[] DMI; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/Enums.cs b/DiscImageChef.Decoders/DVD/Enums.cs index 27005f12..d486a46e 100644 --- a/DiscImageChef.Decoders/DVD/Enums.cs +++ b/DiscImageChef.Decoders/DVD/Enums.cs @@ -260,5 +260,4 @@ namespace DiscImageChef.Decoders.DVD Twelve = 0x50 } #endregion -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/Layers.cs b/DiscImageChef.Decoders/DVD/Layers.cs index e763f3c3..9e9fe57a 100644 --- a/DiscImageChef.Decoders/DVD/Layers.cs +++ b/DiscImageChef.Decoders/DVD/Layers.cs @@ -236,5 +236,4 @@ namespace DiscImageChef.Decoders.DVD public uint LBA; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/PFI.cs b/DiscImageChef.Decoders/DVD/PFI.cs index 44cea06f..fae1214b 100644 --- a/DiscImageChef.Decoders/DVD/PFI.cs +++ b/DiscImageChef.Decoders/DVD/PFI.cs @@ -1049,11 +1049,9 @@ namespace DiscImageChef.Decoders.DVD public static PhysicalFormatInformation? Decode(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length < 2052) - return null; + if(response.Length < 2052) return null; PhysicalFormatInformation pfi = new PhysicalFormatInformation(); byte[] tmp; @@ -1073,8 +1071,10 @@ namespace DiscImageChef.Decoders.DVD pfi.LayerType = (LayerTypeFieldMask)(response[6] & 0x07); pfi.LinearDensity = (LinearDensityField)((response[7] & 0xF0) >> 4); pfi.TrackDensity = (TrackDensityField)(response[7] & 0x0F); - pfi.DataAreaStartPSN = (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]); - pfi.DataAreaEndPSN = (uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]); + pfi.DataAreaStartPSN = + (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]); + pfi.DataAreaEndPSN = + (uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]); pfi.Layer0EndPSN = (uint)((response[16] << 24) + (response[17] << 16) + (response[18] << 8) + response[19]); pfi.BCA |= (response[20] & 0x80) == 0x80; @@ -1182,13 +1182,13 @@ namespace DiscImageChef.Decoders.DVD } // DVD-R and DVD-RW - if((pfi.DiskCategory == DiskCategory.DVDR && - pfi.PartVersion < 6) || - (pfi.DiskCategory == DiskCategory.DVDRW && - pfi.PartVersion < 3)) + if((pfi.DiskCategory == DiskCategory.DVDR && pfi.PartVersion < 6) || + (pfi.DiskCategory == DiskCategory.DVDRW && pfi.PartVersion < 3)) { - pfi.CurrentBorderOutSector = (uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]); - pfi.NextBorderInSector = (uint)((response[40] << 24) + (response[41] << 16) + (response[42] << 8) + response[43]); + pfi.CurrentBorderOutSector = + (uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]); + pfi.NextBorderInSector = + (uint)((response[40] << 24) + (response[41] << 16) + (response[42] << 8) + response[43]); } // DVD+RW @@ -1216,10 +1216,8 @@ namespace DiscImageChef.Decoders.DVD } // DVD+R, DVD+RW, DVD+R DL and DVD+RW DL - if(pfi.DiskCategory == DiskCategory.DVDPR || - pfi.DiskCategory == DiskCategory.DVDPRW || - pfi.DiskCategory == DiskCategory.DVDPRDL || - pfi.DiskCategory == DiskCategory.DVDPRWDL) + if(pfi.DiskCategory == DiskCategory.DVDPR || pfi.DiskCategory == DiskCategory.DVDPRW || + pfi.DiskCategory == DiskCategory.DVDPRDL || pfi.DiskCategory == DiskCategory.DVDPRWDL) { pfi.VCPS |= (response[20] & 0x40) == 0x40; pfi.ApplicationCode = response[21]; @@ -1230,13 +1228,13 @@ namespace DiscImageChef.Decoders.DVD tmp = new byte[3]; Array.Copy(response, 31, tmp, 0, 3); pfi.MediaTypeID = StringHandlers.CToString(tmp); - pfi.ProductRevision = pfi.DiskCategory == DiskCategory.DVDPRDL ? (byte)(response[34] & 0x3F) : response[34]; + pfi.ProductRevision = + pfi.DiskCategory == DiskCategory.DVDPRDL ? (byte)(response[34] & 0x3F) : response[34]; pfi.PFIUsedInADIP = response[35]; } // DVD+RW - if(pfi.DiskCategory == DiskCategory.DVDPRW && - pfi.PartVersion == 2) + if(pfi.DiskCategory == DiskCategory.DVDPRW && pfi.PartVersion == 2) { pfi.TopFirstPulseDuration = response[55]; pfi.MultiPulseDuration = response[56]; @@ -1246,8 +1244,7 @@ namespace DiscImageChef.Decoders.DVD } // DVD+R and DVD+R DL - if(pfi.DiskCategory == DiskCategory.DVDPR || - pfi.DiskCategory == DiskCategory.DVDPRDL) + if(pfi.DiskCategory == DiskCategory.DVDPR || pfi.DiskCategory == DiskCategory.DVDPRDL) { pfi.PrimaryVelocity = response[36]; pfi.UpperVelocity = response[37]; @@ -1305,10 +1302,8 @@ namespace DiscImageChef.Decoders.DVD } // DVD-R DL and DVD-RW DL - if((pfi.DiskCategory == DiskCategory.DVDR && - pfi.PartVersion == 6) || - (pfi.DiskCategory == DiskCategory.DVDRW && - pfi.PartVersion == 3)) + if((pfi.DiskCategory == DiskCategory.DVDR && pfi.PartVersion == 6) || + (pfi.DiskCategory == DiskCategory.DVDRW && pfi.PartVersion == 3)) { pfi.MaxRecordingSpeed = (DVDRecordingSpeed)response[21]; pfi.MinRecordingSpeed = (DVDRecordingSpeed)response[22]; @@ -1321,8 +1316,10 @@ namespace DiscImageChef.Decoders.DVD pfi.RecordingSpeed7 = (DVDRecordingSpeed)response[29]; pfi.Class = response[30]; pfi.ExtendedVersion = response[31]; - pfi.CurrentBorderOutSector = (uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]); - pfi.NextBorderInSector = (uint)((response[40] << 24) + (response[41] << 16) + (response[42] << 8) + response[43]); + pfi.CurrentBorderOutSector = + (uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]); + pfi.NextBorderInSector = + (uint)((response[40] << 24) + (response[41] << 16) + (response[42] << 8) + response[43]); pfi.PreRecordedControlDataInv |= (response[44] & 0x01) == 0x01; pfi.PreRecordedLeadIn |= (response[44] & 0x02) == 0x02; pfi.PreRecordedLeadOut |= (response[44] & 0x08) == 0x08; @@ -1335,8 +1332,7 @@ namespace DiscImageChef.Decoders.DVD public static string Prettify(PhysicalFormatInformation? pfi) { - if(pfi == null) - return null; + if(pfi == null) return null; PhysicalFormatInformation decoded = pfi.Value; StringBuilder sb = new StringBuilder(); @@ -1377,12 +1373,12 @@ namespace DiscImageChef.Decoders.DVD sb.AppendLine("Disc claims conformation to ECMA-330"); break; } + break; case DiskCategory.DVDR: if(decoded.PartVersion >= 6) sb.AppendFormat(categorySentence, sizeString, "DVD-R DL", decoded.PartVersion).AppendLine(); - else - sb.AppendFormat(categorySentence, sizeString, "DVD-R", decoded.PartVersion).AppendLine(); + else sb.AppendFormat(categorySentence, sizeString, "DVD-R", decoded.PartVersion).AppendLine(); switch(decoded.PartVersion) { case 1: @@ -1395,12 +1391,12 @@ namespace DiscImageChef.Decoders.DVD sb.AppendLine("Disc claims conformation to ECMA-382"); break; } + break; case DiskCategory.DVDRW: if(decoded.PartVersion >= 3) sb.AppendFormat(categorySentence, sizeString, "DVD-RW DL", decoded.PartVersion).AppendLine(); - else - sb.AppendFormat(categorySentence, sizeString, "DVD-RW", decoded.PartVersion).AppendLine(); + else sb.AppendFormat(categorySentence, sizeString, "DVD-RW", decoded.PartVersion).AppendLine(); switch(decoded.PartVersion) { case 2: @@ -1410,18 +1406,19 @@ namespace DiscImageChef.Decoders.DVD sb.AppendLine("Disc claims conformation to ECMA-384"); break; } + break; case DiskCategory.UMD: if(decoded.DiscSize == DVDSize.OneTwenty) sb.AppendFormat(categorySentence, "60mm", "UMD", decoded.PartVersion).AppendLine(); - else - sb.AppendFormat(categorySentence, "invalid size", "UMD", decoded.PartVersion).AppendLine(); + else sb.AppendFormat(categorySentence, "invalid size", "UMD", decoded.PartVersion).AppendLine(); switch(decoded.PartVersion) { case 0: sb.AppendLine("Disc claims conformation to ECMA-365"); break; } + break; case DiskCategory.DVDPRW: sb.AppendFormat(categorySentence, sizeString, "DVD+RW", decoded.PartVersion).AppendLine(); @@ -1437,6 +1434,7 @@ namespace DiscImageChef.Decoders.DVD sb.AppendLine("Disc claims conformation to ECMA-371"); break; } + break; case DiskCategory.DVDPR: sb.AppendFormat(categorySentence, sizeString, "DVD+R", decoded.PartVersion).AppendLine(); @@ -1446,6 +1444,7 @@ namespace DiscImageChef.Decoders.DVD sb.AppendLine("Disc claims conformation to ECMA-349"); break; } + break; case DiskCategory.DVDPRWDL: sb.AppendFormat(categorySentence, sizeString, "DVD+RW DL", decoded.PartVersion).AppendLine(); @@ -1455,6 +1454,7 @@ namespace DiscImageChef.Decoders.DVD sb.AppendLine("Disc claims conformation to ECMA-374"); break; } + break; case DiskCategory.DVDPRDL: sb.AppendFormat(categorySentence, sizeString, "DVD+R DL", decoded.PartVersion).AppendLine(); @@ -1464,6 +1464,7 @@ namespace DiscImageChef.Decoders.DVD sb.AppendLine("Disc claims conformation to ECMA-364"); break; } + break; case DiskCategory.Nintendo: if(decoded.PartVersion == 15) @@ -1472,11 +1473,9 @@ namespace DiscImageChef.Decoders.DVD sb.AppendLine("Disc is a Nintendo Gamecube Optical Disc (GOD)"); else if(decoded.DiscSize == DVDSize.OneTwenty) sb.AppendLine("Disc is a Nintendo Wii Optical Disc (WOD)"); - else - goto default; + else goto default; } - else - goto default; + else goto default; break; case DiskCategory.HDDVDROM: sb.AppendFormat(categorySentence, sizeString, "HD DVD-ROM", decoded.PartVersion).AppendLine(); @@ -1491,7 +1490,8 @@ namespace DiscImageChef.Decoders.DVD sb.AppendFormat(categorySentence, sizeString, "HD DVD-RW", decoded.PartVersion).AppendLine(); break; default: - sb.AppendFormat(categorySentence, sizeString, "unknown disc type", decoded.PartVersion).AppendLine(); + sb.AppendFormat(categorySentence, sizeString, "unknown disc type", decoded.PartVersion) + .AppendLine(); break; } @@ -1516,15 +1516,14 @@ namespace DiscImageChef.Decoders.DVD sb.AppendLine("Disc maximum transfer rate is unspecified."); break; default: - sb.AppendFormat("Disc maximum transfer rate is specified by unknown key {0}", decoded.MaximumRate).AppendLine(); + sb.AppendFormat("Disc maximum transfer rate is specified by unknown key {0}", decoded.MaximumRate) + .AppendLine(); break; } sb.AppendFormat("Disc has {0} layers", decoded.Layers + 1).AppendLine(); - if(decoded.TrackPath && decoded.Layers == 1) - sb.AppendLine("Layers are in parallel track path"); - else if(!decoded.TrackPath && decoded.Layers == 1) - sb.AppendLine("Layers are in opposite track path"); + if(decoded.TrackPath && decoded.Layers == 1) sb.AppendLine("Layers are in parallel track path"); + else if(!decoded.TrackPath && decoded.Layers == 1) sb.AppendLine("Layers are in opposite track path"); switch(decoded.LinearDensity) { @@ -1585,14 +1584,11 @@ namespace DiscImageChef.Decoders.DVD if(decoded.Layers == 1 && !decoded.TrackPath) sb.AppendFormat("Layer 0 ends at PSN {0:X}h", decoded.Layer0EndPSN).AppendLine(); } - else - sb.AppendLine("Disc is empty"); + else sb.AppendLine("Disc is empty"); } - else - sb.AppendLine("Disc is empty"); + else sb.AppendLine("Disc is empty"); - if(decoded.BCA) - sb.AppendLine("Disc has a burst cutting area"); + if(decoded.BCA) sb.AppendLine("Disc has a burst cutting area"); if(decoded.DiskCategory == DiskCategory.UMD) sb.AppendFormat("Media attribute is {0}", decoded.MediaAttribute).AppendLine(); @@ -1615,45 +1611,39 @@ namespace DiscImageChef.Decoders.DVD if(decoded.PartVersion == 6) { sb.AppendFormat("Disc manufacturer is {0}", decoded.DiskManufacturer).AppendLine(); - sb.AppendFormat("Disc manufacturer supplementary information is {0}", decoded.DiskManufacturerSupplementary).AppendLine(); + sb.AppendFormat("Disc manufacturer supplementary information is {0}", + decoded.DiskManufacturerSupplementary).AppendLine(); } } - if((decoded.DiskCategory == DiskCategory.DVDR && - decoded.PartVersion < 6) || - (decoded.DiskCategory == DiskCategory.DVDRW && - decoded.PartVersion < 3)) + if((decoded.DiskCategory == DiskCategory.DVDR && decoded.PartVersion < 6) || + (decoded.DiskCategory == DiskCategory.DVDRW && decoded.PartVersion < 3)) { - sb.AppendFormat("Current Border-Out first sector is PSN {0:X}h", decoded.CurrentBorderOutSector).AppendLine(); + sb.AppendFormat("Current Border-Out first sector is PSN {0:X}h", decoded.CurrentBorderOutSector) + .AppendLine(); sb.AppendFormat("Next Border-In first sector is PSN {0:X}h", decoded.NextBorderInSector).AppendLine(); } - if(decoded.DiskCategory == DiskCategory.DVDPR || - decoded.DiskCategory == DiskCategory.DVDPRW || - decoded.DiskCategory == DiskCategory.DVDPRDL || - decoded.DiskCategory == DiskCategory.DVDPRWDL) + if(decoded.DiskCategory == DiskCategory.DVDPR || decoded.DiskCategory == DiskCategory.DVDPRW || + decoded.DiskCategory == DiskCategory.DVDPRDL || decoded.DiskCategory == DiskCategory.DVDPRWDL) { - if(decoded.VCPS) - sb.AppendLine("Disc contains extended information for VCPS"); + if(decoded.VCPS) sb.AppendLine("Disc contains extended information for VCPS"); sb.AppendFormat("Disc application code is {0}", decoded.ApplicationCode).AppendLine(); sb.AppendFormat("Disc manufacturer is {0}", decoded.DiskManufacturerID).AppendLine(); sb.AppendFormat("Disc media type is {0}", decoded.MediaTypeID).AppendLine(); sb.AppendFormat("Disc product revision is {0}", decoded.ProductRevision).AppendLine(); } - if((decoded.DiskCategory == DiskCategory.DVDR && - decoded.PartVersion >= 6) || - (decoded.DiskCategory == DiskCategory.DVDRW && - decoded.PartVersion >= 3)) + if((decoded.DiskCategory == DiskCategory.DVDR && decoded.PartVersion >= 6) || + (decoded.DiskCategory == DiskCategory.DVDRW && decoded.PartVersion >= 3)) { - sb.AppendFormat("Current RMD in extra Border zone starts at PSN {0:X}h", decoded.CurrentRMDExtraBorderPSN).AppendLine(); - sb.AppendFormat("PFI in extra Border zone starts at PSN {0:X}h", decoded.PFIExtraBorderPSN).AppendLine(); - if(!decoded.PreRecordedControlDataInv) - sb.AppendLine("Control Data Zone is pre-recorded"); - if(decoded.PreRecordedLeadIn) - sb.AppendLine("Lead-In is pre-recorded"); - if(decoded.PreRecordedLeadOut) - sb.AppendLine("Lead-Out is pre-recorded"); + sb.AppendFormat("Current RMD in extra Border zone starts at PSN {0:X}h", + decoded.CurrentRMDExtraBorderPSN).AppendLine(); + sb.AppendFormat("PFI in extra Border zone starts at PSN {0:X}h", decoded.PFIExtraBorderPSN) + .AppendLine(); + if(!decoded.PreRecordedControlDataInv) sb.AppendLine("Control Data Zone is pre-recorded"); + if(decoded.PreRecordedLeadIn) sb.AppendLine("Lead-In is pre-recorded"); + if(decoded.PreRecordedLeadOut) sb.AppendLine("Lead-Out is pre-recorded"); } return sb.ToString(); @@ -1664,5 +1654,4 @@ namespace DiscImageChef.Decoders.DVD return Prettify(Decode(response)); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/PRI.cs b/DiscImageChef.Decoders/DVD/PRI.cs index c11f1305..632f092a 100644 --- a/DiscImageChef.Decoders/DVD/PRI.cs +++ b/DiscImageChef.Decoders/DVD/PRI.cs @@ -74,5 +74,4 @@ namespace DiscImageChef.Decoders.DVD public byte[] PRI; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/RMD.cs b/DiscImageChef.Decoders/DVD/RMD.cs index 144df73f..a57d1d92 100644 --- a/DiscImageChef.Decoders/DVD/RMD.cs +++ b/DiscImageChef.Decoders/DVD/RMD.cs @@ -113,5 +113,4 @@ namespace DiscImageChef.Decoders.DVD public ushort CurrentRemainingRMDs; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/Spare.cs b/DiscImageChef.Decoders/DVD/Spare.cs index 5295472c..74a91aa0 100644 --- a/DiscImageChef.Decoders/DVD/Spare.cs +++ b/DiscImageChef.Decoders/DVD/Spare.cs @@ -87,35 +87,36 @@ namespace DiscImageChef.Decoders.DVD public static SpareAreaInformation? Decode(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 16) - return null; + if(response.Length != 16) return null; SpareAreaInformation sai = new SpareAreaInformation(); sai.DataLength = (ushort)((response[0] << 8) + response[1]); sai.Reserved1 = response[2]; sai.Reserved2 = response[3]; - sai.UnusedPrimaryBlocks = (uint)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]); - sai.UnusedSupplementaryBlocks = (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]); - sai.AllocatedSupplementaryBlocks = (uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]); + sai.UnusedPrimaryBlocks = + (uint)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]); + sai.UnusedSupplementaryBlocks = + (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]); + sai.AllocatedSupplementaryBlocks = + (uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]); return sai; } public static string Prettify(SpareAreaInformation? sai) { - if(sai == null) - return null; + if(sai == null) return null; SpareAreaInformation decoded = sai.Value; StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0} unused primary spare blocks", decoded.UnusedPrimaryBlocks).AppendLine(); sb.AppendFormat("{0} unused supplementary spare blocks", decoded.UnusedSupplementaryBlocks).AppendLine(); - sb.AppendFormat("{0} allocated supplementary spare blocks", decoded.AllocatedSupplementaryBlocks).AppendLine(); + sb.AppendFormat("{0} allocated supplementary spare blocks", decoded.AllocatedSupplementaryBlocks) + .AppendLine(); return sb.ToString(); } @@ -125,5 +126,4 @@ namespace DiscImageChef.Decoders.DVD return Prettify(Decode(response)); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/DVD/UDI.cs b/DiscImageChef.Decoders/DVD/UDI.cs index bcddf21b..3a51ea02 100644 --- a/DiscImageChef.Decoders/DVD/UDI.cs +++ b/DiscImageChef.Decoders/DVD/UDI.cs @@ -114,5 +114,4 @@ namespace DiscImageChef.Decoders.DVD public ushort Second; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Floppy/Amiga.cs b/DiscImageChef.Decoders/Floppy/Amiga.cs index 5259bf0b..3c632336 100644 --- a/DiscImageChef.Decoders/Floppy/Amiga.cs +++ b/DiscImageChef.Decoders/Floppy/Amiga.cs @@ -44,13 +44,11 @@ namespace DiscImageChef.Decoders.Floppy /// /// Set to 0x00 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] zero; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] zero; /// /// Set to 0xA1 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] sync; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] sync; /// /// Set to 0xFF /// @@ -70,8 +68,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// OS dependent tag /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] label; /// /// Checksum from to /// @@ -80,9 +77,7 @@ namespace DiscImageChef.Decoders.Floppy /// Checksum from /// public uint dataChecksum; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] - public byte[] data; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] data; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Floppy/Apple2.cs b/DiscImageChef.Decoders/Floppy/Apple2.cs index 4b1dc967..7f3831e5 100644 --- a/DiscImageChef.Decoders/Floppy/Apple2.cs +++ b/DiscImageChef.Decoders/Floppy/Apple2.cs @@ -86,41 +86,35 @@ namespace DiscImageChef.Decoders.Floppy /// /// Always 0xD5, 0xAA, 0x96 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] prologue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue; /// /// Volume number encoded as: /// volume[0] = (decodedVolume >> 1) | 0xAA /// volume[1] = decodedVolume | 0xAA /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] volume; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] volume; /// /// Track number encoded as: /// track[0] = (decodedTrack >> 1) | 0xAA /// track[1] = decodedTrack | 0xAA /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] track; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] track; /// /// Sector number encoded as: /// sector[0] = (decodedSector >> 1) | 0xAA /// sector[1] = decodedSector | 0xAA /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] sector; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] sector; /// /// decodedChecksum = decodedVolume ^ decodedTrack ^ decodedSector /// checksum[0] = (decodedChecksum >> 1) | 0xAA /// checksum[1] = decodedChecksum | 0xAA /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] checksum; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] checksum; /// /// Always 0xDE, 0xAA, 0xEB /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] epilogue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] epilogue; } /// @@ -131,8 +125,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Always 0xD5, 0xAA, 0xAD /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] prologue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue; /// /// Encoded data bytes. /// 410 bytes for 5to3 (aka DOS 3.2) format @@ -143,8 +136,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Always 0xDE, 0xAA, 0xEB /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] epilogue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] epilogue; } static readonly byte[] ReadTable5and3 = @@ -225,8 +217,7 @@ namespace DiscImageChef.Decoders.Floppy /// 5and3 encoded data. public static byte[] Decode5and3(byte[] data) { - if(data == null || data.Length != 410) - return null; + if(data == null || data.Length != 410) return null; byte[] buffer = new byte[data.Length]; byte carry = 0; @@ -250,6 +241,7 @@ namespace DiscImageChef.Decoders.Floppy output[253 - 5 * i] = (byte)(((buffer[i + 51 * 6 + 1] << 3) | b4) & 0xFF); output[254 - 5 * i] = (byte)(((buffer[i + 51 * 7 + 1] << 3) | b5) & 0xFF); } + output[255] = (byte)(((buffer[409] << 3) | (buffer[0] & 0x7)) & 0xFF); return output; @@ -261,8 +253,7 @@ namespace DiscImageChef.Decoders.Floppy /// 6and2 encoded data. public static byte[] Decode6and2(byte[] data) { - if(data == null || data.Length != 342) - return null; + if(data == null || data.Length != 342) return null; byte[] buffer = new byte[data.Length]; byte carry = 0; @@ -299,15 +290,12 @@ namespace DiscImageChef.Decoders.Floppy public static byte[] DecodeSector(RawSector sector) { - if(sector.addressField.prologue[0] == 0xD5 && - sector.addressField.prologue[1] == 0xAA) + if(sector.addressField.prologue[0] == 0xD5 && sector.addressField.prologue[1] == 0xAA) { // Pre DOS 3.3 - if(sector.addressField.prologue[2] == 0xB5) - return Decode5and3(sector.dataField.data); + if(sector.addressField.prologue[2] == 0xB5) return Decode5and3(sector.dataField.data); // DOS 3.3 - if(sector.addressField.prologue[2] == 0x96) - return Decode6and2(sector.dataField.data); + if(sector.addressField.prologue[2] == 0x96) return Decode6and2(sector.dataField.data); // Unknown return null; } @@ -327,8 +315,7 @@ namespace DiscImageChef.Decoders.Floppy endOffset = offset; // Not an Apple ][ GCR sector - if(data == null || data.Length < 363) - return null; + if(data == null || data.Length < 363) return null; RawSector sector; int position = offset; @@ -346,8 +333,7 @@ namespace DiscImageChef.Decoders.Floppy DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Prologue found at {0}", position); // Epilogue not in correct position - if(data[position + 11] != 0xDE || data[position + 12] != 0xAA) - return null; + if(data[position + 11] != 0xDE || data[position + 12] != 0xAA) return null; sector = new RawSector(); sector.addressField = new RawAddressField(); @@ -372,11 +358,21 @@ namespace DiscImageChef.Decoders.Floppy sector.addressField.epilogue[1] = data[position + 12]; sector.addressField.epilogue[2] = data[position + 13]; - DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Volume {0}", (((sector.addressField.volume[0] & 0x55) << 1) | (sector.addressField.volume[1] & 0x55)) & 0xFF); - DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Track {0}", (((sector.addressField.track[0] & 0x55) << 1) | (sector.addressField.track[1] & 0x55)) & 0xFF); - DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Sector {0}", (((sector.addressField.sector[0] & 0x55) << 1) | (sector.addressField.sector[1] & 0x55)) & 0xFF); - DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Checksum {0}", (((sector.addressField.checksum[0] & 0x55) << 1) | (sector.addressField.checksum[1] & 0x55)) & 0xFF); - DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Epilogue {0:X2}{1:X2}{2:X2}", sector.addressField.epilogue[0], sector.addressField.epilogue[1], sector.addressField.epilogue[2]); + DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Volume {0}", + (((sector.addressField.volume[0] & 0x55) << 1) | + (sector.addressField.volume[1] & 0x55)) & 0xFF); + DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Track {0}", + (((sector.addressField.track[0] & 0x55) << 1) | + (sector.addressField.track[1] & 0x55)) & 0xFF); + DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Sector {0}", + (((sector.addressField.sector[0] & 0x55) << 1) | + (sector.addressField.sector[1] & 0x55)) & 0xFF); + DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Checksum {0}", + (((sector.addressField.checksum[0] & 0x55) << 1) | + (sector.addressField.checksum[1] & 0x55)) & 0xFF); + DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Epilogue {0:X2}{1:X2}{2:X2}", + sector.addressField.epilogue[0], sector.addressField.epilogue[1], + sector.addressField.epilogue[2]); position += 14; syncCount = 0; @@ -392,17 +388,16 @@ namespace DiscImageChef.Decoders.Floppy } // Lost sync - if(!onSync) - return null; + if(!onSync) return null; // Prologue not found - if(data[position] != 0xD5 || data[position + 1] != 0xAA) - return null; + if(data[position] != 0xD5 || data[position + 1] != 0xAA) return null; sector.innerGap = gaps.ToArray(); sector.dataField = new RawDataField(); - DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Inner gap has {0} bytes", sector.innerGap.Length); + DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Inner gap has {0} bytes", + sector.innerGap.Length); DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Prologue found at {0}", position); sector.dataField.prologue = new byte[3]; sector.dataField.prologue[0] = data[position]; @@ -418,12 +413,12 @@ namespace DiscImageChef.Decoders.Floppy position++; // No space left for epilogue - if(position + 4 > data.Length) - return null; + if(position + 4 > data.Length) return null; } sector.dataField.data = gaps.ToArray(); - DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Data has {0} bytes", sector.dataField.data.Length); + DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Data has {0} bytes", + sector.dataField.data.Length); sector.dataField.checksum = data[position]; sector.dataField.epilogue = new byte[3]; sector.dataField.epilogue[0] = data[position + 1]; @@ -454,25 +449,19 @@ namespace DiscImageChef.Decoders.Floppy return sector; } - if(data[position] == 0xFF) - position++; + if(data[position] == 0xFF) position++; // Found data that is not sync or a prologue - else - return null; + else return null; } } - catch(IndexOutOfRangeException) - { - return null; - } + catch(IndexOutOfRangeException) { return null; } return null; } public static byte[] MarshalAddressField(RawAddressField addressField) { - if(addressField == null) - return null; + if(addressField == null) return null; MemoryStream raw = new MemoryStream(); raw.Write(addressField.prologue, 0, addressField.prologue.Length); @@ -487,8 +476,7 @@ namespace DiscImageChef.Decoders.Floppy public static byte[] MarshalSector(RawSector sector) { - if(sector == null) - return null; + if(sector == null) return null; MemoryStream raw = new MemoryStream(); raw.Write(sector.addressField.prologue, 0, sector.addressField.prologue.Length); @@ -532,18 +520,15 @@ namespace DiscImageChef.Decoders.Floppy onSync = count >= 5; } - if(position >= data.Length) - return null; + if(position >= data.Length) return null; - if(!onSync) - return null; + if(!onSync) return null; while(position < data.Length) { int oldPosition = position; RawSector sector = MarshalSector(data, out position, position); - if(sector == null) - break; + if(sector == null) break; if(firstSector) { @@ -552,19 +537,21 @@ namespace DiscImageChef.Decoders.Floppy firstSector = false; } - if(sector.addressField.track[0] != trackNumber[0] || - sector.addressField.track[1] != trackNumber[1]) + if(sector.addressField.track[0] != trackNumber[0] || sector.addressField.track[1] != trackNumber[1]) { position = oldPosition; break; } - DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Adding sector {0} of track {1}", (((sector.addressField.sector[0] & 0x55) << 1) | (sector.addressField.sector[1] & 0x55)) & 0xFF, (((sector.addressField.track[0] & 0x55) << 1) | (sector.addressField.track[1] & 0x55)) & 0xFF); + DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Adding sector {0} of track {1}", + (((sector.addressField.sector[0] & 0x55) << 1) | + (sector.addressField.sector[1] & 0x55)) & 0xFF, + (((sector.addressField.track[0] & 0x55) << 1) | + (sector.addressField.track[1] & 0x55)) & 0xFF); sectors.Add(sector); } - if(sectors.Count == 0) - return null; + if(sectors.Count == 0) return null; RawTrack track = new RawTrack(); track.gap = gaps.ToArray(); @@ -575,8 +562,7 @@ namespace DiscImageChef.Decoders.Floppy public static byte[] MarshalTrack(RawTrack track) { - if(track == null) - return null; + if(track == null) return null; MemoryStream raw = new MemoryStream(); raw.Write(track.gap, 0, track.gap.Length); @@ -585,6 +571,7 @@ namespace DiscImageChef.Decoders.Floppy byte[] rawSector = MarshalSector(sector); raw.Write(rawSector, 0, rawSector.Length); } + return raw.ToArray(); } @@ -607,8 +594,7 @@ namespace DiscImageChef.Decoders.Floppy track = MarshalTrack(data, out position, position); } - if(tracks.Count == 0) - return null; + if(tracks.Count == 0) return null; endOffset = position; return tracks; @@ -621,8 +607,7 @@ namespace DiscImageChef.Decoders.Floppy public static byte[] MarshalDisk(RawTrack[] disk) { - if(disk == null) - return null; + if(disk == null) return null; MemoryStream raw = new MemoryStream(); foreach(RawTrack track in disk) @@ -630,6 +615,7 @@ namespace DiscImageChef.Decoders.Floppy byte[] rawTrack = MarshalTrack(track); raw.Write(rawTrack, 0, rawTrack.Length); } + return raw.ToArray(); } @@ -641,5 +627,4 @@ namespace DiscImageChef.Decoders.Floppy return sector != null && position != 0; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Floppy/AppleSony.cs b/DiscImageChef.Decoders/Floppy/AppleSony.cs index cce2dc9a..ae3c59cf 100644 --- a/DiscImageChef.Decoders/Floppy/AppleSony.cs +++ b/DiscImageChef.Decoders/Floppy/AppleSony.cs @@ -88,8 +88,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Always 0xD5, 0xAA, 0x96 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] prologue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue; /// /// Encoded (decodedTrack & 0x3F) /// @@ -113,8 +112,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Always 0xDE, 0xAA /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] epilogue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] epilogue; } /// @@ -125,8 +123,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Always 0xD5, 0xAA, 0xAD /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] prologue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue; /// /// Spare, usually /// @@ -134,24 +131,20 @@ namespace DiscImageChef.Decoders.Floppy /// /// Encoded data bytes. /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 698)] - public byte[] data; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 698)] public byte[] data; /// /// Checksum /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] checksum; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] checksum; /// /// Always 0xDE, 0xAA /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] epilogue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] epilogue; } public static byte[] DecodeSector(RawSector sector) { - if(sector.addressField.prologue[0] == 0xD5 && - sector.addressField.prologue[1] == 0xAA && + if(sector.addressField.prologue[0] == 0xD5 && sector.addressField.prologue[1] == 0xAA && sector.addressField.prologue[2] == 0x96) { uint ck1, ck2, ck3; @@ -185,8 +178,7 @@ namespace DiscImageChef.Decoders.Floppy while(true) { ck1 = (ck1 & 0xFF) << 1; - if((ck1 & 0x0100) > 0) - ck1++; + if((ck1 & 0x0100) > 0) ck1++; carry = (byte)((bf1[j] ^ ck1) & 0xFF); ck3 += carry; @@ -199,18 +191,18 @@ namespace DiscImageChef.Decoders.Floppy carry = (byte)((bf2[j] ^ ck3) & 0xFF); ck2 += carry; - if (ck3 > 0xFF) + if(ck3 > 0xFF) { ck2++; ck3 &= 0xFF; } ms.WriteByte(carry); - if (ms.Length == 524) break; + if(ms.Length == 524) break; carry = (byte)((bf3[j] ^ ck2) & 0xFF); ck1 += carry; - if (ck2 > 0xFF) + if(ck2 > 0xFF) { ck1++; ck2 &= 0xFF; @@ -237,8 +229,7 @@ namespace DiscImageChef.Decoders.Floppy endOffset = offset; // Not an Apple ][ GCR sector - if(data == null || data.Length < 363) - return null; + if(data == null || data.Length < 363) return null; RawSector sector; int position = offset; @@ -254,8 +245,7 @@ namespace DiscImageChef.Decoders.Floppy if(data[position] == 0xD5 && data[position + 1] == 0xAA && data[position + 2] == 0x96) { // Epilogue not in correct position - if(data[position + 8] != 0xDE || data[position + 9] != 0xAA) - return null; + if(data[position + 8] != 0xDE || data[position + 9] != 0xAA) return null; sector = new RawSector(); sector.addressField = new RawAddressField(); @@ -286,8 +276,7 @@ namespace DiscImageChef.Decoders.Floppy } // Lost sync - if(!onSync) - return null; + if(!onSync) return null; // Prologue not found if(data[position] != 0xDE || data[position + 1] != 0xAA || data[position + 2] != 0xAD) @@ -310,8 +299,7 @@ namespace DiscImageChef.Decoders.Floppy position++; // No space left for epilogue - if(position + 7 > data.Length) - return null; + if(position + 7 > data.Length) return null; } sector.dataField.data = gaps.ToArray(); @@ -346,25 +334,19 @@ namespace DiscImageChef.Decoders.Floppy return sector; } - if(data[position] == 0xFF) - position++; + if(data[position] == 0xFF) position++; // Found data that is not sync or a prologue - else - return null; + else return null; } } - catch(IndexOutOfRangeException) - { - return null; - } + catch(IndexOutOfRangeException) { return null; } return null; } public static byte[] MarshalAddressField(RawAddressField addressField) { - if(addressField == null) - return null; + if(addressField == null) return null; MemoryStream raw = new MemoryStream(); raw.Write(addressField.prologue, 0, addressField.prologue.Length); @@ -379,8 +361,7 @@ namespace DiscImageChef.Decoders.Floppy public static byte[] MarshalSector(RawSector sector) { - if(sector == null) - return null; + if(sector == null) return null; MemoryStream raw = new MemoryStream(); raw.Write(sector.addressField.prologue, 0, sector.addressField.prologue.Length); @@ -426,18 +407,15 @@ namespace DiscImageChef.Decoders.Floppy onSync = count >= 5; } - if(position >= data.Length) - return null; + if(position >= data.Length) return null; - if(!onSync) - return null; + if(!onSync) return null; while(position < data.Length) { int oldPosition = position; RawSector sector = MarshalSector(data, out position, position); - if(sector == null) - break; + if(sector == null) break; if(firstSector) { @@ -446,8 +424,7 @@ namespace DiscImageChef.Decoders.Floppy firstSector = false; } - if(sector.addressField.track != trackNumber || - sector.addressField.side != sideNumber) + if(sector.addressField.track != trackNumber || sector.addressField.side != sideNumber) { position = oldPosition; break; @@ -456,8 +433,7 @@ namespace DiscImageChef.Decoders.Floppy sectors.Add(sector); } - if(sectors.Count == 0) - return null; + if(sectors.Count == 0) return null; RawTrack track = new RawTrack(); track.gap = gaps.ToArray(); @@ -468,8 +444,7 @@ namespace DiscImageChef.Decoders.Floppy public static byte[] MarshalTrack(RawTrack track) { - if(track == null) - return null; + if(track == null) return null; MemoryStream raw = new MemoryStream(); raw.Write(track.gap, 0, track.gap.Length); @@ -478,6 +453,7 @@ namespace DiscImageChef.Decoders.Floppy byte[] rawSector = MarshalSector(sector); raw.Write(rawSector, 0, rawSector.Length); } + return raw.ToArray(); } @@ -500,8 +476,7 @@ namespace DiscImageChef.Decoders.Floppy track = MarshalTrack(data, out position, position); } - if(tracks.Count == 0) - return null; + if(tracks.Count == 0) return null; endOffset = position; return tracks; @@ -514,8 +489,7 @@ namespace DiscImageChef.Decoders.Floppy public static byte[] MarshalDisk(RawTrack[] disk) { - if(disk == null) - return null; + if(disk == null) return null; MemoryStream raw = new MemoryStream(); foreach(RawTrack track in disk) @@ -523,6 +497,7 @@ namespace DiscImageChef.Decoders.Floppy byte[] rawTrack = MarshalTrack(track); raw.Write(rawTrack, 0, rawTrack.Length); } + return raw.ToArray(); } @@ -534,5 +509,4 @@ namespace DiscImageChef.Decoders.Floppy return sector != null && position != 0; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Floppy/Commodore.cs b/DiscImageChef.Decoders/Floppy/Commodore.cs index 9802f96d..bbd53351 100644 --- a/DiscImageChef.Decoders/Floppy/Commodore.cs +++ b/DiscImageChef.Decoders/Floppy/Commodore.cs @@ -82,8 +82,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// User data /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] - public byte data; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte data; /// /// XOR of /// @@ -94,5 +93,4 @@ namespace DiscImageChef.Decoders.Floppy public ushort fill; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Floppy/Enums.cs b/DiscImageChef.Decoders/Floppy/Enums.cs index d874f5a0..25f53e55 100644 --- a/DiscImageChef.Decoders/Floppy/Enums.cs +++ b/DiscImageChef.Decoders/Floppy/Enums.cs @@ -98,5 +98,4 @@ namespace DiscImageChef.Decoders.Floppy /// MacDoubleSide = 0xD9 } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Floppy/ISO.cs b/DiscImageChef.Decoders/Floppy/ISO.cs index 9bf3c1ad..1f811cdf 100644 --- a/DiscImageChef.Decoders/Floppy/ISO.cs +++ b/DiscImageChef.Decoders/Floppy/ISO.cs @@ -57,8 +57,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Start of track, 32 bytes set to 0x4E /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] innerGap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] innerGap; /// /// Track sectors /// @@ -81,8 +80,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// 22 bytes set to 0x4E, set to 0x22 on Commodore 1581 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] - public byte[] innerGap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] public byte[] innerGap; /// /// Sector data block /// @@ -101,13 +99,11 @@ namespace DiscImageChef.Decoders.Floppy /// /// 12 bytes set to 0 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] zero; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero; /// /// 3 bytes set to 0xA1 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] aone; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] aone; /// /// Set to /// @@ -142,13 +138,11 @@ namespace DiscImageChef.Decoders.Floppy /// /// 12 bytes set to 0 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] zero; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero; /// /// 3 bytes set to 0xA1 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] aone; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] aone; /// /// Set to or to /// @@ -163,5 +157,4 @@ namespace DiscImageChef.Decoders.Floppy public ushort crc; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Floppy/Perpendicular.cs b/DiscImageChef.Decoders/Floppy/Perpendicular.cs index e01ec351..7d3f9cf6 100644 --- a/DiscImageChef.Decoders/Floppy/Perpendicular.cs +++ b/DiscImageChef.Decoders/Floppy/Perpendicular.cs @@ -80,8 +80,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// 41 bytes set to 0x4E /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 41)] - public byte[] innerGap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 41)] public byte[] innerGap; /// /// Sector data block /// @@ -101,18 +100,15 @@ namespace DiscImageChef.Decoders.Floppy /// /// Gap from index pulse, 80 bytes set to 0x4E /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] - public byte[] gap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] public byte[] gap; /// /// 12 bytes set to 0x00 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] zero; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero; /// /// 3 bytes set to 0xC2 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] ctwo; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] ctwo; /// /// Set to /// @@ -120,8 +116,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Gap until first sector, 50 bytes to 0x4E /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] - public byte[] gap1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] public byte[] gap1; } /// @@ -132,13 +127,11 @@ namespace DiscImageChef.Decoders.Floppy /// /// 12 bytes set to 0 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] zero; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero; /// /// 3 bytes set to 0xA1 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] aone; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] aone; /// /// Set to /// @@ -173,13 +166,11 @@ namespace DiscImageChef.Decoders.Floppy /// /// 12 bytes set to 0 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] zero; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero; /// /// 3 bytes set to 0xA1 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] aone; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] aone; /// /// Set to or to /// @@ -194,5 +185,4 @@ namespace DiscImageChef.Decoders.Floppy public ushort crc; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Floppy/System34.cs b/DiscImageChef.Decoders/Floppy/System34.cs index 2a935196..be719ebc 100644 --- a/DiscImageChef.Decoders/Floppy/System34.cs +++ b/DiscImageChef.Decoders/Floppy/System34.cs @@ -78,18 +78,15 @@ namespace DiscImageChef.Decoders.Floppy /// /// Gap from index pulse, 80 bytes set to 0x4E /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] - public byte[] gap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] public byte[] gap; /// /// 12 bytes set to 0x00 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] zero; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero; /// /// 3 bytes set to 0xC2 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] ctwo; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] ctwo; /// /// Set to /// @@ -97,8 +94,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Gap until first sector, 50 bytes to 0x4E /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] - public byte[] gap1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] public byte[] gap1; } /// @@ -113,8 +109,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// 22 bytes set to 0x4E, set to 0x22 on Commodore 1581 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] - public byte[] innerGap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] public byte[] innerGap; /// /// Sector data block /// @@ -133,13 +128,11 @@ namespace DiscImageChef.Decoders.Floppy /// /// 12 bytes set to 0 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] zero; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero; /// /// 3 bytes set to 0xA1 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] aone; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] aone; /// /// Set to /// @@ -174,13 +167,11 @@ namespace DiscImageChef.Decoders.Floppy /// /// 12 bytes set to 0 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] zero; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero; /// /// 3 bytes set to 0xA1 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] aone; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] aone; /// /// Set to or to /// @@ -195,5 +186,4 @@ namespace DiscImageChef.Decoders.Floppy public ushort crc; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Floppy/System3740.cs b/DiscImageChef.Decoders/Floppy/System3740.cs index 1ec8729f..f089db9f 100644 --- a/DiscImageChef.Decoders/Floppy/System3740.cs +++ b/DiscImageChef.Decoders/Floppy/System3740.cs @@ -76,13 +76,11 @@ namespace DiscImageChef.Decoders.Floppy /// /// Gap from index pulse, 80 bytes set to 0xFF /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)] - public byte[] gap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)] public byte[] gap; /// /// 6 bytes set to 0x00 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] zero; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] zero; /// /// Set to /// @@ -90,8 +88,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Gap until first sector, 26 bytes to 0xFF /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 26)] - public byte[] gap1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 26)] public byte[] gap1; } /// @@ -106,8 +103,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// 11 bytes set to 0xFF /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] innerGap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] innerGap; /// /// Sector data block /// @@ -126,8 +122,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// 6 bytes set to 0 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] zero; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] zero; /// /// Set to /// @@ -162,8 +157,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// 12 bytes set to 0 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] zero; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero; /// /// Set to or to /// @@ -178,5 +172,4 @@ namespace DiscImageChef.Decoders.Floppy public ushort crc; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/LisaTag.cs b/DiscImageChef.Decoders/LisaTag.cs index d4fa99a0..d6463528 100644 --- a/DiscImageChef.Decoders/LisaTag.cs +++ b/DiscImageChef.Decoders/LisaTag.cs @@ -84,7 +84,7 @@ namespace DiscImageChef.Decoders public bool isFirst; /// On-memory value for easy last block search. public bool isLast; -} + } /// /// LisaOS tag as stored on Priam DataTower disks (24 bytes) @@ -176,8 +176,7 @@ namespace DiscImageChef.Decoders public static SonyTag? DecodeSonyTag(byte[] tag) { - if(tag == null || tag.Length != 12) - return null; + if(tag == null || tag.Length != 12) return null; SonyTag snTag = new SonyTag(); @@ -200,8 +199,7 @@ namespace DiscImageChef.Decoders public static ProfileTag? DecodeProfileTag(byte[] tag) { - if(tag == null || tag.Length != 20) - return null; + if(tag == null || tag.Length != 20) return null; ProfileTag phTag = new ProfileTag(); @@ -246,8 +244,7 @@ namespace DiscImageChef.Decoders public static PriamTag? DecodePriamTag(byte[] tag) { - if(tag == null || tag.Length != 24) - return null; + if(tag == null || tag.Length != 24) return null; PriamTag pmTag = new PriamTag(); @@ -294,8 +291,7 @@ namespace DiscImageChef.Decoders public static PriamTag? DecodeTag(byte[] tag) { - if(tag == null) - return null; + if(tag == null) return null; PriamTag pmTag = new PriamTag(); @@ -304,8 +300,7 @@ namespace DiscImageChef.Decoders case 12: SonyTag? snTag = DecodeSonyTag(tag); - if(snTag == null) - return null; + if(snTag == null) return null; pmTag = new PriamTag(); pmTag.absPage = 0; @@ -328,8 +323,7 @@ namespace DiscImageChef.Decoders case 20: ProfileTag? phTag = DecodeProfileTag(tag); - if(phTag == null) - return null; + if(phTag == null) return null; pmTag = new PriamTag(); pmTag.absPage = phTag.Value.absPage; @@ -349,12 +343,9 @@ namespace DiscImageChef.Decoders pmTag.isLast = phTag.Value.isLast; return pmTag; - case 24: - return DecodePriamTag(tag); - default: - return null; + case 24: return DecodePriamTag(tag); + default: return null; } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/MMC/CID.cs b/DiscImageChef.Decoders/MMC/CID.cs index ee93238b..76cbfb78 100644 --- a/DiscImageChef.Decoders/MMC/CID.cs +++ b/DiscImageChef.Decoders/MMC/CID.cs @@ -51,11 +51,9 @@ namespace DiscImageChef.Decoders.MMC { public static CID DecodeCID(uint[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 4) - return null; + if(response.Length != 4) return null; byte[] data = new byte[16]; byte[] tmp = new byte[4]; @@ -74,11 +72,9 @@ namespace DiscImageChef.Decoders.MMC public static CID DecodeCID(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 16) - return null; + if(response.Length != 16) return null; byte[] tmp; @@ -99,8 +95,7 @@ namespace DiscImageChef.Decoders.MMC public static string PrettifyCID(CID cid) { - if(cid == null) - return null; + if(cid == null) return null; StringBuilder sb = new StringBuilder(); @@ -118,9 +113,11 @@ namespace DiscImageChef.Decoders.MMC sb.AppendLine("\tPOP device"); break; } + sb.AppendFormat("\tApplication ID: {0}", cid.ApplicationID).AppendLine(); sb.AppendFormat("\tProduct name: {0}", cid.ProductName).AppendLine(); - sb.AppendFormat("\tProduct revision: {0:X2}.{1:X2}", (cid.ProductRevision & 0xF0) >> 4, cid.ProductRevision & 0x0F).AppendLine(); + sb.AppendFormat("\tProduct revision: {0:X2}.{1:X2}", (cid.ProductRevision & 0xF0) >> 4, + cid.ProductRevision & 0x0F).AppendLine(); sb.AppendFormat("\tProduct serial number: {0}", cid.ProductSerialNumber).AppendLine(); string year = ""; switch(cid.ManufacturingDate & 0x0F) @@ -174,7 +171,9 @@ namespace DiscImageChef.Decoders.MMC year = "2012"; break; } - sb.AppendFormat("\tDevice manufactured month {0} of {1}", (cid.ManufacturingDate & 0xF0) >> 4, year).AppendLine(); + + sb.AppendFormat("\tDevice manufactured month {0} of {1}", (cid.ManufacturingDate & 0xF0) >> 4, year) + .AppendLine(); sb.AppendFormat("\tCID CRC: 0x{0:X2}", cid.CRC).AppendLine(); return sb.ToString(); @@ -190,4 +189,4 @@ namespace DiscImageChef.Decoders.MMC return PrettifyCID(DecodeCID(response)); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/MMC/CSD.cs b/DiscImageChef.Decoders/MMC/CSD.cs index e19b7906..190ddfa6 100644 --- a/DiscImageChef.Decoders/MMC/CSD.cs +++ b/DiscImageChef.Decoders/MMC/CSD.cs @@ -76,11 +76,9 @@ namespace DiscImageChef.Decoders.MMC { public static CSD DecodeCSD(uint[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 4) - return null; + if(response.Length != 4) return null; byte[] data = new byte[16]; byte[] tmp = new byte[4]; @@ -99,11 +97,9 @@ namespace DiscImageChef.Decoders.MMC public static CSD DecodeCSD(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 16) - return null; + if(response.Length != 16) return null; CSD csd = new CSD(); @@ -146,8 +142,7 @@ namespace DiscImageChef.Decoders.MMC public static string PrettifyCSD(CSD csd) { - if(csd == null) - return null; + if(csd == null) return null; double unitFactor = 0; double multiplier = 0; @@ -259,6 +254,7 @@ namespace DiscImageChef.Decoders.MMC multiplier = 8; break; } + result = unitFactor * multiplier; sb.AppendFormat("\tAsynchronous data access time is {0}{1}", result, unit).AppendLine(); @@ -336,32 +332,26 @@ namespace DiscImageChef.Decoders.MMC multiplier = 8; break; } + result = unitFactor * multiplier; sb.AppendFormat("\tDevice's clock frequency: {0}{1}", result, unit).AppendLine(); unit = ""; for(int cl = 0, mask = 1; cl <= 11; cl++, mask <<= 1) { - if((csd.Classes & mask) == mask) - unit += string.Format(" {0}", cl); + if((csd.Classes & mask) == mask) unit += string.Format(" {0}", cl); } sb.AppendFormat("\tDevice support command classes {0}", unit).AppendLine(); - if(csd.ReadBlockLength == 15) - sb.AppendLine("\tRead block length size is defined in extended CSD"); - else - sb.AppendFormat("\tRead block length is {0} bytes", Math.Pow(2, csd.ReadBlockLength)).AppendLine(); + if(csd.ReadBlockLength == 15) sb.AppendLine("\tRead block length size is defined in extended CSD"); + else sb.AppendFormat("\tRead block length is {0} bytes", Math.Pow(2, csd.ReadBlockLength)).AppendLine(); - if(csd.ReadsPartialBlocks) - sb.AppendLine("\tDevice allows reading partial blocks"); + if(csd.ReadsPartialBlocks) sb.AppendLine("\tDevice allows reading partial blocks"); - if(csd.WriteMisalignment) - sb.AppendLine("\tWrite commands can cross physical block boundaries"); - if(csd.ReadMisalignment) - sb.AppendLine("\tRead commands can cross physical block boundaries"); + if(csd.WriteMisalignment) sb.AppendLine("\tWrite commands can cross physical block boundaries"); + if(csd.ReadMisalignment) sb.AppendLine("\tRead commands can cross physical block boundaries"); - if(csd.DSRImplemented) - sb.AppendLine("\tDevice implements configurable driver stage"); + if(csd.DSRImplemented) sb.AppendLine("\tDevice implements configurable driver stage"); if(csd.Size == 0xFFF) sb.AppendLine("\tDevice may be bigger than 2GiB and have its real size defined in the extended CSD"); @@ -370,14 +360,10 @@ namespace DiscImageChef.Decoders.MMC sb.AppendFormat("\tDevice has {0} blocks", (int)result).AppendLine(); result = (csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2) * Math.Pow(2, csd.ReadBlockLength); - if(result > 1073741824) - sb.AppendFormat("\tDevice has {0} GiB", result/1073741824.0).AppendLine(); - else if(result > 1048576) - sb.AppendFormat("\tDevice has {0} MiB", result / 1048576.0).AppendLine(); - else if(result > 1024) - sb.AppendFormat("\tDevice has {0} KiB", result / 1024.0).AppendLine(); - else - sb.AppendFormat("\tDevice has {0} bytes", result).AppendLine(); + if(result > 1073741824) sb.AppendFormat("\tDevice has {0} GiB", result / 1073741824.0).AppendLine(); + else if(result > 1048576) sb.AppendFormat("\tDevice has {0} MiB", result / 1048576.0).AppendLine(); + else if(result > 1024) sb.AppendFormat("\tDevice has {0} KiB", result / 1024.0).AppendLine(); + else sb.AppendFormat("\tDevice has {0} bytes", result).AppendLine(); switch(csd.ReadCurrentAtVddMin & 0x07) { @@ -501,10 +487,10 @@ namespace DiscImageChef.Decoders.MMC { sb.AppendLine("\tDevice can write protect regions"); unitFactor = Convert.ToDouble(csd.WriteProtectGroupSize); - sb.AppendFormat("\tDevice can write protect a minimum of {0} blocks at a time", (int)(result + 1)).AppendLine(); + sb.AppendFormat("\tDevice can write protect a minimum of {0} blocks at a time", (int)(result + 1)) + .AppendLine(); } - else - sb.AppendLine("\tDevice can't write protect regions"); + else sb.AppendLine("\tDevice can't write protect regions"); switch(csd.DefaultECC) { @@ -519,27 +505,21 @@ namespace DiscImageChef.Decoders.MMC break; } - sb.AppendFormat("\tWriting is {0} times slower than reading", Math.Pow(2, csd.WriteSpeedFactor)).AppendLine(); + sb.AppendFormat("\tWriting is {0} times slower than reading", Math.Pow(2, csd.WriteSpeedFactor)) + .AppendLine(); - if(csd.WriteBlockLength == 15) - sb.AppendLine("\tWrite block length size is defined in extended CSD"); - else - sb.AppendFormat("\tWrite block length is {0} bytes", Math.Pow(2, csd.WriteBlockLength)).AppendLine(); + if(csd.WriteBlockLength == 15) sb.AppendLine("\tWrite block length size is defined in extended CSD"); + else sb.AppendFormat("\tWrite block length is {0} bytes", Math.Pow(2, csd.WriteBlockLength)).AppendLine(); - if(csd.WritesPartialBlocks) - sb.AppendLine("\tDevice allows writing partial blocks"); + if(csd.WritesPartialBlocks) sb.AppendLine("\tDevice allows writing partial blocks"); - if(csd.ContentProtection) - sb.AppendLine("\tDevice supports content protection"); + if(csd.ContentProtection) sb.AppendLine("\tDevice supports content protection"); - if(!csd.Copy) - sb.AppendLine("\tDevice contents are original"); + if(!csd.Copy) sb.AppendLine("\tDevice contents are original"); - if(csd.PermanentWriteProtect) - sb.AppendLine("\tDevice is permanently write protected"); + if(csd.PermanentWriteProtect) sb.AppendLine("\tDevice is permanently write protected"); - if(csd.TemporaryWriteProtect) - sb.AppendLine("\tDevice is temporarily write protected"); + if(csd.TemporaryWriteProtect) sb.AppendLine("\tDevice is temporarily write protected"); if(!csd.FileFormatGroup) { @@ -560,7 +540,8 @@ namespace DiscImageChef.Decoders.MMC } } else - sb.AppendFormat("\tDevice uses unknown file format code {0} and file format group 1", csd.FileFormat).AppendLine(); + sb.AppendFormat("\tDevice uses unknown file format code {0} and file format group 1", csd.FileFormat) + .AppendLine(); switch(csd.ECC) { @@ -590,4 +571,4 @@ namespace DiscImageChef.Decoders.MMC return PrettifyCSD(DecodeCSD(response)); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/MMC/ExtendedCSD.cs b/DiscImageChef.Decoders/MMC/ExtendedCSD.cs index 824f9e7b..11abeaac 100644 --- a/DiscImageChef.Decoders/MMC/ExtendedCSD.cs +++ b/DiscImageChef.Decoders/MMC/ExtendedCSD.cs @@ -39,8 +39,7 @@ namespace DiscImageChef.Decoders.MMC [StructLayout(LayoutKind.Sequential)] public class ExtendedCSD { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] Reserved0; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] Reserved0; public byte ExtendedSecurityCommandsError; public byte SupportedCommandSets; public byte HPIFeatures; @@ -58,13 +57,11 @@ namespace DiscImageChef.Decoders.MMC public byte OperationCodesTimeout; public uint FFUArgument; public byte BarrierSupport; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 177)] - public byte[] Reserved1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 177)] public byte[] Reserved1; public byte CMDQueuingSupport; public byte CMDQueuingDepth; public uint NumberofFWSectorsCorrectlyProgrammed; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] VendorHealthReport; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] VendorHealthReport; public byte DeviceLifeEstimationTypeB; public byte DeviceLifeEstimationTypeA; public byte PreEOLInformation; @@ -158,14 +155,11 @@ namespace DiscImageChef.Decoders.MMC public byte HWResetFunction; public byte HPIManagement; public byte PartitioningSupport; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] MaxEnhancedAreaSize; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] MaxEnhancedAreaSize; public byte PartitionsAttribute; public byte PartitioningSetting; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] GeneralPurposePartitionSize; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] EnhancedUserDataAreaSize; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] GeneralPurposePartitionSize; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] EnhancedUserDataAreaSize; public uint EnhancedUserDataStartAddress; public byte Reserved15; public byte BadBlockManagementMode; @@ -174,8 +168,7 @@ namespace DiscImageChef.Decoders.MMC public byte PeriodicWakeUp; public byte SupportsProgramCxDInDDR; public ushort Reserved16; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] VendorSpecific; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] VendorSpecific; public byte NativeSectorSize; public byte SectorSizeEmulation; public byte SectorSize; @@ -185,8 +178,7 @@ namespace DiscImageChef.Decoders.MMC public ushort ExceptionEventsControl; public ushort ExceptionEventsStatus; public ushort ExtendedPartitionsAttribute; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] - public byte[] ContextConfiguration; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public byte[] ContextConfiguration; public byte PackedCommandStatus; public byte PackedCommandFailureIndex; public byte PowerOffNotification; @@ -202,19 +194,16 @@ namespace DiscImageChef.Decoders.MMC public byte ProductStateAwarenessEnablement; public byte SecureRemovalType; public byte CommandQueueModeEnable; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] - public byte[] Reserved18; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public byte[] Reserved18; } public partial class Decoders { public static ExtendedCSD DecodeExtendedCSD(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 512) - return null; + if(response.Length != 512) return null; ExtendedCSD csd = new ExtendedCSD(); GCHandle handle = GCHandle.Alloc(response, GCHandleType.Pinned); @@ -226,8 +215,7 @@ namespace DiscImageChef.Decoders.MMC public static string PrettifyExtendedCSD(ExtendedCSD csd) { - if(csd == null) - return null; + if(csd == null) return null; StringBuilder sb = new StringBuilder(); sb.AppendLine("MultiMediaCard Extended Device Specific Data Register:"); @@ -236,16 +224,15 @@ namespace DiscImageChef.Decoders.MMC if((csd.HPIFeatures & 0x01) == 0x01) { - if((csd.HPIFeatures & 0x02) == 0x02) - sb.AppendLine("\tDevice implements HPI using CMD12"); - else - sb.AppendLine("\tDevice implements HPI using CMD13"); + if((csd.HPIFeatures & 0x02) == 0x02) sb.AppendLine("\tDevice implements HPI using CMD12"); + else sb.AppendLine("\tDevice implements HPI using CMD13"); } if((csd.BackgroundOperationsSupport & 0x01) == 0x01) sb.AppendLine("\tDevice supports background operations"); - sb.AppendFormat("\tDevice supports a maximum of {0} packed reads and {1} packed writes", csd.MaxPackedReadCommands, csd.MaxPackedWriteCommands).AppendLine(); + sb.AppendFormat("\tDevice supports a maximum of {0} packed reads and {1} packed writes", + csd.MaxPackedReadCommands, csd.MaxPackedWriteCommands).AppendLine(); if((csd.DataTagSupport & 0x01) == 0x01) { @@ -258,15 +245,15 @@ namespace DiscImageChef.Decoders.MMC if((csd.ExtendedPartitionsSupport & 0x02) == 0x02) sb.AppendLine("\tDevice supports system code extended partitions"); - if((csd.SupportedModes & 0x01) == 0x01) - sb.AppendLine("\tDevice supports FFU"); - if((csd.SupportedModes & 0x02) == 0x02) - sb.AppendLine("\tDevice supports Vendor Specific Mode"); + if((csd.SupportedModes & 0x01) == 0x01) sb.AppendLine("\tDevice supports FFU"); + if((csd.SupportedModes & 0x02) == 0x02) sb.AppendLine("\tDevice supports Vendor Specific Mode"); if((csd.CMDQueuingSupport & 0x01) == 0x01) - sb.AppendFormat("\tDevice supports command queuing with a depth of {0}", csd.CMDQueuingDepth + 1).AppendLine(); + sb.AppendFormat("\tDevice supports command queuing with a depth of {0}", csd.CMDQueuingDepth + 1) + .AppendLine(); - sb.AppendFormat("\t{0} firmware sectors correctly programmed", csd.NumberofFWSectorsCorrectlyProgrammed).AppendLine(); + sb.AppendFormat("\t{0} firmware sectors correctly programmed", csd.NumberofFWSectorsCorrectlyProgrammed) + .AppendLine(); switch(csd.DeviceLifeEstimationTypeB) { @@ -362,16 +349,17 @@ namespace DiscImageChef.Decoders.MMC sb.AppendFormat("\tDevice version: {0}", csd.DeviceVersion).AppendLine(); sb.AppendFormat("\tFirmware version: {0}", csd.FirmwareVersion).AppendLine(); - if(csd.CacheSize == 0) - sb.AppendLine("\tDevice has no cache"); - else - sb.AppendFormat("\tDevice has {0} KiB of cache", csd.CacheSize).AppendLine(); + if(csd.CacheSize == 0) sb.AppendLine("\tDevice has no cache"); + else sb.AppendFormat("\tDevice has {0} KiB of cache", csd.CacheSize).AppendLine(); if(csd.GenericCMD6Timeout > 0) - sb.AppendFormat("\tDevice takes a maximum of {0} ms by default for a SWITCH command", csd.GenericCMD6Timeout * 10).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} ms by default for a SWITCH command", + csd.GenericCMD6Timeout * 10).AppendLine(); if(csd.PowerOffNotificationTimeout > 0) - sb.AppendFormat("\tDevice takes a maximum of {0} by default to power off from a SWITCH command notification", csd.PowerOffNotificationTimeout * 10).AppendLine(); + sb + .AppendFormat("\tDevice takes a maximum of {0} by default to power off from a SWITCH command notification", + csd.PowerOffNotificationTimeout * 10).AppendLine(); switch(csd.BackgroundOperationsStatus & 0x03) { @@ -389,103 +377,108 @@ namespace DiscImageChef.Decoders.MMC break; } - sb.AppendFormat("\tLast WRITE MULTIPLE command correctly programmed {0} sectors", csd.CorrectlyProgrammedSectors).AppendLine(); + sb.AppendFormat("\tLast WRITE MULTIPLE command correctly programmed {0} sectors", + csd.CorrectlyProgrammedSectors).AppendLine(); if(csd.InitializationTimeAfterPartition > 0) - sb.AppendFormat("\tDevice takes a maximum of {0} ms for initialization after partition", csd.InitializationTimeAfterPartition * 100).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} ms for initialization after partition", + csd.InitializationTimeAfterPartition * 100).AppendLine(); if((csd.CacheFlushingPolicy & 0x01) == 0x01) sb.AppendLine("\tDevice uses a FIFO policy for cache flushing"); if(csd.TRIMMultiplier > 0) - sb.AppendFormat("\tDevice takes a maximum of {0} ms for trimming a single erase group", csd.TRIMMultiplier * 300).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} ms for trimming a single erase group", + csd.TRIMMultiplier * 300).AppendLine(); - if((csd.SecureFeatureSupport & 0x40) == 0x40) - sb.AppendLine("\tDevice supports the sanitize operation"); + if((csd.SecureFeatureSupport & 0x40) == 0x40) sb.AppendLine("\tDevice supports the sanitize operation"); if((csd.SecureFeatureSupport & 0x10) == 0x10) sb.AppendLine("\tDevice supports supports the secure and insecure trim operations"); if((csd.SecureFeatureSupport & 0x04) == 0x04) sb.AppendLine("\tDevice supports automatic erase on retired defective blocks"); - if((csd.SecureFeatureSupport & 0x01) == 0x01) - sb.AppendLine("\tDevice supports secure purge operations"); + if((csd.SecureFeatureSupport & 0x01) == 0x01) sb.AppendLine("\tDevice supports secure purge operations"); if(csd.SecureEraseMultiplier > 0) - sb.AppendFormat("\tDevice takes a maximum of {0} ms for securely erasing a single erase group", csd.SecureEraseMultiplier * 300).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} ms for securely erasing a single erase group", + csd.SecureEraseMultiplier * 300).AppendLine(); if(csd.SecureTRIMMultiplier > 0) - sb.AppendFormat("\tDevice takes a maximum of {0} ms for securely trimming a single erase group", csd.SecureTRIMMultiplier * 300).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} ms for securely trimming a single erase group", + csd.SecureTRIMMultiplier * 300).AppendLine(); - if((csd.BootInformation & 0x04) == 0x04) - sb.AppendLine("\tDevice supports high speed timing on boot"); - if((csd.BootInformation & 0x02) == 0x02) - sb.AppendLine("\tDevice supports dual data rate on boot"); - if((csd.BootInformation & 0x01) == 0x01) - sb.AppendLine("\tDevice supports alternative boot method"); + if((csd.BootInformation & 0x04) == 0x04) sb.AppendLine("\tDevice supports high speed timing on boot"); + if((csd.BootInformation & 0x02) == 0x02) sb.AppendLine("\tDevice supports dual data rate on boot"); + if((csd.BootInformation & 0x01) == 0x01) sb.AppendLine("\tDevice supports alternative boot method"); if(csd.BootPartitionSize > 0) sb.AppendFormat("\tDevice has a {0} KiB boot partition", csd.BootPartitionSize * 128).AppendLine(); if((csd.AccessSize & 0x0F) > 0) - sb.AppendFormat("\tDevice has a page size of {0} KiB", (csd.AccessSize & 0x0F) * 512.0 / 1024.0).AppendLine(); + sb.AppendFormat("\tDevice has a page size of {0} KiB", (csd.AccessSize & 0x0F) * 512.0 / 1024.0) + .AppendLine(); if(csd.HighCapacityEraseUnitSize > 0) sb.AppendFormat("\tDevice erase groups are {0} KiB", csd.HighCapacityEraseUnitSize * 512).AppendLine(); - if(csd.HighCapacityEraseTimeout > 0) - sb.AppendFormat("\tDevice takes a maximum of {0} ms for erasing a single erase group", csd.HighCapacityEraseTimeout * 300).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} ms for erasing a single erase group", + csd.HighCapacityEraseTimeout * 300).AppendLine(); if(csd.HighCapacityWriteProtectGroupSize > 0) - sb.AppendFormat("\tDevice smallest write protect group is made of {0} erase groups", csd.HighCapacityWriteProtectGroupSize).AppendLine(); + sb.AppendFormat("\tDevice smallest write protect group is made of {0} erase groups", + csd.HighCapacityWriteProtectGroupSize).AppendLine(); if(csd.SleepCurrentVcc > 0) { unit = Math.Pow(2, csd.SleepCurrentVcc); - if(unit > 1000) - sb.AppendFormat("\tDevice uses {0} mA on Vcc when sleeping", unit / 1000).AppendLine(); - else - sb.AppendFormat("\tDevice uses {0} μA on Vcc when sleeping", unit).AppendLine(); + if(unit > 1000) sb.AppendFormat("\tDevice uses {0} mA on Vcc when sleeping", unit / 1000).AppendLine(); + else sb.AppendFormat("\tDevice uses {0} μA on Vcc when sleeping", unit).AppendLine(); } if(csd.SleepCurrentVccq > 0) { unit = Math.Pow(2, csd.SleepCurrentVccq); - if(unit > 1000) - sb.AppendFormat("\tDevice uses {0} mA on Vccq when sleeping", unit / 1000).AppendLine(); - else - sb.AppendFormat("\tDevice uses {0} μA on Vccq when sleeping", unit).AppendLine(); + if(unit > 1000) sb.AppendFormat("\tDevice uses {0} mA on Vccq when sleeping", unit / 1000).AppendLine(); + else sb.AppendFormat("\tDevice uses {0} μA on Vccq when sleeping", unit).AppendLine(); } if(csd.ProductionStateAwarenessTimeout > 0) { unit = Math.Pow(2, csd.ProductionStateAwareness) * 100; if(unit > 1000000) - sb.AppendFormat("\tDevice takes a maximum of {0} s to switch production state awareness", unit / 1000000).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} s to switch production state awareness", + unit / 1000000).AppendLine(); else if(unit > 1000) - sb.AppendFormat("\tDevice takes a maximum of {0} ms to switch production state awareness", unit / 1000).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} ms to switch production state awareness", + unit / 1000).AppendLine(); else - sb.AppendFormat("\tDevice takes a maximum of {0} μs to switch production state awareness", unit).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} μs to switch production state awareness", unit) + .AppendLine(); } if(csd.SleepAwakeTimeout > 0) { unit = Math.Pow(2, csd.SleepAwakeTimeout) * 100; if(unit > 1000000) - sb.AppendFormat("\tDevice takes a maximum of {0} ms to transition between sleep and standby states", unit / 1000000).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} ms to transition between sleep and standby states", + unit / 1000000).AppendLine(); else if(unit > 1000) - sb.AppendFormat("\tDevice takes a maximum of {0} μs to transition between sleep and standby states", unit / 1000).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} μs to transition between sleep and standby states", + unit / 1000).AppendLine(); else - sb.AppendFormat("\tDevice takes a maximum of {0} ns to transition between sleep and standby states", unit).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} ns to transition between sleep and standby states", + unit).AppendLine(); } if(csd.SleepNotificationTimeout > 0) { unit = Math.Pow(2, csd.SleepNotificationTimeout) * 10; if(unit > 1000000) - sb.AppendFormat("\tDevice takes a maximum of {0} s to move to sleep state", unit / 1000000).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} s to move to sleep state", unit / 1000000) + .AppendLine(); else if(unit > 1000) - sb.AppendFormat("\tDevice takes a maximum of {0} ms to move to sleep state", unit / 1000).AppendLine(); - else - sb.AppendFormat("\tDevice takes a maximum of {0} μs to move to sleep state", unit).AppendLine(); + sb.AppendFormat("\tDevice takes a maximum of {0} ms to move to sleep state", unit / 1000) + .AppendLine(); + else sb.AppendFormat("\tDevice takes a maximum of {0} μs to move to sleep state", unit).AppendLine(); } sb.AppendFormat("\tDevice has {0} sectors", csd.SectorCount).AppendLine(); @@ -501,72 +494,74 @@ namespace DiscImageChef.Decoders.MMC if(csd.MinimumReadPerformance26 == 0) sb.AppendLine("\tDevice cannot achieve 2.4MB/s reading in SDR 26Mhz mode"); else - sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s reading in SDR 26Mhz mode", unit / 1000).AppendLine(); + sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s reading in SDR 26Mhz mode", unit / 1000) + .AppendLine(); unit = csd.MinimumReadPerformance26_4 * 150; if(csd.MinimumReadPerformance26_4 == 0) sb.AppendLine("\tDevice cannot achieve 2.4MB/s reading in SDR 26Mhz 4-bit mode"); else - sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s reading in SDR 26Mhz 4-bit mode", unit / 1000).AppendLine(); + sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s reading in SDR 26Mhz 4-bit mode", + unit / 1000).AppendLine(); unit = csd.MinimumReadPerformance52 * 150; if(csd.MinimumReadPerformance52 == 0) sb.AppendLine("\tDevice cannot achieve 2.4MB/s reading in SDR 52Mhz mode"); else - sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s reading in SDR 52Mhz mode", unit / 1000).AppendLine(); + sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s reading in SDR 52Mhz mode", unit / 1000) + .AppendLine(); unit = csd.MinimumReadPerformanceDDR52 * 300; if(csd.MinimumReadPerformanceDDR52 == 0) sb.AppendLine("\tDevice cannot achieve 4.8MB/s reading in DDR 52Mhz mode"); else - sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s reading in DDR 52Mhz mode", unit / 1000).AppendLine(); + sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s reading in DDR 52Mhz mode", unit / 1000) + .AppendLine(); unit = csd.MinimumWritePerformance26 * 150; if(csd.MinimumWritePerformance26 == 0) sb.AppendLine("\tDevice cannot achieve 2.4MB/s writing in SDR 26Mhz mode"); else - sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s writing in SDR 26Mhz mode", unit / 1000).AppendLine(); + sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s writing in SDR 26Mhz mode", unit / 1000) + .AppendLine(); unit = csd.MinimumWritePerformance26_4 * 150; if(csd.MinimumWritePerformance26_4 == 0) sb.AppendLine("\tDevice cannot achieve 2.4MB/s writing in SDR 26Mhz 4-bit mode"); else - sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s writing in SDR 26Mhz 4-bit mode", unit / 1000).AppendLine(); + sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s writing in SDR 26Mhz 4-bit mode", + unit / 1000).AppendLine(); unit = csd.MinimumWritePerformance52 * 150; if(csd.MinimumWritePerformance52 == 0) sb.AppendLine("\tDevice cannot achieve 2.4MB/s writing in SDR 52Mhz mode"); else - sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s writing in SDR 52Mhz mode", unit / 1000).AppendLine(); + sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s writing in SDR 52Mhz mode", unit / 1000) + .AppendLine(); unit = csd.MinimumWritePerformanceDDR52 * 300; if(csd.MinimumWritePerformanceDDR52 == 0) sb.AppendLine("\tDevice cannot achieve 4.8MB/s writing in DDR 52Mhz mode"); else - sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s writing in DDR 52Mhz mode", unit / 1000).AppendLine(); + sb.AppendFormat("\tDevice can achieve a minimum of {0}MB/s writing in DDR 52Mhz mode", unit / 1000) + .AppendLine(); if(csd.PartitionSwitchingTime > 0) - sb.AppendFormat("\tDevice can take a maximum of {0} ms when switching partitions", csd.PartitionSwitchingTime * 10).AppendLine(); + sb.AppendFormat("\tDevice can take a maximum of {0} ms when switching partitions", + csd.PartitionSwitchingTime * 10).AppendLine(); if(csd.OutOfInterruptBusyTiming > 0) - sb.AppendFormat("\tDevice can take a maximum of {0} ms when releasing from an interrupt", csd.OutOfInterruptBusyTiming * 10).AppendLine(); + sb.AppendFormat("\tDevice can take a maximum of {0} ms when releasing from an interrupt", + csd.OutOfInterruptBusyTiming * 10).AppendLine(); - if((csd.DeviceType & 0x01) == 0x01) - sb.AppendLine("\tDevice supports 26 Mhz mode"); - if((csd.DeviceType & 0x02) == 0x02) - sb.AppendLine("\tDevice supports 52 Mhz mode"); - if((csd.DeviceType & 0x04) == 0x04) - sb.AppendLine("\tDevice supports DDR 52 Mhz mode at 1.8V or 3V"); - if((csd.DeviceType & 0x08) == 0x08) - sb.AppendLine("\tDevice supports DDR 52 Mhz mode 1.2V"); - if((csd.DeviceType & 0x10) == 0x10) - sb.AppendLine("\tDevice supports HS-200 mode (SDR 200Mhz) at 1.8V"); - if((csd.DeviceType & 0x20) == 0x20) - sb.AppendLine("\tDevice supports HS-200 mode (SDR 200Mhz) at 1.2V"); - if((csd.DeviceType & 0x40) == 0x40) - sb.AppendLine("\tDevice supports HS-400 mode (DDR 200Mhz) at 1.8V"); - if((csd.DeviceType & 0x80) == 0x80) - sb.AppendLine("\tDevice supports HS-400 mode (DDR 200Mhz) at 1.2V"); + if((csd.DeviceType & 0x01) == 0x01) sb.AppendLine("\tDevice supports 26 Mhz mode"); + if((csd.DeviceType & 0x02) == 0x02) sb.AppendLine("\tDevice supports 52 Mhz mode"); + if((csd.DeviceType & 0x04) == 0x04) sb.AppendLine("\tDevice supports DDR 52 Mhz mode at 1.8V or 3V"); + if((csd.DeviceType & 0x08) == 0x08) sb.AppendLine("\tDevice supports DDR 52 Mhz mode 1.2V"); + if((csd.DeviceType & 0x10) == 0x10) sb.AppendLine("\tDevice supports HS-200 mode (SDR 200Mhz) at 1.8V"); + if((csd.DeviceType & 0x20) == 0x20) sb.AppendLine("\tDevice supports HS-200 mode (SDR 200Mhz) at 1.2V"); + if((csd.DeviceType & 0x40) == 0x40) sb.AppendLine("\tDevice supports HS-400 mode (DDR 200Mhz) at 1.8V"); + if((csd.DeviceType & 0x80) == 0x80) sb.AppendLine("\tDevice supports HS-400 mode (DDR 200Mhz) at 1.2V"); sb.AppendFormat("\tCSD version 1.{0} revision 1.{1}", csd.Structure, csd.Revision).AppendLine(); @@ -575,8 +570,7 @@ namespace DiscImageChef.Decoders.MMC sb.AppendLine("\tDevice supports enhanced strobe mode"); if((csd.BusWidth & 0x80) == 0x80) sb.AppendLine("\tDevice uses strobe during Data Out, CRC and CMD responses"); - else - sb.AppendLine("\tDevice uses strobe during Data Out and CRC responses"); + else sb.AppendLine("\tDevice uses strobe during Data Out and CRC responses"); } switch(csd.BusWidth & 0x0F) @@ -601,8 +595,7 @@ namespace DiscImageChef.Decoders.MMC break; } - if((csd.PartitionConfiguration & 0x80) == 0x80) - sb.AppendLine("\tDevice sends boot acknowledge"); + if((csd.PartitionConfiguration & 0x80) == 0x80) sb.AppendLine("\tDevice sends boot acknowledge"); switch((csd.PartitionConfiguration & 0x38) >> 3) { @@ -619,7 +612,8 @@ namespace DiscImageChef.Decoders.MMC sb.AppendLine("\tDevice user area is enable for boot"); break; default: - sb.AppendFormat("\tUnknown enabled boot partition code {0}", (csd.PartitionConfiguration & 0x38) >> 3).AppendLine(); + sb.AppendFormat("\tUnknown enabled boot partition code {0}", + (csd.PartitionConfiguration & 0x38) >> 3).AppendLine(); break; } @@ -638,15 +632,16 @@ namespace DiscImageChef.Decoders.MMC sb.AppendLine("\tThere is read/write access to replay protected memory block"); break; default: - sb.AppendFormat("\tThere is access to general purpose partition {0}", (csd.PartitionConfiguration & 0x07) - 3).AppendLine(); + sb.AppendFormat("\tThere is access to general purpose partition {0}", + (csd.PartitionConfiguration & 0x07) - 3).AppendLine(); break; } - if((csd.FirmwareConfiguration & 0x01) == 0x01) - sb.AppendLine("\tFirmware updates are permanently disabled"); + if((csd.FirmwareConfiguration & 0x01) == 0x01) sb.AppendLine("\tFirmware updates are permanently disabled"); if(csd.RPMBSize > 0) - sb.AppendFormat("\tDevice has a {0} KiB replay protected memory block", csd.RPMBSize * 128).AppendLine(); + sb.AppendFormat("\tDevice has a {0} KiB replay protected memory block", csd.RPMBSize * 128) + .AppendLine(); switch(csd.NativeSectorSize) { @@ -657,7 +652,8 @@ namespace DiscImageChef.Decoders.MMC sb.AppendLine("\tDevice natively uses 4096 byte sectors"); break; default: - sb.AppendFormat("\tDevice natively uses unknown sector size indicated by code {0}", csd.NativeSectorSize).AppendLine(); + sb.AppendFormat("\tDevice natively uses unknown sector size indicated by code {0}", + csd.NativeSectorSize).AppendLine(); break; } @@ -670,7 +666,8 @@ namespace DiscImageChef.Decoders.MMC sb.AppendLine("\tDevice is using natively sized sectors"); break; default: - sb.AppendFormat("\tDevice emulates unknown sector size indicated by code {0}", csd.NativeSectorSize).AppendLine(); + sb.AppendFormat("\tDevice emulates unknown sector size indicated by code {0}", csd.NativeSectorSize) + .AppendLine(); break; } @@ -683,15 +680,14 @@ namespace DiscImageChef.Decoders.MMC sb.AppendLine("\tDevice currently addresses 4096 byte sectors"); break; default: - sb.AppendFormat("\tDevice currently addresses unknown sector size indicated by code {0}", csd.NativeSectorSize).AppendLine(); + sb.AppendFormat("\tDevice currently addresses unknown sector size indicated by code {0}", + csd.NativeSectorSize).AppendLine(); break; } - if((csd.CacheControl & 0x01) == 0x01) - sb.AppendLine("\tDevice's cache is enabled"); + if((csd.CacheControl & 0x01) == 0x01) sb.AppendLine("\tDevice's cache is enabled"); - if((csd.CommandQueueModeEnable & 0x01) == 0x01) - sb.AppendLine("\tDevice has enabled command queuing"); + if((csd.CommandQueueModeEnable & 0x01) == 0x01) sb.AppendLine("\tDevice has enabled command queuing"); return sb.ToString(); } @@ -701,4 +697,4 @@ namespace DiscImageChef.Decoders.MMC return PrettifyExtendedCSD(DecodeExtendedCSD(response)); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/MMC/OCR.cs b/DiscImageChef.Decoders/MMC/OCR.cs index 07c57c15..74068ad3 100644 --- a/DiscImageChef.Decoders/MMC/OCR.cs +++ b/DiscImageChef.Decoders/MMC/OCR.cs @@ -89,24 +89,20 @@ namespace DiscImageChef.Decoders.MMC public static OCR DecodeOCR(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 4) - return null; + if(response.Length != 4) return null; return DecodeOCR(BitConverter.ToUInt32(response, 0)); } public static string PrettifyOCR(OCR ocr) { - if(ocr == null) - return null; + if(ocr == null) return null; StringBuilder sb = new StringBuilder(); sb.AppendLine("MultiMediaCard Operation Conditions Register:"); - if(!ocr.PowerUp) - sb.AppendLine("\tDevice is powering up"); + if(!ocr.PowerUp) sb.AppendLine("\tDevice is powering up"); switch(ocr.AccessMode) { case 0: @@ -119,38 +115,23 @@ namespace DiscImageChef.Decoders.MMC sb.AppendFormat("\tUnknown device access mode {0}", ocr.AccessMode).AppendLine(); break; } - if(ocr.ThreeFive) - sb.AppendLine("\tDevice can work with supply 3.5~3.6V"); - if(ocr.ThreeFour) - sb.AppendLine("\tDevice can work with supply 3.4~3.5V"); - if(ocr.ThreeThree) - sb.AppendLine("\tDevice can work with supply 3.3~3.4V"); - if(ocr.ThreeTwo) - sb.AppendLine("\tDevice can work with supply 3.2~3.3V"); - if(ocr.ThreeOne) - sb.AppendLine("\tDevice can work with supply 3.1~3.2V"); - if(ocr.TwoNine) - sb.AppendLine("\tDevice can work with supply 2.9~3.0V"); - if(ocr.TwoEight) - sb.AppendLine("\tDevice can work with supply 2.8~2.9V"); - if(ocr.TwoSeven) - sb.AppendLine("\tDevice can work with supply 2.7~2.8V"); - if(ocr.TwoSix) - sb.AppendLine("\tDevice can work with supply 2.6~2.7V"); - if(ocr.TwoFive) - sb.AppendLine("\tDevice can work with supply 2.5~2.6V"); - if(ocr.TwoFour) - sb.AppendLine("\tDevice can work with supply 2.4~2.5V"); - if(ocr.TwoThree) - sb.AppendLine("\tDevice can work with supply 2.3~2.4V"); - if(ocr.TwoTwo) - sb.AppendLine("\tDevice can work with supply 2.2~2.3V"); - if(ocr.TwoOne) - sb.AppendLine("\tDevice can work with supply 2.1~2.2V"); - if(ocr.TwoZero) - sb.AppendLine("\tDevice can work with supply 2.0~2.1V"); - if(ocr.OneSix) - sb.AppendLine("\tDevice can work with supply 1.65~1.95V"); + + if(ocr.ThreeFive) sb.AppendLine("\tDevice can work with supply 3.5~3.6V"); + if(ocr.ThreeFour) sb.AppendLine("\tDevice can work with supply 3.4~3.5V"); + if(ocr.ThreeThree) sb.AppendLine("\tDevice can work with supply 3.3~3.4V"); + if(ocr.ThreeTwo) sb.AppendLine("\tDevice can work with supply 3.2~3.3V"); + if(ocr.ThreeOne) sb.AppendLine("\tDevice can work with supply 3.1~3.2V"); + if(ocr.TwoNine) sb.AppendLine("\tDevice can work with supply 2.9~3.0V"); + if(ocr.TwoEight) sb.AppendLine("\tDevice can work with supply 2.8~2.9V"); + if(ocr.TwoSeven) sb.AppendLine("\tDevice can work with supply 2.7~2.8V"); + if(ocr.TwoSix) sb.AppendLine("\tDevice can work with supply 2.6~2.7V"); + if(ocr.TwoFive) sb.AppendLine("\tDevice can work with supply 2.5~2.6V"); + if(ocr.TwoFour) sb.AppendLine("\tDevice can work with supply 2.4~2.5V"); + if(ocr.TwoThree) sb.AppendLine("\tDevice can work with supply 2.3~2.4V"); + if(ocr.TwoTwo) sb.AppendLine("\tDevice can work with supply 2.2~2.3V"); + if(ocr.TwoOne) sb.AppendLine("\tDevice can work with supply 2.1~2.2V"); + if(ocr.TwoZero) sb.AppendLine("\tDevice can work with supply 2.0~2.1V"); + if(ocr.OneSix) sb.AppendLine("\tDevice can work with supply 1.65~1.95V"); return sb.ToString(); } @@ -159,10 +140,10 @@ namespace DiscImageChef.Decoders.MMC { return PrettifyOCR(DecodeOCR(response)); } - + public static string PrettifyOCR(uint response) { return PrettifyOCR(DecodeOCR(response)); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/MMC/VendorString.cs b/DiscImageChef.Decoders/MMC/VendorString.cs index 6181e061..feaa4160 100644 --- a/DiscImageChef.Decoders/MMC/VendorString.cs +++ b/DiscImageChef.Decoders/MMC/VendorString.cs @@ -38,11 +38,9 @@ namespace DiscImageChef.Decoders.MMC { switch(MMCVendorID) { - case 0x15: - return "Samsung"; - default: - return string.Format("Unknown manufacturer ID 0x{0:X2}", MMCVendorID); + case 0x15: return "Samsung"; + default: return string.Format("Unknown manufacturer ID 0x{0:X2}", MMCVendorID); } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/PCMCIA/CIS.cs b/DiscImageChef.Decoders/PCMCIA/CIS.cs index 1f8b6763..a61baf23 100644 --- a/DiscImageChef.Decoders/PCMCIA/CIS.cs +++ b/DiscImageChef.Decoders/PCMCIA/CIS.cs @@ -50,15 +50,13 @@ namespace DiscImageChef.Decoders.PCMCIA tuple.Code = (TupleCodes)data[position]; - if(tuple.Code == TupleCodes.CISTPL_NULL) - continue; - if(tuple.Code == TupleCodes.CISTPL_END) - break; + if(tuple.Code == TupleCodes.CISTPL_NULL) continue; + + if(tuple.Code == TupleCodes.CISTPL_END) break; tuple.Link = data[position + 1]; - if(position + 2 + tuple.Link > data.Length) - break; + if(position + 2 + tuple.Link > data.Length) break; tuple.Data = new byte[tuple.Link + 2]; Array.Copy(data, position, tuple.Data, 0, tuple.Link + 2); @@ -72,24 +70,19 @@ namespace DiscImageChef.Decoders.PCMCIA public static DeviceGeometryTuple DecodeDeviceGeometryTuple(Tuple tuple) { - if(tuple == null) - return null; + if(tuple == null) return null; - if(tuple.Code != TupleCodes.CISTPL_DEVICEGEO && tuple.Code != TupleCodes.CISTPL_DEVICEGEO_A) - return null; + if(tuple.Code != TupleCodes.CISTPL_DEVICEGEO && tuple.Code != TupleCodes.CISTPL_DEVICEGEO_A) return null; - if(tuple.Data == null) - return null; + if(tuple.Data == null) return null; return DecodeDeviceGeometryTuple(tuple.Data); } public static DeviceGeometryTuple DecodeDeviceGeometryTuple(byte[] data) { - if(data == null) - return null; - if((data.Length - 2) % 6 != 0) - return null; + if(data == null) return null; + if((data.Length - 2) % 6 != 0) return null; DeviceGeometryTuple tuple = new DeviceGeometryTuple(); List geometries = new List(); @@ -115,11 +108,9 @@ namespace DiscImageChef.Decoders.PCMCIA public static string PrettifyDeviceGeometryTuple(DeviceGeometryTuple tuple) { - if(tuple == null) - return null; + if(tuple == null) return null; - if(tuple.Code != TupleCodes.CISTPL_DEVICEGEO && tuple.Code != TupleCodes.CISTPL_DEVICEGEO_A) - return null; + if(tuple.Code != TupleCodes.CISTPL_DEVICEGEO && tuple.Code != TupleCodes.CISTPL_DEVICEGEO_A) return null; StringBuilder sb = new StringBuilder(); sb.AppendLine("PCMCIA Device Geometry Tuples:"); @@ -127,10 +118,15 @@ namespace DiscImageChef.Decoders.PCMCIA { sb.AppendLine("\tGeometry:"); sb.AppendFormat("\t\tDevice width: {0} bits", (1 << (geometry.CardInterface - 1)) * 8).AppendLine(); - sb.AppendFormat("\t\tErase block = {0} bytes", (1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1))).AppendLine(); - sb.AppendFormat("\t\tRead block = {0} bytes", (1 << (geometry.ReadBlockSize - 1)) * (1 << (geometry.Interleaving - 1))).AppendLine(); - sb.AppendFormat("\t\tWrite block = {0} bytes", (1 << (geometry.WriteBlockSize - 1)) * (1 << (geometry.Interleaving - 1))).AppendLine(); - sb.AppendFormat("\t\tPartition alignment = {0} bytes", (1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)) * (1 << (geometry.Partitions - 1))).AppendLine(); + sb.AppendFormat("\t\tErase block = {0} bytes", + (1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1))).AppendLine(); + sb.AppendFormat("\t\tRead block = {0} bytes", + (1 << (geometry.ReadBlockSize - 1)) * (1 << (geometry.Interleaving - 1))).AppendLine(); + sb.AppendFormat("\t\tWrite block = {0} bytes", + (1 << (geometry.WriteBlockSize - 1)) * (1 << (geometry.Interleaving - 1))).AppendLine(); + sb.AppendFormat("\t\tPartition alignment = {0} bytes", + (1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)) * + (1 << (geometry.Partitions - 1))).AppendLine(); } return sb.ToString(); @@ -148,25 +144,20 @@ namespace DiscImageChef.Decoders.PCMCIA public static ManufacturerIdentificationTuple DecodeManufacturerIdentificationTuple(Tuple tuple) { - if(tuple == null) - return null; + if(tuple == null) return null; - if(tuple.Code != TupleCodes.CISTPL_MANFID) - return null; + if(tuple.Code != TupleCodes.CISTPL_MANFID) return null; - if(tuple.Data == null) - return null; + if(tuple.Data == null) return null; return DecodeManufacturerIdentificationTuple(tuple.Data); } public static ManufacturerIdentificationTuple DecodeManufacturerIdentificationTuple(byte[] data) { - if(data == null) - return null; + if(data == null) return null; - if(data.Length < 6) - return null; + if(data.Length < 6) return null; ManufacturerIdentificationTuple tuple = new ManufacturerIdentificationTuple(); tuple.Code = (TupleCodes)data[0]; @@ -179,11 +170,9 @@ namespace DiscImageChef.Decoders.PCMCIA public static string PrettifyManufacturerIdentificationTuple(ManufacturerIdentificationTuple tuple) { - if(tuple == null) - return null; + if(tuple == null) return null; - if(tuple.Code != TupleCodes.CISTPL_MANFID) - return null; + if(tuple.Code != TupleCodes.CISTPL_MANFID) return null; StringBuilder sb = new StringBuilder(); sb.AppendLine("PCMCIA Manufacturer Identification Tuple:"); @@ -205,25 +194,20 @@ namespace DiscImageChef.Decoders.PCMCIA public static Level1VersionTuple DecodeLevel1VersionTuple(Tuple tuple) { - if(tuple == null) - return null; + if(tuple == null) return null; - if(tuple.Code != TupleCodes.CISTPL_VERS_1) - return null; + if(tuple.Code != TupleCodes.CISTPL_VERS_1) return null; - if(tuple.Data == null) - return null; + if(tuple.Data == null) return null; return DecodeLevel1VersionTuple(tuple.Data); } public static Level1VersionTuple DecodeLevel1VersionTuple(byte[] data) { - if(data == null) - return null; + if(data == null) return null; - if(data.Length < 4) - return null; + if(data.Length < 4) return null; List buffer = new List(); List strings = null; @@ -238,8 +222,7 @@ namespace DiscImageChef.Decoders.PCMCIA for(int position = 4; position < data.Length; position++) { - if(data[position] == 0xFF) - break; + if(data[position] == 0xFF) break; buffer.Add(data[position]); @@ -261,42 +244,35 @@ namespace DiscImageChef.Decoders.PCMCIA continue; } - if(strings == null) - strings = new List(); + if(strings == null) strings = new List(); strings.Add(StringHandlers.CToString(buffer.ToArray())); buffer = new List(); } } - if(strings != null) - tuple.AdditionalInformation = strings.ToArray(); + if(strings != null) tuple.AdditionalInformation = strings.ToArray(); return tuple; } public static string PrettifyLevel1VersionTuple(Level1VersionTuple tuple) { - if(tuple == null) - return null; + if(tuple == null) return null; - if(tuple.Code != TupleCodes.CISTPL_VERS_1) - return null; + if(tuple.Code != TupleCodes.CISTPL_VERS_1) return null; StringBuilder sb = new StringBuilder(); sb.AppendLine("PCMCIA Level 1 Version / Product Information Tuple:"); - sb.AppendFormat("\tCard indicates compliance with PC Card Standard Release {0}.{1}", tuple.MajorVersion, tuple.MinorVersion).AppendLine(); + sb.AppendFormat("\tCard indicates compliance with PC Card Standard Release {0}.{1}", tuple.MajorVersion, + tuple.MinorVersion).AppendLine(); - if(string.IsNullOrEmpty(tuple.Manufacturer)) - sb.AppendLine("\tNo manufacturer information string."); - else - sb.AppendFormat("\tManufacturer: {0}", tuple.Manufacturer).AppendLine(); + if(string.IsNullOrEmpty(tuple.Manufacturer)) sb.AppendLine("\tNo manufacturer information string."); + else sb.AppendFormat("\tManufacturer: {0}", tuple.Manufacturer).AppendLine(); - if(string.IsNullOrEmpty(tuple.Product)) - sb.AppendLine("\tNo product name string."); - else - sb.AppendFormat("\tProduct name: {0}", tuple.Product).AppendLine(); + if(string.IsNullOrEmpty(tuple.Product)) sb.AppendLine("\tNo product name string."); + else sb.AppendFormat("\tProduct name: {0}", tuple.Product).AppendLine(); if(tuple.AdditionalInformation == null || tuple.AdditionalInformation.Length == 0) sb.AppendLine("\tNo additional information."); @@ -305,8 +281,7 @@ namespace DiscImageChef.Decoders.PCMCIA sb.AppendLine("\tAdditional information:"); foreach(string info in tuple.AdditionalInformation) { - if(!string.IsNullOrEmpty(info)) - sb.AppendFormat("\t\t{0}", info).AppendLine(); + if(!string.IsNullOrEmpty(info)) sb.AppendFormat("\t\t{0}", info).AppendLine(); } } @@ -317,10 +292,10 @@ namespace DiscImageChef.Decoders.PCMCIA { return PrettifyLevel1VersionTuple(DecodeLevel1VersionTuple(tuple)); } - + public static string PrettifyLevel1VersionTuple(byte[] data) { return PrettifyLevel1VersionTuple(DecodeLevel1VersionTuple(data)); } -} -} + } +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/PCMCIA/Enums.cs b/DiscImageChef.Decoders/PCMCIA/Enums.cs index 782a0ebd..5a627639 100644 --- a/DiscImageChef.Decoders/PCMCIA/Enums.cs +++ b/DiscImageChef.Decoders/PCMCIA/Enums.cs @@ -287,4 +287,4 @@ namespace DiscImageChef.Decoders.PCMCIA HighSpeedSerial = 0x0B, VendorSpecific = 0xFE } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/PCMCIA/Types.cs b/DiscImageChef.Decoders/PCMCIA/Types.cs index f086ed02..2deeba6d 100644 --- a/DiscImageChef.Decoders/PCMCIA/Types.cs +++ b/DiscImageChef.Decoders/PCMCIA/Types.cs @@ -476,4 +476,4 @@ namespace DiscImageChef.Decoders.PCMCIA /// public ushort Cylinders; } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/PCMCIA/VendorCode.cs b/DiscImageChef.Decoders/PCMCIA/VendorCode.cs index 1066de14..c5a89a7c 100644 --- a/DiscImageChef.Decoders/PCMCIA/VendorCode.cs +++ b/DiscImageChef.Decoders/PCMCIA/VendorCode.cs @@ -39,635 +39,322 @@ namespace DiscImageChef.Decoders.PCMCIA switch(id) { #region JEDEC - case 0x01: - return "AMD"; - case 0x02: - return "AMI"; - case 0x83: - return "Fairchild"; - case 0x04: - return "Fujitsu"; - case 0x85: - return "GTE"; - case 0x86: - return "Harris"; - case 0x07: - return "Hitachi"; - case 0x08: - return "Inmos"; - case 0x89: - return "Intel"; - case 0x8A: - return "I.T.T."; - case 0x0B: - return "Intersil"; - case 0x8C: - return "Monolithic Memories"; - case 0x0D: - return "Mostek"; - case 0x0E: - return "Freescale"; - case 0x8F: - return "National"; - case 0x10: - return "NEC"; - case 0x91: - return "RCA"; - case 0x92: - return "Raytheon"; - case 0x13: - return "Conexant"; - case 0x94: - return "Seeq"; - case 0x15: - return "NXP"; - case 0x16: - return "Synertek"; - case 0x97: - return "Texas Instruments"; - case 0x98: - return "Toshiba"; - case 0x19: - return "Xicor"; - case 0x1A: - return "Zilog"; - case 0x9B: - return "Eurotechnique"; - case 0x1C: - return "Mitsubishi2"; - case 0x9D: - return "Lucent"; - case 0x9E: - return "Exel"; - case 0x1F: - return "Atmel"; - case 0x20: - return "SGS/Thomson"; - case 0xA1: - return "Lattice Semiconductor"; - case 0xA2: - return "NCR"; - case 0x23: - return "Wafer Scale Integration"; - case 0xA4: - return "International Business Machines"; - case 0x25: - return "Tristar"; - case 0x26: - return "Visic"; - case 0xA7: - return "International CMOS Technology"; - case 0xA8: - return "SSSI"; - case 0x29: - return "Microchip Technology"; - case 0x2A: - return "Ricoh"; - case 0xAB: - return "VLSI"; - case 0x2C: - return "Micron Technology"; - case 0xAD: - return "Hynix Semiconductor"; - case 0xAE: - return "OKI Semiconductor"; - case 0x2F: - return "ACTEL"; - case 0xB0: - return "Sharp"; - case 0x31: - return "Catalyst"; - case 0x32: - return "Panasonic"; - case 0xB3: - return "IDT"; - case 0x34: - return "Cypress"; - case 0xB5: - return "Digital Equipment Corporation"; - case 0xB6: - return "LSI Logic"; - case 0x37: - return "Zarlink"; - case 0x38: - return "UTMC"; - case 0xB9: - return "Thinking Machine"; - case 0xBA: - return "Thomson CSF"; - case 0x3B: - return "Integrated CMOS"; - case 0xBC: - return "Honeywell"; - case 0x3D: - return "Tektronix"; - case 0x3E: - return "Oracle Corporation"; - case 0xBF: - return "Silicon Storage Technology"; - case 0x40: - return "ProMos"; - case 0xC1: - return "Infineon"; - case 0xC2: - return "Macronix"; - case 0x43: - return "Xerox"; - case 0xC4: - return "Plus Logic"; - case 0x45: - return "SanDisk Corporation"; - case 0x46: - return "Elan Circuit Technology"; - case 0xC7: - return "European Silicon"; - case 0xC8: - return "Apple"; - case 0x49: - return "Xilinx"; - case 0x4A: - return "Compaq"; - case 0xCB: - return "Protocol Engines"; - case 0x4C: - return "SCI"; - case 0xCD: - return "Seiko Instruments"; - case 0xCE: - return "Samsung"; - case 0x4F: - return "I3 Design System"; - case 0xD0: - return "Klic"; - case 0x51: - return "Crosspoint Solutions"; - case 0x52: - return "Alliance Semiconductor"; - case 0xD3: - return "Tandem"; - case 0x54: - return "Hewlett-Packard"; - case 0xD5: - return "Integrated Silicon Solutions"; - case 0xD6: - return "Brooktree"; - case 0x57: - return "New Media"; - case 0x58: - return "MHS Electronic"; - case 0xD9: - return "Performance Semiconductors"; - case 0xDA: - return "Winbond Electronic"; - case 0x5B: - return "Kawasaki Steel"; - case 0x5D: - return "TECMAR"; - case 0x5E: - return "Exar"; - case 0xDF: - return "PCMCIA"; - case 0xE0: - return "LG Semiconductor"; - case 0x61: - return "Northern Telecom"; - case 0x62: - return "Sanyo2"; - case 0xE3: - return "Array Microsystems"; - case 0x64: - return "Crystal Semiconductor"; - case 0xE5: - return "Analog Devices"; - case 0xE6: - return "PMC-Sierra"; - case 0x67: - return "Asparix"; - case 0x68: - return "Convex Computer"; - case 0xE9: - return "Nimbus Technology"; - case 0x6B: - return "Transwitch"; - case 0xEC: - return "Micronas"; - case 0x6D: - return "Canon"; - case 0x6E: - return "Altera"; - case 0xEF: - return "NEXCOM"; - case 0x70: - return "Qualcomm"; - case 0xF1: - return "Sony"; - case 0xF2: - return "Cray Research"; - case 0x73: - return "AMS"; - case 0xF4: - return "Vitesse"; - case 0x75: - return "Aster Electronics"; - case 0x76: - return "Bay Networks"; - case 0xF7: - return "Zentrum"; - case 0xF8: - return "TRW"; - case 0x79: - return "Thesys"; - case 0x7A: - return "Solbourne Computer"; - case 0xFB: - return "Allied-Signal"; - case 0x7C: - return "Dialog Semiconductor"; - case 0xFD: - return "Media Vision"; - case 0xFE: - return "Numonyx Corporation"; - case 0x7F01: - return "Cirrus Logic"; - case 0x7F02: - return "National Instruments"; - case 0x7F04: - return "Alcatel Mietec"; - case 0x7F07: - return "JTAG Technologies"; - case 0x7F08: - return "Loral"; - case 0x7F0B: - return "Bestlink Systems"; - case 0x7F0D: - return "GENNUM"; - case 0x7F0E: - return "VideoLogic"; - case 0x7F10: - return "Chip Express"; - case 0x7F13: - return "TCSI"; - case 0x7F15: - return "Hughes Aircraft"; - case 0x7F16: - return "Lanstar Semiconductor"; - case 0x7F19: - return "Music Semi"; - case 0x7F1A: - return "Ericsson Components"; - case 0x7F1C: - return "Eon Silicon Devices"; - case 0x7F1F: - return "Integ.Memories Tech."; - case 0x7F20: - return "Corollary Inc."; - case 0x7F23: - return "EIV(Switzerland)"; - case 0x7F25: - return "Zarlink(formerly Mitel)"; - case 0x7F26: - return "Clearpoint"; - case 0x7F29: - return "Vanguard"; - case 0x7F2A: - return "Hagiwara Sys-Com"; - case 0x7F2C: - return "Celestica"; - case 0x7F2F: - return "Rohm Company Ltd."; - case 0x7F31: - return "Libit Signal Processing"; - case 0x7F32: - return "Enhanced Memories Inc."; - case 0x7F34: - return "Adaptec Inc."; - case 0x7F37: - return "AMIC Technology"; - case 0x7F38: - return "Adobe Systems"; - case 0x7F3B: - return "Newport Digital"; - case 0x7F3D: - return "T Square"; - case 0x7F3E: - return "Seiko Epson"; - case 0x7F40: - return "Viking Components"; - case 0x7F43: - return "Suwa Electronics"; - case 0x7F45: - return "Micron CMS"; - case 0x7F46: - return "American Computer &Digital Components Inc"; - case 0x7F49: - return "CPU Design"; - case 0x7F4A: - return "Price Point"; - case 0x7F4C: - return "Tellabs"; - case 0x7F4F: - return "Transcend Information"; - case 0x7F51: - return "CKD Corporation Ltd."; - case 0x7F52: - return "Capital Instruments, Inc."; - case 0x7F54: - return "Linvex Technology"; - case 0x7F57: - return "Dynamem, Inc."; - case 0x7F58: - return "NERA ASA"; - case 0x7F5B: - return "Acorn Computers"; - case 0x7F5D: - return "Oak Technology, Inc."; - case 0x7F5E: - return "Itec Memory"; - case 0x7F61: - return "Wintec Industries"; - case 0x7F62: - return "Super PC Memory"; - case 0x7F64: - return "Galvantech"; - case 0x7F67: - return "GateField"; - case 0x7F68: - return "Integrated Memory System"; - case 0x7F6B: - return "Goldenram"; - case 0x7F6D: - return "Cimaron Communications"; - case 0x7F6E: - return "Nippon Steel Semi.Corp."; - case 0x7F70: - return "AMCC"; - case 0x7F73: - return "Digital Microwave"; - case 0x7F75: - return "MIMOS Semiconductor"; - case 0x7F76: - return "Advanced Fibre"; - case 0x7F79: - return "Acbel Polytech Inc."; - case 0x7F7A: - return "Apacer Technology"; - case 0x7F7C: - return "FOXCONN"; - case 0x7F83: - return "ILC Data Device"; - case 0x7F85: - return "Micro Linear"; - case 0x7F86: - return "Univ.Of NC"; - case 0x7F89: - return "Nchip"; - case 0x7F8A: - return "Galileo Tech"; - case 0x7F8C: - return "Graychip"; - case 0x7F8F: - return "Robert Bosch"; - case 0x7F91: - return "DATARAM"; - case 0x7F92: - return "United Microelec Corp."; - case 0x7F94: - return "Smart Modular"; - case 0x7F97: - return "Qlogic"; - case 0x7F98: - return "Kingston"; - case 0x7F9B: - return "SpaSE"; - case 0x7F9D: - return "Programmable Micro Corp"; - case 0x7F9E: - return "DoD"; - case 0x7FA1: - return "Dallas Semiconductor"; - case 0x7FA2: - return "Omnivision"; - case 0x7FA4: - return "Novatel Wireless"; - case 0x7FA7: - return "Cabletron"; - case 0x7FA8: - return "Silicon Technology"; - case 0x7FAB: - return "Vantis"; - case 0x7FAD: - return "Century"; - case 0x7FAE: - return "Hal Computers"; - case 0x7FB0: - return "Juniper Networks"; - case 0x7FB3: - return "Tundra Semiconductor"; - case 0x7FB5: - return "LightSpeed Semi."; - case 0x7FB6: - return "ZSP Corp."; - case 0x7FB9: - return "Dynachip"; - case 0x7FBA: - return "PNY Electronics"; - case 0x7FBC: - return "MMC Networks"; - case 0x7FBF: - return "Broadcom"; - case 0x7FC1: - return "V3 Semiconductor"; - case 0x7FC2: - return "Flextronics(formerly Orbit)"; - case 0x7FC4: - return "Transmeta"; - case 0x7FC7: - return "Enhance 3000 Inc"; - case 0x7FC8: - return "Tower Semiconductor"; - case 0x7FCB: - return "Maxim Integrated Product"; - case 0x7FCD: - return "Centaur Technology"; - case 0x7FCE: - return "Unigen Corporation"; - case 0x7FD0: - return "Memory Card Technology"; - case 0x7FD3: - return "Aica Kogyo, Ltd."; - case 0x7FD5: - return "MSC Vertriebs GmbH"; - case 0x7FD6: - return "AKM Company, Ltd."; - case 0x7FD9: - return "GSI Technology"; - case 0x7FDA: - return "Dane-Elec (C Memory)"; - case 0x7FDC: - return "Lara Technology"; - case 0x7FDF: - return "Tanisys Technology"; - case 0x7FE0: - return "Truevision"; - case 0x7FE3: - return "MGV Memory"; - case 0x7FE5: - return "Gadzoox Networks"; - case 0x7FE6: - return "Multi Dimensional Cons."; - case 0x7FE9: - return "Triscend"; - case 0x7FEA: - return "XaQti"; - case 0x7FEC: - return "Clear Logic"; - case 0x7FEF: - return "Advantage Memory"; - case 0x7FF1: - return "LeCroy"; - case 0x7FF2: - return "Yamaha Corporation"; - case 0x7FF4: - return "NetLogic Microsystems"; - case 0x7FF7: - return "BF Goodrich Data."; - case 0x7FF8: - return "Epigram"; - case 0x7FFB: - return "Admor Memory"; - case 0x7FFD: - return "Quadratics Superconductor"; - case 0x7FFE: - return "3COM"; + case 0x01: return "AMD"; + case 0x02: return "AMI"; + case 0x83: return "Fairchild"; + case 0x04: return "Fujitsu"; + case 0x85: return "GTE"; + case 0x86: return "Harris"; + case 0x07: return "Hitachi"; + case 0x08: return "Inmos"; + case 0x89: return "Intel"; + case 0x8A: return "I.T.T."; + case 0x0B: return "Intersil"; + case 0x8C: return "Monolithic Memories"; + case 0x0D: return "Mostek"; + case 0x0E: return "Freescale"; + case 0x8F: return "National"; + case 0x10: return "NEC"; + case 0x91: return "RCA"; + case 0x92: return "Raytheon"; + case 0x13: return "Conexant"; + case 0x94: return "Seeq"; + case 0x15: return "NXP"; + case 0x16: return "Synertek"; + case 0x97: return "Texas Instruments"; + case 0x98: return "Toshiba"; + case 0x19: return "Xicor"; + case 0x1A: return "Zilog"; + case 0x9B: return "Eurotechnique"; + case 0x1C: return "Mitsubishi2"; + case 0x9D: return "Lucent"; + case 0x9E: return "Exel"; + case 0x1F: return "Atmel"; + case 0x20: return "SGS/Thomson"; + case 0xA1: return "Lattice Semiconductor"; + case 0xA2: return "NCR"; + case 0x23: return "Wafer Scale Integration"; + case 0xA4: return "International Business Machines"; + case 0x25: return "Tristar"; + case 0x26: return "Visic"; + case 0xA7: return "International CMOS Technology"; + case 0xA8: return "SSSI"; + case 0x29: return "Microchip Technology"; + case 0x2A: return "Ricoh"; + case 0xAB: return "VLSI"; + case 0x2C: return "Micron Technology"; + case 0xAD: return "Hynix Semiconductor"; + case 0xAE: return "OKI Semiconductor"; + case 0x2F: return "ACTEL"; + case 0xB0: return "Sharp"; + case 0x31: return "Catalyst"; + case 0x32: return "Panasonic"; + case 0xB3: return "IDT"; + case 0x34: return "Cypress"; + case 0xB5: return "Digital Equipment Corporation"; + case 0xB6: return "LSI Logic"; + case 0x37: return "Zarlink"; + case 0x38: return "UTMC"; + case 0xB9: return "Thinking Machine"; + case 0xBA: return "Thomson CSF"; + case 0x3B: return "Integrated CMOS"; + case 0xBC: return "Honeywell"; + case 0x3D: return "Tektronix"; + case 0x3E: return "Oracle Corporation"; + case 0xBF: return "Silicon Storage Technology"; + case 0x40: return "ProMos"; + case 0xC1: return "Infineon"; + case 0xC2: return "Macronix"; + case 0x43: return "Xerox"; + case 0xC4: return "Plus Logic"; + case 0x45: return "SanDisk Corporation"; + case 0x46: return "Elan Circuit Technology"; + case 0xC7: return "European Silicon"; + case 0xC8: return "Apple"; + case 0x49: return "Xilinx"; + case 0x4A: return "Compaq"; + case 0xCB: return "Protocol Engines"; + case 0x4C: return "SCI"; + case 0xCD: return "Seiko Instruments"; + case 0xCE: return "Samsung"; + case 0x4F: return "I3 Design System"; + case 0xD0: return "Klic"; + case 0x51: return "Crosspoint Solutions"; + case 0x52: return "Alliance Semiconductor"; + case 0xD3: return "Tandem"; + case 0x54: return "Hewlett-Packard"; + case 0xD5: return "Integrated Silicon Solutions"; + case 0xD6: return "Brooktree"; + case 0x57: return "New Media"; + case 0x58: return "MHS Electronic"; + case 0xD9: return "Performance Semiconductors"; + case 0xDA: return "Winbond Electronic"; + case 0x5B: return "Kawasaki Steel"; + case 0x5D: return "TECMAR"; + case 0x5E: return "Exar"; + case 0xDF: return "PCMCIA"; + case 0xE0: return "LG Semiconductor"; + case 0x61: return "Northern Telecom"; + case 0x62: return "Sanyo2"; + case 0xE3: return "Array Microsystems"; + case 0x64: return "Crystal Semiconductor"; + case 0xE5: return "Analog Devices"; + case 0xE6: return "PMC-Sierra"; + case 0x67: return "Asparix"; + case 0x68: return "Convex Computer"; + case 0xE9: return "Nimbus Technology"; + case 0x6B: return "Transwitch"; + case 0xEC: return "Micronas"; + case 0x6D: return "Canon"; + case 0x6E: return "Altera"; + case 0xEF: return "NEXCOM"; + case 0x70: return "Qualcomm"; + case 0xF1: return "Sony"; + case 0xF2: return "Cray Research"; + case 0x73: return "AMS"; + case 0xF4: return "Vitesse"; + case 0x75: return "Aster Electronics"; + case 0x76: return "Bay Networks"; + case 0xF7: return "Zentrum"; + case 0xF8: return "TRW"; + case 0x79: return "Thesys"; + case 0x7A: return "Solbourne Computer"; + case 0xFB: return "Allied-Signal"; + case 0x7C: return "Dialog Semiconductor"; + case 0xFD: return "Media Vision"; + case 0xFE: return "Numonyx Corporation"; + case 0x7F01: return "Cirrus Logic"; + case 0x7F02: return "National Instruments"; + case 0x7F04: return "Alcatel Mietec"; + case 0x7F07: return "JTAG Technologies"; + case 0x7F08: return "Loral"; + case 0x7F0B: return "Bestlink Systems"; + case 0x7F0D: return "GENNUM"; + case 0x7F0E: return "VideoLogic"; + case 0x7F10: return "Chip Express"; + case 0x7F13: return "TCSI"; + case 0x7F15: return "Hughes Aircraft"; + case 0x7F16: return "Lanstar Semiconductor"; + case 0x7F19: return "Music Semi"; + case 0x7F1A: return "Ericsson Components"; + case 0x7F1C: return "Eon Silicon Devices"; + case 0x7F1F: return "Integ.Memories Tech."; + case 0x7F20: return "Corollary Inc."; + case 0x7F23: return "EIV(Switzerland)"; + case 0x7F25: return "Zarlink(formerly Mitel)"; + case 0x7F26: return "Clearpoint"; + case 0x7F29: return "Vanguard"; + case 0x7F2A: return "Hagiwara Sys-Com"; + case 0x7F2C: return "Celestica"; + case 0x7F2F: return "Rohm Company Ltd."; + case 0x7F31: return "Libit Signal Processing"; + case 0x7F32: return "Enhanced Memories Inc."; + case 0x7F34: return "Adaptec Inc."; + case 0x7F37: return "AMIC Technology"; + case 0x7F38: return "Adobe Systems"; + case 0x7F3B: return "Newport Digital"; + case 0x7F3D: return "T Square"; + case 0x7F3E: return "Seiko Epson"; + case 0x7F40: return "Viking Components"; + case 0x7F43: return "Suwa Electronics"; + case 0x7F45: return "Micron CMS"; + case 0x7F46: return "American Computer &Digital Components Inc"; + case 0x7F49: return "CPU Design"; + case 0x7F4A: return "Price Point"; + case 0x7F4C: return "Tellabs"; + case 0x7F4F: return "Transcend Information"; + case 0x7F51: return "CKD Corporation Ltd."; + case 0x7F52: return "Capital Instruments, Inc."; + case 0x7F54: return "Linvex Technology"; + case 0x7F57: return "Dynamem, Inc."; + case 0x7F58: return "NERA ASA"; + case 0x7F5B: return "Acorn Computers"; + case 0x7F5D: return "Oak Technology, Inc."; + case 0x7F5E: return "Itec Memory"; + case 0x7F61: return "Wintec Industries"; + case 0x7F62: return "Super PC Memory"; + case 0x7F64: return "Galvantech"; + case 0x7F67: return "GateField"; + case 0x7F68: return "Integrated Memory System"; + case 0x7F6B: return "Goldenram"; + case 0x7F6D: return "Cimaron Communications"; + case 0x7F6E: return "Nippon Steel Semi.Corp."; + case 0x7F70: return "AMCC"; + case 0x7F73: return "Digital Microwave"; + case 0x7F75: return "MIMOS Semiconductor"; + case 0x7F76: return "Advanced Fibre"; + case 0x7F79: return "Acbel Polytech Inc."; + case 0x7F7A: return "Apacer Technology"; + case 0x7F7C: return "FOXCONN"; + case 0x7F83: return "ILC Data Device"; + case 0x7F85: return "Micro Linear"; + case 0x7F86: return "Univ.Of NC"; + case 0x7F89: return "Nchip"; + case 0x7F8A: return "Galileo Tech"; + case 0x7F8C: return "Graychip"; + case 0x7F8F: return "Robert Bosch"; + case 0x7F91: return "DATARAM"; + case 0x7F92: return "United Microelec Corp."; + case 0x7F94: return "Smart Modular"; + case 0x7F97: return "Qlogic"; + case 0x7F98: return "Kingston"; + case 0x7F9B: return "SpaSE"; + case 0x7F9D: return "Programmable Micro Corp"; + case 0x7F9E: return "DoD"; + case 0x7FA1: return "Dallas Semiconductor"; + case 0x7FA2: return "Omnivision"; + case 0x7FA4: return "Novatel Wireless"; + case 0x7FA7: return "Cabletron"; + case 0x7FA8: return "Silicon Technology"; + case 0x7FAB: return "Vantis"; + case 0x7FAD: return "Century"; + case 0x7FAE: return "Hal Computers"; + case 0x7FB0: return "Juniper Networks"; + case 0x7FB3: return "Tundra Semiconductor"; + case 0x7FB5: return "LightSpeed Semi."; + case 0x7FB6: return "ZSP Corp."; + case 0x7FB9: return "Dynachip"; + case 0x7FBA: return "PNY Electronics"; + case 0x7FBC: return "MMC Networks"; + case 0x7FBF: return "Broadcom"; + case 0x7FC1: return "V3 Semiconductor"; + case 0x7FC2: return "Flextronics(formerly Orbit)"; + case 0x7FC4: return "Transmeta"; + case 0x7FC7: return "Enhance 3000 Inc"; + case 0x7FC8: return "Tower Semiconductor"; + case 0x7FCB: return "Maxim Integrated Product"; + case 0x7FCD: return "Centaur Technology"; + case 0x7FCE: return "Unigen Corporation"; + case 0x7FD0: return "Memory Card Technology"; + case 0x7FD3: return "Aica Kogyo, Ltd."; + case 0x7FD5: return "MSC Vertriebs GmbH"; + case 0x7FD6: return "AKM Company, Ltd."; + case 0x7FD9: return "GSI Technology"; + case 0x7FDA: return "Dane-Elec (C Memory)"; + case 0x7FDC: return "Lara Technology"; + case 0x7FDF: return "Tanisys Technology"; + case 0x7FE0: return "Truevision"; + case 0x7FE3: return "MGV Memory"; + case 0x7FE5: return "Gadzoox Networks"; + case 0x7FE6: return "Multi Dimensional Cons."; + case 0x7FE9: return "Triscend"; + case 0x7FEA: return "XaQti"; + case 0x7FEC: return "Clear Logic"; + case 0x7FEF: return "Advantage Memory"; + case 0x7FF1: return "LeCroy"; + case 0x7FF2: return "Yamaha Corporation"; + case 0x7FF4: return "NetLogic Microsystems"; + case 0x7FF7: return "BF Goodrich Data."; + case 0x7FF8: return "Epigram"; + case 0x7FFB: return "Admor Memory"; + case 0x7FFD: return "Quadratics Superconductor"; + case 0x7FFE: return "3COM"; #endregion JEDEC - case 0x0100: - return "Digital Equipment Corporation"; - case 0x0101: - return "3Com Corporation"; - case 0x0102: - return "Megahertz Corporation"; - case 0x0104: - return "Socket Communications"; - case 0x0105: - return "TDK Corporation"; - case 0x0108: - return "Standard Microsystems Corporation"; - case 0x0109: - return "Motorola Corporation"; - case 0x010b: - return "National Instruments"; - case 0x0115: - return "US Robotics Corporation"; - case 0x0121: - return "Olicom"; - case 0x0126: - return "Proxim"; - case 0x0128: - return "Megahertz Corporation"; - case 0x012F: - return "Adaptec Corporation"; - case 0x0137: - return "Quatech"; - case 0x0138: - return "Compaq"; - case 0x0140: - return "Ositech"; - case 0x0143: - return "D-Link"; - case 0x0149: - return "Netgear"; - case 0x014D: - return "Simple Technology"; - case 0x0156: - return "Lucent Technologies"; - case 0x015F: - return "Aironet Wireless Communications"; - case 0x016B: - return "Ericsson"; - case 0x016C: - return "Psion"; - case 0x0183: - return "Compaq"; - case 0x0186: - return "Kingston"; - case 0x0192: - return "Sierra Wireless"; - case 0x0194: - return "Dayna Corporation"; - case 0x01a6: - return "Raytheon"; - case 0x01BF: - return "Belkin"; - case 0x01EB: - return "Bay Networks"; - case 0x0200: - return "Farallon Communications"; - case 0x021B: - return "Telecom Device"; - case 0x023D: - return "Nokia Communications"; - case 0x0250: - return "Samsung"; - case 0x0264: - return "Anycom"; - case 0x0268: - return "Alvarion Ltd."; - case 0x026C: - return "Symbol"; - case 0x026F: - return "BUFFALO"; - case 0x0274: - return "The Linksys Group"; - case 0x0288: - return "NEC Infrontia"; - case 0x028A: - return "I-O DATA"; - case 0x02AA: - return "Asustek Computer"; - case 0x02AC: - return "Siemens"; - case 0x02D2: - return "Microsoft Corporation"; - case 0x02DF: - return "AmbiCom Inc"; - case 0x0a02: - return "BreezeCOM"; - case 0x10CD: - return "NewMedia"; - case 0x1668: - return "ACTIONTEC"; - case 0x3401: - return "Lasat Communications A/S"; - case 0x4E01: - return "Lexar Media"; - case 0x5241: - return "Archos"; - case 0x890F: - return "Dual"; - case 0x8A01: - return "Compex Corporation"; - case 0xC001: - return "Contec"; - case 0xC00B: - return "MACNICA"; - case 0xC00C: - return "Roland"; - case 0xC00F: - return "Corega K.K."; - case 0xC012: - return "Hagiwara SYS-COM"; - case 0xC015: - return "RATOC System Inc."; - case 0xC020: - return "NextCom K.K."; - case 0xC250: - return "EMTAC Technology Corporation"; - case 0xD601: - return "Elsa"; - default: - return string.Format("Unknown vendor id 0x{0:X4}", id); + case 0x0100: return "Digital Equipment Corporation"; + case 0x0101: return "3Com Corporation"; + case 0x0102: return "Megahertz Corporation"; + case 0x0104: return "Socket Communications"; + case 0x0105: return "TDK Corporation"; + case 0x0108: return "Standard Microsystems Corporation"; + case 0x0109: return "Motorola Corporation"; + case 0x010b: return "National Instruments"; + case 0x0115: return "US Robotics Corporation"; + case 0x0121: return "Olicom"; + case 0x0126: return "Proxim"; + case 0x0128: return "Megahertz Corporation"; + case 0x012F: return "Adaptec Corporation"; + case 0x0137: return "Quatech"; + case 0x0138: return "Compaq"; + case 0x0140: return "Ositech"; + case 0x0143: return "D-Link"; + case 0x0149: return "Netgear"; + case 0x014D: return "Simple Technology"; + case 0x0156: return "Lucent Technologies"; + case 0x015F: return "Aironet Wireless Communications"; + case 0x016B: return "Ericsson"; + case 0x016C: return "Psion"; + case 0x0183: return "Compaq"; + case 0x0186: return "Kingston"; + case 0x0192: return "Sierra Wireless"; + case 0x0194: return "Dayna Corporation"; + case 0x01a6: return "Raytheon"; + case 0x01BF: return "Belkin"; + case 0x01EB: return "Bay Networks"; + case 0x0200: return "Farallon Communications"; + case 0x021B: return "Telecom Device"; + case 0x023D: return "Nokia Communications"; + case 0x0250: return "Samsung"; + case 0x0264: return "Anycom"; + case 0x0268: return "Alvarion Ltd."; + case 0x026C: return "Symbol"; + case 0x026F: return "BUFFALO"; + case 0x0274: return "The Linksys Group"; + case 0x0288: return "NEC Infrontia"; + case 0x028A: return "I-O DATA"; + case 0x02AA: return "Asustek Computer"; + case 0x02AC: return "Siemens"; + case 0x02D2: return "Microsoft Corporation"; + case 0x02DF: return "AmbiCom Inc"; + case 0x0a02: return "BreezeCOM"; + case 0x10CD: return "NewMedia"; + case 0x1668: return "ACTIONTEC"; + case 0x3401: return "Lasat Communications A/S"; + case 0x4E01: return "Lexar Media"; + case 0x5241: return "Archos"; + case 0x890F: return "Dual"; + case 0x8A01: return "Compex Corporation"; + case 0xC001: return "Contec"; + case 0xC00B: return "MACNICA"; + case 0xC00C: return "Roland"; + case 0xC00F: return "Corega K.K."; + case 0xC012: return "Hagiwara SYS-COM"; + case 0xC015: return "RATOC System Inc."; + case 0xC020: return "NextCom K.K."; + case 0xC250: return "EMTAC Technology Corporation"; + case 0xD601: return "Elsa"; + default: return string.Format("Unknown vendor id 0x{0:X4}", id); } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Properties/AssemblyInfo.cs b/DiscImageChef.Decoders/Properties/AssemblyInfo.cs index b8897b0b..d12c190b 100644 --- a/DiscImageChef.Decoders/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Decoders/Properties/AssemblyInfo.cs @@ -54,5 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs b/DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs index 24fadebd..b4289f4e 100644 --- a/DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs +++ b/DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs @@ -56,8 +56,7 @@ namespace DiscImageChef.Decoders.SCSI { ushort len = (ushort)((response[0] << 8) + response[1]); - if(len + 2 != response.Length) - return null; + if(len + 2 != response.Length) return null; List caps = new List(); @@ -76,5 +75,4 @@ namespace DiscImageChef.Decoders.SCSI return caps.ToArray(); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/EVPD.cs b/DiscImageChef.Decoders/SCSI/EVPD.cs index fb60125a..4722f477 100644 --- a/DiscImageChef.Decoders/SCSI/EVPD.cs +++ b/DiscImageChef.Decoders/SCSI/EVPD.cs @@ -47,14 +47,11 @@ namespace DiscImageChef.Decoders.SCSI /// Page 0x00. public static byte[] DecodePage00(byte[] page) { - if(page == null) - return null; + if(page == null) return null; - if(page[1] != 0) - return null; + if(page[1] != 0) return null; - if(page.Length != page[3] + 4) - return null; + if(page.Length != page[3] + 4) return null; byte[] decoded = new byte[page.Length - 4]; @@ -70,14 +67,11 @@ namespace DiscImageChef.Decoders.SCSI /// Page 0x01-0x7F. public static string DecodeASCIIPage(byte[] page) { - if(page == null) - return null; + if(page == null) return null; - if(page[1] == 0 || page[1] > 0x7F) - return null; + if(page[1] == 0 || page[1] > 0x7F) return null; - if(page.Length != page[3] + 4) - return null; + if(page.Length != page[3] + 4) return null; byte[] ascii = new byte[page[4]]; @@ -93,14 +87,11 @@ namespace DiscImageChef.Decoders.SCSI /// Page 0x80. public static string DecodePage80(byte[] page) { - if(page == null) - return null; + if(page == null) return null; - if(page[1] != 0x80) - return null; + if(page[1] != 0x80) return null; - if(page.Length != page[3] + 4) - return null; + if(page.Length != page[3] + 4) return null; byte[] ascii = new byte[page.Length - 4]; @@ -110,7 +101,6 @@ namespace DiscImageChef.Decoders.SCSI } #region EVPD Page 0x81: Implemented operating definition page - /// /// Implemented operating definition page /// Page code 0x81 @@ -149,17 +139,13 @@ namespace DiscImageChef.Decoders.SCSI public static Page_81? DecodePage_81(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0x81) - return null; + if(pageResponse[1] != 0x81) return null; - if(pageResponse[3] + 4 != pageResponse.Length) - return null; + if(pageResponse[3] + 4 != pageResponse.Length) return null; - if(pageResponse.Length < 6) - return null; + if(pageResponse.Length < 6) return null; Page_81 decoded = new Page_81(); @@ -193,25 +179,18 @@ namespace DiscImageChef.Decoders.SCSI { switch(definition) { - case ScsiDefinitions.Current: - return ""; - case ScsiDefinitions.CCS: - return "CCS"; - case ScsiDefinitions.SCSI1: - return "SCSI-1"; - case ScsiDefinitions.SCSI2: - return "SCSI-2"; - case ScsiDefinitions.SCSI3: - return "SCSI-3"; - default: - return string.Format("Unknown definition code {0}", (byte)definition); + case ScsiDefinitions.Current: return ""; + case ScsiDefinitions.CCS: return "CCS"; + case ScsiDefinitions.SCSI1: return "SCSI-1"; + case ScsiDefinitions.SCSI2: return "SCSI-2"; + case ScsiDefinitions.SCSI3: return "SCSI-3"; + default: return string.Format("Unknown definition code {0}", (byte)definition); } } public static string PrettifyPage_81(Page_81? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_81 page = modePage.Value; StringBuilder sb = new StringBuilder(); @@ -233,7 +212,6 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion EVPD Page 0x81: Implemented operating definition page /// @@ -243,14 +221,11 @@ namespace DiscImageChef.Decoders.SCSI /// Page 0x82. public static string DecodePage82(byte[] page) { - if(page == null) - return null; + if(page == null) return null; - if(page[1] != 0x82) - return null; + if(page[1] != 0x82) return null; - if(page.Length != page[3] + 4) - return null; + if(page.Length != page[3] + 4) return null; byte[] ascii = new byte[page.Length - 4]; @@ -260,7 +235,6 @@ namespace DiscImageChef.Decoders.SCSI } #region EVPD Page 0x83: Device identification page - public enum IdentificationAssociation : byte { /// @@ -403,17 +377,13 @@ namespace DiscImageChef.Decoders.SCSI public static Page_83? DecodePage_83(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0x83) - return null; + if(pageResponse[1] != 0x83) return null; - if(pageResponse[3] + 4 != pageResponse.Length) - return null; + if(pageResponse[3] + 4 != pageResponse.Length) return null; - if(pageResponse.Length < 6) - return null; + if(pageResponse.Length < 6) return null; Page_83 decoded = new Page_83(); @@ -441,8 +411,7 @@ namespace DiscImageChef.Decoders.SCSI descriptor.ASCII = StringHandlers.CToString(descriptor.Binary); else if(descriptor.CodeSet == IdentificationCodeSet.UTF8) descriptor.ASCII = Encoding.UTF8.GetString(descriptor.Binary); - else - descriptor.ASCII = ""; + else descriptor.ASCII = ""; position += 4 + descriptor.Length; descriptors.Add(descriptor); @@ -460,8 +429,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyPage_83(Page_83? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_83 page = modePage.Value; StringBuilder sb = new StringBuilder(); @@ -488,7 +456,8 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("\tIdentifier belongs to target device that contains the addressed logical unit"); break; default: - sb.AppendFormat("\tIndentifier has unknown association with code {0}", (byte)descriptor.Association).AppendLine(); + sb.AppendFormat("\tIndentifier has unknown association with code {0}", + (byte)descriptor.Association).AppendLine(); break; } @@ -540,156 +509,227 @@ namespace DiscImageChef.Decoders.SCSI protocol = string.Format("unknown code {0}", (byte)descriptor.ProtocolIdentifier); break; } + sb.AppendFormat("\tDescriptor referes to {0} protocol", protocol).AppendLine(); } switch(descriptor.Type) { case IdentificationTypes.NoAuthority: - if(descriptor.CodeSet == IdentificationCodeSet.ASCII || descriptor.CodeSet == IdentificationCodeSet.UTF8) + if(descriptor.CodeSet == IdentificationCodeSet.ASCII || + descriptor.CodeSet == IdentificationCodeSet.UTF8) sb.AppendFormat("\tVendor descriptor contains: {0}", descriptor.ASCII).AppendLine(); else if(descriptor.CodeSet == IdentificationCodeSet.Binary) - sb.AppendFormat("\tVendor descriptor contains binary data (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); + sb.AppendFormat("\tVendor descriptor contains binary data (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); else - sb.AppendFormat("\tVendor descriptor contains unknown kind {1} of data (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40), (byte)descriptor.CodeSet).AppendLine(); + sb.AppendFormat("\tVendor descriptor contains unknown kind {1} of data (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40), + (byte)descriptor.CodeSet).AppendLine(); break; case IdentificationTypes.Inquiry: - if(descriptor.CodeSet == IdentificationCodeSet.ASCII || descriptor.CodeSet == IdentificationCodeSet.UTF8) + if(descriptor.CodeSet == IdentificationCodeSet.ASCII || + descriptor.CodeSet == IdentificationCodeSet.UTF8) sb.AppendFormat("\tInquiry descriptor contains: {0}", descriptor.ASCII).AppendLine(); else if(descriptor.CodeSet == IdentificationCodeSet.Binary) - sb.AppendFormat("\tInquiry descriptor contains binary data (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); + sb.AppendFormat("\tInquiry descriptor contains binary data (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); else - sb.AppendFormat("\tInquiry descriptor contains unknown kind {1} of data (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40), (byte)descriptor.CodeSet).AppendLine(); + sb.AppendFormat("\tInquiry descriptor contains unknown kind {1} of data (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40), + (byte)descriptor.CodeSet).AppendLine(); break; case IdentificationTypes.EUI: - if(descriptor.CodeSet == IdentificationCodeSet.ASCII || descriptor.CodeSet == IdentificationCodeSet.UTF8) + if(descriptor.CodeSet == IdentificationCodeSet.ASCII || + descriptor.CodeSet == IdentificationCodeSet.UTF8) sb.AppendFormat("\tIEEE EUI-64: {0}", descriptor.ASCII).AppendLine(); else { sb.AppendFormat("\tIEEE EUI-64: {0:X2}", descriptor.Binary[0]); for(int i = 1; i < descriptor.Binary.Length; i++) sb.AppendFormat(":{0:X2}", descriptor.Binary[i]); + sb.AppendLine(); } + break; case IdentificationTypes.NAA: - if(descriptor.CodeSet == IdentificationCodeSet.ASCII || descriptor.CodeSet == IdentificationCodeSet.UTF8) + if(descriptor.CodeSet == IdentificationCodeSet.ASCII || + descriptor.CodeSet == IdentificationCodeSet.UTF8) sb.AppendFormat("\tNAA: {0}", descriptor.ASCII).AppendLine(); else { sb.AppendFormat("\tNAA: {0:X2}", descriptor.Binary[0]); for(int i = 1; i < descriptor.Binary.Length; i++) sb.AppendFormat(":{0:X2}", descriptor.Binary[i]); + sb.AppendLine(); } + break; case IdentificationTypes.Relative: - if(descriptor.CodeSet == IdentificationCodeSet.ASCII || descriptor.CodeSet == IdentificationCodeSet.UTF8) + if(descriptor.CodeSet == IdentificationCodeSet.ASCII || + descriptor.CodeSet == IdentificationCodeSet.UTF8) sb.AppendFormat("\tRelative target port identifier: {0}", descriptor.ASCII).AppendLine(); else - sb.AppendFormat("\tRelative target port identifier: {0}", (descriptor.Binary[2] << 8) + descriptor.Binary[3]).AppendLine(); + sb.AppendFormat("\tRelative target port identifier: {0}", + (descriptor.Binary[2] << 8) + descriptor.Binary[3]).AppendLine(); break; case IdentificationTypes.TargetPortGroup: - if(descriptor.CodeSet == IdentificationCodeSet.ASCII || descriptor.CodeSet == IdentificationCodeSet.UTF8) + if(descriptor.CodeSet == IdentificationCodeSet.ASCII || + descriptor.CodeSet == IdentificationCodeSet.UTF8) sb.AppendFormat("\tTarget group identifier: {0}", descriptor.ASCII).AppendLine(); else - sb.AppendFormat("\tTarget group identifier: {0}", (descriptor.Binary[2] << 8) + descriptor.Binary[3]).AppendLine(); + sb.AppendFormat("\tTarget group identifier: {0}", + (descriptor.Binary[2] << 8) + descriptor.Binary[3]).AppendLine(); break; case IdentificationTypes.LogicalUnitGroup: - if(descriptor.CodeSet == IdentificationCodeSet.ASCII || descriptor.CodeSet == IdentificationCodeSet.UTF8) + if(descriptor.CodeSet == IdentificationCodeSet.ASCII || + descriptor.CodeSet == IdentificationCodeSet.UTF8) sb.AppendFormat("\tLogical unit group identifier: {0}", descriptor.ASCII).AppendLine(); else - sb.AppendFormat("\tLogical unit group identifier: {0}", (descriptor.Binary[2] << 8) + descriptor.Binary[3]).AppendLine(); + sb.AppendFormat("\tLogical unit group identifier: {0}", + (descriptor.Binary[2] << 8) + descriptor.Binary[3]).AppendLine(); break; case IdentificationTypes.MD5: - if(descriptor.CodeSet == IdentificationCodeSet.ASCII || descriptor.CodeSet == IdentificationCodeSet.UTF8) + if(descriptor.CodeSet == IdentificationCodeSet.ASCII || + descriptor.CodeSet == IdentificationCodeSet.UTF8) sb.AppendFormat("\tMD5 logical unit identifier: {0}", descriptor.ASCII).AppendLine(); else { sb.AppendFormat("\tMD5 logical unit identifier: {0:x2}", descriptor.Binary[0]); for(int i = 1; i < descriptor.Binary.Length; i++) sb.AppendFormat("{0:x2}", descriptor.Binary[i]); + sb.AppendLine(); } + break; case IdentificationTypes.SCSI: - if(descriptor.CodeSet == IdentificationCodeSet.ASCII || descriptor.CodeSet == IdentificationCodeSet.UTF8) + if(descriptor.CodeSet == IdentificationCodeSet.ASCII || + descriptor.CodeSet == IdentificationCodeSet.UTF8) sb.AppendFormat("\tSCSI name string identifier: {0}", descriptor.ASCII).AppendLine(); else { - sb.AppendFormat("\tSCSI name string identifier (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); + sb.AppendFormat("\tSCSI name string identifier (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); } break; case IdentificationTypes.ProtocolSpecific: + { + if(descriptor.PIV) { - if(descriptor.PIV) + switch(descriptor.ProtocolIdentifier) { - switch(descriptor.ProtocolIdentifier) - { - case ProtocolIdentifiers.ADT: - sb.AppendFormat("\tProtocol (Automation/Drive Interface Transport) specific descriptor with unknown format (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); - break; - case ProtocolIdentifiers.ATA: - sb.AppendFormat("\tProtocol (ATA/ATAPI) specific descriptor with unknown format (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); - break; - case ProtocolIdentifiers.FibreChannel: - sb.AppendFormat("\tProtocol (Fibre Channel) specific descriptor with unknown format (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); - break; - case ProtocolIdentifiers.Firewire: - sb.AppendFormat("\tProtocol (IEEE 1394) specific descriptor with unknown format (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); - break; - case ProtocolIdentifiers.iSCSI: - sb.AppendFormat("\tProtocol (Internet SCSI) specific descriptor with unknown format (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); - break; - case ProtocolIdentifiers.NoProtocol: - sb.AppendFormat("\tProtocol (unknown) specific descriptor with unknown format (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); - break; - case ProtocolIdentifiers.PCIe: - sb.AppendFormat("\tProtocol (PCI Express) specific descriptor with unknown format (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); - break; - case ProtocolIdentifiers.RDMAP: - sb.AppendFormat("\tProtocol (SCSI Remote Direct Memory Access) specific descriptor with unknown format (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); - break; - case ProtocolIdentifiers.SAS: - sb.AppendFormat("\tProtocol (Serial Attachment SCSI) specific descriptor with unknown format (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); - break; - case ProtocolIdentifiers.SCSI: - sb.AppendFormat("\tProtocol (Parallel SCSI) specific descriptor with unknown format (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); - break; - case ProtocolIdentifiers.SSA: - sb.AppendFormat("\tProtocol (SSA) specific descriptor with unknown format (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); - break; - case ProtocolIdentifiers.SCSIe: - sb.AppendFormat("\tProtocol (SCSIe) specific descriptor: Routing ID is {0}", (descriptor.Binary[0] << 8) + descriptor.Binary[1]).AppendLine(); - break; - case ProtocolIdentifiers.UAS: - sb.AppendFormat("\tProtocol (UAS) specific descriptor: USB address {0} interface {1}", descriptor.Binary[0] & 0x7F, descriptor.Binary[2]).AppendLine(); - break; - default: - sb.AppendFormat("\tProtocol (unknown code {0}) specific descriptor with unknown format (hex): {1}", (byte)descriptor.ProtocolIdentifier, PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine(); - break; - } + case ProtocolIdentifiers.ADT: + sb + .AppendFormat("\tProtocol (Automation/Drive Interface Transport) specific descriptor with unknown format (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) + .AppendLine(); + break; + case ProtocolIdentifiers.ATA: + sb + .AppendFormat("\tProtocol (ATA/ATAPI) specific descriptor with unknown format (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) + .AppendLine(); + break; + case ProtocolIdentifiers.FibreChannel: + sb + .AppendFormat("\tProtocol (Fibre Channel) specific descriptor with unknown format (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) + .AppendLine(); + break; + case ProtocolIdentifiers.Firewire: + sb + .AppendFormat("\tProtocol (IEEE 1394) specific descriptor with unknown format (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) + .AppendLine(); + break; + case ProtocolIdentifiers.iSCSI: + sb + .AppendFormat("\tProtocol (Internet SCSI) specific descriptor with unknown format (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) + .AppendLine(); + break; + case ProtocolIdentifiers.NoProtocol: + sb + .AppendFormat("\tProtocol (unknown) specific descriptor with unknown format (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) + .AppendLine(); + break; + case ProtocolIdentifiers.PCIe: + sb + .AppendFormat("\tProtocol (PCI Express) specific descriptor with unknown format (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) + .AppendLine(); + break; + case ProtocolIdentifiers.RDMAP: + sb + .AppendFormat("\tProtocol (SCSI Remote Direct Memory Access) specific descriptor with unknown format (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) + .AppendLine(); + break; + case ProtocolIdentifiers.SAS: + sb + .AppendFormat("\tProtocol (Serial Attachment SCSI) specific descriptor with unknown format (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) + .AppendLine(); + break; + case ProtocolIdentifiers.SCSI: + sb + .AppendFormat("\tProtocol (Parallel SCSI) specific descriptor with unknown format (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) + .AppendLine(); + break; + case ProtocolIdentifiers.SSA: + sb + .AppendFormat("\tProtocol (SSA) specific descriptor with unknown format (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) + .AppendLine(); + break; + case ProtocolIdentifiers.SCSIe: + sb.AppendFormat("\tProtocol (SCSIe) specific descriptor: Routing ID is {0}", + (descriptor.Binary[0] << 8) + descriptor.Binary[1]).AppendLine(); + break; + case ProtocolIdentifiers.UAS: + sb + .AppendFormat("\tProtocol (UAS) specific descriptor: USB address {0} interface {1}", + descriptor.Binary[0] & 0x7F, descriptor.Binary[2]).AppendLine(); + break; + default: + sb + .AppendFormat("\tProtocol (unknown code {0}) specific descriptor with unknown format (hex): {1}", + (byte)descriptor.ProtocolIdentifier, + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)) + .AppendLine(); + break; } } + } + break; default: - if(descriptor.CodeSet == IdentificationCodeSet.ASCII || descriptor.CodeSet == IdentificationCodeSet.UTF8) - sb.AppendFormat("\tUnknown descriptor type {1} contains: {0}", descriptor.ASCII, (byte)descriptor.Type).AppendLine(); + if(descriptor.CodeSet == IdentificationCodeSet.ASCII || + descriptor.CodeSet == IdentificationCodeSet.UTF8) + sb.AppendFormat("\tUnknown descriptor type {1} contains: {0}", descriptor.ASCII, + (byte)descriptor.Type).AppendLine(); else if(descriptor.CodeSet == IdentificationCodeSet.Binary) - sb.AppendFormat("\tUnknown descriptor type {1} contains binary data (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40), (byte)descriptor.Type).AppendLine(); + sb.AppendFormat("\tUnknown descriptor type {1} contains binary data (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40), + (byte)descriptor.Type).AppendLine(); else - sb.AppendFormat("Inquiry descriptor type {2} contains unknown kind {1} of data (hex): {0}", PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40), (byte)descriptor.CodeSet, (byte)descriptor.Type).AppendLine(); + sb.AppendFormat("Inquiry descriptor type {2} contains unknown kind {1} of data (hex): {0}", + PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40), + (byte)descriptor.CodeSet, (byte)descriptor.Type).AppendLine(); break; } } return sb.ToString(); } - #endregion EVPD Page 0x83: Device identification page #region EVPD Page 0x84: Software Interface Identification page - public struct SoftwareIdentifier { /// @@ -728,17 +768,13 @@ namespace DiscImageChef.Decoders.SCSI public static Page_84? DecodePage_84(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0x84) - return null; + if(pageResponse[1] != 0x84) return null; - if(pageResponse[3] + 4 != pageResponse.Length) - return null; + if(pageResponse[3] + 4 != pageResponse.Length) return null; - if(pageResponse.Length < 10) - return null; + if(pageResponse.Length < 10) return null; Page_84 decoded = new Page_84(); @@ -770,8 +806,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyPage_84(Page_84? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_84 page = modePage.Value; StringBuilder sb = new StringBuilder(); @@ -789,16 +824,15 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendFormat("\t{0:X2}", identifier.Identifier[0]); for(int i = 1; i < identifier.Identifier.Length; i++) sb.AppendFormat(":{0:X2}", identifier.Identifier[i]); + sb.AppendLine(); } return sb.ToString(); } - #endregion EVPD Page 0x84: Software Interface Identification page #region EVPD Page 0x85: Management Network Addresses page - public enum NetworkServiceTypes : byte { Unspecified = 0, @@ -861,17 +895,13 @@ namespace DiscImageChef.Decoders.SCSI public static Page_85? DecodePage_85(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0x85) - return null; + if(pageResponse[1] != 0x85) return null; - if((pageResponse[2] << 8) + pageResponse[3] + 4 != pageResponse.Length) - return null; + if((pageResponse[2] << 8) + pageResponse[3] + 4 != pageResponse.Length) return null; - if(pageResponse.Length < 4) - return null; + if(pageResponse.Length < 4) return null; Page_85 decoded = new Page_85(); @@ -907,8 +937,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyPage_85(Page_85? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_85 page = modePage.Value; StringBuilder sb = new StringBuilder(); @@ -935,49 +964,58 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("\tIdentifier belongs to target device that contains the addressed logical unit"); break; default: - sb.AppendFormat("\tIndentifier has unknown association with code {0}", (byte)descriptor.Association).AppendLine(); + sb.AppendFormat("\tIndentifier has unknown association with code {0}", + (byte)descriptor.Association).AppendLine(); break; } switch(descriptor.Type) { case NetworkServiceTypes.CodeDownload: - sb.AppendFormat("Address for code download: {0}", StringHandlers.CToString(descriptor.Address)).AppendLine(); + sb.AppendFormat("Address for code download: {0}", StringHandlers.CToString(descriptor.Address)) + .AppendLine(); break; case NetworkServiceTypes.Diagnostics: - sb.AppendFormat("Address for diagnostics: {0}", StringHandlers.CToString(descriptor.Address)).AppendLine(); + sb.AppendFormat("Address for diagnostics: {0}", StringHandlers.CToString(descriptor.Address)) + .AppendLine(); break; case NetworkServiceTypes.Logging: - sb.AppendFormat("Address for logging: {0}", StringHandlers.CToString(descriptor.Address)).AppendLine(); + sb.AppendFormat("Address for logging: {0}", StringHandlers.CToString(descriptor.Address)) + .AppendLine(); break; case NetworkServiceTypes.Status: - sb.AppendFormat("Address for status: {0}", StringHandlers.CToString(descriptor.Address)).AppendLine(); + sb.AppendFormat("Address for status: {0}", StringHandlers.CToString(descriptor.Address)) + .AppendLine(); break; case NetworkServiceTypes.StorageConf: - sb.AppendFormat("Address for storage configuration service: {0}", StringHandlers.CToString(descriptor.Address)).AppendLine(); + sb.AppendFormat("Address for storage configuration service: {0}", + StringHandlers.CToString(descriptor.Address)).AppendLine(); break; case NetworkServiceTypes.Unspecified: - sb.AppendFormat("Unspecified address: {0}", StringHandlers.CToString(descriptor.Address)).AppendLine(); + sb.AppendFormat("Unspecified address: {0}", StringHandlers.CToString(descriptor.Address)) + .AppendLine(); break; case NetworkServiceTypes.CopyService: - sb.AppendFormat("Address for copy service: {0}", StringHandlers.CToString(descriptor.Address)).AppendLine(); + sb.AppendFormat("Address for copy service: {0}", StringHandlers.CToString(descriptor.Address)) + .AppendLine(); break; case NetworkServiceTypes.Administrative: - sb.AppendFormat("Address for administrative configuration service: {0}", StringHandlers.CToString(descriptor.Address)).AppendLine(); + sb.AppendFormat("Address for administrative configuration service: {0}", + StringHandlers.CToString(descriptor.Address)).AppendLine(); break; default: - sb.AppendFormat("Address of unknown type {1}: {0}", StringHandlers.CToString(descriptor.Address), (byte)descriptor.Type).AppendLine(); + sb.AppendFormat("Address of unknown type {1}: {0}", + StringHandlers.CToString(descriptor.Address), (byte)descriptor.Type) + .AppendLine(); break; } } return sb.ToString(); } - #endregion EVPD Page 0x85: Management Network Addresses page #region EVPD Page 0x86: Extended INQUIRY data page - /// /// Device identification page /// Page code 0x86 @@ -1112,17 +1150,13 @@ namespace DiscImageChef.Decoders.SCSI public static Page_86? DecodePage_86(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0x86) - return null; + if(pageResponse[1] != 0x86) return null; - if(pageResponse[3] + 4 != pageResponse.Length) - return null; + if(pageResponse[3] + 4 != pageResponse.Length) return null; - if(pageResponse.Length < 64) - return null; + if(pageResponse.Length < 64) return null; Page_86 decoded = new Page_86(); @@ -1168,8 +1202,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyPage_86(Page_86? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_86 page = modePage.Value; StringBuilder sb = new StringBuilder(); @@ -1203,71 +1236,51 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("Logical unit supports types 1, 2 and 3 protection"); break; default: - sb.AppendFormat("Logical unit supports unknown protection defined by code {0}", (byte)page.SPT).AppendLine(); + sb.AppendFormat("Logical unit supports unknown protection defined by code {0}", (byte)page.SPT) + .AppendLine(); break; } } else if(page.PeripheralDeviceType == PeripheralDeviceTypes.SequentialAccess && page.SPT == 1) sb.AppendLine("Logical unit supports logical block protection"); - if(page.GRD_CHK) - sb.AppendLine("Device checks the logical block guard"); - if(page.APP_CHK) - sb.AppendLine("Device checks the logical block application tag"); - if(page.REF_CHK) - sb.AppendLine("Device checks the logical block reference tag"); - if(page.UASK_SUP) - sb.AppendLine("Device supports unit attention condition sense key specific data"); - if(page.GROUP_SUP) - sb.AppendLine("Device supports grouping"); - if(page.PRIOR_SUP) - sb.AppendLine("Device supports priority"); - if(page.HEADSUP) - sb.AppendLine("Device supports head of queue"); - if(page.ORDSUP) - sb.AppendLine("Device supports the ORDERED task attribute"); - if(page.SIMPSUP) - sb.AppendLine("Device supports the SIMPLE task attribute"); - if(page.WU_SUP) - sb.AppendLine("Device supports marking a block as uncorrectable with WRITE LONG"); - if(page.CRD_SUP) - sb.AppendLine("Device supports disabling correction with WRITE LONG"); - if(page.NV_SUP) - sb.AppendLine("Device has a non-volatile cache"); - if(page.V_SUP) - sb.AppendLine("Device has a volatile cache"); - if(page.NO_PI_CHK) - sb.AppendLine("Device has disabled protection information checks"); - if(page.P_I_I_SUP) - sb.AppendLine("Device supports protection information intervals"); + if(page.GRD_CHK) sb.AppendLine("Device checks the logical block guard"); + if(page.APP_CHK) sb.AppendLine("Device checks the logical block application tag"); + if(page.REF_CHK) sb.AppendLine("Device checks the logical block reference tag"); + if(page.UASK_SUP) sb.AppendLine("Device supports unit attention condition sense key specific data"); + if(page.GROUP_SUP) sb.AppendLine("Device supports grouping"); + if(page.PRIOR_SUP) sb.AppendLine("Device supports priority"); + if(page.HEADSUP) sb.AppendLine("Device supports head of queue"); + if(page.ORDSUP) sb.AppendLine("Device supports the ORDERED task attribute"); + if(page.SIMPSUP) sb.AppendLine("Device supports the SIMPLE task attribute"); + if(page.WU_SUP) sb.AppendLine("Device supports marking a block as uncorrectable with WRITE LONG"); + if(page.CRD_SUP) sb.AppendLine("Device supports disabling correction with WRITE LONG"); + if(page.NV_SUP) sb.AppendLine("Device has a non-volatile cache"); + if(page.V_SUP) sb.AppendLine("Device has a volatile cache"); + if(page.NO_PI_CHK) sb.AppendLine("Device has disabled protection information checks"); + if(page.P_I_I_SUP) sb.AppendLine("Device supports protection information intervals"); if(page.LUICLR) sb.AppendLine("Device clears any unit attention condition in all LUNs after reporting for any LUN"); - if(page.R_SUP) - sb.AppendLine("Device supports referrals"); - if(page.HSSRELEF) - sb.AppendLine("Devoce implements alternate reset handling"); - if(page.CBCS) - sb.AppendLine("Device supports capability-based command security"); - if(page.POA_SUP) - sb.AppendLine("Device supports power-on activation for new microcode"); - if(page.HRA_SUP) - sb.AppendLine("Device supports hard reset activation for new microcode"); - if(page.VSA_SUP) - sb.AppendLine("Device supports vendor specific activation for new microcode"); + if(page.R_SUP) sb.AppendLine("Device supports referrals"); + if(page.HSSRELEF) sb.AppendLine("Devoce implements alternate reset handling"); + if(page.CBCS) sb.AppendLine("Device supports capability-based command security"); + if(page.POA_SUP) sb.AppendLine("Device supports power-on activation for new microcode"); + if(page.HRA_SUP) sb.AppendLine("Device supports hard reset activation for new microcode"); + if(page.VSA_SUP) sb.AppendLine("Device supports vendor specific activation for new microcode"); if(page.ExtendedTestMinutes > 0) - sb.AppendFormat("Extended self-test takes {0} to complete", TimeSpan.FromMinutes(page.ExtendedTestMinutes)).AppendLine(); + sb.AppendFormat("Extended self-test takes {0} to complete", + TimeSpan.FromMinutes(page.ExtendedTestMinutes)).AppendLine(); if(page.MaximumSenseLength > 0) - sb.AppendFormat("Device supports a maximum of {0} bytes for sense data", page.MaximumSenseLength).AppendLine(); + sb.AppendFormat("Device supports a maximum of {0} bytes for sense data", page.MaximumSenseLength) + .AppendLine(); return sb.ToString(); } - #endregion EVPD Page 0x86: Extended INQUIRY data page #region EVPD Page 0x89: ATA Information page - /// /// ATA Information page /// Page code 0x89 @@ -1318,17 +1331,13 @@ namespace DiscImageChef.Decoders.SCSI public static Page_89? DecodePage_89(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0x89) - return null; + if(pageResponse[1] != 0x89) return null; - if((pageResponse[2] << 8) + pageResponse[3] + 4 != pageResponse.Length) - return null; + if((pageResponse[2] << 8) + pageResponse[3] + 4 != pageResponse.Length) return null; - if(pageResponse.Length < 572) - return null; + if(pageResponse.Length < 572) return null; Page_89 decoded = new Page_89(); @@ -1360,17 +1369,20 @@ namespace DiscImageChef.Decoders.SCSI // TODO: Decode ATA signature? public static string PrettifyPage_89(Page_89? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_89 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI to ATA Translation Layer Data:"); - sb.AppendFormat("\tTranslation layer vendor: {0}", VendorString.Prettify(StringHandlers.CToString(page.VendorIdentification).Trim())).AppendLine(); - sb.AppendFormat("\tTranslation layer name: {0}", StringHandlers.CToString(page.ProductIdentification).Trim()).AppendLine(); - sb.AppendFormat("\tTranslation layer release level: {0}", StringHandlers.CToString(page.ProductRevisionLevel).Trim()).AppendLine(); + sb.AppendFormat("\tTranslation layer vendor: {0}", + VendorString.Prettify(StringHandlers.CToString(page.VendorIdentification).Trim())) + .AppendLine(); + sb.AppendFormat("\tTranslation layer name: {0}", + StringHandlers.CToString(page.ProductIdentification).Trim()).AppendLine(); + sb.AppendFormat("\tTranslation layer release level: {0}", + StringHandlers.CToString(page.ProductRevisionLevel).Trim()).AppendLine(); switch(page.CommandCode) { case 0xEC: @@ -1402,16 +1414,13 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("\tATA IDENTIFY information follows:"); sb.AppendFormat("{0}", ATA.Identify.Prettify(id)).AppendLine(); } - else - sb.AppendLine("\tCould not decode ATA IDENTIFY information"); + else sb.AppendLine("\tCould not decode ATA IDENTIFY information"); return sb.ToString(); } - #endregion EVPD Page 0x89: ATA Information page #region EVPD Page 0xC0 (Quantum): Firmware Build Information page - /// /// Firmware Build Information page /// Page code 0xC0 (Quantum) @@ -1454,17 +1463,13 @@ namespace DiscImageChef.Decoders.SCSI public static Page_C0_Quantum? DecodePage_C0_Quantum(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0xC0) - return null; + if(pageResponse[1] != 0xC0) return null; - if(pageResponse[3] != 20) - return null; + if(pageResponse[3] != 20) return null; - if(pageResponse.Length != 36) - return null; + if(pageResponse.Length != 36) return null; Page_C0_Quantum decoded = new Page_C0_Quantum(); @@ -1474,7 +1479,8 @@ namespace DiscImageChef.Decoders.SCSI decoded.ServoFirmwareChecksum = (ushort)((pageResponse[4] << 8) + pageResponse[5]); decoded.ServoEEPROMChecksum = (ushort)((pageResponse[6] << 8) + pageResponse[7]); - decoded.ReadWriteFirmwareChecksum = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + (pageResponse[10] << 8) + pageResponse[11]); + decoded.ReadWriteFirmwareChecksum = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + + (pageResponse[10] << 8) + pageResponse[11]); decoded.ReadWriteFirmwareBuildData = new byte[24]; Array.Copy(pageResponse, 12, decoded.ReadWriteFirmwareBuildData, 0, 24); @@ -1488,8 +1494,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyPage_C0_Quantum(Page_C0_Quantum? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_C0_Quantum page = modePage.Value; StringBuilder sb = new StringBuilder(); @@ -1499,15 +1504,14 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendFormat("\tServo firmware checksum: 0x{0:X4}", page.ServoFirmwareChecksum).AppendLine(); sb.AppendFormat("\tEEPROM firmware checksum: 0x{0:X4}", page.ServoEEPROMChecksum).AppendLine(); sb.AppendFormat("\tRead/write firmware checksum: 0x{0:X8}", page.ReadWriteFirmwareChecksum).AppendLine(); - sb.AppendFormat("\tRead/write firmware build date: {0}", StringHandlers.CToString(page.ReadWriteFirmwareBuildData)).AppendLine(); + sb.AppendFormat("\tRead/write firmware build date: {0}", + StringHandlers.CToString(page.ReadWriteFirmwareBuildData)).AppendLine(); return sb.ToString(); } - #endregion EVPD Page 0xC0 (Quantum): Firmware Build Information page #region EVPD Pages 0xC0, 0xC1 (Certance): Drive component revision level pages - /// /// Drive component revision level pages /// Page codes 0xC0, 0xC1 (Certance) @@ -1538,17 +1542,13 @@ namespace DiscImageChef.Decoders.SCSI public static Page_C0_C1_Certance? DecodePage_C0_C1_Certance(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0xC0 && pageResponse[1] != 0xC1) - return null; + if(pageResponse[1] != 0xC0 && pageResponse[1] != 0xC1) return null; - if(pageResponse[3] != 92) - return null; + if(pageResponse[3] != 92) return null; - if(pageResponse.Length != 96) - return null; + if(pageResponse.Length != 96) return null; Page_C0_C1_Certance decoded = new Page_C0_C1_Certance(); @@ -1576,8 +1576,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyPage_C0_C1_Certance(Page_C0_C1_Certance? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_C0_C1_Certance page = modePage.Value; StringBuilder sb = new StringBuilder(); @@ -1591,11 +1590,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion EVPD Pages 0xC0, 0xC1 (Certance): Drive component revision level pages #region EVPD Pages 0xC2, 0xC3, 0xC4, 0xC5, 0xC6 (Certance): Drive component serial number pages - /// /// Drive component serial number pages /// Page codes 0xC2, 0xC3, 0xC4, 0xC5, 0xC6 (Certance) @@ -1623,19 +1620,14 @@ namespace DiscImageChef.Decoders.SCSI public static Page_C2_C3_C4_C5_C6_Certance? DecodePage_C2_C3_C4_C5_C6_Certance(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0xC2 && pageResponse[1] != 0xC3 && - pageResponse[1] != 0xC4 && pageResponse[1] != 0xC5 && - pageResponse[1] != 0xC6) - return null; + if(pageResponse[1] != 0xC2 && pageResponse[1] != 0xC3 && pageResponse[1] != 0xC4 && + pageResponse[1] != 0xC5 && pageResponse[1] != 0xC6) return null; - if(pageResponse[3] != 12) - return null; + if(pageResponse[3] != 12) return null; - if(pageResponse.Length != 16) - return null; + if(pageResponse.Length != 16) return null; Page_C2_C3_C4_C5_C6_Certance decoded = new Page_C2_C3_C4_C5_C6_Certance(); @@ -1656,8 +1648,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyPage_C2_C3_C4_C5_C6_Certance(Page_C2_C3_C4_C5_C6_Certance? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_C2_C3_C4_C5_C6_Certance page = modePage.Value; StringBuilder sb = new StringBuilder(); @@ -1667,29 +1658,32 @@ namespace DiscImageChef.Decoders.SCSI switch(page.PageCode) { case 0xC2: - sb.AppendFormat("\tHead Assembly Serial Number: {0}", StringHandlers.CToString(page.SerialNumber)).AppendLine(); + sb.AppendFormat("\tHead Assembly Serial Number: {0}", StringHandlers.CToString(page.SerialNumber)) + .AppendLine(); break; case 0xC3: - sb.AppendFormat("\tReel Motor 1 Serial Number: {0}", StringHandlers.CToString(page.SerialNumber)).AppendLine(); + sb.AppendFormat("\tReel Motor 1 Serial Number: {0}", StringHandlers.CToString(page.SerialNumber)) + .AppendLine(); break; case 0xC4: - sb.AppendFormat("\tReel Motor 2 Serial Number: {0}", StringHandlers.CToString(page.SerialNumber)).AppendLine(); + sb.AppendFormat("\tReel Motor 2 Serial Number: {0}", StringHandlers.CToString(page.SerialNumber)) + .AppendLine(); break; case 0xC5: - sb.AppendFormat("\tBoard Serial Number: {0}", StringHandlers.CToString(page.SerialNumber)).AppendLine(); + sb.AppendFormat("\tBoard Serial Number: {0}", StringHandlers.CToString(page.SerialNumber)) + .AppendLine(); break; case 0xC6: - sb.AppendFormat("\tBase Mechanical Serial Number: {0}", StringHandlers.CToString(page.SerialNumber)).AppendLine(); + sb.AppendFormat("\tBase Mechanical Serial Number: {0}", StringHandlers.CToString(page.SerialNumber)) + .AppendLine(); break; } return sb.ToString(); } - #endregion EVPD Pages 0xC0, 0xC1 (Certance): Drive component revision level pages #region EVPD Page 0xDF (Certance): Drive status pages - /// /// Drive status pages /// Page codes 0xDF (Certance) @@ -1780,17 +1774,13 @@ namespace DiscImageChef.Decoders.SCSI public static Page_DF_Certance? DecodePage_DF_Certance(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0xDF) - return null; + if(pageResponse[1] != 0xDF) return null; - if(pageResponse[3] != 60) - return null; + if(pageResponse[3] != 60) return null; - if(pageResponse.Length != 64) - return null; + if(pageResponse.Length != 64) return null; Page_DF_Certance decoded = new Page_DF_Certance(); @@ -1811,7 +1801,8 @@ namespace DiscImageChef.Decoders.SCSI decoded.CartridgeCapacity = (ushort)((pageResponse[10] << 8) + pageResponse[11] + 4); decoded.PortATransportType = pageResponse[12]; decoded.PortASelectionID = pageResponse[15]; - decoded.OperatingHours = (uint)((pageResponse[20] << 24) + (pageResponse[21] << 16) + (pageResponse[22] << 8) + pageResponse[23]); + decoded.OperatingHours = (uint)((pageResponse[20] << 24) + (pageResponse[21] << 16) + + (pageResponse[22] << 8) + pageResponse[23]); byte[] buf = new byte[8]; Array.Copy(pageResponse, 24, buf, 0, 8); @@ -1830,8 +1821,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyPage_DF_Certance(Page_DF_Certance? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_DF_Certance page = modePage.Value; StringBuilder sb = new StringBuilder(); @@ -1851,18 +1841,13 @@ namespace DiscImageChef.Decoders.SCSI break; } - if(page.Alerts) - sb.AppendLine("\tAlerts are enabled"); - if(page.NoRemov) - sb.AppendLine("\tCartridge removable is prevented"); + if(page.Alerts) sb.AppendLine("\tAlerts are enabled"); + if(page.NoRemov) sb.AppendLine("\tCartridge removable is prevented"); if(page.UnitRsvd) sb.AppendFormat("\tUnit is reserved by initiator ID {0:X16}", page.InitiatorID).AppendLine(); - if(page.Clean) - sb.AppendLine("\tDevice needs cleaning cartridge"); - if(page.Threaded) - sb.AppendLine("\tCartridge tape is threaded"); - if(page.Lun1Cmd) - sb.AppendLine("\tThere are commands pending to be forwarded"); + if(page.Clean) sb.AppendLine("\tDevice needs cleaning cartridge"); + if(page.Threaded) sb.AppendLine("\tCartridge tape is threaded"); + if(page.Lun1Cmd) sb.AppendLine("\tThere are commands pending to be forwarded"); switch(page.AutoloadMode) { @@ -1944,19 +1929,18 @@ namespace DiscImageChef.Decoders.SCSI break; } - sb.AppendFormat("\tCartridge has an uncompressed capabity of {0} gigabytes", page.CartridgeCapacity).AppendLine(); - sb.AppendFormat("\tCartridge serial number: {0}", StringHandlers.SpacePaddedToString(page.CartridgeSerialNumber)).AppendLine(); + sb.AppendFormat("\tCartridge has an uncompressed capabity of {0} gigabytes", page.CartridgeCapacity) + .AppendLine(); + sb.AppendFormat("\tCartridge serial number: {0}", + StringHandlers.SpacePaddedToString(page.CartridgeSerialNumber)).AppendLine(); } - else - sb.AppendLine("\tThere is no cartridge inserted"); + else sb.AppendLine("\tThere is no cartridge inserted"); return sb.ToString(); } - #endregion EVPD Page 0xDF (Certance): Drive status pages #region EVPD Page 0xC0 (IBM): Drive Component Revision Levels page - /// /// Drive Component Revision Levels page /// Page code 0xC0 (IBM) @@ -1985,17 +1969,13 @@ namespace DiscImageChef.Decoders.SCSI public static Page_C0_IBM? DecodePage_C0_IBM(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0xC0) - return null; + if(pageResponse[1] != 0xC0) return null; - if(pageResponse[3] != 39) - return null; + if(pageResponse[3] != 39) return null; - if(pageResponse.Length != 43) - return null; + if(pageResponse.Length != 43) return null; Page_C0_IBM decoded = new Page_C0_IBM(); @@ -2019,8 +1999,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyPage_C0_IBM(Page_C0_IBM? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_C0_IBM page = modePage.Value; StringBuilder sb = new StringBuilder(); @@ -2032,11 +2011,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion EVPD Page 0xC0 (IBM): Drive Component Revision Levels page #region EVPD Page 0xC1 (IBM): Drive Serial Numbers page - /// /// Drive Serial Numbers page /// Page code 0xC1 (IBM) @@ -2065,17 +2042,13 @@ namespace DiscImageChef.Decoders.SCSI public static Page_C1_IBM? DecodePage_C1_IBM(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0xC1) - return null; + if(pageResponse[1] != 0xC1) return null; - if(pageResponse[3] != 24) - return null; + if(pageResponse[3] != 24) return null; - if(pageResponse.Length != 28) - return null; + if(pageResponse.Length != 28) return null; Page_C1_IBM decoded = new Page_C1_IBM(); @@ -2099,24 +2072,23 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyPage_C1_IBM(Page_C1_IBM? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_C1_IBM page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("IBM Drive Serial Numbers page:"); - sb.AppendFormat("\tManufacturing serial number: {0}", StringHandlers.CToString(page.ManufacturingSerial)).AppendLine(); - sb.AppendFormat("\tReported serial number: {0}", StringHandlers.CToString(page.ReportedSerial)).AppendLine(); + sb.AppendFormat("\tManufacturing serial number: {0}", StringHandlers.CToString(page.ManufacturingSerial)) + .AppendLine(); + sb.AppendFormat("\tReported serial number: {0}", StringHandlers.CToString(page.ReportedSerial)) + .AppendLine(); return sb.ToString(); } - #endregion EVPD Page 0xC1 (IBM): Drive Serial Numbers page #region EVPD Page 0xB0: Sequential-access device capabilities page - /// /// Sequential-access device capabilities page /// Page code 0xB0 @@ -2145,17 +2117,13 @@ namespace DiscImageChef.Decoders.SCSI public static Page_B0? DecodePage_B0(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0xB0) - return null; + if(pageResponse[1] != 0xB0) return null; - if((pageResponse[2] << 8) + pageResponse[3] + 4 != pageResponse.Length) - return null; + if((pageResponse[2] << 8) + pageResponse[3] + 4 != pageResponse.Length) return null; - if(pageResponse.Length < 5) - return null; + if(pageResponse.Length < 5) return null; Page_B0 decoded = new Page_B0(); @@ -2176,36 +2144,28 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyPage_B0(Page_B0? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_B0 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Sequential-access Device Capabilities:"); - if(page.WORM) - sb.AppendLine("\tDevice supports WORM media"); - if(page.TSMC) - sb.AppendLine("\tDevice supports Tape Stream Mirroring"); + if(page.WORM) sb.AppendLine("\tDevice supports WORM media"); + if(page.TSMC) sb.AppendLine("\tDevice supports Tape Stream Mirroring"); return sb.ToString(); } - #endregion EVPD Page 0xB0: Sequential-access device capabilities page #region EVPD Page 0xB1: Manufacturer-assigned Serial Number page - public static string DecodePageB1(byte[] page) { - if(page == null) - return null; + if(page == null) return null; - if(page[1] != 0xB1) - return null; + if(page[1] != 0xB1) return null; - if(page.Length != page[3] + 4) - return null; + if(page.Length != page[3] + 4) return null; byte[] ascii = new byte[page.Length - 4]; @@ -2213,21 +2173,16 @@ namespace DiscImageChef.Decoders.SCSI return StringHandlers.CToString(ascii).Trim(); } - #endregion EVPD Page 0xB1: Manufacturer-assigned Serial Number page #region EVPD Page 0xB2: TapeAlert Supported Flags page - public static ulong DecodePageB2(byte[] page) { - if(page == null) - return 0; + if(page == null) return 0; - if(page[1] != 0xB2) - return 0; + if(page[1] != 0xB2) return 0; - if(page.Length != 12) - return 0; + if(page.Length != 12) return 0; byte[] bitmap = new byte[8]; @@ -2235,21 +2190,16 @@ namespace DiscImageChef.Decoders.SCSI return BitConverter.ToUInt64(bitmap.Reverse().ToArray(), 0); } - #endregion EVPD Page 0xB2: TapeAlert Supported Flags page #region EVPD Page 0xB3: Automation Device Serial Number page - public static string DecodePageB3(byte[] page) { - if(page == null) - return null; + if(page == null) return null; - if(page[1] != 0xB3) - return null; + if(page[1] != 0xB3) return null; - if(page.Length != page[3] + 4) - return null; + if(page.Length != page[3] + 4) return null; byte[] ascii = new byte[page.Length - 4]; @@ -2257,34 +2207,26 @@ namespace DiscImageChef.Decoders.SCSI return StringHandlers.CToString(ascii).Trim(); } - #endregion EVPD Page 0xB3: Automation Device Serial Number page #region EVPD Page 0xB4: Data Transfer Device Element Address page - public static string DecodePageB4(byte[] page) { - if(page == null) - return null; + if(page == null) return null; - if(page[1] != 0xB3) - return null; + if(page[1] != 0xB3) return null; - if(page.Length != page[3] + 4) - return null; + if(page.Length != page[3] + 4) return null; byte[] element = new byte[page.Length - 4]; StringBuilder sb = new StringBuilder(); - foreach(byte b in element) - sb.AppendFormat("{0:X2}", b); + foreach(byte b in element) sb.AppendFormat("{0:X2}", b); return sb.ToString(); } - #endregion EVPD Page 0xB4: Data Transfer Device Element Address page #region EVPD Pages 0xC0 to 0xC5 (HP): Drive component revision level pages - /// /// Drive component revision level pages /// Page codes 0xC0 to 0xC5 (HP) @@ -2316,16 +2258,12 @@ namespace DiscImageChef.Decoders.SCSI public static Page_C0_to_C5_HP? DecodePage_C0_to_C5_HP(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0xC0 && pageResponse[1] != 0xC1 && - pageResponse[1] != 0xC2 && pageResponse[1] != 0xC3 && - pageResponse[1] != 0xC4 && pageResponse[1] != 0xC5) - return null; + if(pageResponse[1] != 0xC0 && pageResponse[1] != 0xC1 && pageResponse[1] != 0xC2 && + pageResponse[1] != 0xC3 && pageResponse[1] != 0xC4 && pageResponse[1] != 0xC5) return null; - if(pageResponse.Length < 4) - return null; + if(pageResponse.Length < 4) return null; Page_C0_to_C5_HP decoded = new Page_C0_to_C5_HP(); @@ -2352,7 +2290,8 @@ namespace DiscImageChef.Decoders.SCSI if(pageResponse[4] == pageResponse[3] - 1) { List array = new List(); - string fwRegExStr = "Firmware Rev\\s+=\\s+(?\\d+\\.\\d+)\\s+Build date\\s+=\\s+(?(\\w|\\d|\\s*.)*)\\s*$"; + string fwRegExStr = + "Firmware Rev\\s+=\\s+(?\\d+\\.\\d+)\\s+Build date\\s+=\\s+(?(\\w|\\d|\\s*.)*)\\s*$"; string fwcRegExStr = "FW_CONF\\s+=\\s+(?0x[0-9A-Fa-f]{8})\\s*$"; string servoRegExStr = "Servo\\s+Rev\\s+=\\s+(?\\d+\\.\\d+)\\s*$"; Regex fwRegEx = new Regex(fwRegExStr); @@ -2389,8 +2328,7 @@ namespace DiscImageChef.Decoders.SCSI array = new List(); } - else - array.Add(pageResponse[pos]); + else array.Add(pageResponse[pos]); } return decoded; @@ -2406,8 +2344,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyPage_C0_to_C5_HP(Page_C0_to_C5_HP? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_C0_to_C5_HP page = modePage.Value; StringBuilder sb = new StringBuilder(); @@ -2447,11 +2384,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion EVPD Pages 0xC0 to 0xC5 (HP): Drive component revision level pages #region EVPD Page 0xC0 (Seagate): Firmware numbers page - /// /// Firmware numbers page /// Page code 0xC0 (Seagate) @@ -2481,17 +2416,13 @@ namespace DiscImageChef.Decoders.SCSI public static Page_C0_Seagate? DecodePage_C0_Seagate(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if(pageResponse[1] != 0xC0) - return null; + if(pageResponse[1] != 0xC0) return null; - if(pageResponse[3] != 12) - return null; + if(pageResponse[3] != 12) return null; - if(pageResponse.Length != 16) - return null; + if(pageResponse.Length != 16) return null; Page_C0_Seagate decoded = new Page_C0_Seagate(); @@ -2518,23 +2449,20 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyPage_C0_Seagate(Page_C0_Seagate? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Page_C0_Seagate page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("Seagate Firmware Numbers page:"); - sb.AppendFormat("\tController firmware version: {0}", StringHandlers.CToString(page.ControllerFirmware)).AppendLine(); + sb.AppendFormat("\tController firmware version: {0}", StringHandlers.CToString(page.ControllerFirmware)) + .AppendLine(); sb.AppendFormat("\tBoot firmware version: {0}", StringHandlers.CToString(page.BootFirmware)).AppendLine(); sb.AppendFormat("\tServo firmware version: {0}", StringHandlers.CToString(page.ServoFirmware)).AppendLine(); return sb.ToString(); } - #endregion EVPD Page 0xC0 (Seagate): Firmware numbers page - } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/Enums.cs b/DiscImageChef.Decoders/SCSI/Enums.cs index d3d7d3f8..1118ff02 100644 --- a/DiscImageChef.Decoders/SCSI/Enums.cs +++ b/DiscImageChef.Decoders/SCSI/Enums.cs @@ -312,5 +312,4 @@ namespace DiscImageChef.Decoders.SCSI SCSI2 = 3, SCSI3 = 4 } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/Inquiry.cs b/DiscImageChef.Decoders/SCSI/Inquiry.cs index b6983ee4..8212695c 100644 --- a/DiscImageChef.Decoders/SCSI/Inquiry.cs +++ b/DiscImageChef.Decoders/SCSI/Inquiry.cs @@ -51,21 +51,23 @@ namespace DiscImageChef.Decoders.SCSI public static class Inquiry { #region Public methods - public static SCSIInquiry? Decode(byte[] SCSIInquiryResponse) { - if(SCSIInquiryResponse == null) - return null; + if(SCSIInquiryResponse == null) return null; if(SCSIInquiryResponse.Length < 36 && SCSIInquiryResponse.Length != 5) { - DicConsole.DebugWriteLine("SCSI INQUIRY decoder", "INQUIRY response is {0} bytes, less than minimum of 36 bytes, decoded data can be incorrect, not decoding.", SCSIInquiryResponse.Length); + DicConsole.DebugWriteLine("SCSI INQUIRY decoder", + "INQUIRY response is {0} bytes, less than minimum of 36 bytes, decoded data can be incorrect, not decoding.", + SCSIInquiryResponse.Length); return null; } if(SCSIInquiryResponse.Length < SCSIInquiryResponse[4] + 5) { - DicConsole.DebugWriteLine("SCSI INQUIRY decoder", "INQUIRY response length ({0} bytes) is different than specified in length field ({1} bytes), decoded data can be incorrect, not decoding.", SCSIInquiryResponse.Length, SCSIInquiryResponse[4] + 4); + DicConsole.DebugWriteLine("SCSI INQUIRY decoder", + "INQUIRY response length ({0} bytes) is different than specified in length field ({1} bytes), decoded data can be incorrect, not decoding.", + SCSIInquiryResponse.Length, SCSIInquiryResponse[4] + 4); return null; } @@ -95,8 +97,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.HiSup = Convert.ToBoolean((SCSIInquiryResponse[3] & 0x10)); decoded.ResponseDataFormat = (byte)(SCSIInquiryResponse[3] & 0x07); } - if(SCSIInquiryResponse.Length >= 5) - decoded.AdditionalLength = SCSIInquiryResponse[4]; + if(SCSIInquiryResponse.Length >= 5) decoded.AdditionalLength = SCSIInquiryResponse[4]; if(SCSIInquiryResponse.Length >= 6) { decoded.SCCS = Convert.ToBoolean((SCSIInquiryResponse[5] & 0x80)); @@ -159,7 +160,8 @@ namespace DiscImageChef.Decoders.SCSI decoded.KreonVersion = new byte[5]; Array.Copy(SCSIInquiryResponse, 42, decoded.KreonVersion, 0, 5); - if(decoded.KreonSpace == 0x20 && decoded.KreonIdentifier.SequenceEqual(new byte[] { 0x4B, 0x52, 0x45, 0x4F, 0x4E })) + if(decoded.KreonSpace == 0x20 && + decoded.KreonIdentifier.SequenceEqual(new byte[] {0x4B, 0x52, 0x45, 0x4F, 0x4E})) decoded.KreonPresent = true; } if(SCSIInquiryResponse.Length >= 49) @@ -212,16 +214,13 @@ namespace DiscImageChef.Decoders.SCSI decoded.QAS = Convert.ToBoolean((SCSIInquiryResponse[56] & 0x02)); decoded.IUS = Convert.ToBoolean((SCSIInquiryResponse[56] & 0x01)); } - if(SCSIInquiryResponse.Length >= 58) - decoded.Reserved4 = SCSIInquiryResponse[57]; + if(SCSIInquiryResponse.Length >= 58) decoded.Reserved4 = SCSIInquiryResponse[57]; if(SCSIInquiryResponse.Length >= 60) { int descriptorsNo; - if(SCSIInquiryResponse.Length >= 74) - descriptorsNo = 8; - else - descriptorsNo = (SCSIInquiryResponse.Length - 58) / 2; + if(SCSIInquiryResponse.Length >= 74) descriptorsNo = 8; + else descriptorsNo = (SCSIInquiryResponse.Length - 58) / 2; decoded.VersionDescriptors = new ushort[descriptorsNo]; for(int i = 0; i < descriptorsNo; i++) @@ -229,6 +228,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.VersionDescriptors[i] = BitConverter.ToUInt16(SCSIInquiryResponse, 58 + (i * 2)); } } + if(SCSIInquiryResponse.Length >= 75 && SCSIInquiryResponse.Length < 96) { decoded.Reserved5 = new byte[SCSIInquiryResponse.Length - 74]; @@ -264,16 +264,19 @@ namespace DiscImageChef.Decoders.SCSI public static string Prettify(SCSIInquiry? SCSIInquiryResponse) { - if(SCSIInquiryResponse == null) - return null; + if(SCSIInquiryResponse == null) return null; SCSIInquiry response = SCSIInquiryResponse.Value; StringBuilder sb = new StringBuilder(); - sb.AppendFormat("Device vendor: {0}", VendorString.Prettify(StringHandlers.CToString(response.VendorIdentification).Trim())).AppendLine(); - sb.AppendFormat("Device name: {0}", StringHandlers.CToString(response.ProductIdentification).Trim()).AppendLine(); - sb.AppendFormat("Device release level: {0}", StringHandlers.CToString(response.ProductRevisionLevel).Trim()).AppendLine(); + sb.AppendFormat("Device vendor: {0}", + VendorString.Prettify(StringHandlers.CToString(response.VendorIdentification).Trim())) + .AppendLine(); + sb.AppendFormat("Device name: {0}", StringHandlers.CToString(response.ProductIdentification).Trim()) + .AppendLine(); + sb.AppendFormat("Device release level: {0}", StringHandlers.CToString(response.ProductRevisionLevel).Trim()) + .AppendLine(); switch((PeripheralQualifiers)response.PeripheralQualifier) { case PeripheralQualifiers.Supported: @@ -289,7 +292,8 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("Device is connected but unsupported."); break; default: - sb.AppendFormat("Vendor value {0} set in Peripheral Qualifier field.", response.PeripheralQualifier).AppendLine(); + sb.AppendFormat("Vendor value {0} set in Peripheral Qualifier field.", response.PeripheralQualifier) + .AppendLine(); break; } @@ -365,7 +369,8 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("Unknown or no device type"); break; default: - sb.AppendFormat("Unknown device type field value 0x{0:X2}", response.PeripheralDeviceType).AppendLine(); + sb.AppendFormat("Unknown device type field value 0x{0:X2}", response.PeripheralDeviceType) + .AppendLine(); break; } @@ -393,7 +398,8 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("Device claims to comply with ANSI X3.408:2005 (SPC-4)"); break; default: - sb.AppendFormat("Device claims to comply with unknown SCSI ANSI standard value 0x{0:X2})", response.ANSIVersion).AppendLine(); + sb.AppendFormat("Device claims to comply with unknown SCSI ANSI standard value 0x{0:X2})", + response.ANSIVersion).AppendLine(); break; } @@ -406,7 +412,8 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("Device claims to comply ECMA-111: Small Computer System Interface SCSI"); break; default: - sb.AppendFormat("Device claims to comply with unknown SCSI ECMA standard value 0x{0:X2})", response.ECMAVersion).AppendLine(); + sb.AppendFormat("Device claims to comply with unknown SCSI ECMA standard value 0x{0:X2})", + response.ECMAVersion).AppendLine(); break; } @@ -419,65 +426,39 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("Device claims to comply with ISO/IEC 9316:1995"); break; default: - sb.AppendFormat("Device claims to comply with unknown SCSI ISO/IEC standard value 0x{0:X2})", response.ISOVersion).AppendLine(); + sb.AppendFormat("Device claims to comply with unknown SCSI ISO/IEC standard value 0x{0:X2})", + response.ISOVersion).AppendLine(); break; } - if(response.RMB) - sb.AppendLine("Device is removable"); - if(response.AERC) - sb.AppendLine("Device supports Asynchronous Event Reporting Capability"); - if(response.TrmTsk) - sb.AppendLine("Device supports TERMINATE TASK command"); - if(response.NormACA) - sb.AppendLine("Device supports setting Normal ACA"); - if(response.HiSup) - sb.AppendLine("Device supports LUN hierarchical addressing"); - if(response.SCCS) - sb.AppendLine("Device contains an embedded storage array controller"); - if(response.ACC) - sb.AppendLine("Device contains an Access Control Coordinator"); - if(response.ThreePC) - sb.AppendLine("Device supports third-party copy commands"); - if(response.Protect) - sb.AppendLine("Device supports protection information"); - if(response.BQue) - sb.AppendLine("Device supports basic queueing"); - if(response.EncServ) - sb.AppendLine("Device contains an embedded enclosure services component"); - if(response.MultiP) - sb.AppendLine("Multi-port device"); - if(response.MChngr) - sb.AppendLine("Device contains or is attached to a medium changer"); - if(response.ACKREQQ) - sb.AppendLine("Device supports request and acknowledge handshakes"); - if(response.Addr32) - sb.AppendLine("Device supports 32-bit wide SCSI addresses"); - if(response.Addr16) - sb.AppendLine("Device supports 16-bit wide SCSI addresses"); - if(response.RelAddr) - sb.AppendLine("Device supports relative addressing"); - if(response.WBus32) - sb.AppendLine("Device supports 32-bit wide data transfers"); - if(response.WBus16) - sb.AppendLine("Device supports 16-bit wide data transfers"); - if(response.Sync) - sb.AppendLine("Device supports synchronous data transfer"); - if(response.Linked) - sb.AppendLine("Device supports linked commands"); - if(response.TranDis) - sb.AppendLine("Device supports CONTINUE TASK and TARGET TRANSFER DISABLE commands"); - if(response.QAS) - sb.AppendLine("Device supports Quick Arbitration and Selection"); - if(response.CmdQue) - sb.AppendLine("Device supports TCQ queue"); - if(response.IUS) - sb.AppendLine("Device supports information unit transfers"); - if(response.SftRe) - sb.AppendLine("Device implements RESET as a soft reset"); + if(response.RMB) sb.AppendLine("Device is removable"); + if(response.AERC) sb.AppendLine("Device supports Asynchronous Event Reporting Capability"); + if(response.TrmTsk) sb.AppendLine("Device supports TERMINATE TASK command"); + if(response.NormACA) sb.AppendLine("Device supports setting Normal ACA"); + if(response.HiSup) sb.AppendLine("Device supports LUN hierarchical addressing"); + if(response.SCCS) sb.AppendLine("Device contains an embedded storage array controller"); + if(response.ACC) sb.AppendLine("Device contains an Access Control Coordinator"); + if(response.ThreePC) sb.AppendLine("Device supports third-party copy commands"); + if(response.Protect) sb.AppendLine("Device supports protection information"); + if(response.BQue) sb.AppendLine("Device supports basic queueing"); + if(response.EncServ) sb.AppendLine("Device contains an embedded enclosure services component"); + if(response.MultiP) sb.AppendLine("Multi-port device"); + if(response.MChngr) sb.AppendLine("Device contains or is attached to a medium changer"); + if(response.ACKREQQ) sb.AppendLine("Device supports request and acknowledge handshakes"); + if(response.Addr32) sb.AppendLine("Device supports 32-bit wide SCSI addresses"); + if(response.Addr16) sb.AppendLine("Device supports 16-bit wide SCSI addresses"); + if(response.RelAddr) sb.AppendLine("Device supports relative addressing"); + if(response.WBus32) sb.AppendLine("Device supports 32-bit wide data transfers"); + if(response.WBus16) sb.AppendLine("Device supports 16-bit wide data transfers"); + if(response.Sync) sb.AppendLine("Device supports synchronous data transfer"); + if(response.Linked) sb.AppendLine("Device supports linked commands"); + if(response.TranDis) sb.AppendLine("Device supports CONTINUE TASK and TARGET TRANSFER DISABLE commands"); + if(response.QAS) sb.AppendLine("Device supports Quick Arbitration and Selection"); + if(response.CmdQue) sb.AppendLine("Device supports TCQ queue"); + if(response.IUS) sb.AppendLine("Device supports information unit transfers"); + if(response.SftRe) sb.AppendLine("Device implements RESET as a soft reset"); #if DEBUG - if(response.VS1) - sb.AppendLine("Vendor specific bit 5 on byte 6 of INQUIRY response is set"); + if(response.VS1) sb.AppendLine("Vendor specific bit 5 on byte 6 of INQUIRY response is set"); #endif switch((TGPSValues)response.TPGS) @@ -525,8 +506,7 @@ namespace DiscImageChef.Decoders.SCSI switch(VersionDescriptor) { case 0xFFFF: - case 0x0000: - break; + case 0x0000: break; case 0x0020: sb.AppendLine("Device complies with SAM (no version claimed)"); break; @@ -1185,7 +1165,8 @@ namespace DiscImageChef.Decoders.SCSI case 0x097D: case 0x097E: case 0x097F: - sb.AppendFormat("Device complies with iSCSI revision {0}", VersionDescriptor & 0x1F).AppendLine(); + sb.AppendFormat("Device complies with iSCSI revision {0}", VersionDescriptor & 0x1F) + .AppendLine(); break; case 0x0980: sb.AppendLine("Device complies with SBP-3 (no version claimed)"); @@ -1932,14 +1913,16 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("Device complies with IEEE 1667-2009"); break; default: - sb.AppendFormat("Device complies with unknown standard code 0x{0:X4}", VersionDescriptor).AppendLine(); + sb.AppendFormat("Device complies with unknown standard code 0x{0:X4}", VersionDescriptor) + .AppendLine(); break; } } } #region Quantum vendor prettifying - if(response.QuantumPresent && StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "quantum") + if(response.QuantumPresent && + StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "quantum") { sb.AppendLine("Quantum vendor-specific information:"); switch(response.Qt_ProductFamily) @@ -1968,77 +1951,85 @@ namespace DiscImageChef.Decoders.SCSI } sb.AppendFormat("Release firmware: {0}", response.Qt_ReleasedFirmware).AppendLine(); - sb.AppendFormat("Firmware version: {0}.{1}", response.Qt_FirmwareMajorVersion, response.Qt_FirmwareMinorVersion).AppendLine(); - sb.AppendFormat("EEPROM format version: {0}.{1}", response.Qt_EEPROMFormatMajorVersion, response.Qt_EEPROMFormatMinorVersion).AppendLine(); + sb.AppendFormat("Firmware version: {0}.{1}", response.Qt_FirmwareMajorVersion, + response.Qt_FirmwareMinorVersion).AppendLine(); + sb.AppendFormat("EEPROM format version: {0}.{1}", response.Qt_EEPROMFormatMajorVersion, + response.Qt_EEPROMFormatMinorVersion).AppendLine(); sb.AppendFormat("Firmware personality: {0}", response.Qt_FirmwarePersonality).AppendLine(); sb.AppendFormat("Firmware subpersonality: {0}", response.Qt_FirmwareSubPersonality).AppendLine(); - sb.AppendFormat("Tape directory format version: {0}", response.Qt_TapeDirectoryFormatVersion).AppendLine(); + sb.AppendFormat("Tape directory format version: {0}", response.Qt_TapeDirectoryFormatVersion) + .AppendLine(); sb.AppendFormat("Controller hardware version: {0}", response.Qt_ControllerHardwareVersion).AppendLine(); sb.AppendFormat("Drive EEPROM version: {0}", response.Qt_DriveEEPROMVersion).AppendLine(); sb.AppendFormat("Drive hardware version: {0}", response.Qt_DriveHardwareVersion).AppendLine(); - sb.AppendFormat("Media loader firmware version: {0}", response.Qt_MediaLoaderFirmwareVersion).AppendLine(); - sb.AppendFormat("Media loader hardware version: {0}", response.Qt_MediaLoaderHardwareVersion).AppendLine(); - sb.AppendFormat("Media loader mechanical version: {0}", response.Qt_MediaLoaderMechanicalVersion).AppendLine(); - if(response.Qt_LibraryPresent) - sb.AppendLine("Library is present"); - if(response.Qt_MediaLoaderPresent) - sb.AppendLine("Media loader is present"); - sb.AppendFormat("Module revision: {0}", StringHandlers.CToString(response.Qt_ModuleRevision)).AppendLine(); + sb.AppendFormat("Media loader firmware version: {0}", response.Qt_MediaLoaderFirmwareVersion) + .AppendLine(); + sb.AppendFormat("Media loader hardware version: {0}", response.Qt_MediaLoaderHardwareVersion) + .AppendLine(); + sb.AppendFormat("Media loader mechanical version: {0}", response.Qt_MediaLoaderMechanicalVersion) + .AppendLine(); + if(response.Qt_LibraryPresent) sb.AppendLine("Library is present"); + if(response.Qt_MediaLoaderPresent) sb.AppendLine("Media loader is present"); + sb.AppendFormat("Module revision: {0}", StringHandlers.CToString(response.Qt_ModuleRevision)) + .AppendLine(); } #endregion Quantum vendor prettifying #region IBM vendor prettifying - if(response.IBMPresent && StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "ibm") + if(response.IBMPresent && + StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "ibm") { sb.AppendLine("IBM vendor-specific information:"); - if(response.IBM_PerformanceLimit == 0) - sb.AppendLine("Performance is not limited"); - else - sb.AppendFormat("Performance is limited using factor {0}", response.IBM_PerformanceLimit); + if(response.IBM_PerformanceLimit == 0) sb.AppendLine("Performance is not limited"); + else sb.AppendFormat("Performance is limited using factor {0}", response.IBM_PerformanceLimit); - if(response.IBM_AutDis) - sb.AppendLine("Automation is disabled"); + if(response.IBM_AutDis) sb.AppendLine("Automation is disabled"); sb.AppendFormat("IBM OEM Specific Field: {0}", response.IBM_OEMSpecific).AppendLine(); } #endregion IBM vendor prettifying #region HP vendor prettifying - if(response.HPPresent && StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "hp") + if(response.HPPresent && + StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "hp") { sb.AppendLine("HP vendor-specific information:"); if(response.HP_WORM) sb.AppendFormat("Device supports WORM version {0}", response.HP_WORMVersion).AppendLine(); - byte[] OBDRSign = { 0x24, 0x44, 0x52, 0x2D, 0x31, 0x30}; - if(OBDRSign.SequenceEqual(response.HP_OBDR)) - sb.AppendLine("Device supports Tape Disaster Recovery"); + byte[] OBDRSign = {0x24, 0x44, 0x52, 0x2D, 0x31, 0x30}; + if(OBDRSign.SequenceEqual(response.HP_OBDR)) sb.AppendLine("Device supports Tape Disaster Recovery"); } #endregion HP vendor prettifying #region Seagate vendor prettifying - if((response.SeagatePresent || response.Seagate2Present || response.Seagate3Present) - && StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "seagate") + if((response.SeagatePresent || response.Seagate2Present || response.Seagate3Present) && + StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "seagate") { sb.AppendLine("Seagate vendor-specific information:"); if(response.SeagatePresent) - sb.AppendFormat("Drive serial number: {0}", StringHandlers.CToString(response.Seagate_DriveSerialNumber)).AppendLine(); + sb.AppendFormat("Drive serial number: {0}", + StringHandlers.CToString(response.Seagate_DriveSerialNumber)).AppendLine(); if(response.Seagate2Present) - sb.AppendFormat("Drive copyright: {0}", StringHandlers.CToString(response.Seagate_Copyright)).AppendLine(); + sb.AppendFormat("Drive copyright: {0}", StringHandlers.CToString(response.Seagate_Copyright)) + .AppendLine(); if(response.Seagate3Present) - sb.AppendFormat("Drive servo part number: {0}", PrintHex.ByteArrayToHexArrayString(response.Seagate_ServoPROMPartNo, 40)).AppendLine(); + sb.AppendFormat("Drive servo part number: {0}", + PrintHex.ByteArrayToHexArrayString(response.Seagate_ServoPROMPartNo, 40)) + .AppendLine(); } #endregion Seagate vendor prettifying #region Kreon vendor prettifying if(response.KreonPresent) { - sb.AppendFormat("Drive is flashed with Kreon firmware {0}.", StringHandlers.CToString(response.KreonVersion)).AppendLine(); + sb.AppendFormat("Drive is flashed with Kreon firmware {0}.", + StringHandlers.CToString(response.KreonVersion)).AppendLine(); } #endregion Kreon vendor prettifying @@ -2049,8 +2040,7 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendFormat("Reserved byte 5, bits 2 to 1 = 0x{0:X2}", response.Reserved2).AppendLine(); if(response.Reserved3 != 0) sb.AppendFormat("Reserved byte 56, bits 7 to 4 = 0x{0:X2}", response.Reserved3).AppendLine(); - if(response.Reserved4 != 0) - sb.AppendFormat("Reserved byte 57 = 0x{0:X2}", response.Reserved4).AppendLine(); + if(response.Reserved4 != 0) sb.AppendFormat("Reserved byte 57 = 0x{0:X2}", response.Reserved4).AppendLine(); if(response.Reserved5 != null) { @@ -2097,11 +2087,9 @@ namespace DiscImageChef.Decoders.SCSI SCSIInquiry? decoded = Decode(SCSIInquiryResponse); return Prettify(decoded); } - #endregion Public methods #region Public structures - // SCSI INQUIRY command response public struct SCSIInquiry { @@ -2341,6 +2329,7 @@ namespace DiscImageChef.Decoders.SCSI public byte[] VendorSpecific2; // Per DLT4000/DLT4500/DLT4700 Cartridge Tape Subsystem Product Manual + #region Quantum vendor unique inquiry data structure /// /// Means that the INQUIRY response contains 56 bytes or more, so this data has been filled @@ -2532,8 +2521,6 @@ namespace DiscImageChef.Decoders.SCSI public byte[] KreonVersion; #endregion Kreon vendor unique inquiry data structure } - #endregion Public structures } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/MMC/AACS.cs b/DiscImageChef.Decoders/SCSI/MMC/AACS.cs index ba13bf6a..715f3bfb 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/AACS.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/AACS.cs @@ -218,8 +218,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static AACSVolumeIdentifier? DecodeAACSVolumeIdentifier(byte[] AACSVIResponse) { - if(AACSVIResponse == null) - return null; + if(AACSVIResponse == null) return null; AACSVolumeIdentifier decoded = new AACSVolumeIdentifier(); @@ -237,18 +236,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyAACSVolumeIdentifier(AACSVolumeIdentifier? AACSVIResponse) { - if(AACSVIResponse == null) - return null; + if(AACSVIResponse == null) return null; AACSVolumeIdentifier response = AACSVIResponse.Value; StringBuilder sb = new StringBuilder(); #if DEBUG - if(response.Reserved1 != 0) - sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); - if(response.Reserved2 != 0) - sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); + if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); + if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); #endif sb.AppendFormat("AACS Volume Identifier in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.VolumeIdentifier, 80)); @@ -264,8 +260,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static AACSMediaSerialNumber? DecodeAACSMediaSerialNumber(byte[] AACSMSNResponse) { - if(AACSMSNResponse == null) - return null; + if(AACSMSNResponse == null) return null; AACSMediaSerialNumber decoded = new AACSMediaSerialNumber(); @@ -283,18 +278,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyAACSMediaSerialNumber(AACSMediaSerialNumber? AACSMSNResponse) { - if(AACSMSNResponse == null) - return null; + if(AACSMSNResponse == null) return null; AACSMediaSerialNumber response = AACSMSNResponse.Value; StringBuilder sb = new StringBuilder(); #if DEBUG - if(response.Reserved1 != 0) - sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); - if(response.Reserved2 != 0) - sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); + if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); + if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); #endif sb.AppendFormat("AACS Media Serial Number in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaSerialNumber, 80)); @@ -310,8 +302,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static AACSMediaIdentifier? DecodeAACSMediaIdentifier(byte[] AACSMIResponse) { - if(AACSMIResponse == null) - return null; + if(AACSMIResponse == null) return null; AACSMediaIdentifier decoded = new AACSMediaIdentifier(); @@ -329,18 +320,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyAACSMediaIdentifier(AACSMediaIdentifier? AACSMIResponse) { - if(AACSMIResponse == null) - return null; + if(AACSMIResponse == null) return null; AACSMediaIdentifier response = AACSMIResponse.Value; StringBuilder sb = new StringBuilder(); #if DEBUG - if(response.Reserved1 != 0) - sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); - if(response.Reserved2 != 0) - sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); + if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); + if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); #endif sb.AppendFormat("AACS Media Identifier in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaIdentifier, 80)); @@ -356,8 +344,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static AACSMediaKeyBlock? DecodeAACSMediaKeyBlock(byte[] AACSMKBResponse) { - if(AACSMKBResponse == null) - return null; + if(AACSMKBResponse == null) return null; AACSMediaKeyBlock decoded = new AACSMediaKeyBlock(); @@ -375,18 +362,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyAACSMediaKeyBlock(AACSMediaKeyBlock? AACSMKBResponse) { - if(AACSMKBResponse == null) - return null; + if(AACSMKBResponse == null) return null; AACSMediaKeyBlock response = AACSMKBResponse.Value; StringBuilder sb = new StringBuilder(); #if DEBUG - if(response.Reserved != 0) - sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine(); + if(response.Reserved != 0) sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine(); #endif - sb.AppendFormat("Total number of media key blocks available to transfer {0}", response.TotalPacks).AppendLine(); + sb.AppendFormat("Total number of media key blocks available to transfer {0}", response.TotalPacks) + .AppendLine(); sb.AppendFormat("AACS Media Key Blocks in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaKeyBlockPacks, 80)); @@ -401,8 +387,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static AACSDataKeys? DecodeAACSDataKeys(byte[] AACSDKResponse) { - if(AACSDKResponse == null) - return null; + if(AACSDKResponse == null) return null; AACSDataKeys decoded = new AACSDataKeys(); @@ -420,18 +405,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyAACSDataKeys(AACSDataKeys? AACSDKResponse) { - if(AACSDKResponse == null) - return null; + if(AACSDKResponse == null) return null; AACSDataKeys response = AACSDKResponse.Value; StringBuilder sb = new StringBuilder(); #if DEBUG - if(response.Reserved1 != 0) - sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); - if(response.Reserved2 != 0) - sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); + if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); + if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); #endif sb.AppendFormat("AACS Data Keys in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.DataKeys, 80)); @@ -447,8 +429,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static AACSLBAExtentsResponse? DecodeAACSLBAExtents(byte[] AACSLBAExtsResponse) { - if(AACSLBAExtsResponse == null) - return null; + if(AACSLBAExtsResponse == null) return null; AACSLBAExtentsResponse decoded = new AACSLBAExtentsResponse(); @@ -458,8 +439,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Reserved = AACSLBAExtsResponse[2]; decoded.MaxLBAExtents = AACSLBAExtsResponse[3]; - if((AACSLBAExtsResponse.Length - 4) % 16 != 0) - return decoded; + if((AACSLBAExtsResponse.Length - 4) % 16 != 0) return decoded; decoded.Extents = new AACSLBAExtent[(AACSLBAExtsResponse.Length - 4) / 16]; @@ -476,8 +456,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyAACSLBAExtents(AACSLBAExtentsResponse? AACSLBAExtsResponse) { - if(AACSLBAExtsResponse == null) - return null; + if(AACSLBAExtsResponse == null) return null; AACSLBAExtentsResponse response = AACSLBAExtsResponse.Value; @@ -485,16 +464,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC if(response.MaxLBAExtents == 0) { - if(response.DataLength > 2) - sb.AppendLine("Drive can store 256 LBA Extents"); - else - sb.AppendLine("Drive cannot store LBA Extents"); + if(response.DataLength > 2) sb.AppendLine("Drive can store 256 LBA Extents"); + else sb.AppendLine("Drive cannot store LBA Extents"); } - else - sb.AppendFormat("Drive can store {0} LBA Extents", response.MaxLBAExtents).AppendLine(); + else sb.AppendFormat("Drive can store {0} LBA Extents", response.MaxLBAExtents).AppendLine(); for(int i = 0; i < response.Extents.Length; i++) - sb.AppendFormat("LBA Extent {0} starts at LBA {1} and goes for {2} sectors", i, response.Extents[i].StartLBA, response.Extents[i].LBACount); + sb.AppendFormat("LBA Extent {0} starts at LBA {1} and goes for {2} sectors", i, + response.Extents[i].StartLBA, response.Extents[i].LBACount); return sb.ToString(); } @@ -505,5 +482,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC return PrettifyAACSLBAExtents(decoded); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/MMC/CPRM.cs b/DiscImageChef.Decoders/SCSI/MMC/CPRM.cs index 670a7740..db291bb5 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/CPRM.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/CPRM.cs @@ -78,8 +78,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static CPRMMediaKeyBlock? DecodeCPRMMediaKeyBlock(byte[] CPRMMKBResponse) { - if(CPRMMKBResponse == null) - return null; + if(CPRMMKBResponse == null) return null; CPRMMediaKeyBlock decoded = new CPRMMediaKeyBlock(); @@ -97,18 +96,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyCPRMMediaKeyBlock(CPRMMediaKeyBlock? CPRMMKBResponse) { - if(CPRMMKBResponse == null) - return null; + if(CPRMMKBResponse == null) return null; CPRMMediaKeyBlock response = CPRMMKBResponse.Value; StringBuilder sb = new StringBuilder(); #if DEBUG - if(response.Reserved != 0) - sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine(); + if(response.Reserved != 0) sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine(); #endif - sb.AppendFormat("Total number of CPRM Media Key Blocks available to transfer: {0}", response.TotalPacks).AppendLine(); + sb.AppendFormat("Total number of CPRM Media Key Blocks available to transfer: {0}", response.TotalPacks) + .AppendLine(); sb.AppendFormat("CPRM Media Key Blocks in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MKBPackData, 80)); @@ -121,5 +119,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC return PrettifyCPRMMediaKeyBlock(decoded); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs b/DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs index 39d9ea91..20114dbd 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs @@ -275,17 +275,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static StandardDiscInformation? Decode000b(byte[] response) { - if(response.Length < 34) - return null; + if(response.Length < 34) return null; - if((response[2] & 0xE0) != 0) - return null; + if((response[2] & 0xE0) != 0) return null; StandardDiscInformation decoded = new StandardDiscInformation(); decoded.DataLength = (ushort)((response[0] << 8) + response[1]); - if((decoded.DataLength + 2) != response.Length) - return null; + if((decoded.DataLength + 2) != response.Length) return null; decoded.DataType = (byte)((response[2] & 0xE0) >> 5); decoded.Erasable |= (response[2] & 0x10) == 0x10; @@ -304,12 +301,12 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Dbit |= (response[7] & 0x04) == 0x04; decoded.BGFormatStatus = (byte)(response[7] & 0x03); - decoded.DiscIdentification = (uint)((response[12] << 24) + (response[13] << 16) + - (response[14] << 8) + response[15]); - decoded.LastSessionLeadInStartLBA = (uint)((response[16] << 24) + (response[17] << 16) + - (response[18] << 8) + response[19]); - decoded.LastPossibleLeadOutStartLBA = (uint)((response[20] << 24) + (response[21] << 16) + - (response[22] << 8) + response[23]); + decoded.DiscIdentification = + (uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]); + decoded.LastSessionLeadInStartLBA = + (uint)((response[16] << 24) + (response[17] << 16) + (response[18] << 8) + response[19]); + decoded.LastPossibleLeadOutStartLBA = + (uint)((response[20] << 24) + (response[21] << 16) + (response[22] << 8) + response[23]); byte[] temp = new byte[8]; Array.Copy(response, 24, temp, 0, 8); @@ -335,13 +332,11 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify000b(StandardDiscInformation? information) { - if(!information.HasValue) - return null; + if(!information.HasValue) return null; StandardDiscInformation decoded = information.Value; - if(decoded.DataType != 0) - return null; + if(decoded.DataType != 0) return null; StringBuilder sb = new StringBuilder(); @@ -377,8 +372,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC break; } - if(decoded.Erasable) - sb.AppendLine("Disc is erasable"); + if(decoded.Erasable) sb.AppendLine("Disc is erasable"); switch(decoded.LastSessionStatus) { @@ -409,41 +403,35 @@ namespace DiscImageChef.Decoders.SCSI.MMC break; } - if(decoded.Dbit) - sb.AppendLine("MRW is dirty"); + if(decoded.Dbit) sb.AppendLine("MRW is dirty"); sb.AppendFormat("First track on disc is track {0}", decoded.FirstTrackNumber).AppendLine(); sb.AppendFormat("Disc has {0} sessions", decoded.Sessions).AppendLine(); sb.AppendFormat("First track in last session is track {0}", decoded.FirstTrackLastSession).AppendLine(); sb.AppendFormat("Last track in last session is track {0}", decoded.LastTrackLastSession).AppendLine(); - sb.AppendFormat("Last session Lead-In address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}", decoded.LastSessionLeadInStartLBA, - (decoded.LastSessionLeadInStartLBA & 0xFF0000) >> 16, - (decoded.LastSessionLeadInStartLBA & 0xFF00) >> 8, - (decoded.LastSessionLeadInStartLBA & 0xFF)).AppendLine(); - sb.AppendFormat("Last possible Lead-Out address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}", decoded.LastPossibleLeadOutStartLBA, - (decoded.LastPossibleLeadOutStartLBA & 0xFF0000) >> 16, - (decoded.LastPossibleLeadOutStartLBA & 0xFF00) >> 8, - (decoded.LastPossibleLeadOutStartLBA & 0xFF)).AppendLine(); + sb.AppendFormat("Last session Lead-In address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}", + decoded.LastSessionLeadInStartLBA, (decoded.LastSessionLeadInStartLBA & 0xFF0000) >> 16, + (decoded.LastSessionLeadInStartLBA & 0xFF00) >> 8, + (decoded.LastSessionLeadInStartLBA & 0xFF)).AppendLine(); + sb.AppendFormat("Last possible Lead-Out address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}", + decoded.LastPossibleLeadOutStartLBA, (decoded.LastPossibleLeadOutStartLBA & 0xFF0000) >> 16, + (decoded.LastPossibleLeadOutStartLBA & 0xFF00) >> 8, + (decoded.LastPossibleLeadOutStartLBA & 0xFF)).AppendLine(); - if(decoded.URU) - sb.AppendLine("Disc is defined for unrestricted use"); - else - sb.AppendLine("Disc is defined for restricted use"); + if(decoded.URU) sb.AppendLine("Disc is defined for unrestricted use"); + else sb.AppendLine("Disc is defined for restricted use"); - if(decoded.DID_V) - sb.AppendFormat("Disc ID: {0:X6}", decoded.DiscIdentification & 0x00FFFFFF).AppendLine(); - if(decoded.DBC_V) - sb.AppendFormat("Disc barcode: {0:X16}", decoded.DiscBarcode).AppendLine(); - if(decoded.DAC_V) - sb.AppendFormat("Disc application code: {0}", decoded.DiscApplicationCode).AppendLine(); + if(decoded.DID_V) sb.AppendFormat("Disc ID: {0:X6}", decoded.DiscIdentification & 0x00FFFFFF).AppendLine(); + if(decoded.DBC_V) sb.AppendFormat("Disc barcode: {0:X16}", decoded.DiscBarcode).AppendLine(); + if(decoded.DAC_V) sb.AppendFormat("Disc application code: {0}", decoded.DiscApplicationCode).AppendLine(); if(decoded.OPCTables != null) { foreach(OPCTable table in decoded.OPCTables) { sb.AppendFormat("OPC values for {0}Kbit/sec.: {1}, {2}, {3}, {4}, {5}, {6}", table.Speed, - table.OPCValues[0], table.OPCValues[1], table.OPCValues[2], - table.OPCValues[3], table.OPCValues[4], table.OPCValues[5]).AppendLine(); + table.OPCValues[0], table.OPCValues[1], table.OPCValues[2], table.OPCValues[3], + table.OPCValues[4], table.OPCValues[5]).AppendLine(); } } @@ -452,17 +440,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static TrackResourcesInformation? Decode001b(byte[] response) { - if(response.Length != 12) - return null; + if(response.Length != 12) return null; - if((response[2] & 0xE0) != 0x20) - return null; + if((response[2] & 0xE0) != 0x20) return null; TrackResourcesInformation decoded = new TrackResourcesInformation(); decoded.DataLength = (ushort)((response[0] << 8) + response[1]); - if((decoded.DataLength + 2) != response.Length) - return null; + if((decoded.DataLength + 2) != response.Length) return null; decoded.DataType = (byte)((response[2] & 0xE0) >> 5); decoded.MaxTracks = (ushort)((response[4] << 8) + response[5]); @@ -475,19 +460,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify001b(TrackResourcesInformation? information) { - if(!information.HasValue) - return null; + if(!information.HasValue) return null; TrackResourcesInformation decoded = information.Value; - if(decoded.DataType != 1) - return null; + if(decoded.DataType != 1) return null; StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0} maximum possible tracks on the disc", decoded.MaxTracks).AppendLine(); sb.AppendFormat("{0} assigned tracks on the disc", decoded.AssignedTracks).AppendLine(); - sb.AppendFormat("{0} maximum possible appendable tracks on the disc", decoded.AppendableTracks).AppendLine(); + sb.AppendFormat("{0} maximum possible appendable tracks on the disc", decoded.AppendableTracks) + .AppendLine(); sb.AppendFormat("{0} current appendable tracks on the disc", decoded.MaxAppendableTracks).AppendLine(); return sb.ToString(); @@ -495,40 +479,39 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static POWResourcesInformation? Decode010b(byte[] response) { - if(response.Length != 16) - return null; + if(response.Length != 16) return null; - if((response[2] & 0xE0) != 0x40) - return null; + if((response[2] & 0xE0) != 0x40) return null; POWResourcesInformation decoded = new POWResourcesInformation(); decoded.DataLength = (ushort)((response[0] << 8) + response[1]); - if((decoded.DataLength + 2) != response.Length) - return null; + if((decoded.DataLength + 2) != response.Length) return null; decoded.DataType = (byte)((response[2] & 0xE0) >> 5); - decoded.RemainingPOWReplacements = (ushort)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]); - decoded.RemainingPOWReallocation = (ushort)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]); - decoded.RemainingPOWUpdates = (ushort)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]); + decoded.RemainingPOWReplacements = + (ushort)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]); + decoded.RemainingPOWReallocation = + (ushort)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]); + decoded.RemainingPOWUpdates = + (ushort)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]); return decoded; } public static string Prettify010b(POWResourcesInformation? information) { - if(!information.HasValue) - return null; + if(!information.HasValue) return null; POWResourcesInformation decoded = information.Value; - if(decoded.DataType != 1) - return null; + if(decoded.DataType != 1) return null; StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0} remaining POW replacements", decoded.RemainingPOWReplacements).AppendLine(); - sb.AppendFormat("{0} remaining POW reallocation map entries", decoded.RemainingPOWReallocation).AppendLine(); + sb.AppendFormat("{0} remaining POW reallocation map entries", decoded.RemainingPOWReallocation) + .AppendLine(); sb.AppendFormat("{0} remaining POW updates", decoded.RemainingPOWUpdates).AppendLine(); return sb.ToString(); @@ -536,24 +519,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length < 12) - return null; + if(response.Length < 12) return null; switch(response[2] & 0xE0) { - case 0x00: - return Prettify000b(Decode000b(response)); - case 0x20: - return Prettify001b(Decode001b(response)); - case 0x40: - return Prettify010b(Decode010b(response)); + case 0x00: return Prettify000b(Decode000b(response)); + case 0x20: return Prettify001b(Decode001b(response)); + case 0x40: return Prettify010b(Decode010b(response)); } return null; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/MMC/Enums.cs b/DiscImageChef.Decoders/SCSI/MMC/Enums.cs index 3560552e..28fce67f 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/Enums.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/Enums.cs @@ -74,5 +74,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC CDROMXA = 0x20, Undefined = 0xFF } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/MMC/Features.cs b/DiscImageChef.Decoders/SCSI/MMC/Features.cs index cda1d946..2a1d845d 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/Features.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/Features.cs @@ -36,7 +36,6 @@ using System.Text; namespace DiscImageChef.Decoders.SCSI.MMC { - /// /// MMC Feature enumeration /// @@ -1630,7 +1629,6 @@ namespace DiscImageChef.Decoders.SCSI.MMC public bool HDDVDRAM; } - /// /// HD DVD Write Feature (0051h) /// @@ -2164,19 +2162,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC { public static Feature_0000? Decode_0000(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0000) - return null; + if(number != 0x0000) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0000 decoded = new Feature_0000(); @@ -2194,6 +2188,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC listProfiles.Add(prof); offset += 4; } + decoded.Profiles = listProfiles.ToArray(); return decoded; @@ -2201,19 +2196,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0001? Decode_0001(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0001) - return null; + if(number != 0x0001) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0001 decoded = new Feature_0001(); @@ -2222,32 +2213,27 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Version = (byte)((feature[2] & 0x3C) >> 2); if(decoded.Version >= 0) - decoded.PhysicalInterfaceStandard = (PhysicalInterfaces)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); + decoded.PhysicalInterfaceStandard = + (PhysicalInterfaces)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); - if(decoded.Version >= 1 && feature.Length >= 12) - decoded.DBE |= (feature[8] & 0x01) == 0x01; + if(decoded.Version >= 1 && feature.Length >= 12) decoded.DBE |= (feature[8] & 0x01) == 0x01; - if(decoded.Version >= 2 && feature.Length >= 12) - decoded.INQ2 |= (feature[8] & 0x02) == 0x02; + if(decoded.Version >= 2 && feature.Length >= 12) decoded.INQ2 |= (feature[8] & 0x02) == 0x02; return decoded; } public static Feature_0002? Decode_0002(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0002) - return null; + if(number != 0x0002) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0002 decoded = new Feature_0002(); @@ -2255,30 +2241,24 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if(decoded.Version >= 0) - decoded.Async |= (feature[4] & 0x01) == 0x01; + if(decoded.Version >= 0) decoded.Async |= (feature[4] & 0x01) == 0x01; - if(decoded.Version >= 1) - decoded.OCEvent |= (feature[4] & 0x02) == 0x02; + if(decoded.Version >= 1) decoded.OCEvent |= (feature[4] & 0x02) == 0x02; return decoded; } public static Feature_0003? Decode_0003(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0003) - return null; + if(number != 0x0003) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0003 decoded = new Feature_0003(); @@ -2305,19 +2285,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0004? Decode_0004(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0004) - return null; + if(number != 0x0004) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0004 decoded = new Feature_0004(); @@ -2331,30 +2307,24 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.SSWPP |= (feature[4] & 0x01) == 0x01; } - if(decoded.Version >= 1) - decoded.WDCB |= (feature[4] & 0x04) == 0x04; + if(decoded.Version >= 1) decoded.WDCB |= (feature[4] & 0x04) == 0x04; - if(decoded.Version >= 2) - decoded.DWP |= (feature[4] & 0x08) == 0x08; + if(decoded.Version >= 2) decoded.DWP |= (feature[4] & 0x08) == 0x08; return decoded; } public static Feature_0010? Decode_0010(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 12) - return null; + if(feature.Length < 12) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0010) - return null; + if(number != 0x0010) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0010 decoded = new Feature_0010(); @@ -2364,7 +2334,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC if(decoded.Version >= 0) { - decoded.LogicalBlockSize = (uint)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); + decoded.LogicalBlockSize = + (uint)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); decoded.Blocking = (ushort)((feature[8] << 8) + feature[9]); decoded.PP |= (feature[10] & 0x01) == 0x01; } @@ -2374,19 +2345,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_001D? Decode_001D(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x001D) - return null; + if(number != 0x001D) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_001D decoded = new Feature_001D(); @@ -2399,19 +2366,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_001E? Decode_001E(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x001E) - return null; + if(number != 0x001E) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_001E decoded = new Feature_001E(); @@ -2425,27 +2388,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.CDText |= (feature[4] & 0x01) == 0x01; } - if(decoded.Version >= 2) - decoded.DAP |= (feature[4] & 0x80) == 0x80; + if(decoded.Version >= 2) decoded.DAP |= (feature[4] & 0x80) == 0x80; return decoded; } public static Feature_001F? Decode_001F(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x001F) - return null; + if(number != 0x001F) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_001F decoded = new Feature_001F(); @@ -2460,27 +2418,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC } // TODO: Check this - if(decoded.Version >= 2 && feature.Length >= 8) - decoded.DualRW |= (feature[6] & 0x02) == 0x02; + if(decoded.Version >= 2 && feature.Length >= 8) decoded.DualRW |= (feature[6] & 0x02) == 0x02; return decoded; } public static Feature_0020? Decode_0020(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 16) - return null; + if(feature.Length < 16) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0020) - return null; + if(number != 0x0020) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0020 decoded = new Feature_0020(); @@ -2491,7 +2444,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC if(decoded.Version >= 1) { decoded.LastLBA = (uint)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); - decoded.LogicalBlockSize = (uint)((feature[8] << 24) + (feature[9] << 16) + (feature[10] << 8) + feature[11]); + decoded.LogicalBlockSize = + (uint)((feature[8] << 24) + (feature[9] << 16) + (feature[10] << 8) + feature[11]); decoded.Blocking = (ushort)((feature[12] << 8) + feature[13]); decoded.PP |= (feature[14] & 0x01) == 0x01; } @@ -2501,19 +2455,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0021? Decode_0021(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0021) - return null; + if(number != 0x0021) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0021 decoded = new Feature_0021(); @@ -2526,8 +2476,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.DataTypeSupported = (ushort)((feature[4] << 8) + feature[5]); decoded.BUF |= (feature[6] & 0x01) == 0x01; decoded.LinkSizes = new byte[feature[7]]; - if(feature.Length > (feature[7] + 8)) - Array.Copy(feature, 8, decoded.LinkSizes, 0, feature[7]); + if(feature.Length > (feature[7] + 8)) Array.Copy(feature, 8, decoded.LinkSizes, 0, feature[7]); } if(decoded.Version >= 3) @@ -2541,19 +2490,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0022? Decode_0022(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0022) - return null; + if(number != 0x0022) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0022 decoded = new Feature_0022(); @@ -2566,19 +2511,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0023? Decode_0023(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0023) - return null; + if(number != 0x0023) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0023 decoded = new Feature_0023(); @@ -2595,27 +2536,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.RRM |= (feature[8] & 0x01) == 0x01; } - if(decoded.Version >= 2 && feature.Length >= 12) - decoded.FRF |= (feature[4] & 0x80) == 0x80; + if(decoded.Version >= 2 && feature.Length >= 12) decoded.FRF |= (feature[4] & 0x80) == 0x80; return decoded; } public static Feature_0024? Decode_0024(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0024) - return null; + if(number != 0x0024) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0024 decoded = new Feature_0024(); @@ -2623,27 +2559,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if(decoded.Version >= 1 && feature.Length >= 8) - decoded.SSA |= (feature[4] & 0x80) == 0x80; + if(decoded.Version >= 1 && feature.Length >= 8) decoded.SSA |= (feature[4] & 0x80) == 0x80; return decoded; } public static Feature_0025? Decode_0025(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 12) - return null; + if(feature.Length < 12) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0025) - return null; + if(number != 0x0025) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0025 decoded = new Feature_0025(); @@ -2653,7 +2584,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC if(decoded.Version >= 0) { - decoded.LogicalBlockSize = (uint)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); + decoded.LogicalBlockSize = + (uint)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); decoded.Blocking = (ushort)((feature[8] << 8) + feature[9]); decoded.PP |= (feature[10] & 0x01) == 0x01; } @@ -2663,19 +2595,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0026? Decode_0026(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0026) - return null; + if(number != 0x0026) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0026 decoded = new Feature_0026(); @@ -2688,19 +2616,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0027? Decode_0027(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0027) - return null; + if(number != 0x0027) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0027 decoded = new Feature_0027(); @@ -2713,19 +2637,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0028? Decode_0028(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0028) - return null; + if(number != 0x0028) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0028 decoded = new Feature_0028(); @@ -2733,8 +2653,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if(decoded.Version >= 0) - decoded.Write |= (feature[4] & 0x01) == 0x01; + if(decoded.Version >= 0) decoded.Write |= (feature[4] & 0x01) == 0x01; if(decoded.Version >= 1) { @@ -2747,19 +2666,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0029? Decode_0029(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0029) - return null; + if(number != 0x0029) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0029 decoded = new Feature_0029(); @@ -2779,19 +2694,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_002A? Decode_002A(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x002A) - return null; + if(number != 0x002A) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_002A decoded = new Feature_002A(); @@ -2805,27 +2716,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.CloseOnly |= (feature[5] & 0x01) == 0x01; } - if(decoded.Version >= 1) - decoded.QuickStart |= (feature[5] & 0x02) == 0x02; + if(decoded.Version >= 1) decoded.QuickStart |= (feature[5] & 0x02) == 0x02; return decoded; } public static Feature_002B? Decode_002B(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x002B) - return null; + if(number != 0x002B) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_002B decoded = new Feature_002B(); @@ -2833,27 +2739,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if(decoded.Version >= 0) - decoded.Write |= (feature[4] & 0x01) == 0x01; + if(decoded.Version >= 0) decoded.Write |= (feature[4] & 0x01) == 0x01; return decoded; } public static Feature_002C? Decode_002C(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x002C) - return null; + if(number != 0x002C) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_002C decoded = new Feature_002C(); @@ -2874,19 +2775,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_002D? Decode_002D(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x002D) - return null; + if(number != 0x002D) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_002D decoded = new Feature_002D(); @@ -2914,19 +2811,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_002E? Decode_002E(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x002E) - return null; + if(number != 0x002E) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_002E decoded = new Feature_002E(); @@ -2945,27 +2838,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.MaxCueSheet = (uint)((feature[5] << 16) + (feature[6] << 8) + feature[7]); } - if(decoded.Version >= 1) - decoded.BUF |= (feature[4] & 0x40) == 0x40; + if(decoded.Version >= 1) decoded.BUF |= (feature[4] & 0x40) == 0x40; return decoded; } public static Feature_002F? Decode_002F(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x002F) - return null; + if(number != 0x002F) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_002F decoded = new Feature_002F(); @@ -2979,30 +2867,24 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.TestWrite |= (feature[4] & 0x04) == 0x04; } - if(decoded.Version >= 1) - decoded.DVDRW |= (feature[4] & 0x02) == 0x02; + if(decoded.Version >= 1) decoded.DVDRW |= (feature[4] & 0x02) == 0x02; - if(decoded.Version >= 2) - decoded.RDL |= (feature[4] & 0x08) == 0x08; + if(decoded.Version >= 2) decoded.RDL |= (feature[4] & 0x08) == 0x08; return decoded; } public static Feature_0030? Decode_0030(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0030) - return null; + if(number != 0x0030) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0030 decoded = new Feature_0030(); @@ -3015,19 +2897,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0031? Decode_0031(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0031) - return null; + if(number != 0x0031) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0031 decoded = new Feature_0031(); @@ -3035,27 +2913,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if(decoded.Version >= 0) - decoded.TestWrite |= (feature[4] & 0x04) == 0x04; + if(decoded.Version >= 0) decoded.TestWrite |= (feature[4] & 0x04) == 0x04; return decoded; } public static Feature_0032? Decode_0032(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0032) - return null; + if(number != 0x0032) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0032 decoded = new Feature_0032(); @@ -3074,19 +2947,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0033? Decode_0033(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0033) - return null; + if(number != 0x0033) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0033 decoded = new Feature_0033(); @@ -3105,19 +2974,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0035? Decode_0035(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0035) - return null; + if(number != 0x0035) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0035 decoded = new Feature_0035(); @@ -3130,19 +2995,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0037? Decode_0037(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0037) - return null; + if(number != 0x0037) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0037 decoded = new Feature_0037(); @@ -3150,27 +3011,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if(decoded.Version >= 0) - decoded.SubtypeSupport = feature[5]; + if(decoded.Version >= 0) decoded.SubtypeSupport = feature[5]; return decoded; } public static Feature_0038? Decode_0038(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0038) - return null; + if(number != 0x0038) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0038 decoded = new Feature_0038(); @@ -3183,19 +3039,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_003A? Decode_003A(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x003A) - return null; + if(number != 0x003A) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_003A decoded = new Feature_003A(); @@ -3215,19 +3067,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_003B? Decode_003B(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x003B) - return null; + if(number != 0x003B) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_003B decoded = new Feature_003B(); @@ -3235,27 +3083,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if(decoded.Version >= 0) - decoded.Write |= (feature[4] & 0x01) == 0x01; + if(decoded.Version >= 0) decoded.Write |= (feature[4] & 0x01) == 0x01; return decoded; } public static Feature_0040? Decode_0040(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 32) - return null; + if(feature.Length < 32) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0040) - return null; + if(number != 0x0040) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0040 decoded = new Feature_0040(); @@ -3284,19 +3127,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0041? Decode_0041(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 24) - return null; + if(feature.Length < 24) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0041) - return null; + if(number != 0x0041) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0041 decoded = new Feature_0041(); @@ -3323,19 +3162,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0042? Decode_0042(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0042) - return null; + if(number != 0x0042) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0042 decoded = new Feature_0042(); @@ -3348,19 +3183,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0050? Decode_0050(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0050) - return null; + if(number != 0x0050) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0050 decoded = new Feature_0050(); @@ -3379,19 +3210,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0051? Decode_0051(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0051) - return null; + if(number != 0x0051) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0051 decoded = new Feature_0051(); @@ -3410,19 +3237,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0080? Decode_0080(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0080) - return null; + if(number != 0x0080) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0080 decoded = new Feature_0080(); @@ -3430,27 +3253,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if(decoded.Version >= 0) - decoded.RI |= (feature[4] & 0x01) == 0x01; + if(decoded.Version >= 0) decoded.RI |= (feature[4] & 0x01) == 0x01; return decoded; } public static Feature_0100? Decode_0100(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0100) - return null; + if(number != 0x0100) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0100 decoded = new Feature_0100(); @@ -3463,19 +3281,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0101? Decode_0101(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0101) - return null; + if(number != 0x0101) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0101 decoded = new Feature_0101(); @@ -3483,27 +3297,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if(decoded.Version >= 0) - decoded.PP |= (feature[4] & 0x01) == 0x01; + if(decoded.Version >= 0) decoded.PP |= (feature[4] & 0x01) == 0x01; return decoded; } public static Feature_0102? Decode_0102(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0102) - return null; + if(number != 0x0102) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0102 decoded = new Feature_0102(); @@ -3523,19 +3332,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0103? Decode_0103(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0103) - return null; + if(number != 0x0103) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0103 decoded = new Feature_0103(); @@ -3556,19 +3361,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0104? Decode_0104(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0104) - return null; + if(number != 0x0104) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0104 decoded = new Feature_0104(); @@ -3576,27 +3377,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if(decoded.Version >= 1 && feature.Length >= 8) - decoded.M5 |= (feature[4] & 0x01) == 0x01; + if(decoded.Version >= 1 && feature.Length >= 8) decoded.M5 |= (feature[4] & 0x01) == 0x01; return decoded; } public static Feature_0105? Decode_0105(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0105) - return null; + if(number != 0x0105) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0105 decoded = new Feature_0105(); @@ -3615,19 +3411,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0106? Decode_0106(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0106) - return null; + if(number != 0x0106) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0106 decoded = new Feature_0106(); @@ -3635,27 +3427,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if(decoded.Version >= 0) - decoded.CSSVersion = feature[7]; + if(decoded.Version >= 0) decoded.CSSVersion = feature[7]; return decoded; } public static Feature_0107? Decode_0107(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0107) - return null; + if(number != 0x0107) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0107 decoded = new Feature_0107(); @@ -3683,19 +3470,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0108? Decode_0108(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0108) - return null; + if(number != 0x0108) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0108 decoded = new Feature_0108(); @@ -3715,19 +3498,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0109? Decode_0109(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0109) - return null; + if(number != 0x0109) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0109 decoded = new Feature_0109(); @@ -3740,19 +3519,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_010A? Decode_010A(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x010A) - return null; + if(number != 0x010A) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_010A decoded = new Feature_010A(); @@ -3764,7 +3539,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC { decoded.DCBs = new uint[feature[3] / 4]; for(int i = 0; i < decoded.DCBs.Length; i++) - decoded.DCBs[i] = (uint)((feature[0 + 4 + i * 4] << 24) + (feature[1 + 4 + i * 4] << 16) + (feature[2 + 4 + i * 4] << 8) + feature[3 + 4 + i * 4]); + decoded.DCBs[i] = (uint)((feature[0 + 4 + i * 4] << 24) + (feature[1 + 4 + i * 4] << 16) + + (feature[2 + 4 + i * 4] << 8) + feature[3 + 4 + i * 4]); } return decoded; @@ -3772,19 +3548,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_010B? Decode_010B(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x010B) - return null; + if(number != 0x010B) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_010B decoded = new Feature_010B(); @@ -3792,27 +3564,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if(decoded.Version >= 0) - decoded.CPRMVersion = feature[7]; + if(decoded.Version >= 0) decoded.CPRMVersion = feature[7]; return decoded; } public static Feature_010C? Decode_010C(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 20) - return null; + if(feature.Length < 20) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x010C) - return null; + if(number != 0x010C) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_010C decoded = new Feature_010C(); @@ -3836,19 +3603,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_010D? Decode_010D(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x010D) - return null; + if(number != 0x010D) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_010D decoded = new Feature_010D(); @@ -3877,19 +3640,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_010E? Decode_010E(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x010E) - return null; + if(number != 0x010E) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_010E decoded = new Feature_010E(); @@ -3897,27 +3656,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if(decoded.Version >= 0) - decoded.MaxScrambleExtent = feature[4]; + if(decoded.Version >= 0) decoded.MaxScrambleExtent = feature[4]; return decoded; } public static Feature_0110? Decode_0110(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 8) - return null; + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0110) - return null; + if(number != 0x0110) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0110 decoded = new Feature_0110(); @@ -3930,19 +3684,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0113? Decode_0113(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 4) - return null; + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0113) - return null; + if(number != 0x0113) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0113 decoded = new Feature_0113(); @@ -3955,19 +3705,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0142? Decode_0142(byte[] feature) { - if(feature == null) - return null; + if(feature == null) return null; - if(feature.Length < 6) - return null; + if(feature.Length < 6) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if(number != 0x0142) - return null; + if(number != 0x0142) return null; - if((feature[3] + 4) != feature.Length) - return null; + if((feature[3] + 4) != feature.Length) return null; Feature_0142 decoded = new Feature_0142(); @@ -3993,8 +3739,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0000(Feature_0000? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0000 ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -4128,10 +3873,8 @@ namespace DiscImageChef.Decoders.SCSI.MMC break; } - if(prof.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); + if(prof.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); } } @@ -4140,8 +3883,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0001(Feature_0001? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0001 ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -4181,12 +3923,12 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("a vendor unique interface"); break; default: - sb.AppendFormat("an unknown interface with code {0}", (uint)ftr.PhysicalInterfaceStandard).AppendLine(); + sb.AppendFormat("an unknown interface with code {0}", (uint)ftr.PhysicalInterfaceStandard) + .AppendLine(); break; } - if(ftr.DBE) - sb.AppendLine("\tDrive supports Device Busy events"); + if(ftr.DBE) sb.AppendLine("\tDrive supports Device Busy events"); if(ftr.INQ2) sb.AppendLine("\tDrive supports EVPD, Page Code and 16-bit Allocation Length as described in SPC-3"); @@ -4195,29 +3937,24 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0002(Feature_0002? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0002 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Morphing:"); - if(ftr.Async) - sb.AppendLine("\tDrive supports polling and asynchronous GET EVENT STATUS NOTIFICATION"); - else - sb.AppendLine("\tDrive supports only polling GET EVENT STATUS NOTIFICATION"); + if(ftr.Async) sb.AppendLine("\tDrive supports polling and asynchronous GET EVENT STATUS NOTIFICATION"); + else sb.AppendLine("\tDrive supports only polling GET EVENT STATUS NOTIFICATION"); - if(ftr.OCEvent) - sb.AppendLine("\tDrive supports operational change request / notification class events"); + if(ftr.OCEvent) sb.AppendLine("\tDrive supports operational change request / notification class events"); return sb.ToString(); } public static string Prettify_0003(Feature_0003? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0003 ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -4242,61 +3979,49 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("\tDrive is a changer using cartridges"); break; default: - sb.AppendFormat("\tDrive uses unknown loading mechanism type {0}", ftr.LoadingMechanismType).AppendLine(); + sb.AppendFormat("\tDrive uses unknown loading mechanism type {0}", ftr.LoadingMechanismType) + .AppendLine(); break; } - if(ftr.Lock) - sb.AppendLine("\tDrive can lock media"); - if(ftr.PreventJumper) - sb.AppendLine("\tDrive power ups locked"); - if(ftr.Eject) - sb.AppendLine("\tDrive can eject media"); - if(ftr.Load) - sb.AppendLine("\tDrive can load media"); - if(ftr.DBML) - sb.AppendLine("\tDrive reports Device Busy Class events during medium loading/unloading"); + if(ftr.Lock) sb.AppendLine("\tDrive can lock media"); + if(ftr.PreventJumper) sb.AppendLine("\tDrive power ups locked"); + if(ftr.Eject) sb.AppendLine("\tDrive can eject media"); + if(ftr.Load) sb.AppendLine("\tDrive can load media"); + if(ftr.DBML) sb.AppendLine("\tDrive reports Device Busy Class events during medium loading/unloading"); return sb.ToString(); } public static string Prettify_0004(Feature_0004? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0004 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Write Protect:"); - if(ftr.DWP) - sb.AppendLine("\tDrive supports reading/writing the Disc Write Protect PAC on BD-R/-RE media"); - if(ftr.WDCB) - sb.AppendLine("\tDrive supports writing the Write Inhibit DCB on DVD+RW media"); - if(ftr.SPWP) - sb.AppendLine("\tDrive supports set/release of PWP status"); - if(ftr.SSWPP) - sb.AppendLine("\tDrive supports the SWPP bit of the Timeout and Protect mode page"); + if(ftr.DWP) sb.AppendLine("\tDrive supports reading/writing the Disc Write Protect PAC on BD-R/-RE media"); + if(ftr.WDCB) sb.AppendLine("\tDrive supports writing the Write Inhibit DCB on DVD+RW media"); + if(ftr.SPWP) sb.AppendLine("\tDrive supports set/release of PWP status"); + if(ftr.SSWPP) sb.AppendLine("\tDrive supports the SWPP bit of the Timeout and Protect mode page"); return sb.ToString(); } public static string Prettify_0010(Feature_0010? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0010 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC Random Readable"); - if(ftr.Current) - sb.Append(" (current)"); + if(ftr.Current) sb.Append(" (current)"); sb.AppendLine(":"); - if(ftr.PP) - sb.AppendLine("\tDrive shall report Read/Write Error Recovery mode page"); + if(ftr.PP) sb.AppendLine("\tDrive shall report Read/Write Error Recovery mode page"); if(ftr.LogicalBlockSize > 0) sb.AppendFormat("\t{0} bytes per logical block", ftr.LogicalBlockSize).AppendLine(); if(ftr.Blocking > 1) @@ -4307,85 +4032,72 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_001D(Feature_001D? feature) { - return !feature.HasValue ? null : "Drive claims capability to read all CD formats according to OSTA Multi-Read Specification\n"; + return !feature.HasValue + ? null + : "Drive claims capability to read all CD formats according to OSTA Multi-Read Specification\n"; } public static string Prettify_001E(Feature_001E? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_001E ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC CD Read"); - if(ftr.Current) - sb.Append(" (current)"); + if(ftr.Current) sb.Append(" (current)"); sb.AppendLine(":"); - if(ftr.DAP) - sb.AppendLine("\tDrive supports the DAP bit in the READ CD and READ CD MSF commands"); - if(ftr.C2) - sb.AppendLine("\tDrive supports C2 Error Pointers"); - if(ftr.CDText) - sb.AppendLine("\tDrive can return CD-Text from Lead-In"); + if(ftr.DAP) sb.AppendLine("\tDrive supports the DAP bit in the READ CD and READ CD MSF commands"); + if(ftr.C2) sb.AppendLine("\tDrive supports C2 Error Pointers"); + if(ftr.CDText) sb.AppendLine("\tDrive can return CD-Text from Lead-In"); return sb.ToString(); } public static string Prettify_001F(Feature_001F? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_001F ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC DVD Read"); - if(ftr.Current) - sb.Append(" (current)"); + if(ftr.Current) sb.Append(" (current)"); sb.AppendLine(":"); sb.AppendLine("\tDrive can read DVD media"); - if(ftr.DualR) - sb.AppendLine("\tDrive can read DVD-R DL from all recording modes"); - if(ftr.DualRW) - sb.AppendLine("\tDrive can read DVD-RW DL from all recording modes"); - if(ftr.MULTI110) - sb.AppendLine("\tDrive conforms to DVD Multi Drive Read-only Specifications"); + if(ftr.DualR) sb.AppendLine("\tDrive can read DVD-R DL from all recording modes"); + if(ftr.DualRW) sb.AppendLine("\tDrive can read DVD-RW DL from all recording modes"); + if(ftr.MULTI110) sb.AppendLine("\tDrive conforms to DVD Multi Drive Read-only Specifications"); return sb.ToString(); } public static string Prettify_0020(Feature_0020? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0020 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC Random Writable:"); - if(ftr.Current) - sb.Append(" (current)"); + if(ftr.Current) sb.Append(" (current)"); sb.AppendLine(":"); - if(ftr.PP) - sb.AppendLine("\tDrive shall report Read/Write Error Recovery mode page"); + if(ftr.PP) sb.AppendLine("\tDrive shall report Read/Write Error Recovery mode page"); if(ftr.LogicalBlockSize > 0) sb.AppendFormat("\t{0} bytes per logical block", ftr.LogicalBlockSize).AppendLine(); if(ftr.Blocking > 1) sb.AppendFormat("\t{0} logical blocks per media writable unit", ftr.Blocking).AppendLine(); - if(ftr.LastLBA > 0) - sb.AppendFormat("\tLast adressable logical block is {0}", ftr.LastLBA).AppendLine(); + if(ftr.LastLBA > 0) sb.AppendFormat("\tLast adressable logical block is {0}", ftr.LastLBA).AppendLine(); return sb.ToString(); } public static string Prettify_0021(Feature_0021? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0021 ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -4395,47 +4107,28 @@ namespace DiscImageChef.Decoders.SCSI.MMC if(ftr.DataTypeSupported > 0) { sb.Append("\tDrive supports data block types:"); - if((ftr.DataTypeSupported & 0x0001) == 0x0001) - sb.Append(" 0"); - if((ftr.DataTypeSupported & 0x0002) == 0x0002) - sb.Append(" 1"); - if((ftr.DataTypeSupported & 0x0004) == 0x0004) - sb.Append(" 2"); - if((ftr.DataTypeSupported & 0x0008) == 0x0008) - sb.Append(" 3"); - if((ftr.DataTypeSupported & 0x0010) == 0x0010) - sb.Append(" 4"); - if((ftr.DataTypeSupported & 0x0020) == 0x0020) - sb.Append(" 5"); - if((ftr.DataTypeSupported & 0x0040) == 0x0040) - sb.Append(" 6"); - if((ftr.DataTypeSupported & 0x0080) == 0x0080) - sb.Append(" 7"); - if((ftr.DataTypeSupported & 0x0100) == 0x0100) - sb.Append(" 8"); - if((ftr.DataTypeSupported & 0x0200) == 0x0200) - sb.Append(" 9"); - if((ftr.DataTypeSupported & 0x0400) == 0x0400) - sb.Append(" 10"); - if((ftr.DataTypeSupported & 0x0800) == 0x0800) - sb.Append(" 11"); - if((ftr.DataTypeSupported & 0x1000) == 0x1000) - sb.Append(" 12"); - if((ftr.DataTypeSupported & 0x2000) == 0x2000) - sb.Append(" 13"); - if((ftr.DataTypeSupported & 0x4000) == 0x4000) - sb.Append(" 14"); - if((ftr.DataTypeSupported & 0x8000) == 0x8000) - sb.Append(" 15"); + if((ftr.DataTypeSupported & 0x0001) == 0x0001) sb.Append(" 0"); + if((ftr.DataTypeSupported & 0x0002) == 0x0002) sb.Append(" 1"); + if((ftr.DataTypeSupported & 0x0004) == 0x0004) sb.Append(" 2"); + if((ftr.DataTypeSupported & 0x0008) == 0x0008) sb.Append(" 3"); + if((ftr.DataTypeSupported & 0x0010) == 0x0010) sb.Append(" 4"); + if((ftr.DataTypeSupported & 0x0020) == 0x0020) sb.Append(" 5"); + if((ftr.DataTypeSupported & 0x0040) == 0x0040) sb.Append(" 6"); + if((ftr.DataTypeSupported & 0x0080) == 0x0080) sb.Append(" 7"); + if((ftr.DataTypeSupported & 0x0100) == 0x0100) sb.Append(" 8"); + if((ftr.DataTypeSupported & 0x0200) == 0x0200) sb.Append(" 9"); + if((ftr.DataTypeSupported & 0x0400) == 0x0400) sb.Append(" 10"); + if((ftr.DataTypeSupported & 0x0800) == 0x0800) sb.Append(" 11"); + if((ftr.DataTypeSupported & 0x1000) == 0x1000) sb.Append(" 12"); + if((ftr.DataTypeSupported & 0x2000) == 0x2000) sb.Append(" 13"); + if((ftr.DataTypeSupported & 0x4000) == 0x4000) sb.Append(" 14"); + if((ftr.DataTypeSupported & 0x8000) == 0x8000) sb.Append(" 15"); sb.AppendLine(); } - if(ftr.TRIO) - sb.AppendLine("\tDrive claims support to report Track Resources Information"); - if(ftr.ARSV) - sb.AppendLine("\tDrive supports address mode reservation on the RESERVE TRACK command"); - if(ftr.BUF) - sb.AppendLine("\tDrive is capable of zero loss linking"); + if(ftr.TRIO) sb.AppendLine("\tDrive claims support to report Track Resources Information"); + if(ftr.ARSV) sb.AppendLine("\tDrive supports address mode reservation on the RESERVE TRACK command"); + if(ftr.BUF) sb.AppendLine("\tDrive is capable of zero loss linking"); return sb.ToString(); } @@ -4447,8 +4140,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0023(Feature_0023? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0023 ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -4456,53 +4148,42 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("MMC Formattable:"); sb.AppendLine("\tDrive can format media into logical blocks"); - if(ftr.RENoSA) - sb.AppendLine("\tDrive can format BD-RE with no spares allocated"); - if(ftr.Expand) - sb.AppendLine("\tDrive can expand the spare area on a formatted BD-RE disc"); - if(ftr.QCert) - sb.AppendLine("\tDrive can format BD-RE discs with quick certification"); - if(ftr.Cert) - sb.AppendLine("\tDrive can format BD-RE discs with full certification"); - if(ftr.FRF) - sb.AppendLine("\tDrive can fast re-format BD-RE discs"); - if(ftr.RRM) - sb.AppendLine("\tDrive can format BD-R discs with RRM format"); + if(ftr.RENoSA) sb.AppendLine("\tDrive can format BD-RE with no spares allocated"); + if(ftr.Expand) sb.AppendLine("\tDrive can expand the spare area on a formatted BD-RE disc"); + if(ftr.QCert) sb.AppendLine("\tDrive can format BD-RE discs with quick certification"); + if(ftr.Cert) sb.AppendLine("\tDrive can format BD-RE discs with full certification"); + if(ftr.FRF) sb.AppendLine("\tDrive can fast re-format BD-RE discs"); + if(ftr.RRM) sb.AppendLine("\tDrive can format BD-R discs with RRM format"); return sb.ToString(); } public static string Prettify_0024(Feature_0024? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0024 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Hardware Defect Management:"); sb.AppendLine("\tDrive shall be able to provide a defect-free contiguous address space"); - if(ftr.SSA) - sb.AppendLine("\tDrive can return Spare Area Information"); + if(ftr.SSA) sb.AppendLine("\tDrive can return Spare Area Information"); return sb.ToString(); } public static string Prettify_0025(Feature_0025? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0025 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC Write Once"); - if(ftr.Current) - sb.Append(" (current)"); + if(ftr.Current) sb.Append(" (current)"); sb.AppendLine(":"); - if(ftr.PP) - sb.AppendLine("\tDrive shall report Read/Write Error Recovery mode page"); + if(ftr.PP) sb.AppendLine("\tDrive shall report Read/Write Error Recovery mode page"); if(ftr.LogicalBlockSize > 0) sb.AppendFormat("\t{0} bytes per logical block", ftr.LogicalBlockSize).AppendLine(); if(ftr.Blocking > 1) @@ -4513,82 +4194,67 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0026(Feature_0026? feature) { - return !feature.HasValue ? null : "Drive shall have the ability to overwrite logical blocks only in fixed sets at a time\n"; + return !feature.HasValue + ? null + : "Drive shall have the ability to overwrite logical blocks only in fixed sets at a time\n"; } public static string Prettify_0027(Feature_0027? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0027 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("Drive can write High-Speed CD-RW"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); return sb.ToString(); } public static string Prettify_0028(Feature_0028? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0028 ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if(ftr.Write && ftr.DVDPRead && ftr.DVDPWrite) - sb.Append("Drive can read and write CD-MRW and DVD+MRW"); - else if(ftr.DVDPRead && ftr.DVDPWrite) - sb.Append("Drive can read and write DVD+MRW"); - else if(ftr.Write && ftr.DVDPRead) - sb.Append("Drive and read DVD+MRW and read and write CD-MRW"); - else if(ftr.Write) - sb.Append("Drive can read and write CD-MRW"); - else if(ftr.DVDPRead) - sb.Append("Drive can read CD-MRW and DVD+MRW"); - else - sb.Append("Drive can read CD-MRW"); + if(ftr.Write && ftr.DVDPRead && ftr.DVDPWrite) sb.Append("Drive can read and write CD-MRW and DVD+MRW"); + else if(ftr.DVDPRead && ftr.DVDPWrite) sb.Append("Drive can read and write DVD+MRW"); + else if(ftr.Write && ftr.DVDPRead) sb.Append("Drive and read DVD+MRW and read and write CD-MRW"); + else if(ftr.Write) sb.Append("Drive can read and write CD-MRW"); + else if(ftr.DVDPRead) sb.Append("Drive can read CD-MRW and DVD+MRW"); + else sb.Append("Drive can read CD-MRW"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); return sb.ToString(); } public static string Prettify_0029(Feature_0029? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0029 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Enhanced Defect Reporting Feature:"); - if(ftr.DRTDM) - sb.AppendLine("\tDrive supports DRT-DM mode"); - else - sb.AppendLine("\tDrive supports Persistent-DM mode"); + if(ftr.DRTDM) sb.AppendLine("\tDrive supports DRT-DM mode"); + else sb.AppendLine("\tDrive supports Persistent-DM mode"); if(ftr.DBICacheZones > 0) sb.AppendFormat("\tDrive has {0} DBI cache zones", ftr.DBICacheZones).AppendLine(); - if(ftr.Entries > 0) - sb.AppendFormat("\tDrive has {0} DBI entries", ftr.Entries).AppendLine(); + if(ftr.Entries > 0) sb.AppendFormat("\tDrive has {0} DBI entries", ftr.Entries).AppendLine(); return sb.ToString(); } public static string Prettify_002A(Feature_002A? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_002A ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -4596,24 +4262,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC if(ftr.Write) { sb.Append("Drive can read and write DVD+RW"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); - if(ftr.CloseOnly) - sb.AppendLine("\tDrive supports only the read compatibility stop"); - else - sb.AppendLine("\tDrive supports both forms of background format stopping"); - if(ftr.QuickStart) - sb.AppendLine("\tDrive can do a quick start formatting"); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); + if(ftr.CloseOnly) sb.AppendLine("\tDrive supports only the read compatibility stop"); + else sb.AppendLine("\tDrive supports both forms of background format stopping"); + if(ftr.QuickStart) sb.AppendLine("\tDrive can do a quick start formatting"); } else { sb.Append("Drive can read DVD+RW"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); } return sb.ToString(); @@ -4621,8 +4280,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_002B(Feature_002B? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_002B ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -4630,18 +4288,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC if(ftr.Write) { sb.Append("Drive can read and write DVD+R"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); } else { sb.Append("Drive can read DVD+R"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); } return sb.ToString(); @@ -4649,34 +4303,27 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_002C(Feature_002C? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_002C ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC Rigid Restricted Overwrite"); - if(ftr.Current) - sb.AppendLine(" (current):"); - else - sb.AppendLine(":"); + if(ftr.Current) sb.AppendLine(" (current):"); + else sb.AppendLine(":"); - if(ftr.Blank) - sb.AppendLine("\tDrive supports the BLANK command"); + if(ftr.Blank) sb.AppendLine("\tDrive supports the BLANK command"); if(ftr.Intermediate) sb.AppendLine("\tDrive supports writing on an intermediate state session and quick formatting"); - if(ftr.DSDR) - sb.AppendLine("\tDrive can read Defect Status data recorded on the medium"); - if(ftr.DSDG) - sb.AppendLine("\tDrive can generate Defect Status data during formatting"); + if(ftr.DSDR) sb.AppendLine("\tDrive can read Defect Status data recorded on the medium"); + if(ftr.DSDG) sb.AppendLine("\tDrive can generate Defect Status data during formatting"); return sb.ToString(); } public static string Prettify_002D(Feature_002D? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_002D ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -4686,55 +4333,33 @@ namespace DiscImageChef.Decoders.SCSI.MMC if(ftr.RWSubchannel) { sb.AppendLine("\tDrive can write user provided data in the R-W subchannels"); - if(ftr.RWRaw) - sb.AppendLine("\tDrive accepts RAW R-W subchannel data"); - if(ftr.RWPack) - sb.AppendLine("\tDrive accepts Packed R-W subchannel data"); - + if(ftr.RWRaw) sb.AppendLine("\tDrive accepts RAW R-W subchannel data"); + if(ftr.RWPack) sb.AppendLine("\tDrive accepts Packed R-W subchannel data"); } - if(ftr.CDRW) - sb.AppendLine("\tDrive can overwrite a TAO track with another in CD-RWs"); - if(ftr.TestWrite) - sb.AppendLine("\tDrive can do a test writing"); - if(ftr.BUF) - sb.AppendLine("\tDrive supports zero loss linking"); + if(ftr.CDRW) sb.AppendLine("\tDrive can overwrite a TAO track with another in CD-RWs"); + if(ftr.TestWrite) sb.AppendLine("\tDrive can do a test writing"); + if(ftr.BUF) sb.AppendLine("\tDrive supports zero loss linking"); if(ftr.DataTypeSupported > 0) { sb.Append("\tDrive supports data block types:"); - if((ftr.DataTypeSupported & 0x0001) == 0x0001) - sb.Append(" 0"); - if((ftr.DataTypeSupported & 0x0002) == 0x0002) - sb.Append(" 1"); - if((ftr.DataTypeSupported & 0x0004) == 0x0004) - sb.Append(" 2"); - if((ftr.DataTypeSupported & 0x0008) == 0x0008) - sb.Append(" 3"); - if((ftr.DataTypeSupported & 0x0010) == 0x0010) - sb.Append(" 4"); - if((ftr.DataTypeSupported & 0x0020) == 0x0020) - sb.Append(" 5"); - if((ftr.DataTypeSupported & 0x0040) == 0x0040) - sb.Append(" 6"); - if((ftr.DataTypeSupported & 0x0080) == 0x0080) - sb.Append(" 7"); - if((ftr.DataTypeSupported & 0x0100) == 0x0100) - sb.Append(" 8"); - if((ftr.DataTypeSupported & 0x0200) == 0x0200) - sb.Append(" 9"); - if((ftr.DataTypeSupported & 0x0400) == 0x0400) - sb.Append(" 10"); - if((ftr.DataTypeSupported & 0x0800) == 0x0800) - sb.Append(" 11"); - if((ftr.DataTypeSupported & 0x1000) == 0x1000) - sb.Append(" 12"); - if((ftr.DataTypeSupported & 0x2000) == 0x2000) - sb.Append(" 13"); - if((ftr.DataTypeSupported & 0x4000) == 0x4000) - sb.Append(" 14"); - if((ftr.DataTypeSupported & 0x8000) == 0x8000) - sb.Append(" 15"); + if((ftr.DataTypeSupported & 0x0001) == 0x0001) sb.Append(" 0"); + if((ftr.DataTypeSupported & 0x0002) == 0x0002) sb.Append(" 1"); + if((ftr.DataTypeSupported & 0x0004) == 0x0004) sb.Append(" 2"); + if((ftr.DataTypeSupported & 0x0008) == 0x0008) sb.Append(" 3"); + if((ftr.DataTypeSupported & 0x0010) == 0x0010) sb.Append(" 4"); + if((ftr.DataTypeSupported & 0x0020) == 0x0020) sb.Append(" 5"); + if((ftr.DataTypeSupported & 0x0040) == 0x0040) sb.Append(" 6"); + if((ftr.DataTypeSupported & 0x0080) == 0x0080) sb.Append(" 7"); + if((ftr.DataTypeSupported & 0x0100) == 0x0100) sb.Append(" 8"); + if((ftr.DataTypeSupported & 0x0200) == 0x0200) sb.Append(" 9"); + if((ftr.DataTypeSupported & 0x0400) == 0x0400) sb.Append(" 10"); + if((ftr.DataTypeSupported & 0x0800) == 0x0800) sb.Append(" 11"); + if((ftr.DataTypeSupported & 0x1000) == 0x1000) sb.Append(" 12"); + if((ftr.DataTypeSupported & 0x2000) == 0x2000) sb.Append(" 13"); + if((ftr.DataTypeSupported & 0x4000) == 0x4000) sb.Append(" 14"); + if((ftr.DataTypeSupported & 0x8000) == 0x8000) sb.Append(" 15"); sb.AppendLine(); } @@ -4743,59 +4368,44 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_002E(Feature_002E? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_002E ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if(ftr.SAO && !ftr.RAW) - sb.AppendLine("Drive can write CDs in Session at Once Mode:"); - else if(!ftr.SAO && ftr.RAW) - sb.AppendLine("Drive can write CDs in raw Mode:"); - else - sb.AppendLine("Drive can write CDs in Session at Once and in Raw Modes:"); + if(ftr.SAO && !ftr.RAW) sb.AppendLine("Drive can write CDs in Session at Once Mode:"); + else if(!ftr.SAO && ftr.RAW) sb.AppendLine("Drive can write CDs in raw Mode:"); + else sb.AppendLine("Drive can write CDs in Session at Once and in Raw Modes:"); - if(ftr.RAW && ftr.RAWMS) - sb.AppendLine("\tDrive can write multi-session CDs in raw mode"); + if(ftr.RAW && ftr.RAWMS) sb.AppendLine("\tDrive can write multi-session CDs in raw mode"); - if(ftr.RW) - sb.AppendLine("\tDrive can write user provided data in the R-W subchannels"); + if(ftr.RW) sb.AppendLine("\tDrive can write user provided data in the R-W subchannels"); - if(ftr.CDRW) - sb.AppendLine("\tDrive can write CD-RWs"); - if(ftr.TestWrite) - sb.AppendLine("\tDrive can do a test writing"); - if(ftr.BUF) - sb.AppendLine("\tDrive supports zero loss linking"); + if(ftr.CDRW) sb.AppendLine("\tDrive can write CD-RWs"); + if(ftr.TestWrite) sb.AppendLine("\tDrive can do a test writing"); + if(ftr.BUF) sb.AppendLine("\tDrive supports zero loss linking"); if(ftr.MaxCueSheet > 0) - sb.AppendFormat("\tDrive supports a maximum of {0} bytes in a single cue sheet", ftr.MaxCueSheet).AppendLine(); + sb.AppendFormat("\tDrive supports a maximum of {0} bytes in a single cue sheet", ftr.MaxCueSheet) + .AppendLine(); return sb.ToString(); } public static string Prettify_002F(Feature_002F? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_002F ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if(ftr.DVDRW && ftr.RDL) - sb.AppendLine("Drive supports writing DVD-R, DVD-RW and DVD-R DL"); - else if(ftr.RDL) - sb.AppendLine("Drive supports writing DVD-R and DVD-R DL"); - else if(ftr.DVDRW) - sb.AppendLine("Drive supports writing DVD-R and DVD-RW"); - else - sb.AppendLine("Drive supports writing DVD-R"); + if(ftr.DVDRW && ftr.RDL) sb.AppendLine("Drive supports writing DVD-R, DVD-RW and DVD-R DL"); + else if(ftr.RDL) sb.AppendLine("Drive supports writing DVD-R and DVD-R DL"); + else if(ftr.DVDRW) sb.AppendLine("Drive supports writing DVD-R and DVD-RW"); + else sb.AppendLine("Drive supports writing DVD-R"); - if(ftr.TestWrite) - sb.AppendLine("\tDrive can do a test writing"); - if(ftr.BUF) - sb.AppendLine("\tDrive supports zero loss linking"); + if(ftr.TestWrite) sb.AppendLine("\tDrive can do a test writing"); + if(ftr.BUF) sb.AppendLine("\tDrive supports zero loss linking"); return sb.ToString(); } @@ -4807,42 +4417,36 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0031(Feature_0031? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0031 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive supports writing DDCD-R"); - if(ftr.TestWrite) - sb.AppendLine("\tDrive can do a test writing"); + if(ftr.TestWrite) sb.AppendLine("\tDrive can do a test writing"); return sb.ToString(); } public static string Prettify_0032(Feature_0032? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0032 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive supports writing DDCD-RW"); - if(ftr.Blank) - sb.AppendLine("\tDrive supports the BLANK command"); - if(ftr.Intermediate) - sb.AppendLine("\tDrive supports quick formatting"); + if(ftr.Blank) sb.AppendLine("\tDrive supports the BLANK command"); + if(ftr.Intermediate) sb.AppendLine("\tDrive supports quick formatting"); return sb.ToString(); } public static string Prettify_0033(Feature_0033? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0033 ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -4865,8 +4469,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0037(Feature_0037? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0037 ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -4875,22 +4478,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC if(ftr.SubtypeSupport > 0) { sb.Append("\tDrive supports CD-RW subtypes"); - if((ftr.SubtypeSupport & 0x01) == 0x01) - sb.Append(" 0"); - if((ftr.SubtypeSupport & 0x02) == 0x02) - sb.Append(" 1"); - if((ftr.SubtypeSupport & 0x04) == 0x04) - sb.Append(" 2"); - if((ftr.SubtypeSupport & 0x08) == 0x08) - sb.Append(" 3"); - if((ftr.SubtypeSupport & 0x10) == 0x10) - sb.Append(" 4"); - if((ftr.SubtypeSupport & 0x20) == 0x20) - sb.Append(" 5"); - if((ftr.SubtypeSupport & 0x40) == 0x40) - sb.Append(" 6"); - if((ftr.SubtypeSupport & 0x80) == 0x80) - sb.Append(" 7"); + if((ftr.SubtypeSupport & 0x01) == 0x01) sb.Append(" 0"); + if((ftr.SubtypeSupport & 0x02) == 0x02) sb.Append(" 1"); + if((ftr.SubtypeSupport & 0x04) == 0x04) sb.Append(" 2"); + if((ftr.SubtypeSupport & 0x08) == 0x08) sb.Append(" 3"); + if((ftr.SubtypeSupport & 0x10) == 0x10) sb.Append(" 4"); + if((ftr.SubtypeSupport & 0x20) == 0x20) sb.Append(" 5"); + if((ftr.SubtypeSupport & 0x40) == 0x40) sb.Append(" 6"); + if((ftr.SubtypeSupport & 0x80) == 0x80) sb.Append(" 7"); sb.AppendLine(); } @@ -4904,8 +4499,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_003A(Feature_003A? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_003A ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -4913,24 +4507,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC if(ftr.Write) { sb.Append("Drive can read and write DVD+RW DL"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); - if(ftr.CloseOnly) - sb.AppendLine("\tDrive supports only the read compatibility stop"); - else - sb.AppendLine("\tDrive supports both forms of background format stopping"); - if(ftr.QuickStart) - sb.AppendLine("\tDrive can do a quick start formatting"); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); + if(ftr.CloseOnly) sb.AppendLine("\tDrive supports only the read compatibility stop"); + else sb.AppendLine("\tDrive supports both forms of background format stopping"); + if(ftr.QuickStart) sb.AppendLine("\tDrive can do a quick start formatting"); } else { sb.Append("Drive can read DVD+RW DL"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); } return sb.ToString(); @@ -4938,8 +4525,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_003B(Feature_003B? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_003B ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -4947,18 +4533,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC if(ftr.Write) { sb.Append("Drive can read and write DVD+R DL"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); } else { sb.Append("Drive can read DVD+R DL"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); } return sb.ToString(); @@ -4966,138 +4548,103 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0040(Feature_0040? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0040 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC BD Read"); - if(ftr.Current) - sb.AppendLine(" (current):"); - else - sb.AppendLine(":"); + if(ftr.Current) sb.AppendLine(" (current):"); + else sb.AppendLine(":"); - if(ftr.OldROM) - sb.AppendLine("\tDrive can read BD-ROM pre-1.0"); - if(ftr.ROM) - sb.AppendLine("\tDrive can read BD-ROM Ver.1"); - if(ftr.OldR) - sb.AppendLine("\tDrive can read BD-R pre-1.0"); - if(ftr.R) - sb.AppendLine("\tDrive can read BD-R Ver.1"); - if(ftr.OldRE) - sb.AppendLine("\tDrive can read BD-RE pre-1.0"); - if(ftr.RE1) - sb.AppendLine("\tDrive can read BD-RE Ver.1"); - if(ftr.RE2) - sb.AppendLine("\tDrive can read BD-RE Ver.2"); + if(ftr.OldROM) sb.AppendLine("\tDrive can read BD-ROM pre-1.0"); + if(ftr.ROM) sb.AppendLine("\tDrive can read BD-ROM Ver.1"); + if(ftr.OldR) sb.AppendLine("\tDrive can read BD-R pre-1.0"); + if(ftr.R) sb.AppendLine("\tDrive can read BD-R Ver.1"); + if(ftr.OldRE) sb.AppendLine("\tDrive can read BD-RE pre-1.0"); + if(ftr.RE1) sb.AppendLine("\tDrive can read BD-RE Ver.1"); + if(ftr.RE2) sb.AppendLine("\tDrive can read BD-RE Ver.2"); - if(ftr.BCA) - sb.AppendLine("\tDrive can read BD's Burst Cutting Area"); + if(ftr.BCA) sb.AppendLine("\tDrive can read BD's Burst Cutting Area"); return sb.ToString(); } public static string Prettify_0041(Feature_0041? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0041 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC BD Write"); - if(ftr.Current) - sb.AppendLine(" (current):"); - else - sb.AppendLine(":"); + if(ftr.Current) sb.AppendLine(" (current):"); + else sb.AppendLine(":"); - if(ftr.OldR) - sb.AppendLine("\tDrive can write BD-R pre-1.0"); - if(ftr.R) - sb.AppendLine("\tDrive can write BD-R Ver.1"); - if(ftr.OldRE) - sb.AppendLine("\tDrive can write BD-RE pre-1.0"); - if(ftr.RE1) - sb.AppendLine("\tDrive can write BD-RE Ver.1"); - if(ftr.RE2) - sb.AppendLine("\tDrive can write BD-RE Ver.2"); + if(ftr.OldR) sb.AppendLine("\tDrive can write BD-R pre-1.0"); + if(ftr.R) sb.AppendLine("\tDrive can write BD-R Ver.1"); + if(ftr.OldRE) sb.AppendLine("\tDrive can write BD-RE pre-1.0"); + if(ftr.RE1) sb.AppendLine("\tDrive can write BD-RE Ver.1"); + if(ftr.RE2) sb.AppendLine("\tDrive can write BD-RE Ver.2"); - if(ftr.SVNR) - sb.AppendLine("\tDrive supports write without verify requirement"); + if(ftr.SVNR) sb.AppendLine("\tDrive supports write without verify requirement"); return sb.ToString(); } public static string Prettify_0042(Feature_0042? feature) { - return !feature.HasValue ? null : "Drive is able to detect and report defective writable unit and behave accordinly\n"; + return !feature.HasValue + ? null + : "Drive is able to detect and report defective writable unit and behave accordinly\n"; } public static string Prettify_0050(Feature_0050? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0050 ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if(ftr.HDDVDR && ftr.HDDVDRAM) - sb.Append("Drive can read HD DVD-ROM, HD DVD-RW, HD DVD-R and HD DVD-RAM"); - else if(ftr.HDDVDR) - sb.Append("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-R"); - else if(ftr.HDDVDRAM) - sb.Append("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-RAM"); - else - sb.Append("Drive can read HD DVD-ROM and HD DVD-RW"); + if(ftr.HDDVDR && ftr.HDDVDRAM) sb.Append("Drive can read HD DVD-ROM, HD DVD-RW, HD DVD-R and HD DVD-RAM"); + else if(ftr.HDDVDR) sb.Append("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-R"); + else if(ftr.HDDVDRAM) sb.Append("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-RAM"); + else sb.Append("Drive can read HD DVD-ROM and HD DVD-RW"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); return sb.ToString(); } public static string Prettify_0051(Feature_0051? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0051 ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if(ftr.HDDVDR && ftr.HDDVDRAM) - sb.Append("Drive can write HD DVD-RW, HD DVD-R and HD DVD-RAM"); - else if(ftr.HDDVDR) - sb.Append("Drive can write HD DVD-RW and HD DVD-R"); - else if(ftr.HDDVDRAM) - sb.Append("Drive can write HD DVD-RW and HD DVD-RAM"); - else - sb.Append("Drive can write HD DVD-RW"); + if(ftr.HDDVDR && ftr.HDDVDRAM) sb.Append("Drive can write HD DVD-RW, HD DVD-R and HD DVD-RAM"); + else if(ftr.HDDVDR) sb.Append("Drive can write HD DVD-RW and HD DVD-R"); + else if(ftr.HDDVDRAM) sb.Append("Drive can write HD DVD-RW and HD DVD-RAM"); + else sb.Append("Drive can write HD DVD-RW"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); return sb.ToString(); } public static string Prettify_0080(Feature_0080? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0080 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("Drive is able to access Hybrid discs"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); if(ftr.RI) sb.AppendLine("\tDrive is able to maintain the online format layer through reset and power cycling"); @@ -5112,33 +4659,28 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0101(Feature_0101? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0101 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive supports S.M.A.R.T."); - if(ftr.PP) - sb.AppendLine("\tDrive supports the Informational Exceptions Control mode page 1Ch"); + if(ftr.PP) sb.AppendLine("\tDrive supports the Informational Exceptions Control mode page 1Ch"); return sb.ToString(); } public static string Prettify_0102(Feature_0102? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0102 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Embedded Changer:"); - if(ftr.SCC) - sb.AppendLine("\tDrive can change disc side"); - if(ftr.SDP) - sb.AppendLine("\tDrive is able to report slots contents after a reset or change"); + if(ftr.SCC) sb.AppendLine("\tDrive can change disc side"); + if(ftr.SDP) sb.AppendLine("\tDrive is able to report slots contents after a reset or change"); sb.AppendFormat("\tDrive has {0} slots", ftr.HighestSlotNumber + 1).AppendLine(); @@ -5147,20 +4689,16 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0103(Feature_0103? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0103 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive has an analogue audio output"); - if(ftr.Scan) - sb.AppendLine("\tDrive supports the SCAN command"); - if(ftr.SCM) - sb.AppendLine("\tDrive is able to mute channels separately"); - if(ftr.SV) - sb.AppendLine("\tDrive supports separate volume per channel"); + if(ftr.Scan) sb.AppendLine("\tDrive supports the SCAN command"); + if(ftr.SCM) sb.AppendLine("\tDrive is able to mute channels separately"); + if(ftr.SV) sb.AppendLine("\tDrive supports separate volume per channel"); sb.AppendFormat("\tDrive has {0} volume levels", ftr.VolumeLevels + 1).AppendLine(); @@ -5169,8 +4707,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0104(Feature_0104? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0104 ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -5184,8 +4721,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0105(Feature_0105? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0105 ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -5204,51 +4740,42 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0106(Feature_0106? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0106 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendFormat("Drive supports DVD CSS/CPPM version {0}", ftr.CSSVersion); - if(ftr.Current) - sb.AppendLine(" and current disc is encrypted"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" and current disc is encrypted"); + else sb.AppendLine(); return sb.ToString(); } public static string Prettify_0107(Feature_0107? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0107 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Real Time Streaming:"); - if(ftr.SMP) - sb.AppendLine("\tDrive supports Set Minimum Performance with the SET STREAMING command"); - if(ftr.RBCB) - sb.AppendLine("\tDrive supports the block bit in the READ BUFFER CAPACITY command"); - if(ftr.SCS) - sb.AppendLine("\tDrive supports the SET CD SPEED command"); + if(ftr.SMP) sb.AppendLine("\tDrive supports Set Minimum Performance with the SET STREAMING command"); + if(ftr.RBCB) sb.AppendLine("\tDrive supports the block bit in the READ BUFFER CAPACITY command"); + if(ftr.SCS) sb.AppendLine("\tDrive supports the SET CD SPEED command"); if(ftr.MP2A) sb.AppendLine("\tDrive supports the Write Speed Performance Descriptor Blocks in the MMC mode page 2Ah"); if(ftr.WSPD) sb.AppendLine("\tDrive supports the Write Speed data of GET PERFORMANCE and the WRC field of SET STREAMING"); - if(ftr.SW) - sb.AppendLine("\tDrive supports stream recording"); + if(ftr.SW) sb.AppendLine("\tDrive supports stream recording"); return sb.ToString(); } public static string Prettify_0108(Feature_0108? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0108 ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -5265,16 +4792,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_010A(Feature_010A? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_010A ftr = feature.Value; StringBuilder sb = new StringBuilder(); if(ftr.DCBs != null) { - foreach(uint DCB in ftr.DCBs) - sb.AppendFormat("Drive supports DCB {0:X8}h", DCB).AppendLine(); + foreach(uint DCB in ftr.DCBs) sb.AppendFormat("Drive supports DCB {0:X8}h", DCB).AppendLine(); } return sb.ToString(); @@ -5282,25 +4807,21 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_010B(Feature_010B? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_010B ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendFormat("Drive supports DVD CPRM version {0}", ftr.CPRMVersion); - if(ftr.Current) - sb.AppendLine(" and current disc is or can be encrypted"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" and current disc is or can be encrypted"); + else sb.AppendLine(); return sb.ToString(); } public static string Prettify_010C(Feature_010C? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_010C ftr = feature.Value; StringBuilder sb = new StringBuilder(); @@ -5337,125 +4858,102 @@ namespace DiscImageChef.Decoders.SCSI.MMC try { - DateTime fwDate = new DateTime(int.Parse(syear), int.Parse(smonth), - int.Parse(sday), int.Parse(shour), int.Parse(sminute), - int.Parse(ssecond), DateTimeKind.Utc); + DateTime fwDate = new DateTime(int.Parse(syear), int.Parse(smonth), int.Parse(sday), int.Parse(shour), + int.Parse(sminute), int.Parse(ssecond), DateTimeKind.Utc); sb.AppendFormat("Drive firmware is dated {0}", fwDate).AppendLine(); } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - catch + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body - { - } return sb.ToString(); } public static string Prettify_010D(Feature_010D? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_010D ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendFormat("Drive supports AACS version {0}", ftr.AACSVersion); - if(ftr.Current) - sb.AppendLine(" and current disc is encrypted"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" and current disc is encrypted"); + else sb.AppendLine(); - if(ftr.RDC) - sb.AppendLine("\tDrive supports reading the Drive Certificate"); - if(ftr.RMC) - sb.AppendLine("\tDrive supports reading Media Key Block of CPRM"); - if(ftr.WBE) - sb.AppendLine("\tDrive supports writing with bus encryption"); - if(ftr.BEC) - sb.AppendLine("\tDrive supports bus encryption"); + if(ftr.RDC) sb.AppendLine("\tDrive supports reading the Drive Certificate"); + if(ftr.RMC) sb.AppendLine("\tDrive supports reading Media Key Block of CPRM"); + if(ftr.WBE) sb.AppendLine("\tDrive supports writing with bus encryption"); + if(ftr.BEC) sb.AppendLine("\tDrive supports bus encryption"); if(ftr.BNG) { sb.AppendLine("\tDrive supports generating the binding nonce"); if(ftr.BindNonceBlocks > 0) - sb.AppendFormat("\t{0} media blocks are required for the binding nonce", ftr.BindNonceBlocks).AppendLine(); + sb.AppendFormat("\t{0} media blocks are required for the binding nonce", ftr.BindNonceBlocks) + .AppendLine(); } - if(ftr.AGIDs > 0) - sb.AppendFormat("\tDrive supports {0} AGIDs concurrently", ftr.AGIDs).AppendLine(); + if(ftr.AGIDs > 0) sb.AppendFormat("\tDrive supports {0} AGIDs concurrently", ftr.AGIDs).AppendLine(); return sb.ToString(); } public static string Prettify_010E(Feature_010E? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_010E ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("Drive supports DVD-Download"); - if(ftr.Current) - sb.AppendLine(" (current)"); - else - sb.AppendLine(); + if(ftr.Current) sb.AppendLine(" (current)"); + else sb.AppendLine(); if(ftr.MaxScrambleExtent > 0) - sb.AppendFormat("\tMaximum {0} scranble extent information entries", ftr.MaxScrambleExtent).AppendLine(); + sb.AppendFormat("\tMaximum {0} scranble extent information entries", ftr.MaxScrambleExtent) + .AppendLine(); return sb.ToString(); } public static string Prettify_0110(Feature_0110? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0110 ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if(ftr.Current) - sb.AppendLine("Drive and currently inserted media support VCPS"); - else - sb.AppendLine("Drive supports VCPS"); + if(ftr.Current) sb.AppendLine("Drive and currently inserted media support VCPS"); + else sb.AppendLine("Drive supports VCPS"); return sb.ToString(); } public static string Prettify_0113(Feature_0113? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0113 ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if(ftr.Current) - sb.AppendLine("Drive and currently inserted media support SecurDisc"); - else - sb.AppendLine("Drive supports SecurDisc"); + if(ftr.Current) sb.AppendLine("Drive and currently inserted media support SecurDisc"); + else sb.AppendLine("Drive supports SecurDisc"); return sb.ToString(); } public static string Prettify_0142(Feature_0142? feature) { - if(!feature.HasValue) - return null; + if(!feature.HasValue) return null; Feature_0142 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive supports the Trusted Computing Group Optical Security Subsystem Class"); - if(ftr.Current) - sb.AppendLine("\tCurrent media is initialized with TCG OSSC"); - if(ftr.PSAU) - sb.AppendLine("\tDrive supports PSA updates on write-once media"); - if(ftr.LOSPB) - sb.AppendLine("\tDrive supports linked OSPBs"); - if(ftr.ME) - sb.AppendLine("\tDrive will only record on the OSSC Disc Format"); + if(ftr.Current) sb.AppendLine("\tCurrent media is initialized with TCG OSSC"); + if(ftr.PSAU) sb.AppendLine("\tDrive supports PSA updates on write-once media"); + if(ftr.LOSPB) sb.AppendLine("\tDrive supports linked OSPBs"); + if(ftr.ME) sb.AppendLine("\tDrive will only record on the OSSC Disc Format"); if(ftr.Profiles != null) { @@ -5782,8 +5280,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC FeatureDescriptor desc = new FeatureDescriptor(); desc.Code = (ushort)((response[offset + 0] << 8) + response[offset + 1]); desc.Data = new byte[response[offset + 3] + 4]; - if (desc.Data.Length + offset > response.Length) - desc.Data = new byte[response.Length - offset]; + if(desc.Data.Length + offset > response.Length) desc.Data = new byte[response.Length - offset]; Array.Copy(response, offset, desc.Data, 0, desc.Data.Length); offset += (uint)(desc.Data.Length); @@ -5795,5 +5292,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC return dec; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs b/DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs index 508f6415..daa22ffd 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs @@ -103,11 +103,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static RecognizedFormatLayers? DecodeFormatLayers(byte[] FormatLayersResponse) { - if(FormatLayersResponse == null) - return null; + if(FormatLayersResponse == null) return null; - if(FormatLayersResponse.Length < 8) - return null; + if(FormatLayersResponse.Length < 8) return null; RecognizedFormatLayers decoded = new RecognizedFormatLayers(); @@ -134,8 +132,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyFormatLayers(RecognizedFormatLayers? FormatLayersResponse) { - if(FormatLayersResponse == null) - return null; + if(FormatLayersResponse == null) return null; RecognizedFormatLayers response = FormatLayersResponse.Value; @@ -148,50 +145,41 @@ namespace DiscImageChef.Decoders.SCSI.MMC switch(response.FormatLayers[i]) { case (ushort)FormatLayerTypeCodes.BDLayer: - { - sb.AppendFormat("Layer {0} is of type Blu-ray", i).AppendLine(); - if(response.DefaultFormatLayer == i) - sb.AppendLine("This is the default layer."); - if(response.OnlineFormatLayer == i) - sb.AppendLine("This is the layer actually in use."); - break; - } + { + sb.AppendFormat("Layer {0} is of type Blu-ray", i).AppendLine(); + if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer."); + if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use."); + break; + } case (ushort)FormatLayerTypeCodes.CDLayer: - { - sb.AppendFormat("Layer {0} is of type CD", i).AppendLine(); - if(response.DefaultFormatLayer == i) - sb.AppendLine("This is the default layer."); - if(response.OnlineFormatLayer == i) - sb.AppendLine("This is the layer actually in use."); - break; - } + { + sb.AppendFormat("Layer {0} is of type CD", i).AppendLine(); + if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer."); + if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use."); + break; + } case (ushort)FormatLayerTypeCodes.DVDLayer: - { - sb.AppendFormat("Layer {0} is of type DVD", i).AppendLine(); - if(response.DefaultFormatLayer == i) - sb.AppendLine("This is the default layer."); - if(response.OnlineFormatLayer == i) - sb.AppendLine("This is the layer actually in use."); - break; - } + { + sb.AppendFormat("Layer {0} is of type DVD", i).AppendLine(); + if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer."); + if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use."); + break; + } case (ushort)FormatLayerTypeCodes.HDDVDLayer: - { - sb.AppendFormat("Layer {0} is of type HD DVD", i).AppendLine(); - if(response.DefaultFormatLayer == i) - sb.AppendLine("This is the default layer."); - if(response.OnlineFormatLayer == i) - sb.AppendLine("This is the layer actually in use."); - break; - } + { + sb.AppendFormat("Layer {0} is of type HD DVD", i).AppendLine(); + if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer."); + if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use."); + break; + } default: - { - sb.AppendFormat("Layer {0} is of unknown type 0x{1:X4}", i, response.FormatLayers[i]).AppendLine(); - if(response.DefaultFormatLayer == i) - sb.AppendLine("This is the default layer."); - if(response.OnlineFormatLayer == i) - sb.AppendLine("This is the layer actually in use."); - break; - } + { + sb.AppendFormat("Layer {0} is of unknown type 0x{1:X4}", i, response.FormatLayers[i]) + .AppendLine(); + if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer."); + if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use."); + break; + } } } @@ -204,5 +192,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC return PrettifyFormatLayers(decoded); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs b/DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs index 81605a65..ad1362cd 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs @@ -113,8 +113,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static WriteProtectionStatus? DecodeWriteProtectionStatus(byte[] WPSResponse) { - if(WPSResponse == null) - return null; + if(WPSResponse == null) return null; WriteProtectionStatus decoded = new WriteProtectionStatus(); @@ -137,35 +136,24 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyWriteProtectionStatus(WriteProtectionStatus? WPSResponse) { - if(WPSResponse == null) - return null; + if(WPSResponse == null) return null; WriteProtectionStatus response = WPSResponse.Value; StringBuilder sb = new StringBuilder(); - if(response.MSWI) - sb.AppendLine("Writing inhibited by media specific reason"); - if(response.CWP) - sb.AppendLine("Cartridge sets write protection"); - if(response.PWP) - sb.AppendLine("Media surface sets write protection"); - if(response.SWPP) - sb.AppendLine("Software write protection is set until power down"); + if(response.MSWI) sb.AppendLine("Writing inhibited by media specific reason"); + if(response.CWP) sb.AppendLine("Cartridge sets write protection"); + if(response.PWP) sb.AppendLine("Media surface sets write protection"); + if(response.SWPP) sb.AppendLine("Software write protection is set until power down"); #if DEBUG - if(response.Reserved1 != 0) - sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); - if(response.Reserved2 != 0) - sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); - if(response.Reserved3 != 0) - sb.AppendFormat("Reserved3 = 0x{0:X2}", response.Reserved3).AppendLine(); - if(response.Reserved4 != 0) - sb.AppendFormat("Reserved4 = 0x{0:X2}", response.Reserved4).AppendLine(); - if(response.Reserved5 != 0) - sb.AppendFormat("Reserved5 = 0x{0:X2}", response.Reserved5).AppendLine(); - if(response.Reserved6 != 0) - sb.AppendFormat("Reserved6 = 0x{0:X2}", response.Reserved6).AppendLine(); + if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); + if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); + if(response.Reserved3 != 0) sb.AppendFormat("Reserved3 = 0x{0:X2}", response.Reserved3).AppendLine(); + if(response.Reserved4 != 0) sb.AppendFormat("Reserved4 = 0x{0:X2}", response.Reserved4).AppendLine(); + if(response.Reserved5 != 0) sb.AppendFormat("Reserved5 = 0x{0:X2}", response.Reserved5).AppendLine(); + if(response.Reserved6 != 0) sb.AppendFormat("Reserved6 = 0x{0:X2}", response.Reserved6).AppendLine(); #endif return sb.ToString(); @@ -177,5 +165,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC return PrettifyWriteProtectionStatus(decoded); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/Modes.cs b/DiscImageChef.Decoders/SCSI/Modes.cs index 4e00d5dd..ada1b5f9 100644 --- a/DiscImageChef.Decoders/SCSI/Modes.cs +++ b/DiscImageChef.Decoders/SCSI/Modes.cs @@ -116,21 +116,28 @@ namespace DiscImageChef.Decoders.SCSI switch(type) { case MediumTypes.ECMA54: - return "ECMA-54: 200 mm Flexible Disk Cartridge using Two-Frequency Recording at 13262 ftprad on One Side"; + return + "ECMA-54: 200 mm Flexible Disk Cartridge using Two-Frequency Recording at 13262 ftprad on One Side"; case MediumTypes.ECMA59: - return "ECMA-59 & ANSI X3.121-1984: 200 mm Flexible Disk Cartridge using Two-Frequency Recording at 13262 ftprad on Both Sides"; + return + "ECMA-59 & ANSI X3.121-1984: 200 mm Flexible Disk Cartridge using Two-Frequency Recording at 13262 ftprad on Both Sides"; case MediumTypes.ECMA69: return "ECMA-69: 200 mm Flexible Disk Cartridge using MFM Recording at 13262 ftprad on Both Sides"; case MediumTypes.ECMA66: - return "ECMA-66: 130 mm Flexible Disk Cartridge using Two-Frequency Recording at 7958 ftprad on One Side"; + return + "ECMA-66: 130 mm Flexible Disk Cartridge using Two-Frequency Recording at 7958 ftprad on One Side"; case MediumTypes.ECMA70: - return "ECMA-70 & ANSI X3.125-1985: 130 mm Flexible Disk Cartridge using MFM Recording at 7958 ftprad on Both Sides; 1,9 Tracks per mm"; + return + "ECMA-70 & ANSI X3.125-1985: 130 mm Flexible Disk Cartridge using MFM Recording at 7958 ftprad on Both Sides; 1,9 Tracks per mm"; case MediumTypes.ECMA78: - return "ECMA-78 & ANSI X3.126-1986: 130 mm Flexible Disk Cartridge using MFM Recording at 7958 ftprad on Both Sides; 3,8 Tracks per mm"; + return + "ECMA-78 & ANSI X3.126-1986: 130 mm Flexible Disk Cartridge using MFM Recording at 7958 ftprad on Both Sides; 3,8 Tracks per mm"; case MediumTypes.ECMA99: - return "ECMA-99 & ISO 8630-1985: 130 mm Flexible Disk Cartridge using MFM Recording at 13262 ftprad on Both Sides; 3,8 Tracks per mm"; + return + "ECMA-99 & ISO 8630-1985: 130 mm Flexible Disk Cartridge using MFM Recording at 13262 ftprad on Both Sides; 3,8 Tracks per mm"; case MediumTypes.ECMA100: - return "ECMA-100 & ANSI X3.137: 90 mm Flexible Disk Cartridge using MFM Recording at 7859 ftprad on Both Sides; 5,3 Tracks per mm"; + return + "ECMA-100 & ANSI X3.137: 90 mm Flexible Disk Cartridge using MFM Recording at 7859 ftprad on Both Sides; 5,3 Tracks per mm"; // Most probably they will never appear, but magneto-opticals use these codes /* case MediumTypes.Unspecified_SS: @@ -138,24 +145,16 @@ namespace DiscImageChef.Decoders.SCSI case MediumTypes.Unspecified_DS: return "Unspecified double sided flexible disk"; */ - case MediumTypes.X3_73: - return "ANSI X3.73-1980: 200 mm, 6631 ftprad, 1,9 Tracks per mm, 1 side"; - case MediumTypes.X3_73_DS: - return "ANSI X3.73-1980: 200 mm, 6631 ftprad, 1,9 Tracks per mm, 2 sides"; - case MediumTypes.X3_82: - return "ANSI X3.80-1980: 130 mm, 3979 ftprad, 1,9 Tracks per mm, 1 side"; + case MediumTypes.X3_73: return "ANSI X3.73-1980: 200 mm, 6631 ftprad, 1,9 Tracks per mm, 1 side"; + case MediumTypes.X3_73_DS: return "ANSI X3.73-1980: 200 mm, 6631 ftprad, 1,9 Tracks per mm, 2 sides"; + case MediumTypes.X3_82: return "ANSI X3.80-1980: 130 mm, 3979 ftprad, 1,9 Tracks per mm, 1 side"; case MediumTypes.Type3Floppy: return "3.5-inch, 135 tpi, 12362 bits/radian, double-sided MFM (aka 1.25Mb)"; - case MediumTypes.HDFloppy: - return "3.5-inch, 135 tpi, 15916 bits/radian, double-sided MFM (aka 1.44Mb)"; - case MediumTypes.ReadOnly: - return "a Read-only optical"; - case MediumTypes.WORM: - return "a Write-once Read-many optical"; - case MediumTypes.Erasable: - return "a Erasable optical"; - case MediumTypes.RO_WORM: - return "a combination of read-only and write-once optical"; + case MediumTypes.HDFloppy: return "3.5-inch, 135 tpi, 15916 bits/radian, double-sided MFM (aka 1.44Mb)"; + case MediumTypes.ReadOnly: return "a Read-only optical"; + case MediumTypes.WORM: return "a Write-once Read-many optical"; + case MediumTypes.Erasable: return "a Erasable optical"; + case MediumTypes.RO_WORM: return "a combination of read-only and write-once optical"; // These magneto-opticals were never manufactured /* case MediumTypes.RO_RW: @@ -164,17 +163,14 @@ namespace DiscImageChef.Decoders.SCSI case MediumTypes.WORM_RW: return "a combination of write-once and erasable optical"; */ - case MediumTypes.DOW: - return "a direct-overwrite optical"; - default: - return string.Format("Unknown medium type 0x{0:X2}", (byte)type); + case MediumTypes.DOW: return "a direct-overwrite optical"; + default: return string.Format("Unknown medium type 0x{0:X2}", (byte)type); } } public static string PrettifyModeHeader(ModeHeader? header, PeripheralDeviceTypes deviceType) { - if(!header.HasValue) - return null; + if(!header.HasValue) return null; StringBuilder sb = new StringBuilder(); @@ -184,1622 +180,1754 @@ namespace DiscImageChef.Decoders.SCSI { #region Direct access device mode header case PeripheralDeviceTypes.DirectAccess: + { + if(header.Value.MediumType != MediumTypes.Default) + sb.AppendFormat("\tMedium is {0}", GetMediumTypeDescription(header.Value.MediumType)) + .AppendLine(); + + if(header.Value.WriteProtected) sb.AppendLine("\tMedium is write protected"); + + if(header.Value.DPOFUA) sb.AppendLine("\tDrive supports DPO and FUA bits"); + + if(header.Value.BlockDescriptors != null) { - if(header.Value.MediumType != MediumTypes.Default) - sb.AppendFormat("\tMedium is {0}", GetMediumTypeDescription(header.Value.MediumType)).AppendLine(); - - if(header.Value.WriteProtected) - sb.AppendLine("\tMedium is write protected"); - - if(header.Value.DPOFUA) - sb.AppendLine("\tDrive supports DPO and FUA bits"); - - if(header.Value.BlockDescriptors != null) + foreach(BlockDescriptor descriptor in header.Value.BlockDescriptors) { - foreach(BlockDescriptor descriptor in header.Value.BlockDescriptors) + string density = ""; + switch(descriptor.Density) { - string density = ""; - switch(descriptor.Density) - { - case DensityType.Default: - break; - case DensityType.Flux7958: - density = "7958 flux transitions per radian"; - break; - case DensityType.Flux13262: - density = "13262 flux transitions per radian"; - break; - case DensityType.Flux15916: - density = "15916 flux transitions per radian"; - break; - default: - density = string.Format("with unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - - if(density != "") - { - if(descriptor.Blocks == 0) - sb.AppendFormat("\tAll remaining blocks have {0} and are {1} bytes each", density, descriptor.BlockLength).AppendLine(); - else - sb.AppendFormat("\t{0} blocks have {1} and are {2} bytes each", descriptor.Blocks, density, descriptor.BlockLength).AppendLine(); - } - else - { - if(descriptor.Blocks == 0) - sb.AppendFormat("\tAll remaining blocks are {0} bytes each", descriptor.BlockLength).AppendLine(); - else - sb.AppendFormat("\t{0} blocks are {1} bytes each", descriptor.Blocks, descriptor.BlockLength).AppendLine(); - } - } - } - - break; - } - #endregion Direct access device mode header - #region Sequential access device mode header - case PeripheralDeviceTypes.SequentialAccess: - { - switch(header.Value.BufferedMode) - { - case 0: - sb.AppendLine("\tDevice writes directly to media"); - break; - case 1: - sb.AppendLine("\tDevice uses a write cache"); - break; - case 2: - sb.AppendLine("\tDevice uses a write cache but doesn't return until cache is flushed"); - break; - default: - sb.AppendFormat("\tUnknown buffered mode code 0x{0:X2}", header.Value.BufferedMode).AppendLine(); - break; - } - - if(header.Value.Speed == 0) - sb.AppendLine("\tDevice uses default speed"); - else - sb.AppendFormat("\tDevice uses speed {0}", header.Value.Speed).AppendLine(); - - if(header.Value.WriteProtected) - sb.AppendLine("\tMedium is write protected"); - - string medium = ""; - - switch(header.Value.MediumType) - { - case MediumTypes.Default: - medium = "undefined"; - break; - case MediumTypes.Tape12: - medium = "6,3 mm tape with 12 tracks at 394 ftpmm or DC-9250"; - break; - case MediumTypes.Tape24: - medium = "6,3 mm tape with 24 tracks at 394 ftpmm or MLR1-26GBSL"; - break; - case MediumTypes.LTOWORM: - medium = "LTO Ultrium WORM or cleaning cartridge"; - break; - case MediumTypes.LTO: - medium = "LTO Ultrium"; - break; - case MediumTypes.LTO2: - medium = "LTO Ultrium-2"; - break; - case MediumTypes.DC2900SL: - medium = "DC-2900SL"; - break; - case MediumTypes.MLR1: - medium = "MLR1-26GB or DDS-3"; - break; - case MediumTypes.DC9200: - medium = "DC-9200 or DDS-4"; - break; - case MediumTypes.DAT72: - medium = "DAT-72"; - break; - case MediumTypes.LTO3: - medium = "LTO Ultrium-3"; - break; - case MediumTypes.LTO3WORM: - medium = "LTO Ultrium-3 WORM"; - break; - case MediumTypes.DDSCleaning: - medium = "DDS cleaning cartridge"; - break; - case MediumTypes.SLR32: - medium = "SLR-32"; - break; - case MediumTypes.SLRtape50: - medium = "SLRtape-50"; - break; - case MediumTypes.LTO4: - medium = "LTO Ultrium-4"; - break; - case MediumTypes.LTO4WORM: - medium = "LTO Ultrium-4 WORM"; - break; - case MediumTypes.SLRtape50SL: - medium = "SLRtape-50 SL"; - break; - case MediumTypes.SLR32SL: - medium = "SLR-32SL"; - break; - case MediumTypes.SLR5: - medium = "SLR-5"; - break; - case MediumTypes.SLR5SL: - medium = "SLR-5SL"; - break; - case MediumTypes.LTO5: - medium = "LTO Ultrium-5"; - break; - case MediumTypes.LTO5WORM: - medium = "LTO Ultrium-5 WORM"; - break; - case MediumTypes.SLRtape7: - medium = "SLRtape-7"; - break; - case MediumTypes.SLRtape7SL: - medium = "SLRtape-7 SL"; - break; - case MediumTypes.SLRtape24: - medium = "SLRtape-24"; - break; - case MediumTypes.SLRtape24SL: - medium = "SLRtape-24 SL"; - break; - case MediumTypes.LTO6: - medium = "LTO Ultrium-6"; - break; - case MediumTypes.LTO6WORM: - medium = "LTO Ultrium-6 WORM"; - break; - case MediumTypes.SLRtape140: - medium = "SLRtape-140"; - break; - case MediumTypes.SLRtape40: - medium = "SLRtape-40"; - break; - case MediumTypes.SLRtape60: - medium = "SLRtape-60 or SLRtape-75"; - break; - case MediumTypes.SLRtape100: - medium = "SLRtape-100"; - break; - case MediumTypes.SLR40_60_100: - medium = "SLR-40, SLR-60 or SLR-100"; - break; - case MediumTypes.LTO7: - medium = "LTO Ultrium-7"; - break; - case MediumTypes.LTO7WORM: - medium = "LTO Ultrium-7 WORM"; - break; - case MediumTypes.LTOCD: - medium = "LTO Ultrium"; - break; - case MediumTypes.Exatape15m: - medium = "Exatape 15m, IBM MagStar or VXA"; - break; - case MediumTypes.CT1: - medium = "CompactTape I, Exatape 28m, CompactTape II, VXA-2 or VXA-3"; - break; - case MediumTypes.Exatape54m: - medium = "Exatape 54m or DLTtape III"; - break; - case MediumTypes.Exatape80m: - medium = "Exatape 80m or DLTtape IIIxt"; - break; - case MediumTypes.Exatape106m: - medium = "Exatape 106m, DLTtape IV or Travan 5"; - break; - case MediumTypes.Exatape106mXL: - medium = "Exatape 160m XL or Super DLTtape I"; - break; - case MediumTypes.SDLT2: - medium = "Super DLTtape II"; - break; - case MediumTypes.VStapeI: - medium = "VStape I"; - break; - case MediumTypes.DLTtapeS4: - medium = "DLTtape S4"; - break; - case MediumTypes.Travan7: - medium = "Travan 7"; - break; - case MediumTypes.Exatape22m: - medium = "Exatape 22m"; - break; - case MediumTypes.Exatape40m: - medium = "Exatape 40m"; - break; - case MediumTypes.Exatape76m: - medium = "Exatape 76m"; - break; - case MediumTypes.Exatape112m: - medium = "Exatape 112m"; - break; - case MediumTypes.Exatape22mAME: - medium = "Exatape 22m AME"; - break; - case MediumTypes.Exatape170m: - medium = "Exatape 170m"; - break; - case MediumTypes.Exatape125m: - medium = "Exatape 125m"; - break; - case MediumTypes.Exatape45m: - medium = "Exatape 45m"; - break; - case MediumTypes.Exatape225m: - medium = "Exatape 225m"; - break; - case MediumTypes.Exatape150m: - medium = "Exatape 150m"; - break; - case MediumTypes.Exatape75m: - medium = "Exatape 75m"; - break; - default: - medium = string.Format("unknown medium type 0x{0:X2}", (byte)header.Value.MediumType); - break; - } - - sb.AppendFormat("\tMedium is {0}", medium).AppendLine(); - - if(header.Value.BlockDescriptors != null) - { - foreach(BlockDescriptor descriptor in header.Value.BlockDescriptors) - { - string density = ""; - switch(header.Value.MediumType) - { - case MediumTypes.Default: - { - switch(descriptor.Density) - { - case DensityType.Default: - break; - case DensityType.ECMA62: - density = "ECMA-62 & ANSI X3.22-1983: 12,7 mm 9-Track Magnetic Tape, 32 ftpmm, NRZI, 32 cpmm"; - break; - case DensityType.ECMA62_Phase: - density = "ECMA-62 & ANSI X3.39-1986: 12,7 mm 9-Track Magnetic Tape, 126 ftpmm, Phase Encoding, 63 cpmm"; - break; - case DensityType.ECMA62_GCR: - density = "ECMA-62 & ANSI X3.54-1986: 12,7 mm 9-Track Magnetic Tape, 356 ftpmm, NRZI, 245 cpmm GCR"; - break; - case DensityType.ECMA79: - density = "ECMA-79 & ANSI X3.116-1986: 6,30 mm Magnetic Tape Cartridge, 252 ftpmm, MFM"; - break; - case DensityType.IBM3480: - density = "Draft ECMA & ANSI X3B5/87-099: 12,7 mm 18-Track Magnetic Tape Cartridge, 1944 ftpmm, IFM, GCR (IBM 3480, 3490, 3490E)"; - break; - case DensityType.ECMA46: - density = "ECMA-46 & ANSI X3.56-1986: 6,30 mm Magnetic Tape Cartridge, Phase Encoding, 63 bpmm"; - break; - case DensityType.ECMA98: - density = "ECMA-98: 6,30 mm Magnetic Tape Cartridge, NRZI, 394 ftpmm"; - break; - case DensityType.X3_136: - density = "ANXI X3.136-1986: 6,3 mm 4 or 9-Track Magnetic Tape Cartridge, 315 bpmm, GCR (QIC-24)"; - break; - case DensityType.X3_157: - density = "ANXI X3.157-1987: 12,7 mm 9-Track Magnetic Tape, 126 bpmm, Phase Encoding"; - break; - case DensityType.X3_158: - density = "ANXI X3.158-1987: 3,81 mm 4-Track Magnetic Tape Cassette, 315 bpmm, GCR"; - break; - case DensityType.X3B5_86: - density = "ANXI X3B5/86-199: 12,7 mm 22-Track Magnetic Tape Cartridge, 262 bpmm, MFM"; - break; - case DensityType.HiTC1: - density = "HI-TC1: 12,7 mm 24-Track Magnetic Tape Cartridge, 500 bpmm, GCR"; - break; - case DensityType.HiTC2: - density = "HI-TC2: 12,7 mm 24-Track Magnetic Tape Cartridge, 999 bpmm, GCR"; - break; - case DensityType.QIC120: - density = "QIC-120: 6,3 mm 15-Track Magnetic Tape Cartridge, 394 bpmm, GCR"; - break; - case DensityType.QIC150: - density = "QIC-150: 6,3 mm 18-Track Magnetic Tape Cartridge, 394 bpmm, GCR"; - break; - case DensityType.QIC320: - density = "QIC-320: 6,3 mm 26-Track Magnetic Tape Cartridge, 630 bpmm, GCR"; - break; - case DensityType.QIC1350: - density = "QIC-1350: 6,3 mm 30-Track Magnetic Tape Cartridge, 2034 bpmm, RLL"; - break; - case DensityType.X3B5_88: - density = "ANXI X3B5/88-185A: 3,81 mm Magnetic Tape Cassette, 2400 bpmm, DDS"; - break; - case DensityType.X3_202: - density = "ANXI X3.202-1991: 8 mm Magnetic Tape Cassette, 1703 bpmm, RLL"; - break; - case DensityType.ECMA_TC17: - density = "ECMA TC17: 8 mm Magnetic Tape Cassette, 1789 bpmm, RLL"; - break; - case DensityType.X3_193: - density = "ANXI X3.193-1990: 12,7 mm 48-Track Magnetic Tape Cartridge, 394 bpmm, MFM"; - break; - case DensityType.X3B5_91: - density = "ANXI X3B5/97-174: 12,7 mm 48-Track Magnetic Tape Cartridge, 1673 bpmm, MFM"; - break; - case DensityType.QIC11: - density = "QIC-11"; - break; - case DensityType.IBM3490E: - density = "IBM 3490E"; - break; - case DensityType.LTO1: - //case DensityType.SAIT1: - density = "LTO Ultrium or Super AIT-1"; - break; - case DensityType.LTO2Old: - density = "LTO Ultrium-2"; - break; - case DensityType.LTO2: - //case DensityType.T9840: - density = "LTO Ultrium-2 or T9840"; - break; - case DensityType.T9940: - density = "T9940"; - break; - case DensityType.LTO3: - //case DensityType.T9940: - density = "LTO Ultrium-3 or T9940"; - break; - case DensityType.T9840C: - density = "T9840C"; - break; - case DensityType.LTO4: - //case DensityType.T9840D: - density = "LTO Ultrium-4 or T9840D"; - break; - case DensityType.T10000A: - density = "T10000A"; - break; - case DensityType.T10000B: - density = "T10000B"; - break; - case DensityType.T10000C: - density = "T10000C"; - break; - case DensityType.T10000D: - density = "T10000D"; - break; - case DensityType.AIT1: - density = "AIT-1"; - break; - case DensityType.AIT2: - density = "AIT-2"; - break; - case DensityType.AIT3: - density = "AIT-3"; - break; - case DensityType.DDS2: - density = "DDS-2"; - break; - case DensityType.DDS3: - density = "DDS-3"; - break; - case DensityType.DDS4: - density = "DDS-4"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.LTOWORM: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "LTO Ultrium cleaning cartridge"; - break; - case DensityType.LTO3: - density = "LTO Ultrium-3 WORM"; - break; - case DensityType.LTO4: - density = "LTO Ultrium-4 WORM"; - break; - case DensityType.LTO5: - density = "LTO Ultrium-5 WORM"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.LTO: - { - switch(descriptor.Density) - { - case DensityType.LTO1: - density = "LTO Ultrium"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.LTO2: - { - switch(descriptor.Density) - { - case DensityType.LTO2: - density = "LTO Ultrium-2"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.DDS3: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "MLR1-26GB"; - break; - case DensityType.DDS3: - density = "DDS-3"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.DDS4: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "DC-9200"; - break; - case DensityType.DDS4: - density = "DDS-4"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.DAT72: - { - switch(descriptor.Density) - { - case DensityType.DAT72: - density = "DAT-72"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.LTO3: - case MediumTypes.LTO3WORM: - { - switch(descriptor.Density) - { - case DensityType.LTO3: - density = "LTO Ultrium-3"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.DDSCleaning: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "DDS cleaning cartridge"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.LTO4: - case MediumTypes.LTO4WORM: - { - switch(descriptor.Density) - { - case DensityType.LTO4: - density = "LTO Ultrium-4"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.LTO5: - case MediumTypes.LTO5WORM: - { - switch(descriptor.Density) - { - case DensityType.LTO5: - density = "LTO Ultrium-5"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.LTO6: - case MediumTypes.LTO6WORM: - { - switch(descriptor.Density) - { - case DensityType.LTO6: - density = "LTO Ultrium-6"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.LTO7: - case MediumTypes.LTO7WORM: - { - switch(descriptor.Density) - { - case DensityType.LTO7: - density = "LTO Ultrium-7"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.LTOCD: - { - switch(descriptor.Density) - { - case DensityType.LTO2: - density = "LTO Ultrium-2 in CD emulation mode"; - break; - case DensityType.LTO3: - density = "LTO Ultrium-3 in CD emulation mode"; - break; - case DensityType.LTO4: - density = "LTO Ultrium-4 in CD emulation mode"; - break; - case DensityType.LTO5: - density = "LTO Ultrium-5 in CD emulation mode"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.Exatape15m: - { - switch(descriptor.Density) - { - case DensityType.Ex8200: - density = "EXB-8200"; - break; - case DensityType.Ex8200c: - density = "EXB-8200 compressed"; - break; - case DensityType.Ex8500: - density = "EXB-8500"; - break; - case DensityType.Ex8500c: - density = "EXB-8500 compressed"; - break; - case DensityType.Mammoth: - density = "Mammoth"; - break; - case DensityType.IBM3590: - density = "IBM 3590"; - break; - case DensityType.IBM3590E: - density = "IBM 3590E"; - break; - case DensityType.VXA1: - density = "VXA-1"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.Exatape28m: - { - switch(descriptor.Density) - { - case DensityType.Ex8200: - density = "EXB-8200"; - break; - case DensityType.Ex8200c: - density = "EXB-8200 compressed"; - break; - case DensityType.Ex8500: - density = "EXB-8500"; - break; - case DensityType.Ex8500c: - density = "EXB-8500 compressed"; - break; - case DensityType.Mammoth: - density = "Mammoth"; - break; - case DensityType.CT1: - density = "CompactTape I"; - break; - case DensityType.CT2: - density = "CompactTape II"; - break; - case DensityType.IBM3590: - density = "IBM 3590 extended"; - break; - case DensityType.IBM3590E: - density = "IBM 3590E extended"; - break; - case DensityType.VXA2: - density = "VXA-2"; - break; - case DensityType.VXA3: - density = "VXA-3"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.Exatape54m: - { - switch(descriptor.Density) - { - case DensityType.Ex8200: - density = "EXB-8200"; - break; - case DensityType.Ex8200c: - density = "EXB-8200 compressed"; - break; - case DensityType.Ex8500: - density = "EXB-8500"; - break; - case DensityType.Ex8500c: - density = "EXB-8500 compressed"; - break; - case DensityType.Mammoth: - density = "Mammoth"; - break; - case DensityType.DLT3_42k: - density = "DLTtape III at 42500 bpi"; - break; - case DensityType.DLT3_56t: - density = "DLTtape III with 56 tracks"; - break; - case DensityType.DLT3_62k: - case DensityType.DLT3_62kAlt: - density = "DLTtape III at 62500 bpi"; - break; - case DensityType.DLT3c: - density = "DLTtape III compressed"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.Exatape80m: - { - switch(descriptor.Density) - { - case DensityType.Ex8200: - density = "EXB-8200"; - break; - case DensityType.Ex8200c: - density = "EXB-8200 compressed"; - break; - case DensityType.Ex8500: - density = "EXB-8500"; - break; - case DensityType.Ex8500c: - density = "EXB-8500 compressed"; - break; - case DensityType.Mammoth: - density = "Mammoth"; - break; - case DensityType.DLT3_62k: - case DensityType.DLT3_62kAlt: - density = "DLTtape IIIxt"; - break; - case DensityType.DLT3c: - density = "DLTtape IIIxt compressed"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.Exatape106m: - { - switch(descriptor.Density) - { - case DensityType.Ex8200: - density = "EXB-8200"; - break; - case DensityType.Ex8200c: - density = "EXB-8200 compressed"; - break; - case DensityType.Ex8500: - density = "EXB-8500"; - break; - case DensityType.Ex8500c: - density = "EXB-8500 compressed"; - break; - case DensityType.Mammoth: - density = "Mammoth"; - break; - case DensityType.DLT4: - case DensityType.DLT4Alt: - density = "DLTtape IV"; - break; - case DensityType.DLT4_123k: - case DensityType.DLT4_123kAlt: - density = "DLTtape IV at 123090 bpi"; - break; - case DensityType.DLT4_98k: - density = "DLTtape IV at 98250 bpi"; - break; - case DensityType.Travan5: - density = "Travan 5"; - break; - case DensityType.DLT4c: - density = "DLTtape IV compressed"; - break; - case DensityType.DLT4_85k: - density = "DLTtape IV at 85937 bpi"; - break; - case DensityType.DLT4c_85k: - density = "DLTtape IV at 85937 bpi compressed"; - break; - case DensityType.DLT4c_123k: - density = "DLTtape IV at 123090 bpi compressed"; - break; - case DensityType.DLT4c_98k: - density = "DLTtape IV at 98250 bpi compressed"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.Exatape106mXL: - { - switch(descriptor.Density) - { - case DensityType.Ex8200: - density = "EXB-8200"; - break; - case DensityType.Ex8200c: - density = "EXB-8200 compressed"; - break; - case DensityType.Ex8500: - density = "EXB-8500"; - break; - case DensityType.Ex8500c: - density = "EXB-8500 compressed"; - break; - case DensityType.Mammoth: - density = "Mammoth"; - break; - case DensityType.SDLT1_133k: - case DensityType.SDLT1_133kAlt: - density = "Super DLTtape I at 133000 bpi"; - break; - case DensityType.SDLT1: - //case DensityType.SDLT1Alt: - density = "Super DLTtape I"; - break; - case DensityType.SDLT1c: - density = "Super DLTtape I compressed"; - break; - /*case DensityType.SDLT1_133kAlt: - density = "Super DLTtape I at 133000 bpi compressed"; - break;*/ - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SDLT2: - { - switch(descriptor.Density) - { - case DensityType.SDLT2: - density = "Super DLTtape II"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.VStapeI: - { - switch(descriptor.Density) - { - case DensityType.VStape1: - case DensityType.VStape1Alt: - density = "VStape I"; - break; - case DensityType.VStape1c: - density = "VStape I compressed"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.DLTtapeS4: - { - switch(descriptor.Density) - { - case DensityType.DLTS4: - density = "DLTtape S4"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.Exatape22m: - { - switch(descriptor.Density) - { - case DensityType.Ex8200: - density = "EXB-8200"; - break; - case DensityType.Ex8200c: - density = "EXB-8200 compressed"; - break; - case DensityType.Ex8500: - density = "EXB-8500"; - break; - case DensityType.Ex8500c: - density = "EXB-8500 compressed"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.Exatape40m: - { - switch(descriptor.Density) - { - case DensityType.Ex8200: - density = "EXB-8200"; - break; - case DensityType.Ex8200c: - density = "EXB-8200 compressed"; - break; - case DensityType.Ex8500: - density = "EXB-8500"; - break; - case DensityType.Ex8500c: - density = "EXB-8500 compressed"; - break; - case DensityType.Mammoth: - density = "Mammoth"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.Exatape76m: - { - switch(descriptor.Density) - { - case DensityType.Ex8200: - density = "EXB-8200"; - break; - case DensityType.Ex8200c: - density = "EXB-8200 compressed"; - break; - case DensityType.Ex8500: - density = "EXB-8500"; - break; - case DensityType.Ex8500c: - density = "EXB-8500 compressed"; - break; - case DensityType.Mammoth: - density = "Mammoth"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.Exatape112m: - { - switch(descriptor.Density) - { - case DensityType.Ex8200: - density = "EXB-8200"; - break; - case DensityType.Ex8200c: - density = "EXB-8200 compressed"; - break; - case DensityType.Ex8500: - density = "EXB-8500"; - break; - case DensityType.Ex8500c: - density = "EXB-8500 compressed"; - break; - case DensityType.Mammoth: - density = "Mammoth"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.Exatape22mAME: - case MediumTypes.Exatape170m: - case MediumTypes.Exatape125m: - case MediumTypes.Exatape45m: - case MediumTypes.Exatape225m: - case MediumTypes.Exatape150m: - case MediumTypes.Exatape75m: - { - switch(descriptor.Density) - { - case DensityType.Mammoth: - density = "Mammoth"; - break; - case DensityType.Mammoth2: - density = "Mammoth-2"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.DC2900SL: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "DC-2900SL"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.DC9250: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "DC-9250"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLR32: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLR-32"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.MLR1SL: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "MRL1-26GBSL"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLRtape50: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLRtape-50"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLRtape50SL: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLRtape-50 SL"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLR32SL: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLR-32 SL"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLR5: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLR-5"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLR5SL: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLR-5 SL"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLRtape7: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLRtape-7"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLRtape7SL: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLRtape-7 SL"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLRtape24: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLRtape-24"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLRtape24SL: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLRtape-24 SL"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLRtape140: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLRtape-140"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLRtape40: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLRtape-40"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLRtape60: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLRtape-60 or SLRtape-75"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLRtape100: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLRtape-100"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - case MediumTypes.SLR40_60_100: - { - switch(descriptor.Density) - { - case DensityType.Default: - density = "SLR40, SLR60 or SLR100"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - } - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; - } - - if(density != "") - { - if(descriptor.Blocks == 0) - { - if(descriptor.BlockLength == 0) - sb.AppendFormat("\tAll remaining blocks conform to {0} and have a variable length", density).AppendLine(); - else - sb.AppendFormat("\tAll remaining blocks conform to {0} and are {1} bytes each", density, descriptor.BlockLength).AppendLine(); - } - else - { - if(descriptor.BlockLength == 0) - sb.AppendFormat("\t{0} blocks conform to {1} and have a variable length", descriptor.Blocks, density).AppendLine(); - else - sb.AppendFormat("\t{0} blocks conform to {1} and are {2} bytes each", descriptor.Blocks, density, descriptor.BlockLength).AppendLine(); - } - } - else - { - if(descriptor.Blocks == 0) - { - if(descriptor.BlockLength == 0) - sb.AppendFormat("\tAll remaining blocks have a variable length").AppendLine(); - else - sb.AppendFormat("\tAll remaining blocks are {0} bytes each", descriptor.BlockLength).AppendLine(); - } - else - { - if(descriptor.BlockLength == 0) - sb.AppendFormat("\t{0} blocks have a variable length", descriptor.Blocks).AppendLine(); - else - sb.AppendFormat("\t{0} blocks are {1} bytes each", descriptor.Blocks, descriptor.BlockLength).AppendLine(); - } - } - } - } - - break; - } - #endregion Sequential access device mode header - #region Printer device mode header - case PeripheralDeviceTypes.PrinterDevice: - { - switch(header.Value.BufferedMode) - { - case 0: - sb.AppendLine("\tDevice prints directly"); - break; - case 1: - sb.AppendLine("\tDevice uses a print cache"); - break; - default: - sb.AppendFormat("\tUnknown buffered mode code 0x{0:X2}", header.Value.BufferedMode).AppendLine(); - break; - } - break; - } - #endregion Printer device mode header - #region Optical device mode header - case PeripheralDeviceTypes.OpticalDevice: - { - if(header.Value.MediumType != MediumTypes.Default) - { - sb.Append("\tMedium is "); - - switch(header.Value.MediumType) - { - case MediumTypes.ReadOnly: - sb.AppendLine("a Read-only optical"); + case DensityType.Default: break; + case DensityType.Flux7958: + density = "7958 flux transitions per radian"; break; - case MediumTypes.WORM: - sb.AppendLine("a Write-once Read-many optical"); + case DensityType.Flux13262: + density = "13262 flux transitions per radian"; break; - case MediumTypes.Erasable: - sb.AppendLine("a Erasable optical"); - break; - case MediumTypes.RO_WORM: - sb.AppendLine("a combination of read-only and write-once optical"); - break; - case MediumTypes.RO_RW: - sb.AppendLine("a combination of read-only and erasable optical"); - break; - case MediumTypes.WORM_RW: - sb.AppendLine("a combination of write-once and erasable optical"); - break; - case MediumTypes.DOW: - sb.AppendLine("a direct-overwrite optical"); + case DensityType.Flux15916: + density = "15916 flux transitions per radian"; break; default: - sb.AppendFormat("an unknown medium type 0x{0:X2}", header.Value.MediumType).AppendLine(); + density = string.Format("with unknown density code 0x{0:X2}", + (byte)descriptor.Density); break; } - } - if(header.Value.WriteProtected) - sb.AppendLine("\tMedium is write protected"); - if(header.Value.EBC) - sb.AppendLine("\tBlank checking during write is enabled"); - if(header.Value.DPOFUA) - sb.AppendLine("\tDrive supports DPO and FUA bits"); - - if(header.Value.BlockDescriptors != null) - { - foreach(BlockDescriptor descriptor in header.Value.BlockDescriptors) + if(density != "") { - string density = ""; - switch(descriptor.Density) + if(descriptor.Blocks == 0) + sb.AppendFormat("\tAll remaining blocks have {0} and are {1} bytes each", density, + descriptor.BlockLength).AppendLine(); + else + sb.AppendFormat("\t{0} blocks have {1} and are {2} bytes each", descriptor.Blocks, + density, descriptor.BlockLength).AppendLine(); + } + else + { + if(descriptor.Blocks == 0) + sb.AppendFormat("\tAll remaining blocks are {0} bytes each", descriptor.BlockLength) + .AppendLine(); + else + sb.AppendFormat("\t{0} blocks are {1} bytes each", descriptor.Blocks, + descriptor.BlockLength).AppendLine(); + } + } + } + + break; + } + #endregion Direct access device mode header + + #region Sequential access device mode header + case PeripheralDeviceTypes.SequentialAccess: + { + switch(header.Value.BufferedMode) + { + case 0: + sb.AppendLine("\tDevice writes directly to media"); + break; + case 1: + sb.AppendLine("\tDevice uses a write cache"); + break; + case 2: + sb.AppendLine("\tDevice uses a write cache but doesn't return until cache is flushed"); + break; + default: + sb.AppendFormat("\tUnknown buffered mode code 0x{0:X2}", header.Value.BufferedMode) + .AppendLine(); + break; + } + + if(header.Value.Speed == 0) sb.AppendLine("\tDevice uses default speed"); + else sb.AppendFormat("\tDevice uses speed {0}", header.Value.Speed).AppendLine(); + + if(header.Value.WriteProtected) sb.AppendLine("\tMedium is write protected"); + + string medium = ""; + + switch(header.Value.MediumType) + { + case MediumTypes.Default: + medium = "undefined"; + break; + case MediumTypes.Tape12: + medium = "6,3 mm tape with 12 tracks at 394 ftpmm or DC-9250"; + break; + case MediumTypes.Tape24: + medium = "6,3 mm tape with 24 tracks at 394 ftpmm or MLR1-26GBSL"; + break; + case MediumTypes.LTOWORM: + medium = "LTO Ultrium WORM or cleaning cartridge"; + break; + case MediumTypes.LTO: + medium = "LTO Ultrium"; + break; + case MediumTypes.LTO2: + medium = "LTO Ultrium-2"; + break; + case MediumTypes.DC2900SL: + medium = "DC-2900SL"; + break; + case MediumTypes.MLR1: + medium = "MLR1-26GB or DDS-3"; + break; + case MediumTypes.DC9200: + medium = "DC-9200 or DDS-4"; + break; + case MediumTypes.DAT72: + medium = "DAT-72"; + break; + case MediumTypes.LTO3: + medium = "LTO Ultrium-3"; + break; + case MediumTypes.LTO3WORM: + medium = "LTO Ultrium-3 WORM"; + break; + case MediumTypes.DDSCleaning: + medium = "DDS cleaning cartridge"; + break; + case MediumTypes.SLR32: + medium = "SLR-32"; + break; + case MediumTypes.SLRtape50: + medium = "SLRtape-50"; + break; + case MediumTypes.LTO4: + medium = "LTO Ultrium-4"; + break; + case MediumTypes.LTO4WORM: + medium = "LTO Ultrium-4 WORM"; + break; + case MediumTypes.SLRtape50SL: + medium = "SLRtape-50 SL"; + break; + case MediumTypes.SLR32SL: + medium = "SLR-32SL"; + break; + case MediumTypes.SLR5: + medium = "SLR-5"; + break; + case MediumTypes.SLR5SL: + medium = "SLR-5SL"; + break; + case MediumTypes.LTO5: + medium = "LTO Ultrium-5"; + break; + case MediumTypes.LTO5WORM: + medium = "LTO Ultrium-5 WORM"; + break; + case MediumTypes.SLRtape7: + medium = "SLRtape-7"; + break; + case MediumTypes.SLRtape7SL: + medium = "SLRtape-7 SL"; + break; + case MediumTypes.SLRtape24: + medium = "SLRtape-24"; + break; + case MediumTypes.SLRtape24SL: + medium = "SLRtape-24 SL"; + break; + case MediumTypes.LTO6: + medium = "LTO Ultrium-6"; + break; + case MediumTypes.LTO6WORM: + medium = "LTO Ultrium-6 WORM"; + break; + case MediumTypes.SLRtape140: + medium = "SLRtape-140"; + break; + case MediumTypes.SLRtape40: + medium = "SLRtape-40"; + break; + case MediumTypes.SLRtape60: + medium = "SLRtape-60 or SLRtape-75"; + break; + case MediumTypes.SLRtape100: + medium = "SLRtape-100"; + break; + case MediumTypes.SLR40_60_100: + medium = "SLR-40, SLR-60 or SLR-100"; + break; + case MediumTypes.LTO7: + medium = "LTO Ultrium-7"; + break; + case MediumTypes.LTO7WORM: + medium = "LTO Ultrium-7 WORM"; + break; + case MediumTypes.LTOCD: + medium = "LTO Ultrium"; + break; + case MediumTypes.Exatape15m: + medium = "Exatape 15m, IBM MagStar or VXA"; + break; + case MediumTypes.CT1: + medium = "CompactTape I, Exatape 28m, CompactTape II, VXA-2 or VXA-3"; + break; + case MediumTypes.Exatape54m: + medium = "Exatape 54m or DLTtape III"; + break; + case MediumTypes.Exatape80m: + medium = "Exatape 80m or DLTtape IIIxt"; + break; + case MediumTypes.Exatape106m: + medium = "Exatape 106m, DLTtape IV or Travan 5"; + break; + case MediumTypes.Exatape106mXL: + medium = "Exatape 160m XL or Super DLTtape I"; + break; + case MediumTypes.SDLT2: + medium = "Super DLTtape II"; + break; + case MediumTypes.VStapeI: + medium = "VStape I"; + break; + case MediumTypes.DLTtapeS4: + medium = "DLTtape S4"; + break; + case MediumTypes.Travan7: + medium = "Travan 7"; + break; + case MediumTypes.Exatape22m: + medium = "Exatape 22m"; + break; + case MediumTypes.Exatape40m: + medium = "Exatape 40m"; + break; + case MediumTypes.Exatape76m: + medium = "Exatape 76m"; + break; + case MediumTypes.Exatape112m: + medium = "Exatape 112m"; + break; + case MediumTypes.Exatape22mAME: + medium = "Exatape 22m AME"; + break; + case MediumTypes.Exatape170m: + medium = "Exatape 170m"; + break; + case MediumTypes.Exatape125m: + medium = "Exatape 125m"; + break; + case MediumTypes.Exatape45m: + medium = "Exatape 45m"; + break; + case MediumTypes.Exatape225m: + medium = "Exatape 225m"; + break; + case MediumTypes.Exatape150m: + medium = "Exatape 150m"; + break; + case MediumTypes.Exatape75m: + medium = "Exatape 75m"; + break; + default: + medium = string.Format("unknown medium type 0x{0:X2}", (byte)header.Value.MediumType); + break; + } + + sb.AppendFormat("\tMedium is {0}", medium).AppendLine(); + + if(header.Value.BlockDescriptors != null) + { + foreach(BlockDescriptor descriptor in header.Value.BlockDescriptors) + { + string density = ""; + switch(header.Value.MediumType) + { + case MediumTypes.Default: { - case DensityType.Default: - break; - case DensityType.ISO10090: - density = "ISO/IEC 10090: 86 mm Read/Write single-sided optical disc with 12500 tracks"; - break; - case DensityType.D581: - density = "89 mm Read/Write double-sided optical disc with 12500 tracks"; - break; - case DensityType.X3_212: - density = "ANSI X3.212: 130 mm Read/Write double-sided optical disc with 18750 tracks"; - break; - case DensityType.X3_191: - density = "ANSI X3.191: 130 mm Write-Once double-sided optical disc with 30000 tracks"; - break; - case DensityType.X3_214: - density = "ANSI X3.214: 130 mm Write-Once double-sided optical disc with 20000 tracks"; - break; - case DensityType.X3_211: - density = "ANSI X3.211: 130 mm Write-Once double-sided optical disc with 18750 tracks"; - break; - case DensityType.D407: - density = "200 mm optical disc"; - break; - case DensityType.ISO13614: - density = "ISO/IEC 13614: 300 mm double-sided optical disc"; - break; - case DensityType.X3_200: - density = "ANSI X3.200: 356 mm double-sided optical disc with 56350 tracks"; - break; - default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); - break; + switch(descriptor.Density) + { + case DensityType.Default: break; + case DensityType.ECMA62: + density = + "ECMA-62 & ANSI X3.22-1983: 12,7 mm 9-Track Magnetic Tape, 32 ftpmm, NRZI, 32 cpmm"; + break; + case DensityType.ECMA62_Phase: + density = + "ECMA-62 & ANSI X3.39-1986: 12,7 mm 9-Track Magnetic Tape, 126 ftpmm, Phase Encoding, 63 cpmm"; + break; + case DensityType.ECMA62_GCR: + density = + "ECMA-62 & ANSI X3.54-1986: 12,7 mm 9-Track Magnetic Tape, 356 ftpmm, NRZI, 245 cpmm GCR"; + break; + case DensityType.ECMA79: + density = + "ECMA-79 & ANSI X3.116-1986: 6,30 mm Magnetic Tape Cartridge, 252 ftpmm, MFM"; + break; + case DensityType.IBM3480: + density = + "Draft ECMA & ANSI X3B5/87-099: 12,7 mm 18-Track Magnetic Tape Cartridge, 1944 ftpmm, IFM, GCR (IBM 3480, 3490, 3490E)"; + break; + case DensityType.ECMA46: + density = + "ECMA-46 & ANSI X3.56-1986: 6,30 mm Magnetic Tape Cartridge, Phase Encoding, 63 bpmm"; + break; + case DensityType.ECMA98: + density = "ECMA-98: 6,30 mm Magnetic Tape Cartridge, NRZI, 394 ftpmm"; + break; + case DensityType.X3_136: + density = + "ANXI X3.136-1986: 6,3 mm 4 or 9-Track Magnetic Tape Cartridge, 315 bpmm, GCR (QIC-24)"; + break; + case DensityType.X3_157: + density = + "ANXI X3.157-1987: 12,7 mm 9-Track Magnetic Tape, 126 bpmm, Phase Encoding"; + break; + case DensityType.X3_158: + density = + "ANXI X3.158-1987: 3,81 mm 4-Track Magnetic Tape Cassette, 315 bpmm, GCR"; + break; + case DensityType.X3B5_86: + density = + "ANXI X3B5/86-199: 12,7 mm 22-Track Magnetic Tape Cartridge, 262 bpmm, MFM"; + break; + case DensityType.HiTC1: + density = "HI-TC1: 12,7 mm 24-Track Magnetic Tape Cartridge, 500 bpmm, GCR"; + break; + case DensityType.HiTC2: + density = "HI-TC2: 12,7 mm 24-Track Magnetic Tape Cartridge, 999 bpmm, GCR"; + break; + case DensityType.QIC120: + density = "QIC-120: 6,3 mm 15-Track Magnetic Tape Cartridge, 394 bpmm, GCR"; + break; + case DensityType.QIC150: + density = "QIC-150: 6,3 mm 18-Track Magnetic Tape Cartridge, 394 bpmm, GCR"; + break; + case DensityType.QIC320: + density = "QIC-320: 6,3 mm 26-Track Magnetic Tape Cartridge, 630 bpmm, GCR"; + break; + case DensityType.QIC1350: + density = + "QIC-1350: 6,3 mm 30-Track Magnetic Tape Cartridge, 2034 bpmm, RLL"; + break; + case DensityType.X3B5_88: + density = + "ANXI X3B5/88-185A: 3,81 mm Magnetic Tape Cassette, 2400 bpmm, DDS"; + break; + case DensityType.X3_202: + density = "ANXI X3.202-1991: 8 mm Magnetic Tape Cassette, 1703 bpmm, RLL"; + break; + case DensityType.ECMA_TC17: + density = "ECMA TC17: 8 mm Magnetic Tape Cassette, 1789 bpmm, RLL"; + break; + case DensityType.X3_193: + density = + "ANXI X3.193-1990: 12,7 mm 48-Track Magnetic Tape Cartridge, 394 bpmm, MFM"; + break; + case DensityType.X3B5_91: + density = + "ANXI X3B5/97-174: 12,7 mm 48-Track Magnetic Tape Cartridge, 1673 bpmm, MFM"; + break; + case DensityType.QIC11: + density = "QIC-11"; + break; + case DensityType.IBM3490E: + density = "IBM 3490E"; + break; + case DensityType.LTO1: + //case DensityType.SAIT1: + density = "LTO Ultrium or Super AIT-1"; + break; + case DensityType.LTO2Old: + density = "LTO Ultrium-2"; + break; + case DensityType.LTO2: + //case DensityType.T9840: + density = "LTO Ultrium-2 or T9840"; + break; + case DensityType.T9940: + density = "T9940"; + break; + case DensityType.LTO3: + //case DensityType.T9940: + density = "LTO Ultrium-3 or T9940"; + break; + case DensityType.T9840C: + density = "T9840C"; + break; + case DensityType.LTO4: + //case DensityType.T9840D: + density = "LTO Ultrium-4 or T9840D"; + break; + case DensityType.T10000A: + density = "T10000A"; + break; + case DensityType.T10000B: + density = "T10000B"; + break; + case DensityType.T10000C: + density = "T10000C"; + break; + case DensityType.T10000D: + density = "T10000D"; + break; + case DensityType.AIT1: + density = "AIT-1"; + break; + case DensityType.AIT2: + density = "AIT-2"; + break; + case DensityType.AIT3: + density = "AIT-3"; + break; + case DensityType.DDS2: + density = "DDS-2"; + break; + case DensityType.DDS3: + density = "DDS-3"; + break; + case DensityType.DDS4: + density = "DDS-4"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } } - if(density != "") + break; + case MediumTypes.LTOWORM: { - if(descriptor.Blocks == 0) + switch(descriptor.Density) { - if(descriptor.BlockLength == 0) - sb.AppendFormat("\tAll remaining blocks are {0} and have a variable length", density).AppendLine(); - else - sb.AppendFormat("\tAll remaining blocks are {0} and are {1} bytes each", density, descriptor.BlockLength).AppendLine(); + case DensityType.Default: + density = "LTO Ultrium cleaning cartridge"; + break; + case DensityType.LTO3: + density = "LTO Ultrium-3 WORM"; + break; + case DensityType.LTO4: + density = "LTO Ultrium-4 WORM"; + break; + case DensityType.LTO5: + density = "LTO Ultrium-5 WORM"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; } + } + + break; + case MediumTypes.LTO: + { + switch(descriptor.Density) + { + case DensityType.LTO1: + density = "LTO Ultrium"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.LTO2: + { + switch(descriptor.Density) + { + case DensityType.LTO2: + density = "LTO Ultrium-2"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.DDS3: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "MLR1-26GB"; + break; + case DensityType.DDS3: + density = "DDS-3"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.DDS4: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "DC-9200"; + break; + case DensityType.DDS4: + density = "DDS-4"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.DAT72: + { + switch(descriptor.Density) + { + case DensityType.DAT72: + density = "DAT-72"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.LTO3: + case MediumTypes.LTO3WORM: + { + switch(descriptor.Density) + { + case DensityType.LTO3: + density = "LTO Ultrium-3"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.DDSCleaning: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "DDS cleaning cartridge"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.LTO4: + case MediumTypes.LTO4WORM: + { + switch(descriptor.Density) + { + case DensityType.LTO4: + density = "LTO Ultrium-4"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.LTO5: + case MediumTypes.LTO5WORM: + { + switch(descriptor.Density) + { + case DensityType.LTO5: + density = "LTO Ultrium-5"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.LTO6: + case MediumTypes.LTO6WORM: + { + switch(descriptor.Density) + { + case DensityType.LTO6: + density = "LTO Ultrium-6"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.LTO7: + case MediumTypes.LTO7WORM: + { + switch(descriptor.Density) + { + case DensityType.LTO7: + density = "LTO Ultrium-7"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.LTOCD: + { + switch(descriptor.Density) + { + case DensityType.LTO2: + density = "LTO Ultrium-2 in CD emulation mode"; + break; + case DensityType.LTO3: + density = "LTO Ultrium-3 in CD emulation mode"; + break; + case DensityType.LTO4: + density = "LTO Ultrium-4 in CD emulation mode"; + break; + case DensityType.LTO5: + density = "LTO Ultrium-5 in CD emulation mode"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.Exatape15m: + { + switch(descriptor.Density) + { + case DensityType.Ex8200: + density = "EXB-8200"; + break; + case DensityType.Ex8200c: + density = "EXB-8200 compressed"; + break; + case DensityType.Ex8500: + density = "EXB-8500"; + break; + case DensityType.Ex8500c: + density = "EXB-8500 compressed"; + break; + case DensityType.Mammoth: + density = "Mammoth"; + break; + case DensityType.IBM3590: + density = "IBM 3590"; + break; + case DensityType.IBM3590E: + density = "IBM 3590E"; + break; + case DensityType.VXA1: + density = "VXA-1"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.Exatape28m: + { + switch(descriptor.Density) + { + case DensityType.Ex8200: + density = "EXB-8200"; + break; + case DensityType.Ex8200c: + density = "EXB-8200 compressed"; + break; + case DensityType.Ex8500: + density = "EXB-8500"; + break; + case DensityType.Ex8500c: + density = "EXB-8500 compressed"; + break; + case DensityType.Mammoth: + density = "Mammoth"; + break; + case DensityType.CT1: + density = "CompactTape I"; + break; + case DensityType.CT2: + density = "CompactTape II"; + break; + case DensityType.IBM3590: + density = "IBM 3590 extended"; + break; + case DensityType.IBM3590E: + density = "IBM 3590E extended"; + break; + case DensityType.VXA2: + density = "VXA-2"; + break; + case DensityType.VXA3: + density = "VXA-3"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.Exatape54m: + { + switch(descriptor.Density) + { + case DensityType.Ex8200: + density = "EXB-8200"; + break; + case DensityType.Ex8200c: + density = "EXB-8200 compressed"; + break; + case DensityType.Ex8500: + density = "EXB-8500"; + break; + case DensityType.Ex8500c: + density = "EXB-8500 compressed"; + break; + case DensityType.Mammoth: + density = "Mammoth"; + break; + case DensityType.DLT3_42k: + density = "DLTtape III at 42500 bpi"; + break; + case DensityType.DLT3_56t: + density = "DLTtape III with 56 tracks"; + break; + case DensityType.DLT3_62k: + case DensityType.DLT3_62kAlt: + density = "DLTtape III at 62500 bpi"; + break; + case DensityType.DLT3c: + density = "DLTtape III compressed"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.Exatape80m: + { + switch(descriptor.Density) + { + case DensityType.Ex8200: + density = "EXB-8200"; + break; + case DensityType.Ex8200c: + density = "EXB-8200 compressed"; + break; + case DensityType.Ex8500: + density = "EXB-8500"; + break; + case DensityType.Ex8500c: + density = "EXB-8500 compressed"; + break; + case DensityType.Mammoth: + density = "Mammoth"; + break; + case DensityType.DLT3_62k: + case DensityType.DLT3_62kAlt: + density = "DLTtape IIIxt"; + break; + case DensityType.DLT3c: + density = "DLTtape IIIxt compressed"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.Exatape106m: + { + switch(descriptor.Density) + { + case DensityType.Ex8200: + density = "EXB-8200"; + break; + case DensityType.Ex8200c: + density = "EXB-8200 compressed"; + break; + case DensityType.Ex8500: + density = "EXB-8500"; + break; + case DensityType.Ex8500c: + density = "EXB-8500 compressed"; + break; + case DensityType.Mammoth: + density = "Mammoth"; + break; + case DensityType.DLT4: + case DensityType.DLT4Alt: + density = "DLTtape IV"; + break; + case DensityType.DLT4_123k: + case DensityType.DLT4_123kAlt: + density = "DLTtape IV at 123090 bpi"; + break; + case DensityType.DLT4_98k: + density = "DLTtape IV at 98250 bpi"; + break; + case DensityType.Travan5: + density = "Travan 5"; + break; + case DensityType.DLT4c: + density = "DLTtape IV compressed"; + break; + case DensityType.DLT4_85k: + density = "DLTtape IV at 85937 bpi"; + break; + case DensityType.DLT4c_85k: + density = "DLTtape IV at 85937 bpi compressed"; + break; + case DensityType.DLT4c_123k: + density = "DLTtape IV at 123090 bpi compressed"; + break; + case DensityType.DLT4c_98k: + density = "DLTtape IV at 98250 bpi compressed"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.Exatape106mXL: + { + switch(descriptor.Density) + { + case DensityType.Ex8200: + density = "EXB-8200"; + break; + case DensityType.Ex8200c: + density = "EXB-8200 compressed"; + break; + case DensityType.Ex8500: + density = "EXB-8500"; + break; + case DensityType.Ex8500c: + density = "EXB-8500 compressed"; + break; + case DensityType.Mammoth: + density = "Mammoth"; + break; + case DensityType.SDLT1_133k: + case DensityType.SDLT1_133kAlt: + density = "Super DLTtape I at 133000 bpi"; + break; + case DensityType.SDLT1: + //case DensityType.SDLT1Alt: + density = "Super DLTtape I"; + break; + case DensityType.SDLT1c: + density = "Super DLTtape I compressed"; + break; + /*case DensityType.SDLT1_133kAlt: + density = "Super DLTtape I at 133000 bpi compressed"; + break;*/ + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SDLT2: + { + switch(descriptor.Density) + { + case DensityType.SDLT2: + density = "Super DLTtape II"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.VStapeI: + { + switch(descriptor.Density) + { + case DensityType.VStape1: + case DensityType.VStape1Alt: + density = "VStape I"; + break; + case DensityType.VStape1c: + density = "VStape I compressed"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.DLTtapeS4: + { + switch(descriptor.Density) + { + case DensityType.DLTS4: + density = "DLTtape S4"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.Exatape22m: + { + switch(descriptor.Density) + { + case DensityType.Ex8200: + density = "EXB-8200"; + break; + case DensityType.Ex8200c: + density = "EXB-8200 compressed"; + break; + case DensityType.Ex8500: + density = "EXB-8500"; + break; + case DensityType.Ex8500c: + density = "EXB-8500 compressed"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.Exatape40m: + { + switch(descriptor.Density) + { + case DensityType.Ex8200: + density = "EXB-8200"; + break; + case DensityType.Ex8200c: + density = "EXB-8200 compressed"; + break; + case DensityType.Ex8500: + density = "EXB-8500"; + break; + case DensityType.Ex8500c: + density = "EXB-8500 compressed"; + break; + case DensityType.Mammoth: + density = "Mammoth"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.Exatape76m: + { + switch(descriptor.Density) + { + case DensityType.Ex8200: + density = "EXB-8200"; + break; + case DensityType.Ex8200c: + density = "EXB-8200 compressed"; + break; + case DensityType.Ex8500: + density = "EXB-8500"; + break; + case DensityType.Ex8500c: + density = "EXB-8500 compressed"; + break; + case DensityType.Mammoth: + density = "Mammoth"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.Exatape112m: + { + switch(descriptor.Density) + { + case DensityType.Ex8200: + density = "EXB-8200"; + break; + case DensityType.Ex8200c: + density = "EXB-8200 compressed"; + break; + case DensityType.Ex8500: + density = "EXB-8500"; + break; + case DensityType.Ex8500c: + density = "EXB-8500 compressed"; + break; + case DensityType.Mammoth: + density = "Mammoth"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.Exatape22mAME: + case MediumTypes.Exatape170m: + case MediumTypes.Exatape125m: + case MediumTypes.Exatape45m: + case MediumTypes.Exatape225m: + case MediumTypes.Exatape150m: + case MediumTypes.Exatape75m: + { + switch(descriptor.Density) + { + case DensityType.Mammoth: + density = "Mammoth"; + break; + case DensityType.Mammoth2: + density = "Mammoth-2"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.DC2900SL: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "DC-2900SL"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.DC9250: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "DC-9250"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLR32: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLR-32"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.MLR1SL: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "MRL1-26GBSL"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLRtape50: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLRtape-50"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLRtape50SL: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLRtape-50 SL"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLR32SL: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLR-32 SL"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLR5: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLR-5"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLR5SL: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLR-5 SL"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLRtape7: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLRtape-7"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLRtape7SL: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLRtape-7 SL"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLRtape24: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLRtape-24"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLRtape24SL: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLRtape-24 SL"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLRtape140: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLRtape-140"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLRtape40: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLRtape-40"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLRtape60: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLRtape-60 or SLRtape-75"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLRtape100: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLRtape-100"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + case MediumTypes.SLR40_60_100: + { + switch(descriptor.Density) + { + case DensityType.Default: + density = "SLR40, SLR60 or SLR100"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", + (byte)descriptor.Density); + break; + } + } + + break; + default: + density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); + break; + } + + if(density != "") + { + if(descriptor.Blocks == 0) + { + if(descriptor.BlockLength == 0) + sb + .AppendFormat("\tAll remaining blocks conform to {0} and have a variable length", + density).AppendLine(); else - { - if(descriptor.BlockLength == 0) - sb.AppendFormat("\t{0} blocks are {1} and have a variable length", descriptor.Blocks, density).AppendLine(); - else - sb.AppendFormat("\t{0} blocks are {1} and are {2} bytes each", descriptor.Blocks, density, descriptor.BlockLength).AppendLine(); - } + sb.AppendFormat("\tAll remaining blocks conform to {0} and are {1} bytes each", + density, descriptor.BlockLength).AppendLine(); } else { - if(descriptor.Blocks == 0) - { - if(descriptor.BlockLength == 0) - sb.AppendFormat("\tAll remaining blocks have a variable length").AppendLine(); - else - sb.AppendFormat("\tAll remaining blocks are {0} bytes each", descriptor.BlockLength).AppendLine(); - } + if(descriptor.BlockLength == 0) + sb.AppendFormat("\t{0} blocks conform to {1} and have a variable length", + descriptor.Blocks, density).AppendLine(); else - { - if(descriptor.BlockLength == 0) - sb.AppendFormat("\t{0} blocks have a variable length", descriptor.Blocks).AppendLine(); - else - sb.AppendFormat("\t{0} blocks are {1} bytes each", descriptor.Blocks, descriptor.BlockLength).AppendLine(); - } + sb.AppendFormat("\t{0} blocks conform to {1} and are {2} bytes each", + descriptor.Blocks, density, descriptor.BlockLength) + .AppendLine(); + } + } + else + { + if(descriptor.Blocks == 0) + { + if(descriptor.BlockLength == 0) + sb.AppendFormat("\tAll remaining blocks have a variable length").AppendLine(); + else + sb.AppendFormat("\tAll remaining blocks are {0} bytes each", + descriptor.BlockLength).AppendLine(); + } + else + { + if(descriptor.BlockLength == 0) + sb.AppendFormat("\t{0} blocks have a variable length", descriptor.Blocks) + .AppendLine(); + else + sb.AppendFormat("\t{0} blocks are {1} bytes each", descriptor.Blocks, + descriptor.BlockLength).AppendLine(); } } } - - break; } - #endregion Optical device mode header - #region Multimedia device mode header - case PeripheralDeviceTypes.MultiMediaDevice: + + break; + } + #endregion Sequential access device mode header + + #region Printer device mode header + case PeripheralDeviceTypes.PrinterDevice: + { + switch(header.Value.BufferedMode) + { + case 0: + sb.AppendLine("\tDevice prints directly"); + break; + case 1: + sb.AppendLine("\tDevice uses a print cache"); + break; + default: + sb.AppendFormat("\tUnknown buffered mode code 0x{0:X2}", header.Value.BufferedMode) + .AppendLine(); + break; + } + + break; + } + #endregion Printer device mode header + + #region Optical device mode header + case PeripheralDeviceTypes.OpticalDevice: + { + if(header.Value.MediumType != MediumTypes.Default) { sb.Append("\tMedium is "); switch(header.Value.MediumType) { - case MediumTypes.CDROM: - sb.AppendLine("120 mm CD-ROM"); + case MediumTypes.ReadOnly: + sb.AppendLine("a Read-only optical"); break; - case MediumTypes.CDDA: - sb.AppendLine("120 mm Compact Disc Digital Audio"); + case MediumTypes.WORM: + sb.AppendLine("a Write-once Read-many optical"); break; - case MediumTypes.MixedCD: - sb.AppendLine("120 mm Compact Disc with data and audio"); + case MediumTypes.Erasable: + sb.AppendLine("a Erasable optical"); break; - case MediumTypes.CDROM_80: - sb.AppendLine("80 mm CD-ROM"); + case MediumTypes.RO_WORM: + sb.AppendLine("a combination of read-only and write-once optical"); break; - case MediumTypes.CDDA_80: - sb.AppendLine("80 mm Compact Disc Digital Audio"); + case MediumTypes.RO_RW: + sb.AppendLine("a combination of read-only and erasable optical"); break; - case MediumTypes.MixedCD_80: - sb.AppendLine("80 mm Compact Disc with data and audio"); + case MediumTypes.WORM_RW: + sb.AppendLine("a combination of write-once and erasable optical"); break; - case MediumTypes.Unknown_CD: - sb.AppendLine("Unknown medium type"); - break; - case MediumTypes.HybridCD: - sb.AppendLine("120 mm Hybrid disc (Photo CD)"); - break; - case MediumTypes.Unknown_CDR: - sb.AppendLine("Unknown size CD-R"); - break; - case MediumTypes.CDR: - sb.AppendLine("120 mm CD-R with data only"); - break; - case MediumTypes.CDR_DA: - sb.AppendLine("120 mm CD-R with audio only"); - break; - case MediumTypes.CDR_Mixed: - sb.AppendLine("120 mm CD-R with data and audio"); - break; - case MediumTypes.HybridCDR: - sb.AppendLine("120 mm Hybrid CD-R (Photo CD)"); - break; - case MediumTypes.CDR_80: - sb.AppendLine("80 mm CD-R with data only"); - break; - case MediumTypes.CDR_DA_80: - sb.AppendLine("80 mm CD-R with audio only"); - break; - case MediumTypes.CDR_Mixed_80: - sb.AppendLine("80 mm CD-R with data and audio"); - break; - case MediumTypes.HybridCDR_80: - sb.AppendLine("80 mm Hybrid CD-R (Photo CD)"); - break; - case MediumTypes.Unknown_CDRW: - sb.AppendLine("Unknown size CD-RW"); - break; - case MediumTypes.CDRW: - sb.AppendLine("120 mm CD-RW with data only"); - break; - case MediumTypes.CDRW_DA: - sb.AppendLine("120 mm CD-RW with audio only"); - break; - case MediumTypes.CDRW_Mixed: - sb.AppendLine("120 mm CD-RW with data and audio"); - break; - case MediumTypes.HybridCDRW: - sb.AppendLine("120 mm Hybrid CD-RW (Photo CD)"); - break; - case MediumTypes.CDRW_80: - sb.AppendLine("80 mm CD-RW with data only"); - break; - case MediumTypes.CDRW_DA_80: - sb.AppendLine("80 mm CD-RW with audio only"); - break; - case MediumTypes.CDRW_Mixed_80: - sb.AppendLine("80 mm CD-RW with data and audio"); - break; - case MediumTypes.HybridCDRW_80: - sb.AppendLine("80 mm Hybrid CD-RW (Photo CD)"); - break; - case MediumTypes.Unknown_HD: - sb.AppendLine("Unknown size HD disc"); - break; - case MediumTypes.HD: - sb.AppendLine("120 mm HD disc"); - break; - case MediumTypes.HD_80: - sb.AppendLine("80 mm HD disc"); - break; - case MediumTypes.NoDisc: - sb.AppendLine("No disc inserted, tray closed or caddy inserted"); - break; - case MediumTypes.TrayOpen: - sb.AppendLine("Tray open or no caddy inserted"); - break; - case MediumTypes.MediumError: - sb.AppendLine("Tray closed or caddy inserted but medium error"); - break; - case MediumTypes.UnknownBlockDevice: - sb.AppendLine("Unknown block device"); - break; - case MediumTypes.ReadOnlyBlockDevice: - sb.AppendLine("Read-only block device"); - break; - case MediumTypes.ReadWriteBlockDevice: - sb.AppendLine("Read/Write block device"); - break; - case MediumTypes.LTOCD: - sb.AppendLine("LTO in CD-ROM emulation mode"); + case MediumTypes.DOW: + sb.AppendLine("a direct-overwrite optical"); break; default: - sb.AppendFormat("Unknown medium type 0x{0:X2}", header.Value.MediumType).AppendLine(); + sb.AppendFormat("an unknown medium type 0x{0:X2}", header.Value.MediumType) + .AppendLine(); break; } + } - if(header.Value.WriteProtected) - sb.AppendLine("\tMedium is write protected"); + if(header.Value.WriteProtected) sb.AppendLine("\tMedium is write protected"); + if(header.Value.EBC) sb.AppendLine("\tBlank checking during write is enabled"); + if(header.Value.DPOFUA) sb.AppendLine("\tDrive supports DPO and FUA bits"); - if(header.Value.DPOFUA) - sb.AppendLine("\tDrive supports DPO and FUA bits"); - - if(header.Value.BlockDescriptors != null) + if(header.Value.BlockDescriptors != null) + { + foreach(BlockDescriptor descriptor in header.Value.BlockDescriptors) { - foreach(BlockDescriptor descriptor in header.Value.BlockDescriptors) + string density = ""; + switch(descriptor.Density) { - string density = ""; - switch(descriptor.Density) - { - case DensityType.Default: - break; - case DensityType.User: - density = "user data only"; - break; - case DensityType.UserAuxiliary: - density = "user data plus auxiliary data"; - break; - case DensityType.UserAuxiliaryTag: - density = "4-byte tag, user data plus auxiliary data"; - break; - case DensityType.Audio: - density = "audio information only"; - break; - case DensityType.LTO2: - density = "LTO Ultrium-2"; - break; - case DensityType.LTO3: - density = "LTO Ultrium-3"; - break; - case DensityType.LTO4: - density = "LTO Ultrium-4"; - break; - case DensityType.LTO5: - density = "LTO Ultrium-5"; - break; - default: - density = string.Format("with unknown density code 0x{0:X2}", descriptor.Density); - break; - } + case DensityType.Default: break; + case DensityType.ISO10090: + density = + "ISO/IEC 10090: 86 mm Read/Write single-sided optical disc with 12500 tracks"; + break; + case DensityType.D581: + density = "89 mm Read/Write double-sided optical disc with 12500 tracks"; + break; + case DensityType.X3_212: + density = + "ANSI X3.212: 130 mm Read/Write double-sided optical disc with 18750 tracks"; + break; + case DensityType.X3_191: + density = + "ANSI X3.191: 130 mm Write-Once double-sided optical disc with 30000 tracks"; + break; + case DensityType.X3_214: + density = + "ANSI X3.214: 130 mm Write-Once double-sided optical disc with 20000 tracks"; + break; + case DensityType.X3_211: + density = + "ANSI X3.211: 130 mm Write-Once double-sided optical disc with 18750 tracks"; + break; + case DensityType.D407: + density = "200 mm optical disc"; + break; + case DensityType.ISO13614: + density = "ISO/IEC 13614: 300 mm double-sided optical disc"; + break; + case DensityType.X3_200: + density = "ANSI X3.200: 356 mm double-sided optical disc with 56350 tracks"; + break; + default: + density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); + break; + } - if(density != "") + if(density != "") + { + if(descriptor.Blocks == 0) { - if(descriptor.Blocks == 0) - sb.AppendFormat("\tAll remaining blocks have {0} and are {1} bytes each", density, descriptor.BlockLength).AppendLine(); + if(descriptor.BlockLength == 0) + sb.AppendFormat("\tAll remaining blocks are {0} and have a variable length", + density).AppendLine(); else - sb.AppendFormat("\t{0} blocks have {1} and are {2} bytes each", descriptor.Blocks, density, descriptor.BlockLength).AppendLine(); + sb.AppendFormat("\tAll remaining blocks are {0} and are {1} bytes each", + density, descriptor.BlockLength).AppendLine(); } else { - if(descriptor.Blocks == 0) - sb.AppendFormat("\tAll remaining blocks are {0} bytes each", descriptor.BlockLength).AppendLine(); + if(descriptor.BlockLength == 0) + sb.AppendFormat("\t{0} blocks are {1} and have a variable length", + descriptor.Blocks, density).AppendLine(); else - sb.AppendFormat("\t{0} blocks are {1} bytes each", descriptor.Blocks, descriptor.BlockLength).AppendLine(); + sb.AppendFormat("\t{0} blocks are {1} and are {2} bytes each", + descriptor.Blocks, density, descriptor.BlockLength) + .AppendLine(); + } + } + else + { + if(descriptor.Blocks == 0) + { + if(descriptor.BlockLength == 0) + sb.AppendFormat("\tAll remaining blocks have a variable length").AppendLine(); + else + sb.AppendFormat("\tAll remaining blocks are {0} bytes each", + descriptor.BlockLength).AppendLine(); + } + else + { + if(descriptor.BlockLength == 0) + sb.AppendFormat("\t{0} blocks have a variable length", descriptor.Blocks) + .AppendLine(); + else + sb.AppendFormat("\t{0} blocks are {1} bytes each", descriptor.Blocks, + descriptor.BlockLength).AppendLine(); } } } - - break; } - #endregion Multimedia device mode header + + break; + } + #endregion Optical device mode header + + #region Multimedia device mode header + case PeripheralDeviceTypes.MultiMediaDevice: + { + sb.Append("\tMedium is "); + + switch(header.Value.MediumType) + { + case MediumTypes.CDROM: + sb.AppendLine("120 mm CD-ROM"); + break; + case MediumTypes.CDDA: + sb.AppendLine("120 mm Compact Disc Digital Audio"); + break; + case MediumTypes.MixedCD: + sb.AppendLine("120 mm Compact Disc with data and audio"); + break; + case MediumTypes.CDROM_80: + sb.AppendLine("80 mm CD-ROM"); + break; + case MediumTypes.CDDA_80: + sb.AppendLine("80 mm Compact Disc Digital Audio"); + break; + case MediumTypes.MixedCD_80: + sb.AppendLine("80 mm Compact Disc with data and audio"); + break; + case MediumTypes.Unknown_CD: + sb.AppendLine("Unknown medium type"); + break; + case MediumTypes.HybridCD: + sb.AppendLine("120 mm Hybrid disc (Photo CD)"); + break; + case MediumTypes.Unknown_CDR: + sb.AppendLine("Unknown size CD-R"); + break; + case MediumTypes.CDR: + sb.AppendLine("120 mm CD-R with data only"); + break; + case MediumTypes.CDR_DA: + sb.AppendLine("120 mm CD-R with audio only"); + break; + case MediumTypes.CDR_Mixed: + sb.AppendLine("120 mm CD-R with data and audio"); + break; + case MediumTypes.HybridCDR: + sb.AppendLine("120 mm Hybrid CD-R (Photo CD)"); + break; + case MediumTypes.CDR_80: + sb.AppendLine("80 mm CD-R with data only"); + break; + case MediumTypes.CDR_DA_80: + sb.AppendLine("80 mm CD-R with audio only"); + break; + case MediumTypes.CDR_Mixed_80: + sb.AppendLine("80 mm CD-R with data and audio"); + break; + case MediumTypes.HybridCDR_80: + sb.AppendLine("80 mm Hybrid CD-R (Photo CD)"); + break; + case MediumTypes.Unknown_CDRW: + sb.AppendLine("Unknown size CD-RW"); + break; + case MediumTypes.CDRW: + sb.AppendLine("120 mm CD-RW with data only"); + break; + case MediumTypes.CDRW_DA: + sb.AppendLine("120 mm CD-RW with audio only"); + break; + case MediumTypes.CDRW_Mixed: + sb.AppendLine("120 mm CD-RW with data and audio"); + break; + case MediumTypes.HybridCDRW: + sb.AppendLine("120 mm Hybrid CD-RW (Photo CD)"); + break; + case MediumTypes.CDRW_80: + sb.AppendLine("80 mm CD-RW with data only"); + break; + case MediumTypes.CDRW_DA_80: + sb.AppendLine("80 mm CD-RW with audio only"); + break; + case MediumTypes.CDRW_Mixed_80: + sb.AppendLine("80 mm CD-RW with data and audio"); + break; + case MediumTypes.HybridCDRW_80: + sb.AppendLine("80 mm Hybrid CD-RW (Photo CD)"); + break; + case MediumTypes.Unknown_HD: + sb.AppendLine("Unknown size HD disc"); + break; + case MediumTypes.HD: + sb.AppendLine("120 mm HD disc"); + break; + case MediumTypes.HD_80: + sb.AppendLine("80 mm HD disc"); + break; + case MediumTypes.NoDisc: + sb.AppendLine("No disc inserted, tray closed or caddy inserted"); + break; + case MediumTypes.TrayOpen: + sb.AppendLine("Tray open or no caddy inserted"); + break; + case MediumTypes.MediumError: + sb.AppendLine("Tray closed or caddy inserted but medium error"); + break; + case MediumTypes.UnknownBlockDevice: + sb.AppendLine("Unknown block device"); + break; + case MediumTypes.ReadOnlyBlockDevice: + sb.AppendLine("Read-only block device"); + break; + case MediumTypes.ReadWriteBlockDevice: + sb.AppendLine("Read/Write block device"); + break; + case MediumTypes.LTOCD: + sb.AppendLine("LTO in CD-ROM emulation mode"); + break; + default: + sb.AppendFormat("Unknown medium type 0x{0:X2}", header.Value.MediumType).AppendLine(); + break; + } + + if(header.Value.WriteProtected) sb.AppendLine("\tMedium is write protected"); + + if(header.Value.DPOFUA) sb.AppendLine("\tDrive supports DPO and FUA bits"); + + if(header.Value.BlockDescriptors != null) + { + foreach(BlockDescriptor descriptor in header.Value.BlockDescriptors) + { + string density = ""; + switch(descriptor.Density) + { + case DensityType.Default: break; + case DensityType.User: + density = "user data only"; + break; + case DensityType.UserAuxiliary: + density = "user data plus auxiliary data"; + break; + case DensityType.UserAuxiliaryTag: + density = "4-byte tag, user data plus auxiliary data"; + break; + case DensityType.Audio: + density = "audio information only"; + break; + case DensityType.LTO2: + density = "LTO Ultrium-2"; + break; + case DensityType.LTO3: + density = "LTO Ultrium-3"; + break; + case DensityType.LTO4: + density = "LTO Ultrium-4"; + break; + case DensityType.LTO5: + density = "LTO Ultrium-5"; + break; + default: + density = string.Format("with unknown density code 0x{0:X2}", descriptor.Density); + break; + } + + if(density != "") + { + if(descriptor.Blocks == 0) + sb.AppendFormat("\tAll remaining blocks have {0} and are {1} bytes each", density, + descriptor.BlockLength).AppendLine(); + else + sb.AppendFormat("\t{0} blocks have {1} and are {2} bytes each", descriptor.Blocks, + density, descriptor.BlockLength).AppendLine(); + } + else + { + if(descriptor.Blocks == 0) + sb.AppendFormat("\tAll remaining blocks are {0} bytes each", descriptor.BlockLength) + .AppendLine(); + else + sb.AppendFormat("\t{0} blocks are {1} bytes each", descriptor.Blocks, + descriptor.BlockLength).AppendLine(); + } + } + } + + break; + } + #endregion Multimedia device mode header } return sb.ToString(); @@ -1807,8 +1935,7 @@ namespace DiscImageChef.Decoders.SCSI public static ModeHeader? DecodeModeHeader10(byte[] modeResponse, PeripheralDeviceTypes deviceType) { - if(modeResponse == null || modeResponse.Length < 8) - return null; + if(modeResponse == null || modeResponse.Length < 8) return null; ushort modeLength; ushort blockDescLength; @@ -1816,8 +1943,7 @@ namespace DiscImageChef.Decoders.SCSI modeLength = (ushort)((modeResponse[0] << 8) + modeResponse[1]); blockDescLength = (ushort)((modeResponse[6] << 8) + modeResponse[7]); - if(modeResponse.Length < modeLength) - return null; + if(modeResponse.Length < modeLength) return null; ModeHeader header = new ModeHeader(); header.MediumType = (MediumTypes)modeResponse[2]; @@ -1906,7 +2032,6 @@ namespace DiscImageChef.Decoders.SCSI } #region Mode Page 0x0A: Control mode page - /// /// Control mode page /// Page code 0x0A @@ -2031,20 +2156,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_0A? DecodeModePage_0A(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x0A) - return null; + if((pageResponse[0] & 0x3F) != 0x0A) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 8) - return null; + if(pageResponse.Length < 8) return null; ModePage_0A decoded = new ModePage_0A(); @@ -2062,8 +2182,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.ReadyAENHoldOffPeriod = (ushort)((pageResponse[6] << 8) + pageResponse[7]); - if(pageResponse.Length < 10) - return decoded; + if(pageResponse.Length < 10) return decoded; // SPC-1 decoded.GLTSD |= (pageResponse[2] & 0x02) == 0x02; @@ -2102,52 +2221,38 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_0A(ModePage_0A? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_0A page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Control mode page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); - if(page.RLEC) - sb.AppendLine("\tIf set, target shall report log exception conditions"); - if(page.DQue) - sb.AppendLine("\tTagged queuing is disabled"); - if(page.EECA) - sb.AppendLine("\tExtended Contingent Allegiance is enabled"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); + if(page.RLEC) sb.AppendLine("\tIf set, target shall report log exception conditions"); + if(page.DQue) sb.AppendLine("\tTagged queuing is disabled"); + if(page.EECA) sb.AppendLine("\tExtended Contingent Allegiance is enabled"); if(page.RAENP) sb.AppendLine("\tTarget may issue an asynchronous event notification upon completing its initialization"); if(page.UAAENP) sb.AppendLine("\tTarget may issue an asynchronous event notification instead of a unit attention condition"); if(page.EAENP) sb.AppendLine("\tTarget may issue an asynchronous event notification instead of a deferred error"); - if(page.GLTSD) - sb.AppendLine("\tGlobal logging target save disabled"); - if(page.RAC) - sb.AppendLine("\tCHECK CONDITION should be reported rather than a long busy condition"); - if(page.SWP) - sb.AppendLine("\tSoftware write protect is active"); + if(page.GLTSD) sb.AppendLine("\tGlobal logging target save disabled"); + if(page.RAC) sb.AppendLine("\tCHECK CONDITION should be reported rather than a long busy condition"); + if(page.SWP) sb.AppendLine("\tSoftware write protect is active"); if(page.TAS) sb.AppendLine("\tTasks aborted by other initiator's actions should be terminated with TASK ABORTED"); if(page.TMF_ONLY) sb.AppendLine("\tAll tasks received in nexus with ACA ACTIVE is set and an ACA condition is established shall terminate"); if(page.D_SENSE) sb.AppendLine("\tDevice shall return descriptor format sense data when returning sense data in the same transactions as a CHECK CONDITION"); - if(page.ATO) - sb.AppendLine("\tLOGICAL BLOCK APPLICATION TAG should not be modified"); - if(page.DPICZ) - sb.AppendLine("\tProtector information checking is disabled"); - if(page.NUAR) - sb.AppendLine("\tNo unit attention on release"); - if(page.ATMPE) - sb.AppendLine("\tApplication Tag mode page is enabled"); - if(page.RWWP) - sb.AppendLine("\tAbort any write command without protection information"); - if(page.SBLP) - sb.AppendLine("\tSupportes block lengths and protection information"); + if(page.ATO) sb.AppendLine("\tLOGICAL BLOCK APPLICATION TAG should not be modified"); + if(page.DPICZ) sb.AppendLine("\tProtector information checking is disabled"); + if(page.NUAR) sb.AppendLine("\tNo unit attention on release"); + if(page.ATMPE) sb.AppendLine("\tApplication Tag mode page is enabled"); + if(page.RWWP) sb.AppendLine("\tAbort any write command without protection information"); + if(page.SBLP) sb.AppendLine("\tSupportes block lengths and protection information"); switch(page.TST) { @@ -2224,14 +2329,16 @@ namespace DiscImageChef.Decoders.SCSI } if(page.ReadyAENHoldOffPeriod > 0) - sb.AppendFormat("\t{0} ms before attempting asynchronous event notifications after initialization", page.ReadyAENHoldOffPeriod).AppendLine(); + sb.AppendFormat("\t{0} ms before attempting asynchronous event notifications after initialization", + page.ReadyAENHoldOffPeriod).AppendLine(); if(page.BusyTimeoutPeriod > 0) { if(page.BusyTimeoutPeriod == 0xFFFF) sb.AppendLine("\tThere is no limit on the maximum time that is allowed to remain busy"); else - sb.AppendFormat("\tA maximum of {0} ms are allowed to remain busy", page.BusyTimeoutPeriod * 100).AppendLine(); + sb.AppendFormat("\tA maximum of {0} ms are allowed to remain busy", page.BusyTimeoutPeriod * 100) + .AppendLine(); } if(page.ExtendedSelfTestCompletionTime > 0) @@ -2239,11 +2346,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion Mode Page 0x0A: Control mode page #region Mode Page 0x02: Disconnect-reconnect page - /// /// Disconnect-reconnect page /// Page code 0x02 @@ -2304,20 +2409,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_02? DecodeModePage_02(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x02) - return null; + if((pageResponse[0] & 0x3F) != 0x02) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 12) - return null; + if(pageResponse.Length < 12) return null; ModePage_02 decoded = new ModePage_02(); @@ -2337,8 +2437,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.DTDC = (byte)(pageResponse[12] & 0x07); } - if(pageResponse.Length >= 16) - decoded.FirstBurstSize = (ushort)((pageResponse[14] << 8) + pageResponse[15]); + if(pageResponse.Length >= 16) decoded.FirstBurstSize = (ushort)((pageResponse[14] << 8) + pageResponse[15]); return decoded; } @@ -2350,35 +2449,41 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_02(ModePage_02? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_02 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Disconnect-Reconnect mode page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); if(page.BufferFullRatio > 0) - sb.AppendFormat("\t{0} ratio of buffer that shall be full prior to attempting a reselection", page.BufferFullRatio).AppendLine(); + sb.AppendFormat("\t{0} ratio of buffer that shall be full prior to attempting a reselection", + page.BufferFullRatio).AppendLine(); if(page.BufferEmptyRatio > 0) - sb.AppendFormat("\t{0} ratio of buffer that shall be empty prior to attempting a reselection", page.BufferEmptyRatio).AppendLine(); + sb.AppendFormat("\t{0} ratio of buffer that shall be empty prior to attempting a reselection", + page.BufferEmptyRatio).AppendLine(); if(page.BusInactivityLimit > 0) - sb.AppendFormat("\t{0} µs maximum permitted to assert BSY without a REQ/ACK handshake", page.BusInactivityLimit * 100).AppendLine(); + sb.AppendFormat("\t{0} µs maximum permitted to assert BSY without a REQ/ACK handshake", + page.BusInactivityLimit * 100).AppendLine(); if(page.DisconnectTimeLimit > 0) - sb.AppendFormat("\t{0} µs maximum permitted wait after releasing the bus before attempting reselection", page.DisconnectTimeLimit * 100).AppendLine(); + sb.AppendFormat("\t{0} µs maximum permitted wait after releasing the bus before attempting reselection", + page.DisconnectTimeLimit * 100).AppendLine(); if(page.ConnectTimeLimit > 0) - sb.AppendFormat("\t{0} µs allowed to use the bus before disconnecting, if granted the privilege and not restricted", page.ConnectTimeLimit * 100).AppendLine(); + sb + .AppendFormat("\t{0} µs allowed to use the bus before disconnecting, if granted the privilege and not restricted", + page.ConnectTimeLimit * 100).AppendLine(); if(page.MaxBurstSize > 0) - sb.AppendFormat("\t{0} bytes maximum can be transferred before disconnecting", page.MaxBurstSize * 512).AppendLine(); + sb.AppendFormat("\t{0} bytes maximum can be transferred before disconnecting", page.MaxBurstSize * 512) + .AppendLine(); if(page.FirstBurstSize > 0) - sb.AppendFormat("\t{0} bytes maximum can be transferred for a command along with the disconnect command", page.FirstBurstSize * 512).AppendLine(); + sb + .AppendFormat("\t{0} bytes maximum can be transferred for a command along with the disconnect command", + page.FirstBurstSize * 512).AppendLine(); if(page.DIMM) sb.AppendLine("\tTarget shall not transfer data for a command during the same interconnect tenancy"); - if(page.EMDP) - sb.AppendLine("\tTarget is allowed to re-order the data transfer"); + if(page.EMDP) sb.AppendLine("\tTarget is allowed to re-order the data transfer"); switch(page.DTDC) { @@ -2398,11 +2503,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion Mode Page 0x02: Disconnect-reconnect page #region Mode Page 0x08: Caching page - /// /// Disconnect-reconnect page /// Page code 0x08 @@ -2502,20 +2605,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_08? DecodeModePage_08(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x08) - return null; + if((pageResponse[0] & 0x3F) != 0x08) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 12) - return null; + if(pageResponse.Length < 12) return null; ModePage_08 decoded = new ModePage_08(); @@ -2531,8 +2629,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.MaximumPreFetch = (ushort)((pageResponse[8] << 8) + pageResponse[9]); decoded.MaximumPreFetchCeiling = (ushort)((pageResponse[10] << 8) + pageResponse[11]); - if(pageResponse.Length < 20) - return decoded; + if(pageResponse.Length < 20) return decoded; decoded.IC |= (pageResponse[2] & 0x80) == 0x80; decoded.ABPF |= (pageResponse[2] & 0x40) == 0x40; @@ -2560,20 +2657,16 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_08(ModePage_08? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_08 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Caching mode page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); - if(page.RCD) - sb.AppendLine("\tRead-cache is enabled"); - if(page.WCE) - sb.AppendLine("\tWrite-cache is enabled"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); + if(page.RCD) sb.AppendLine("\tRead-cache is enabled"); + if(page.WCE) sb.AppendLine("\tWrite-cache is enabled"); switch(page.DemandReadRetentionPrio) { @@ -2587,7 +2680,8 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("\tData put by READ commands should not be evicted if there is data cached by other means that can be evicted"); break; default: - sb.AppendFormat("\tUnknown demand read retention priority value {0}", page.DemandReadRetentionPrio).AppendLine(); + sb.AppendFormat("\tUnknown demand read retention priority value {0}", page.DemandReadRetentionPrio) + .AppendLine(); break; } @@ -2603,52 +2697,54 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("\tData put by WRITE commands should not be evicted if there is data cached by other means that can be evicted"); break; default: - sb.AppendFormat("\tUnknown demand write retention priority value {0}", page.DemandReadRetentionPrio).AppendLine(); + sb.AppendFormat("\tUnknown demand write retention priority value {0}", page.DemandReadRetentionPrio) + .AppendLine(); break; } - if(page.DRA) - sb.AppendLine("\tRead-ahead is disabled"); + if(page.DRA) sb.AppendLine("\tRead-ahead is disabled"); else { - if(page.MF) - sb.AppendLine("\tPre-fetch values indicate a block multiplier"); + if(page.MF) sb.AppendLine("\tPre-fetch values indicate a block multiplier"); - if(page.DisablePreFetch == 0) - sb.AppendLine("\tNo pre-fetch will be done"); + if(page.DisablePreFetch == 0) sb.AppendLine("\tNo pre-fetch will be done"); else { - sb.AppendFormat("\tPre-fetch will be done for READ commands of {0} blocks or less", page.DisablePreFetch).AppendLine(); + sb.AppendFormat("\tPre-fetch will be done for READ commands of {0} blocks or less", + page.DisablePreFetch).AppendLine(); if(page.MinimumPreFetch > 0) - sb.AppendFormat("At least {0} blocks will be always pre-fetched", page.MinimumPreFetch).AppendLine(); + sb.AppendFormat("At least {0} blocks will be always pre-fetched", page.MinimumPreFetch) + .AppendLine(); if(page.MaximumPreFetch > 0) - sb.AppendFormat("\tA maximum of {0} blocks will be pre-fetched", page.MaximumPreFetch).AppendLine(); + sb.AppendFormat("\tA maximum of {0} blocks will be pre-fetched", page.MaximumPreFetch) + .AppendLine(); if(page.MaximumPreFetchCeiling > 0) - sb.AppendFormat("\tA maximum of {0} blocks will be pre-fetched even if it is commanded to pre-fetch more", page.MaximumPreFetchCeiling).AppendLine(); + sb + .AppendFormat("\tA maximum of {0} blocks will be pre-fetched even if it is commanded to pre-fetch more", + page.MaximumPreFetchCeiling).AppendLine(); if(page.IC) sb.AppendLine("\tDevice should use number of cache segments or cache segment size for caching"); - if(page.ABPF) - sb.AppendLine("\tPre-fetch should be aborted upong receiving a new command"); - if(page.CAP) - sb.AppendLine("\tCaching analysis is permitted"); + if(page.ABPF) sb.AppendLine("\tPre-fetch should be aborted upong receiving a new command"); + if(page.CAP) sb.AppendLine("\tCaching analysis is permitted"); if(page.Disc) sb.AppendLine("\tPre-fetch can continue across discontinuities (such as cylinders or tracks)"); } } - if(page.FSW) - sb.AppendLine("\tDrive should not reorder the sequence of write commands to be faster"); + if(page.FSW) sb.AppendLine("\tDrive should not reorder the sequence of write commands to be faster"); if(page.Size) { if(page.CacheSegmentSize > 0) { if(page.LBCSS) - sb.AppendFormat("\tDrive cache segments should be {0} blocks long", page.CacheSegmentSize).AppendLine(); + sb.AppendFormat("\tDrive cache segments should be {0} blocks long", page.CacheSegmentSize) + .AppendLine(); else - sb.AppendFormat("\tDrive cache segments should be {0} bytes long", page.CacheSegmentSize).AppendLine(); + sb.AppendFormat("\tDrive cache segments should be {0} bytes long", page.CacheSegmentSize) + .AppendLine(); } } else @@ -2658,18 +2754,17 @@ namespace DiscImageChef.Decoders.SCSI } if(page.NonCacheSegmentSize > 0) - sb.AppendFormat("\tDrive shall allocate {0} bytes to buffer even when all cached data cannot be evicted", page.NonCacheSegmentSize).AppendLine(); + sb + .AppendFormat("\tDrive shall allocate {0} bytes to buffer even when all cached data cannot be evicted", + page.NonCacheSegmentSize).AppendLine(); - if(page.NV_DIS) - sb.AppendLine("\tNon-Volatile cache is disabled"); + if(page.NV_DIS) sb.AppendLine("\tNon-Volatile cache is disabled"); return sb.ToString(); } - #endregion Mode Page 0x08: Caching page #region Mode Page 0x05: Flexible disk page - /// /// Disconnect-reconnect page /// Page code 0x05 @@ -2786,20 +2881,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_05? DecodeModePage_05(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x05) - return null; + if((pageResponse[0] & 0x3F) != 0x05) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 32) - return null; + if(pageResponse.Length < 32) return null; ModePage_05 decoded = new ModePage_05(); @@ -2839,16 +2929,14 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_05(ModePage_05? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_05 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Flexible disk page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); sb.AppendFormat("\tTransfer rate: {0} kbit/s", page.TransferRate).AppendLine(); sb.AppendFormat("\t{0} heads", page.Heads).AppendLine(); @@ -2856,9 +2944,11 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendFormat("\t{0} sectors per track", page.SectorsPerTrack).AppendLine(); sb.AppendFormat("\t{0} bytes per sector", page.BytesPerSector).AppendLine(); if(page.WritePrecompCylinder < page.Cylinders) - sb.AppendFormat("\tWrite pre-compensation starts at cylinder {0}", page.WritePrecompCylinder).AppendLine(); + sb.AppendFormat("\tWrite pre-compensation starts at cylinder {0}", page.WritePrecompCylinder) + .AppendLine(); if(page.WriteReduceCylinder < page.Cylinders) - sb.AppendFormat("\tWrite current reduction starts at cylinder {0}", page.WriteReduceCylinder).AppendLine(); + sb.AppendFormat("\tWrite current reduction starts at cylinder {0}", page.WriteReduceCylinder) + .AppendLine(); if(page.DriveStepRate > 0) sb.AppendFormat("\tDrive steps in {0} μs", (uint)page.DriveStepRate * 100).AppendLine(); if(page.DriveStepPulse > 0) @@ -2867,31 +2957,29 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendFormat("\tHeads settles in {0} μs", (uint)page.HeadSettleDelay * 100).AppendLine(); if(!page.TRDY) - sb.AppendFormat("\tTarget shall wait {0} seconds before attempting to access the medium after motor on is asserted", - (double)page.MotorOnDelay * 10).AppendLine(); + sb + .AppendFormat("\tTarget shall wait {0} seconds before attempting to access the medium after motor on is asserted", + (double)page.MotorOnDelay * 10).AppendLine(); else - sb.AppendFormat("\tTarget shall wait {0} seconds after drive is ready before aborting medium access attemps", - (double)page.MotorOnDelay * 10).AppendLine(); + sb + .AppendFormat("\tTarget shall wait {0} seconds after drive is ready before aborting medium access attemps", + (double)page.MotorOnDelay * 10).AppendLine(); if(page.MotorOffDelay != 0xFF) - sb.AppendFormat("\tTarget shall wait {0} seconds before releasing the motor on signal after becoming idle", - (double)page.MotorOffDelay * 10).AppendLine(); - else - sb.AppendLine("\tTarget shall never release the motor on signal"); + sb + .AppendFormat("\tTarget shall wait {0} seconds before releasing the motor on signal after becoming idle", + (double)page.MotorOffDelay * 10).AppendLine(); + else sb.AppendLine("\tTarget shall never release the motor on signal"); - if(page.TRDY) - sb.AppendLine("\tThere is a drive ready signal"); - if(page.SSN) - sb.AppendLine("\tSectors start at 1"); - if(page.MO) - sb.AppendLine("\tThe motor on signal shall remain released"); + if(page.TRDY) sb.AppendLine("\tThere is a drive ready signal"); + if(page.SSN) sb.AppendLine("\tSectors start at 1"); + if(page.MO) sb.AppendLine("\tThe motor on signal shall remain released"); sb.AppendFormat("\tDrive needs to do {0} step pulses per cylinder", page.SPC + 1).AppendLine(); if(page.WriteCompensation > 0) sb.AppendFormat("\tWrite pre-compensation is {0}", page.WriteCompensation).AppendLine(); - if(page.HeadLoadDelay > 0) - sb.AppendFormat("\tHead takes {0} ms to load", page.HeadLoadDelay).AppendLine(); + if(page.HeadLoadDelay > 0) sb.AppendFormat("\tHead takes {0} ms to load", page.HeadLoadDelay).AppendLine(); if(page.HeadUnloadDelay > 0) sb.AppendFormat("\tHead takes {0} ms to unload", page.HeadUnloadDelay).AppendLine(); @@ -2905,24 +2993,18 @@ namespace DiscImageChef.Decoders.SCSI break; case 1: sb.Append("\tPin 34 indicates drive is ready when active "); - if((page.Pin34 & 0x08) == 0x08) - sb.Append("high"); - else - sb.Append("low"); + if((page.Pin34 & 0x08) == 0x08) sb.Append("high"); + else sb.Append("low"); break; case 2: sb.Append("\tPin 34 indicates disk has changed when active "); - if((page.Pin34 & 0x08) == 0x08) - sb.Append("high"); - else - sb.Append("low"); + if((page.Pin34 & 0x08) == 0x08) sb.Append("high"); + else sb.Append("low"); break; default: sb.AppendFormat("\tPin 34 indicates unknown function {0} when active ", page.Pin34 & 0x07); - if((page.Pin34 & 0x08) == 0x08) - sb.Append("high"); - else - sb.Append("low"); + if((page.Pin34 & 0x08) == 0x08) sb.Append("high"); + else sb.Append("low"); break; } @@ -2933,31 +3015,23 @@ namespace DiscImageChef.Decoders.SCSI break; case 1: sb.Append("\tPin 4 indicates drive is in use when active "); - if((page.Pin4 & 0x08) == 0x08) - sb.Append("high"); - else - sb.Append("low"); + if((page.Pin4 & 0x08) == 0x08) sb.Append("high"); + else sb.Append("low"); break; case 2: sb.Append("\tPin 4 indicates eject when active "); - if((page.Pin4 & 0x08) == 0x08) - sb.Append("high"); - else - sb.Append("low"); + if((page.Pin4 & 0x08) == 0x08) sb.Append("high"); + else sb.Append("low"); break; case 3: sb.Append("\tPin 4 indicates head load when active "); - if((page.Pin4 & 0x08) == 0x08) - sb.Append("high"); - else - sb.Append("low"); + if((page.Pin4 & 0x08) == 0x08) sb.Append("high"); + else sb.Append("low"); break; default: sb.AppendFormat("\tPin 4 indicates unknown function {0} when active ", page.Pin4 & 0x07); - if((page.Pin4 & 0x08) == 0x08) - sb.Append("high"); - else - sb.Append("low"); + if((page.Pin4 & 0x08) == 0x08) sb.Append("high"); + else sb.Append("low"); break; } @@ -2968,10 +3042,8 @@ namespace DiscImageChef.Decoders.SCSI break; default: sb.AppendFormat("\tPin 2 indicates unknown function {0} when active ", page.Pin2 & 0x07); - if((page.Pin2 & 0x08) == 0x08) - sb.Append("high"); - else - sb.Append("low"); + if((page.Pin2 & 0x08) == 0x08) sb.Append("high"); + else sb.Append("low"); break; } @@ -2982,27 +3054,21 @@ namespace DiscImageChef.Decoders.SCSI break; case 1: sb.Append("\tPin 1 indicates disk change reset when active "); - if((page.Pin1 & 0x08) == 0x08) - sb.Append("high"); - else - sb.Append("low"); + if((page.Pin1 & 0x08) == 0x08) sb.Append("high"); + else sb.Append("low"); break; default: sb.AppendFormat("\tPin 1 indicates unknown function {0} when active ", page.Pin1 & 0x07); - if((page.Pin1 & 0x08) == 0x08) - sb.Append("high"); - else - sb.Append("low"); + if((page.Pin1 & 0x08) == 0x08) sb.Append("high"); + else sb.Append("low"); break; } return sb.ToString(); } - #endregion Mode Page 0x05: Flexible disk page #region Mode Page 0x03: Format device page - /// /// Disconnect-reconnect page /// Page code 0x03 @@ -3071,20 +3137,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_03? DecodeModePage_03(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x03) - return null; + if((pageResponse[0] & 0x3F) != 0x03) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 24) - return null; + if(pageResponse.Length < 24) return null; ModePage_03 decoded = new ModePage_03(); @@ -3113,32 +3174,34 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_03(ModePage_03? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_03 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Format device page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - sb.AppendFormat("\t{0} tracks per zone to use in dividing the capacity for the purpose of allocating alternate sectors", page.TracksPerZone).AppendLine(); - sb.AppendFormat("\t{0} sectors per zone that shall be reserved for defect handling", page.AltSectorsPerZone).AppendLine(); - sb.AppendFormat("\t{0} tracks per zone that shall be reserved for defect handling", page.AltTracksPerZone).AppendLine(); - sb.AppendFormat("\t{0} tracks per LUN that shall be reserved for defect handling", page.AltTracksPerLun).AppendLine(); + sb + .AppendFormat("\t{0} tracks per zone to use in dividing the capacity for the purpose of allocating alternate sectors", + page.TracksPerZone).AppendLine(); + sb.AppendFormat("\t{0} sectors per zone that shall be reserved for defect handling", page.AltSectorsPerZone) + .AppendLine(); + sb.AppendFormat("\t{0} tracks per zone that shall be reserved for defect handling", page.AltTracksPerZone) + .AppendLine(); + sb.AppendFormat("\t{0} tracks per LUN that shall be reserved for defect handling", page.AltTracksPerLun) + .AppendLine(); sb.AppendFormat("\t{0} physical sectors per track", page.SectorsPerTrack).AppendLine(); sb.AppendFormat("\t{0} Bytes per physical sector", page.BytesPerSector).AppendLine(); sb.AppendFormat("\tTarget-dependent interleave value is {0}", page.Interleave).AppendLine(); - sb.AppendFormat("\t{0} sectors between last block of one track and first block of the next", page.TrackSkew).AppendLine(); - sb.AppendFormat("\t{0} sectors between last block of a cylinder and first block of the next one", page.CylinderSkew).AppendLine(); - if(page.SSEC) - sb.AppendLine("\tDrive supports soft-sectoring format"); - if(page.HSEC) - sb.AppendLine("\tDrive supports hard-sectoring format"); - if(page.RMB) - sb.AppendLine("\tDrive media is removable"); + sb.AppendFormat("\t{0} sectors between last block of one track and first block of the next", page.TrackSkew) + .AppendLine(); + sb.AppendFormat("\t{0} sectors between last block of a cylinder and first block of the next one", + page.CylinderSkew).AppendLine(); + if(page.SSEC) sb.AppendLine("\tDrive supports soft-sectoring format"); + if(page.HSEC) sb.AppendLine("\tDrive supports hard-sectoring format"); + if(page.RMB) sb.AppendLine("\tDrive media is removable"); if(page.SURF) sb.AppendLine("\tSector addressing is progressively incremented in one surface before going to the next"); else @@ -3146,11 +3209,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion Mode Page 0x03: Format device page #region Mode Page 0x0B: Medium types supported page - /// /// Disconnect-reconnect page /// Page code 0x0B @@ -3170,20 +3231,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_0B? DecodeModePage_0B(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x0B) - return null; + if((pageResponse[0] & 0x3F) != 0x0B) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 8) - return null; + if(pageResponse.Length < 8) return null; ModePage_0B decoded = new ModePage_0B(); @@ -3203,39 +3259,37 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_0B(ModePage_0B? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_0B page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Medium types supported page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); if(page.MediumType1 != MediumTypes.Default) - sb.AppendFormat("Supported medium type one: {0}", GetMediumTypeDescription(page.MediumType1)).AppendLine(); + sb.AppendFormat("Supported medium type one: {0}", GetMediumTypeDescription(page.MediumType1)) + .AppendLine(); if(page.MediumType2 != MediumTypes.Default) - sb.AppendFormat("Supported medium type two: {0}", GetMediumTypeDescription(page.MediumType2)).AppendLine(); + sb.AppendFormat("Supported medium type two: {0}", GetMediumTypeDescription(page.MediumType2)) + .AppendLine(); if(page.MediumType3 != MediumTypes.Default) - sb.AppendFormat("Supported medium type three: {0}", GetMediumTypeDescription(page.MediumType3)).AppendLine(); + sb.AppendFormat("Supported medium type three: {0}", GetMediumTypeDescription(page.MediumType3)) + .AppendLine(); if(page.MediumType4 != MediumTypes.Default) - sb.AppendFormat("Supported medium type four: {0}", GetMediumTypeDescription(page.MediumType4)).AppendLine(); + sb.AppendFormat("Supported medium type four: {0}", GetMediumTypeDescription(page.MediumType4)) + .AppendLine(); return sb.ToString(); } - #endregion Mode Page 0x0B: Medium types supported page #region Mode Page 0x0C: Notch page - // TODO: Implement this page - #endregion Mode Page 0x0C: Notch page #region Mode Page 0x01: Read-write error recovery page - /// /// Disconnect-reconnect page /// Page code 0x01 @@ -3312,20 +3366,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_01? DecodeModePage_01(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x01) - return null; + if((pageResponse[0] & 0x3F) != 0x01) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 8) - return null; + if(pageResponse.Length < 8) return null; ModePage_01 decoded = new ModePage_01(); @@ -3344,8 +3393,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.HeadOffsetCount = (sbyte)pageResponse[5]; decoded.DataStrobeOffsetCount = (sbyte)pageResponse[6]; - if(pageResponse.Length < 12) - return decoded; + if(pageResponse.Length < 12) return decoded; decoded.WriteRetryCount = pageResponse[8]; decoded.RecoveryTimeLimit = (ushort)((pageResponse[10] << 8) + pageResponse[11]); @@ -3361,49 +3409,39 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_01(ModePage_01? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_01 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Read-write error recovery page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if(page.AWRE) - sb.AppendLine("\tAutomatic write reallocation is enabled"); - if(page.ARRE) - sb.AppendLine("\tAutomatic read reallocation is enabled"); + if(page.AWRE) sb.AppendLine("\tAutomatic write reallocation is enabled"); + if(page.ARRE) sb.AppendLine("\tAutomatic read reallocation is enabled"); if(page.TB) sb.AppendLine("\tData not recovered within limits shall be transferred back before a CHECK CONDITION"); if(page.RC) sb.AppendLine("\tDrive will transfer the entire requested length without delaying to perform error recovery"); - if(page.EER) - sb.AppendLine("\tDrive will use the most expedient form of error recovery first"); - if(page.PER) - sb.AppendLine("\tDrive shall report recovered errors"); - if(page.DTE) - sb.AppendLine("\tTransfer will be terminated upon error detection"); - if(page.DCR) - sb.AppendLine("\tError correction is disabled"); + if(page.EER) sb.AppendLine("\tDrive will use the most expedient form of error recovery first"); + if(page.PER) sb.AppendLine("\tDrive shall report recovered errors"); + if(page.DTE) sb.AppendLine("\tTransfer will be terminated upon error detection"); + if(page.DCR) sb.AppendLine("\tError correction is disabled"); if(page.ReadRetryCount > 0) sb.AppendFormat("\tDrive will repeat read operations {0} times", page.ReadRetryCount).AppendLine(); if(page.WriteRetryCount > 0) sb.AppendFormat("\tDrive will repeat write operations {0} times", page.WriteRetryCount).AppendLine(); if(page.RecoveryTimeLimit > 0) - sb.AppendFormat("\tDrive will employ a maximum of {0} ms to recover data", page.RecoveryTimeLimit).AppendLine(); - if(page.LBPERE) - sb.AppendLine("Logical block provisioning error reporting is enabled"); + sb.AppendFormat("\tDrive will employ a maximum of {0} ms to recover data", page.RecoveryTimeLimit) + .AppendLine(); + if(page.LBPERE) sb.AppendLine("Logical block provisioning error reporting is enabled"); return sb.ToString(); } - #endregion Mode Page 0x01: Read-write error recovery page #region Mode Page 0x04: Rigid disk drive geometry page - /// /// Disconnect-reconnect page /// Page code 0x04 @@ -3455,20 +3493,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_04? DecodeModePage_04(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x04) - return null; + if((pageResponse[0] & 0x3F) != 0x04) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 20) - return null; + if(pageResponse.Length < 20) return null; ModePage_04 decoded = new ModePage_04(); @@ -3495,23 +3528,23 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_04(ModePage_04? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_04 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Rigid disk drive geometry page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); sb.AppendFormat("\t{0} heads", page.Heads).AppendLine(); sb.AppendFormat("\t{0} cylinders", page.Cylinders).AppendLine(); if(page.WritePrecompCylinder < page.Cylinders) - sb.AppendFormat("\tWrite pre-compensation starts at cylinder {0}", page.WritePrecompCylinder).AppendLine(); + sb.AppendFormat("\tWrite pre-compensation starts at cylinder {0}", page.WritePrecompCylinder) + .AppendLine(); if(page.WriteReduceCylinder < page.Cylinders) - sb.AppendFormat("\tWrite current reduction starts at cylinder {0}", page.WriteReduceCylinder).AppendLine(); + sb.AppendFormat("\tWrite current reduction starts at cylinder {0}", page.WriteReduceCylinder) + .AppendLine(); if(page.DriveStepRate > 0) sb.AppendFormat("\tDrive steps in {0} ns", (uint)page.DriveStepRate * 100).AppendLine(); @@ -3538,11 +3571,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion Mode Page 0x04: Rigid disk drive geometry page #region Mode Page 0x07: Verify error recovery page - /// /// Disconnect-reconnect page /// Page code 0x07 @@ -3586,20 +3617,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_07? DecodeModePage_07(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x07) - return null; + if((pageResponse[0] & 0x3F) != 0x07) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 12) - return null; + if(pageResponse.Length < 12) return null; ModePage_07 decoded = new ModePage_07(); @@ -3623,37 +3649,30 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_07(ModePage_07? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_07 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Verify error recovery page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if(page.EER) - sb.AppendLine("\tDrive will use the most expedient form of error recovery first"); - if(page.PER) - sb.AppendLine("\tDrive shall report recovered errors"); - if(page.DTE) - sb.AppendLine("\tTransfer will be terminated upon error detection"); - if(page.DCR) - sb.AppendLine("\tError correction is disabled"); + if(page.EER) sb.AppendLine("\tDrive will use the most expedient form of error recovery first"); + if(page.PER) sb.AppendLine("\tDrive shall report recovered errors"); + if(page.DTE) sb.AppendLine("\tTransfer will be terminated upon error detection"); + if(page.DCR) sb.AppendLine("\tError correction is disabled"); if(page.VerifyRetryCount > 0) sb.AppendFormat("\tDrive will repeat verify operations {0} times", page.VerifyRetryCount).AppendLine(); if(page.RecoveryTimeLimit > 0) - sb.AppendFormat("\tDrive will employ a maximum of {0} ms to recover data", page.RecoveryTimeLimit).AppendLine(); + sb.AppendFormat("\tDrive will employ a maximum of {0} ms to recover data", page.RecoveryTimeLimit) + .AppendLine(); return sb.ToString(); } - #endregion Mode Page 0x07: Verify error recovery page #region Mode Page 0x10: Device configuration page - /// /// Device configuration page /// Page code 0x10 @@ -3779,20 +3798,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_10_SSC? DecodeModePage_10_SSC(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x10) - return null; + if((pageResponse[0] & 0x3F) != 0x10) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 16) - return null; + if(pageResponse.Length < 16) return null; ModePage_10_SSC decoded = new ModePage_10_SSC(); @@ -3813,7 +3827,8 @@ namespace DiscImageChef.Decoders.SCSI decoded.EEG |= (pageResponse[10] & 0x10) == 0x10; decoded.SEW |= (pageResponse[10] & 0x08) == 0x08; decoded.SOCF = (byte)((pageResponse[8] & 0x0C) >> 2); - decoded.BufferSizeEarlyWarning = (uint)((pageResponse[11] << 16) + (pageResponse[12] << 8) + pageResponse[13]); + decoded.BufferSizeEarlyWarning = + (uint)((pageResponse[11] << 16) + (pageResponse[12] << 8) + pageResponse[13]); decoded.SelectedCompression = pageResponse[14]; decoded.SWP |= (pageResponse[10] & 0x04) == 0x04; @@ -3839,34 +3854,32 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_10_SSC(ModePage_10_SSC? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_10_SSC page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Device configuration page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); sb.AppendFormat("\tActive format: {0}", page.ActiveFormat).AppendLine(); sb.AppendFormat("\tActive partition: {0}", page.ActivePartition).AppendLine(); - sb.AppendFormat("\tWrite buffer shall have a full ratio of {0} before being flushed to medium", page.WriteBufferFullRatio).AppendLine(); - sb.AppendFormat("\tRead buffer shall have an empty ratio of {0} before more data is read from medium", page.ReadBufferEmptyRatio).AppendLine(); - sb.AppendFormat("\tDrive will delay {0} ms before buffered data is forcefully written to the medium even before buffer is full", page.WriteDelayTime * 100).AppendLine(); + sb.AppendFormat("\tWrite buffer shall have a full ratio of {0} before being flushed to medium", + page.WriteBufferFullRatio).AppendLine(); + sb.AppendFormat("\tRead buffer shall have an empty ratio of {0} before more data is read from medium", + page.ReadBufferEmptyRatio).AppendLine(); + sb + .AppendFormat("\tDrive will delay {0} ms before buffered data is forcefully written to the medium even before buffer is full", + page.WriteDelayTime * 100).AppendLine(); if(page.DBR) { sb.AppendLine("\tDrive supports recovering data from buffer"); - if(page.RBO) - sb.AppendLine("\tRecovered buffer data comes in LIFO order"); - else - sb.AppendLine("\tRecovered buffer data comes in FIFO order"); + if(page.RBO) sb.AppendLine("\tRecovered buffer data comes in LIFO order"); + else sb.AppendLine("\tRecovered buffer data comes in FIFO order"); } - if(page.BIS) - sb.AppendLine("\tMedium supports block IDs"); - if(page.RSmk) - sb.AppendLine("\tDrive reports setmarks"); + if(page.BIS) sb.AppendLine("\tMedium supports block IDs"); + if(page.RSmk) sb.AppendLine("\tDrive reports setmarks"); switch(page.SOCF) { case 0: @@ -3886,14 +3899,12 @@ namespace DiscImageChef.Decoders.SCSI if(page.REW) { sb.AppendLine("\tDrive reports early warnings"); - if(page.SEW) - sb.AppendLine("\tDrive will synchronize buffer to medium on early warnings"); + if(page.SEW) sb.AppendLine("\tDrive will synchronize buffer to medium on early warnings"); } switch(page.GapSize) { - case 0: - break; + case 0: break; case 1: sb.AppendLine("\tInter-block gap is long enough to support update in place"); break; @@ -3911,15 +3922,15 @@ namespace DiscImageChef.Decoders.SCSI case 13: case 14: case 15: - sb.AppendFormat("\tInter-block gap is {0} times the device's defined gap size", page.GapSize).AppendLine(); + sb.AppendFormat("\tInter-block gap is {0} times the device's defined gap size", page.GapSize) + .AppendLine(); break; default: sb.AppendFormat("\tInter-block gap is unknown value {0}", page.GapSize).AppendLine(); break; } - if(page.EEG) - sb.AppendLine("\tDrive generates end-of-data"); + if(page.EEG) sb.AppendLine("\tDrive generates end-of-data"); switch(page.SelectedCompression) { @@ -3934,21 +3945,15 @@ namespace DiscImageChef.Decoders.SCSI break; } - if(page.SWP) - sb.AppendLine("\tSoftware write protect is enabled"); - if(page.ASOCWP) - sb.AppendLine("\tAssociated write protect is enabled"); - if(page.PERSWP) - sb.AppendLine("\tPersistent write protect is enabled"); - if(page.PRMWP) - sb.AppendLine("\tPermanent write protect is enabled"); + if(page.SWP) sb.AppendLine("\tSoftware write protect is enabled"); + if(page.ASOCWP) sb.AppendLine("\tAssociated write protect is enabled"); + if(page.PERSWP) sb.AppendLine("\tPersistent write protect is enabled"); + if(page.PRMWP) sb.AppendLine("\tPermanent write protect is enabled"); if(page.BAML) { - if(page.BAM) - sb.AppendLine("\tDrive operates using explicit address mode"); - else - sb.AppendLine("\tDrive operates using implicit address mode"); + if(page.BAM) sb.AppendLine("\tDrive operates using explicit address mode"); + else sb.AppendLine("\tDrive operates using implicit address mode"); } switch(page.RewindOnReset) @@ -3971,16 +3976,13 @@ namespace DiscImageChef.Decoders.SCSI break; } - if(page.OIR) - sb.AppendLine("\tDrive will only respond to commands if it has received a reservation"); + if(page.OIR) sb.AppendLine("\tDrive will only respond to commands if it has received a reservation"); return sb.ToString(); } - #endregion Mode Page 0x10: Device configuration page #region Mode Page 0x0E: CD-ROM audio control parameters page - /// /// CD-ROM audio control parameters /// Page code 0x0E @@ -4048,20 +4050,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_0E? DecodeModePage_0E(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x0E) - return null; + if((pageResponse[0] & 0x3F) != 0x0E) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 16) - return null; + if(pageResponse.Length < 16) return null; ModePage_0E decoded = new ModePage_0E(); @@ -4090,30 +4087,23 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_0E(ModePage_0E? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_0E page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI CD-ROM audio control parameters page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); - if(page.Immed) - sb.AppendLine("\tDrive will return from playback command immediately"); - else - sb.AppendLine("\tDrive will return from playback command when playback ends"); - if(page.SOTC) - sb.AppendLine("\tDrive will stop playback on track end"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); + if(page.Immed) sb.AppendLine("\tDrive will return from playback command immediately"); + else sb.AppendLine("\tDrive will return from playback command when playback ends"); + if(page.SOTC) sb.AppendLine("\tDrive will stop playback on track end"); if(page.APRVal) { double blocks; - if(page.LBAFormat == 8) - blocks = page.BlocksPerSecondOfAudio * (1 / 256); - else - blocks = page.BlocksPerSecondOfAudio; + if(page.LBAFormat == 8) blocks = page.BlocksPerSecondOfAudio * (1 / 256); + else blocks = page.BlocksPerSecondOfAudio; sb.AppendFormat("\tThere are {0} blocks per each second of audio", blocks).AppendLine(); } @@ -4121,14 +4111,10 @@ namespace DiscImageChef.Decoders.SCSI if(page.OutputPort0ChannelSelection > 0) { sb.Append("\tOutput port 0 has channels "); - if((page.OutputPort0ChannelSelection & 0x01) == 0x01) - sb.Append("0 "); - if((page.OutputPort0ChannelSelection & 0x02) == 0x02) - sb.Append("1 "); - if((page.OutputPort0ChannelSelection & 0x04) == 0x04) - sb.Append("2 "); - if((page.OutputPort0ChannelSelection & 0x08) == 0x08) - sb.Append("3 "); + if((page.OutputPort0ChannelSelection & 0x01) == 0x01) sb.Append("0 "); + if((page.OutputPort0ChannelSelection & 0x02) == 0x02) sb.Append("1 "); + if((page.OutputPort0ChannelSelection & 0x04) == 0x04) sb.Append("2 "); + if((page.OutputPort0ChannelSelection & 0x08) == 0x08) sb.Append("3 "); switch(page.OutputPort0Volume) { @@ -4147,14 +4133,10 @@ namespace DiscImageChef.Decoders.SCSI if(page.OutputPort1ChannelSelection > 0) { sb.Append("\tOutput port 1 has channels "); - if((page.OutputPort1ChannelSelection & 0x01) == 0x01) - sb.Append("0 "); - if((page.OutputPort1ChannelSelection & 0x02) == 0x02) - sb.Append("1 "); - if((page.OutputPort1ChannelSelection & 0x04) == 0x04) - sb.Append("2 "); - if((page.OutputPort1ChannelSelection & 0x08) == 0x08) - sb.Append("3 "); + if((page.OutputPort1ChannelSelection & 0x01) == 0x01) sb.Append("0 "); + if((page.OutputPort1ChannelSelection & 0x02) == 0x02) sb.Append("1 "); + if((page.OutputPort1ChannelSelection & 0x04) == 0x04) sb.Append("2 "); + if((page.OutputPort1ChannelSelection & 0x08) == 0x08) sb.Append("3 "); switch(page.OutputPort1Volume) { @@ -4173,14 +4155,10 @@ namespace DiscImageChef.Decoders.SCSI if(page.OutputPort2ChannelSelection > 0) { sb.Append("\tOutput port 2 has channels "); - if((page.OutputPort2ChannelSelection & 0x01) == 0x01) - sb.Append("0 "); - if((page.OutputPort2ChannelSelection & 0x02) == 0x02) - sb.Append("1 "); - if((page.OutputPort2ChannelSelection & 0x04) == 0x04) - sb.Append("2 "); - if((page.OutputPort2ChannelSelection & 0x08) == 0x08) - sb.Append("3 "); + if((page.OutputPort2ChannelSelection & 0x01) == 0x01) sb.Append("0 "); + if((page.OutputPort2ChannelSelection & 0x02) == 0x02) sb.Append("1 "); + if((page.OutputPort2ChannelSelection & 0x04) == 0x04) sb.Append("2 "); + if((page.OutputPort2ChannelSelection & 0x08) == 0x08) sb.Append("3 "); switch(page.OutputPort2Volume) { @@ -4199,14 +4177,10 @@ namespace DiscImageChef.Decoders.SCSI if(page.OutputPort3ChannelSelection > 0) { sb.Append("\tOutput port 3 has channels "); - if((page.OutputPort3ChannelSelection & 0x01) == 0x01) - sb.Append("0 "); - if((page.OutputPort3ChannelSelection & 0x02) == 0x02) - sb.Append("1 "); - if((page.OutputPort3ChannelSelection & 0x04) == 0x04) - sb.Append("2 "); - if((page.OutputPort3ChannelSelection & 0x08) == 0x08) - sb.Append("3 "); + if((page.OutputPort3ChannelSelection & 0x01) == 0x01) sb.Append("0 "); + if((page.OutputPort3ChannelSelection & 0x02) == 0x02) sb.Append("1 "); + if((page.OutputPort3ChannelSelection & 0x04) == 0x04) sb.Append("2 "); + if((page.OutputPort3ChannelSelection & 0x08) == 0x08) sb.Append("3 "); switch(page.OutputPort3Volume) { @@ -4224,11 +4198,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion Mode Page 0x0E: CD-ROM audio control parameters page #region Mode Page 0x0D: CD-ROM parameteres page - /// /// CD-ROM parameteres page /// Page code 0x0D @@ -4256,20 +4228,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_0D? DecodeModePage_0D(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x0D) - return null; + if((pageResponse[0] & 0x3F) != 0x0D) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 8) - return null; + if(pageResponse.Length < 8) return null; ModePage_0D decoded = new ModePage_0D(); @@ -4288,16 +4255,14 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_0D(ModePage_0D? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_0D page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI CD-ROM parameters page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); switch(page.InactivityTimerMultiplier) { case 0: @@ -4357,11 +4322,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion Mode Page 0x0D: CD-ROM parameteres page #region Mode Page 0x01: Read error recovery page for MultiMedia Devices - /// /// Read error recovery page for MultiMedia Devices /// Page code 0x01 @@ -4394,20 +4357,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_01_MMC? DecodeModePage_01_MMC(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x01) - return null; + if((pageResponse[0] & 0x3F) != 0x01) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 8) - return null; + if(pageResponse.Length < 8) return null; ModePage_01_MMC decoded = new ModePage_01_MMC(); @@ -4415,8 +4373,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.Parameter = pageResponse[2]; decoded.ReadRetryCount = pageResponse[3]; - if(pageResponse.Length < 12) - return decoded; + if(pageResponse.Length < 12) return decoded; decoded.WriteRetryCount = pageResponse[8]; decoded.RecoveryTimeLimit = (ushort)((pageResponse[10] << 8) + pageResponse[11]); @@ -4431,16 +4388,14 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_01_MMC(ModePage_01_MMC? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_01_MMC page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Read error recovery page for MultiMedia Devices:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); if(page.ReadRetryCount > 0) sb.AppendFormat("\tDrive will repeat read operations {0} times", page.ReadRetryCount).AppendLine(); @@ -4455,7 +4410,8 @@ namespace DiscImageChef.Decoders.SCSI string UnrecECCNotAbort = "\tUnrecovered ECC errors will not abort the transfer."; string UnrecCIRCNotAbort = "\tUnrecovered CIRC errors will not abort the transfer."; string UnrecECCAbortData = "\tUnrecovered ECC errors will return CHECK CONDITION and the uncorrected data."; - string UnrecCIRCAbortData = "\tUnrecovered CIRC errors will return CHECK CONDITION and the uncorrected data."; + string UnrecCIRCAbortData = + "\tUnrecovered CIRC errors will return CHECK CONDITION and the uncorrected data."; switch(page.Parameter) { @@ -4507,14 +4463,10 @@ namespace DiscImageChef.Decoders.SCSI case 0x27: sb.AppendLine(RetriesUsed + RecoveredAbort + UnrecCIRCAbortData); break; - case 0x30: - goto case 0x10; - case 0x31: - goto case 0x11; - case 0x34: - goto case 0x14; - case 0x35: - goto case 0x15; + case 0x30: goto case 0x10; + case 0x31: goto case 0x11; + case 0x34: goto case 0x14; + case 0x35: goto case 0x15; default: sb.AppendFormat("Unknown recovery parameter 0x{0:X2}", page.Parameter).AppendLine(); break; @@ -4523,15 +4475,14 @@ namespace DiscImageChef.Decoders.SCSI if(page.WriteRetryCount > 0) sb.AppendFormat("\tDrive will repeat write operations {0} times", page.WriteRetryCount).AppendLine(); if(page.RecoveryTimeLimit > 0) - sb.AppendFormat("\tDrive will employ a maximum of {0} ms to recover data", page.RecoveryTimeLimit).AppendLine(); + sb.AppendFormat("\tDrive will employ a maximum of {0} ms to recover data", page.RecoveryTimeLimit) + .AppendLine(); return sb.ToString(); } - #endregion Mode Page 0x01: Read error recovery page for MultiMedia Devices #region Mode Page 0x07: Verify error recovery page for MultiMedia Devices - /// /// Verify error recovery page for MultiMedia Devices /// Page code 0x07 @@ -4555,20 +4506,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_07_MMC? DecodeModePage_07_MMC(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x07) - return null; + if((pageResponse[0] & 0x3F) != 0x07) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 8) - return null; + if(pageResponse.Length < 8) return null; ModePage_07_MMC decoded = new ModePage_07_MMC(); @@ -4586,16 +4532,14 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_07_MMC(ModePage_07_MMC? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_07_MMC page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Verify error recovery page for MultiMedia Devices:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); if(page.VerifyRetryCount > 0) sb.AppendFormat("\tDrive will repeat verify operations {0} times", page.VerifyRetryCount).AppendLine(); @@ -4610,7 +4554,8 @@ namespace DiscImageChef.Decoders.SCSI string UnrecECCNotAbort = "\tUnrecovered ECC errors will not abort the transfer."; string UnrecCIRCNotAbort = "\tUnrecovered CIRC errors will not abort the transfer."; string UnrecECCAbortData = "\tUnrecovered ECC errors will return CHECK CONDITION and the uncorrected data."; - string UnrecCIRCAbortData = "\tUnrecovered CIRC errors will return CHECK CONDITION and the uncorrected data."; + string UnrecCIRCAbortData = + "\tUnrecovered CIRC errors will return CHECK CONDITION and the uncorrected data."; switch(page.Parameter) { @@ -4662,14 +4607,10 @@ namespace DiscImageChef.Decoders.SCSI case 0x27: sb.AppendLine(RetriesUsed + RecoveredAbort + UnrecCIRCAbortData); break; - case 0x30: - goto case 0x10; - case 0x31: - goto case 0x11; - case 0x34: - goto case 0x14; - case 0x35: - goto case 0x15; + case 0x30: goto case 0x10; + case 0x31: goto case 0x11; + case 0x34: goto case 0x14; + case 0x35: goto case 0x15; default: sb.AppendFormat("Unknown recovery parameter 0x{0:X2}", page.Parameter).AppendLine(); break; @@ -4677,11 +4618,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion Mode Page 0x07: Verify error recovery page for MultiMedia Devices #region Mode Page 0x06: Optical memory page - /// /// Optical memory page /// Page code 0x06 @@ -4701,20 +4640,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_06? DecodeModePage_06(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x06) - return null; + if((pageResponse[0] & 0x3F) != 0x06) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 4) - return null; + if(pageResponse.Length < 4) return null; ModePage_06 decoded = new ModePage_06(); @@ -4731,26 +4665,21 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_06(ModePage_06? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_06 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI optical memory:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); - if(page.RUBR) - sb.AppendLine("\tOn reading an updated block drive will return RECOVERED ERROR"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); + if(page.RUBR) sb.AppendLine("\tOn reading an updated block drive will return RECOVERED ERROR"); return sb.ToString(); } - #endregion Mode Page 0x06: Optical memory page #region Mode Page 0x2A: CD-ROM capabilities page - /// /// CD-ROM capabilities page /// Page code 0x2A @@ -4899,20 +4828,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_2A? DecodeModePage_2A(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x2A) - return null; + if((pageResponse[0] & 0x3F) != 0x2A) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 16) - return null; + if(pageResponse.Length < 16) return null; ModePage_2A decoded = new ModePage_2A(); @@ -4945,8 +4869,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.BufferSize = (ushort)((pageResponse[12] << 8) + pageResponse[13]); decoded.CurrentSpeed = (ushort)((pageResponse[14] << 8) + pageResponse[15]); - if(pageResponse.Length < 20) - return decoded; + if(pageResponse.Length < 20) return decoded; decoded.Method2 |= (pageResponse[2] & 0x04) == 0x04; decoded.ReadCDRW |= (pageResponse[2] & 0x02) == 0x02; @@ -4967,8 +4890,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.RCK |= (pageResponse[17] & 0x04) == 0x04; decoded.BCK |= (pageResponse[17] & 0x02) == 0x02; - if(pageResponse.Length < 22) - return decoded; + if(pageResponse.Length < 22) return decoded; decoded.TestWrite |= (pageResponse[3] & 0x04) == 0x04; decoded.MaxWriteSpeed = (ushort)((pageResponse[18] << 8) + pageResponse[19]); @@ -4976,8 +4898,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.ReadBarcode |= (pageResponse[5] & 0x80) == 0x80; - if(pageResponse.Length < 26) - return decoded; + if(pageResponse.Length < 26) return decoded; decoded.ReadDVDRAM |= (pageResponse[2] & 0x20) == 0x20; decoded.ReadDVDR |= (pageResponse[2] & 0x10) == 0x10; @@ -4991,8 +4912,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.CMRSupported = (ushort)((pageResponse[22] << 8) + pageResponse[23]); - if(pageResponse.Length < 32) - return decoded; + if(pageResponse.Length < 32) return decoded; decoded.BUF |= (pageResponse[4] & 0x80) == 0x80; decoded.RotationControlSelected = (byte)(pageResponse[27] & 0x03); @@ -5004,8 +4924,10 @@ namespace DiscImageChef.Decoders.SCSI for(int i = 0; i < descriptors; i++) { decoded.WriteSpeedPerformanceDescriptors[i] = new ModePage_2A_WriteDescriptor(); - decoded.WriteSpeedPerformanceDescriptors[i].RotationControl = (byte)(pageResponse[1 + 32 + i * 4] & 0x07); - decoded.WriteSpeedPerformanceDescriptors[i].WriteSpeed = (ushort)((pageResponse[2 + 32 + i * 4] << 8) + pageResponse[3 + 32 + i * 4]); + decoded.WriteSpeedPerformanceDescriptors[i].RotationControl = + (byte)(pageResponse[1 + 32 + i * 4] & 0x07); + decoded.WriteSpeedPerformanceDescriptors[i].WriteSpeed = + (ushort)((pageResponse[2 + 32 + i * 4] << 8) + pageResponse[3 + 32 + i * 4]); } return decoded; @@ -5018,40 +4940,27 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_2A(ModePage_2A? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_2A page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI CD-ROM capabilities page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if(page.AudioPlay) - sb.AppendLine("\tDrive can play audio"); - if(page.Mode2Form1) - sb.AppendLine("\tDrive can read sectors in Mode 2 Form 1 format"); - if(page.Mode2Form2) - sb.AppendLine("\tDrive can read sectors in Mode 2 Form 2 format"); - if(page.MultiSession) - sb.AppendLine("\tDrive supports multi-session discs and/or Photo-CD"); + if(page.AudioPlay) sb.AppendLine("\tDrive can play audio"); + if(page.Mode2Form1) sb.AppendLine("\tDrive can read sectors in Mode 2 Form 1 format"); + if(page.Mode2Form2) sb.AppendLine("\tDrive can read sectors in Mode 2 Form 2 format"); + if(page.MultiSession) sb.AppendLine("\tDrive supports multi-session discs and/or Photo-CD"); - if(page.CDDACommand) - sb.AppendLine("\tDrive can read digital audio"); - if(page.AccurateCDDA) - sb.AppendLine("\tDrive can continue from streaming loss"); - if(page.Subchannel) - sb.AppendLine("\tDrive can read uncorrected and interleaved R-W subchannels"); - if(page.DeinterlaveSubchannel) - sb.AppendLine("\tDrive can read, deinterleave and correct R-W subchannels"); - if(page.C2Pointer) - sb.AppendLine("\tDrive supports C2 pointers"); - if(page.UPC) - sb.AppendLine("\tDrive can read Media Catalogue Number"); - if(page.ISRC) - sb.AppendLine("\tDrive can read ISRC"); + if(page.CDDACommand) sb.AppendLine("\tDrive can read digital audio"); + if(page.AccurateCDDA) sb.AppendLine("\tDrive can continue from streaming loss"); + if(page.Subchannel) sb.AppendLine("\tDrive can read uncorrected and interleaved R-W subchannels"); + if(page.DeinterlaveSubchannel) sb.AppendLine("\tDrive can read, deinterleave and correct R-W subchannels"); + if(page.C2Pointer) sb.AppendLine("\tDrive supports C2 pointers"); + if(page.UPC) sb.AppendLine("\tDrive can read Media Catalogue Number"); + if(page.ISRC) sb.AppendLine("\tDrive can read ISRC"); switch(page.LoadingMechanism) { @@ -5071,39 +4980,32 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("\tDrive is a changer using cartridges"); break; default: - sb.AppendFormat("\tDrive uses unknown loading mechanism type {0}", page.LoadingMechanism).AppendLine(); + sb.AppendFormat("\tDrive uses unknown loading mechanism type {0}", page.LoadingMechanism) + .AppendLine(); break; } - if(page.Lock) - sb.AppendLine("\tDrive can lock media"); + if(page.Lock) sb.AppendLine("\tDrive can lock media"); if(page.PreventJumper) { sb.AppendLine("\tDrive power ups locked"); - if(page.LockState) - sb.AppendLine("\tDrive is locked, media cannot be ejected or inserted"); - else - sb.AppendLine("\tDrive is not locked, media can be ejected and inserted"); + if(page.LockState) sb.AppendLine("\tDrive is locked, media cannot be ejected or inserted"); + else sb.AppendLine("\tDrive is not locked, media can be ejected and inserted"); } else { if(page.LockState) sb.AppendLine("\tDrive is locked, media cannot be ejected, but if empty, can be inserted"); - else - sb.AppendLine("\tDrive is not locked, media can be ejected and inserted"); + else sb.AppendLine("\tDrive is not locked, media can be ejected and inserted"); } - if(page.Eject) - sb.AppendLine("\tDrive can eject media"); + if(page.Eject) sb.AppendLine("\tDrive can eject media"); - if(page.SeparateChannelMute) - sb.AppendLine("\tEach channel can be muted independently"); - if(page.SeparateChannelVolume) - sb.AppendLine("\tEach channel's volume can be controlled independently"); + if(page.SeparateChannelMute) sb.AppendLine("\tEach channel can be muted independently"); + if(page.SeparateChannelVolume) sb.AppendLine("\tEach channel's volume can be controlled independently"); if(page.SupportedVolumeLevels > 0) sb.AppendFormat("\tDrive supports {0} volume levels", page.SupportedVolumeLevels).AppendLine(); - if(page.BufferSize > 0) - sb.AppendFormat("\tDrive has {0} Kbyte of buffer", page.BufferSize).AppendLine(); + if(page.BufferSize > 0) sb.AppendFormat("\tDrive has {0} Kbyte of buffer", page.BufferSize).AppendLine(); if(page.MaximumSpeed > 0) sb.AppendFormat("\tDrive's maximum reading speed is {0} Kbyte/sec.", page.MaximumSpeed).AppendLine(); if(page.CurrentSpeed > 0) @@ -5111,62 +5013,52 @@ namespace DiscImageChef.Decoders.SCSI if(page.ReadCDR) { - if(page.WriteCDR) - sb.AppendLine("\tDrive can read and write CD-R"); - else - sb.AppendLine("\tDrive can read CD-R"); + if(page.WriteCDR) sb.AppendLine("\tDrive can read and write CD-R"); + else sb.AppendLine("\tDrive can read CD-R"); - if(page.Method2) - sb.AppendLine("\tDrive supports reading CD-R packet media"); + if(page.Method2) sb.AppendLine("\tDrive supports reading CD-R packet media"); } if(page.ReadCDRW) { - if(page.WriteCDRW) - sb.AppendLine("\tDrive can read and write CD-RW"); - else - sb.AppendLine("\tDrive can read CD-RW"); + if(page.WriteCDRW) sb.AppendLine("\tDrive can read and write CD-RW"); + else sb.AppendLine("\tDrive can read CD-RW"); } - if(page.ReadDVDROM) - sb.AppendLine("\tDrive can read DVD-ROM"); + if(page.ReadDVDROM) sb.AppendLine("\tDrive can read DVD-ROM"); if(page.ReadDVDR) { - if(page.WriteDVDR) - sb.AppendLine("\tDrive can read and write DVD-R"); - else - sb.AppendLine("\tDrive can read DVD-R"); + if(page.WriteDVDR) sb.AppendLine("\tDrive can read and write DVD-R"); + else sb.AppendLine("\tDrive can read DVD-R"); } if(page.ReadDVDRAM) { - if(page.WriteDVDRAM) - sb.AppendLine("\tDrive can read and write DVD-RAM"); - else - sb.AppendLine("\tDrive can read DVD-RAM"); + if(page.WriteDVDRAM) sb.AppendLine("\tDrive can read and write DVD-RAM"); + else sb.AppendLine("\tDrive can read DVD-RAM"); } - if(page.Composite) - sb.AppendLine("\tDrive can deliver a composite audio and video data stream"); - if(page.DigitalPort1) - sb.AppendLine("\tDrive supports IEC-958 digital output on port 1"); - if(page.DigitalPort2) - sb.AppendLine("\tDrive supports IEC-958 digital output on port 2"); + if(page.Composite) sb.AppendLine("\tDrive can deliver a composite audio and video data stream"); + if(page.DigitalPort1) sb.AppendLine("\tDrive supports IEC-958 digital output on port 1"); + if(page.DigitalPort2) sb.AppendLine("\tDrive supports IEC-958 digital output on port 2"); - if(page.SDP) - sb.AppendLine("\tDrive contains a changer that can report the exact contents of the slots"); + if(page.SDP) sb.AppendLine("\tDrive contains a changer that can report the exact contents of the slots"); if(page.CurrentWriteSpeedSelected > 0) { if(page.RotationControlSelected == 0) - sb.AppendFormat("\tDrive's current writing speed is {0} Kbyte/sec. in CLV mode", page.CurrentWriteSpeedSelected).AppendLine(); + sb.AppendFormat("\tDrive's current writing speed is {0} Kbyte/sec. in CLV mode", + page.CurrentWriteSpeedSelected).AppendLine(); else if(page.RotationControlSelected == 1) - sb.AppendFormat("\tDrive's current writing speed is {0} Kbyte/sec. in pure CAV mode", page.CurrentWriteSpeedSelected).AppendLine(); + sb.AppendFormat("\tDrive's current writing speed is {0} Kbyte/sec. in pure CAV mode", + page.CurrentWriteSpeedSelected).AppendLine(); } else { if(page.MaxWriteSpeed > 0) - sb.AppendFormat("\tDrive's maximum writing speed is {0} Kbyte/sec.", page.MaxWriteSpeed).AppendLine(); + sb.AppendFormat("\tDrive's maximum writing speed is {0} Kbyte/sec.", page.MaxWriteSpeed) + .AppendLine(); if(page.CurrentWriteSpeed > 0) - sb.AppendFormat("\tDrive's current writing speed is {0} Kbyte/sec.", page.CurrentWriteSpeed).AppendLine(); + sb.AppendFormat("\tDrive's current writing speed is {0} Kbyte/sec.", page.CurrentWriteSpeed) + .AppendLine(); } if(page.WriteSpeedPerformanceDescriptors != null) @@ -5176,37 +5068,31 @@ namespace DiscImageChef.Decoders.SCSI if(descriptor.WriteSpeed > 0) { if(descriptor.RotationControl == 0) - sb.AppendFormat("\tDrive supports writing at {0} Kbyte/sec. in CLV mode", descriptor.WriteSpeed).AppendLine(); + sb.AppendFormat("\tDrive supports writing at {0} Kbyte/sec. in CLV mode", + descriptor.WriteSpeed).AppendLine(); else if(descriptor.RotationControl == 1) - sb.AppendFormat("\tDrive supports writing at is {0} Kbyte/sec. in pure CAV mode", descriptor.WriteSpeed).AppendLine(); + sb.AppendFormat("\tDrive supports writing at is {0} Kbyte/sec. in pure CAV mode", + descriptor.WriteSpeed).AppendLine(); } } } - if(page.TestWrite) - sb.AppendLine("\tDrive supports test writing"); + if(page.TestWrite) sb.AppendLine("\tDrive supports test writing"); - if(page.ReadBarcode) - sb.AppendLine("\tDrive can read barcode"); + if(page.ReadBarcode) sb.AppendLine("\tDrive can read barcode"); - if(page.SCC) - sb.AppendLine("\tDrive can read both sides of a disc"); - if(page.LeadInPW) - sb.AppendLine("\tDrive an read raw R-W subchannel from the Lead-In"); + if(page.SCC) sb.AppendLine("\tDrive can read both sides of a disc"); + if(page.LeadInPW) sb.AppendLine("\tDrive an read raw R-W subchannel from the Lead-In"); - if(page.CMRSupported == 1) - sb.AppendLine("\tDrive supports DVD CSS and/or DVD CPPM"); + if(page.CMRSupported == 1) sb.AppendLine("\tDrive supports DVD CSS and/or DVD CPPM"); - if(page.BUF) - sb.AppendLine("\tDrive supports buffer under-run free recording"); + if(page.BUF) sb.AppendLine("\tDrive supports buffer under-run free recording"); return sb.ToString(); } - #endregion Mode Page 0x2A: CD-ROM capabilities page #region Mode Page 0x1C: Informational exceptions control page - /// /// Informational exceptions control page /// Page code 0x1C @@ -5264,20 +5150,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_1C? DecodeModePage_1C(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x1C) - return null; + if((pageResponse[0] & 0x3F) != 0x1C) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 8) - return null; + if(pageResponse.Length < 8) return null; ModePage_1C decoded = new ModePage_1C(); @@ -5290,7 +5171,8 @@ namespace DiscImageChef.Decoders.SCSI decoded.MRIE = (byte)(pageResponse[3] & 0x0F); - decoded.IntervalTimer = (uint)((pageResponse[4] << 24) + (pageResponse[5] << 16) + (pageResponse[6] << 8) + pageResponse[7]); + decoded.IntervalTimer = (uint)((pageResponse[4] << 24) + (pageResponse[5] << 16) + (pageResponse[6] << 8) + + pageResponse[7]); decoded.EBF |= (pageResponse[2] & 0x20) == 0x20; decoded.EWasc |= (pageResponse[2] & 0x10) == 0x10; @@ -5298,7 +5180,8 @@ namespace DiscImageChef.Decoders.SCSI decoded.EBACKERR |= (pageResponse[2] & 0x02) == 0x02; if(pageResponse.Length >= 12) - decoded.ReportCount = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + (pageResponse[10] << 8) + pageResponse[11]); + decoded.ReportCount = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + + (pageResponse[10] << 8) + pageResponse[11]); return decoded; } @@ -5310,19 +5193,16 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_1C(ModePage_1C? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_1C page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Informational exceptions control page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if(page.DExcpt) - sb.AppendLine("\tInformational exceptions are disabled"); + if(page.DExcpt) sb.AppendLine("\tInformational exceptions are disabled"); else { sb.AppendLine("\tInformational exceptions are enabled"); @@ -5355,39 +5235,30 @@ namespace DiscImageChef.Decoders.SCSI break; } - if(page.Perf) - sb.AppendLine("\tInformational exceptions reporting should not affect drive performance"); - if(page.Test) - sb.AppendLine("\tA test informational exception will raise on next timer"); - if(page.LogErr) - sb.AppendLine("\tDrive shall log informational exception conditions"); + if(page.Perf) sb.AppendLine("\tInformational exceptions reporting should not affect drive performance"); + if(page.Test) sb.AppendLine("\tA test informational exception will raise on next timer"); + if(page.LogErr) sb.AppendLine("\tDrive shall log informational exception conditions"); if(page.IntervalTimer > 0) { - if(page.IntervalTimer == 0xFFFFFFFF) - sb.AppendLine("\tTimer interval is vendor-specific"); - else - sb.AppendFormat("\tTimer interval is {0} ms", page.IntervalTimer * 100).AppendLine(); + if(page.IntervalTimer == 0xFFFFFFFF) sb.AppendLine("\tTimer interval is vendor-specific"); + else sb.AppendFormat("\tTimer interval is {0} ms", page.IntervalTimer * 100).AppendLine(); } if(page.ReportCount > 0) - sb.AppendFormat("\tInformational exception conditions will be reported a maximum of {0} times", page.ReportCount); + sb.AppendFormat("\tInformational exception conditions will be reported a maximum of {0} times", + page.ReportCount); } - if(page.EWasc) - sb.AppendLine("\tWarning reporting is enabled"); - if(page.EBF) - sb.AppendLine("\tBackground functions are enabled"); - if(page.EBACKERR) - sb.AppendLine("\tDrive will report background self-test errors"); + if(page.EWasc) sb.AppendLine("\tWarning reporting is enabled"); + if(page.EBF) sb.AppendLine("\tBackground functions are enabled"); + if(page.EBACKERR) sb.AppendLine("\tDrive will report background self-test errors"); return sb.ToString(); } - #endregion Mode Page 0x1C: Informational exceptions control page #region Mode Page 0x1A: Power condition page - /// /// Power condition page /// Page code 0x1A @@ -5452,20 +5323,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_1A? DecodeModePage_1A(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x1A) - return null; + if((pageResponse[0] & 0x3F) != 0x1A) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 12) - return null; + if(pageResponse.Length < 12) return null; ModePage_1A decoded = new ModePage_1A(); @@ -5474,20 +5340,24 @@ namespace DiscImageChef.Decoders.SCSI decoded.Standby |= (pageResponse[3] & 0x01) == 0x01; decoded.Idle |= (pageResponse[3] & 0x02) == 0x02; - decoded.IdleTimer = (uint)((pageResponse[4] << 24) + (pageResponse[5] << 16) + (pageResponse[6] << 8) + pageResponse[7]); - decoded.StandbyTimer = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + (pageResponse[10] << 8) + pageResponse[11]); + decoded.IdleTimer = (uint)((pageResponse[4] << 24) + (pageResponse[5] << 16) + (pageResponse[6] << 8) + + pageResponse[7]); + decoded.StandbyTimer = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + (pageResponse[10] << 8) + + pageResponse[11]); - if(pageResponse.Length < 40) - return decoded; + if(pageResponse.Length < 40) return decoded; decoded.PM_BG_Precedence = (byte)((pageResponse[2] & 0xC0) >> 6); decoded.Standby_Y |= (pageResponse[2] & 0x01) == 0x01; decoded.Idle_B |= (pageResponse[3] & 0x04) == 0x04; decoded.Idle_C |= (pageResponse[3] & 0x08) == 0x08; - decoded.IdleTimer_B = (uint)((pageResponse[12] << 24) + (pageResponse[13] << 16) + (pageResponse[14] << 8) + pageResponse[15]); - decoded.IdleTimer_C = (uint)((pageResponse[16] << 24) + (pageResponse[17] << 16) + (pageResponse[18] << 8) + pageResponse[19]); - decoded.StandbyTimer_Y = (uint)((pageResponse[20] << 24) + (pageResponse[21] << 16) + (pageResponse[22] << 8) + pageResponse[23]); + decoded.IdleTimer_B = (uint)((pageResponse[12] << 24) + (pageResponse[13] << 16) + (pageResponse[14] << 8) + + pageResponse[15]); + decoded.IdleTimer_C = (uint)((pageResponse[16] << 24) + (pageResponse[17] << 16) + (pageResponse[18] << 8) + + pageResponse[19]); + decoded.StandbyTimer_Y = (uint)((pageResponse[20] << 24) + (pageResponse[21] << 16) + + (pageResponse[22] << 8) + pageResponse[23]); decoded.CCF_Idle = (byte)((pageResponse[39] & 0xC0) >> 6); decoded.CCF_Standby = (byte)((pageResponse[39] & 0x30) >> 4); @@ -5503,31 +5373,26 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_1A(ModePage_1A? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_1A page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Power condition page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if((page.Standby && page.StandbyTimer > 0) || - (page.Standby_Y && page.StandbyTimer_Y > 0)) + if((page.Standby && page.StandbyTimer > 0) || (page.Standby_Y && page.StandbyTimer_Y > 0)) { if(page.Standby && page.StandbyTimer > 0) sb.AppendFormat("\tStandby timer Z is set to {0} ms", page.StandbyTimer * 100).AppendLine(); if(page.Standby_Y && page.StandbyTimer_Y > 0) sb.AppendFormat("\tStandby timer Y is set to {0} ms", page.StandbyTimer_Y * 100).AppendLine(); } - else - sb.AppendLine("\tDrive will not enter standy mode"); + else sb.AppendLine("\tDrive will not enter standy mode"); - if((page.Idle && page.IdleTimer > 0) || - (page.Idle_B && page.IdleTimer_B > 0) || - (page.Idle_C && page.IdleTimer_C > 0)) + if((page.Idle && page.IdleTimer > 0) || (page.Idle_B && page.IdleTimer_B > 0) || + (page.Idle_C && page.IdleTimer_C > 0)) { if(page.Idle && page.IdleTimer > 0) sb.AppendFormat("\tIdle timer A is set to {0} ms", page.IdleTimer * 100).AppendLine(); @@ -5536,13 +5401,11 @@ namespace DiscImageChef.Decoders.SCSI if(page.Idle_C && page.IdleTimer_C > 0) sb.AppendFormat("\tIdle timer C is set to {0} ms", page.IdleTimer_C * 100).AppendLine(); } - else - sb.AppendLine("\tDrive will not enter idle mode"); + else sb.AppendLine("\tDrive will not enter idle mode"); switch(page.PM_BG_Precedence) { - case 0: - break; + case 0: break; case 1: sb.AppendLine("\tPerforming background functions take precedence over maintaining low power conditions"); break; @@ -5553,11 +5416,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion Mode Page 0x1A: Power condition page #region Mode Page 0x0A subpage 0x01: Control Extension mode page - /// /// Control Extension mode page /// Page code 0x0A @@ -5599,23 +5460,17 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_0A_S01? DecodeModePage_0A_S01(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) != 0x40) - return null; + if((pageResponse[0] & 0x40) != 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x0A) - return null; + if((pageResponse[0] & 0x3F) != 0x0A) return null; - if(pageResponse[1] != 0x01) - return null; + if(pageResponse[1] != 0x01) return null; - if(((pageResponse[2] << 8) + pageResponse[3] + 4) != pageResponse.Length) - return null; + if(((pageResponse[2] << 8) + pageResponse[3] + 4) != pageResponse.Length) return null; - if(pageResponse.Length < 32) - return null; + if(pageResponse.Length < 32) return null; ModePage_0A_S01 decoded = new ModePage_0A_S01(); @@ -5637,45 +5492,38 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_0A_S01(ModePage_0A_S01? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_0A_S01 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Control extension page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); if(page.TCMOS) { sb.Append("\tTimestamp can be initialized by methods outside of the SCSI standards"); - if(page.SCSIP) - sb.Append(", but SCSI's SET TIMESTAMP shall take precedence over them"); + if(page.SCSIP) sb.Append(", but SCSI's SET TIMESTAMP shall take precedence over them"); sb.AppendLine(); } - if(page.IALUAE) - sb.AppendLine("\tImplicit Asymmetric Logical Unit Access is enabled"); + if(page.IALUAE) sb.AppendLine("\tImplicit Asymmetric Logical Unit Access is enabled"); sb.AppendFormat("\tInitial priority is {0}", page.InitialPriority).AppendLine(); - if(page.DLC) - sb.AppendLine("\tDevice will not degrade performance to extend its life"); + if(page.DLC) sb.AppendLine("\tDevice will not degrade performance to extend its life"); if(page.MaximumSenseLength > 0) sb.AppendFormat("\tMaximum sense data would be {0} bytes", page.MaximumSenseLength).AppendLine(); return sb.ToString(); } - #endregion Mode Page 0x0A subpage 0x01: Control Extension mode page #region Mode Page 0x1A subpage 0x01: Power Consumption mode page - /// /// Power Consumption mode page /// Page code 0x1A @@ -5700,23 +5548,17 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_1A_S01? DecodeModePage_1A_S01(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) != 0x40) - return null; + if((pageResponse[0] & 0x40) != 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x1A) - return null; + if((pageResponse[0] & 0x3F) != 0x1A) return null; - if(pageResponse[1] != 0x01) - return null; + if(pageResponse[1] != 0x01) return null; - if(((pageResponse[2] << 8) + pageResponse[3] + 4) != pageResponse.Length) - return null; + if(((pageResponse[2] << 8) + pageResponse[3] + 4) != pageResponse.Length) return null; - if(pageResponse.Length < 16) - return null; + if(pageResponse.Length < 16) return null; ModePage_1A_S01 decoded = new ModePage_1A_S01(); @@ -5734,21 +5576,20 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_1A_S01(ModePage_1A_S01? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_1A_S01 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Power Consumption page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); switch(page.ActiveLevel) { case 0: - sb.AppendFormat("\tDevice power consumption is dictated by identifier {0} of Power Consumption VPD", page.PowerConsumptionIdentifier).AppendLine(); + sb.AppendFormat("\tDevice power consumption is dictated by identifier {0} of Power Consumption VPD", + page.PowerConsumptionIdentifier).AppendLine(); break; case 1: sb.AppendLine("\tDevice is in highest relative power consumption level"); @@ -5763,11 +5604,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion Mode Page 0x1A subpage 0x01: Power Consumption mode page #region Mode Page 0x10: XOR control mode page - /// /// XOR control mode page /// Page code 0x10 @@ -5803,29 +5642,27 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_10? DecodeModePage_10(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x10) - return null; + if((pageResponse[0] & 0x3F) != 0x10) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 24) - return null; + if(pageResponse.Length < 24) return null; ModePage_10 decoded = new ModePage_10(); decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.XORDIS |= (pageResponse[2] & 0x02) == 0x02; - decoded.MaxXorWrite = (uint)((pageResponse[4] << 24) + (pageResponse[5] << 16) + (pageResponse[6] << 8) + pageResponse[7]); - decoded.MaxRegenSize = (uint)((pageResponse[12] << 24) + (pageResponse[13] << 16) + (pageResponse[14] << 8) + pageResponse[15]); - decoded.MaxRebuildRead = (uint)((pageResponse[16] << 24) + (pageResponse[17] << 16) + (pageResponse[18] << 8) + pageResponse[19]); + decoded.MaxXorWrite = (uint)((pageResponse[4] << 24) + (pageResponse[5] << 16) + (pageResponse[6] << 8) + + pageResponse[7]); + decoded.MaxRegenSize = (uint)((pageResponse[12] << 24) + (pageResponse[13] << 16) + + (pageResponse[14] << 8) + pageResponse[15]); + decoded.MaxRebuildRead = (uint)((pageResponse[16] << 24) + (pageResponse[17] << 16) + + (pageResponse[18] << 8) + pageResponse[19]); decoded.RebuildDelay = (ushort)((pageResponse[22] << 8) + pageResponse[23]); return decoded; @@ -5838,38 +5675,37 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_10(ModePage_10? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_10 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI XOR control mode page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if(page.XORDIS) - sb.AppendLine("\tXOR operations are disabled"); + if(page.XORDIS) sb.AppendLine("\tXOR operations are disabled"); else { if(page.MaxXorWrite > 0) - sb.AppendFormat("\tDrive accepts a maximum of {0} blocks in a single XOR WRITE command", page.MaxXorWrite).AppendLine(); + sb.AppendFormat("\tDrive accepts a maximum of {0} blocks in a single XOR WRITE command", + page.MaxXorWrite).AppendLine(); if(page.MaxRegenSize > 0) - sb.AppendFormat("\tDrive accepts a maximum of {0} blocks in a REGENERATE command", page.MaxRegenSize).AppendLine(); + sb.AppendFormat("\tDrive accepts a maximum of {0} blocks in a REGENERATE command", + page.MaxRegenSize).AppendLine(); if(page.MaxRebuildRead > 0) - sb.AppendFormat("\tDrive accepts a maximum of {0} blocks in a READ command during rebuild", page.MaxRebuildRead).AppendLine(); + sb.AppendFormat("\tDrive accepts a maximum of {0} blocks in a READ command during rebuild", + page.MaxRebuildRead).AppendLine(); if(page.RebuildDelay > 0) - sb.AppendFormat("\tDrive needs a minimum of {0} ms between READ commands during rebuild", page.RebuildDelay).AppendLine(); + sb.AppendFormat("\tDrive needs a minimum of {0} ms between READ commands during rebuild", + page.RebuildDelay).AppendLine(); } return sb.ToString(); } - #endregion Mode Page 0x10: XOR control mode page #region Mode Page 0x1C subpage 0x01: Background Control mode page - /// /// Background Control mode page /// Page code 0x1A @@ -5918,23 +5754,17 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_1C_S01? DecodeModePage_1C_S01(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) != 0x40) - return null; + if((pageResponse[0] & 0x40) != 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x1C) - return null; + if((pageResponse[0] & 0x3F) != 0x1C) return null; - if(pageResponse[1] != 0x01) - return null; + if(pageResponse[1] != 0x01) return null; - if(((pageResponse[2] << 8) + pageResponse[3] + 4) != pageResponse.Length) - return null; + if(((pageResponse[2] << 8) + pageResponse[3] + 4) != pageResponse.Length) return null; - if(pageResponse.Length < 16) - return null; + if(pageResponse.Length < 16) return null; ModePage_1C_S01 decoded = new ModePage_1C_S01(); @@ -5960,45 +5790,42 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_1C_S01(ModePage_1C_S01? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_1C_S01 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Background Control page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if(page.S_L_Full) - sb.AppendLine("\tBackground scans will be halted if log is full"); - if(page.LOWIR) - sb.AppendLine("\tBackground scans will only be logged if they require intervention"); - if(page.En_Bms) - sb.AppendLine("\tBackground medium scans are enabled"); - if(page.En_Ps) - sb.AppendLine("\tBackground pre-scans are enabled"); + if(page.S_L_Full) sb.AppendLine("\tBackground scans will be halted if log is full"); + if(page.LOWIR) sb.AppendLine("\tBackground scans will only be logged if they require intervention"); + if(page.En_Bms) sb.AppendLine("\tBackground medium scans are enabled"); + if(page.En_Ps) sb.AppendLine("\tBackground pre-scans are enabled"); if(page.BackgroundScanInterval > 0) - sb.AppendFormat("\t{0} hours shall be between the start of a background scan operation and the next", page.BackgroundScanInterval).AppendLine(); + sb.AppendFormat("\t{0} hours shall be between the start of a background scan operation and the next", + page.BackgroundScanInterval).AppendLine(); if(page.BackgroundPrescanTimeLimit > 0) - sb.AppendFormat("\tBackgroun pre-scan operations can take a maximum of {0} hours", page.BackgroundPrescanTimeLimit).AppendLine(); + sb.AppendFormat("\tBackgroun pre-scan operations can take a maximum of {0} hours", + page.BackgroundPrescanTimeLimit).AppendLine(); if(page.MinIdleBeforeBgScan > 0) - sb.AppendFormat("\tAt least {0} ms must be idle before resuming a suspended background scan operation", page.MinIdleBeforeBgScan).AppendLine(); + sb.AppendFormat("\tAt least {0} ms must be idle before resuming a suspended background scan operation", + page.MinIdleBeforeBgScan).AppendLine(); if(page.MaxTimeSuspendBgScan > 0) - sb.AppendFormat("\tAt most {0} ms must be before suspending a background scan operation and processing received commands", page.MaxTimeSuspendBgScan).AppendLine(); + sb + .AppendFormat("\tAt most {0} ms must be before suspending a background scan operation and processing received commands", + page.MaxTimeSuspendBgScan).AppendLine(); return sb.ToString(); } - #endregion Mode Page 0x1C subpage 0x01: Background Control mode page #region Mode Page 0x0F: Data compression page - /// /// Data compression page /// Page code 0x0F @@ -6038,20 +5865,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_0F? DecodeModePage_0F(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x0F) - return null; + if((pageResponse[0] & 0x3F) != 0x0F) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 16) - return null; + if(pageResponse.Length < 16) return null; ModePage_0F decoded = new ModePage_0F(); @@ -6062,8 +5884,10 @@ namespace DiscImageChef.Decoders.SCSI decoded.DDE |= (pageResponse[3] & 0x80) == 0x80; decoded.RED = (byte)((pageResponse[3] & 0x60) >> 5); - decoded.CompressionAlgo = (uint)((pageResponse[4] << 24) + (pageResponse[5] << 16) + (pageResponse[6] << 8) + pageResponse[7]); - decoded.DecompressionAlgo = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + (pageResponse[10] << 8) + pageResponse[11]); + decoded.CompressionAlgo = (uint)((pageResponse[4] << 24) + (pageResponse[5] << 16) + + (pageResponse[6] << 8) + pageResponse[7]); + decoded.DecompressionAlgo = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + + (pageResponse[10] << 8) + pageResponse[11]); return decoded; } @@ -6075,16 +5899,14 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_0F(ModePage_0F? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_0F page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Data compression page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); if(page.DCC) { @@ -6117,11 +5939,11 @@ namespace DiscImageChef.Decoders.SCSI break; } } + if(page.DDE) { sb.AppendLine("\tData decompression is enabled"); - if(page.DecompressionAlgo == 0) - sb.AppendLine("\tLast data read was uncompressed"); + if(page.DecompressionAlgo == 0) sb.AppendLine("\tLast data read was uncompressed"); else { sb.Append("\tLast data read was compressed with "); @@ -6154,16 +5976,13 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendFormat("\tReport exception on compression is set to {0}", page.RED).AppendLine(); } - else - sb.AppendLine("\tDrive does not support data compression"); + else sb.AppendLine("\tDrive does not support data compression"); return sb.ToString(); } - #endregion Mode Page 0x0F: Data compression page #region Mode Page 0x1B: Removable Block Access Capabilities page - /// /// Removable Block Access Capabilities page /// Page code 0x1B @@ -6199,20 +6018,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_1B? DecodeModePage_1B(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x1B) - return null; + if((pageResponse[0] & 0x3F) != 0x1B) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 12) - return null; + if(pageResponse.Length < 12) return null; ModePage_1B decoded = new ModePage_1B(); @@ -6234,35 +6048,26 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_1B(ModePage_1B? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_1B page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Removable Block Access Capabilities page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if(page.SFLP) - sb.AppendLine("\tDrive can be used as a system floppy device"); - if(page.SRFP) - sb.AppendLine("\tDrive supports reporting progress of format"); - if(page.NCD) - sb.AppendLine("\tDrive is a Non-CD Optical Device"); - if(page.SML) - sb.AppendLine("\tDevice is a dual device supporting CD and Non-CD Optical"); - if(page.TLUN > 0) - sb.AppendFormat("\tDrive supports {0} LUNs", page.TLUN).AppendLine(); + if(page.SFLP) sb.AppendLine("\tDrive can be used as a system floppy device"); + if(page.SRFP) sb.AppendLine("\tDrive supports reporting progress of format"); + if(page.NCD) sb.AppendLine("\tDrive is a Non-CD Optical Device"); + if(page.SML) sb.AppendLine("\tDevice is a dual device supporting CD and Non-CD Optical"); + if(page.TLUN > 0) sb.AppendFormat("\tDrive supports {0} LUNs", page.TLUN).AppendLine(); return sb.ToString(); } - #endregion Mode Page 0x1B: Removable Block Access Capabilities page #region Mode Page 0x1C: Timer & Protect page - /// /// Timer & Protect page /// Page code 0x1C @@ -6290,20 +6095,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_1C_SFF? DecodeModePage_1C_SFF(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x1C) - return null; + if((pageResponse[0] & 0x3F) != 0x1C) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 8) - return null; + if(pageResponse.Length < 8) return null; ModePage_1C_SFF decoded = new ModePage_1C_SFF(); @@ -6323,21 +6123,17 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_1C_SFF(ModePage_1C_SFF? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_1C_SFF page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Timer & Protect page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if(page.DISP) - sb.AppendLine("\tDrive is disabled until power is cycled"); - if(page.SWPP) - sb.AppendLine("\tDrive is software write-protected until powered down"); + if(page.DISP) sb.AppendLine("\tDrive is disabled until power is cycled"); + if(page.SWPP) sb.AppendLine("\tDrive is software write-protected until powered down"); switch(page.InactivityTimeMultiplier) { @@ -6393,11 +6189,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion Mode Page 0x1C: Timer & Protect page #region Mode Page 0x00: Drive Operation Mode page - /// /// Drive Operation Mode page /// Page code 0x00 @@ -6429,20 +6223,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_00_SFF? DecodeModePage_00_SFF(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x00) - return null; + if((pageResponse[0] & 0x3F) != 0x00) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 4) - return null; + if(pageResponse.Length < 4) return null; ModePage_00_SFF decoded = new ModePage_00_SFF(); @@ -6464,34 +6253,27 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_00_SFF(ModePage_00_SFF? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_00_SFF page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Drive Operation Mode page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if(page.DVW) - sb.AppendLine("\tVerifying after writing is disabled"); - if(page.DDE) - sb.AppendLine("\tDrive will abort when a writing error is detected"); + if(page.DVW) sb.AppendLine("\tVerifying after writing is disabled"); + if(page.DDE) sb.AppendLine("\tDrive will abort when a writing error is detected"); if(page.SLM) { sb.Append("\tDrive has two LUNs with rewritable being "); - if(page.SLM) - sb.AppendLine("LUN 1"); - else - sb.AppendLine("LUN 0"); + if(page.SLM) sb.AppendLine("LUN 1"); + else sb.AppendLine("LUN 0"); } return sb.ToString(); } - #endregion Mode Page 0x00: Drive Operation Mode page public struct ModePage @@ -6510,20 +6292,17 @@ namespace DiscImageChef.Decoders.SCSI public static DecodedMode? DecodeMode6(byte[] modeResponse, PeripheralDeviceTypes deviceType) { ModeHeader? hdr = DecodeModeHeader6(modeResponse, deviceType); - if(!hdr.HasValue) - return null; + if(!hdr.HasValue) return null; DecodedMode decoded = new DecodedMode(); decoded.Header = hdr.Value; int blkDrLength = 0; - if(decoded.Header.BlockDescriptors != null) - blkDrLength = decoded.Header.BlockDescriptors.Length; + if(decoded.Header.BlockDescriptors != null) blkDrLength = decoded.Header.BlockDescriptors.Length; int offset = 4 + blkDrLength * 8; int length = modeResponse[0] + 1; - if(length != modeResponse.Length) - return decoded; + if(length != modeResponse.Length) return decoded; List listpages = new List(); @@ -6545,12 +6324,11 @@ namespace DiscImageChef.Decoders.SCSI { if(isSubpage) { - if (offset + 3 >= modeResponse.Length) - break; + if(offset + 3 >= modeResponse.Length) break; pg.PageResponse = new byte[(modeResponse[offset + 2] << 8) + modeResponse[offset + 3] + 4]; - if((pg.PageResponse.Length + offset) > modeResponse.Length) - return decoded; + if((pg.PageResponse.Length + offset) > modeResponse.Length) return decoded; + Array.Copy(modeResponse, offset, pg.PageResponse, 0, pg.PageResponse.Length); pg.Page = (byte)(modeResponse[offset] & 0x3F); pg.Subpage = modeResponse[offset + 1]; @@ -6558,12 +6336,11 @@ namespace DiscImageChef.Decoders.SCSI } else { - if (offset + 1 >= modeResponse.Length) - break; - + if(offset + 1 >= modeResponse.Length) break; + pg.PageResponse = new byte[modeResponse[offset + 1] + 2]; - if((pg.PageResponse.Length + offset) > modeResponse.Length) - return decoded; + if((pg.PageResponse.Length + offset) > modeResponse.Length) return decoded; + Array.Copy(modeResponse, offset, pg.PageResponse, 0, pg.PageResponse.Length); pg.Page = (byte)(modeResponse[offset] & 0x3F); pg.Subpage = 0; @@ -6582,27 +6359,22 @@ namespace DiscImageChef.Decoders.SCSI public static DecodedMode? DecodeMode10(byte[] modeResponse, PeripheralDeviceTypes deviceType) { ModeHeader? hdr = DecodeModeHeader10(modeResponse, deviceType); - if(!hdr.HasValue) - return null; + if(!hdr.HasValue) return null; DecodedMode decoded = new DecodedMode(); decoded.Header = hdr.Value; bool longlba = (modeResponse[4] & 0x01) == 0x01; int offset; int blkDrLength = 0; - if(decoded.Header.BlockDescriptors != null) - blkDrLength = decoded.Header.BlockDescriptors.Length; + if(decoded.Header.BlockDescriptors != null) blkDrLength = decoded.Header.BlockDescriptors.Length; - if(longlba) - offset = 8 + blkDrLength * 16; - else - offset = 8 + blkDrLength * 8; + if(longlba) offset = 8 + blkDrLength * 16; + else offset = 8 + blkDrLength * 8; int length = (modeResponse[0] << 8); length += modeResponse[1]; length += 2; - if(length != modeResponse.Length) - return decoded; + if(length != modeResponse.Length) return decoded; List listpages = new List(); @@ -6626,8 +6398,7 @@ namespace DiscImageChef.Decoders.SCSI { pg.PageResponse = new byte[(modeResponse[offset + 2] << 8) + modeResponse[offset + 3] + 4]; - if((pg.PageResponse.Length + offset) > modeResponse.Length) - return decoded; + if((pg.PageResponse.Length + offset) > modeResponse.Length) return decoded; Array.Copy(modeResponse, offset, pg.PageResponse, 0, pg.PageResponse.Length); pg.Page = (byte)(modeResponse[offset] & 0x3F); @@ -6638,8 +6409,7 @@ namespace DiscImageChef.Decoders.SCSI { pg.PageResponse = new byte[modeResponse[offset + 1] + 2]; - if((pg.PageResponse.Length + offset) > modeResponse.Length) - return decoded; + if((pg.PageResponse.Length + offset) > modeResponse.Length) return decoded; Array.Copy(modeResponse, offset, pg.PageResponse, 0, pg.PageResponse.Length); pg.Page = (byte)(modeResponse[offset] & 0x3F); @@ -6703,20 +6473,15 @@ namespace DiscImageChef.Decoders.SCSI public static Fujitsu_ModePage_3E? DecodeFujitsuModePage_3E(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x3E) - return null; + if((pageResponse[0] & 0x3F) != 0x3E) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length != 8) - return null; + if(pageResponse.Length != 8) return null; Fujitsu_ModePage_3E decoded = new Fujitsu_ModePage_3E(); @@ -6743,19 +6508,16 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyFujitsuModePage_3E(Fujitsu_ModePage_3E? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Fujitsu_ModePage_3E page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("Fujitsu Verify Control Page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if(page.audioVisualMode) - sb.AppendLine("\tAudio/Visual data support mode is applied"); + if(page.audioVisualMode) sb.AppendLine("\tAudio/Visual data support mode is applied"); if(page.streamingMode) sb.AppendLine("\tTest write operation is restricted during read or write operations."); @@ -6772,16 +6534,14 @@ namespace DiscImageChef.Decoders.SCSI break; } - sb.AppendFormat("\tThe device type that would be provided in the INQUIRY response is {0}", - page.devType).AppendLine(); + sb.AppendFormat("\tThe device type that would be provided in the INQUIRY response is {0}", page.devType) + .AppendLine(); return sb.ToString(); } - #endregion Fujitsu Mode Page 0x3E: Verify Control page #region Mode Page 0x11: Medium partition page (1) - public enum PartitionSizeUnitOfMeasures : byte { /// @@ -6872,20 +6632,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_11? DecodeModePage_11(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x11) - return null; + if((pageResponse[0] & 0x3F) != 0x11) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 8) - return null; + if(pageResponse.Length < 8) return null; ModePage_11 decoded = new ModePage_11(); @@ -6904,10 +6659,10 @@ namespace DiscImageChef.Decoders.SCSI decoded.MediumFormatRecognition = (MediumFormatRecognitionValues)pageResponse[5]; decoded.PartitionSizes = new ushort[(pageResponse.Length - 8) / 2]; - for(int i = 8; i < pageResponse.Length; i+=2) + for(int i = 8; i < pageResponse.Length; i += 2) { decoded.PartitionSizes[(i - 8) / 2] = (ushort)(pageResponse[i] << 8); - decoded.PartitionSizes[(i - 8) / 2] += pageResponse[i+1]; + decoded.PartitionSizes[(i - 8) / 2] += pageResponse[i + 1]; } return decoded; @@ -6920,26 +6675,21 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_11(ModePage_11? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_11 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI medium partition page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); sb.AppendFormat("\t{0} maximum additional partitions", page.MaxAdditionalPartitions).AppendLine(); sb.AppendFormat("\t{0} additional partitions defined", page.AdditionalPartitionsDefined).AppendLine(); - if(page.FDP) - sb.AppendLine("\tPartitions are fixed under device definitions"); - if(page.SDP) - sb.AppendLine("\tNumber of partitions can be defined but their size is defined by the device"); - if(page.IDP) - sb.AppendLine("\tNumber and size of partitions can be manually defined"); + if(page.FDP) sb.AppendLine("\tPartitions are fixed under device definitions"); + if(page.SDP) sb.AppendLine("\tNumber of partitions can be defined but their size is defined by the device"); + if(page.IDP) sb.AppendLine("\tNumber and size of partitions can be manually defined"); if(page.POFM) sb.AppendLine("\tPartition parameters will not be applied until a FORMAT MEDIUM command is received"); if(!page.CLEAR && !page.ADDP) @@ -6968,7 +6718,8 @@ namespace DiscImageChef.Decoders.SCSI measure = "megabytes"; break; case PartitionSizeUnitOfMeasures.Exponential: - sb.AppendFormat("\tPartitions are defined in units of {0} bytes", Math.Pow(10, page.PartitionUnits)).AppendLine(); + sb.AppendFormat("\tPartitions are defined in units of {0} bytes", Math.Pow(10, page.PartitionUnits)) + .AppendLine(); measure = string.Format("units of {0} bytes", Math.Pow(10, page.PartitionUnits)); break; default: @@ -6992,7 +6743,8 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("\tDevice is not capable of recognizing neither medium partitions nor format"); break; default: - sb.AppendFormat("\tUnknown medium recognition code {0}", (byte)page.MediumFormatRecognition).AppendLine(); + sb.AppendFormat("\tUnknown medium recognition code {0}", (byte)page.MediumFormatRecognition) + .AppendLine(); break; } @@ -7004,8 +6756,7 @@ namespace DiscImageChef.Decoders.SCSI { if(page.PartitionSizes.Length == 1) sb.AppendLine("\tDevice recognizes one single partition spanning whole medium"); - else - sb.AppendFormat("\tPartition {0} runs for rest of medium", i).AppendLine(); + else sb.AppendFormat("\tPartition {0} runs for rest of medium", i).AppendLine(); } else sb.AppendFormat("\tPartition {0} is {1} {2} long", i, page.PartitionSizes[i], measure).AppendLine(); @@ -7013,11 +6764,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion Mode Page 0x11: Medium partition page (1) #region Mode Pages 0x12, 0x13, 0x14: Medium partition page (2-4) - /// /// Medium partition page (2-4) /// Page codes 0x12, 0x13 and 0x14 @@ -7036,22 +6785,16 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_12_13_14? DecodeModePage_12_13_14(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x12 && - (pageResponse[0] & 0x3F) != 0x13 && - (pageResponse[0] & 0x3F) != 0x14) - return null; + if((pageResponse[0] & 0x3F) != 0x12 && (pageResponse[0] & 0x3F) != 0x13 && + (pageResponse[0] & 0x3F) != 0x14) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 2) - return null; + if(pageResponse.Length < 2) return null; ModePage_12_13_14 decoded = new ModePage_12_13_14(); @@ -7075,16 +6818,14 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_12_13_14(ModePage_12_13_14? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_12_13_14 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI medium partition page (extra):"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); sb.AppendFormat("\tMedium has defined {0} partitions", page.PartitionSizes.Length).AppendLine(); @@ -7093,7 +6834,6 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion Mode Pages 0x12, 0x13, 0x14: Medium partition page (2-4) #region Certance Mode Page 0x21: Drive Capabilities Control Mode page @@ -7115,20 +6855,15 @@ namespace DiscImageChef.Decoders.SCSI public static Certance_ModePage_21? DecodeCertanceModePage_21(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x21) - return null; + if((pageResponse[0] & 0x3F) != 0x21) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length != 9) - return null; + if(pageResponse.Length != 9) return null; Certance_ModePage_21 decoded = new Certance_ModePage_21(); @@ -7152,16 +6887,14 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyCertanceModePage_21(Certance_ModePage_21? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Certance_ModePage_21 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("Certance Drive Capabilities Control Mode Page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); switch(page.OperatingSystemsSupport) { @@ -7169,7 +6902,8 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("\tOperating systems support is standard LTO"); break; default: - sb.AppendFormat("\tOperating systems support is unknown code {0}", page.OperatingSystemsSupport).AppendLine(); + sb.AppendFormat("\tOperating systems support is unknown code {0}", page.OperatingSystemsSupport) + .AppendLine(); break; } @@ -7221,8 +6955,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - if(page.HostUnloadOverride) - sb.AppendLine("\tSCSI UNLOAD command will not eject the cartridge"); + if(page.HostUnloadOverride) sb.AppendLine("\tSCSI UNLOAD command will not eject the cartridge"); sb.Append("\tHow should tapes be unloaded in a power cycle, tape incompatibility, firmware download or cleaning end: "); switch(page.AutoUnloadMode) @@ -7246,7 +6979,6 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion Certance Mode Page 0x21: Drive Capabilities Control Mode page #region Certance Mode Page 0x22: Interface Control Mode Page @@ -7271,20 +7003,15 @@ namespace DiscImageChef.Decoders.SCSI public static Certance_ModePage_22? DecodeCertanceModePage_22(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x22) - return null; + if((pageResponse[0] & 0x3F) != 0x22) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length != 16) - return null; + if(pageResponse.Length != 16) return null; Certance_ModePage_22 decoded = new Certance_ModePage_22(); @@ -7311,16 +7038,14 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyCertanceModePage_22(Certance_ModePage_22? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; Certance_ModePage_22 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("Certance Interface Control Mode Page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); switch(page.BaudRate) { @@ -7346,10 +7071,8 @@ namespace DiscImageChef.Decoders.SCSI break; } - if(page.StopBits) - sb.AppendLine("Library interface transmits 2 stop bits per byte"); - else - sb.AppendLine("Library interface transmits 1 stop bits per byte"); + if(page.StopBits) sb.AppendLine("Library interface transmits 2 stop bits per byte"); + else sb.AppendLine("Library interface transmits 1 stop bits per byte"); switch(page.CmdFwd) { @@ -7380,22 +7103,18 @@ namespace DiscImageChef.Decoders.SCSI if(page.PortATransportType > 0) sb.AppendFormat("\tDrive responds to SCSI ID {0}", page.PortAPresentSelectionID).AppendLine(); - sb.AppendFormat("\tDrive will respond to SCSI ID {0} on Port A enabling", page.NextSelectionID).AppendLine(); + sb.AppendFormat("\tDrive will respond to SCSI ID {0} on Port A enabling", page.NextSelectionID) + .AppendLine(); sb.AppendFormat("\tDrive jumpers choose SCSI ID {0}", page.JumperedSelectionID).AppendLine(); - if(page.PortAEnabled) - sb.AppendLine("\tSCSI port is enabled"); - else - sb.AppendLine("\tSCSI port is disabled"); + if(page.PortAEnabled) sb.AppendLine("\tSCSI port is enabled"); + else sb.AppendLine("\tSCSI port is disabled"); - if(page.PortAEnabledOnPower) - sb.AppendLine("\tSCSI port will be enabled on next power up"); - else - sb.AppendLine("\tSCSI port will be disabled on next power up"); + if(page.PortAEnabledOnPower) sb.AppendLine("\tSCSI port will be enabled on next power up"); + else sb.AppendLine("\tSCSI port will be disabled on next power up"); return sb.ToString(); } - #endregion Certance Mode Page 0x22: Interface Control Mode Page #region Mode Page 0x1D: Medium Configuration Mode Page @@ -7412,20 +7131,15 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_1D? DecodeModePage_1D(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x1D) - return null; + if((pageResponse[0] & 0x3F) != 0x1D) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 32) - return null; + if(pageResponse.Length < 32) return null; ModePage_1D decoded = new ModePage_1D(); @@ -7444,19 +7158,16 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_1D(ModePage_1D? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; ModePage_1D page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Medium Configuration Mode Page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if(page.WORMM) - sb.AppendLine("\tDrive is operating in WORM mode"); + if(page.WORMM) sb.AppendLine("\tDrive is operating in WORM mode"); switch(page.WormModeLabelRestrictions) { @@ -7470,7 +7181,8 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("\tDrive allows all format labels to be overwritten"); break; default: - sb.AppendFormat("\tUnknown WORM mode label restrictions code {0}", page.WormModeLabelRestrictions).AppendLine(); + sb.AppendFormat("\tUnknown WORM mode label restrictions code {0}", page.WormModeLabelRestrictions) + .AppendLine(); break; } @@ -7483,13 +7195,13 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("\tDrive allows any number of filemarks immediately preceding EOD to be overwritten"); break; default: - sb.AppendFormat("\tUnknown WORM mode filemark restrictions code {0}", page.WormModeLabelRestrictions).AppendLine(); + sb.AppendFormat("\tUnknown WORM mode filemark restrictions code {0}", + page.WormModeLabelRestrictions).AppendLine(); break; } return sb.ToString(); } - #endregion Mode Page 0x1D: Medium Configuration Mode Page #region IBM Mode Page 0x24: Drive Capabilities Control Mode page @@ -7507,20 +7219,15 @@ namespace DiscImageChef.Decoders.SCSI public static IBM_ModePage_24? DecodeIBMModePage_24(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x24) - return null; + if((pageResponse[0] & 0x3F) != 0x24) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length != 8) - return null; + if(pageResponse.Length != 8) return null; IBM_ModePage_24 decoded = new IBM_ModePage_24(); @@ -7540,16 +7247,14 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyIBMModePage_24(IBM_ModePage_24? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; IBM_ModePage_24 page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("IBM Vendor-Specific Control Mode Page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); sb.AppendFormat("\tVendor-specific mode control: {0}", page.ModeControl); sb.AppendFormat("\tVendor-specific velocity setting: {0}", page.VelocitySetting); @@ -7557,13 +7262,11 @@ namespace DiscImageChef.Decoders.SCSI if(page.EncryptionCapable) { sb.AppendLine("\tDrive supports encryption"); - if(page.EncryptionEnabled) - sb.AppendLine("\tDrive has encryption enabled"); + if(page.EncryptionEnabled) sb.AppendLine("\tDrive has encryption enabled"); } return sb.ToString(); } - #endregion IBM Mode Page 0x24: Drive Capabilities Control Mode page #region IBM Mode Page 0x2F: Behaviour Configuration Mode page @@ -7588,20 +7291,15 @@ namespace DiscImageChef.Decoders.SCSI public static IBM_ModePage_2F? DecodeIBMModePage_2F(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x2F) - return null; + if((pageResponse[0] & 0x3F) != 0x2F) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length < 8) - return null; + if(pageResponse.Length < 8) return null; IBM_ModePage_2F decoded = new IBM_ModePage_2F(); @@ -7628,16 +7326,14 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyIBMModePage_2F(IBM_ModePage_2F? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; IBM_ModePage_2F page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("IBM Behaviour Configuration Mode Page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); switch(page.FenceBehaviour) { @@ -7691,25 +7387,18 @@ namespace DiscImageChef.Decoders.SCSI break; } - if(page.CLNCHK) - sb.AppendLine("\tDrive will set Check Condition when cleaning is needed"); - if(page.DDEOR) - sb.AppendLine("\tNo deferred error will be reported to a rewind command"); - if(page.CCDM) - sb.AppendLine("\tDrive will set Check Condition when the criteria for Dead Media is met"); + if(page.CLNCHK) sb.AppendLine("\tDrive will set Check Condition when cleaning is needed"); + if(page.DDEOR) sb.AppendLine("\tNo deferred error will be reported to a rewind command"); + if(page.CCDM) sb.AppendLine("\tDrive will set Check Condition when the criteria for Dead Media is met"); if(page.FirmwareUpdateBehaviour > 0) sb.AppendLine("\tDrive will not accept downlevel firmware via an FMR tape"); - if(page.UOE_C == 1) - sb.AppendLine("\tDrive will eject cleaning cartridges on error"); - if(page.UOE_F == 1) - sb.AppendLine("\tDrive will eject firmware cartridges on error"); - if(page.UOE_D == 1) - sb.AppendLine("\tDrive will eject data cartridges on error"); + if(page.UOE_C == 1) sb.AppendLine("\tDrive will eject cleaning cartridges on error"); + if(page.UOE_F == 1) sb.AppendLine("\tDrive will eject firmware cartridges on error"); + if(page.UOE_D == 1) sb.AppendLine("\tDrive will eject data cartridges on error"); return sb.ToString(); } - #endregion IBM Mode Page 0x24: Drive Capabilities Control Mode page #region IBM Mode Page 0x3D: Behaviour Configuration Mode page @@ -7724,20 +7413,15 @@ namespace DiscImageChef.Decoders.SCSI public static IBM_ModePage_3D? DecodeIBMModePage_3D(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x3D) - return null; + if((pageResponse[0] & 0x3F) != 0x3D) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length != 5) - return null; + if(pageResponse.Length != 5) return null; IBM_ModePage_3D decoded = new IBM_ModePage_3D(); @@ -7754,22 +7438,19 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyIBMModePage_3D(IBM_ModePage_3D? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; IBM_ModePage_3D page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("IBM LEOT Mode Page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); sb.AppendFormat("\t{0} wraps", page.NumberOfWraps).AppendLine(); return sb.ToString(); } - #endregion IBM Mode Page 0x3D: Behaviour Configuration Mode page #region HP Mode Page 0x3B: Serial Number Override Mode page @@ -7785,20 +7466,15 @@ namespace DiscImageChef.Decoders.SCSI public static HP_ModePage_3B? DecodeHPModePage_3B(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x3B) - return null; + if((pageResponse[0] & 0x3F) != 0x3B) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length != 16) - return null; + if(pageResponse.Length != 16) return null; HP_ModePage_3B decoded = new HP_ModePage_3B(); @@ -7817,16 +7493,14 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyHPModePage_3B(HP_ModePage_3B? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; HP_ModePage_3B page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("HP Serial Number Override Mode Page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); switch(page.MSN) { @@ -7842,7 +7516,6 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion HP Mode Page 0x3B: Serial Number Override Mode page #region HP Mode Page 0x3C: Device Time Mode page @@ -7868,20 +7541,15 @@ namespace DiscImageChef.Decoders.SCSI public static HP_ModePage_3C? DecodeHPModePage_3C(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x3C) - return null; + if((pageResponse[0] & 0x3F) != 0x3C) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length != 36) - return null; + if(pageResponse.Length != 36) return null; HP_ModePage_3C decoded = new HP_ModePage_3C(); @@ -7890,14 +7558,17 @@ namespace DiscImageChef.Decoders.SCSI decoded.WT |= (pageResponse[2] & 0x02) == 0x02; decoded.PT |= (pageResponse[2] & 0x01) == 0x01; decoded.CurrentPowerOn = (ushort)((pageResponse[6] << 8) + pageResponse[7]); - decoded.PowerOnTime = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + (pageResponse[10] << 8) + pageResponse[11]); + decoded.PowerOnTime = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + (pageResponse[10] << 8) + + pageResponse[11]); decoded.UTC |= (pageResponse[14] & 0x02) == 0x02; decoded.NTP |= (pageResponse[14] & 0x01) == 0x01; - decoded.WorldTime = (uint)((pageResponse[16] << 24) + (pageResponse[17] << 16) + (pageResponse[18] << 8) + pageResponse[19]); + decoded.WorldTime = (uint)((pageResponse[16] << 24) + (pageResponse[17] << 16) + (pageResponse[18] << 8) + + pageResponse[19]); decoded.LibraryHours = pageResponse[23]; decoded.LibraryMinutes = pageResponse[24]; decoded.LibrarySeconds = pageResponse[25]; - decoded.CumulativePowerOn = (uint)((pageResponse[32] << 24) + (pageResponse[33] << 16) + (pageResponse[34] << 8) + pageResponse[35]); + decoded.CumulativePowerOn = (uint)((pageResponse[32] << 24) + (pageResponse[33] << 16) + + (pageResponse[34] << 8) + pageResponse[35]); return decoded; } @@ -7909,39 +7580,39 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyHPModePage_3C(HP_ModePage_3C? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; HP_ModePage_3C page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("HP Device Time Mode Page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); if(page.PT) { sb.AppendFormat("\tDrive has been powered up {0} times", page.CurrentPowerOn); - sb.AppendFormat("\tDrive has been powered up since {0} this time", TimeSpan.FromSeconds(page.PowerOnTime)).AppendLine(); - sb.AppendFormat("\tDrive has been powered up a total of {0}", TimeSpan.FromSeconds(page.CumulativePowerOn)).AppendLine(); + sb.AppendFormat("\tDrive has been powered up since {0} this time", + TimeSpan.FromSeconds(page.PowerOnTime)).AppendLine(); + sb.AppendFormat("\tDrive has been powered up a total of {0}", + TimeSpan.FromSeconds(page.CumulativePowerOn)).AppendLine(); } if(page.WT) { - sb.AppendFormat("\tDrive's date/time is: {0}", DateHandlers.UNIXUnsignedToDateTime(page.WorldTime)).AppendLine(); - if(page.UTC) - sb.AppendLine("\tDrive's time is UTC"); - if(page.NTP) - sb.AppendLine("\tDrive's time is synchronized with a NTP source"); + sb.AppendFormat("\tDrive's date/time is: {0}", DateHandlers.UNIXUnsignedToDateTime(page.WorldTime)) + .AppendLine(); + if(page.UTC) sb.AppendLine("\tDrive's time is UTC"); + if(page.NTP) sb.AppendLine("\tDrive's time is synchronized with a NTP source"); } if(page.LT) - sb.AppendFormat("\tLibrary time is {0}", new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, page.LibraryHours, page.LibraryMinutes, page.LibrarySeconds)).AppendLine(); + sb.AppendFormat("\tLibrary time is {0}", + new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, page.LibraryHours, + page.LibraryMinutes, page.LibrarySeconds)).AppendLine(); return sb.ToString(); } - #endregion HP Mode Page 0x3C: Device Time Mode page #region HP Mode Page 0x3D: Extended Reset Mode page @@ -7956,20 +7627,15 @@ namespace DiscImageChef.Decoders.SCSI public static HP_ModePage_3D? DecodeHPModePage_3D(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x3D) - return null; + if((pageResponse[0] & 0x3F) != 0x3D) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length != 4) - return null; + if(pageResponse.Length != 4) return null; HP_ModePage_3D decoded = new HP_ModePage_3D(); @@ -7986,16 +7652,14 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyHPModePage_3D(HP_ModePage_3D? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; HP_ModePage_3D page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("HP Extended Reset Mode Page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); switch(page.ResetBehaviour) { @@ -8012,7 +7676,6 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - #endregion HP Mode Page 0x3D: Extended Reset Mode page #region HP Mode Page 0x3E: CD-ROM Emulation/Disaster Recovery Mode page @@ -8028,26 +7691,21 @@ namespace DiscImageChef.Decoders.SCSI public static HP_ModePage_3E? DecodeHPModePage_3E(byte[] pageResponse) { - if(pageResponse == null) - return null; + if(pageResponse == null) return null; - if((pageResponse[0] & 0x40) == 0x40) - return null; + if((pageResponse[0] & 0x40) == 0x40) return null; - if((pageResponse[0] & 0x3F) != 0x3E) - return null; + if((pageResponse[0] & 0x3F) != 0x3E) return null; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if(pageResponse.Length != 4) - return null; + if(pageResponse.Length != 4) return null; HP_ModePage_3E decoded = new HP_ModePage_3E(); decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.NonAuto |= (pageResponse[2] & 0x02) == 0x02; - decoded.CDmode|= (pageResponse[2] & 0x01) == 0x01; + decoded.CDmode |= (pageResponse[2] & 0x01) == 0x01; return decoded; } @@ -8059,48 +7717,41 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyHPModePage_3E(HP_ModePage_3E? modePage) { - if(!modePage.HasValue) - return null; + if(!modePage.HasValue) return null; HP_ModePage_3E page = modePage.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("HP CD-ROM Emulation/Disaster Recovery Mode Page:"); - if(page.PS) - sb.AppendLine("\tParameters can be saved"); + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if(page.CDmode) - sb.AppendLine("\tDrive is emulating a CD-ROM drive"); - else - sb.AppendLine("\tDrive is not emulating a CD-ROM drive"); - if(page.NonAuto) - sb.AppendLine("\tDrive will not exit emulation automatically"); + if(page.CDmode) sb.AppendLine("\tDrive is emulating a CD-ROM drive"); + else sb.AppendLine("\tDrive is not emulating a CD-ROM drive"); + if(page.NonAuto) sb.AppendLine("\tDrive will not exit emulation automatically"); return sb.ToString(); } - #endregion HP Mode Page 0x3E: CD-ROM Emulation/Disaster Recovery Mode page #region Apple Mode Page 0x30: Apple OEM String - static readonly byte[] AppleOEMString = { 0x41, 0x50, 0x50, 0x4C, 0x45, 0x20, 0x43, 0x4F, 0x4D, 0x50, 0x55, 0x54, 0x45, 0x52, 0x2C, 0x20, 0x49, 0x4E, 0x43, 0x2E }; + static readonly byte[] AppleOEMString = + { + 0x41, 0x50, 0x50, 0x4C, 0x45, 0x20, 0x43, 0x4F, 0x4D, 0x50, 0x55, 0x54, 0x45, 0x52, 0x2C, 0x20, 0x49, 0x4E, + 0x43, 0x2E + }; public static bool IsAppleModePage_30(byte[] pageResponse) { - if(pageResponse == null) - return false; + if(pageResponse == null) return false; - if((pageResponse[0] & 0x40) == 0x40) - return false; + if((pageResponse[0] & 0x40) == 0x40) return false; - if((pageResponse[0] & 0x3F) != 0x30) - return false; + if((pageResponse[0] & 0x3F) != 0x30) return false; - if(pageResponse[1] + 2 != pageResponse.Length) - return false; + if(pageResponse[1] + 2 != pageResponse.Length) return false; - if(pageResponse.Length != 30) - return false; + if(pageResponse.Length != 30) return false; byte[] str = new byte[20]; Array.Copy(pageResponse, 10, str, 0, 20); @@ -8109,5 +7760,4 @@ namespace DiscImageChef.Decoders.SCSI } #endregion Apple Mode Page 0x30: Apple OEM String } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/ModesEncoders.cs b/DiscImageChef.Decoders/SCSI/ModesEncoders.cs index 67bb6159..add4dde8 100644 --- a/DiscImageChef.Decoders/SCSI/ModesEncoders.cs +++ b/DiscImageChef.Decoders/SCSI/ModesEncoders.cs @@ -40,40 +40,31 @@ namespace DiscImageChef.Decoders.SCSI { byte[] hdr; - if(header.BlockDescriptors != null) - hdr = new byte[4 + header.BlockDescriptors.Length * 8]; - else - hdr = new byte[4]; + if(header.BlockDescriptors != null) hdr = new byte[4 + header.BlockDescriptors.Length * 8]; + else hdr = new byte[4]; hdr[1] = (byte)header.MediumType; if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice) { - if(header.WriteProtected) - hdr[2] += 0x80; - if(header.DPOFUA) - hdr[2] += 0x10; + if(header.WriteProtected) hdr[2] += 0x80; + if(header.DPOFUA) hdr[2] += 0x10; } if(deviceType == PeripheralDeviceTypes.SequentialAccess) { - if(header.WriteProtected) - hdr[2] += 0x80; + if(header.WriteProtected) hdr[2] += 0x80; hdr[2] += (byte)(header.Speed & 0x0F); hdr[2] += (byte)((header.BufferedMode << 4) & 0x70); } - if(deviceType == PeripheralDeviceTypes.PrinterDevice) - hdr[2] += (byte)((header.BufferedMode << 4) & 0x70); + if(deviceType == PeripheralDeviceTypes.PrinterDevice) hdr[2] += (byte)((header.BufferedMode << 4) & 0x70); if(deviceType == PeripheralDeviceTypes.OpticalDevice) { - if(header.WriteProtected) - hdr[2] += 0x80; - if(header.EBC) - hdr[2] += 0x01; - if(header.DPOFUA) - hdr[2] += 0x10; + if(header.WriteProtected) hdr[2] += 0x80; + if(header.EBC) hdr[2] += 0x01; + if(header.DPOFUA) hdr[2] += 0x10; } if(header.BlockDescriptors != null) @@ -98,11 +89,7 @@ namespace DiscImageChef.Decoders.SCSI public static byte[] EncodeMode6(DecodedMode mode, PeripheralDeviceTypes deviceType) { int modeSize = 0; - if(mode.Pages != null) - { - foreach(ModePage page in mode.Pages) - modeSize += page.PageResponse.Length; - } + if(mode.Pages != null) { foreach(ModePage page in mode.Pages) modeSize += page.PageResponse.Length; } byte[] hdr = EncodeModeHeader6(mode.Header, deviceType); modeSize += hdr.Length; @@ -123,15 +110,10 @@ namespace DiscImageChef.Decoders.SCSI return md; } - public static byte[] EncodeMode10(DecodedMode mode, PeripheralDeviceTypes deviceType) { int modeSize = 0; - if(mode.Pages != null) - { - foreach(ModePage page in mode.Pages) - modeSize += page.PageResponse.Length; - } + if(mode.Pages != null) { foreach(ModePage page in mode.Pages) modeSize += page.PageResponse.Length; } byte[] hdr = EncodeModeHeader10(mode.Header, deviceType); modeSize += hdr.Length; @@ -163,47 +145,36 @@ namespace DiscImageChef.Decoders.SCSI if(header.BlockDescriptors != null) { - if(longLBA) - hdr = new byte[8 + header.BlockDescriptors.Length * 16]; - else - hdr = new byte[8 + header.BlockDescriptors.Length * 8]; + if(longLBA) hdr = new byte[8 + header.BlockDescriptors.Length * 16]; + else hdr = new byte[8 + header.BlockDescriptors.Length * 8]; } - else - hdr = new byte[8]; + else hdr = new byte[8]; hdr[2] = (byte)header.MediumType; if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice) { - if(header.WriteProtected) - hdr[3] += 0x80; - if(header.DPOFUA) - hdr[3] += 0x10; + if(header.WriteProtected) hdr[3] += 0x80; + if(header.DPOFUA) hdr[3] += 0x10; } if(deviceType == PeripheralDeviceTypes.SequentialAccess) { - if(header.WriteProtected) - hdr[3] += 0x80; + if(header.WriteProtected) hdr[3] += 0x80; hdr[3] += (byte)(header.Speed & 0x0F); hdr[3] += (byte)((header.BufferedMode << 4) & 0x70); } - if(deviceType == PeripheralDeviceTypes.PrinterDevice) - hdr[3] += (byte)((header.BufferedMode << 4) & 0x70); + if(deviceType == PeripheralDeviceTypes.PrinterDevice) hdr[3] += (byte)((header.BufferedMode << 4) & 0x70); if(deviceType == PeripheralDeviceTypes.OpticalDevice) { - if(header.WriteProtected) - hdr[3] += 0x80; - if(header.EBC) - hdr[3] += 0x01; - if(header.DPOFUA) - hdr[3] += 0x10; + if(header.WriteProtected) hdr[3] += 0x80; + if(header.EBC) hdr[3] += 0x01; + if(header.DPOFUA) hdr[3] += 0x10; } - if(longLBA) - hdr[4] += 0x01; + if(longLBA) hdr[4] += 0x01; if(header.BlockDescriptors != null) { @@ -232,8 +203,7 @@ namespace DiscImageChef.Decoders.SCSI { if(deviceType != PeripheralDeviceTypes.DirectAccess) hdr[0 + i * 8 + 8] = (byte)header.BlockDescriptors[i].Density; - else - hdr[0 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF000000) >> 24); + else hdr[0 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF000000) >> 24); hdr[1 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF0000) >> 16); hdr[2 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF00) >> 8); hdr[3 + i * 8 + 8] = (byte)(header.BlockDescriptors[i].Blocks & 0xFF); @@ -254,24 +224,15 @@ namespace DiscImageChef.Decoders.SCSI pg[0] = 0x01; pg[1] = 6; - if(page.PS) - pg[0] += 0x80; - if(page.AWRE) - pg[2] += 0x80; - if(page.ARRE) - pg[2] += 0x40; - if(page.TB) - pg[2] += 0x20; - if(page.RC) - pg[2] += 0x10; - if(page.EER) - pg[2] += 0x08; - if(page.PER) - pg[2] += 0x04; - if(page.DTE) - pg[2] += 0x02; - if(page.DCR) - pg[2] += 0x01; + if(page.PS) pg[0] += 0x80; + if(page.AWRE) pg[2] += 0x80; + if(page.ARRE) pg[2] += 0x40; + if(page.TB) pg[2] += 0x20; + if(page.RC) pg[2] += 0x10; + if(page.EER) pg[2] += 0x08; + if(page.PER) pg[2] += 0x04; + if(page.DTE) pg[2] += 0x02; + if(page.DCR) pg[2] += 0x01; pg[3] = page.ReadRetryCount; pg[4] = page.CorrectionSpan; @@ -296,8 +257,7 @@ namespace DiscImageChef.Decoders.SCSI pg[0] = 0x01; pg[1] = 10; - if(page.PS) - pg[0] += 0x80; + if(page.PS) pg[0] += 0x80; pg[2] = page.Parameter; pg[3] = page.ReadRetryCount; @@ -310,5 +270,4 @@ namespace DiscImageChef.Decoders.SCSI return pg; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs b/DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs index 4a4fce91..a477d28d 100644 --- a/DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs +++ b/DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs @@ -55,11 +55,9 @@ namespace DiscImageChef.Decoders.SCSI.SSC public static BlockLimitsData? Decode(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 6) - return null; + if(response.Length != 6) return null; BlockLimitsData dec = new BlockLimitsData(); @@ -72,8 +70,7 @@ namespace DiscImageChef.Decoders.SCSI.SSC public static string Prettify(BlockLimitsData? decoded) { - if(decoded == null) - return null; + if(decoded == null) return null; StringBuilder sb = new StringBuilder(); @@ -83,13 +80,14 @@ namespace DiscImageChef.Decoders.SCSI.SSC { if(decoded.Value.maxBlockLen > 0) sb.AppendFormat("Device's maximum block size is {0} bytes", decoded.Value.maxBlockLen).AppendLine(); - else - sb.AppendLine("Device does not specify a maximum block size"); + else sb.AppendLine("Device does not specify a maximum block size"); sb.AppendFormat("Device's minimum block size is {0} bytes", decoded.Value.minBlockLen).AppendLine(); if(decoded.Value.granularity > 0) #pragma warning disable IDE0004 // Remove Unnecessary Cast - sb.AppendFormat("Device's needs a block size granularity of 2^{0} ({1}) bytes", decoded.Value.granularity, Math.Pow(2, (double)decoded.Value.granularity)).AppendLine(); + sb.AppendFormat("Device's needs a block size granularity of 2^{0} ({1}) bytes", + decoded.Value.granularity, Math.Pow(2, (double)decoded.Value.granularity)) + .AppendLine(); #pragma warning restore IDE0004 // Remove Unnecessary Cast } @@ -101,5 +99,4 @@ namespace DiscImageChef.Decoders.SCSI.SSC return Prettify(Decode(response)); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs b/DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs index 75e136ab..7824aa0f 100644 --- a/DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs +++ b/DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs @@ -89,16 +89,13 @@ namespace DiscImageChef.Decoders.SCSI.SSC public static DensitySupportHeader? DecodeDensity(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length <= 56) - return null; + if(response.Length <= 56) return null; ushort responseLen = (ushort)((response[0] << 8) + response[1] + 2); - if(response.Length != responseLen) - return null; + if(response.Length != responseLen) return null; List descriptors = new List(); int offset = 4; @@ -115,10 +112,12 @@ namespace DiscImageChef.Decoders.SCSI.SSC descriptor.reserved = (byte)((response[offset + 2] & 0x1E) >> 1); descriptor.lenvalid |= (response[offset + 2] & 0x01) == 0x01; descriptor.len = (ushort)((response[offset + 3] << 8) + response[offset + 4]); - descriptor.bpmm = (uint)((response[offset + 5] << 16) + (response[offset + 6] << 8) + response[offset + 7]); + descriptor.bpmm = + (uint)((response[offset + 5] << 16) + (response[offset + 6] << 8) + response[offset + 7]); descriptor.width = (ushort)((response[offset + 8] << 8) + response[offset + 9]); descriptor.tracks = (ushort)((response[offset + 10] << 8) + response[offset + 11]); - descriptor.capacity = (uint)((response[offset + 12] << 24) + (response[offset + 13] << 16) + (response[offset + 14] << 8) + response[offset + 15]); + descriptor.capacity = (uint)((response[offset + 12] << 24) + (response[offset + 13] << 16) + + (response[offset + 14] << 8) + response[offset + 15]); tmp = new byte[8]; Array.Copy(response, offset + 16, tmp, 0, 8); descriptor.organization = StringHandlers.CToString(tmp).Trim(); @@ -129,10 +128,8 @@ namespace DiscImageChef.Decoders.SCSI.SSC Array.Copy(response, offset + 32, tmp, 0, 20); descriptor.description = StringHandlers.CToString(tmp).Trim(); - if(descriptor.lenvalid) - offset += descriptor.len + 5; - else - offset += 52; + if(descriptor.lenvalid) offset += descriptor.len + 5; + else offset += 52; descriptors.Add(descriptor); } @@ -147,27 +144,25 @@ namespace DiscImageChef.Decoders.SCSI.SSC public static string PrettifyDensity(DensitySupportHeader? density) { - if(density == null) - return null; + if(density == null) return null; DensitySupportHeader decoded = density.Value; StringBuilder sb = new StringBuilder(); foreach(DensitySupportDescriptor descriptor in decoded.descriptors) { - sb.AppendFormat("Density \"{0}\" defined by \"{1}\".", descriptor.name, descriptor.organization).AppendLine(); + sb.AppendFormat("Density \"{0}\" defined by \"{1}\".", descriptor.name, descriptor.organization) + .AppendLine(); sb.AppendFormat("\tPrimary code: {0:X2}h", descriptor.primaryCode).AppendLine(); if(descriptor.primaryCode != descriptor.secondaryCode) sb.AppendFormat("\tSecondary code: {0:X2}h", descriptor.secondaryCode).AppendLine(); - if(descriptor.writable) - sb.AppendLine("\tDrive can write this density"); - if(descriptor.duplicate) - sb.AppendLine("\tThis descriptor is duplicated"); - if(descriptor.defaultDensity) - sb.AppendLine("\tThis is the default density on the drive"); + if(descriptor.writable) sb.AppendLine("\tDrive can write this density"); + if(descriptor.duplicate) sb.AppendLine("\tThis descriptor is duplicated"); + if(descriptor.defaultDensity) sb.AppendLine("\tThis is the default density on the drive"); sb.AppendFormat("\tDensity has {0} bits per mm, with {1} tracks in a {2} mm width tape", #pragma warning disable IDE0004 // Remove Unnecessary Cast - descriptor.bpmm, descriptor.tracks, (double)((double)descriptor.width / (double)10)).AppendLine(); + descriptor.bpmm, descriptor.tracks, (double)((double)descriptor.width / (double)10)) + .AppendLine(); #pragma warning restore IDE0004 // Remove Unnecessary Cast sb.AppendFormat("\tDensity maximum capacity is {0} megabytes", descriptor.capacity).AppendLine(); sb.AppendFormat("\tDensity description: {0}", descriptor.description).AppendLine(); @@ -184,16 +179,13 @@ namespace DiscImageChef.Decoders.SCSI.SSC public static MediaTypeSupportHeader? DecodeMediumType(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length <= 60) - return null; + if(response.Length <= 60) return null; ushort responseLen = (ushort)((response[0] << 8) + response[1] + 2); - if(response.Length != responseLen) - return null; + if(response.Length != responseLen) return null; List descriptors = new List(); int offset = 4; @@ -205,8 +197,8 @@ namespace DiscImageChef.Decoders.SCSI.SSC descriptor.mediumType = response[offset + 0]; descriptor.reserved1 = response[offset + 1]; descriptor.len = (ushort)((response[offset + 2] << 8) + response[offset + 3]); - if(descriptor.len != 52) - return null; + if(descriptor.len != 52) return null; + descriptor.numberOfCodes = response[offset + 4]; descriptor.densityCodes = new byte[9]; Array.Copy(response, offset + 5, descriptor.densityCodes, 0, 9); @@ -239,27 +231,28 @@ namespace DiscImageChef.Decoders.SCSI.SSC public static string PrettifyMediumType(MediaTypeSupportHeader? mediumType) { - if(mediumType == null) - return null; + if(mediumType == null) return null; MediaTypeSupportHeader decoded = mediumType.Value; StringBuilder sb = new StringBuilder(); foreach(MediaTypeSupportDescriptor descriptor in decoded.descriptors) { - sb.AppendFormat("Medium type \"{0}\" defined by \"{1}\".", descriptor.name, descriptor.organization).AppendLine(); + sb.AppendFormat("Medium type \"{0}\" defined by \"{1}\".", descriptor.name, descriptor.organization) + .AppendLine(); sb.AppendFormat("\tMedium type code: {0:X2}h", descriptor.mediumType).AppendLine(); if(descriptor.numberOfCodes > 0) { sb.AppendFormat("\tMedium supports following density codes:"); for(int i = 0; i < descriptor.numberOfCodes; i++) sb.AppendFormat(" {0:X2}h", descriptor.densityCodes[i]); + sb.AppendLine(); } sb.AppendFormat("\tMedium has a nominal length of {0} m in a {1} mm width tape", #pragma warning disable IDE0004 // Remove Unnecessary Cast - descriptor.length, (double)((double)descriptor.width / (double)10)).AppendLine(); + descriptor.length, (double)((double)descriptor.width / (double)10)).AppendLine(); #pragma warning restore IDE0004 // Remove Unnecessary Cast sb.AppendFormat("\tMedium description: {0}", descriptor.description).AppendLine(); sb.AppendLine(); @@ -273,5 +266,4 @@ namespace DiscImageChef.Decoders.SCSI.SSC return PrettifyMediumType(DecodeMediumType(response)); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/Sense.cs b/DiscImageChef.Decoders/SCSI/Sense.cs index b4273fe0..db78e907 100644 --- a/DiscImageChef.Decoders/SCSI/Sense.cs +++ b/DiscImageChef.Decoders/SCSI/Sense.cs @@ -233,34 +233,25 @@ namespace DiscImageChef.Decoders.SCSI /// Sense bytes. public static SenseType GetType(byte[] sense) { - if(sense == null) - return SenseType.Invalid; + if(sense == null) return SenseType.Invalid; - if(sense.Length < 4) - return SenseType.Invalid; + if(sense.Length < 4) return SenseType.Invalid; - if((sense[0] & 0x70) != 0x70) - return sense.Length != 4 ? SenseType.Invalid : SenseType.StandardSense; + if((sense[0] & 0x70) != 0x70) return sense.Length != 4 ? SenseType.Invalid : SenseType.StandardSense; switch(sense[0] & 0x0F) { - case 0: - return SenseType.ExtendedSenseFixedCurrent; - case 1: - return SenseType.ExtendedSenseFixedPast; - case 2: - return SenseType.ExtendedSenseDescriptorCurrent; - case 3: - return SenseType.ExtendedSenseDescriptorPast; - default: - return SenseType.Unknown; + case 0: return SenseType.ExtendedSenseFixedCurrent; + case 1: return SenseType.ExtendedSenseFixedPast; + case 2: return SenseType.ExtendedSenseDescriptorCurrent; + case 3: return SenseType.ExtendedSenseDescriptorPast; + default: return SenseType.Unknown; } } public static StandardSense? DecodeStandard(byte[] sense) { - if(GetType(sense) != SenseType.StandardSense) - return null; + if(GetType(sense) != SenseType.StandardSense) return null; StandardSense decoded = new StandardSense(); decoded.AddressValid |= (sense[0] & 0x80) == 0x80; @@ -281,12 +272,9 @@ namespace DiscImageChef.Decoders.SCSI public static FixedSense? DecodeFixed(byte[] sense, out string senseDescription) { senseDescription = null; - if((sense[0] & 0x7F) != 0x70 && - (sense[0] & 0x7F) != 0x71) - return null; + if((sense[0] & 0x7F) != 0x70 && (sense[0] & 0x7F) != 0x71) return null; - if(sense.Length < 8) - return null; + if(sense.Length < 8) return null; FixedSense decoded = new FixedSense(); @@ -309,11 +297,9 @@ namespace DiscImageChef.Decoders.SCSI senseDescription = GetSenseDescription(decoded.ASC, decoded.ASCQ); } - if(sense.Length >= 15) - decoded.FieldReplaceable = sense[14]; + if(sense.Length >= 15) decoded.FieldReplaceable = sense[14]; - if(sense.Length >= 18) - decoded.SenseKeySpecific = (uint)((sense[15] << 16) + (sense[16] << 8) + sense[17]); + if(sense.Length >= 18) decoded.SenseKeySpecific = (uint)((sense[15] << 16) + (sense[16] << 8) + sense[17]); if(sense.Length > 18) { @@ -334,11 +320,9 @@ namespace DiscImageChef.Decoders.SCSI { senseDescription = null; - if(sense == null) - return null; + if(sense == null) return null; - if(sense.Length < 8) - return null; + if(sense.Length < 8) return null; DescriptorSense decoded = new DescriptorSense(); @@ -360,13 +344,11 @@ namespace DiscImageChef.Decoders.SCSI byte[] desc = new byte[descLen]; Array.Copy(sense, offset, desc, 0, descLen); - if(!decoded.Descriptors.ContainsKey(descType)) - decoded.Descriptors.Add(descType, desc); + if(!decoded.Descriptors.ContainsKey(descType)) decoded.Descriptors.Add(descType, desc); offset += descLen; } - else - break; + else break; } return decoded; @@ -378,81 +360,67 @@ namespace DiscImageChef.Decoders.SCSI switch(type) { - case SenseType.StandardSense: - return PrettifySense(DecodeStandard(sense)); + case SenseType.StandardSense: return PrettifySense(DecodeStandard(sense)); case SenseType.ExtendedSenseFixedCurrent: - case SenseType.ExtendedSenseFixedPast: - return PrettifySense(DecodeFixed(sense)); + case SenseType.ExtendedSenseFixedPast: return PrettifySense(DecodeFixed(sense)); case SenseType.ExtendedSenseDescriptorCurrent: - case SenseType.ExtendedSenseDescriptorPast: - return PrettifySense(DecodeDescriptor(sense)); - default: - return null; + case SenseType.ExtendedSenseDescriptorPast: return PrettifySense(DecodeDescriptor(sense)); + default: return null; } } public static string PrettifySense(StandardSense? sense) { - if(!sense.HasValue) - return null; + if(!sense.HasValue) return null; - return sense.Value.AddressValid ? string.Format("Error class {0} type {1} happened on block {2}\n", - sense.Value.ErrorClass, sense.Value.ErrorType, sense.Value.LBA) : - string.Format("Error class {0} type {1}\n", sense.Value.ErrorClass, - sense.Value.ErrorType); + return sense.Value.AddressValid + ? string.Format("Error class {0} type {1} happened on block {2}\n", sense.Value.ErrorClass, + sense.Value.ErrorType, sense.Value.LBA) + : string.Format("Error class {0} type {1}\n", sense.Value.ErrorClass, sense.Value.ErrorType); } public static string PrettifySense(FixedSense? sense) { - if(!sense.HasValue) - return null; + if(!sense.HasValue) return null; FixedSense decoded = sense.Value; StringBuilder sb = new StringBuilder(); sb.AppendFormat("SCSI SENSE: {0}", GetSenseKey(decoded.SenseKey)).AppendLine(); - if(decoded.SegmentNumber > 0) - sb.AppendFormat("On segment {0}", decoded.SegmentNumber).AppendLine(); - if(decoded.Filemark) - sb.AppendLine("Filemark or setmark found"); - if(decoded.EOM) - sb.AppendLine("End-of-medium/partition found"); - if(decoded.ILI) - sb.AppendLine("Incorrect length indicator"); - if(decoded.InformationValid) - sb.AppendFormat("On logical block {0}", decoded.Information).AppendLine(); + if(decoded.SegmentNumber > 0) sb.AppendFormat("On segment {0}", decoded.SegmentNumber).AppendLine(); + if(decoded.Filemark) sb.AppendLine("Filemark or setmark found"); + if(decoded.EOM) sb.AppendLine("End-of-medium/partition found"); + if(decoded.ILI) sb.AppendLine("Incorrect length indicator"); + if(decoded.InformationValid) sb.AppendFormat("On logical block {0}", decoded.Information).AppendLine(); - if(decoded.AdditionalLength < 6) - return sb.ToString(); + if(decoded.AdditionalLength < 6) return sb.ToString(); sb.AppendLine(GetSenseDescription(decoded.ASC, decoded.ASCQ)); - if(decoded.AdditionalLength < 10) - return sb.ToString(); + if(decoded.AdditionalLength < 10) return sb.ToString(); if(decoded.SKSV) { switch(decoded.SenseKey) { case SenseKeys.IllegalRequest: - { - if((decoded.SenseKeySpecific & 0x400000) == 0x400000) - sb.AppendLine("Illegal field in CDB"); - else - sb.AppendLine("Illegal field in data parameters"); + { + if((decoded.SenseKeySpecific & 0x400000) == 0x400000) sb.AppendLine("Illegal field in CDB"); + else sb.AppendLine("Illegal field in data parameters"); - if((decoded.SenseKeySpecific & 0x200000) == 0x200000) - sb.AppendFormat("Invalid value in bit {0} in field {1} of CDB", - (decoded.SenseKeySpecific & 0x70000) >> 16, - decoded.SenseKeySpecific & 0xFFFF).AppendLine(); - else - sb.AppendFormat("Invalid value in field {0} of CDB", - decoded.SenseKeySpecific & 0xFFFF).AppendLine(); - } + if((decoded.SenseKeySpecific & 0x200000) == 0x200000) + sb.AppendFormat("Invalid value in bit {0} in field {1} of CDB", + (decoded.SenseKeySpecific & 0x70000) >> 16, + decoded.SenseKeySpecific & 0xFFFF).AppendLine(); + else + sb.AppendFormat("Invalid value in field {0} of CDB", decoded.SenseKeySpecific & 0xFFFF) + .AppendLine(); + } break; case SenseKeys.NotReady: - sb.AppendFormat("Format progress {0:P}", (double)(decoded.SenseKeySpecific & 0xFFFF) / 65536).AppendLine(); + sb.AppendFormat("Format progress {0:P}", (double)(decoded.SenseKeySpecific & 0xFFFF) / 65536) + .AppendLine(); break; case SenseKeys.RecoveredError: case SenseKeys.HardwareError: @@ -465,11 +433,9 @@ namespace DiscImageChef.Decoders.SCSI return sb.ToString(); } - public static string PrettifySense(DescriptorSense? sense) { - if(!sense.HasValue) - return null; + if(!sense.HasValue) return null; DescriptorSense decoded = sense.Value; @@ -478,8 +444,7 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendFormat("SCSI SENSE: {0}", GetSenseKey(decoded.SenseKey)).AppendLine(); sb.AppendLine(GetSenseDescription(decoded.ASC, decoded.ASCQ)); - if(decoded.Descriptors == null || decoded.Descriptors.Count == 0) - return sb.ToString(); + if(decoded.Descriptors == null || decoded.Descriptors.Count == 0) return sb.ToString(); foreach(KeyValuePair kvp in decoded.Descriptors) { @@ -501,8 +466,7 @@ namespace DiscImageChef.Decoders.SCSI /// Descriptor. public static ulong DecodeDescriptor00(byte[] descriptor) { - if(descriptor.Length != 12 || descriptor[0] != 0x00) - return 0; + if(descriptor.Length != 12 || descriptor[0] != 0x00) return 0; byte[] temp = new byte[8]; @@ -525,8 +489,7 @@ namespace DiscImageChef.Decoders.SCSI /// Descriptor. public static ulong DecodeDescriptor01(byte[] descriptor) { - if(descriptor.Length != 12 || descriptor[0] != 0x01) - return 0; + if(descriptor.Length != 12 || descriptor[0] != 0x01) return 0; byte[] temp = new byte[8]; @@ -549,8 +512,7 @@ namespace DiscImageChef.Decoders.SCSI /// Descriptor. public static byte[] DecodeDescriptor02(byte[] descriptor) { - if(descriptor.Length != 8 || descriptor[0] != 0x02) - return null; + if(descriptor.Length != 8 || descriptor[0] != 0x02) return null; byte[] temp = new byte[3]; Array.Copy(descriptor, 4, temp, 0, 3); @@ -564,8 +526,7 @@ namespace DiscImageChef.Decoders.SCSI /// Descriptor. public static byte DecodeDescriptor03(byte[] descriptor) { - if(descriptor.Length != 4 || descriptor[0] != 0x03) - return 0; + if(descriptor.Length != 4 || descriptor[0] != 0x03) return 0; return descriptor[3]; } @@ -577,8 +538,7 @@ namespace DiscImageChef.Decoders.SCSI /// Descriptor. public static AnotherProgressIndicationSenseDescriptor? DecodeDescriptor0A(byte[] descriptor) { - if(descriptor.Length != 8 || descriptor[0] != 0x0A) - return null; + if(descriptor.Length != 8 || descriptor[0] != 0x0A) return null; AnotherProgressIndicationSenseDescriptor decoded = new AnotherProgressIndicationSenseDescriptor(); @@ -654,38 +614,22 @@ namespace DiscImageChef.Decoders.SCSI { switch(key) { - case SenseKeys.AbortedCommand: - return "ABORTED COMMAND"; - case SenseKeys.BlankCheck: - return "BLANK CHECK"; - case SenseKeys.CopyAborted: - return "COPY ABORTED"; - case SenseKeys.DataProtect: - return "DATA PROTECT"; - case SenseKeys.Equal: - return "EQUAL"; - case SenseKeys.HardwareError: - return "HARDWARE ERROR"; - case SenseKeys.IllegalRequest: - return "ILLEGAL REQUEST"; - case SenseKeys.MediumError: - return "MEDIUM ERROR"; - case SenseKeys.Miscompare: - return "MISCOMPARE"; - case SenseKeys.NoSense: - return "NO SENSE"; - case SenseKeys.PrivateUse: - return "PRIVATE USE"; - case SenseKeys.RecoveredError: - return "RECOVERED ERROR"; - case SenseKeys.Completed: - return "COMPLETED"; - case SenseKeys.UnitAttention: - return "UNIT ATTENTION"; - case SenseKeys.VolumeOverflow: - return "VOLUME OVERFLOW"; - default: - return "UNKNOWN"; + case SenseKeys.AbortedCommand: return "ABORTED COMMAND"; + case SenseKeys.BlankCheck: return "BLANK CHECK"; + case SenseKeys.CopyAborted: return "COPY ABORTED"; + case SenseKeys.DataProtect: return "DATA PROTECT"; + case SenseKeys.Equal: return "EQUAL"; + case SenseKeys.HardwareError: return "HARDWARE ERROR"; + case SenseKeys.IllegalRequest: return "ILLEGAL REQUEST"; + case SenseKeys.MediumError: return "MEDIUM ERROR"; + case SenseKeys.Miscompare: return "MISCOMPARE"; + case SenseKeys.NoSense: return "NO SENSE"; + case SenseKeys.PrivateUse: return "PRIVATE USE"; + case SenseKeys.RecoveredError: return "RECOVERED ERROR"; + case SenseKeys.Completed: return "COMPLETED"; + case SenseKeys.UnitAttention: return "UNIT ATTENTION"; + case SenseKeys.VolumeOverflow: return "VOLUME OVERFLOW"; + default: return "UNKNOWN"; } } @@ -696,1999 +640,1382 @@ namespace DiscImageChef.Decoders.SCSI case 0x00: switch(ASCQ) { - case 0x00: - return "NO ADDITIONAL SENSE INFORMATION"; - case 0x01: - return "FILEMARK DETECTED"; - case 0x02: - return "END-OF-PARTITION/MEDIUM DETECTED"; - case 0x03: - return "SETMARK DETECTED"; - case 0x04: - return "BEGINNING-OF-PARTITION/MEDIUM DETECTED"; - case 0x05: - return "END-OF-DATA DETECTED"; - case 0x06: - return "I/O PROCESS TERMINATED"; - case 0x07: - return "PROGRAMMABLE EARLY WARNING DETECTED"; - case 0x11: - return "AUDIO PLAY OPERATION IN PROGRESS"; - case 0x12: - return "AUDIO PLAY OPERATION PAUSED"; - case 0x13: - return "AUDIO PLAY OPERATION SUCCESSFULLY COMPLETED"; - case 0x14: - return "AUDIO PLAY OPERATION STOPPED DUE TO ERROR"; - case 0x15: - return "NO CURRENT AUDIO STATUS TO RETURN"; - case 0x16: - return "OPERATION IN PROGRESS"; - case 0x17: - return "CLEANING REQUESTED"; - case 0x18: - return "ERASE OPERATION IN PROGRESS"; - case 0x19: - return "LOCATE OPERATION IN PROGRESS"; - case 0x1A: - return "REWIND OPERATION IN PROGRESS"; - case 0x1B: - return "SET CAPACITY OPERATION IN PROGRESS"; - case 0x1C: - return "VERIFY OPERATION IN PROGRESS"; - case 0x1D: - return "ATA PASS THROUGH INFORMATION AVAILABLE"; - case 0x1E: - return "CONFLICTING SA CREATION REQUEST"; - case 0x1F: - return "LOGICAL UNIT TRANSITIONING TO ANOTHER POWER CONDITION"; - case 0x20: - return "EXTENDED COPY INFORMATION AVAILABLE"; - case 0x21: - return "ATOMIC COMMAND ABORTED DUE TO ACA"; + case 0x00: return "NO ADDITIONAL SENSE INFORMATION"; + case 0x01: return "FILEMARK DETECTED"; + case 0x02: return "END-OF-PARTITION/MEDIUM DETECTED"; + case 0x03: return "SETMARK DETECTED"; + case 0x04: return "BEGINNING-OF-PARTITION/MEDIUM DETECTED"; + case 0x05: return "END-OF-DATA DETECTED"; + case 0x06: return "I/O PROCESS TERMINATED"; + case 0x07: return "PROGRAMMABLE EARLY WARNING DETECTED"; + case 0x11: return "AUDIO PLAY OPERATION IN PROGRESS"; + case 0x12: return "AUDIO PLAY OPERATION PAUSED"; + case 0x13: return "AUDIO PLAY OPERATION SUCCESSFULLY COMPLETED"; + case 0x14: return "AUDIO PLAY OPERATION STOPPED DUE TO ERROR"; + case 0x15: return "NO CURRENT AUDIO STATUS TO RETURN"; + case 0x16: return "OPERATION IN PROGRESS"; + case 0x17: return "CLEANING REQUESTED"; + case 0x18: return "ERASE OPERATION IN PROGRESS"; + case 0x19: return "LOCATE OPERATION IN PROGRESS"; + case 0x1A: return "REWIND OPERATION IN PROGRESS"; + case 0x1B: return "SET CAPACITY OPERATION IN PROGRESS"; + case 0x1C: return "VERIFY OPERATION IN PROGRESS"; + case 0x1D: return "ATA PASS THROUGH INFORMATION AVAILABLE"; + case 0x1E: return "CONFLICTING SA CREATION REQUEST"; + case 0x1F: return "LOGICAL UNIT TRANSITIONING TO ANOTHER POWER CONDITION"; + case 0x20: return "EXTENDED COPY INFORMATION AVAILABLE"; + case 0x21: return "ATOMIC COMMAND ABORTED DUE TO ACA"; } + break; case 0x01: switch(ASCQ) { - case 0x00: - return "NO INDEX/SECTOR SIGNAL"; + case 0x00: return "NO INDEX/SECTOR SIGNAL"; } + break; case 0x02: switch(ASCQ) { - case 0x00: - return "NO SEEK COMPLETE"; + case 0x00: return "NO SEEK COMPLETE"; } + break; case 0x03: switch(ASCQ) { - case 0x00: - return "PERIPHERAL DEVICE WRITE FAULT"; - case 0x01: - return "NO WRITE CURRENT"; - case 0x02: - return "EXCESSIVE WRITE ERRORS"; + case 0x00: return "PERIPHERAL DEVICE WRITE FAULT"; + case 0x01: return "NO WRITE CURRENT"; + case 0x02: return "EXCESSIVE WRITE ERRORS"; } + break; case 0x04: switch(ASCQ) { - case 0x00: - return "LOGICAL UNIT NOT READY, CAUSE NOT REPORTABLE"; - case 0x01: - return "LOGICAL UNIT IS IN PROCESS OF BECOMING READY"; - case 0x02: - return "LOGICAL UNIT NOT READY, INITIALIZING COMMAND REQUIRED"; - case 0x03: - return "LOGICAL UNIT NOT READY, MANUAL INTERVENTION REQUIRED"; - case 0x04: - return "LOGICAL UNIT NOT READY, FORMAT IN PROGRESS"; - case 0x05: - return "LOGICAL UNIT NOT READY, REBUILD IN PROGRESS"; - case 0x06: - return "LOGICAL UNIT NOT READY, RECALCULATION IN PROGRESS"; - case 0x07: - return "LOGICAL UNIT NOT READY, OPERATION IN PROGRESS"; - case 0x08: - return "LOGICAL UNIT NOT READY, LONG WRITE IN PROGRESS"; - case 0x09: - return "LOGICAL UNIT NOT READY, SELF-TEST IN PROGRESS"; - case 0x0A: - return "LOGICAL UNIT NOT ACCESSIBLE, ASYMMETRIC ACCESS STATE TRANSITION"; - case 0x0B: - return "LOGICAL UNIT NOT ACCESSIBLE, TARGET IN STANDBY STATE"; - case 0x0C: - return "LOGICAL UNIT NOT ACCESSIBLE, TARGET PORT IN UNAVAILABLE STATE"; - case 0x0D: - return "LOGICAL UNIT NOT READY, STRUCTURE CHECK REQUIRED"; - case 0x0E: - return "LOGICAL UNIT NOT READY, SECURITY SESSION IN PROGRESS"; - case 0x10: - return "LOGICAL UNIT NOT READY, AUXILIARY MEMORY NOT ACCESSIBLE"; - case 0x11: - return "LOGICAL UNIT NOT READY, NOTIFY (ENABLE SPINUP) REQUIRED"; - case 0x12: - return "LOGICAL UNIT NOT READY, OFFLINE"; - case 0x13: - return "LOGICAL UNIT NOT READY, SA CREATION IN PROGRESS"; - case 0x14: - return "LOGICAL UNIT NOT READY, SPACE ALLOCATION IN PROGRESS"; - case 0x15: - return "LOGICAL UNIT NOT READY, ROBOTICS DISABLED"; - case 0x16: - return "LOGICAL UNIT NOT READY, CONFIGURATION REQUIRED"; - case 0x17: - return "LOGICAL UNIT NOT READY, CALIBRATION REQUIRED"; - case 0x18: - return "LOGICAL UNIT NOT READY, A DOOR IS OPEN"; - case 0x19: - return "LOGICAL UNIT NOT READY, OPERATING IN SEQUENTIAL MODE"; - case 0x1A: - return "LOGICAL UNIT NOT READY, START STOP UNIT IN PROGRESS"; - case 0x1B: - return "LOGICAL UNIT NOT READY, SANITIZE IN PROGRESS"; - case 0x1C: - return "LOGICAL UNIT NOT READY, ADDITIONAL POWER USE NOT YET GRANTED"; - case 0x1D: - return "LOGICAL UNIT NOT READY, CONFIGURATION IN PROGRESS"; - case 0x1E: - return "LOGICAL UNIT NOT READY, MICROCODE ACTIVATION REQUIRED"; - case 0x1F: - return "LOGICAL UNIT NOT READY, MICROCODE DOWNLOAD REQUIRED"; - case 0x20: - return "LOGICAL UNIT NOT READY, LOGICAL UNIT RESET REQUIRED"; - case 0x21: - return "LOGICAL UNIT NOT READY, HARD RESET REQUIRED"; - case 0x22: - return "LOGICAL UNIT NOT READY, POWER CYCLE REQUIRED"; + case 0x00: return "LOGICAL UNIT NOT READY, CAUSE NOT REPORTABLE"; + case 0x01: return "LOGICAL UNIT IS IN PROCESS OF BECOMING READY"; + case 0x02: return "LOGICAL UNIT NOT READY, INITIALIZING COMMAND REQUIRED"; + case 0x03: return "LOGICAL UNIT NOT READY, MANUAL INTERVENTION REQUIRED"; + case 0x04: return "LOGICAL UNIT NOT READY, FORMAT IN PROGRESS"; + case 0x05: return "LOGICAL UNIT NOT READY, REBUILD IN PROGRESS"; + case 0x06: return "LOGICAL UNIT NOT READY, RECALCULATION IN PROGRESS"; + case 0x07: return "LOGICAL UNIT NOT READY, OPERATION IN PROGRESS"; + case 0x08: return "LOGICAL UNIT NOT READY, LONG WRITE IN PROGRESS"; + case 0x09: return "LOGICAL UNIT NOT READY, SELF-TEST IN PROGRESS"; + case 0x0A: return "LOGICAL UNIT NOT ACCESSIBLE, ASYMMETRIC ACCESS STATE TRANSITION"; + case 0x0B: return "LOGICAL UNIT NOT ACCESSIBLE, TARGET IN STANDBY STATE"; + case 0x0C: return "LOGICAL UNIT NOT ACCESSIBLE, TARGET PORT IN UNAVAILABLE STATE"; + case 0x0D: return "LOGICAL UNIT NOT READY, STRUCTURE CHECK REQUIRED"; + case 0x0E: return "LOGICAL UNIT NOT READY, SECURITY SESSION IN PROGRESS"; + case 0x10: return "LOGICAL UNIT NOT READY, AUXILIARY MEMORY NOT ACCESSIBLE"; + case 0x11: return "LOGICAL UNIT NOT READY, NOTIFY (ENABLE SPINUP) REQUIRED"; + case 0x12: return "LOGICAL UNIT NOT READY, OFFLINE"; + case 0x13: return "LOGICAL UNIT NOT READY, SA CREATION IN PROGRESS"; + case 0x14: return "LOGICAL UNIT NOT READY, SPACE ALLOCATION IN PROGRESS"; + case 0x15: return "LOGICAL UNIT NOT READY, ROBOTICS DISABLED"; + case 0x16: return "LOGICAL UNIT NOT READY, CONFIGURATION REQUIRED"; + case 0x17: return "LOGICAL UNIT NOT READY, CALIBRATION REQUIRED"; + case 0x18: return "LOGICAL UNIT NOT READY, A DOOR IS OPEN"; + case 0x19: return "LOGICAL UNIT NOT READY, OPERATING IN SEQUENTIAL MODE"; + case 0x1A: return "LOGICAL UNIT NOT READY, START STOP UNIT IN PROGRESS"; + case 0x1B: return "LOGICAL UNIT NOT READY, SANITIZE IN PROGRESS"; + case 0x1C: return "LOGICAL UNIT NOT READY, ADDITIONAL POWER USE NOT YET GRANTED"; + case 0x1D: return "LOGICAL UNIT NOT READY, CONFIGURATION IN PROGRESS"; + case 0x1E: return "LOGICAL UNIT NOT READY, MICROCODE ACTIVATION REQUIRED"; + case 0x1F: return "LOGICAL UNIT NOT READY, MICROCODE DOWNLOAD REQUIRED"; + case 0x20: return "LOGICAL UNIT NOT READY, LOGICAL UNIT RESET REQUIRED"; + case 0x21: return "LOGICAL UNIT NOT READY, HARD RESET REQUIRED"; + case 0x22: return "LOGICAL UNIT NOT READY, POWER CYCLE REQUIRED"; } + break; case 0x05: switch(ASCQ) { - case 0x00: - return "LOGICAL UNIT DOES NOT RESPOND TO SELECTION"; + case 0x00: return "LOGICAL UNIT DOES NOT RESPOND TO SELECTION"; } + break; case 0x06: switch(ASCQ) { - case 0x00: - return "NO REFERENCE POSITION FOUND"; + case 0x00: return "NO REFERENCE POSITION FOUND"; } + break; case 0x07: switch(ASCQ) { - case 0x00: - return "MULTIPLE PERIPHERAL DEVICES SELECTED"; + case 0x00: return "MULTIPLE PERIPHERAL DEVICES SELECTED"; } + break; case 0x08: switch(ASCQ) { - case 0x00: - return "LOGICAL UNIT COMMUNICATION FAILURE"; - case 0x01: - return "LOGICAL UNIT COMMUNICATION TIME-OUT"; - case 0x02: - return "LOGICAL UNIT COMMUNICATION PARITY ERROR"; - case 0x03: - return "LOGICAL UNIT COMMUNICATION CRC ERROR"; - case 0x04: - return "UNREACHABLE COPY TARGET"; + case 0x00: return "LOGICAL UNIT COMMUNICATION FAILURE"; + case 0x01: return "LOGICAL UNIT COMMUNICATION TIME-OUT"; + case 0x02: return "LOGICAL UNIT COMMUNICATION PARITY ERROR"; + case 0x03: return "LOGICAL UNIT COMMUNICATION CRC ERROR"; + case 0x04: return "UNREACHABLE COPY TARGET"; } + break; case 0x09: switch(ASCQ) { - case 0x00: - return "TRACK FLOLLOWING ERROR"; - case 0x01: - return "TRACKING SERVO FAILURE"; - case 0x02: - return "FOCUS SERVO FAILURE"; - case 0x03: - return "SPINDLE SERVO FAILURE"; - case 0x04: - return "HEAD SELECT FAULT"; - case 0x05: - return "VIBRATION INDUCED TRACKING ERROR"; + case 0x00: return "TRACK FLOLLOWING ERROR"; + case 0x01: return "TRACKING SERVO FAILURE"; + case 0x02: return "FOCUS SERVO FAILURE"; + case 0x03: return "SPINDLE SERVO FAILURE"; + case 0x04: return "HEAD SELECT FAULT"; + case 0x05: return "VIBRATION INDUCED TRACKING ERROR"; } + break; case 0x0A: switch(ASCQ) { - case 0x00: - return "ERROR LOG OVERFLOW"; + case 0x00: return "ERROR LOG OVERFLOW"; } + break; case 0x0B: switch(ASCQ) { - case 0x00: - return "WARNING"; - case 0x01: - return "WARNING - SPECIFIED TEMPERATURE EXCEEDED"; - case 0x02: - return "WARNING - ENCLOSURE DEGRADED"; - case 0x03: - return "WARNING - BACKGROUND SELF-TEST FAILED"; - case 0x04: - return "WARNING - BACKGROUND PRE-SCAN DETECTED MEDIUM ERROR"; - case 0x05: - return "WARNING - BACKGROUND MEDIUM SCAN DETECTED MEDIUM ERROR"; - case 0x06: - return "WARNING - NON-VOLATILE CACHE NOW VOLATILE"; - case 0x07: - return "WARNING - DEGRADED POWER TO NON-VOLATILE CACHE"; - case 0x08: - return "WARNING - POWER LOSS EXPECTED"; - case 0x09: - return "WARNING - DEVICE STATISTICS NOTIFICATION ACTIVE"; - case 0x0A: - return "WARNING - HIGH CRITICAL TEMPERATURE LIMIT EXCEEDED"; - case 0x0B: - return "WARNING - LOW CRITICAL TEMPERATURE LIMIT EXCEEDED"; - case 0x0C: - return "WARNING - HIGH OPERATING TEMPERATURE LIMIT EXCEEDED"; - case 0x0D: - return "WARNING - LOW OPERATING TEMPERATURE LIMIT EXCEEDED"; - case 0x0E: - return "WARNING - HIGH CRITICAL HUMIDITY LIMIT EXCEEDED"; - case 0x0F: - return "WARNING - LOW CRITICAL HUMIDITY LIMIT EXCEEDED"; - case 0x10: - return "WARNING - HIGH OPERATING HUMIDITY LIMIT EXCEEDED"; - case 0x11: - return "WARNING - LOW OPERATING HUMIDITY LIMIT EXCEEDED"; - + case 0x00: return "WARNING"; + case 0x01: return "WARNING - SPECIFIED TEMPERATURE EXCEEDED"; + case 0x02: return "WARNING - ENCLOSURE DEGRADED"; + case 0x03: return "WARNING - BACKGROUND SELF-TEST FAILED"; + case 0x04: return "WARNING - BACKGROUND PRE-SCAN DETECTED MEDIUM ERROR"; + case 0x05: return "WARNING - BACKGROUND MEDIUM SCAN DETECTED MEDIUM ERROR"; + case 0x06: return "WARNING - NON-VOLATILE CACHE NOW VOLATILE"; + case 0x07: return "WARNING - DEGRADED POWER TO NON-VOLATILE CACHE"; + case 0x08: return "WARNING - POWER LOSS EXPECTED"; + case 0x09: return "WARNING - DEVICE STATISTICS NOTIFICATION ACTIVE"; + case 0x0A: return "WARNING - HIGH CRITICAL TEMPERATURE LIMIT EXCEEDED"; + case 0x0B: return "WARNING - LOW CRITICAL TEMPERATURE LIMIT EXCEEDED"; + case 0x0C: return "WARNING - HIGH OPERATING TEMPERATURE LIMIT EXCEEDED"; + case 0x0D: return "WARNING - LOW OPERATING TEMPERATURE LIMIT EXCEEDED"; + case 0x0E: return "WARNING - HIGH CRITICAL HUMIDITY LIMIT EXCEEDED"; + case 0x0F: return "WARNING - LOW CRITICAL HUMIDITY LIMIT EXCEEDED"; + case 0x10: return "WARNING - HIGH OPERATING HUMIDITY LIMIT EXCEEDED"; + case 0x11: return "WARNING - LOW OPERATING HUMIDITY LIMIT EXCEEDED"; } + break; case 0x0C: switch(ASCQ) { - case 0x00: - return "WRITE ERROR"; - case 0x01: - return "WRITE ERROR - RECOVERED WITH AUTO REALLOCATION"; - case 0x02: - return "WRITE ERROR - AUTO REALLOCATION FAILED"; - case 0x03: - return "WRITE ERROR - RECOMMENDED REASSIGNMENT"; - case 0x04: - return "COMPRESSION CHECK MISCOMPARE ERROR"; - case 0x05: - return "DATA EXPANSION OCCURRED DURING COMPRESSION"; - case 0x06: - return "BLOCK NOT COMPRESSIBLE"; - case 0x07: - return "WRITE ERROR - RECOVERY NEEDED"; - case 0x08: - return "WRITE ERROR - RECOVERY FAILED"; - case 0x09: - return "WRITE ERROR - LOSS OF STREAMING"; - case 0x0A: - return "WRITE ERROR - PADDING BLOCKS ADDED"; - case 0x0B: - return "AUXILIARY MEMORY WRITE ERROR"; - case 0x0C: - return "WRITE ERROR - UNEXPECTED UNSOLICITED DATA"; - case 0x0D: - return "WRITE ERROR - NOT ENOUGH UNSOLICITED DATA"; - case 0x0E: - return "MULTIPLE WRITE ERRORS"; - case 0x0F: - return "DEFECTS IN ERROR WINDOW"; - case 0x10: - return "INCOMPLETE MULTIPLE ATOMIC WRITE OPERATIONS"; - case 0x11: - return "WRITE ERROR - RECOVERY SCAN NEEDED"; - case 0x12: - return "WRITE ERROR - INSUFFICIENT ZONE RESOURCES"; + case 0x00: return "WRITE ERROR"; + case 0x01: return "WRITE ERROR - RECOVERED WITH AUTO REALLOCATION"; + case 0x02: return "WRITE ERROR - AUTO REALLOCATION FAILED"; + case 0x03: return "WRITE ERROR - RECOMMENDED REASSIGNMENT"; + case 0x04: return "COMPRESSION CHECK MISCOMPARE ERROR"; + case 0x05: return "DATA EXPANSION OCCURRED DURING COMPRESSION"; + case 0x06: return "BLOCK NOT COMPRESSIBLE"; + case 0x07: return "WRITE ERROR - RECOVERY NEEDED"; + case 0x08: return "WRITE ERROR - RECOVERY FAILED"; + case 0x09: return "WRITE ERROR - LOSS OF STREAMING"; + case 0x0A: return "WRITE ERROR - PADDING BLOCKS ADDED"; + case 0x0B: return "AUXILIARY MEMORY WRITE ERROR"; + case 0x0C: return "WRITE ERROR - UNEXPECTED UNSOLICITED DATA"; + case 0x0D: return "WRITE ERROR - NOT ENOUGH UNSOLICITED DATA"; + case 0x0E: return "MULTIPLE WRITE ERRORS"; + case 0x0F: return "DEFECTS IN ERROR WINDOW"; + case 0x10: return "INCOMPLETE MULTIPLE ATOMIC WRITE OPERATIONS"; + case 0x11: return "WRITE ERROR - RECOVERY SCAN NEEDED"; + case 0x12: return "WRITE ERROR - INSUFFICIENT ZONE RESOURCES"; } + break; case 0x0D: switch(ASCQ) { - case 0x00: - return "ERROR DETECTED BY THIRD PARTY TEMPORARY INITIATOR"; - case 0x01: - return "THIRD PARTY DEVICE FAILURE"; - case 0x02: - return "COPY TARGET DEVICE NOT REACHABLE"; - case 0x03: - return "INCORRECT COPY TARGET DEVICE TYPE"; - case 0x04: - return "COPY TARGET DEVICE DATA UNDERRUN"; - case 0x05: - return "COPY TARGET DEVICE DATA OVERRUN"; + case 0x00: return "ERROR DETECTED BY THIRD PARTY TEMPORARY INITIATOR"; + case 0x01: return "THIRD PARTY DEVICE FAILURE"; + case 0x02: return "COPY TARGET DEVICE NOT REACHABLE"; + case 0x03: return "INCORRECT COPY TARGET DEVICE TYPE"; + case 0x04: return "COPY TARGET DEVICE DATA UNDERRUN"; + case 0x05: return "COPY TARGET DEVICE DATA OVERRUN"; } + break; case 0x0E: switch(ASCQ) { - case 0x00: - return "INVALID INFORMATION UNIT"; - case 0x01: - return "INFORMATION UNIT TOO SHORT"; - case 0x02: - return "INFORMATION UNIT TOO LONG"; - case 0x03: - return "INVALID FIELD IN COMMAND INFORMATION UNIT"; + case 0x00: return "INVALID INFORMATION UNIT"; + case 0x01: return "INFORMATION UNIT TOO SHORT"; + case 0x02: return "INFORMATION UNIT TOO LONG"; + case 0x03: return "INVALID FIELD IN COMMAND INFORMATION UNIT"; } + break; case 0x10: switch(ASCQ) { - case 0x00: - return "ID CRC OR ECC ERROR"; - case 0x01: - return "LOGICAL BLOCK GUARD CHECK FAILED"; - case 0x02: - return "LOGICAL BLOCK APPLICATION TAG CHECK FAILED"; - case 0x03: - return "LOGICAL BLOCK REFERENCE TAG CHECK FAILED"; - case 0x04: - return "LOGICAL BLOCK PROTECTION ERROR ON RECOVER BUFFERED DATA"; - case 0x05: - return "LOGICAL BLOCK PROTECTION METHOD ERROR"; + case 0x00: return "ID CRC OR ECC ERROR"; + case 0x01: return "LOGICAL BLOCK GUARD CHECK FAILED"; + case 0x02: return "LOGICAL BLOCK APPLICATION TAG CHECK FAILED"; + case 0x03: return "LOGICAL BLOCK REFERENCE TAG CHECK FAILED"; + case 0x04: return "LOGICAL BLOCK PROTECTION ERROR ON RECOVER BUFFERED DATA"; + case 0x05: return "LOGICAL BLOCK PROTECTION METHOD ERROR"; } + break; case 0x11: switch(ASCQ) { - case 0x00: - return "UNRECOVERED READ ERROR"; - case 0x01: - return "READ RETRIES EXHAUSTED"; - case 0x02: - return "ERROR TOO LONG TO CORRECT"; - case 0x03: - return "MULTIPLE READ ERRORS"; - case 0x04: - return "UNRECOVERED READ ERROR - AUTO REALLOCATE FAILED"; - case 0x05: - return "L-EC UNCORRECTABLE ERROR"; - case 0x06: - return "CIRC UNRECOVERED ERROR"; - case 0x07: - return "DATA RESYNCHRONIZATION ERROR"; - case 0x08: - return "INCOMPLETE BLOCK READ"; - case 0x09: - return "NO GAP FOUND"; - case 0x0A: - return "MISCORRECTED ERROR"; - case 0x0B: - return "UNRECOVERED READ ERROR - RECOMMENDED REASSIGNMENT"; - case 0x0C: - return "UNRECOVERED READ ERROR - RECOMMENDED REWRITE THE DATA"; - case 0x0D: - return "DE-COMPRESSION CRC ERROR"; - case 0x0E: - return "CANNOT DECOMPRESS USING DECLARED ALGORITHM"; - case 0x0F: - return "ERROR READING UPC/EAN NUMBER"; - case 0x10: - return "ERROR READING ISRC NUMBER"; - case 0x11: - return "READ ERROR - LOSS OF STREAMING"; - case 0x12: - return "AUXILIARY MEMORY READ ERROR"; - case 0x13: - return "READ ERROR - FAILED RETRANSMISSITION REQUEST"; - case 0x14: - return "READ ERROR - LBA MARKED BAD BY APPLICATION CLIENT"; - case 0x15: - return "WRITE AFTER SANITIZE REQUIRED"; + case 0x00: return "UNRECOVERED READ ERROR"; + case 0x01: return "READ RETRIES EXHAUSTED"; + case 0x02: return "ERROR TOO LONG TO CORRECT"; + case 0x03: return "MULTIPLE READ ERRORS"; + case 0x04: return "UNRECOVERED READ ERROR - AUTO REALLOCATE FAILED"; + case 0x05: return "L-EC UNCORRECTABLE ERROR"; + case 0x06: return "CIRC UNRECOVERED ERROR"; + case 0x07: return "DATA RESYNCHRONIZATION ERROR"; + case 0x08: return "INCOMPLETE BLOCK READ"; + case 0x09: return "NO GAP FOUND"; + case 0x0A: return "MISCORRECTED ERROR"; + case 0x0B: return "UNRECOVERED READ ERROR - RECOMMENDED REASSIGNMENT"; + case 0x0C: return "UNRECOVERED READ ERROR - RECOMMENDED REWRITE THE DATA"; + case 0x0D: return "DE-COMPRESSION CRC ERROR"; + case 0x0E: return "CANNOT DECOMPRESS USING DECLARED ALGORITHM"; + case 0x0F: return "ERROR READING UPC/EAN NUMBER"; + case 0x10: return "ERROR READING ISRC NUMBER"; + case 0x11: return "READ ERROR - LOSS OF STREAMING"; + case 0x12: return "AUXILIARY MEMORY READ ERROR"; + case 0x13: return "READ ERROR - FAILED RETRANSMISSITION REQUEST"; + case 0x14: return "READ ERROR - LBA MARKED BAD BY APPLICATION CLIENT"; + case 0x15: return "WRITE AFTER SANITIZE REQUIRED"; } + break; case 0x12: switch(ASCQ) { - case 0x00: - return "ADDRESS MARK NOT FOUND FOR ID FIELD"; + case 0x00: return "ADDRESS MARK NOT FOUND FOR ID FIELD"; } + break; case 0x13: switch(ASCQ) { - case 0x00: - return "ADDRESS MARK NOT FOUND FOR DATA FIELD"; + case 0x00: return "ADDRESS MARK NOT FOUND FOR DATA FIELD"; } + break; case 0x14: switch(ASCQ) { - case 0x00: - return "RECORDED ENTITY NOT FOUND"; - case 0x01: - return "RECORD NOT FOUND"; - case 0x02: - return "FILEMARK OR SETMARK NOT FOUND"; - case 0x03: - return "END-OF-DATA NOT FOUND"; - case 0x04: - return "BLOCK SEQUENCE ERROR"; - case 0x05: - return "RECORD NOT FOUND - RECOMMENDAD REASSIGNMENT"; - case 0x06: - return "RECORD NOT FOUND - DATA AUTO-REALLOCATED"; - case 0x07: - return "LOCATE OPERATION FAILURE"; + case 0x00: return "RECORDED ENTITY NOT FOUND"; + case 0x01: return "RECORD NOT FOUND"; + case 0x02: return "FILEMARK OR SETMARK NOT FOUND"; + case 0x03: return "END-OF-DATA NOT FOUND"; + case 0x04: return "BLOCK SEQUENCE ERROR"; + case 0x05: return "RECORD NOT FOUND - RECOMMENDAD REASSIGNMENT"; + case 0x06: return "RECORD NOT FOUND - DATA AUTO-REALLOCATED"; + case 0x07: return "LOCATE OPERATION FAILURE"; } + break; case 0x15: switch(ASCQ) { - case 0x00: - return "RANDOM POSITIONING ERROR"; - case 0x01: - return "MECHANICAL POSITIONING ERROR"; - case 0x02: - return "POSITIONING ERROR DETECTED BY READ OF MEDIUM"; + case 0x00: return "RANDOM POSITIONING ERROR"; + case 0x01: return "MECHANICAL POSITIONING ERROR"; + case 0x02: return "POSITIONING ERROR DETECTED BY READ OF MEDIUM"; } + break; case 0x16: switch(ASCQ) { - case 0x00: - return "DATA SYNCHRONIZATION MARK ERROR"; - case 0x01: - return "DATA SYNC ERROR - DATA REWRITTEN"; - case 0x02: - return "DATA SYNC ERROR - RECOMMENDED REWRITE"; - case 0x03: - return "DATA SYNC ERROR - DATA AUTO-REALLOCATED"; - case 0x04: - return "DATA SYNC ERROR - RECOMMENDED REASSIGNMENT"; + case 0x00: return "DATA SYNCHRONIZATION MARK ERROR"; + case 0x01: return "DATA SYNC ERROR - DATA REWRITTEN"; + case 0x02: return "DATA SYNC ERROR - RECOMMENDED REWRITE"; + case 0x03: return "DATA SYNC ERROR - DATA AUTO-REALLOCATED"; + case 0x04: return "DATA SYNC ERROR - RECOMMENDED REASSIGNMENT"; } + break; case 0x17: switch(ASCQ) { - case 0x00: - return "RECOVERED DATA WITH NO ERROR CORRECTION APPLIED"; - case 0x01: - return "RECOVERED DATA WITH RETRIES"; - case 0x02: - return "RECOVERED DATA WITH POSITIVE HEAD OFFSET"; - case 0x03: - return "RECOVERED DATA WITH NEGATIVE HEAD OFFSET"; - case 0x04: - return "RECOVERED DATA WITH RETRIES AND/OR CIRC APPLIED"; - case 0x05: - return "RECOVERED DATA USING PREVIOUS SECTOR ID"; - case 0x06: - return "RECOVERED DATA WITHOUT ECC - DATA AUTO-REALLOCATED"; - case 0x07: - return "RECOVERED DATA WITHOUT ECC - RECOMMENDED REASSIGNMENT"; - case 0x08: - return "RECOVERED DATA WITHOUT ECC - RECOMMENDED REWRITE"; - case 0x09: - return "RECOVERED DATA WITHOUT ECC - DATA REWRITTEN"; + case 0x00: return "RECOVERED DATA WITH NO ERROR CORRECTION APPLIED"; + case 0x01: return "RECOVERED DATA WITH RETRIES"; + case 0x02: return "RECOVERED DATA WITH POSITIVE HEAD OFFSET"; + case 0x03: return "RECOVERED DATA WITH NEGATIVE HEAD OFFSET"; + case 0x04: return "RECOVERED DATA WITH RETRIES AND/OR CIRC APPLIED"; + case 0x05: return "RECOVERED DATA USING PREVIOUS SECTOR ID"; + case 0x06: return "RECOVERED DATA WITHOUT ECC - DATA AUTO-REALLOCATED"; + case 0x07: return "RECOVERED DATA WITHOUT ECC - RECOMMENDED REASSIGNMENT"; + case 0x08: return "RECOVERED DATA WITHOUT ECC - RECOMMENDED REWRITE"; + case 0x09: return "RECOVERED DATA WITHOUT ECC - DATA REWRITTEN"; } + break; case 0x18: switch(ASCQ) { - case 0x00: - return "RECOVERED DATA WITH ERROR CORRECTION APPLIED"; - case 0x01: - return "RECOVERED DATA WITH ERROR CORRECTION & RETRIES APPLIED"; - case 0x02: - return "RECOVERED DATA - DATA AUTO-REALLOCATED"; - case 0x03: - return "RECOVERED DATA WITH CIRC"; - case 0x04: - return "RECOVERED DATA WITH L-EC"; - case 0x05: - return "RECOVERED DATA - RECOMMENDED REASSIGNMENT"; - case 0x06: - return "RECOVERED DATA - RECOMMENDED REWRITE"; - case 0x07: - return "RECOVERED DATA WITH ECC - DATA REWRITTEN"; - case 0x08: - return "RECOVERED DATA WITH LINKING"; + case 0x00: return "RECOVERED DATA WITH ERROR CORRECTION APPLIED"; + case 0x01: return "RECOVERED DATA WITH ERROR CORRECTION & RETRIES APPLIED"; + case 0x02: return "RECOVERED DATA - DATA AUTO-REALLOCATED"; + case 0x03: return "RECOVERED DATA WITH CIRC"; + case 0x04: return "RECOVERED DATA WITH L-EC"; + case 0x05: return "RECOVERED DATA - RECOMMENDED REASSIGNMENT"; + case 0x06: return "RECOVERED DATA - RECOMMENDED REWRITE"; + case 0x07: return "RECOVERED DATA WITH ECC - DATA REWRITTEN"; + case 0x08: return "RECOVERED DATA WITH LINKING"; } + break; case 0x19: switch(ASCQ) { - case 0x00: - return "DEFECT LIST ERROR"; - case 0x01: - return "DEFECT LIST NOT AVAILABLE"; - case 0x02: - return "DEFECT LIST ERROR IN PRIMARY LIST"; - case 0x03: - return "DEFECT LIST ERROR IN GROWN LIST"; + case 0x00: return "DEFECT LIST ERROR"; + case 0x01: return "DEFECT LIST NOT AVAILABLE"; + case 0x02: return "DEFECT LIST ERROR IN PRIMARY LIST"; + case 0x03: return "DEFECT LIST ERROR IN GROWN LIST"; } + break; case 0x1A: switch(ASCQ) { - case 0x00: - return "PARAMETER LIST LENGTH ERROR"; + case 0x00: return "PARAMETER LIST LENGTH ERROR"; } + break; case 0x1B: switch(ASCQ) { - case 0x00: - return "SYNCHRONOUS DATA TRANSFER ERROR"; + case 0x00: return "SYNCHRONOUS DATA TRANSFER ERROR"; } + break; case 0x1C: switch(ASCQ) { - case 0x00: - return "DEFECT LIST NOT FOUND"; - case 0x01: - return "PRIMARY DEFECT LIST NOT FOUND"; - case 0x02: - return "GROWN DEFECT LIST NOT FOUND"; + case 0x00: return "DEFECT LIST NOT FOUND"; + case 0x01: return "PRIMARY DEFECT LIST NOT FOUND"; + case 0x02: return "GROWN DEFECT LIST NOT FOUND"; } + break; case 0x1D: switch(ASCQ) { - case 0x00: - return "MISCOMPARE DURING VERIFY OPERATION"; - case 0x01: - return "MISCOMPARE VERIFY OF UNMAPPED LBA"; + case 0x00: return "MISCOMPARE DURING VERIFY OPERATION"; + case 0x01: return "MISCOMPARE VERIFY OF UNMAPPED LBA"; } + break; case 0x1E: switch(ASCQ) { - case 0x00: - return "RECOVERED ID WITH ECC CORRECTION"; + case 0x00: return "RECOVERED ID WITH ECC CORRECTION"; } + break; case 0x1F: switch(ASCQ) { - case 0x00: - return "PARTIAL DEFECT LIST TRANSFER"; + case 0x00: return "PARTIAL DEFECT LIST TRANSFER"; } + break; case 0x20: switch(ASCQ) { - case 0x00: - return "INVALID COMMAND OPERATION CODE"; - case 0x01: - return "ACCESS DENIED - INITIATOR PENDING-ENROLLED"; - case 0x02: - return "ACCESS DENIED - NO ACCESS RIGHTS"; - case 0x03: - return "ACCESS DENIED - INVALID MGMT ID KEY"; - case 0x04: - return "ILLEGAL COMMAND WHILE IN WRITE CAPABLE STATE"; - case 0x05: - return "ILLEGAL COMMAND WHILE IN READ CAPABLE STATE"; - case 0x06: - return "ILLEGAL COMMAND WHILE IN EXPLICIT ADDRESS MODE"; - case 0x07: - return "ILLEGAL COMMAND WHILE IN IMPLICIT ADDRESS MODE"; - case 0x08: - return "ACCESS DENIED - ENROLLMENT CONFLICT"; - case 0x09: - return "ACCESS DENIED - INVALID LUN IDENTIFIER"; - case 0x0A: - return "ACCESS DENIED - INVALID PROXY TOKEN"; - case 0x0B: - return "ACCESS DENIED - ACL LUN CONFLICT"; - case 0x0C: - return "ILLEGAL COMMAND WHEN NOT IN APPEND-ONLY MODE"; + case 0x00: return "INVALID COMMAND OPERATION CODE"; + case 0x01: return "ACCESS DENIED - INITIATOR PENDING-ENROLLED"; + case 0x02: return "ACCESS DENIED - NO ACCESS RIGHTS"; + case 0x03: return "ACCESS DENIED - INVALID MGMT ID KEY"; + case 0x04: return "ILLEGAL COMMAND WHILE IN WRITE CAPABLE STATE"; + case 0x05: return "ILLEGAL COMMAND WHILE IN READ CAPABLE STATE"; + case 0x06: return "ILLEGAL COMMAND WHILE IN EXPLICIT ADDRESS MODE"; + case 0x07: return "ILLEGAL COMMAND WHILE IN IMPLICIT ADDRESS MODE"; + case 0x08: return "ACCESS DENIED - ENROLLMENT CONFLICT"; + case 0x09: return "ACCESS DENIED - INVALID LUN IDENTIFIER"; + case 0x0A: return "ACCESS DENIED - INVALID PROXY TOKEN"; + case 0x0B: return "ACCESS DENIED - ACL LUN CONFLICT"; + case 0x0C: return "ILLEGAL COMMAND WHEN NOT IN APPEND-ONLY MODE"; } + break; case 0x21: switch(ASCQ) { - case 0x00: - return "LOGICAL BLOCK ADDRESS OUT OF RANGE"; - case 0x01: - return "INVALID ELEMENT ADDRESS"; - case 0x02: - return "INVALID ADDRESS FOR WRITE"; - case 0x03: - return "INVALID WRITE CROSSING LAYER JUMP"; - case 0x04: - return "UNALIGNED WRITE COMMAND"; - case 0x05: - return "WRITE BOUNDARY VIOLATION"; - case 0x06: - return "ATTEMPT TO READ INVALID DATA"; - case 0x07: - return "READ BOUNDARY VIOLATION"; + case 0x00: return "LOGICAL BLOCK ADDRESS OUT OF RANGE"; + case 0x01: return "INVALID ELEMENT ADDRESS"; + case 0x02: return "INVALID ADDRESS FOR WRITE"; + case 0x03: return "INVALID WRITE CROSSING LAYER JUMP"; + case 0x04: return "UNALIGNED WRITE COMMAND"; + case 0x05: return "WRITE BOUNDARY VIOLATION"; + case 0x06: return "ATTEMPT TO READ INVALID DATA"; + case 0x07: return "READ BOUNDARY VIOLATION"; } + break; case 0x22: switch(ASCQ) { - case 0x00: - return "ILLEGAL FUNCTION"; + case 0x00: return "ILLEGAL FUNCTION"; } + break; case 0x23: switch(ASCQ) { - case 0x00: - return "INVALID TOKEN OPERATION, CAUSE NOT REPORTABLE"; - case 0x01: - return "INVALID TOKEN OPERATION, UNSUPPORTED TOKEN TYPE"; - case 0x02: - return "INVALID TOKEN OPERATION, REMOTE TOKEN USAGE NOT SUPPORTED"; - case 0x03: - return "INVALID TOKEN OPERATION, REMOTE ROD TOKEN CREATION NOT SUPPORTED"; - case 0x04: - return "INVALID TOKEN OPERATION, TOKEN UNKNOWN"; - case 0x05: - return "INVALID TOKEN OPERATION, TOKEN CORRUPT"; - case 0x06: - return "INVALID TOKEN OPERATION, TOKEN REVOKED"; - case 0x07: - return "INVALID TOKEN OPERATION, TOKEN EXPIRED"; - case 0x08: - return "INVALID TOKEN OPERATION, TOKEN CANCELLED"; - case 0x09: - return "INVALID TOKEN OPERATION, TOKEN DELETED"; - case 0x0A: - return "INVALID TOKEN OPERATION, INVALID TOKEN LENGTH"; + case 0x00: return "INVALID TOKEN OPERATION, CAUSE NOT REPORTABLE"; + case 0x01: return "INVALID TOKEN OPERATION, UNSUPPORTED TOKEN TYPE"; + case 0x02: return "INVALID TOKEN OPERATION, REMOTE TOKEN USAGE NOT SUPPORTED"; + case 0x03: return "INVALID TOKEN OPERATION, REMOTE ROD TOKEN CREATION NOT SUPPORTED"; + case 0x04: return "INVALID TOKEN OPERATION, TOKEN UNKNOWN"; + case 0x05: return "INVALID TOKEN OPERATION, TOKEN CORRUPT"; + case 0x06: return "INVALID TOKEN OPERATION, TOKEN REVOKED"; + case 0x07: return "INVALID TOKEN OPERATION, TOKEN EXPIRED"; + case 0x08: return "INVALID TOKEN OPERATION, TOKEN CANCELLED"; + case 0x09: return "INVALID TOKEN OPERATION, TOKEN DELETED"; + case 0x0A: return "INVALID TOKEN OPERATION, INVALID TOKEN LENGTH"; } + break; case 0x24: switch(ASCQ) { - case 0x00: - return "ILLEGAL FIELD IN CDB"; - case 0x01: - return "CDB DECRYPTION ERROR"; - case 0x02: - return "INVALID CDB FIELD WHILE IN EXPLICIT BLOCK ADDRESS MODEL"; - case 0x03: - return "INVALID CDB FIELD WHILE IN IMPLICIT BLOCK ADDRESS MODEL"; - case 0x04: - return "SECURITY AUDIT VALUE FROZEN"; - case 0x05: - return "SECURITY WORKING KEY FROZEN"; - case 0x06: - return "NONCE NOT UNIQUE"; - case 0x07: - return "NONCE TIMESTAMP OUT OF RANGE"; - case 0x08: - return "INVALID XCDB"; + case 0x00: return "ILLEGAL FIELD IN CDB"; + case 0x01: return "CDB DECRYPTION ERROR"; + case 0x02: return "INVALID CDB FIELD WHILE IN EXPLICIT BLOCK ADDRESS MODEL"; + case 0x03: return "INVALID CDB FIELD WHILE IN IMPLICIT BLOCK ADDRESS MODEL"; + case 0x04: return "SECURITY AUDIT VALUE FROZEN"; + case 0x05: return "SECURITY WORKING KEY FROZEN"; + case 0x06: return "NONCE NOT UNIQUE"; + case 0x07: return "NONCE TIMESTAMP OUT OF RANGE"; + case 0x08: return "INVALID XCDB"; } + break; case 0x25: switch(ASCQ) { - case 0x00: - return "LOGICAL UNIT NOT SUPPORTED"; + case 0x00: return "LOGICAL UNIT NOT SUPPORTED"; } + break; case 0x26: switch(ASCQ) { - case 0x00: - return "INVALID FIELD IN PARAMETER LIST"; - case 0x01: - return "PARAMETER NOT SUPPORTED"; - case 0x02: - return "PARAMETER VALUE INVALID"; - case 0x03: - return "THRESHOLD PARAMETERS NOT SUPPORTED"; - case 0x04: - return "INVALID RELEASE OF PERSISTENT RESERVATION"; - case 0x05: - return "DATA DECRYPTION ERROR"; - case 0x06: - return "TOO MANY TARGET DESCRIPTORS"; - case 0x07: - return "UNSUPPORTED TARGET DESCRIPTOR TYPE CODE"; - case 0x08: - return "TOO MANY SEGMENT DESCRIPTORS"; - case 0x09: - return "UNSUPPORTED SEGMENT DESCRIPTOR TYPE CODE"; - case 0x0A: - return "UNEXPECTED INEXACT SEGMENT"; - case 0x0B: - return "INLINE DATA LENGTH EXCEEDED"; - case 0x0C: - return "INVALID OPERATION FOR COPY SOURCE OR DESTINATION"; - case 0x0D: - return "COPY SEGMENT GRANULARITY VIOLATION"; - case 0x0E: - return "INVALID PARAMETER WHILE PORT IS ENABLED"; - case 0x0F: - return "INVALID DATA-OUT BUFFER INTEGRITY CHECK VALUE"; - case 0x10: - return "DATA DECRYPTION KEY FAIL LIMIT REACHED"; - case 0x11: - return "INCOMPLETE KEY-ASSOCIATED DATA SET"; - case 0x12: - return "VENDOR SPECIFIC KEY REFERENCE NOT FOUND"; - case 0x13: - return "APPLICATION TAG MODE PAGE IS INVALID"; + case 0x00: return "INVALID FIELD IN PARAMETER LIST"; + case 0x01: return "PARAMETER NOT SUPPORTED"; + case 0x02: return "PARAMETER VALUE INVALID"; + case 0x03: return "THRESHOLD PARAMETERS NOT SUPPORTED"; + case 0x04: return "INVALID RELEASE OF PERSISTENT RESERVATION"; + case 0x05: return "DATA DECRYPTION ERROR"; + case 0x06: return "TOO MANY TARGET DESCRIPTORS"; + case 0x07: return "UNSUPPORTED TARGET DESCRIPTOR TYPE CODE"; + case 0x08: return "TOO MANY SEGMENT DESCRIPTORS"; + case 0x09: return "UNSUPPORTED SEGMENT DESCRIPTOR TYPE CODE"; + case 0x0A: return "UNEXPECTED INEXACT SEGMENT"; + case 0x0B: return "INLINE DATA LENGTH EXCEEDED"; + case 0x0C: return "INVALID OPERATION FOR COPY SOURCE OR DESTINATION"; + case 0x0D: return "COPY SEGMENT GRANULARITY VIOLATION"; + case 0x0E: return "INVALID PARAMETER WHILE PORT IS ENABLED"; + case 0x0F: return "INVALID DATA-OUT BUFFER INTEGRITY CHECK VALUE"; + case 0x10: return "DATA DECRYPTION KEY FAIL LIMIT REACHED"; + case 0x11: return "INCOMPLETE KEY-ASSOCIATED DATA SET"; + case 0x12: return "VENDOR SPECIFIC KEY REFERENCE NOT FOUND"; + case 0x13: return "APPLICATION TAG MODE PAGE IS INVALID"; } + break; case 0x27: switch(ASCQ) { - case 0x00: - return "WRITE PROTECTED"; - case 0x01: - return "HARDWARE WRITE PROTECTED"; - case 0x02: - return "LOGICAL UNIT SOFTWARE WRITE PROTECTED"; - case 0x03: - return "ASSOCIATED WRITE PROTECT"; - case 0x04: - return "PERSISTENT WRITE PROTECT"; - case 0x05: - return "PERMANENT WRITE PROTECT"; - case 0x06: - return "CONDITIONAL WRITE PROTECT"; - case 0x07: - return "SPACE ALLOCATION FAILED WRITE PROTECT"; - case 0x08: - return "ZONE IS READ ONLY"; + case 0x00: return "WRITE PROTECTED"; + case 0x01: return "HARDWARE WRITE PROTECTED"; + case 0x02: return "LOGICAL UNIT SOFTWARE WRITE PROTECTED"; + case 0x03: return "ASSOCIATED WRITE PROTECT"; + case 0x04: return "PERSISTENT WRITE PROTECT"; + case 0x05: return "PERMANENT WRITE PROTECT"; + case 0x06: return "CONDITIONAL WRITE PROTECT"; + case 0x07: return "SPACE ALLOCATION FAILED WRITE PROTECT"; + case 0x08: return "ZONE IS READ ONLY"; } + break; case 0x28: switch(ASCQ) { - case 0x00: - return "NOT READY TO READY CHANGE (MEDIUM MAY HAVE CHANGED)"; - case 0x01: - return "IMPORT OR EXPORT ELEMENT ACCESSED"; - case 0x02: - return "FORMAT-LAYER MAY HAVE CHANGED"; - case 0x03: - return "IMPORT/EXPORT ELEMENT ACCESSED, MEDIUM CHANGED"; + case 0x00: return "NOT READY TO READY CHANGE (MEDIUM MAY HAVE CHANGED)"; + case 0x01: return "IMPORT OR EXPORT ELEMENT ACCESSED"; + case 0x02: return "FORMAT-LAYER MAY HAVE CHANGED"; + case 0x03: return "IMPORT/EXPORT ELEMENT ACCESSED, MEDIUM CHANGED"; } + break; case 0x29: switch(ASCQ) { - case 0x00: - return "POWER ON, RESET, OR BUS DEVICE RESET OCCURRED"; - case 0x01: - return "POWER ON OCCURRED"; - case 0x02: - return "SCSI BUS RESET OCCURRED"; - case 0x03: - return "BUS DEVICE RESET FUNCTION OCCURRED"; - case 0x04: - return "DEVICE INTERNAL RESET"; - case 0x05: - return "TRANSCEIVER MODE CHANGED TO SINGLE-ENDED"; - case 0x06: - return "TRANSCEIVER MODE CHANGED TO LVD"; - case 0x07: - return "I_T NEXUS LOSS OCCURRED"; + case 0x00: return "POWER ON, RESET, OR BUS DEVICE RESET OCCURRED"; + case 0x01: return "POWER ON OCCURRED"; + case 0x02: return "SCSI BUS RESET OCCURRED"; + case 0x03: return "BUS DEVICE RESET FUNCTION OCCURRED"; + case 0x04: return "DEVICE INTERNAL RESET"; + case 0x05: return "TRANSCEIVER MODE CHANGED TO SINGLE-ENDED"; + case 0x06: return "TRANSCEIVER MODE CHANGED TO LVD"; + case 0x07: return "I_T NEXUS LOSS OCCURRED"; } + break; case 0x2A: switch(ASCQ) { - case 0x00: - return "PARAMETERS CHANGED"; - case 0x01: - return "MODE PARAMETERS CHANGED"; - case 0x02: - return "LOG PARAMETERS CHANGED"; - case 0x03: - return "RESERVATIONS PREEMPTED"; - case 0x04: - return "RESERVATIONS RELEASED"; - case 0x05: - return "REGISTRATIONS PREEMPTED"; - case 0x06: - return "ASYMMETRIC ACCESS STATE CHANGED"; - case 0x07: - return "IMPLICIT ASYMMETRIC ACCESS STATE TRANSITION FAILED"; - case 0x08: - return "PRIORITY CHANGED"; - case 0x09: - return "CAPACITY DATA HAS CHANGED"; - case 0x0A: - return "ERROR HISTORY I_T NEXUS CLEARED"; - case 0x0B: - return "ERROR HISTORY SNAPSHOT RELEASED"; - case 0x0C: - return "ERROR RECOVERY ATTRIBUTES HAVE CHANGED"; - case 0x0D: - return "DATA ENCRYPTION CAPABILITIES CHANGED"; - case 0x10: - return "TIMESTAMP CHANGED"; - case 0x11: - return "DATA ENCRYPTION PARAMETERS CHANGED BY ANOTHER I_T NEXUS"; - case 0x12: - return "DATA ENCRYPTION PARAMETERS CHANGED BY VENDOR SPECIFIC EVENT"; - case 0x13: - return "DATA ENCRYPTION KEY INSTANCE COUNTER HAS CHANGED"; - case 0x14: - return "SA CREATION CAPABILITIES DATA HAS CHANGED"; - case 0x15: - return "MEDIUM REMOVAL PREVENTION PREEMPTED"; + case 0x00: return "PARAMETERS CHANGED"; + case 0x01: return "MODE PARAMETERS CHANGED"; + case 0x02: return "LOG PARAMETERS CHANGED"; + case 0x03: return "RESERVATIONS PREEMPTED"; + case 0x04: return "RESERVATIONS RELEASED"; + case 0x05: return "REGISTRATIONS PREEMPTED"; + case 0x06: return "ASYMMETRIC ACCESS STATE CHANGED"; + case 0x07: return "IMPLICIT ASYMMETRIC ACCESS STATE TRANSITION FAILED"; + case 0x08: return "PRIORITY CHANGED"; + case 0x09: return "CAPACITY DATA HAS CHANGED"; + case 0x0A: return "ERROR HISTORY I_T NEXUS CLEARED"; + case 0x0B: return "ERROR HISTORY SNAPSHOT RELEASED"; + case 0x0C: return "ERROR RECOVERY ATTRIBUTES HAVE CHANGED"; + case 0x0D: return "DATA ENCRYPTION CAPABILITIES CHANGED"; + case 0x10: return "TIMESTAMP CHANGED"; + case 0x11: return "DATA ENCRYPTION PARAMETERS CHANGED BY ANOTHER I_T NEXUS"; + case 0x12: return "DATA ENCRYPTION PARAMETERS CHANGED BY VENDOR SPECIFIC EVENT"; + case 0x13: return "DATA ENCRYPTION KEY INSTANCE COUNTER HAS CHANGED"; + case 0x14: return "SA CREATION CAPABILITIES DATA HAS CHANGED"; + case 0x15: return "MEDIUM REMOVAL PREVENTION PREEMPTED"; } + break; case 0x2B: switch(ASCQ) { - case 0x00: - return "COPY CANNOT EXECUTE SINCE HOST CANNOT DISCONNECT"; + case 0x00: return "COPY CANNOT EXECUTE SINCE HOST CANNOT DISCONNECT"; } + break; case 0x2C: switch(ASCQ) { - case 0x00: - return "COMMAND SEQUENCE ERROR"; - case 0x01: - return "TOO MANY WINDOWS SPECIFIED"; - case 0x02: - return "INVALID COMBINATION OF WINDOWS SPECIFIED"; - case 0x03: - return "CURRENT PROGRAM AREA IS NOT EMPTY"; - case 0x04: - return "CURRENT PROGRAM AREA IS EMPTY"; - case 0x05: - return "ILLEGAL POWER CONDITION REQUEST"; - case 0x06: - return "PERSISTENT PREVENT CONFLICT"; - case 0x07: - return "PREVIOUS BUSY STATUS"; - case 0x08: - return "PREVIOUS TASK SET FULL STATUS"; - case 0x09: - return "PREVIOUS RESERVATION CONFLICT STATUS"; - case 0x0A: - return "PARTITION OR COLLECTION CONTAINS USER OBJECTS"; - case 0x0B: - return "NOT RESERVED"; - case 0x0C: - return "ORWRITE GENERATION DOES NOT MATCH"; - case 0x0D: - return "RESET WRITE POINTER NOT ALLOWED"; - case 0x0E: - return "ZONE IS OFFLINE"; - case 0x0F: - return "STREAM NOT OPEN"; - case 0x10: - return "UNWRITTEN DATA IN ZONE"; + case 0x00: return "COMMAND SEQUENCE ERROR"; + case 0x01: return "TOO MANY WINDOWS SPECIFIED"; + case 0x02: return "INVALID COMBINATION OF WINDOWS SPECIFIED"; + case 0x03: return "CURRENT PROGRAM AREA IS NOT EMPTY"; + case 0x04: return "CURRENT PROGRAM AREA IS EMPTY"; + case 0x05: return "ILLEGAL POWER CONDITION REQUEST"; + case 0x06: return "PERSISTENT PREVENT CONFLICT"; + case 0x07: return "PREVIOUS BUSY STATUS"; + case 0x08: return "PREVIOUS TASK SET FULL STATUS"; + case 0x09: return "PREVIOUS RESERVATION CONFLICT STATUS"; + case 0x0A: return "PARTITION OR COLLECTION CONTAINS USER OBJECTS"; + case 0x0B: return "NOT RESERVED"; + case 0x0C: return "ORWRITE GENERATION DOES NOT MATCH"; + case 0x0D: return "RESET WRITE POINTER NOT ALLOWED"; + case 0x0E: return "ZONE IS OFFLINE"; + case 0x0F: return "STREAM NOT OPEN"; + case 0x10: return "UNWRITTEN DATA IN ZONE"; } + break; case 0x2D: switch(ASCQ) { - case 0x00: - return "OVERWRITE ERROR ON UPDATE IN PLACE"; + case 0x00: return "OVERWRITE ERROR ON UPDATE IN PLACE"; } + break; case 0x2E: switch(ASCQ) { - case 0x00: - return "INSUFFICIENT TIME FOR OPERATION"; - case 0x01: - return "COMMAND TIMEOUT BEFORE PROCESSING"; - case 0x02: - return "COMMAND TIMEOUT DURING PROCESSING"; - case 0x03: - return "COMMAND TIMEOUT DURING PROCESSING DUE TO ERROR RECOVERY"; + case 0x00: return "INSUFFICIENT TIME FOR OPERATION"; + case 0x01: return "COMMAND TIMEOUT BEFORE PROCESSING"; + case 0x02: return "COMMAND TIMEOUT DURING PROCESSING"; + case 0x03: return "COMMAND TIMEOUT DURING PROCESSING DUE TO ERROR RECOVERY"; } + break; case 0x2F: switch(ASCQ) { - case 0x00: - return "COMMANDS CLEARED BY ANOTHER INITIATOR"; - case 0x01: - return "COMMANDS CLEARED BY POWER LOSS NOTIFICATION"; - case 0x02: - return "COMMANDS CLEARED BY DEVICE SERVER"; - case 0x03: - return "SOME COMMANDS CLEARED BY QUEUING LAYER EVENT"; + case 0x00: return "COMMANDS CLEARED BY ANOTHER INITIATOR"; + case 0x01: return "COMMANDS CLEARED BY POWER LOSS NOTIFICATION"; + case 0x02: return "COMMANDS CLEARED BY DEVICE SERVER"; + case 0x03: return "SOME COMMANDS CLEARED BY QUEUING LAYER EVENT"; } + break; case 0x30: switch(ASCQ) { - case 0x00: - return "INCOMPATIBLE MEDIUM INSTALLED"; - case 0x01: - return "CANNOT READ MEDIUM - UNKNOWN FORMAT"; - case 0x02: - return "CANNOT READ MEDIUM - INCOMPATIBLE FORMAT"; - case 0x03: - return "CLEANING CARTRIDGE INSTALLED"; - case 0x04: - return "CANNOT WRITE MEDIUM - UNKNOWN FORMAT"; - case 0x05: - return "CANNOT WRITE MEDIUM - INCOMPATIBLE FORMAT"; - case 0x06: - return "CANNOT FORMAT MEDIUM - INCOMPATIBLE MEDIUM"; - case 0x07: - return "CLEANING FAILURE"; - case 0x08: - return "CANNOT WRITE - APPLICATION CODE MISMATCH"; - case 0x09: - return "CURRENT SESSION NOT FIXATED FOR APPEND"; - case 0x0A: - return "CLEANING REQUEST REJECTED"; - case 0x0C: - return "WORM MEDIUM - OVERWRITE ATTEMPTED"; - case 0x0D: - return "WORM MEDIUM - INTEGRITY CHECK"; - case 0x10: - return "MEDIUM NOT FORMATTED"; - case 0x11: - return "INCOMPATIBLE VOLUME TYPE"; - case 0x12: - return "INCOMPATIBLE VOLUME QUALIFIER"; - case 0x13: - return "CLEANING VOLUME EXPIRED"; + case 0x00: return "INCOMPATIBLE MEDIUM INSTALLED"; + case 0x01: return "CANNOT READ MEDIUM - UNKNOWN FORMAT"; + case 0x02: return "CANNOT READ MEDIUM - INCOMPATIBLE FORMAT"; + case 0x03: return "CLEANING CARTRIDGE INSTALLED"; + case 0x04: return "CANNOT WRITE MEDIUM - UNKNOWN FORMAT"; + case 0x05: return "CANNOT WRITE MEDIUM - INCOMPATIBLE FORMAT"; + case 0x06: return "CANNOT FORMAT MEDIUM - INCOMPATIBLE MEDIUM"; + case 0x07: return "CLEANING FAILURE"; + case 0x08: return "CANNOT WRITE - APPLICATION CODE MISMATCH"; + case 0x09: return "CURRENT SESSION NOT FIXATED FOR APPEND"; + case 0x0A: return "CLEANING REQUEST REJECTED"; + case 0x0C: return "WORM MEDIUM - OVERWRITE ATTEMPTED"; + case 0x0D: return "WORM MEDIUM - INTEGRITY CHECK"; + case 0x10: return "MEDIUM NOT FORMATTED"; + case 0x11: return "INCOMPATIBLE VOLUME TYPE"; + case 0x12: return "INCOMPATIBLE VOLUME QUALIFIER"; + case 0x13: return "CLEANING VOLUME EXPIRED"; } + break; case 0x31: switch(ASCQ) { - case 0x00: - return "MEDIUM FORMAT CORRUPTED"; - case 0x01: - return "FORMAT COMMAND FAILED"; - case 0x02: - return "ZONED FORMATTING FAILED DUE TO SPARE LINKING"; - case 0x03: - return "SANITIZE COMMAND FAILED"; + case 0x00: return "MEDIUM FORMAT CORRUPTED"; + case 0x01: return "FORMAT COMMAND FAILED"; + case 0x02: return "ZONED FORMATTING FAILED DUE TO SPARE LINKING"; + case 0x03: return "SANITIZE COMMAND FAILED"; } + break; case 0x32: switch(ASCQ) { - case 0x00: - return "NO DEFECT SPARE LOCATION AVAILABLE"; - case 0x01: - return "DEFECT LIST UPDATE FAILURE"; + case 0x00: return "NO DEFECT SPARE LOCATION AVAILABLE"; + case 0x01: return "DEFECT LIST UPDATE FAILURE"; } + break; case 0x33: switch(ASCQ) { - case 0x00: - return "TAPE LENGTH ERROR"; + case 0x00: return "TAPE LENGTH ERROR"; } + break; case 0x34: switch(ASCQ) { - case 0x00: - return "ENCLOSURE FAILURE"; + case 0x00: return "ENCLOSURE FAILURE"; } + break; case 0x35: switch(ASCQ) { - case 0x00: - return "ENCLOSURE SERVICES FAILURE"; - case 0x01: - return "UNSUPPORTED ENCLOSURE FUNCTION"; - case 0x02: - return "ENCLOSURE SERVICES UNAVAILABLE"; - case 0x03: - return "ENCLOSURE SERVICES TRANSFER FAILURE"; - case 0x04: - return "ENCLOSURE SERVICES TRANSFER REFUSED"; - case 0x05: - return "ENCLOSURE SERVICES CHECKSUM ERROR"; + case 0x00: return "ENCLOSURE SERVICES FAILURE"; + case 0x01: return "UNSUPPORTED ENCLOSURE FUNCTION"; + case 0x02: return "ENCLOSURE SERVICES UNAVAILABLE"; + case 0x03: return "ENCLOSURE SERVICES TRANSFER FAILURE"; + case 0x04: return "ENCLOSURE SERVICES TRANSFER REFUSED"; + case 0x05: return "ENCLOSURE SERVICES CHECKSUM ERROR"; } + break; case 0x36: switch(ASCQ) { - case 0x00: - return "RIBBON, INK, OR TONER FAILURE"; + case 0x00: return "RIBBON, INK, OR TONER FAILURE"; } + break; case 0x37: switch(ASCQ) { - case 0x00: - return "ROUNDED PARAMETER"; + case 0x00: return "ROUNDED PARAMETER"; } + break; case 0x38: switch(ASCQ) { - case 0x00: - return "EVENT STATUS NOTIFICATION"; - case 0x02: - return "ESN - POWER MANAGEMENT CLASS EVENT"; - case 0x04: - return "ESN - MEDIA CLASS EVENT"; - case 0x06: - return "ESN - DEVICE BUSY CLASS EVENT"; - case 0x07: - return "THIN PROVISIONING SOFT THRESHOLD REACHED"; + case 0x00: return "EVENT STATUS NOTIFICATION"; + case 0x02: return "ESN - POWER MANAGEMENT CLASS EVENT"; + case 0x04: return "ESN - MEDIA CLASS EVENT"; + case 0x06: return "ESN - DEVICE BUSY CLASS EVENT"; + case 0x07: return "THIN PROVISIONING SOFT THRESHOLD REACHED"; } + break; case 0x39: switch(ASCQ) { - case 0x00: - return "SAVING PARAMETERS NOT SUPPORTED"; + case 0x00: return "SAVING PARAMETERS NOT SUPPORTED"; } + break; case 0x3A: switch(ASCQ) { - case 0x00: - return "MEDIUM NOT PRESENT"; - case 0x01: - return "MEDIUM NOT PRESENT - TRAY CLOSED"; - case 0x02: - return "MEDIUM NOT PRESENT - TRAY OPEN"; - case 0x03: - return "MEDIUM NOT PRESENT - LOADABLE"; - case 0x04: - return "MEDIUM NOT PRESENT - MEDIUM AUXILIARY MEMORY ACCESSIBLE"; + case 0x00: return "MEDIUM NOT PRESENT"; + case 0x01: return "MEDIUM NOT PRESENT - TRAY CLOSED"; + case 0x02: return "MEDIUM NOT PRESENT - TRAY OPEN"; + case 0x03: return "MEDIUM NOT PRESENT - LOADABLE"; + case 0x04: return "MEDIUM NOT PRESENT - MEDIUM AUXILIARY MEMORY ACCESSIBLE"; } + break; case 0x3B: switch(ASCQ) { - case 0x00: - return "SEQUENTIAL POSITIONING ERROR"; - case 0x01: - return "TAPE POSITION ERROR AT BEGINNING-OF-MEDIUM"; - case 0x02: - return "TAPE POSITION ERROR AT END-OF-MEDIUM"; - case 0x03: - return "TAPE OR ELECTRONIC VERTICAL FORMS UNIT NOT READY"; - case 0x04: - return "SLEW FAILURE"; - case 0x05: - return "PAPER JAM"; - case 0x06: - return "FAILED TO SENSE TOP-OF-FORM"; - case 0x07: - return "FAILED TO SENSE BOTTOM-OF-FORM"; - case 0x08: - return "REPOSITION ERROR"; - case 0x09: - return "READ PAST END OF MEDIUM"; - case 0x0A: - return "READ PAST BEGINNING OF MEDIUM"; - case 0x0B: - return "POSITION PAST END OF MEDIUM"; - case 0x0C: - return "POSITION PAST BEGINNING OF MEDIUM"; - case 0x0D: - return "MEDIUM DESTINATION ELEMENT FULL"; - case 0x0E: - return "MEDIUM SOURCE ELEMENT EMPTY"; - case 0x0F: - return "END OF MEDIUM REACHED"; - case 0x11: - return "MEDIUM MAGAZINE NOT ACCESSIBLE"; - case 0x12: - return "MEDIUM MAGAZINE REMOVED"; - case 0x13: - return "MEDIUM MAGAZINE INSERTED"; - case 0x14: - return "MEDIUM MAGAZINE LOCKED"; - case 0x15: - return "MEDIUM MAGAZINE UNLOCKED"; - case 0x16: - return "MECHANICAL POSITIONING OR CHANGER ERROR"; - case 0x17: - return "READ PAST END OF USER OBJECT"; - case 0x18: - return "ELEMENT DISABLED"; - case 0x19: - return "ELEMENT ENABLED"; - case 0x1A: - return "DATA TRANSFER DEVICE REMOVED"; - case 0x1B: - return "DATA TRANSFER DEVICE INSERTED"; - case 0x1C: - return "TOO MANY LOGICAL OBJECTS ON PARTITION TO SUPPORT OPERATION"; + case 0x00: return "SEQUENTIAL POSITIONING ERROR"; + case 0x01: return "TAPE POSITION ERROR AT BEGINNING-OF-MEDIUM"; + case 0x02: return "TAPE POSITION ERROR AT END-OF-MEDIUM"; + case 0x03: return "TAPE OR ELECTRONIC VERTICAL FORMS UNIT NOT READY"; + case 0x04: return "SLEW FAILURE"; + case 0x05: return "PAPER JAM"; + case 0x06: return "FAILED TO SENSE TOP-OF-FORM"; + case 0x07: return "FAILED TO SENSE BOTTOM-OF-FORM"; + case 0x08: return "REPOSITION ERROR"; + case 0x09: return "READ PAST END OF MEDIUM"; + case 0x0A: return "READ PAST BEGINNING OF MEDIUM"; + case 0x0B: return "POSITION PAST END OF MEDIUM"; + case 0x0C: return "POSITION PAST BEGINNING OF MEDIUM"; + case 0x0D: return "MEDIUM DESTINATION ELEMENT FULL"; + case 0x0E: return "MEDIUM SOURCE ELEMENT EMPTY"; + case 0x0F: return "END OF MEDIUM REACHED"; + case 0x11: return "MEDIUM MAGAZINE NOT ACCESSIBLE"; + case 0x12: return "MEDIUM MAGAZINE REMOVED"; + case 0x13: return "MEDIUM MAGAZINE INSERTED"; + case 0x14: return "MEDIUM MAGAZINE LOCKED"; + case 0x15: return "MEDIUM MAGAZINE UNLOCKED"; + case 0x16: return "MECHANICAL POSITIONING OR CHANGER ERROR"; + case 0x17: return "READ PAST END OF USER OBJECT"; + case 0x18: return "ELEMENT DISABLED"; + case 0x19: return "ELEMENT ENABLED"; + case 0x1A: return "DATA TRANSFER DEVICE REMOVED"; + case 0x1B: return "DATA TRANSFER DEVICE INSERTED"; + case 0x1C: return "TOO MANY LOGICAL OBJECTS ON PARTITION TO SUPPORT OPERATION"; } + break; case 0x3D: switch(ASCQ) { - case 0x00: - return "INVALID BITS IN IDENTIFY MESSAGE"; + case 0x00: return "INVALID BITS IN IDENTIFY MESSAGE"; } + break; case 0x3E: switch(ASCQ) { - case 0x00: - return "LOGICAL UNIT HAS NOT SELF-CONFIGURED YET"; - case 0x01: - return "LOGICAL UNIT FAILURE"; - case 0x02: - return "TIMEOUT ON LOGICAL UNIT"; - case 0x03: - return "LOGICAL UNIT FAILED SELF-TEST"; - case 0x04: - return "LOGICAL UNIT UNABLE TO UPDATE SELF-TEST LOG"; + case 0x00: return "LOGICAL UNIT HAS NOT SELF-CONFIGURED YET"; + case 0x01: return "LOGICAL UNIT FAILURE"; + case 0x02: return "TIMEOUT ON LOGICAL UNIT"; + case 0x03: return "LOGICAL UNIT FAILED SELF-TEST"; + case 0x04: return "LOGICAL UNIT UNABLE TO UPDATE SELF-TEST LOG"; } + break; case 0x3F: switch(ASCQ) { - case 0x00: - return "TARGET OPERATING CONDITIONS HAVE CHANGED"; - case 0x01: - return "MICROCODE HAS BEEN CHANGED"; - case 0x02: - return "CHANGED OPERATING DEFINITION"; - case 0x03: - return "INQUIRY DATA HAS CHANGED"; - case 0x04: - return "COMPONENT DEVICE ATTACHED"; - case 0x05: - return "DEVICE IDENTIFIED CHANGED"; - case 0x06: - return "REDUNDANCY GROUP CREATED OR MODIFIED"; - case 0x07: - return "REDUNDANCY GROUP DELETED"; - case 0x08: - return "SPARE CREATED OR MODIFIED"; - case 0x09: - return "SPARE DELETED"; - case 0x0A: - return "VOLUME SET CREATED OR MODIFIED"; - case 0x0B: - return "VOLUME SET DELETED"; - case 0x0C: - return "VOLUME SET DEASSIGNED"; - case 0x0D: - return "VOLUME SET REASSIGNED"; - case 0x0E: - return "REPORTED LUNS DATA HAS CHANGED"; - case 0x0F: - return "ECHO BUFFER OVERWRITTEN"; - case 0x10: - return "MEDIUM LOADABLE"; - case 0x11: - return "MEDIUM AUXILIARY MEMORY ACCESSIBLE"; - case 0x12: - return "iSCSI IP ADDRESS ADDED"; - case 0x13: - return "iSCSI IP ADDRESS REMOVED"; - case 0x14: - return "iSCSI IP ADDRESS CHANGED"; - case 0x15: - return "INSPECT REFERRALS SENSE DESCRIPTORS"; - case 0x16: - return "MICROCODE HAS BEEN CHANGED WITHOUT RESET"; - case 0x17: - return "ZONE TRANSITION TO FULL"; + case 0x00: return "TARGET OPERATING CONDITIONS HAVE CHANGED"; + case 0x01: return "MICROCODE HAS BEEN CHANGED"; + case 0x02: return "CHANGED OPERATING DEFINITION"; + case 0x03: return "INQUIRY DATA HAS CHANGED"; + case 0x04: return "COMPONENT DEVICE ATTACHED"; + case 0x05: return "DEVICE IDENTIFIED CHANGED"; + case 0x06: return "REDUNDANCY GROUP CREATED OR MODIFIED"; + case 0x07: return "REDUNDANCY GROUP DELETED"; + case 0x08: return "SPARE CREATED OR MODIFIED"; + case 0x09: return "SPARE DELETED"; + case 0x0A: return "VOLUME SET CREATED OR MODIFIED"; + case 0x0B: return "VOLUME SET DELETED"; + case 0x0C: return "VOLUME SET DEASSIGNED"; + case 0x0D: return "VOLUME SET REASSIGNED"; + case 0x0E: return "REPORTED LUNS DATA HAS CHANGED"; + case 0x0F: return "ECHO BUFFER OVERWRITTEN"; + case 0x10: return "MEDIUM LOADABLE"; + case 0x11: return "MEDIUM AUXILIARY MEMORY ACCESSIBLE"; + case 0x12: return "iSCSI IP ADDRESS ADDED"; + case 0x13: return "iSCSI IP ADDRESS REMOVED"; + case 0x14: return "iSCSI IP ADDRESS CHANGED"; + case 0x15: return "INSPECT REFERRALS SENSE DESCRIPTORS"; + case 0x16: return "MICROCODE HAS BEEN CHANGED WITHOUT RESET"; + case 0x17: return "ZONE TRANSITION TO FULL"; } + break; case 0x40: switch(ASCQ) { - case 0x00: - return "RAM FAILURE"; - default: - return string.Format("DIAGNOSTIC FAILURE ON COMPONENT {0:X2}h", ASCQ); + case 0x00: return "RAM FAILURE"; + default: return string.Format("DIAGNOSTIC FAILURE ON COMPONENT {0:X2}h", ASCQ); } case 0x41: switch(ASCQ) { - case 0x00: - return "DATA PATH FAILURE"; + case 0x00: return "DATA PATH FAILURE"; } + break; case 0x42: switch(ASCQ) { - case 0x00: - return "POWER-ON OR SELF-TEST FAILURE"; + case 0x00: return "POWER-ON OR SELF-TEST FAILURE"; } + break; case 0x43: switch(ASCQ) { - case 0x00: - return "MESSAGE ERROR"; + case 0x00: return "MESSAGE ERROR"; } + break; case 0x44: switch(ASCQ) { - case 0x00: - return "INTERNAL TARGET FAILURE"; - case 0x01: - return "PERSISTENT RESERVATION INFORMATION LOST"; - case 0x71: - return "ATA DEVICE FAILED SET FEATURES"; + case 0x00: return "INTERNAL TARGET FAILURE"; + case 0x01: return "PERSISTENT RESERVATION INFORMATION LOST"; + case 0x71: return "ATA DEVICE FAILED SET FEATURES"; } + break; case 0x45: switch(ASCQ) { - case 0x00: - return "SELECT OR RESELECT FAILURE"; + case 0x00: return "SELECT OR RESELECT FAILURE"; } + break; case 0x46: switch(ASCQ) { - case 0x00: - return "UNSUCCESSFUL SOFT RESET"; + case 0x00: return "UNSUCCESSFUL SOFT RESET"; } + break; case 0x47: switch(ASCQ) { - case 0x00: - return "SCSI PARITY ERROR"; - case 0x01: - return "DATA PHASE CRC ERROR DETECTED"; - case 0x02: - return "SCSI PARITY ERROR DETECTED DURING ST DATA PHASE"; - case 0x03: - return "INFORMATION UNIT iuCRC ERROR DETECTED"; - case 0x04: - return "ASYNCHRONOUS INFORMATION PROTECTION ERROR DETECTED"; - case 0x05: - return "PROTOCOL SERVICE CRC ERROR"; - case 0x06: - return "PHY TEST FUNCTION IN PROGRESS"; - case 0x7F: - return "SOME COMMANDS CLEARED BY iSCSI PROTOCOL EVENT"; + case 0x00: return "SCSI PARITY ERROR"; + case 0x01: return "DATA PHASE CRC ERROR DETECTED"; + case 0x02: return "SCSI PARITY ERROR DETECTED DURING ST DATA PHASE"; + case 0x03: return "INFORMATION UNIT iuCRC ERROR DETECTED"; + case 0x04: return "ASYNCHRONOUS INFORMATION PROTECTION ERROR DETECTED"; + case 0x05: return "PROTOCOL SERVICE CRC ERROR"; + case 0x06: return "PHY TEST FUNCTION IN PROGRESS"; + case 0x7F: return "SOME COMMANDS CLEARED BY iSCSI PROTOCOL EVENT"; } + break; case 0x48: switch(ASCQ) { - case 0x00: - return "INITIATOR DETECTED ERROR MESSAGE RECEIVED"; + case 0x00: return "INITIATOR DETECTED ERROR MESSAGE RECEIVED"; } + break; case 0x49: switch(ASCQ) { - case 0x00: - return "INVALID MESSAGE ERROR"; + case 0x00: return "INVALID MESSAGE ERROR"; } + break; case 0x4A: switch(ASCQ) { - case 0x00: - return "COMMAND PHASE ERROR"; + case 0x00: return "COMMAND PHASE ERROR"; } + break; case 0x4B: switch(ASCQ) { - case 0x00: - return "DATA PHASE ERROR"; - case 0x01: - return "INVALID TARGET PORT TRANSFER TAG RECEIVED"; - case 0x02: - return "TOO MUCH WRITE DATA"; - case 0x03: - return "ACK/NAK TIMEOUT"; - case 0x04: - return "NAK RECEIVED"; - case 0x05: - return "DATA OFFSET ERROR"; - case 0x06: - return "INITIATOR RESPONSE TIMEOUT"; - case 0x07: - return "CONNECTION LOST"; - case 0x08: - return "DATA-IN BUFFER OVERFLOW - DATA BUFFER SIZE"; - case 0x09: - return "DATA-IN BUFFER OVERFLOW - DATA BUFFER DESCRIPTOR AREA"; - case 0x0A: - return "DATA-IN BUFFER ERROR"; - case 0x0B: - return "DATA-OUT BUFFER OVERFLOW - DATA BUFFER SIZE"; - case 0x0C: - return "DATA-OUT BUFFER OVERFLOW - DATA BUFFER DESCRIPTOR AREA"; - case 0x0D: - return "DATA-OUT BUFFER ERROR"; - case 0x0E: - return "PCIe FABRIC ERROR"; - case 0x0F: - return "PCIe COMPLETION TIMEOUT"; - case 0x10: - return "PCIe COMPLETION ABORT"; - case 0x11: - return "PCIe POISONED TLP RECEIVED"; - case 0x12: - return "PCIe ECRC CHECK FAILED"; - case 0x13: - return "PCIe UNSUPPORTED REQUEST"; - case 0x14: - return "PCIe ACS VIOLATION"; - case 0x15: - return "PCIe TLP PREFIX BLOCKED"; + case 0x00: return "DATA PHASE ERROR"; + case 0x01: return "INVALID TARGET PORT TRANSFER TAG RECEIVED"; + case 0x02: return "TOO MUCH WRITE DATA"; + case 0x03: return "ACK/NAK TIMEOUT"; + case 0x04: return "NAK RECEIVED"; + case 0x05: return "DATA OFFSET ERROR"; + case 0x06: return "INITIATOR RESPONSE TIMEOUT"; + case 0x07: return "CONNECTION LOST"; + case 0x08: return "DATA-IN BUFFER OVERFLOW - DATA BUFFER SIZE"; + case 0x09: return "DATA-IN BUFFER OVERFLOW - DATA BUFFER DESCRIPTOR AREA"; + case 0x0A: return "DATA-IN BUFFER ERROR"; + case 0x0B: return "DATA-OUT BUFFER OVERFLOW - DATA BUFFER SIZE"; + case 0x0C: return "DATA-OUT BUFFER OVERFLOW - DATA BUFFER DESCRIPTOR AREA"; + case 0x0D: return "DATA-OUT BUFFER ERROR"; + case 0x0E: return "PCIe FABRIC ERROR"; + case 0x0F: return "PCIe COMPLETION TIMEOUT"; + case 0x10: return "PCIe COMPLETION ABORT"; + case 0x11: return "PCIe POISONED TLP RECEIVED"; + case 0x12: return "PCIe ECRC CHECK FAILED"; + case 0x13: return "PCIe UNSUPPORTED REQUEST"; + case 0x14: return "PCIe ACS VIOLATION"; + case 0x15: return "PCIe TLP PREFIX BLOCKED"; } + break; case 0x4C: switch(ASCQ) { - case 0x00: - return "LOGICAL UNIT FAILED SELF-CONFIGURATION"; + case 0x00: return "LOGICAL UNIT FAILED SELF-CONFIGURATION"; } + break; - case 0x4E: - return string.Format("OVERLAPPED COMMANDS ATTEMPTED FOR TASK TAG {0:X2}h", ASCQ); + case 0x4E: return string.Format("OVERLAPPED COMMANDS ATTEMPTED FOR TASK TAG {0:X2}h", ASCQ); case 0x50: switch(ASCQ) { - case 0x00: - return "WRITE APPEND ERROR"; - case 0x01: - return "WRITE APPEND POSITION ERROR"; - case 0x02: - return "POSITION ERROR RELATED TO TIMING"; + case 0x00: return "WRITE APPEND ERROR"; + case 0x01: return "WRITE APPEND POSITION ERROR"; + case 0x02: return "POSITION ERROR RELATED TO TIMING"; } + break; case 0x51: switch(ASCQ) { - case 0x00: - return "ERASE FAILURE"; - case 0x01: - return "ERASE FAILURE - INCOMPLETE ERASE OPERATION DETECTED"; + case 0x00: return "ERASE FAILURE"; + case 0x01: return "ERASE FAILURE - INCOMPLETE ERASE OPERATION DETECTED"; } + break; case 0x52: switch(ASCQ) { - case 0x00: - return "CARTRIDGE FAULT"; + case 0x00: return "CARTRIDGE FAULT"; } + break; case 0x53: switch(ASCQ) { - case 0x00: - return "MEDIA LOAD OR EJECT FAILED"; - case 0x01: - return "UNLOAD TAPE FAILURE"; - case 0x02: - return "MEDIUM REMOVAL PREVENTED"; - case 0x03: - return "MEDIUM REMOVAL PREVENTED BY DATA TRANSFER ELEMENT"; - case 0x04: - return "MEDIUM THREAD OR UNTHREAD FAILURE"; - case 0x05: - return "VOLUME IDENTIFIER INVALID"; - case 0x06: - return "VOLUME IDENTIFIED MISSING"; - case 0x07: - return "DUPLICATE VOLUME IDENTIFIER"; - case 0x08: - return "ELEMENT STATUS UNKNOWN"; - case 0x09: - return "DATA TRANSFER DEVICE ERROR - LOAD FAILED"; - case 0x0A: - return "DATA TRANSFER DEVICE ERROR - UNLOAD FAILED"; - case 0x0B: - return "DATA TRANSFER DEVICE ERROR - UNLOAD MISSING"; - case 0x0C: - return "DATA TRANSFER DEVICE ERROR - EJECT FAILED"; - case 0x0D: - return "DATA TRANSFER DEVICE ERROR - LIBRARY COMMUNICATION FAILED"; + case 0x00: return "MEDIA LOAD OR EJECT FAILED"; + case 0x01: return "UNLOAD TAPE FAILURE"; + case 0x02: return "MEDIUM REMOVAL PREVENTED"; + case 0x03: return "MEDIUM REMOVAL PREVENTED BY DATA TRANSFER ELEMENT"; + case 0x04: return "MEDIUM THREAD OR UNTHREAD FAILURE"; + case 0x05: return "VOLUME IDENTIFIER INVALID"; + case 0x06: return "VOLUME IDENTIFIED MISSING"; + case 0x07: return "DUPLICATE VOLUME IDENTIFIER"; + case 0x08: return "ELEMENT STATUS UNKNOWN"; + case 0x09: return "DATA TRANSFER DEVICE ERROR - LOAD FAILED"; + case 0x0A: return "DATA TRANSFER DEVICE ERROR - UNLOAD FAILED"; + case 0x0B: return "DATA TRANSFER DEVICE ERROR - UNLOAD MISSING"; + case 0x0C: return "DATA TRANSFER DEVICE ERROR - EJECT FAILED"; + case 0x0D: return "DATA TRANSFER DEVICE ERROR - LIBRARY COMMUNICATION FAILED"; } + break; case 0x54: switch(ASCQ) { - case 0x00: - return "SCSI TO HOST SYSTEM INTERFACE FAILURE"; + case 0x00: return "SCSI TO HOST SYSTEM INTERFACE FAILURE"; } + break; case 0x55: switch(ASCQ) { - case 0x00: - return "SYSTEM RESOURCE FAILURE"; - case 0x01: - return "SYSTEM BUFFER FULL"; - case 0x02: - return "INSUFFICIENT RESERVATION RESOURCES"; - case 0x03: - return "INSUFFICIENT RESOURCES"; - case 0x04: - return "INSUFFICIENT REGISTRATION RESOURCES"; - case 0x05: - return "INSUFFICIENT ACCESS CONTROL RESOURCES"; - case 0x06: - return "AUXILIARY MEMORY OUT OF SPACE"; - case 0x07: - return "QUOTA ERROR"; - case 0x08: - return "MAXIMUM NUMBER OF SUPPLEMENTAL DECRYPTION KEYS EXCEEDED"; - case 0x09: - return "MEDIUM AUXILIARY MEMORY NOT ACCESSIBLE"; - case 0x0A: - return "DATA CURRENTLY UNAVAILABLE"; - case 0x0B: - return "INSUFFICIENT POWER FOR OPERATION"; - case 0x0C: - return "INSUFFICIENT RESOURCES TO CREATE ROD"; - case 0x0D: - return "INSUFFICIENT RESOURCES TO CREATE ROD TOKEN"; - case 0x0E: - return "INSUFFICIENT ZONE RESOURCES"; - case 0x0F: - return "INSUFFICIENT ZONE RESOURCES TO COMPLETE WRITE"; - case 0x10: - return "MAXIMUM NUMBER OF STREAMS OPEN"; + case 0x00: return "SYSTEM RESOURCE FAILURE"; + case 0x01: return "SYSTEM BUFFER FULL"; + case 0x02: return "INSUFFICIENT RESERVATION RESOURCES"; + case 0x03: return "INSUFFICIENT RESOURCES"; + case 0x04: return "INSUFFICIENT REGISTRATION RESOURCES"; + case 0x05: return "INSUFFICIENT ACCESS CONTROL RESOURCES"; + case 0x06: return "AUXILIARY MEMORY OUT OF SPACE"; + case 0x07: return "QUOTA ERROR"; + case 0x08: return "MAXIMUM NUMBER OF SUPPLEMENTAL DECRYPTION KEYS EXCEEDED"; + case 0x09: return "MEDIUM AUXILIARY MEMORY NOT ACCESSIBLE"; + case 0x0A: return "DATA CURRENTLY UNAVAILABLE"; + case 0x0B: return "INSUFFICIENT POWER FOR OPERATION"; + case 0x0C: return "INSUFFICIENT RESOURCES TO CREATE ROD"; + case 0x0D: return "INSUFFICIENT RESOURCES TO CREATE ROD TOKEN"; + case 0x0E: return "INSUFFICIENT ZONE RESOURCES"; + case 0x0F: return "INSUFFICIENT ZONE RESOURCES TO COMPLETE WRITE"; + case 0x10: return "MAXIMUM NUMBER OF STREAMS OPEN"; } + break; case 0x57: switch(ASCQ) { - case 0x00: - return "UNABLE TO RECOVER TABLE-OF-CONTENTS"; + case 0x00: return "UNABLE TO RECOVER TABLE-OF-CONTENTS"; } + break; case 0x58: switch(ASCQ) { - case 0x00: - return "GENERATION DOES NOT EXIST"; + case 0x00: return "GENERATION DOES NOT EXIST"; } + break; case 0x59: switch(ASCQ) { - case 0x00: - return "UPDATED BLOCK READ"; + case 0x00: return "UPDATED BLOCK READ"; } + break; case 0x5A: switch(ASCQ) { - case 0x00: - return "OPERATOR REQUEST OR STATE CHANGE INPUT"; - case 0x01: - return "OPERATOR MEDIUM REMOVAL REQUEST"; - case 0x02: - return "OPERATOR SELECTED WRITE PROTECT"; - case 0x03: - return "OPERATOR SELECTED WRITE PERMIT"; + case 0x00: return "OPERATOR REQUEST OR STATE CHANGE INPUT"; + case 0x01: return "OPERATOR MEDIUM REMOVAL REQUEST"; + case 0x02: return "OPERATOR SELECTED WRITE PROTECT"; + case 0x03: return "OPERATOR SELECTED WRITE PERMIT"; } + break; case 0x5B: switch(ASCQ) { - case 0x00: - return "LOG EXCEPTION"; - case 0x01: - return "THRESHOLD CONDITION MET"; - case 0x02: - return "LOG COUNTER AT MAXIMUM"; - case 0x03: - return "LOG LIST CODES EXHAUSTED"; + case 0x00: return "LOG EXCEPTION"; + case 0x01: return "THRESHOLD CONDITION MET"; + case 0x02: return "LOG COUNTER AT MAXIMUM"; + case 0x03: return "LOG LIST CODES EXHAUSTED"; } + break; case 0x5C: switch(ASCQ) { - case 0x00: - return "RPL STATUS CHANGE"; - case 0x01: - return "SPINDLES SYNCHRONIZED"; - case 0x02: - return "SPINDLES NOT SYNCHRONIZED"; - case 0x03: - return "SPARE AREA EXHAUSTION PREDICTION THRESHOLD EXCEEDED"; - case 0x10: - return "HARDWARE IMPENDING FAILURE GENERAL HARD DRIVE FAILURE"; - case 0x11: - return "HARDWARE IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH"; - case 0x12: - return "HARDWARE IMPENDING FAILURE DATA ERROR RATE TOO HIGH"; - case 0x13: - return "HARDWARE IMPENDING FAILURE SEEK ERROR RATE TOO HIGH"; - case 0x14: - return "HARDWARE IMPENDING FAILURE TOO MANY BLOCK REASSIGNS"; - case 0x15: - return "HARDWARE IMPENDING FAILURE ACCESS TIME TOO HIGH"; - case 0x16: - return "HARDWARE IMPENDING FAILURE START UNIT TIMES TOO HIGH"; - case 0x17: - return "HARDWARE IMPENDING FAILURE CHANNEL PARAMETRICS"; - case 0x18: - return "HARDWARE IMPENDING FAILURE CONTROLLER DETECTED"; - case 0x19: - return "HARDWARE IMPENDING FAILURE THROUGHPUT PERFORMANCE"; - case 0x1A: - return "HARDWARE IMPENDING FAILURE SEEK TIME PERFORMANCE"; - case 0x1B: - return "HARDWARE IMPENDING FAILURE SPIN-UP RETRY COUNT"; - case 0x1C: - return "HARDWARE IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT"; - case 0x20: - return "CONTROLLER IMPENDING FAILURE GENERAL HARD DRIVE FAILURE"; - case 0x21: - return "CONTROLLER IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH"; - case 0x22: - return "CONTROLLER IMPENDING FAILURE DATA ERROR RATE TOO HIGH"; - case 0x23: - return "CONTROLLER IMPENDING FAILURE SEEK ERROR RATE TOO HIGH"; - case 0x24: - return "CONTROLLER IMPENDING FAILURE TOO MANY BLOCK REASSIGNS"; - case 0x25: - return "CONTROLLER IMPENDING FAILURE ACCESS TIME TOO HIGH"; - case 0x26: - return "CONTROLLER IMPENDING FAILURE START UNIT TIMES TOO HIGH"; - case 0x27: - return "CONTROLLER IMPENDING FAILURE CHANNEL PARAMETRICS"; - case 0x28: - return "CONTROLLER IMPENDING FAILURE CONTROLLER DETECTED"; - case 0x29: - return "CONTROLLER IMPENDING FAILURE THROUGHPUT PERFORMANCE"; - case 0x2A: - return "CONTROLLER IMPENDING FAILURE SEEK TIME PERFORMANCE"; - case 0x2B: - return "CONTROLLER IMPENDING FAILURE SPIN-UP RETRY COUNT"; - case 0x2C: - return "CONTROLLER IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT"; - case 0x30: - return "DATA CHANNEL IMPENDING FAILURE GENERAL HARD DRIVE FAILURE"; - case 0x31: - return "DATA CHANNEL IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH"; - case 0x32: - return "DATA CHANNEL IMPENDING FAILURE DATA ERROR RATE TOO HIGH"; - case 0x33: - return "DATA CHANNEL IMPENDING FAILURE SEEK ERROR RATE TOO HIGH"; - case 0x34: - return "DATA CHANNEL IMPENDING FAILURE TOO MANY BLOCK REASSIGNS"; - case 0x35: - return "DATA CHANNEL IMPENDING FAILURE ACCESS TIME TOO HIGH"; - case 0x36: - return "DATA CHANNEL IMPENDING FAILURE START UNIT TIMES TOO HIGH"; - case 0x37: - return "DATA CHANNEL IMPENDING FAILURE CHANNEL PARAMETRICS"; - case 0x38: - return "DATA CHANNEL IMPENDING FAILURE DATA CHANNEL DETECTED"; - case 0x39: - return "DATA CHANNEL IMPENDING FAILURE THROUGHPUT PERFORMANCE"; - case 0x3A: - return "DATA CHANNEL IMPENDING FAILURE SEEK TIME PERFORMANCE"; - case 0x3B: - return "DATA CHANNEL IMPENDING FAILURE SPIN-UP RETRY COUNT"; - case 0x3C: - return "DATA CHANNEL IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT"; - case 0x40: - return "SERVO IMPENDING FAILURE GENERAL HARD DRIVE FAILURE"; - case 0x41: - return "SERVO IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH"; - case 0x42: - return "SERVO IMPENDING FAILURE DATA ERROR RATE TOO HIGH"; - case 0x43: - return "SERVO IMPENDING FAILURE SEEK ERROR RATE TOO HIGH"; - case 0x44: - return "SERVO IMPENDING FAILURE TOO MANY BLOCK REASSIGNS"; - case 0x45: - return "SERVO IMPENDING FAILURE ACCESS TIME TOO HIGH"; - case 0x46: - return "SERVO IMPENDING FAILURE START UNIT TIMES TOO HIGH"; - case 0x47: - return "SERVO IMPENDING FAILURE CHANNEL PARAMETRICS"; - case 0x48: - return "SERVO IMPENDING FAILURE SERVO DETECTED"; - case 0x49: - return "SERVO IMPENDING FAILURE THROUGHPUT PERFORMANCE"; - case 0x4A: - return "SERVO IMPENDING FAILURE SEEK TIME PERFORMANCE"; - case 0x4B: - return "SERVO IMPENDING FAILURE SPIN-UP RETRY COUNT"; - case 0x4C: - return "SERVO IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT"; - case 0x50: - return "SPINDLE IMPENDING FAILURE GENERAL HARD DRIVE FAILURE"; - case 0x51: - return "SPINDLE IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH"; - case 0x52: - return "SPINDLE IMPENDING FAILURE DATA ERROR RATE TOO HIGH"; - case 0x53: - return "SPINDLE IMPENDING FAILURE SEEK ERROR RATE TOO HIGH"; - case 0x54: - return "SPINDLE IMPENDING FAILURE TOO MANY BLOCK REASSIGNS"; - case 0x55: - return "SPINDLE IMPENDING FAILURE ACCESS TIME TOO HIGH"; - case 0x56: - return "SPINDLE IMPENDING FAILURE START UNIT TIMES TOO HIGH"; - case 0x57: - return "SPINDLE IMPENDING FAILURE CHANNEL PARAMETRICS"; - case 0x58: - return "SPINDLE IMPENDING FAILURE SPINDLE DETECTED"; - case 0x59: - return "SPINDLE IMPENDING FAILURE THROUGHPUT PERFORMANCE"; - case 0x5A: - return "SPINDLE IMPENDING FAILURE SEEK TIME PERFORMANCE"; - case 0x5B: - return "SPINDLE IMPENDING FAILURE SPIN-UP RETRY COUNT"; - case 0x5C: - return "SPINDLE IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT"; - case 0x60: - return "FIRMWARE IMPENDING FAILURE GENERAL HARD DRIVE FAILURE"; - case 0x61: - return "FIRMWARE IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH"; - case 0x62: - return "FIRMWARE IMPENDING FAILURE DATA ERROR RATE TOO HIGH"; - case 0x63: - return "FIRMWARE IMPENDING FAILURE SEEK ERROR RATE TOO HIGH"; - case 0x64: - return "FIRMWARE IMPENDING FAILURE TOO MANY BLOCK REASSIGNS"; - case 0x65: - return "FIRMWARE IMPENDING FAILURE ACCESS TIME TOO HIGH"; - case 0x66: - return "FIRMWARE IMPENDING FAILURE START UNIT TIMES TOO HIGH"; - case 0x67: - return "FIRMWARE IMPENDING FAILURE CHANNEL PARAMETRICS"; - case 0x68: - return "FIRMWARE IMPENDING FAILURE FIRMWARE DETECTED"; - case 0x69: - return "FIRMWARE IMPENDING FAILURE THROUGHPUT PERFORMANCE"; - case 0x6A: - return "FIRMWARE IMPENDING FAILURE SEEK TIME PERFORMANCE"; - case 0x6B: - return "FIRMWARE IMPENDING FAILURE SPIN-UP RETRY COUNT"; - case 0x6C: - return "FIRMWARE IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT"; - case 0xFF: - return "FAILURE PREDICTION THRESHOLD EXCEEDED (FALSE)"; + case 0x00: return "RPL STATUS CHANGE"; + case 0x01: return "SPINDLES SYNCHRONIZED"; + case 0x02: return "SPINDLES NOT SYNCHRONIZED"; + case 0x03: return "SPARE AREA EXHAUSTION PREDICTION THRESHOLD EXCEEDED"; + case 0x10: return "HARDWARE IMPENDING FAILURE GENERAL HARD DRIVE FAILURE"; + case 0x11: return "HARDWARE IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH"; + case 0x12: return "HARDWARE IMPENDING FAILURE DATA ERROR RATE TOO HIGH"; + case 0x13: return "HARDWARE IMPENDING FAILURE SEEK ERROR RATE TOO HIGH"; + case 0x14: return "HARDWARE IMPENDING FAILURE TOO MANY BLOCK REASSIGNS"; + case 0x15: return "HARDWARE IMPENDING FAILURE ACCESS TIME TOO HIGH"; + case 0x16: return "HARDWARE IMPENDING FAILURE START UNIT TIMES TOO HIGH"; + case 0x17: return "HARDWARE IMPENDING FAILURE CHANNEL PARAMETRICS"; + case 0x18: return "HARDWARE IMPENDING FAILURE CONTROLLER DETECTED"; + case 0x19: return "HARDWARE IMPENDING FAILURE THROUGHPUT PERFORMANCE"; + case 0x1A: return "HARDWARE IMPENDING FAILURE SEEK TIME PERFORMANCE"; + case 0x1B: return "HARDWARE IMPENDING FAILURE SPIN-UP RETRY COUNT"; + case 0x1C: return "HARDWARE IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT"; + case 0x20: return "CONTROLLER IMPENDING FAILURE GENERAL HARD DRIVE FAILURE"; + case 0x21: return "CONTROLLER IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH"; + case 0x22: return "CONTROLLER IMPENDING FAILURE DATA ERROR RATE TOO HIGH"; + case 0x23: return "CONTROLLER IMPENDING FAILURE SEEK ERROR RATE TOO HIGH"; + case 0x24: return "CONTROLLER IMPENDING FAILURE TOO MANY BLOCK REASSIGNS"; + case 0x25: return "CONTROLLER IMPENDING FAILURE ACCESS TIME TOO HIGH"; + case 0x26: return "CONTROLLER IMPENDING FAILURE START UNIT TIMES TOO HIGH"; + case 0x27: return "CONTROLLER IMPENDING FAILURE CHANNEL PARAMETRICS"; + case 0x28: return "CONTROLLER IMPENDING FAILURE CONTROLLER DETECTED"; + case 0x29: return "CONTROLLER IMPENDING FAILURE THROUGHPUT PERFORMANCE"; + case 0x2A: return "CONTROLLER IMPENDING FAILURE SEEK TIME PERFORMANCE"; + case 0x2B: return "CONTROLLER IMPENDING FAILURE SPIN-UP RETRY COUNT"; + case 0x2C: return "CONTROLLER IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT"; + case 0x30: return "DATA CHANNEL IMPENDING FAILURE GENERAL HARD DRIVE FAILURE"; + case 0x31: return "DATA CHANNEL IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH"; + case 0x32: return "DATA CHANNEL IMPENDING FAILURE DATA ERROR RATE TOO HIGH"; + case 0x33: return "DATA CHANNEL IMPENDING FAILURE SEEK ERROR RATE TOO HIGH"; + case 0x34: return "DATA CHANNEL IMPENDING FAILURE TOO MANY BLOCK REASSIGNS"; + case 0x35: return "DATA CHANNEL IMPENDING FAILURE ACCESS TIME TOO HIGH"; + case 0x36: return "DATA CHANNEL IMPENDING FAILURE START UNIT TIMES TOO HIGH"; + case 0x37: return "DATA CHANNEL IMPENDING FAILURE CHANNEL PARAMETRICS"; + case 0x38: return "DATA CHANNEL IMPENDING FAILURE DATA CHANNEL DETECTED"; + case 0x39: return "DATA CHANNEL IMPENDING FAILURE THROUGHPUT PERFORMANCE"; + case 0x3A: return "DATA CHANNEL IMPENDING FAILURE SEEK TIME PERFORMANCE"; + case 0x3B: return "DATA CHANNEL IMPENDING FAILURE SPIN-UP RETRY COUNT"; + case 0x3C: return "DATA CHANNEL IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT"; + case 0x40: return "SERVO IMPENDING FAILURE GENERAL HARD DRIVE FAILURE"; + case 0x41: return "SERVO IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH"; + case 0x42: return "SERVO IMPENDING FAILURE DATA ERROR RATE TOO HIGH"; + case 0x43: return "SERVO IMPENDING FAILURE SEEK ERROR RATE TOO HIGH"; + case 0x44: return "SERVO IMPENDING FAILURE TOO MANY BLOCK REASSIGNS"; + case 0x45: return "SERVO IMPENDING FAILURE ACCESS TIME TOO HIGH"; + case 0x46: return "SERVO IMPENDING FAILURE START UNIT TIMES TOO HIGH"; + case 0x47: return "SERVO IMPENDING FAILURE CHANNEL PARAMETRICS"; + case 0x48: return "SERVO IMPENDING FAILURE SERVO DETECTED"; + case 0x49: return "SERVO IMPENDING FAILURE THROUGHPUT PERFORMANCE"; + case 0x4A: return "SERVO IMPENDING FAILURE SEEK TIME PERFORMANCE"; + case 0x4B: return "SERVO IMPENDING FAILURE SPIN-UP RETRY COUNT"; + case 0x4C: return "SERVO IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT"; + case 0x50: return "SPINDLE IMPENDING FAILURE GENERAL HARD DRIVE FAILURE"; + case 0x51: return "SPINDLE IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH"; + case 0x52: return "SPINDLE IMPENDING FAILURE DATA ERROR RATE TOO HIGH"; + case 0x53: return "SPINDLE IMPENDING FAILURE SEEK ERROR RATE TOO HIGH"; + case 0x54: return "SPINDLE IMPENDING FAILURE TOO MANY BLOCK REASSIGNS"; + case 0x55: return "SPINDLE IMPENDING FAILURE ACCESS TIME TOO HIGH"; + case 0x56: return "SPINDLE IMPENDING FAILURE START UNIT TIMES TOO HIGH"; + case 0x57: return "SPINDLE IMPENDING FAILURE CHANNEL PARAMETRICS"; + case 0x58: return "SPINDLE IMPENDING FAILURE SPINDLE DETECTED"; + case 0x59: return "SPINDLE IMPENDING FAILURE THROUGHPUT PERFORMANCE"; + case 0x5A: return "SPINDLE IMPENDING FAILURE SEEK TIME PERFORMANCE"; + case 0x5B: return "SPINDLE IMPENDING FAILURE SPIN-UP RETRY COUNT"; + case 0x5C: return "SPINDLE IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT"; + case 0x60: return "FIRMWARE IMPENDING FAILURE GENERAL HARD DRIVE FAILURE"; + case 0x61: return "FIRMWARE IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH"; + case 0x62: return "FIRMWARE IMPENDING FAILURE DATA ERROR RATE TOO HIGH"; + case 0x63: return "FIRMWARE IMPENDING FAILURE SEEK ERROR RATE TOO HIGH"; + case 0x64: return "FIRMWARE IMPENDING FAILURE TOO MANY BLOCK REASSIGNS"; + case 0x65: return "FIRMWARE IMPENDING FAILURE ACCESS TIME TOO HIGH"; + case 0x66: return "FIRMWARE IMPENDING FAILURE START UNIT TIMES TOO HIGH"; + case 0x67: return "FIRMWARE IMPENDING FAILURE CHANNEL PARAMETRICS"; + case 0x68: return "FIRMWARE IMPENDING FAILURE FIRMWARE DETECTED"; + case 0x69: return "FIRMWARE IMPENDING FAILURE THROUGHPUT PERFORMANCE"; + case 0x6A: return "FIRMWARE IMPENDING FAILURE SEEK TIME PERFORMANCE"; + case 0x6B: return "FIRMWARE IMPENDING FAILURE SPIN-UP RETRY COUNT"; + case 0x6C: return "FIRMWARE IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT"; + case 0xFF: return "FAILURE PREDICTION THRESHOLD EXCEEDED (FALSE)"; } + break; case 0x5E: switch(ASCQ) { - case 0x00: - return "LOW POWER CONDITION ON"; - case 0x01: - return "IDLE CONDITION ACTIVATED BY TIMER"; - case 0x02: - return "STANDBY CONDITION ACTIVATED BY TIMER"; - case 0x03: - return "IDLE CONDITION ACTIVATED BY COMMAND"; - case 0x04: - return "STANDBY CONDITION ACTIVATED BY COMMAND"; - case 0x05: - return "IDLE_B CONDITION ACTIVATED BY TIMER"; - case 0x06: - return "IDLE_B CONDITION ACTIVATED BY COMMAND"; - case 0x07: - return "IDLE_C CONDITION ACTIVATED BY TIMER"; - case 0x08: - return "IDLE_C CONDITION ACTIVATED BY COMMAND"; - case 0x09: - return "STANDBY_Y CONDITION ACTIVATED BY TIMER"; - case 0x0A: - return "STANDBY_Y CONDITION ACTIVATED BY COMMAND"; - case 0x41: - return "POWER STATE CHANGED TO ACTIVE"; - case 0x42: - return "POWER STATE CHANGED TO IDLE"; - case 0x43: - return "POWER STATE CHANGED TO STANDBY"; - case 0x45: - return "POWER STATE CHANGED TO SLEEP"; - case 0x47: - return "POWER STATE CHANGED TO DEVICE CONTROL"; + case 0x00: return "LOW POWER CONDITION ON"; + case 0x01: return "IDLE CONDITION ACTIVATED BY TIMER"; + case 0x02: return "STANDBY CONDITION ACTIVATED BY TIMER"; + case 0x03: return "IDLE CONDITION ACTIVATED BY COMMAND"; + case 0x04: return "STANDBY CONDITION ACTIVATED BY COMMAND"; + case 0x05: return "IDLE_B CONDITION ACTIVATED BY TIMER"; + case 0x06: return "IDLE_B CONDITION ACTIVATED BY COMMAND"; + case 0x07: return "IDLE_C CONDITION ACTIVATED BY TIMER"; + case 0x08: return "IDLE_C CONDITION ACTIVATED BY COMMAND"; + case 0x09: return "STANDBY_Y CONDITION ACTIVATED BY TIMER"; + case 0x0A: return "STANDBY_Y CONDITION ACTIVATED BY COMMAND"; + case 0x41: return "POWER STATE CHANGED TO ACTIVE"; + case 0x42: return "POWER STATE CHANGED TO IDLE"; + case 0x43: return "POWER STATE CHANGED TO STANDBY"; + case 0x45: return "POWER STATE CHANGED TO SLEEP"; + case 0x47: return "POWER STATE CHANGED TO DEVICE CONTROL"; } + break; case 0x60: switch(ASCQ) { - case 0x00: - return "LAMP FAILURE"; + case 0x00: return "LAMP FAILURE"; } + break; case 0x61: switch(ASCQ) { - case 0x00: - return "VIDEO ACQUISTION ERROR"; - case 0x01: - return "UNABLE TO ACQUIRE VIDEO"; - case 0x02: - return "OUT OF FOCUS"; + case 0x00: return "VIDEO ACQUISTION ERROR"; + case 0x01: return "UNABLE TO ACQUIRE VIDEO"; + case 0x02: return "OUT OF FOCUS"; } + break; case 0x62: switch(ASCQ) { - case 0x00: - return "SCAN HEAD POSITIONING ERROR"; + case 0x00: return "SCAN HEAD POSITIONING ERROR"; } + break; case 0x63: switch(ASCQ) { - case 0x00: - return "END OF USER AREA ENCOUNTERED ON THIS TRACK"; - case 0x01: - return "PACKET DOES NOT FIT IN AVAILABLE SPACE"; + case 0x00: return "END OF USER AREA ENCOUNTERED ON THIS TRACK"; + case 0x01: return "PACKET DOES NOT FIT IN AVAILABLE SPACE"; } + break; case 0x64: switch(ASCQ) { - case 0x00: - return "ILLEGAL MODE FOR THIS TRACK"; - case 0x01: - return "INVALID PACKET SIZE"; + case 0x00: return "ILLEGAL MODE FOR THIS TRACK"; + case 0x01: return "INVALID PACKET SIZE"; } + break; case 0x65: switch(ASCQ) { - case 0x00: - return "VOLTAGE FAULT"; + case 0x00: return "VOLTAGE FAULT"; } + break; case 0x66: switch(ASCQ) { - case 0x00: - return "AUTOMATIC DOCUMENT FEEDER COVER UP"; - case 0x01: - return "AUTOMATIC DOCUMENT FEEDER LIFT UP"; - case 0x02: - return "DOCUMENT JAM IN AUTOMATIC DOCUMENT FEEDER"; - case 0x03: - return "DOCUMENT MISS FEED AUTOMATIC IN DOCUMENT FEEDER"; + case 0x00: return "AUTOMATIC DOCUMENT FEEDER COVER UP"; + case 0x01: return "AUTOMATIC DOCUMENT FEEDER LIFT UP"; + case 0x02: return "DOCUMENT JAM IN AUTOMATIC DOCUMENT FEEDER"; + case 0x03: return "DOCUMENT MISS FEED AUTOMATIC IN DOCUMENT FEEDER"; } + break; case 0x67: switch(ASCQ) { - case 0x00: - return "CONFIGURATION FAILURE"; - case 0x01: - return "CONFIGURATION OF INCAPABLE LOGICAL UNITS FAILED"; - case 0x02: - return "ADD LOGICAL UNIT FAILED"; - case 0x03: - return "MODIFICATION OF LOGICAL UNIT FAILED"; - case 0x04: - return "EXCHANGE OF LOGICAL UNIT FAILED"; - case 0x05: - return "REMOVE OF LOGICAL UNIT FAILED"; - case 0x06: - return "ATTACHMENT OF LOGICAL UNIT FAILED"; - case 0x07: - return "CREATION OF LOGICAL UNIT FAILED"; - case 0x08: - return "ASSIGN FAILURE OCCURRED"; - case 0x09: - return "MULTIPLY ASSIGNED LOGICAL UNIT"; - case 0x0A: - return "SET TARGET PORT GROUPS COMMAND FAILED"; - case 0x0B: - return "ATA DEVICE FEATURE NOT ENABLED"; + case 0x00: return "CONFIGURATION FAILURE"; + case 0x01: return "CONFIGURATION OF INCAPABLE LOGICAL UNITS FAILED"; + case 0x02: return "ADD LOGICAL UNIT FAILED"; + case 0x03: return "MODIFICATION OF LOGICAL UNIT FAILED"; + case 0x04: return "EXCHANGE OF LOGICAL UNIT FAILED"; + case 0x05: return "REMOVE OF LOGICAL UNIT FAILED"; + case 0x06: return "ATTACHMENT OF LOGICAL UNIT FAILED"; + case 0x07: return "CREATION OF LOGICAL UNIT FAILED"; + case 0x08: return "ASSIGN FAILURE OCCURRED"; + case 0x09: return "MULTIPLY ASSIGNED LOGICAL UNIT"; + case 0x0A: return "SET TARGET PORT GROUPS COMMAND FAILED"; + case 0x0B: return "ATA DEVICE FEATURE NOT ENABLED"; } + break; case 0x68: switch(ASCQ) { - case 0x00: - return "LOGICAL UNIT NOT CONFIGURED"; - case 0x01: - return "SUBSIDIARY LOGICAL UNIT NOT CONFIGURED"; + case 0x00: return "LOGICAL UNIT NOT CONFIGURED"; + case 0x01: return "SUBSIDIARY LOGICAL UNIT NOT CONFIGURED"; } + break; case 0x69: switch(ASCQ) { - case 0x00: - return "DATA LOSS ON LOGICAL UNIT"; - case 0x01: - return "MULTIPLE LOGICAL UNIT FAILURES"; - case 0x02: - return "PARITY/DATA MISMATCH"; + case 0x00: return "DATA LOSS ON LOGICAL UNIT"; + case 0x01: return "MULTIPLE LOGICAL UNIT FAILURES"; + case 0x02: return "PARITY/DATA MISMATCH"; } + break; case 0x6A: switch(ASCQ) { - case 0x00: - return "INFORMATIONAL, REFER TO LOG"; + case 0x00: return "INFORMATIONAL, REFER TO LOG"; } + break; case 0x6B: switch(ASCQ) { - case 0x00: - return "STATE CHANGE HAS OCCURRED"; - case 0x01: - return "REDUNDANCY LEVEL GOT BETTER"; - case 0x02: - return "REDUNDANCY LEVEL GOT WORSE"; + case 0x00: return "STATE CHANGE HAS OCCURRED"; + case 0x01: return "REDUNDANCY LEVEL GOT BETTER"; + case 0x02: return "REDUNDANCY LEVEL GOT WORSE"; } + break; case 0x6C: switch(ASCQ) { - case 0x00: - return "REBUILD FAILURE OCCURRED"; + case 0x00: return "REBUILD FAILURE OCCURRED"; } + break; case 0x6D: switch(ASCQ) { - case 0x00: - return "RECALCULATE FAILURE OCCURRED"; + case 0x00: return "RECALCULATE FAILURE OCCURRED"; } + break; case 0x6E: switch(ASCQ) { - case 0x00: - return "COMMAND TO LOGICAL UNIT FAILED"; + case 0x00: return "COMMAND TO LOGICAL UNIT FAILED"; } + break; case 0x6F: switch(ASCQ) { - case 0x00: - return "COPY PROTECTION KEY EXCHANGE FAILURE - AUTHENTICATION FAILURE"; - case 0x01: - return "COPY PROTECTION KEY EXCHANGE FAILURE - KEY NOT PRESENT"; - case 0x02: - return "COPY PROTECTION KEY EXCHANGE FAILURE - KEY NOT ESTABLISHED"; - case 0x03: - return "READ OF SCRAMBLED SECTOR WITHOUT AUTHENTICATION"; - case 0x04: - return "MEDIA REGION CODE IS MISMATCHED TO LOGICAL UNIT REGION"; - case 0x05: - return "DRIVE REGION MUST BE PERMANENT/REGION RESET COUNT ERROR"; - case 0x06: - return "INSUFFICIENT BLOCK COUNT FOR BINDING NONCE RECORDING"; - case 0x07: - return "CONFLICT IN BINDING NONCE RECORDING"; + case 0x00: return "COPY PROTECTION KEY EXCHANGE FAILURE - AUTHENTICATION FAILURE"; + case 0x01: return "COPY PROTECTION KEY EXCHANGE FAILURE - KEY NOT PRESENT"; + case 0x02: return "COPY PROTECTION KEY EXCHANGE FAILURE - KEY NOT ESTABLISHED"; + case 0x03: return "READ OF SCRAMBLED SECTOR WITHOUT AUTHENTICATION"; + case 0x04: return "MEDIA REGION CODE IS MISMATCHED TO LOGICAL UNIT REGION"; + case 0x05: return "DRIVE REGION MUST BE PERMANENT/REGION RESET COUNT ERROR"; + case 0x06: return "INSUFFICIENT BLOCK COUNT FOR BINDING NONCE RECORDING"; + case 0x07: return "CONFLICT IN BINDING NONCE RECORDING"; } + break; - case 0x70: - return string.Format("DECOMPRESSION EXCEPTION SHORT ALGORITHM ID OF {0:X2}h", ASCQ); + case 0x70: return string.Format("DECOMPRESSION EXCEPTION SHORT ALGORITHM ID OF {0:X2}h", ASCQ); case 0x71: switch(ASCQ) { - case 0x00: - return "DECOMPRESSIONG EXCEPTION LONG ALGORITHM ID"; + case 0x00: return "DECOMPRESSIONG EXCEPTION LONG ALGORITHM ID"; } + break; case 0x72: switch(ASCQ) { - case 0x00: - return "SESSION FIXATION ERROR"; - case 0x01: - return "SESSION FIXATION ERROR WRITING LEAD-IN"; - case 0x02: - return "SESSION FIXATION ERROR WRITING LEAD-OUT"; - case 0x03: - return "SESSION FIXATION ERROR - INCOMPLETE TRACK IN SESSION"; - case 0x04: - return "EMPTY OR PARTIALLY WRITTEN RESERVED TRACK"; - case 0x05: - return "NO MORE TRACK RESERVATIONS ALLOWED"; - case 0x06: - return "RMZ EXTENSION IS NOT ALLOWED"; - case 0x07: - return "NO MORE TEST ZONE EXTENSIONS ARE ALLOWED"; + case 0x00: return "SESSION FIXATION ERROR"; + case 0x01: return "SESSION FIXATION ERROR WRITING LEAD-IN"; + case 0x02: return "SESSION FIXATION ERROR WRITING LEAD-OUT"; + case 0x03: return "SESSION FIXATION ERROR - INCOMPLETE TRACK IN SESSION"; + case 0x04: return "EMPTY OR PARTIALLY WRITTEN RESERVED TRACK"; + case 0x05: return "NO MORE TRACK RESERVATIONS ALLOWED"; + case 0x06: return "RMZ EXTENSION IS NOT ALLOWED"; + case 0x07: return "NO MORE TEST ZONE EXTENSIONS ARE ALLOWED"; } + break; case 0x73: switch(ASCQ) { - case 0x00: - return "CD CONTROL ERROR"; - case 0x01: - return "POWER CALIBRATION AREA ALMOST FULL"; - case 0x02: - return "POWER CALIBRATION AREA IS FULL"; - case 0x03: - return "POWER CALIBRATION AREA ERROR"; - case 0x04: - return "PROGRAM MEMORY AREA UPDATE FAILURE"; - case 0x05: - return "PROGRAM MEMORY AREA IS FULL"; - case 0x06: - return "RMA/PMA IS ALMOST FULL"; - case 0x10: - return "CURRENT POWER CALIBRATION AREA ALMOST FULL"; - case 0x11: - return "CURRENT POWER CALIBRATION AREA IS FULL"; - case 0x17: - return "RDZ IS FULL"; + case 0x00: return "CD CONTROL ERROR"; + case 0x01: return "POWER CALIBRATION AREA ALMOST FULL"; + case 0x02: return "POWER CALIBRATION AREA IS FULL"; + case 0x03: return "POWER CALIBRATION AREA ERROR"; + case 0x04: return "PROGRAM MEMORY AREA UPDATE FAILURE"; + case 0x05: return "PROGRAM MEMORY AREA IS FULL"; + case 0x06: return "RMA/PMA IS ALMOST FULL"; + case 0x10: return "CURRENT POWER CALIBRATION AREA ALMOST FULL"; + case 0x11: return "CURRENT POWER CALIBRATION AREA IS FULL"; + case 0x17: return "RDZ IS FULL"; } + break; case 0x74: switch(ASCQ) { - case 0x00: - return "SECURITY ERROR"; - case 0x01: - return "UNABLE TO DECRYPT DATA"; - case 0x02: - return "UNENCRYPTED DATA ENCOUNTERED WHILE DECRYPTING"; - case 0x03: - return "INCORRECT DATA ENCRYPTION KEY"; - case 0x04: - return "CRYPTOGRAPHIC INTEGRITY VALIDATION FAILED"; - case 0x05: - return "ERROR DECRYPTING DATA"; - case 0x06: - return "UNKNOWN SIGNATURE VERIFICATION KEY"; - case 0x07: - return "ENCRYPTION PARAMETERS NOT USEABLE"; - case 0x08: - return "DIGITAL SIGNATURE VALIDATION FAILURE"; - case 0x09: - return "ENCRYPTION MODE MISMATCH ON READ"; - case 0x0A: - return "ENCRYPTED BLOCK NOT RAW READ ENABLED"; - case 0x0B: - return "INCORRECT ENCRYPTION PARAMETERS"; - case 0x0C: - return "UNABLE TO DECRYPT PARAMETER LIST"; - case 0x0D: - return "ENCRYPTION ALGORITHM DISABLED"; - case 0x10: - return "SA CREATION PARAMETER VALUE INVALID"; - case 0x11: - return "SA CREATION PARAMETER VALUE REJECTED"; - case 0x12: - return "INVALID SA USAGE"; - case 0x21: - return "DATA ENCRYPTION CONFIGURATION PREVENTED"; - case 0x30: - return "SA CREATION PARAMETER NOT SUPPORTED"; - case 0x40: - return "AUTHENTICATION FAILED"; - case 0x61: - return "EXTERNAL DATA ENCRYPTION KEY MANAGER ACCESS ERROR"; - case 0x62: - return "EXTERNAL DATA ENCRYPTION KEY MANAGER ERROR"; - case 0x63: - return "EXTERNAL DATA ENCRYPTION KEY NOT FOUND"; - case 0x64: - return "EXTERNAL DATA ENCRYPTION REQUEST NOT AUTHORIZED"; - case 0x6E: - return "EXTERNAL DATA ENCRYPTION CONTROL TIMEOUT"; - case 0x6F: - return "EXTERNAL DATA ENCRYPTION CONTROL ERROR"; - case 0x71: - return "LOGICAL UNIT ACCESS NOT AUTHORIZED"; - case 0x79: - return "SECURITY CONFLICT IN TRANSLATED DEVICE"; + case 0x00: return "SECURITY ERROR"; + case 0x01: return "UNABLE TO DECRYPT DATA"; + case 0x02: return "UNENCRYPTED DATA ENCOUNTERED WHILE DECRYPTING"; + case 0x03: return "INCORRECT DATA ENCRYPTION KEY"; + case 0x04: return "CRYPTOGRAPHIC INTEGRITY VALIDATION FAILED"; + case 0x05: return "ERROR DECRYPTING DATA"; + case 0x06: return "UNKNOWN SIGNATURE VERIFICATION KEY"; + case 0x07: return "ENCRYPTION PARAMETERS NOT USEABLE"; + case 0x08: return "DIGITAL SIGNATURE VALIDATION FAILURE"; + case 0x09: return "ENCRYPTION MODE MISMATCH ON READ"; + case 0x0A: return "ENCRYPTED BLOCK NOT RAW READ ENABLED"; + case 0x0B: return "INCORRECT ENCRYPTION PARAMETERS"; + case 0x0C: return "UNABLE TO DECRYPT PARAMETER LIST"; + case 0x0D: return "ENCRYPTION ALGORITHM DISABLED"; + case 0x10: return "SA CREATION PARAMETER VALUE INVALID"; + case 0x11: return "SA CREATION PARAMETER VALUE REJECTED"; + case 0x12: return "INVALID SA USAGE"; + case 0x21: return "DATA ENCRYPTION CONFIGURATION PREVENTED"; + case 0x30: return "SA CREATION PARAMETER NOT SUPPORTED"; + case 0x40: return "AUTHENTICATION FAILED"; + case 0x61: return "EXTERNAL DATA ENCRYPTION KEY MANAGER ACCESS ERROR"; + case 0x62: return "EXTERNAL DATA ENCRYPTION KEY MANAGER ERROR"; + case 0x63: return "EXTERNAL DATA ENCRYPTION KEY NOT FOUND"; + case 0x64: return "EXTERNAL DATA ENCRYPTION REQUEST NOT AUTHORIZED"; + case 0x6E: return "EXTERNAL DATA ENCRYPTION CONTROL TIMEOUT"; + case 0x6F: return "EXTERNAL DATA ENCRYPTION CONTROL ERROR"; + case 0x71: return "LOGICAL UNIT ACCESS NOT AUTHORIZED"; + case 0x79: return "SECURITY CONFLICT IN TRANSLATED DEVICE"; } + break; } - return ASC >= 0x80 ? ASCQ >= 0x80 ? - string.Format("VENDOR-SPECIFIC ASC {0:X2}h WITH VENDOR-SPECIFIC ASCQ {1:X2}h", ASC, ASCQ) : - string.Format("VENDOR-SPECIFIC ASC {0:X2}h WITH ASCQ {1:X2}h", ASC, ASCQ) : - ASCQ >= 0x80 ? string.Format("ASC {0:X2}h WITH VENDOR-SPECIFIC ASCQ {1:X2}h", ASC, ASCQ) : - string.Format("ASC {0:X2}h WITH ASCQ {1:X2}h", ASC, ASCQ); + return ASC >= 0x80 + ? ASCQ >= 0x80 + ? string.Format("VENDOR-SPECIFIC ASC {0:X2}h WITH VENDOR-SPECIFIC ASCQ {1:X2}h", ASC, ASCQ) + : string.Format("VENDOR-SPECIFIC ASC {0:X2}h WITH ASCQ {1:X2}h", ASC, ASCQ) + : ASCQ >= 0x80 + ? string.Format("ASC {0:X2}h WITH VENDOR-SPECIFIC ASCQ {1:X2}h", ASC, ASCQ) + : string.Format("ASC {0:X2}h WITH ASCQ {1:X2}h", ASC, ASCQ); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/Types.cs b/DiscImageChef.Decoders/SCSI/Types.cs index 4c62c623..c22ca28e 100644 --- a/DiscImageChef.Decoders/SCSI/Types.cs +++ b/DiscImageChef.Decoders/SCSI/Types.cs @@ -35,8 +35,8 @@ namespace DiscImageChef.Decoders.SCSI public enum MediumTypes : byte { Default = 0x00, - #region Medium Types defined in ECMA-111 for Direct-Access devices + #region Medium Types defined in ECMA-111 for Direct-Access devices /// /// ECMA-54: 200 mm Flexible Disk Cartridge using Two-Frequency Recording at 13262 ftprad on One Side /// @@ -72,7 +72,6 @@ namespace DiscImageChef.Decoders.SCSI #endregion Medium Types defined in ECMA-111 for Direct-Access devices #region Medium Types defined in SCSI-2 for Direct-Access devices - /// /// Unspecified single sided flexible disk /// @@ -104,7 +103,6 @@ namespace DiscImageChef.Decoders.SCSI #endregion Medium Types defined in SCSI-2 for Direct-Access devices #region Medium Types defined in SCSI-3 SBC-1 for Optical devices - /// /// Read-only medium /// @@ -132,7 +130,6 @@ namespace DiscImageChef.Decoders.SCSI #endregion Medium Types defined in SCSI-3 SBC-1 for Optical devices #region Medium Types defined in SCSI-2 for MultiMedia devices - /// /// 120 mm CD-ROM /// @@ -157,11 +154,9 @@ namespace DiscImageChef.Decoders.SCSI /// 80 mm Compact Disc with data and audio /// MixedCD_80 = 0x07, - #endregion Medium Types defined in SCSI-2 for MultiMedia devices #region Medium Types defined in SFF-8020i - /// /// Unknown medium type /// @@ -269,7 +264,6 @@ namespace DiscImageChef.Decoders.SCSI #endregion Medium Types defined in SFF-8020i #region Medium Types defined in USB Mass Storage Class - UFI Command Specification - /// /// 3.5-inch, 135 tpi, 12362 bits/radian, double-sided MFM (aka 1.25Mb) /// @@ -281,7 +275,6 @@ namespace DiscImageChef.Decoders.SCSI #endregion Medium Types defined in USB Mass Storage Class - UFI Command Specification #region Medium Types defined in INF-8070 - /// /// Unknown type block device /// @@ -294,7 +287,6 @@ namespace DiscImageChef.Decoders.SCSI /// Read/Write block device /// ReadWriteBlockDevice = 0x42, - #endregion Medium Types defined in INF-8070 #region Medium Types found in vendor documents @@ -590,16 +582,14 @@ namespace DiscImageChef.Decoders.SCSI /// Exatape 75m /// Exatape75m = 0xD7, - - #endregion Medium Types found in vendor documents } public enum DensityType : byte { Default = 0x00, - #region Density Types defined in ECMA-111 for Direct-Access devices + #region Density Types defined in ECMA-111 for Direct-Access devices /// /// 7958 flux transitions per radian /// @@ -615,7 +605,6 @@ namespace DiscImageChef.Decoders.SCSI #endregion Density Types defined in ECMA-111 for Direct-Access devices #region Density Types defined in ECMA-111 for Sequential-Access devices - /// /// ECMA-62 & ANSI X3.22-1983: 12,7 mm 9-Track Magnetic Tape, 32 ftpmm, NRZI, 32 cpmm /// @@ -647,7 +636,6 @@ namespace DiscImageChef.Decoders.SCSI #endregion Density Types defined in ECMA-111 for Sequential-Access devices #region Density Types defined in SCSI-2 for Sequential-Access devices - /// /// ANXI X3.136-1986: 6,35 mm 4 or 9-Track Magnetic Tape Cartridge, 315 bpmm, GCR (QIC-24) /// @@ -711,7 +699,6 @@ namespace DiscImageChef.Decoders.SCSI #endregion Density Types defined in SCSI-2 for Sequential-Access devices #region Density Types defined in SCSI-2 for MultiMedia devices - /// /// User data only /// @@ -731,7 +718,6 @@ namespace DiscImageChef.Decoders.SCSI #endregion Density Types defined in SCSI-2 for MultiMedia devices #region Density Types defined in SCSI-2 for Optical devices - /// /// ISO/IEC 10090: 86 mm Read/Write single-sided optical disc with 12500 tracks /// @@ -768,7 +754,6 @@ namespace DiscImageChef.Decoders.SCSI /// ANSI X3.200: 356 mm double-sided optical disc with 56350 tracks /// X3_200 = 0x09, - #endregion Density Types defined in SCSI-2 for Optical devices #region Density Types found in vendor documents @@ -1044,8 +1029,6 @@ namespace DiscImageChef.Decoders.SCSI /// VStape I compressed /// VStape1c = 0x99, - #endregion Density Types found in vendor documents } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SCSI/VendorString.cs b/DiscImageChef.Decoders/SCSI/VendorString.cs index 133d0309..0e5aecff 100644 --- a/DiscImageChef.Decoders/SCSI/VendorString.cs +++ b/DiscImageChef.Decoders/SCSI/VendorString.cs @@ -38,1606 +38,806 @@ namespace DiscImageChef.Decoders.SCSI { switch(SCSIVendorString) { - case "0B4C": - return "MOOSIK Ltd."; - case "13FE": - return "PHISON"; - case "2AI": - return "2AI (Automatisme et Avenir Informatique)"; - case "3M": - return "3M Company"; - case "3nhtech": - return "3NH Technologies"; - case "3PARdata": - return "3PARdata, Inc."; - case "A-Max": - return "A-Max Technology Co., Ltd"; - case "ABSOLUTE": - return "Absolute Analysis"; - case "ACARD": - return "ACARD Technology Corp."; - case "Accusys": - return "Accusys INC."; - case "Acer": - return "Acer, Inc."; - case "ACL": - return "Automated Cartridge Librarys, Inc."; - case "Actifio": - return "Actifio"; - case "Acuid": - return "Acuid Corporation Ltd."; - case "AcuLab": - return "AcuLab, Inc. (Tulsa, OK)"; - case "ADAPTEC": - return "Adaptec"; - case "ADIC": - return "Advanced Digital Information Corporation"; - case "ADSI": - return "Adaptive Data Systems, Inc. (a Western Digital subsidiary)"; - case "ADTX": - return "ADTX Co., Ltd."; - case "ADVA": - return "ADVA Optical Networking AG"; - case "AEM": - return "AEM Performance Electronics"; - case "AERONICS": - return "Aeronics, Inc."; - case "AGFA": - return "AGFA"; - case "Agilent": - return "Agilent Technologies"; - case "AIC": - return "Advanced Industrial Computer, Inc."; - case "AIPTEK": - return "AIPTEK International Inc."; - case "Alcohol": - return "Alcohol Soft"; - case "ALCOR": - return "Alcor Micro, Corp."; - case "AMCC": - return "Applied Micro Circuits Corporation"; - case "AMCODYNE": - return "Amcodyne"; - case "Amgeon": - return "Amgeon LLC"; - case "AMI": - return "American Megatrends, Inc."; - case "AMPEX": - return "Ampex Data Systems"; - case "Amphenol": - return "Amphenol"; - case "Amtl": - return "Tenlon Technology Co.,Ltd"; - case "ANAMATIC": - return "Anamartic Limited (England)"; - case "Ancor": - return "Ancor Communications, Inc."; - case "ANCOT": - return "ANCOT Corp."; - case "ANDATACO": - return "Andataco"; - case "andiamo": - return "Andiamo Systems, Inc."; - case "ANOBIT": - return "Anobit"; - case "ANRITSU": - return "Anritsu Corporation"; - case "ANTONIO": - return "Antonio Precise Products Manufactory Ltd."; - case "AoT": - return "Art of Technology AG"; - case "APPLE": - return "Apple Computer, Inc."; - case "ARCHIVE": - return "Archive"; - case "ARDENCE": - return "Ardence Inc"; - case "Areca": - return "Areca Technology Corporation"; - case "Arena": - return "MaxTronic International Co., Ltd."; - case "Argent": - return "Argent Data Systems, Inc."; - case "ARIO": - return "Ario Data Networks, Inc."; - case "ARISTOS": - return "Aristos Logic Corp."; - case "ARK": - return "ARK Research Corporation"; - case "ARL:UT@A": - return "Applied Research Laboratories : University of Texas at Austin"; - case "ARTECON": - return "Artecon Inc."; - case "Artistic": - return "Artistic Licence (UK) Ltd"; - case "ARTON": - return "Arton Int."; - case "ASACA": - return "ASACA Corp."; - case "ASC": - return "Advanced Storage Concepts, Inc."; - case "ASPEN": - return "Aspen Peripherals"; - case "AST": - return "AST Research"; - case "ASTEK": - return "Astek Corporation"; - case "ASTK": - return "Alcatel STK A/S"; - case "AStor": - return "AccelStor, Inc."; - case "ASTUTE": - return "Astute Networks, Inc."; - case "AT&T": - return "AT&T"; - case "ATA": - return "SCSI / ATA Translator Software (Organization Not Specified)"; - case "ATARI": - return "Atari Corporation"; - case "ATech": - return "ATech electronics"; - case "ATG CYG": - return "ATG Cygnet Inc."; - case "ATL": - return "Quantum|ATL Products"; - case "ATTO": - return "ATTO Technology Inc."; - case "ATTRATEC": - return "Attratech Ltd liab. Co"; - case "ATX": - return "Alphatronix"; - case "AURASEN": - return "Aurasen Limited"; - case "Avago": - return "Avago Technologies"; - case "AVC": - return "AVC Technology Ltd"; - case "AVIDVIDR": - return "AVID Technologies, Inc."; - case "AVR": - return "Advanced Vision Research"; - case "AXSTOR": - return "AXSTOR"; - case "Axxana": - return "Axxana Ltd."; - case "B*BRIDGE": - return "Blockbridge Networks LLC"; - case "BALLARD": - return "Ballard Synergy Corp."; - case "Barco": - return "Barco"; - case "BAROMTEC": - return "Barom Technologies Co., Ltd."; - case "Bassett": - return "Bassett Electronic Systems Ltd"; - case "BC Hydro": - return "BC Hydro"; - case "BDT": - return "BDT AG"; - case "BECEEM": - return "Beceem Communications, Inc"; - case "BENQ": - return "BENQ Corporation."; - case "BERGSWD": - return "Berg Software Design"; - case "BEZIER": - return "Bezier Systems, Inc."; - case "BHTi": - return "Breece Hill Technologies"; - case "biodata": - return "Biodata Devices SL"; - case "BIOS": - return "BIOS Corporation"; - case "BIR": - return "Bio-Imaging Research, Inc."; - case "BiT": - return "BiT Microsystems"; - case "BITMICRO": - return "BiT Microsystems, Inc."; - case "Blendlgy": - return "Blendology Limited"; - case "BLOOMBAS": - return "Bloombase Technologies Limited"; - case "BlueArc": - return "BlueArc Corporation"; - case "bluecog": - return "bluecog"; - case "BME-HVT": - return "Broadband Infocommunicatons and Electromagnetic Theory Department"; - case "BNCHMARK": - return "Benchmark Tape Systems Corporation"; - case "Bosch": - return "Robert Bosch GmbH"; - case "Botman": - return "Botmanfamily Electronics"; - case "BoxHill": - return "Box Hill Systems Corporation"; - case "BRDGWRKS": - return "Bridgeworks Ltd."; - case "BREA": - return "BREA Technologies, Inc."; - case "BREECE": - return "Breece Hill LLC"; - case "BreqLabs": - return "BreqLabs Inc."; - case "Broadcom": - return "Broadcom Corporation"; - case "BROCADE": - return "Brocade Communications Systems, Incorporated"; - case "BUFFALO": - return "BUFFALO INC."; - case "BULL": - return "Bull Peripherals Corp."; - case "BUSLOGIC": - return "BusLogic Inc."; - case "BVIRTUAL": - return "B-Virtual N.V."; - case "CACHEIO": - return "CacheIO LLC"; - case "CalComp": - return "CalComp, A Lockheed Company"; - case "CALCULEX": - return "CALCULEX, Inc."; - case "CALIPER": - return "Caliper (California Peripheral Corp.)"; - case "CAMBEX": - return "Cambex Corporation"; - case "CAMEOSYS": - return "Cameo Systems Inc."; - case "CANDERA": - return "Candera Inc."; - case "CAPTION": - return "CAPTION BANK"; - case "CAST": - return "Advanced Storage Tech"; - case "CATALYST": - return "Catalyst Enterprises"; - case "CCDISK": - return "iSCSI Cake"; - case "CDC": - return "Control Data or MPI"; - case "CDP": - return "Columbia Data Products"; - case "Celsia": - return "A M Bromley Limited"; - case "CenData": - return "Central Data Corporation"; - case "Cereva": - return "Cereva Networks Inc."; - case "CERTANCE": - return "Certance"; - case "Chantil": - return "Chantil Technology"; - case "CHEROKEE": - return "Cherokee Data Systems"; - case "CHINON": - return "Chinon"; - case "CHRISTMA": - return "Christmann Informationstechnik + Medien GmbH & Co KG"; - case "CIE&YED": - return "YE Data, C.Itoh Electric Corp."; - case "CIPHER": - return "Cipher Data Products"; - case "Ciprico": - return "Ciprico, Inc."; - case "CIRRUSL": - return "Cirrus Logic Inc."; - case "CISCO": - return "Cisco Systems, Inc."; - case "CLEARSKY": - return "ClearSky Data, Inc."; - case "CLOVERLF": - return "Cloverleaf Communications, Inc"; - case "CLS": - return "Celestica"; - case "CMD": - return "CMD Technology Inc."; - case "CMTechno": - return "CMTech"; - case "CNGR SFW": - return "Congruent Software, Inc."; - case "CNSi": - return "Chaparral Network Storage, Inc."; - case "CNT": - return "Computer Network Technology"; - case "COBY": - return "Coby Electronics Corporation, USA"; - case "COGITO": - return "Cogito"; - case "COMAY": - return "Corerise Electronics"; - case "COMPAQ": - return "Compaq Computer Corporation"; - case "COMPELNT": - return "Compellent Technologies, Inc."; - case "COMPORT": - return "Comport Corp."; - case "COMPSIG": - return "Computer Signal Corporation"; - case "COMPTEX": - return "Comptex Pty Limited"; - case "CONNER": - return "Conner Peripherals"; - case "COPANSYS": - return "COPAN SYSTEMS INC"; - case "CORAID": - return "Coraid, Inc"; - case "CORE": - return "Core International, Inc."; - case "CORERISE": - return "Corerise Electronics"; - case "COVOTE": - return "Covote GmbH & Co KG"; - case "COWON": - return "COWON SYSTEMS, Inc."; - case "CPL": - return "Cross Products Ltd"; - case "CPU TECH": - return "CPU Technology, Inc."; - case "CREO": - return "Creo Products Inc."; - case "CROSFLD": - return "Crosfield Electronics"; - case "CROSSRDS": - return "Crossroads Systems, Inc."; - case "crosswlk": - return "Crosswalk, Inc."; - case "CSCOVRTS": - return "Cisco - Veritas"; - case "CSM, INC": - return "Computer SM, Inc."; - case "Cunuqui": - return "CUNUQUI SLU"; - case "CYBERNET": - return "Cybernetics"; - case "Cygnal": - return "Dekimo"; - case "CYPRESS": - return "Cypress Semiconductor Corp."; - case "D Bit": - return "Digby's Bitpile, Inc. DBA D Bit"; - case "DALSEMI": - return "Dallas Semiconductor"; - case "DANEELEC": - return "Dane-Elec"; - case "DANGER": - return "Danger Inc."; - case "DAT-MG": - return "DAT Manufacturers Group"; - case "Data Com": - return "Data Com Information Systems Pty. Ltd."; - case "DATABOOK": - return "Databook, Inc."; - case "DATACOPY": - return "Datacopy Corp."; - case "DataCore": - return "DataCore Software Corporation"; - case "DataG": - return "DataGravity"; - case "DATAPT": - return "Datapoint Corp."; - case "DATARAM": - return "Dataram Corporation"; - case "DATC": - return "Datum Champion Technology Co., Ltd"; - case "DAVIS": - return "Daviscomms (S) Pte Ltd"; - case "DCS": - return "ShenZhen DCS Group Co.,Ltd"; - case "DDN": - return "DataDirect Networks, Inc."; - case "DDRDRIVE": - return "DDRdrive LLC"; - case "DE": - return "Dimension Engineering LLC"; - case "DEC": - return "Digital Equipment Corporation"; - case "DEI": - return "Digital Engineering, Inc."; - case "DELL": - return "Dell, Inc."; - case "Dell(tm)": - return "Dell, Inc"; - case "DELPHI": - return "Delphi Data Div. of Sparks Industries, Inc."; - case "DENON": - return "Denon/Nippon Columbia"; - case "DenOptix": - return "DenOptix, Inc."; - case "DEST": - return "DEST Corp."; - case "DFC": - return "DavioFranke.com"; - case "DFT": - return "Data Fault Tolerance System CO.,LTD."; - case "DGC": - return "Data General Corp."; - case "DIGIDATA": - return "Digi-Data Corporation"; - case "DigiIntl": - return "Digi International"; - case "Digital": - return "Digital Equipment Corporation"; - case "DILOG": - return "Distributed Logic Corp."; - case "DISC": - return "Document Imaging Systems Corp."; - case "DiscSoft": - return "Disc Soft Ltd"; - case "DLNET": - return "Driveline"; - case "DNS": - return "Data and Network Security"; - case "DNUK": - return "Digital Networks Uk Ltd"; - case "DotHill": - return "Dot Hill Systems Corp."; - case "DP": - return "Dell, Inc."; - case "DPT": - return "Distributed Processing Technology"; - case "Drewtech": - return "Drew Technologies, Inc."; - case "DROBO": - return "Data Robotics, Inc."; - case "DSC": - return "DigitalStream Corporation"; - case "DSI": - return "Data Spectrum, Inc."; - case "DSM": - return "Deterner Steuerungs- und Maschinenbau GmbH & Co."; - case "DSNET": - return "Cleversafe, Inc."; - case "DT": - return "Double-Take Software, INC."; - case "DTC QUME": - return "Data Technology Qume"; - case "DXIMAGIN": - return "DX Imaging"; - case "E-Motion": - return "E-Motion LLC"; - case "EARTHLAB": - return "EarthLabs"; - case "EarthLCD": - return "Earth Computer Technologies, Inc."; - case "ECCS": - return "ECCS, Inc."; - case "ECMA": - return "European Computer Manufacturers Association"; - case "EDS": - return "Embedded Data Systems"; - case "EIM": - return "InfoCore"; - case "ELE Intl": - return "ELE International"; - case "ELEGANT": - return "Elegant Invention, LLC"; - case "Elektron": - return "Elektron Music Machines MAV AB"; - case "elipsan": - return "Elipsan UK Ltd."; - case "Elms": - return "Elms Systems Corporation"; - case "ELSE": - return "ELSE Ltd."; - case "ELSEC": - return "Littlemore Scientific"; - case "EMASS": - return "EMASS, Inc."; - case "EMC": - return "EMC Corp."; - case "EMiT": - return "EMiT Conception Eletronique"; - case "EMTEC": - return "EMTEC Magnetics"; - case "EMULEX": - return "Emulex"; - case "ENERGY-B": - return "Energybeam Corporation"; - case "ENGENIO": - return "Engenio Information Technologies, Inc."; - case "ENMOTUS": - return "Enmotus Inc"; - case "Entacore": - return "Entacore"; - case "EPOS": - return "EPOS Technologies Ltd."; - case "EPSON": - return "Epson"; - case "EQLOGIC": - return "EqualLogic"; - case "Eris/RSI": - return "RSI Systems, Inc."; - case "ETERNE": - return "EterneData Technology Co.,Ltd.(China PRC.)"; - case "EuroLogc": - return "Eurologic Systems Limited"; - case "evolve": - return "Evolution Technologies, Inc"; - case "EXABYTE": - return "Exabyte Corp."; - case "EXATEL": - return "Exatelecom Co., Ltd."; - case "EXAVIO": - return "Exavio, Inc."; - case "Exsequi": - return "Exsequi Ltd"; - case "Exxotest": - return "Annecy Electronique"; - case "FAIRHAVN": - return "Fairhaven Health, LLC"; - case "FALCON": - return "FalconStor, Inc."; - case "FDS": - return "Formation Data Systems"; - case "FFEILTD": - return "FujiFilm Electonic Imaging Ltd"; - case "Fibxn": - return "Fiberxon, Inc."; - case "FID": - return "First International Digital, Inc."; - case "FILENET": - return "FileNet Corp."; - case "FirmFact": - return "Firmware Factory Ltd"; - case "FLYFISH": - return "Flyfish Technologies"; - case "FOXCONN": - return "Foxconn Technology Group"; - case "FRAMDRV": - return "FRAMEDRIVE Corp."; - case "FREECION": - return "Nable Communications, Inc."; - case "FRESHDTK": - return "FreshDetect GmbH"; - case "FSC": - return "Fujitsu Siemens Computers"; - case "FTPL": - return "Frontline Technologies Pte Ltd"; - case "FUJI": - return "Fuji Electric Co., Ltd. (Japan)"; - case "FUJIFILM": - return "Fuji Photo Film, Co., Ltd."; - case "FUJITSU": - return "Fujitsu"; - case "FUNAI": - return "Funai Electric Co., Ltd."; - case "FUSIONIO": - return "Fusion-io Inc."; - case "FUTURED": - return "Future Domain Corp."; - case "G&D": - return "Giesecke & Devrient GmbH"; - case "G.TRONIC": - return "Globaltronic - Electronica e Telecomunicacoes, S.A."; - case "Gadzoox": - return "Gadzoox Networks, Inc."; - case "Gammaflx": - return "Gammaflux L.P."; - case "GDI": - return "Generic Distribution International"; - case "GEMALTO": - return "gemalto"; - case "Gen_Dyn": - return "General Dynamics"; - case "Generic": - return "Generic Technology Co., Ltd."; - case "GENSIG": - return "General Signal Networks"; - case "GEO": - return "Green Energy Options Ltd"; - case "GIGATAPE": - return "GIGATAPE GmbH"; - case "GIGATRND": - return "GigaTrend Incorporated"; - case "Global": - return "Global Memory Test Consortium"; - case "Gnutek": - return "Gnutek Ltd."; - case "Goidelic": - return "Goidelic Precision, Inc."; - case "GoldKey": - return "GoldKey Security Corporation"; - case "GoldStar": - return "LG Electronics Inc."; - case "GOOGLE": - return "Google, Inc."; - case "GORDIUS": - return "Gordius"; - case "GOULD": - return "Gould"; - case "HAGIWARA": - return "Hagiwara Sys-Com Co., Ltd."; - case "HAPP3": - return "Inventec Multimedia and Telecom co., ltd"; - case "HDS": - return "Horizon Data Systems, Inc."; - case "Helldyne": - return "Helldyne, Inc"; - case "Heydays": - return "Mazo Technology Co., Ltd."; - case "HGST": - return "HGST a Western Digital Company"; - case "HI-TECH": - return "HI-TECH Software Pty. Ltd."; - case "HITACHI": - return "Hitachi America Ltd or Nissei Sangyo America Ltd"; - case "HL-DT-ST": - return "Hitachi-LG Data Storage, Inc."; - case "HONEYWEL": - return "Honeywell Inc."; - case "Hoptroff": - return "HexWax Ltd"; - case "HORIZONT": - return "Horizontigo Software"; - case "HP": - return "Hewlett Packard"; - case "HPE": - return "Hewlett Packard Enterprise"; - case "HPI": - return "HP Inc."; - case "HPQ": - return "Hewlett Packard"; - case "HUALU": - return "CHINA HUALU GROUP CO., LTD"; - case "HUASY": - return "Huawei Symantec Technologies Co., Ltd."; - case "HYLINX": - return "Hylinx Ltd."; - case "HYUNWON": - return "HYUNWON inc"; - case "i-cubed": - return "i-cubed ltd."; - case "IBM": - return "International Business Machines"; - case "Icefield": - return "Icefield Tools Corporation"; - case "Iceweb": - return "Iceweb Storage Corp"; - case "ICL": - return "ICL"; - case "ICP": - return "ICP vortex Computersysteme GmbH"; - case "IDE": - return "International Data Engineering, Inc."; - case "IDG": - return "Interface Design Group"; - case "IET": - return "ISCSI ENTERPRISE TARGET"; - case "IFT": - return "Infortrend Technology, Inc."; - case "IGR": - return "Intergraph Corp."; - case "IMAGINE": - return "Imagine Communications Corp."; - case "IMAGO": - return "IMAGO SOFTWARE SL"; - case "IMATION": - return "Imation"; - case "IMPLTD": - return "Integrated Micro Products Ltd."; - case "IMPRIMIS": - return "Imprimis Technology Inc."; - case "INCIPNT": - return "Incipient Technologies Inc."; - case "INCITS": - return "InterNational Committee for Information Technology"; - case "INDCOMP": - return "Industrial Computing Limited"; - case "Indigita": - return "Indigita Corporation"; - case "INFOCORE": - return "InfoCore"; - case "INITIO": - return "Initio Corporation"; - case "INRANGE": - return "INRANGE Technologies Corporation"; - case "Insight": - return "L-3 Insight Technology Inc"; - case "INSITE": - return "Insite Peripherals"; - case "integrix": - return "Integrix, Inc."; - case "INTEL": - return "Intel Corporation"; - case "Intransa": - return "Intransa, Inc."; - case "IOC": - return "I/O Concepts, Inc."; - case "iofy": - return "iofy Corporation"; - case "IOMEGA": - return "Iomega"; - case "IOT": - return "IO Turbine, Inc."; - case "iPaper": - return "intelliPaper, LLC"; - case "iqstor": - return "iQstor Networks, Inc."; - case "iQue": - return "iQue"; - case "ISi": - return "Information Storage inc."; - case "Isilon": - return "Isilon Systems, Inc."; - case "ISO": - return "International Standards Organization"; - case "iStor": - return "iStor Networks, Inc."; - case "ITC": - return "International Tapetronics Corporation"; - case "iTwin": - return "iTwin Pte Ltd"; - case "IVIVITY": - return "iVivity, Inc."; - case "IVMMLTD": - return "InnoVISION Multimedia Ltd."; - case "JABIL001": - return "Jabil Circuit"; - case "JETWAY": - return "Jetway Information Co., Ltd"; - case "JMR": - return "JMR Electronics Inc."; - case "JOFEMAR": - return "Jofemar"; - case "JOLLYLOG": - return "Jolly Logic"; - case "JPC Inc.": - return "JPC Inc."; - case "JSCSI": - return "jSCSI Project"; - case "Juniper": - return "Juniper Networks"; - case "JVC": - return "JVC Information Products Co."; - case "KASHYA": - return "Kashya, Inc."; - case "KENNEDY": - return "Kennedy Company"; - case "KENWOOD": - return "KENWOOD Corporation"; - case "KEWL": - return "Shanghai KEWL Imp&Exp Co., Ltd."; - case "Key Tech": - return "Key Technologies, Inc"; - case "KMNRIO": - return "Kaminario Technologies Ltd."; - case "KODAK": - return "Eastman Kodak"; - case "KONAN": - return "Konan"; - case "koncepts": - return "koncepts International Ltd."; - case "KONICA": - return "Konica Japan"; - case "KOVE": - return "KOVE"; - case "KSCOM": - return "KSCOM Co. Ltd.,"; - case "KUDELSKI": - return "Nagravision SA - Kudelski Group"; - case "Kyocera": - return "Kyocera Corporation"; - case "Lapida": - return "Gonmalo Electronics"; - case "LAPINE": - return "Lapine Technology"; - case "LASERDRV": - return "LaserDrive Limited"; - case "LASERGR": - return "Lasergraphics, Inc."; - case "LeapFrog": - return "LeapFrog Enterprises, Inc."; - case "LEFTHAND": - return "LeftHand Networks"; - case "Leica": - return "Leica Camera AG"; - case "Lexar": - return "Lexar Media, Inc."; - case "LEYIO": - return "LEYIO"; - case "LG": - return "LG Electronics Inc."; - case "LGE": - return "LG Electronics Inc."; - case "LIBNOVA": - return "LIBNOVA, SL Digital Preservation Systems"; - case "LION": - return "Lion Optics Corporation"; - case "LMS": - return "Laser Magnetic Storage International Company"; - case "LoupTech": - return "Loup Technologies, Inc."; - case "LSI": - return "LSI Corp. (was LSI Logic Corp.)"; - case "LSILOGIC": - return "LSI Logic Storage Systems, Inc."; - case "LTO-CVE": - return "Linear Tape - Open, Compliance Verification Entity"; - case "LUXPRO": - return "Luxpro Corporation"; - case "MacroSAN": - return "MacroSAN Technologies Co., Ltd."; - case "Malakite": - return "Malachite Technologies (New VID is: Sandial)"; - case "MarcBoon": - return "marcboon.com"; - case "Marner": - return "Marner Storage Technologies, Inc."; - case "MARVELL": - return "Marvell Semiconductor, Inc."; - case "Matrix": - return "Matrix Orbital Corp."; - case "MATSHITA": - return "Matsushita"; - case "MAXELL": - return "Hitachi Maxell, Ltd."; - case "MAXIM-IC": - return "Maxim Integrated Products"; - case "MaxOptix": - return "Maxoptix Corp."; - case "MAXSTRAT": - return "Maximum Strategy, Inc."; - case "MAXTOR": - return "Maxtor Corp."; - case "MaXXan": - return "MaXXan Systems, Inc."; - case "MAYCOM": - return "maycom Co., Ltd."; - case "MBEAT": - return "K-WON C&C Co.,Ltd"; - case "MCC": - return "Measurement Computing Corporation"; - case "McDATA": - return "McDATA Corporation"; - case "MCUBE": - return "Mcube Technology Co., Ltd."; - case "MDI": - return "Micro Design International, Inc."; - case "MEADE": - return "Meade Instruments Corporation"; - case "mediamat": - return "mediamatic"; - case "MegaElec": - return "Mega Electronics Ltd"; - case "MEII": - return "Mountain Engineering II, Inc."; - case "MELA": - return "Mitsubishi Electronics America"; - case "MELCO": - return "Mitsubishi Electric (Japan)"; - case "mellanox": - return "Mellanox Technologies Ltd."; - case "MEMOREX": - return "Memorex Telex Japan Ltd."; - case "MEMREL": - return "Memrel Corporation"; - case "MEMTECH": - return "MemTech Technology"; - case "Mendocin": - return "Mendocino Software"; - case "MendoCno": - return "Mendocino Software"; - case "MERIDATA": - return "Oy Meridata Finland Ltd"; - case "METHODEI": - return "Methode Electronics India pvt ltd"; - case "METRUM": - return "Metrum, Inc."; - case "MHTL": - return "Matsunichi Hi-Tech Limited"; - case "MICROBTX": - return "Microbotics Inc."; - case "Microchp": - return "Microchip Technology, Inc."; - case "MICROLIT": - return "Microlite Corporation"; - case "MICRON": - return "Micron Technology, Inc."; - case "MICROP": - return "Micropolis"; - case "MICROTEK": - return "Microtek Storage Corp"; - case "Minitech": - return "Minitech (UK) Limited"; - case "Minolta": - return "Minolta Corporation"; - case "MINSCRIB": - return "Miniscribe"; - case "MiraLink": - return "MiraLink Corporation"; - case "Mirifica": - return "Mirifica s.r.l."; - case "MITSUMI": - return "Mitsumi Electric Co., Ltd."; - case "MKM": - return "Mitsubishi Kagaku Media Co., LTD."; - case "Mobii": - return "Mobii Systems (Pty.) Ltd."; - case "MOL": - return "Petrosoft Sdn. Bhd."; - case "MOSAID": - return "Mosaid Technologies Inc."; - case "MOTOROLA": - return "Motorola"; - case "MP-400": - return "Daiwa Manufacturing Limited"; - case "MPC": - return "MPC Corporation"; - case "MPCCORP": - return "MPC Computers"; - case "MPEYE": - return "Touchstone Technology Co., Ltd"; - case "MPIO": - return "DKT Co.,Ltd"; - case "MPM": - return "Mitsubishi Paper Mills, Ltd."; - case "MPMan": - return "MPMan.com, Inc."; - case "MSFT": - return "Microsoft Corporation"; - case "MSI": - return "Micro-Star International Corp."; - case "MST": - return "Morning Star Technologies, Inc."; - case "MSystems": - return "M-Systems Flash Disk Pioneers"; - case "MTI": - return "MTI Technology Corporation"; - case "MTNGATE": - return "MountainGate Data Systems"; - case "MXI": - return "Memory Experts International"; - case "nac": - return "nac Image Technology Inc."; - case "NAGRA": - return "Nagravision SA - Kudelski Group"; - case "NAI": - return "North Atlantic Industries"; - case "NAKAMICH": - return "Nakamichi Corporation"; - case "NatInst": - return "National Instruments"; - case "NatSemi": - return "National Semiconductor Corp."; - case "NCITS": - return "InterNational Committee for Information Technology Standards (INCITS)"; - case "NCL": - return "NCL America"; - case "NCR": - return "NCR Corporation"; - case "NDBTECH": - return "NDB Technologie Inc."; - case "Neartek": - return "Neartek, Inc."; - case "NEC": - return "NEC"; - case "NETAPP": - return "NetApp, Inc. (was Network Appliance)"; - case "NetBSD": - return "The NetBSD Foundation"; - case "Netcom": - return "Netcom Storage"; - case "NETENGIN": - return "NetEngine, Inc."; - case "NEWISYS": - return "Newisys Data Storage"; - case "Newtech": - return "Newtech Co., Ltd."; - case "NEXSAN": - return "Nexsan Technologies, Ltd."; - case "NFINIDAT": - return "Infinidat Ltd."; - case "NHR": - return "NH Research, Inc."; - case "Nike": - return "Nike, Inc."; - case "Nimble": - return "Nimble Storage"; - case "NISCA": - return "NISCA Inc."; - case "NISHAN": - return "Nishan Systems Inc."; - case "Nitz": - return "Nitz Associates, Inc."; - case "NKK": - return "NKK Corp."; - case "NRC": - return "Nakamichi Research Corporation"; - case "NSD": - return "Nippon Systems Development Co.,Ltd."; - case "NSM": - return "NSM Jukebox GmbH"; - case "nStor": - return "nStor Technologies, Inc."; - case "NT": - return "Northern Telecom"; - case "NUCONNEX": - return "NuConnex"; - case "NUSPEED": - return "NuSpeed, Inc."; - case "NVIDIA": - return "NVIDIA Corporation"; - case "NVMe": - return "NVM Express Working Group"; - case "OAI": - return "Optical Access International"; - case "OCE": - return "Oce Graphics"; - case "ODS": - return "ShenZhen DCS Group Co.,Ltd"; - case "OHDEN": - return "Ohden Co., Ltd."; - case "OKI": - return "OKI Electric Industry Co.,Ltd (Japan)"; - case "Olidata": - return "Olidata S.p.A."; - case "OMI": - return "Optical Media International"; - case "OMNIFI": - return "Rockford Corporation - Omnifi Media"; - case "OMNIS": - return "OMNIS Company (FRANCE)"; - case "Ophidian": - return "Ophidian Designs"; - case "opslag": - return "Tyrone Systems"; - case "Optelec": - return "Optelec BV"; - case "Optiarc": - return "Sony Optiarc Inc."; - case "OPTIMEM": - return "Cipher/Optimem"; - case "OPTOTECH": - return "Optotech"; - case "ORACLE": - return "Oracle Corporation"; - case "ORANGE": - return "Orange Micro, Inc."; - case "ORCA": - return "Orca Technology"; - case "Origin": - return "Origin Energy"; - case "OSI": - return "Optical Storage International"; - case "OSNEXUS": - return "OS NEXUS, Inc."; - case "OTL": - return "OTL Engineering"; - case "OVERLAND": - return "Overland Storage Inc."; - case "pacdigit": - return "Pacific Digital Corp"; - case "Packard": - return "Parkard Bell"; - case "Panasas": - return "Panasas, Inc."; - case "PARALAN": - return "Paralan Corporation"; - case "PASCOsci": - return "Pasco Scientific"; - case "PATHLGHT": - return "Pathlight Technology, Inc."; - case "PCS": - return "Pro Charging Systems, LLC"; - case "PerStor": - return "Perstor"; - case "PERTEC": - return "Pertec Peripherals Corporation"; - case "PFTI": - return "Performance Technology Inc."; - case "PFU": - return "PFU Limited"; - case "Phigment": - return "Phigment Technologies"; - case "PHILIPS": - return "Philips Electronics"; - case "PICO": - return "Packard Instrument Company"; - case "PIK": - return "TECHNILIENT & MCS"; - case "Pillar": - return "Pillar Data Systems"; - case "PIONEER": - return "Pioneer Electronic Corp."; - case "Pirus": - return "Pirus Networks"; - case "PIVOT3": - return "Pivot3, Inc."; - case "PLASMON": - return "Plasmon Data"; - case "Pliant": - return "Pliant Technology, Inc."; - case "PMCSIERA": - return "PMC-Sierra"; - case "PME": - return "Precision Measurement Engineering"; - case "PNNMed": - return "PNN Medical SA"; - case "POKEN": - return "Poken SA"; - case "POLYTRON": - return "PT. HARTONO ISTANA TEKNOLOGI"; - case "PRAIRIE": - return "PrairieTek"; - case "PREPRESS": - return "PrePRESS Solutions"; - case "PRESOFT": - return "PreSoft Architects"; - case "PRESTON": - return "Preston Scientific"; - case "PRIAM": - return "Priam"; - case "PRIMAGFX": - return "Primagraphics Ltd"; - case "PRIMOS": - return "Primos"; - case "PROCOM": - return "Procom Technology"; - case "PROLIFIC": - return "Prolific Technology Inc."; - case "PROMISE": - return "PROMISE TECHNOLOGY, Inc"; - case "PROSTOR": - return "ProStor Systems, Inc."; - case "PROSUM": - return "PROSUM"; - case "PROWARE": - return "Proware Technology Corp."; - case "PTI": - return "Peripheral Technology Inc."; - case "PTICO": - return "Pacific Technology International"; - case "PURE": - return "PURE Storage"; - case "Qi-Hardw": - return "Qi Hardware"; - case "QIC": - return "Quarter-Inch Cartridge Drive Standards, Inc."; - case "QLogic": - return "QLogic Corporation"; - case "QNAP": - return "QNAP Systems"; - case "Qsan": - return "QSAN Technology, Inc."; - case "QUALSTAR": - return "Qualstar"; - case "QUANTEL": - return "Quantel Ltd."; - case "QUANTUM": - return "Quantum Corp."; - case "QUIX": - return "Quix Computerware AG"; - case "R-BYTE": - return "R-Byte, Inc."; - case "RACALREC": - return "Racal Recorders"; - case "RADITEC": - return "Radikal Technologies Deutschland GmbH"; - case "RADSTONE": - return "Radstone Technology"; - case "RAIDINC": - return "RAID Inc."; - case "RASSYS": - return "Rasilient Systems Inc."; - case "RASVIA": - return "Rasvia Systems, Inc."; - case "rave-mp": - return "Go Video"; - case "RDKMSTG": - return "MMS Dipl. Ing. Rolf-Dieter Klein"; - case "RDStor": - return "Rorke China"; - case "Readboy": - return "Readboy Ltd Co."; - case "Realm": - return "Realm Systems"; - case "realtek": - return "Realtek Semiconductor Corp."; - case "REDUXIO": - return "Reduxio Systems Ltd."; - case "rehanltd": - return "Rehan Electronics Ltd"; - case "REKA": - return "REKA HEALTH PTE LTD"; - case "RELDATA": - return "RELDATA Inc"; - case "RENAGmbH": - return "RENA GmbH"; - case "ReThinkM": - return "RETHINK MEDICAL, INC"; - case "Revivio": - return "Revivio, Inc."; - case "RGBLaser": - return "RGB Lasersysteme GmbH"; - case "RGI": - return "Raster Graphics, Inc."; - case "RHAPSODY": - return "Rhapsody Networks, Inc."; - case "RHS": - return "Racal-Heim Systems GmbH"; - case "RICOH": - return "Ricoh"; - case "RODIME": - return "Rodime"; - case "Rorke": - return "RD DATA Technology (ShenZhen) Limited"; - case "Royaltek": - return "RoyalTek company Ltd."; - case "RPS": - return "RPS"; - case "RTI": - return "Reference Technology"; - case "S-D": - return "Sauer-Danfoss"; - case "S-flex": - return "Storageflex Inc"; - case "S-SYSTEM": - return "S-SYSTEM"; - case "S1": - return "storONE"; - case "SAMSUNG": - return "Samsung Electronics Co., Ltd."; - case "SAN": - return "Storage Area Networks, Ltd."; - case "Sandial": - return "Sandial Systems, Inc."; - case "SanDisk": - return "SanDisk Corporation"; - case "SANKYO": - return "Sankyo Seiki"; - case "SANRAD": - return "SANRAD Inc."; - case "SANYO": - return "SANYO Electric Co., Ltd."; - case "SC.Net": - return "StorageConnections.Net"; - case "SCALE": - return "Scale Computing, Inc."; - case "SCIENTEK": - return "SCIENTEK CORP"; - case "SCInc.": - return "Storage Concepts, Inc."; - case "SCREEN": - return "Dainippon Screen Mfg. Co., Ltd."; - case "SDI": - return "Storage Dimensions, Inc."; - case "SDS": - return "Solid Data Systems"; - case "SEAC": - return "SeaChange International, Inc."; - case "SEAGATE": - return "Seagate"; - case "SEAGRAND": - return "SEAGRAND In Japan"; - case "Seanodes": - return "Seanodes"; - case "Sec. Key": - return "SecureKey Technologies Inc."; - case "SEQUOIA": - return "Sequoia Advanced Technologies, Inc."; - case "SGI": - return "Silicon Graphics International"; - case "Shannon": - return "Shannon Systems Co., Ltd."; - case "Shinko": - return "Shinko Electric Co., Ltd."; - case "SIEMENS": - return "Siemens"; - case "SigmaTel": - return "SigmaTel, Inc."; - case "SII": - return "Seiko Instruments Inc."; - case "SIMPLE": - return "SimpleTech, Inc."; - case "SIVMSD": - return "IMAGO SOFTWARE SL"; - case "SKhynix": - return "SK hynix Inc."; - case "SLCNSTOR": - return "SiliconStor, Inc."; - case "SLI": - return "Sierra Logic, Inc."; - case "SMCI": - return "Super Micro Computer, Inc."; - case "SmrtStor": - return "Smart Storage Systems"; - case "SMS": - return "Scientific Micro Systems/OMTI"; - case "SMSC": - return "SMSC Storage, Inc."; - case "SMX": - return "Smartronix, Inc."; - case "SNYSIDE": - return "Sunnyside Computing Inc."; - case "SoftLock": - return "Softlock Digital Security Provider"; - case "SolidFir": - return "SolidFire, Inc."; - case "SONIC": - return "Sonic Solutions"; - case "SoniqCas": - return "SoniqCast"; - case "SONY": - return "Sony Corporation Japan"; - case "SOUL": - return "Soul Storage Technology (Wuxi) Co., Ltd"; - case "SPD": - return "Storage Products Distribution, Inc."; - case "SPECIAL": - return "Special Computing Co."; - case "SPECTRA": - return "Spectra Logic, a Division of Western Automation Labs, Inc."; - case "SPERRY": - return "Sperry"; - case "Spintso": - return "Spintso International AB"; - case "STARBORD": - return "Starboard Storage Systems, Inc."; - case "STARWIND": - return "StarWind Software, Inc."; - case "STEC": - return "STEC, Inc."; - case "Sterling": - return "Sterling Diagnostic Imaging, Inc."; - case "STK": - return "Storage Technology Corporation"; - case "STNWOOD": - return "Stonewood Group"; - case "STONEFLY": - return "StoneFly Networks, Inc."; - case "STOR": - return "StorageNetworks, Inc."; - case "STORAPP": - return "StorageApps, Inc."; - case "STORCIUM": - return "Intelligent Systems Services Inc."; - case "STORCOMP": - return "Storage Computer Corporation"; - case "STORM": - return "Storm Technology, Inc."; - case "StorMagc": - return "StorMagic"; - case "Stratus": - return "Stratus Technologies"; - case "StrmLgc": - return "StreamLogic Corp."; - case "SUMITOMO": - return "Sumitomo Electric Industries, Ltd."; - case "SUN": - return "Sun Microsystems, Inc."; - case "SUNCORP": - return "SunCorporation"; - case "suntx": - return "Suntx System Co., Ltd"; - case "SUSE": - return "SUSE Linux"; - case "Swinxs": - return "Swinxs BV"; - case "SYMANTEC": - return "Symantec Corporation"; - case "SYMBIOS": - return "Symbios Logic Inc."; - case "SYMWAVE": - return "Symwave, Inc."; - case "SYNCSORT": - return "Syncsort Incorporated"; - case "SYNERWAY": - return "Synerway"; - case "SYNOLOGY": - return "Synology, Inc."; - case "SyQuest": - return "SyQuest Technology, Inc."; - case "SYSGEN": - return "Sysgen"; - case "T-MITTON": - return "Transmitton England"; - case "T-MOBILE": - return "T-Mobile USA, Inc."; - case "T11": - return "INCITS Technical Committee T11"; - case "TALARIS": - return "Talaris Systems, Inc."; - case "TALLGRAS": - return "Tallgrass Technologies"; - case "TANDBERG": - return "Tandberg Data A/S"; - case "TANDEM": - return "Tandem"; - case "TANDON": - return "Tandon"; - case "TCL": - return "TCL Shenzhen ASIC MIcro-electronics Ltd"; - case "TDK": - return "TDK Corporation"; - case "TEAC": - return "TEAC Japan"; - case "TECOLOTE": - return "Tecolote Designs"; - case "TEGRA": - return "Tegra Varityper"; - case "Teilch": - return "Teilch"; - case "Tek": - return "Tektronix"; - case "TELLERT": - return "Tellert Elektronik GmbH"; - case "TENTIME": - return "Laura Technologies, Inc."; - case "TFDATACO": - return "TimeForge"; - case "TGEGROUP": - return "TGE Group Co.,LTD."; - case "Thecus": - return "Thecus Technology Corp."; - case "TI-DSG": - return "Texas Instruments"; - case "TiGi": - return "TiGi Corporation"; - case "TILDESGN": - return "Tildesign bv"; - case "Tite": - return "Tite Technology Limited"; - case "TKS Inc.": - return "TimeKeeping Systems, Inc."; - case "TLMKS": - return "Telemakus LLC"; - case "TMS": - return "Texas Memory Systems, Inc."; - case "TMS100": - return "TechnoVas"; - case "TOLISGRP": - return "The TOLIS Group"; - case "TOSHIBA": - return "Toshiba Japan"; - case "TOYOU": - return "TOYOU FEIJI ELECTRONICS CO.,LTD."; - case "Tracker": - return "Tracker, LLC"; - case "TRIOFLEX": - return "Trioflex Oy"; - case "TRIPACE": - return "Tripace"; - case "TRLogger": - return "TrueLogger Ltd."; - case "TROIKA": - return "Troika Networks, Inc."; - case "TRULY": - return "TRULY Electronics MFG. LTD."; - case "TRUSTED": - return "Trusted Data Corporation"; - case "TSSTcorp": - return "Toshiba Samsung Storage Technology Corporation"; - case "TZM": - return "TZ Medical"; - case "UD-DVR": - return "Bigstone Project."; - case "UDIGITAL": - return "United Digital Limited"; - case "UIT": - return "United Infomation Technology"; - case "ULTRA": - return "UltraStor Corporation"; - case "UNISTOR": - return "Unistor Networks, Inc."; - case "UNISYS": - return "Unisys"; - case "USCORE": - return "Underscore, Inc."; - case "USDC": - return "US Design Corp."; - case "Top VASCO": - return "Vasco Data Security"; - case "VDS": - return "Victor Data Systems Co., Ltd."; - case "VELDANA": - return "VELDANA MEDICAL SA"; - case "VENTANA": - return "Ventana Medical Systems"; - case "Verari": - return "Verari Systems, Inc."; - case "VERBATIM": - return "Verbatim Corporation"; - case "Vercet": - return "Vercet LLC"; - case "VERITAS": - return "VERITAS Software Corporation"; - case "Vexata": - return "Vexata Inc"; - case "VEXCEL": - return "VEXCEL IMAGING GmbH"; - case "VICOMSL1": - return "Vicom Systems, Inc."; - case "VicomSys": - return "Vicom Systems, Inc."; - case "VIDEXINC": - return "Videx, Inc."; - case "VIOLIN": - return "Violin Memory, Inc."; - case "VIRIDENT": - return "Virident Systems, Inc."; - case "VITESSE": - return "Vitesse Semiconductor Corporation"; - case "VIXEL": - return "Vixel Corporation"; - case "VLS": - return "Van Lent Systems BV"; - case "VMAX": - return "VMAX Technologies Corp."; - case "VMware": - return "VMware Inc."; - case "Vobis": - return "Vobis Microcomputer AG"; - case "VOLTAIRE": - return "Voltaire Ltd."; - case "VRC": - return "Vermont Research Corp."; - case "VRugged": - return "Vanguard Rugged Storage"; - case "VTGadget": - return "Vermont Gadget Company"; - case "Waitec": - return "Waitec NV"; - case "WangDAT": - return "WangDAT"; - case "WANGTEK": - return "Wangtek"; - case "Wasabi": - return "Wasabi Systems"; - case "WAVECOM": - return "Wavecom"; - case "WD": - return "Western Digital Corporation"; - case "WDC": - return "Western Digital Corporation"; - case "WDIGTL": - return "Western Digital"; - case "WDTI": - return "Western Digital Technologies, Inc."; - case "WEARNES": - return "Wearnes Technology Corporation"; - case "WeeraRes": - return "Weera Research Pte Ltd"; - case "Wildflwr": - return "Wildflower Technologies, Inc."; - case "WSC0001": - return "Wisecom, Inc."; - case "X3": - return "InterNational Committee for Information Technology Standards (INCITS)"; - case "XEBEC": - return "Xebec Corporation"; - case "XENSRC": - return "XenSource, Inc."; - case "Xerox": - return "Xerox Corporation"; - case "XIOtech": - return "XIOtech Corporation"; - case "XIRANET": - return "Xiranet Communications GmbH"; - case "XIV": - return "XIV"; - case "XtremIO": - return "XtremIO"; - case "XYRATEX": - return "Xyratex"; - case "YINHE": - return "NUDT Computer Co."; - case "YIXUN": - return "Yixun Electronic Co.,Ltd."; - case "YOTTA": - return "YottaYotta, Inc."; - case "Zarva": - return "Zarva Digital Technology Co., Ltd."; - case "ZETTA": - return "Zetta Systems, Inc."; - case "ZTE": - return "ZTE Corporation"; - case "ZVAULT": - return "Zetavault"; - default: - return SCSIVendorString; + case "0B4C": return "MOOSIK Ltd."; + case "13FE": return "PHISON"; + case "2AI": return "2AI (Automatisme et Avenir Informatique)"; + case "3M": return "3M Company"; + case "3nhtech": return "3NH Technologies"; + case "3PARdata": return "3PARdata, Inc."; + case "A-Max": return "A-Max Technology Co., Ltd"; + case "ABSOLUTE": return "Absolute Analysis"; + case "ACARD": return "ACARD Technology Corp."; + case "Accusys": return "Accusys INC."; + case "Acer": return "Acer, Inc."; + case "ACL": return "Automated Cartridge Librarys, Inc."; + case "Actifio": return "Actifio"; + case "Acuid": return "Acuid Corporation Ltd."; + case "AcuLab": return "AcuLab, Inc. (Tulsa, OK)"; + case "ADAPTEC": return "Adaptec"; + case "ADIC": return "Advanced Digital Information Corporation"; + case "ADSI": return "Adaptive Data Systems, Inc. (a Western Digital subsidiary)"; + case "ADTX": return "ADTX Co., Ltd."; + case "ADVA": return "ADVA Optical Networking AG"; + case "AEM": return "AEM Performance Electronics"; + case "AERONICS": return "Aeronics, Inc."; + case "AGFA": return "AGFA"; + case "Agilent": return "Agilent Technologies"; + case "AIC": return "Advanced Industrial Computer, Inc."; + case "AIPTEK": return "AIPTEK International Inc."; + case "Alcohol": return "Alcohol Soft"; + case "ALCOR": return "Alcor Micro, Corp."; + case "AMCC": return "Applied Micro Circuits Corporation"; + case "AMCODYNE": return "Amcodyne"; + case "Amgeon": return "Amgeon LLC"; + case "AMI": return "American Megatrends, Inc."; + case "AMPEX": return "Ampex Data Systems"; + case "Amphenol": return "Amphenol"; + case "Amtl": return "Tenlon Technology Co.,Ltd"; + case "ANAMATIC": return "Anamartic Limited (England)"; + case "Ancor": return "Ancor Communications, Inc."; + case "ANCOT": return "ANCOT Corp."; + case "ANDATACO": return "Andataco"; + case "andiamo": return "Andiamo Systems, Inc."; + case "ANOBIT": return "Anobit"; + case "ANRITSU": return "Anritsu Corporation"; + case "ANTONIO": return "Antonio Precise Products Manufactory Ltd."; + case "AoT": return "Art of Technology AG"; + case "APPLE": return "Apple Computer, Inc."; + case "ARCHIVE": return "Archive"; + case "ARDENCE": return "Ardence Inc"; + case "Areca": return "Areca Technology Corporation"; + case "Arena": return "MaxTronic International Co., Ltd."; + case "Argent": return "Argent Data Systems, Inc."; + case "ARIO": return "Ario Data Networks, Inc."; + case "ARISTOS": return "Aristos Logic Corp."; + case "ARK": return "ARK Research Corporation"; + case "ARL:UT@A": return "Applied Research Laboratories : University of Texas at Austin"; + case "ARTECON": return "Artecon Inc."; + case "Artistic": return "Artistic Licence (UK) Ltd"; + case "ARTON": return "Arton Int."; + case "ASACA": return "ASACA Corp."; + case "ASC": return "Advanced Storage Concepts, Inc."; + case "ASPEN": return "Aspen Peripherals"; + case "AST": return "AST Research"; + case "ASTEK": return "Astek Corporation"; + case "ASTK": return "Alcatel STK A/S"; + case "AStor": return "AccelStor, Inc."; + case "ASTUTE": return "Astute Networks, Inc."; + case "AT&T": return "AT&T"; + case "ATA": return "SCSI / ATA Translator Software (Organization Not Specified)"; + case "ATARI": return "Atari Corporation"; + case "ATech": return "ATech electronics"; + case "ATG CYG": return "ATG Cygnet Inc."; + case "ATL": return "Quantum|ATL Products"; + case "ATTO": return "ATTO Technology Inc."; + case "ATTRATEC": return "Attratech Ltd liab. Co"; + case "ATX": return "Alphatronix"; + case "AURASEN": return "Aurasen Limited"; + case "Avago": return "Avago Technologies"; + case "AVC": return "AVC Technology Ltd"; + case "AVIDVIDR": return "AVID Technologies, Inc."; + case "AVR": return "Advanced Vision Research"; + case "AXSTOR": return "AXSTOR"; + case "Axxana": return "Axxana Ltd."; + case "B*BRIDGE": return "Blockbridge Networks LLC"; + case "BALLARD": return "Ballard Synergy Corp."; + case "Barco": return "Barco"; + case "BAROMTEC": return "Barom Technologies Co., Ltd."; + case "Bassett": return "Bassett Electronic Systems Ltd"; + case "BC Hydro": return "BC Hydro"; + case "BDT": return "BDT AG"; + case "BECEEM": return "Beceem Communications, Inc"; + case "BENQ": return "BENQ Corporation."; + case "BERGSWD": return "Berg Software Design"; + case "BEZIER": return "Bezier Systems, Inc."; + case "BHTi": return "Breece Hill Technologies"; + case "biodata": return "Biodata Devices SL"; + case "BIOS": return "BIOS Corporation"; + case "BIR": return "Bio-Imaging Research, Inc."; + case "BiT": return "BiT Microsystems"; + case "BITMICRO": return "BiT Microsystems, Inc."; + case "Blendlgy": return "Blendology Limited"; + case "BLOOMBAS": return "Bloombase Technologies Limited"; + case "BlueArc": return "BlueArc Corporation"; + case "bluecog": return "bluecog"; + case "BME-HVT": return "Broadband Infocommunicatons and Electromagnetic Theory Department"; + case "BNCHMARK": return "Benchmark Tape Systems Corporation"; + case "Bosch": return "Robert Bosch GmbH"; + case "Botman": return "Botmanfamily Electronics"; + case "BoxHill": return "Box Hill Systems Corporation"; + case "BRDGWRKS": return "Bridgeworks Ltd."; + case "BREA": return "BREA Technologies, Inc."; + case "BREECE": return "Breece Hill LLC"; + case "BreqLabs": return "BreqLabs Inc."; + case "Broadcom": return "Broadcom Corporation"; + case "BROCADE": return "Brocade Communications Systems, Incorporated"; + case "BUFFALO": return "BUFFALO INC."; + case "BULL": return "Bull Peripherals Corp."; + case "BUSLOGIC": return "BusLogic Inc."; + case "BVIRTUAL": return "B-Virtual N.V."; + case "CACHEIO": return "CacheIO LLC"; + case "CalComp": return "CalComp, A Lockheed Company"; + case "CALCULEX": return "CALCULEX, Inc."; + case "CALIPER": return "Caliper (California Peripheral Corp.)"; + case "CAMBEX": return "Cambex Corporation"; + case "CAMEOSYS": return "Cameo Systems Inc."; + case "CANDERA": return "Candera Inc."; + case "CAPTION": return "CAPTION BANK"; + case "CAST": return "Advanced Storage Tech"; + case "CATALYST": return "Catalyst Enterprises"; + case "CCDISK": return "iSCSI Cake"; + case "CDC": return "Control Data or MPI"; + case "CDP": return "Columbia Data Products"; + case "Celsia": return "A M Bromley Limited"; + case "CenData": return "Central Data Corporation"; + case "Cereva": return "Cereva Networks Inc."; + case "CERTANCE": return "Certance"; + case "Chantil": return "Chantil Technology"; + case "CHEROKEE": return "Cherokee Data Systems"; + case "CHINON": return "Chinon"; + case "CHRISTMA": return "Christmann Informationstechnik + Medien GmbH & Co KG"; + case "CIE&YED": return "YE Data, C.Itoh Electric Corp."; + case "CIPHER": return "Cipher Data Products"; + case "Ciprico": return "Ciprico, Inc."; + case "CIRRUSL": return "Cirrus Logic Inc."; + case "CISCO": return "Cisco Systems, Inc."; + case "CLEARSKY": return "ClearSky Data, Inc."; + case "CLOVERLF": return "Cloverleaf Communications, Inc"; + case "CLS": return "Celestica"; + case "CMD": return "CMD Technology Inc."; + case "CMTechno": return "CMTech"; + case "CNGR SFW": return "Congruent Software, Inc."; + case "CNSi": return "Chaparral Network Storage, Inc."; + case "CNT": return "Computer Network Technology"; + case "COBY": return "Coby Electronics Corporation, USA"; + case "COGITO": return "Cogito"; + case "COMAY": return "Corerise Electronics"; + case "COMPAQ": return "Compaq Computer Corporation"; + case "COMPELNT": return "Compellent Technologies, Inc."; + case "COMPORT": return "Comport Corp."; + case "COMPSIG": return "Computer Signal Corporation"; + case "COMPTEX": return "Comptex Pty Limited"; + case "CONNER": return "Conner Peripherals"; + case "COPANSYS": return "COPAN SYSTEMS INC"; + case "CORAID": return "Coraid, Inc"; + case "CORE": return "Core International, Inc."; + case "CORERISE": return "Corerise Electronics"; + case "COVOTE": return "Covote GmbH & Co KG"; + case "COWON": return "COWON SYSTEMS, Inc."; + case "CPL": return "Cross Products Ltd"; + case "CPU TECH": return "CPU Technology, Inc."; + case "CREO": return "Creo Products Inc."; + case "CROSFLD": return "Crosfield Electronics"; + case "CROSSRDS": return "Crossroads Systems, Inc."; + case "crosswlk": return "Crosswalk, Inc."; + case "CSCOVRTS": return "Cisco - Veritas"; + case "CSM, INC": return "Computer SM, Inc."; + case "Cunuqui": return "CUNUQUI SLU"; + case "CYBERNET": return "Cybernetics"; + case "Cygnal": return "Dekimo"; + case "CYPRESS": return "Cypress Semiconductor Corp."; + case "D Bit": return "Digby's Bitpile, Inc. DBA D Bit"; + case "DALSEMI": return "Dallas Semiconductor"; + case "DANEELEC": return "Dane-Elec"; + case "DANGER": return "Danger Inc."; + case "DAT-MG": return "DAT Manufacturers Group"; + case "Data Com": return "Data Com Information Systems Pty. Ltd."; + case "DATABOOK": return "Databook, Inc."; + case "DATACOPY": return "Datacopy Corp."; + case "DataCore": return "DataCore Software Corporation"; + case "DataG": return "DataGravity"; + case "DATAPT": return "Datapoint Corp."; + case "DATARAM": return "Dataram Corporation"; + case "DATC": return "Datum Champion Technology Co., Ltd"; + case "DAVIS": return "Daviscomms (S) Pte Ltd"; + case "DCS": return "ShenZhen DCS Group Co.,Ltd"; + case "DDN": return "DataDirect Networks, Inc."; + case "DDRDRIVE": return "DDRdrive LLC"; + case "DE": return "Dimension Engineering LLC"; + case "DEC": return "Digital Equipment Corporation"; + case "DEI": return "Digital Engineering, Inc."; + case "DELL": return "Dell, Inc."; + case "Dell(tm)": return "Dell, Inc"; + case "DELPHI": return "Delphi Data Div. of Sparks Industries, Inc."; + case "DENON": return "Denon/Nippon Columbia"; + case "DenOptix": return "DenOptix, Inc."; + case "DEST": return "DEST Corp."; + case "DFC": return "DavioFranke.com"; + case "DFT": return "Data Fault Tolerance System CO.,LTD."; + case "DGC": return "Data General Corp."; + case "DIGIDATA": return "Digi-Data Corporation"; + case "DigiIntl": return "Digi International"; + case "Digital": return "Digital Equipment Corporation"; + case "DILOG": return "Distributed Logic Corp."; + case "DISC": return "Document Imaging Systems Corp."; + case "DiscSoft": return "Disc Soft Ltd"; + case "DLNET": return "Driveline"; + case "DNS": return "Data and Network Security"; + case "DNUK": return "Digital Networks Uk Ltd"; + case "DotHill": return "Dot Hill Systems Corp."; + case "DP": return "Dell, Inc."; + case "DPT": return "Distributed Processing Technology"; + case "Drewtech": return "Drew Technologies, Inc."; + case "DROBO": return "Data Robotics, Inc."; + case "DSC": return "DigitalStream Corporation"; + case "DSI": return "Data Spectrum, Inc."; + case "DSM": return "Deterner Steuerungs- und Maschinenbau GmbH & Co."; + case "DSNET": return "Cleversafe, Inc."; + case "DT": return "Double-Take Software, INC."; + case "DTC QUME": return "Data Technology Qume"; + case "DXIMAGIN": return "DX Imaging"; + case "E-Motion": return "E-Motion LLC"; + case "EARTHLAB": return "EarthLabs"; + case "EarthLCD": return "Earth Computer Technologies, Inc."; + case "ECCS": return "ECCS, Inc."; + case "ECMA": return "European Computer Manufacturers Association"; + case "EDS": return "Embedded Data Systems"; + case "EIM": return "InfoCore"; + case "ELE Intl": return "ELE International"; + case "ELEGANT": return "Elegant Invention, LLC"; + case "Elektron": return "Elektron Music Machines MAV AB"; + case "elipsan": return "Elipsan UK Ltd."; + case "Elms": return "Elms Systems Corporation"; + case "ELSE": return "ELSE Ltd."; + case "ELSEC": return "Littlemore Scientific"; + case "EMASS": return "EMASS, Inc."; + case "EMC": return "EMC Corp."; + case "EMiT": return "EMiT Conception Eletronique"; + case "EMTEC": return "EMTEC Magnetics"; + case "EMULEX": return "Emulex"; + case "ENERGY-B": return "Energybeam Corporation"; + case "ENGENIO": return "Engenio Information Technologies, Inc."; + case "ENMOTUS": return "Enmotus Inc"; + case "Entacore": return "Entacore"; + case "EPOS": return "EPOS Technologies Ltd."; + case "EPSON": return "Epson"; + case "EQLOGIC": return "EqualLogic"; + case "Eris/RSI": return "RSI Systems, Inc."; + case "ETERNE": return "EterneData Technology Co.,Ltd.(China PRC.)"; + case "EuroLogc": return "Eurologic Systems Limited"; + case "evolve": return "Evolution Technologies, Inc"; + case "EXABYTE": return "Exabyte Corp."; + case "EXATEL": return "Exatelecom Co., Ltd."; + case "EXAVIO": return "Exavio, Inc."; + case "Exsequi": return "Exsequi Ltd"; + case "Exxotest": return "Annecy Electronique"; + case "FAIRHAVN": return "Fairhaven Health, LLC"; + case "FALCON": return "FalconStor, Inc."; + case "FDS": return "Formation Data Systems"; + case "FFEILTD": return "FujiFilm Electonic Imaging Ltd"; + case "Fibxn": return "Fiberxon, Inc."; + case "FID": return "First International Digital, Inc."; + case "FILENET": return "FileNet Corp."; + case "FirmFact": return "Firmware Factory Ltd"; + case "FLYFISH": return "Flyfish Technologies"; + case "FOXCONN": return "Foxconn Technology Group"; + case "FRAMDRV": return "FRAMEDRIVE Corp."; + case "FREECION": return "Nable Communications, Inc."; + case "FRESHDTK": return "FreshDetect GmbH"; + case "FSC": return "Fujitsu Siemens Computers"; + case "FTPL": return "Frontline Technologies Pte Ltd"; + case "FUJI": return "Fuji Electric Co., Ltd. (Japan)"; + case "FUJIFILM": return "Fuji Photo Film, Co., Ltd."; + case "FUJITSU": return "Fujitsu"; + case "FUNAI": return "Funai Electric Co., Ltd."; + case "FUSIONIO": return "Fusion-io Inc."; + case "FUTURED": return "Future Domain Corp."; + case "G&D": return "Giesecke & Devrient GmbH"; + case "G.TRONIC": return "Globaltronic - Electronica e Telecomunicacoes, S.A."; + case "Gadzoox": return "Gadzoox Networks, Inc."; + case "Gammaflx": return "Gammaflux L.P."; + case "GDI": return "Generic Distribution International"; + case "GEMALTO": return "gemalto"; + case "Gen_Dyn": return "General Dynamics"; + case "Generic": return "Generic Technology Co., Ltd."; + case "GENSIG": return "General Signal Networks"; + case "GEO": return "Green Energy Options Ltd"; + case "GIGATAPE": return "GIGATAPE GmbH"; + case "GIGATRND": return "GigaTrend Incorporated"; + case "Global": return "Global Memory Test Consortium"; + case "Gnutek": return "Gnutek Ltd."; + case "Goidelic": return "Goidelic Precision, Inc."; + case "GoldKey": return "GoldKey Security Corporation"; + case "GoldStar": return "LG Electronics Inc."; + case "GOOGLE": return "Google, Inc."; + case "GORDIUS": return "Gordius"; + case "GOULD": return "Gould"; + case "HAGIWARA": return "Hagiwara Sys-Com Co., Ltd."; + case "HAPP3": return "Inventec Multimedia and Telecom co., ltd"; + case "HDS": return "Horizon Data Systems, Inc."; + case "Helldyne": return "Helldyne, Inc"; + case "Heydays": return "Mazo Technology Co., Ltd."; + case "HGST": return "HGST a Western Digital Company"; + case "HI-TECH": return "HI-TECH Software Pty. Ltd."; + case "HITACHI": return "Hitachi America Ltd or Nissei Sangyo America Ltd"; + case "HL-DT-ST": return "Hitachi-LG Data Storage, Inc."; + case "HONEYWEL": return "Honeywell Inc."; + case "Hoptroff": return "HexWax Ltd"; + case "HORIZONT": return "Horizontigo Software"; + case "HP": return "Hewlett Packard"; + case "HPE": return "Hewlett Packard Enterprise"; + case "HPI": return "HP Inc."; + case "HPQ": return "Hewlett Packard"; + case "HUALU": return "CHINA HUALU GROUP CO., LTD"; + case "HUASY": return "Huawei Symantec Technologies Co., Ltd."; + case "HYLINX": return "Hylinx Ltd."; + case "HYUNWON": return "HYUNWON inc"; + case "i-cubed": return "i-cubed ltd."; + case "IBM": return "International Business Machines"; + case "Icefield": return "Icefield Tools Corporation"; + case "Iceweb": return "Iceweb Storage Corp"; + case "ICL": return "ICL"; + case "ICP": return "ICP vortex Computersysteme GmbH"; + case "IDE": return "International Data Engineering, Inc."; + case "IDG": return "Interface Design Group"; + case "IET": return "ISCSI ENTERPRISE TARGET"; + case "IFT": return "Infortrend Technology, Inc."; + case "IGR": return "Intergraph Corp."; + case "IMAGINE": return "Imagine Communications Corp."; + case "IMAGO": return "IMAGO SOFTWARE SL"; + case "IMATION": return "Imation"; + case "IMPLTD": return "Integrated Micro Products Ltd."; + case "IMPRIMIS": return "Imprimis Technology Inc."; + case "INCIPNT": return "Incipient Technologies Inc."; + case "INCITS": return "InterNational Committee for Information Technology"; + case "INDCOMP": return "Industrial Computing Limited"; + case "Indigita": return "Indigita Corporation"; + case "INFOCORE": return "InfoCore"; + case "INITIO": return "Initio Corporation"; + case "INRANGE": return "INRANGE Technologies Corporation"; + case "Insight": return "L-3 Insight Technology Inc"; + case "INSITE": return "Insite Peripherals"; + case "integrix": return "Integrix, Inc."; + case "INTEL": return "Intel Corporation"; + case "Intransa": return "Intransa, Inc."; + case "IOC": return "I/O Concepts, Inc."; + case "iofy": return "iofy Corporation"; + case "IOMEGA": return "Iomega"; + case "IOT": return "IO Turbine, Inc."; + case "iPaper": return "intelliPaper, LLC"; + case "iqstor": return "iQstor Networks, Inc."; + case "iQue": return "iQue"; + case "ISi": return "Information Storage inc."; + case "Isilon": return "Isilon Systems, Inc."; + case "ISO": return "International Standards Organization"; + case "iStor": return "iStor Networks, Inc."; + case "ITC": return "International Tapetronics Corporation"; + case "iTwin": return "iTwin Pte Ltd"; + case "IVIVITY": return "iVivity, Inc."; + case "IVMMLTD": return "InnoVISION Multimedia Ltd."; + case "JABIL001": return "Jabil Circuit"; + case "JETWAY": return "Jetway Information Co., Ltd"; + case "JMR": return "JMR Electronics Inc."; + case "JOFEMAR": return "Jofemar"; + case "JOLLYLOG": return "Jolly Logic"; + case "JPC Inc.": return "JPC Inc."; + case "JSCSI": return "jSCSI Project"; + case "Juniper": return "Juniper Networks"; + case "JVC": return "JVC Information Products Co."; + case "KASHYA": return "Kashya, Inc."; + case "KENNEDY": return "Kennedy Company"; + case "KENWOOD": return "KENWOOD Corporation"; + case "KEWL": return "Shanghai KEWL Imp&Exp Co., Ltd."; + case "Key Tech": return "Key Technologies, Inc"; + case "KMNRIO": return "Kaminario Technologies Ltd."; + case "KODAK": return "Eastman Kodak"; + case "KONAN": return "Konan"; + case "koncepts": return "koncepts International Ltd."; + case "KONICA": return "Konica Japan"; + case "KOVE": return "KOVE"; + case "KSCOM": return "KSCOM Co. Ltd.,"; + case "KUDELSKI": return "Nagravision SA - Kudelski Group"; + case "Kyocera": return "Kyocera Corporation"; + case "Lapida": return "Gonmalo Electronics"; + case "LAPINE": return "Lapine Technology"; + case "LASERDRV": return "LaserDrive Limited"; + case "LASERGR": return "Lasergraphics, Inc."; + case "LeapFrog": return "LeapFrog Enterprises, Inc."; + case "LEFTHAND": return "LeftHand Networks"; + case "Leica": return "Leica Camera AG"; + case "Lexar": return "Lexar Media, Inc."; + case "LEYIO": return "LEYIO"; + case "LG": return "LG Electronics Inc."; + case "LGE": return "LG Electronics Inc."; + case "LIBNOVA": return "LIBNOVA, SL Digital Preservation Systems"; + case "LION": return "Lion Optics Corporation"; + case "LMS": return "Laser Magnetic Storage International Company"; + case "LoupTech": return "Loup Technologies, Inc."; + case "LSI": return "LSI Corp. (was LSI Logic Corp.)"; + case "LSILOGIC": return "LSI Logic Storage Systems, Inc."; + case "LTO-CVE": return "Linear Tape - Open, Compliance Verification Entity"; + case "LUXPRO": return "Luxpro Corporation"; + case "MacroSAN": return "MacroSAN Technologies Co., Ltd."; + case "Malakite": return "Malachite Technologies (New VID is: Sandial)"; + case "MarcBoon": return "marcboon.com"; + case "Marner": return "Marner Storage Technologies, Inc."; + case "MARVELL": return "Marvell Semiconductor, Inc."; + case "Matrix": return "Matrix Orbital Corp."; + case "MATSHITA": return "Matsushita"; + case "MAXELL": return "Hitachi Maxell, Ltd."; + case "MAXIM-IC": return "Maxim Integrated Products"; + case "MaxOptix": return "Maxoptix Corp."; + case "MAXSTRAT": return "Maximum Strategy, Inc."; + case "MAXTOR": return "Maxtor Corp."; + case "MaXXan": return "MaXXan Systems, Inc."; + case "MAYCOM": return "maycom Co., Ltd."; + case "MBEAT": return "K-WON C&C Co.,Ltd"; + case "MCC": return "Measurement Computing Corporation"; + case "McDATA": return "McDATA Corporation"; + case "MCUBE": return "Mcube Technology Co., Ltd."; + case "MDI": return "Micro Design International, Inc."; + case "MEADE": return "Meade Instruments Corporation"; + case "mediamat": return "mediamatic"; + case "MegaElec": return "Mega Electronics Ltd"; + case "MEII": return "Mountain Engineering II, Inc."; + case "MELA": return "Mitsubishi Electronics America"; + case "MELCO": return "Mitsubishi Electric (Japan)"; + case "mellanox": return "Mellanox Technologies Ltd."; + case "MEMOREX": return "Memorex Telex Japan Ltd."; + case "MEMREL": return "Memrel Corporation"; + case "MEMTECH": return "MemTech Technology"; + case "Mendocin": return "Mendocino Software"; + case "MendoCno": return "Mendocino Software"; + case "MERIDATA": return "Oy Meridata Finland Ltd"; + case "METHODEI": return "Methode Electronics India pvt ltd"; + case "METRUM": return "Metrum, Inc."; + case "MHTL": return "Matsunichi Hi-Tech Limited"; + case "MICROBTX": return "Microbotics Inc."; + case "Microchp": return "Microchip Technology, Inc."; + case "MICROLIT": return "Microlite Corporation"; + case "MICRON": return "Micron Technology, Inc."; + case "MICROP": return "Micropolis"; + case "MICROTEK": return "Microtek Storage Corp"; + case "Minitech": return "Minitech (UK) Limited"; + case "Minolta": return "Minolta Corporation"; + case "MINSCRIB": return "Miniscribe"; + case "MiraLink": return "MiraLink Corporation"; + case "Mirifica": return "Mirifica s.r.l."; + case "MITSUMI": return "Mitsumi Electric Co., Ltd."; + case "MKM": return "Mitsubishi Kagaku Media Co., LTD."; + case "Mobii": return "Mobii Systems (Pty.) Ltd."; + case "MOL": return "Petrosoft Sdn. Bhd."; + case "MOSAID": return "Mosaid Technologies Inc."; + case "MOTOROLA": return "Motorola"; + case "MP-400": return "Daiwa Manufacturing Limited"; + case "MPC": return "MPC Corporation"; + case "MPCCORP": return "MPC Computers"; + case "MPEYE": return "Touchstone Technology Co., Ltd"; + case "MPIO": return "DKT Co.,Ltd"; + case "MPM": return "Mitsubishi Paper Mills, Ltd."; + case "MPMan": return "MPMan.com, Inc."; + case "MSFT": return "Microsoft Corporation"; + case "MSI": return "Micro-Star International Corp."; + case "MST": return "Morning Star Technologies, Inc."; + case "MSystems": return "M-Systems Flash Disk Pioneers"; + case "MTI": return "MTI Technology Corporation"; + case "MTNGATE": return "MountainGate Data Systems"; + case "MXI": return "Memory Experts International"; + case "nac": return "nac Image Technology Inc."; + case "NAGRA": return "Nagravision SA - Kudelski Group"; + case "NAI": return "North Atlantic Industries"; + case "NAKAMICH": return "Nakamichi Corporation"; + case "NatInst": return "National Instruments"; + case "NatSemi": return "National Semiconductor Corp."; + case "NCITS": return "InterNational Committee for Information Technology Standards (INCITS)"; + case "NCL": return "NCL America"; + case "NCR": return "NCR Corporation"; + case "NDBTECH": return "NDB Technologie Inc."; + case "Neartek": return "Neartek, Inc."; + case "NEC": return "NEC"; + case "NETAPP": return "NetApp, Inc. (was Network Appliance)"; + case "NetBSD": return "The NetBSD Foundation"; + case "Netcom": return "Netcom Storage"; + case "NETENGIN": return "NetEngine, Inc."; + case "NEWISYS": return "Newisys Data Storage"; + case "Newtech": return "Newtech Co., Ltd."; + case "NEXSAN": return "Nexsan Technologies, Ltd."; + case "NFINIDAT": return "Infinidat Ltd."; + case "NHR": return "NH Research, Inc."; + case "Nike": return "Nike, Inc."; + case "Nimble": return "Nimble Storage"; + case "NISCA": return "NISCA Inc."; + case "NISHAN": return "Nishan Systems Inc."; + case "Nitz": return "Nitz Associates, Inc."; + case "NKK": return "NKK Corp."; + case "NRC": return "Nakamichi Research Corporation"; + case "NSD": return "Nippon Systems Development Co.,Ltd."; + case "NSM": return "NSM Jukebox GmbH"; + case "nStor": return "nStor Technologies, Inc."; + case "NT": return "Northern Telecom"; + case "NUCONNEX": return "NuConnex"; + case "NUSPEED": return "NuSpeed, Inc."; + case "NVIDIA": return "NVIDIA Corporation"; + case "NVMe": return "NVM Express Working Group"; + case "OAI": return "Optical Access International"; + case "OCE": return "Oce Graphics"; + case "ODS": return "ShenZhen DCS Group Co.,Ltd"; + case "OHDEN": return "Ohden Co., Ltd."; + case "OKI": return "OKI Electric Industry Co.,Ltd (Japan)"; + case "Olidata": return "Olidata S.p.A."; + case "OMI": return "Optical Media International"; + case "OMNIFI": return "Rockford Corporation - Omnifi Media"; + case "OMNIS": return "OMNIS Company (FRANCE)"; + case "Ophidian": return "Ophidian Designs"; + case "opslag": return "Tyrone Systems"; + case "Optelec": return "Optelec BV"; + case "Optiarc": return "Sony Optiarc Inc."; + case "OPTIMEM": return "Cipher/Optimem"; + case "OPTOTECH": return "Optotech"; + case "ORACLE": return "Oracle Corporation"; + case "ORANGE": return "Orange Micro, Inc."; + case "ORCA": return "Orca Technology"; + case "Origin": return "Origin Energy"; + case "OSI": return "Optical Storage International"; + case "OSNEXUS": return "OS NEXUS, Inc."; + case "OTL": return "OTL Engineering"; + case "OVERLAND": return "Overland Storage Inc."; + case "pacdigit": return "Pacific Digital Corp"; + case "Packard": return "Parkard Bell"; + case "Panasas": return "Panasas, Inc."; + case "PARALAN": return "Paralan Corporation"; + case "PASCOsci": return "Pasco Scientific"; + case "PATHLGHT": return "Pathlight Technology, Inc."; + case "PCS": return "Pro Charging Systems, LLC"; + case "PerStor": return "Perstor"; + case "PERTEC": return "Pertec Peripherals Corporation"; + case "PFTI": return "Performance Technology Inc."; + case "PFU": return "PFU Limited"; + case "Phigment": return "Phigment Technologies"; + case "PHILIPS": return "Philips Electronics"; + case "PICO": return "Packard Instrument Company"; + case "PIK": return "TECHNILIENT & MCS"; + case "Pillar": return "Pillar Data Systems"; + case "PIONEER": return "Pioneer Electronic Corp."; + case "Pirus": return "Pirus Networks"; + case "PIVOT3": return "Pivot3, Inc."; + case "PLASMON": return "Plasmon Data"; + case "Pliant": return "Pliant Technology, Inc."; + case "PMCSIERA": return "PMC-Sierra"; + case "PME": return "Precision Measurement Engineering"; + case "PNNMed": return "PNN Medical SA"; + case "POKEN": return "Poken SA"; + case "POLYTRON": return "PT. HARTONO ISTANA TEKNOLOGI"; + case "PRAIRIE": return "PrairieTek"; + case "PREPRESS": return "PrePRESS Solutions"; + case "PRESOFT": return "PreSoft Architects"; + case "PRESTON": return "Preston Scientific"; + case "PRIAM": return "Priam"; + case "PRIMAGFX": return "Primagraphics Ltd"; + case "PRIMOS": return "Primos"; + case "PROCOM": return "Procom Technology"; + case "PROLIFIC": return "Prolific Technology Inc."; + case "PROMISE": return "PROMISE TECHNOLOGY, Inc"; + case "PROSTOR": return "ProStor Systems, Inc."; + case "PROSUM": return "PROSUM"; + case "PROWARE": return "Proware Technology Corp."; + case "PTI": return "Peripheral Technology Inc."; + case "PTICO": return "Pacific Technology International"; + case "PURE": return "PURE Storage"; + case "Qi-Hardw": return "Qi Hardware"; + case "QIC": return "Quarter-Inch Cartridge Drive Standards, Inc."; + case "QLogic": return "QLogic Corporation"; + case "QNAP": return "QNAP Systems"; + case "Qsan": return "QSAN Technology, Inc."; + case "QUALSTAR": return "Qualstar"; + case "QUANTEL": return "Quantel Ltd."; + case "QUANTUM": return "Quantum Corp."; + case "QUIX": return "Quix Computerware AG"; + case "R-BYTE": return "R-Byte, Inc."; + case "RACALREC": return "Racal Recorders"; + case "RADITEC": return "Radikal Technologies Deutschland GmbH"; + case "RADSTONE": return "Radstone Technology"; + case "RAIDINC": return "RAID Inc."; + case "RASSYS": return "Rasilient Systems Inc."; + case "RASVIA": return "Rasvia Systems, Inc."; + case "rave-mp": return "Go Video"; + case "RDKMSTG": return "MMS Dipl. Ing. Rolf-Dieter Klein"; + case "RDStor": return "Rorke China"; + case "Readboy": return "Readboy Ltd Co."; + case "Realm": return "Realm Systems"; + case "realtek": return "Realtek Semiconductor Corp."; + case "REDUXIO": return "Reduxio Systems Ltd."; + case "rehanltd": return "Rehan Electronics Ltd"; + case "REKA": return "REKA HEALTH PTE LTD"; + case "RELDATA": return "RELDATA Inc"; + case "RENAGmbH": return "RENA GmbH"; + case "ReThinkM": return "RETHINK MEDICAL, INC"; + case "Revivio": return "Revivio, Inc."; + case "RGBLaser": return "RGB Lasersysteme GmbH"; + case "RGI": return "Raster Graphics, Inc."; + case "RHAPSODY": return "Rhapsody Networks, Inc."; + case "RHS": return "Racal-Heim Systems GmbH"; + case "RICOH": return "Ricoh"; + case "RODIME": return "Rodime"; + case "Rorke": return "RD DATA Technology (ShenZhen) Limited"; + case "Royaltek": return "RoyalTek company Ltd."; + case "RPS": return "RPS"; + case "RTI": return "Reference Technology"; + case "S-D": return "Sauer-Danfoss"; + case "S-flex": return "Storageflex Inc"; + case "S-SYSTEM": return "S-SYSTEM"; + case "S1": return "storONE"; + case "SAMSUNG": return "Samsung Electronics Co., Ltd."; + case "SAN": return "Storage Area Networks, Ltd."; + case "Sandial": return "Sandial Systems, Inc."; + case "SanDisk": return "SanDisk Corporation"; + case "SANKYO": return "Sankyo Seiki"; + case "SANRAD": return "SANRAD Inc."; + case "SANYO": return "SANYO Electric Co., Ltd."; + case "SC.Net": return "StorageConnections.Net"; + case "SCALE": return "Scale Computing, Inc."; + case "SCIENTEK": return "SCIENTEK CORP"; + case "SCInc.": return "Storage Concepts, Inc."; + case "SCREEN": return "Dainippon Screen Mfg. Co., Ltd."; + case "SDI": return "Storage Dimensions, Inc."; + case "SDS": return "Solid Data Systems"; + case "SEAC": return "SeaChange International, Inc."; + case "SEAGATE": return "Seagate"; + case "SEAGRAND": return "SEAGRAND In Japan"; + case "Seanodes": return "Seanodes"; + case "Sec. Key": return "SecureKey Technologies Inc."; + case "SEQUOIA": return "Sequoia Advanced Technologies, Inc."; + case "SGI": return "Silicon Graphics International"; + case "Shannon": return "Shannon Systems Co., Ltd."; + case "Shinko": return "Shinko Electric Co., Ltd."; + case "SIEMENS": return "Siemens"; + case "SigmaTel": return "SigmaTel, Inc."; + case "SII": return "Seiko Instruments Inc."; + case "SIMPLE": return "SimpleTech, Inc."; + case "SIVMSD": return "IMAGO SOFTWARE SL"; + case "SKhynix": return "SK hynix Inc."; + case "SLCNSTOR": return "SiliconStor, Inc."; + case "SLI": return "Sierra Logic, Inc."; + case "SMCI": return "Super Micro Computer, Inc."; + case "SmrtStor": return "Smart Storage Systems"; + case "SMS": return "Scientific Micro Systems/OMTI"; + case "SMSC": return "SMSC Storage, Inc."; + case "SMX": return "Smartronix, Inc."; + case "SNYSIDE": return "Sunnyside Computing Inc."; + case "SoftLock": return "Softlock Digital Security Provider"; + case "SolidFir": return "SolidFire, Inc."; + case "SONIC": return "Sonic Solutions"; + case "SoniqCas": return "SoniqCast"; + case "SONY": return "Sony Corporation Japan"; + case "SOUL": return "Soul Storage Technology (Wuxi) Co., Ltd"; + case "SPD": return "Storage Products Distribution, Inc."; + case "SPECIAL": return "Special Computing Co."; + case "SPECTRA": return "Spectra Logic, a Division of Western Automation Labs, Inc."; + case "SPERRY": return "Sperry"; + case "Spintso": return "Spintso International AB"; + case "STARBORD": return "Starboard Storage Systems, Inc."; + case "STARWIND": return "StarWind Software, Inc."; + case "STEC": return "STEC, Inc."; + case "Sterling": return "Sterling Diagnostic Imaging, Inc."; + case "STK": return "Storage Technology Corporation"; + case "STNWOOD": return "Stonewood Group"; + case "STONEFLY": return "StoneFly Networks, Inc."; + case "STOR": return "StorageNetworks, Inc."; + case "STORAPP": return "StorageApps, Inc."; + case "STORCIUM": return "Intelligent Systems Services Inc."; + case "STORCOMP": return "Storage Computer Corporation"; + case "STORM": return "Storm Technology, Inc."; + case "StorMagc": return "StorMagic"; + case "Stratus": return "Stratus Technologies"; + case "StrmLgc": return "StreamLogic Corp."; + case "SUMITOMO": return "Sumitomo Electric Industries, Ltd."; + case "SUN": return "Sun Microsystems, Inc."; + case "SUNCORP": return "SunCorporation"; + case "suntx": return "Suntx System Co., Ltd"; + case "SUSE": return "SUSE Linux"; + case "Swinxs": return "Swinxs BV"; + case "SYMANTEC": return "Symantec Corporation"; + case "SYMBIOS": return "Symbios Logic Inc."; + case "SYMWAVE": return "Symwave, Inc."; + case "SYNCSORT": return "Syncsort Incorporated"; + case "SYNERWAY": return "Synerway"; + case "SYNOLOGY": return "Synology, Inc."; + case "SyQuest": return "SyQuest Technology, Inc."; + case "SYSGEN": return "Sysgen"; + case "T-MITTON": return "Transmitton England"; + case "T-MOBILE": return "T-Mobile USA, Inc."; + case "T11": return "INCITS Technical Committee T11"; + case "TALARIS": return "Talaris Systems, Inc."; + case "TALLGRAS": return "Tallgrass Technologies"; + case "TANDBERG": return "Tandberg Data A/S"; + case "TANDEM": return "Tandem"; + case "TANDON": return "Tandon"; + case "TCL": return "TCL Shenzhen ASIC MIcro-electronics Ltd"; + case "TDK": return "TDK Corporation"; + case "TEAC": return "TEAC Japan"; + case "TECOLOTE": return "Tecolote Designs"; + case "TEGRA": return "Tegra Varityper"; + case "Teilch": return "Teilch"; + case "Tek": return "Tektronix"; + case "TELLERT": return "Tellert Elektronik GmbH"; + case "TENTIME": return "Laura Technologies, Inc."; + case "TFDATACO": return "TimeForge"; + case "TGEGROUP": return "TGE Group Co.,LTD."; + case "Thecus": return "Thecus Technology Corp."; + case "TI-DSG": return "Texas Instruments"; + case "TiGi": return "TiGi Corporation"; + case "TILDESGN": return "Tildesign bv"; + case "Tite": return "Tite Technology Limited"; + case "TKS Inc.": return "TimeKeeping Systems, Inc."; + case "TLMKS": return "Telemakus LLC"; + case "TMS": return "Texas Memory Systems, Inc."; + case "TMS100": return "TechnoVas"; + case "TOLISGRP": return "The TOLIS Group"; + case "TOSHIBA": return "Toshiba Japan"; + case "TOYOU": return "TOYOU FEIJI ELECTRONICS CO.,LTD."; + case "Tracker": return "Tracker, LLC"; + case "TRIOFLEX": return "Trioflex Oy"; + case "TRIPACE": return "Tripace"; + case "TRLogger": return "TrueLogger Ltd."; + case "TROIKA": return "Troika Networks, Inc."; + case "TRULY": return "TRULY Electronics MFG. LTD."; + case "TRUSTED": return "Trusted Data Corporation"; + case "TSSTcorp": return "Toshiba Samsung Storage Technology Corporation"; + case "TZM": return "TZ Medical"; + case "UD-DVR": return "Bigstone Project."; + case "UDIGITAL": return "United Digital Limited"; + case "UIT": return "United Infomation Technology"; + case "ULTRA": return "UltraStor Corporation"; + case "UNISTOR": return "Unistor Networks, Inc."; + case "UNISYS": return "Unisys"; + case "USCORE": return "Underscore, Inc."; + case "USDC": return "US Design Corp."; + case "Top VASCO": return "Vasco Data Security"; + case "VDS": return "Victor Data Systems Co., Ltd."; + case "VELDANA": return "VELDANA MEDICAL SA"; + case "VENTANA": return "Ventana Medical Systems"; + case "Verari": return "Verari Systems, Inc."; + case "VERBATIM": return "Verbatim Corporation"; + case "Vercet": return "Vercet LLC"; + case "VERITAS": return "VERITAS Software Corporation"; + case "Vexata": return "Vexata Inc"; + case "VEXCEL": return "VEXCEL IMAGING GmbH"; + case "VICOMSL1": return "Vicom Systems, Inc."; + case "VicomSys": return "Vicom Systems, Inc."; + case "VIDEXINC": return "Videx, Inc."; + case "VIOLIN": return "Violin Memory, Inc."; + case "VIRIDENT": return "Virident Systems, Inc."; + case "VITESSE": return "Vitesse Semiconductor Corporation"; + case "VIXEL": return "Vixel Corporation"; + case "VLS": return "Van Lent Systems BV"; + case "VMAX": return "VMAX Technologies Corp."; + case "VMware": return "VMware Inc."; + case "Vobis": return "Vobis Microcomputer AG"; + case "VOLTAIRE": return "Voltaire Ltd."; + case "VRC": return "Vermont Research Corp."; + case "VRugged": return "Vanguard Rugged Storage"; + case "VTGadget": return "Vermont Gadget Company"; + case "Waitec": return "Waitec NV"; + case "WangDAT": return "WangDAT"; + case "WANGTEK": return "Wangtek"; + case "Wasabi": return "Wasabi Systems"; + case "WAVECOM": return "Wavecom"; + case "WD": return "Western Digital Corporation"; + case "WDC": return "Western Digital Corporation"; + case "WDIGTL": return "Western Digital"; + case "WDTI": return "Western Digital Technologies, Inc."; + case "WEARNES": return "Wearnes Technology Corporation"; + case "WeeraRes": return "Weera Research Pte Ltd"; + case "Wildflwr": return "Wildflower Technologies, Inc."; + case "WSC0001": return "Wisecom, Inc."; + case "X3": return "InterNational Committee for Information Technology Standards (INCITS)"; + case "XEBEC": return "Xebec Corporation"; + case "XENSRC": return "XenSource, Inc."; + case "Xerox": return "Xerox Corporation"; + case "XIOtech": return "XIOtech Corporation"; + case "XIRANET": return "Xiranet Communications GmbH"; + case "XIV": return "XIV"; + case "XtremIO": return "XtremIO"; + case "XYRATEX": return "Xyratex"; + case "YINHE": return "NUDT Computer Co."; + case "YIXUN": return "Yixun Electronic Co.,Ltd."; + case "YOTTA": return "YottaYotta, Inc."; + case "Zarva": return "Zarva Digital Technology Co., Ltd."; + case "ZETTA": return "Zetta Systems, Inc."; + case "ZTE": return "ZTE Corporation"; + case "ZVAULT": return "Zetavault"; + default: return SCSIVendorString; } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SecureDigital/CID.cs b/DiscImageChef.Decoders/SecureDigital/CID.cs index fe0ad06d..e0b4ee06 100644 --- a/DiscImageChef.Decoders/SecureDigital/CID.cs +++ b/DiscImageChef.Decoders/SecureDigital/CID.cs @@ -50,11 +50,9 @@ namespace DiscImageChef.Decoders.SecureDigital { public static CID DecodeCID(uint[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 4) - return null; + if(response.Length != 4) return null; byte[] data = new byte[16]; byte[] tmp = new byte[4]; @@ -73,11 +71,9 @@ namespace DiscImageChef.Decoders.SecureDigital public static CID DecodeCID(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 16) - return null; + if(response.Length != 16) return null; byte[] tmp; @@ -99,8 +95,7 @@ namespace DiscImageChef.Decoders.SecureDigital public static string PrettifyCID(CID cid) { - if(cid == null) - return null; + if(cid == null) return null; StringBuilder sb = new StringBuilder(); @@ -108,9 +103,11 @@ namespace DiscImageChef.Decoders.SecureDigital sb.AppendFormat("\tManufacturer: {0}", VendorString.Prettify(cid.Manufacturer)).AppendLine(); sb.AppendFormat("\tApplication ID: {0}", cid.ApplicationID).AppendLine(); sb.AppendFormat("\tProduct name: {0}", cid.ProductName).AppendLine(); - sb.AppendFormat("\tProduct revision: {0:X2}.{1:X2}", (cid.ProductRevision & 0xF0) >> 4, cid.ProductRevision & 0x0F).AppendLine(); + sb.AppendFormat("\tProduct revision: {0:X2}.{1:X2}", (cid.ProductRevision & 0xF0) >> 4, + cid.ProductRevision & 0x0F).AppendLine(); sb.AppendFormat("\tProduct serial number: {0}", cid.ProductSerialNumber).AppendLine(); - sb.AppendFormat("\tDevice manufactured month {0} of {1}", (cid.ManufacturingDate & 0xF00) >> 8, (cid.ManufacturingDate & 0xFF) + 2000).AppendLine(); + sb.AppendFormat("\tDevice manufactured month {0} of {1}", (cid.ManufacturingDate & 0xF00) >> 8, + (cid.ManufacturingDate & 0xFF) + 2000).AppendLine(); sb.AppendFormat("\tCID CRC: 0x{0:X2}", cid.CRC).AppendLine(); return sb.ToString(); @@ -126,4 +123,4 @@ namespace DiscImageChef.Decoders.SecureDigital return PrettifyCID(DecodeCID(response)); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SecureDigital/CSD.cs b/DiscImageChef.Decoders/SecureDigital/CSD.cs index 9411bc6c..5fd9faac 100644 --- a/DiscImageChef.Decoders/SecureDigital/CSD.cs +++ b/DiscImageChef.Decoders/SecureDigital/CSD.cs @@ -72,11 +72,9 @@ namespace DiscImageChef.Decoders.SecureDigital { public static CSD DecodeCSD(uint[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 4) - return null; + if(response.Length != 4) return null; byte[] data = new byte[16]; byte[] tmp = new byte[4]; @@ -95,11 +93,9 @@ namespace DiscImageChef.Decoders.SecureDigital public static CSD DecodeCSD(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 16) - return null; + if(response.Length != 16) return null; CSD csd = new CSD(); @@ -122,8 +118,7 @@ namespace DiscImageChef.Decoders.SecureDigital csd.WriteCurrentAtVddMax = (byte)((response[9] & 0x1C) >> 2); csd.SizeMultiplier = (byte)(((response[9] & 0x03) << 1) + ((response[10] & 0x80) >> 7)); } - else - csd.Size = (uint)(((response[7] & 0x3F) << 16) + (response[8] << 8) + response[9]); + else csd.Size = (uint)(((response[7] & 0x3F) << 16) + (response[8] << 8) + response[9]); csd.EraseBlockEnable = (response[10] & 0x40) == 0x40; csd.EraseSectorSize = (byte)(((response[10] & 0x3F) << 1) + ((response[11] & 0x80) >> 7)); csd.WriteProtectGroupSize = ((byte)(response[11] & 0x7F)); @@ -143,8 +138,7 @@ namespace DiscImageChef.Decoders.SecureDigital public static string PrettifyCSD(CSD csd) { - if(csd == null) - return null; + if(csd == null) return null; double unitFactor = 0; double multiplier = 0; @@ -250,6 +244,7 @@ namespace DiscImageChef.Decoders.SecureDigital multiplier = 8; break; } + result = unitFactor * multiplier; sb.AppendFormat("\tAsynchronous data access time is {0}{1}", result, unit).AppendLine(); @@ -327,29 +322,25 @@ namespace DiscImageChef.Decoders.SecureDigital multiplier = 8; break; } + result = unitFactor * multiplier; sb.AppendFormat("\tDevice's transfer speed: {0}{1}", result, unit).AppendLine(); unit = ""; for(int cl = 0, mask = 1; cl <= 11; cl++, mask <<= 1) { - if((csd.Classes & mask) == mask) - unit += string.Format(" {0}", cl); + if((csd.Classes & mask) == mask) unit += string.Format(" {0}", cl); } sb.AppendFormat("\tDevice support command classes {0}", unit).AppendLine(); sb.AppendFormat("\tRead block length is {0} bytes", Math.Pow(2, csd.ReadBlockLength)).AppendLine(); - if(csd.ReadsPartialBlocks) - sb.AppendLine("\tDevice allows reading partial blocks"); + if(csd.ReadsPartialBlocks) sb.AppendLine("\tDevice allows reading partial blocks"); - if(csd.WriteMisalignment) - sb.AppendLine("\tWrite commands can cross physical block boundaries"); - if(csd.ReadMisalignment) - sb.AppendLine("\tRead commands can cross physical block boundaries"); + if(csd.WriteMisalignment) sb.AppendLine("\tWrite commands can cross physical block boundaries"); + if(csd.ReadMisalignment) sb.AppendLine("\tRead commands can cross physical block boundaries"); - if(csd.DSRImplemented) - sb.AppendLine("\tDevice implements configurable driver stage"); + if(csd.DSRImplemented) sb.AppendLine("\tDevice implements configurable driver stage"); if(csd.Structure == 0) { @@ -357,14 +348,10 @@ namespace DiscImageChef.Decoders.SecureDigital sb.AppendFormat("\tDevice has {0} blocks", (int)result).AppendLine(); result = (csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2) * Math.Pow(2, csd.ReadBlockLength); - if(result > 1073741824) - sb.AppendFormat("\tDevice has {0} GiB", result / 1073741824.0).AppendLine(); - else if(result > 1048576) - sb.AppendFormat("\tDevice has {0} MiB", result / 1048576.0).AppendLine(); - else if(result > 1024) - sb.AppendFormat("\tDevice has {0} KiB", result / 1024.0).AppendLine(); - else - sb.AppendFormat("\tDevice has {0} bytes", result).AppendLine(); + if(result > 1073741824) sb.AppendFormat("\tDevice has {0} GiB", result / 1073741824.0).AppendLine(); + else if(result > 1048576) sb.AppendFormat("\tDevice has {0} MiB", result / 1048576.0).AppendLine(); + else if(result > 1024) sb.AppendFormat("\tDevice has {0} KiB", result / 1024.0).AppendLine(); + else sb.AppendFormat("\tDevice has {0} bytes", result).AppendLine(); } else { @@ -374,12 +361,9 @@ namespace DiscImageChef.Decoders.SecureDigital sb.AppendFormat("\tDevice has {0} TiB", result / 1099511627776.0).AppendLine(); else if(result > 1073741824) sb.AppendFormat("\tDevice has {0} GiB", result / 1073741824.0).AppendLine(); - else if(result > 1048576) - sb.AppendFormat("\tDevice has {0} MiB", result / 1048576.0).AppendLine(); - else if(result > 1024) - sb.AppendFormat("\tDevice has {0} KiB", result / 1024.0).AppendLine(); - else - sb.AppendFormat("\tDevice has {0} bytes", result).AppendLine(); + else if(result > 1048576) sb.AppendFormat("\tDevice has {0} MiB", result / 1048576.0).AppendLine(); + else if(result > 1024) sb.AppendFormat("\tDevice has {0} KiB", result / 1024.0).AppendLine(); + else sb.AppendFormat("\tDevice has {0} bytes", result).AppendLine(); } if(csd.Structure == 0) @@ -496,39 +480,35 @@ namespace DiscImageChef.Decoders.SecureDigital break; } - - if(csd.EraseBlockEnable) - sb.AppendLine("\tDevice can erase multiple blocks"); + if(csd.EraseBlockEnable) sb.AppendLine("\tDevice can erase multiple blocks"); // TODO: Check specification - sb.AppendFormat("\tDevice must erase a minimum of {0} blocks at a time", Convert.ToUInt32(csd.EraseSectorSize) + 1).AppendLine(); + sb.AppendFormat("\tDevice must erase a minimum of {0} blocks at a time", + Convert.ToUInt32(csd.EraseSectorSize) + 1).AppendLine(); if(csd.WriteProtectGroupEnable) { sb.AppendLine("\tDevice can write protect regions"); // TODO: Check specification unitFactor = Convert.ToDouble(csd.WriteProtectGroupSize); - sb.AppendFormat("\tDevice can write protect a minimum of {0} blocks at a time", (int)(result + 1)).AppendLine(); + sb.AppendFormat("\tDevice can write protect a minimum of {0} blocks at a time", (int)(result + 1)) + .AppendLine(); } - else - sb.AppendLine("\tDevice can't write protect regions"); + else sb.AppendLine("\tDevice can't write protect regions"); } - sb.AppendFormat("\tWriting is {0} times slower than reading", Math.Pow(2, csd.WriteSpeedFactor)).AppendLine(); + sb.AppendFormat("\tWriting is {0} times slower than reading", Math.Pow(2, csd.WriteSpeedFactor)) + .AppendLine(); sb.AppendFormat("\tWrite block length is {0} bytes", Math.Pow(2, csd.WriteBlockLength)).AppendLine(); - if(csd.WritesPartialBlocks) - sb.AppendLine("\tDevice allows writing partial blocks"); + if(csd.WritesPartialBlocks) sb.AppendLine("\tDevice allows writing partial blocks"); - if(!csd.Copy) - sb.AppendLine("\tDevice contents are original"); + if(!csd.Copy) sb.AppendLine("\tDevice contents are original"); - if(csd.PermanentWriteProtect) - sb.AppendLine("\tDevice is permanently write protected"); + if(csd.PermanentWriteProtect) sb.AppendLine("\tDevice is permanently write protected"); - if(csd.TemporaryWriteProtect) - sb.AppendLine("\tDevice is temporarily write protected"); + if(csd.TemporaryWriteProtect) sb.AppendLine("\tDevice is temporarily write protected"); if(!csd.FileFormatGroup) { @@ -549,7 +529,8 @@ namespace DiscImageChef.Decoders.SecureDigital } } else - sb.AppendFormat("\tDevice uses unknown file format code {0} and file format group 1", csd.FileFormat).AppendLine(); + sb.AppendFormat("\tDevice uses unknown file format code {0} and file format group 1", csd.FileFormat) + .AppendLine(); sb.AppendFormat("\tCSD CRC: 0x{0:X2}", csd.CRC).AppendLine(); @@ -566,4 +547,4 @@ namespace DiscImageChef.Decoders.SecureDigital return PrettifyCSD(DecodeCSD(response)); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SecureDigital/OCR.cs b/DiscImageChef.Decoders/SecureDigital/OCR.cs index 7c3c6de9..c1f9fc08 100644 --- a/DiscImageChef.Decoders/SecureDigital/OCR.cs +++ b/DiscImageChef.Decoders/SecureDigital/OCR.cs @@ -79,48 +79,32 @@ namespace DiscImageChef.Decoders.SecureDigital public static OCR DecodeOCR(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 4) - return null; + if(response.Length != 4) return null; return DecodeOCR(BitConverter.ToUInt32(response, 0)); } public static string PrettifyOCR(OCR ocr) { - if(ocr == null) - return null; + if(ocr == null) return null; StringBuilder sb = new StringBuilder(); sb.AppendLine("SecureDigital Operation Conditions Register:"); - if(!ocr.PowerUp) - sb.AppendLine("\tDevice is powering up"); - if(ocr.CCS) - sb.AppendLine("\tDevice is SDHC, SDXC or higher"); - if(ocr.UHS) - sb.AppendLine("\tDevice is UHS-II or higher"); - if(ocr.ThreeFive) - sb.AppendLine("\tDevice can work with supply 3.5~3.6V"); - if(ocr.ThreeFour) - sb.AppendLine("\tDevice can work with supply 3.4~3.5V"); - if(ocr.ThreeThree) - sb.AppendLine("\tDevice can work with supply 3.3~3.4V"); - if(ocr.ThreeTwo) - sb.AppendLine("\tDevice can work with supply 3.2~3.3V"); - if(ocr.ThreeOne) - sb.AppendLine("\tDevice can work with supply 3.1~3.2V"); - if(ocr.TwoNine) - sb.AppendLine("\tDevice can work with supply 2.9~3.0V"); - if(ocr.TwoEight) - sb.AppendLine("\tDevice can work with supply 2.8~2.9V"); - if(ocr.TwoSeven) - sb.AppendLine("\tDevice can work with supply 2.7~2.8V"); - if(ocr.OneEight) - sb.AppendLine("\tDevice can switch to work with 1.8V supply"); - if(ocr.LowPower) - sb.AppendLine("\tDevice is in low power mode"); + if(!ocr.PowerUp) sb.AppendLine("\tDevice is powering up"); + if(ocr.CCS) sb.AppendLine("\tDevice is SDHC, SDXC or higher"); + if(ocr.UHS) sb.AppendLine("\tDevice is UHS-II or higher"); + if(ocr.ThreeFive) sb.AppendLine("\tDevice can work with supply 3.5~3.6V"); + if(ocr.ThreeFour) sb.AppendLine("\tDevice can work with supply 3.4~3.5V"); + if(ocr.ThreeThree) sb.AppendLine("\tDevice can work with supply 3.3~3.4V"); + if(ocr.ThreeTwo) sb.AppendLine("\tDevice can work with supply 3.2~3.3V"); + if(ocr.ThreeOne) sb.AppendLine("\tDevice can work with supply 3.1~3.2V"); + if(ocr.TwoNine) sb.AppendLine("\tDevice can work with supply 2.9~3.0V"); + if(ocr.TwoEight) sb.AppendLine("\tDevice can work with supply 2.8~2.9V"); + if(ocr.TwoSeven) sb.AppendLine("\tDevice can work with supply 2.7~2.8V"); + if(ocr.OneEight) sb.AppendLine("\tDevice can switch to work with 1.8V supply"); + if(ocr.LowPower) sb.AppendLine("\tDevice is in low power mode"); return sb.ToString(); } @@ -135,4 +119,4 @@ namespace DiscImageChef.Decoders.SecureDigital return PrettifyOCR(DecodeOCR(response)); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SecureDigital/SCR.cs b/DiscImageChef.Decoders/SecureDigital/SCR.cs index c064981a..10a03e09 100644 --- a/DiscImageChef.Decoders/SecureDigital/SCR.cs +++ b/DiscImageChef.Decoders/SecureDigital/SCR.cs @@ -54,11 +54,9 @@ namespace DiscImageChef.Decoders.SecureDigital { public static SCR DecodeSCR(uint[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 2) - return null; + if(response.Length != 2) return null; byte[] data = new byte[8]; byte[] tmp = new byte[4]; @@ -73,11 +71,9 @@ namespace DiscImageChef.Decoders.SecureDigital public static SCR DecodeSCR(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length != 8) - return null; + if(response.Length != 8) return null; SCR scr = new SCR(); scr.Structure = (byte)((response[0] & 0xF0) >> 4); @@ -98,14 +94,12 @@ namespace DiscImageChef.Decoders.SecureDigital public static string PrettifySCR(SCR scr) { - if(scr == null) - return null; + if(scr == null) return null; StringBuilder sb = new StringBuilder(); sb.AppendLine("SecureDigital Device Configuration Register:"); - if(scr.Structure != 0) - sb.AppendFormat("\tUnknown register version {0}", scr.Structure).AppendLine(); + if(scr.Structure != 0) sb.AppendFormat("\tUnknown register version {0}", scr.Structure).AppendLine(); if(scr.Spec == 0 && scr.Spec3 == false && scr.Spec4 == false && scr.SpecX == 0) sb.AppendLine("\tDevice follows SecureDigital Physical Layer Specification version 1.0x"); @@ -120,8 +114,9 @@ namespace DiscImageChef.Decoders.SecureDigital else if(scr.Spec == 2 && scr.Spec3 == true && scr.SpecX == 1) sb.AppendLine("\tDevice follows SecureDigital Physical Layer Specification version 5.xx"); else - sb.AppendFormat("\tDevice follows SecureDigital Physical Layer Specification with unknown version {0}.{1}.{2}.{3}", - scr.Spec, scr.Spec3, scr.Spec4, scr.SpecX).AppendLine(); + sb + .AppendFormat("\tDevice follows SecureDigital Physical Layer Specification with unknown version {0}.{1}.{2}.{3}", + scr.Spec, scr.Spec3, scr.Spec4, scr.SpecX).AppendLine(); switch(scr.Security) { case 0: @@ -140,26 +135,22 @@ namespace DiscImageChef.Decoders.SecureDigital sb.AppendLine("\tDevice uses CPRM according to specification version 3.xx"); break; default: - sb.AppendFormat("\tDevice uses unknown CPRM specification with code {0}", scr.Security).AppendLine(); + sb.AppendFormat("\tDevice uses unknown CPRM specification with code {0}", scr.Security) + .AppendLine(); break; } - if((scr.BusWidth & 0x01) == 0x01) - sb.AppendLine("\tDevice supports 1-bit data bus"); - if((scr.BusWidth & 0x04) == 0x04) - sb.AppendLine("\tDevice supports 4-bit data bus"); + if((scr.BusWidth & 0x01) == 0x01) sb.AppendLine("\tDevice supports 1-bit data bus"); + if((scr.BusWidth & 0x04) == 0x04) sb.AppendLine("\tDevice supports 4-bit data bus"); - if(scr.ExtendedSecurity != 0) - sb.AppendLine("\tDevice supports extended security"); + if(scr.ExtendedSecurity != 0) sb.AppendLine("\tDevice supports extended security"); if((scr.CommandSupport & 0x08) == 0x08) sb.AppendLine("\tDevice supports extension register multi-block commands"); if((scr.CommandSupport & 0x04) == 0x04) sb.AppendLine("\tDevice supports extension register single-block commands"); - if((scr.CommandSupport & 0x02) == 0x02) - sb.AppendLine("\tDevice supports set block count command"); - if((scr.CommandSupport & 0x01) == 0x01) - sb.AppendLine("\tDevice supports speed class control command"); + if((scr.CommandSupport & 0x02) == 0x02) sb.AppendLine("\tDevice supports set block count command"); + if((scr.CommandSupport & 0x01) == 0x01) sb.AppendLine("\tDevice supports speed class control command"); return sb.ToString(); } @@ -174,4 +165,4 @@ namespace DiscImageChef.Decoders.SecureDigital return PrettifySCR(DecodeSCR(response)); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/SecureDigital/VendorString.cs b/DiscImageChef.Decoders/SecureDigital/VendorString.cs index 0d8400a6..d1c527f9 100644 --- a/DiscImageChef.Decoders/SecureDigital/VendorString.cs +++ b/DiscImageChef.Decoders/SecureDigital/VendorString.cs @@ -38,11 +38,9 @@ namespace DiscImageChef.Decoders.SecureDigital { switch(SDVendorID) { - case 0xAA: - return "QEMU"; - default: - return string.Format("Unknown manufacturer ID 0x{0:X2}", SDVendorID); + case 0xAA: return "QEMU"; + default: return string.Format("Unknown manufacturer ID 0x{0:X2}", SDVendorID); } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Sega/CD.cs b/DiscImageChef.Decoders/Sega/CD.cs index b1b90f6a..ee307689 100644 --- a/DiscImageChef.Decoders/Sega/CD.cs +++ b/DiscImageChef.Decoders/Sega/CD.cs @@ -45,11 +45,9 @@ namespace DiscImageChef.Decoders.Sega public struct IPBin { /// Must be "SEGADISCSYSTEM " or "SEGADATADISC " or "SEGAOS " - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] SegaHardwareID; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] SegaHardwareID; /// 0x010, Varies - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] volume_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] volume_name; /// 0x01B, 0x00 public byte spare_space1; /// 0x01C, Volume version in BCD. <100 = Prerelease. @@ -57,8 +55,7 @@ namespace DiscImageChef.Decoders.Sega /// 0x01E, Bit 0 = 1 => CD-ROM. Rest should be 0. public ushort volume_type; /// 0x020, Unknown, varies! - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] system_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] system_name; /// 0x02B, 0x00 public byte spare_space2; /// 0x02C, Should be 1 @@ -82,55 +79,40 @@ namespace DiscImageChef.Decoders.Sega /// 0x04C, System program work RAM size in bytes public uint sp_work_ram_size; /// 0x050, MMDDYYYY - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] release_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] release_date; /// 0x058, Seems to be all 0x20s - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] - public byte[] unknown1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public byte[] unknown1; /// 0x05F, 0x00 ? public byte spare_space4; /// 0x060, System Reserved Area - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 160)] - public byte[] system_reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 160)] public byte[] system_reserved; /// 0x100, Hardware ID - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] hardware_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] hardware_id; /// 0x113 or 0x110, "SEGA" or "T-xx" - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] developer_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] developer_code; /// 0x118, Another release date, this with month in letters? - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] release_date2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] release_date2; /// 0x120, Domestic version of the game title - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] - public byte[] domestic_title; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] public byte[] domestic_title; /// 0x150, Overseas version of the game title - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] - public byte[] overseas_title; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] public byte[] overseas_title; /// 0x180, Official product code - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] - public byte[] product_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] public byte[] product_code; /// 0x190, Supported peripherals, see above - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] peripherals; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] peripherals; /// 0x1A0, 0x20 - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] spare_space6; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] spare_space6; /// 0x1B0, Inside here should be modem information, but I need to get a modem-enabled game - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] spare_space7; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] spare_space7; /// 0x1F0, Region codes, space-filled - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] region_codes; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] region_codes; } public static IPBin? DecodeIPBin(byte[] ipbin_sector) { - if(ipbin_sector == null) - return null; + if(ipbin_sector == null) return null; - if(ipbin_sector.Length < 512) - return null; + if(ipbin_sector.Length < 512) return null; IPBin ipbin = new IPBin(); IntPtr ptr = Marshal.AllocHGlobal(512); @@ -138,37 +120,51 @@ namespace DiscImageChef.Decoders.Sega ipbin = (IPBin)Marshal.PtrToStructure(ptr, typeof(IPBin)); Marshal.FreeHGlobal(ptr); - DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.volume_name = \"{0}\"", Encoding.ASCII.GetString(ipbin.volume_name)); - DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.system_name = \"{0}\"", Encoding.ASCII.GetString(ipbin.system_name)); - DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.volume_version = \"{0:X}\"", ipbin.volume_version); + DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.volume_name = \"{0}\"", + Encoding.ASCII.GetString(ipbin.volume_name)); + DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.system_name = \"{0}\"", + Encoding.ASCII.GetString(ipbin.system_name)); + DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.volume_version = \"{0:X}\"", + ipbin.volume_version); DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.volume_type = 0x{0:X8}", ipbin.volume_type); DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.system_version = 0x{0:X8}", ipbin.system_version); DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.ip_address = 0x{0:X8}", ipbin.ip_address); DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.ip_loadsize = {0}", ipbin.ip_loadsize); - DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.ip_entry_address = 0x{0:X8}", ipbin.ip_entry_address); + DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.ip_entry_address = 0x{0:X8}", + ipbin.ip_entry_address); DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.ip_work_ram_size = {0}", ipbin.ip_work_ram_size); DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.sp_address = 0x{0:X8}", ipbin.sp_address); DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.sp_loadsize = {0}", ipbin.sp_loadsize); - DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.sp_entry_address = 0x{0:X8}", ipbin.sp_entry_address); + DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.sp_entry_address = 0x{0:X8}", + ipbin.sp_entry_address); DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.sp_work_ram_size = {0}", ipbin.sp_work_ram_size); - DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.release_date = \"{0}\"", Encoding.ASCII.GetString(ipbin.release_date)); - DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.release_date2 = \"{0}\"", Encoding.ASCII.GetString(ipbin.release_date2)); - DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.developer_code = \"{0}\"", Encoding.ASCII.GetString(ipbin.developer_code)); - DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.domestic_title = \"{0}\"", Encoding.ASCII.GetString(ipbin.domestic_title)); - DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.overseas_title = \"{0}\"", Encoding.ASCII.GetString(ipbin.overseas_title)); - DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.product_code = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_code)); - DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.peripherals = \"{0}\"", Encoding.ASCII.GetString(ipbin.peripherals)); - DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.region_codes = \"{0}\"", Encoding.ASCII.GetString(ipbin.region_codes)); + DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.release_date = \"{0}\"", + Encoding.ASCII.GetString(ipbin.release_date)); + DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.release_date2 = \"{0}\"", + Encoding.ASCII.GetString(ipbin.release_date2)); + DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.developer_code = \"{0}\"", + Encoding.ASCII.GetString(ipbin.developer_code)); + DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.domestic_title = \"{0}\"", + Encoding.ASCII.GetString(ipbin.domestic_title)); + DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.overseas_title = \"{0}\"", + Encoding.ASCII.GetString(ipbin.overseas_title)); + DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.product_code = \"{0}\"", + Encoding.ASCII.GetString(ipbin.product_code)); + DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.peripherals = \"{0}\"", + Encoding.ASCII.GetString(ipbin.peripherals)); + DicConsole.DebugWriteLine("ISO9660 plugin", "segacd_ipbin.region_codes = \"{0}\"", + Encoding.ASCII.GetString(ipbin.region_codes)); string id = Encoding.ASCII.GetString(ipbin.SegaHardwareID); - return id == "SEGADISCSYSTEM " || id == "SEGADATADISC " || id == "SEGAOS " ? ipbin : (IPBin?)null; + return id == "SEGADISCSYSTEM " || id == "SEGADATADISC " || id == "SEGAOS " + ? ipbin + : (IPBin?)null; } public static string Prettify(IPBin? decoded) { - if(decoded == null) - return null; + if(decoded == null) return null; IPBin ipbin = decoded.Value; @@ -181,15 +177,13 @@ namespace DiscImageChef.Decoders.Sega // Decoding all data DateTime ipbindate = DateTime.MinValue; CultureInfo provider = CultureInfo.InvariantCulture; - try - { - ipbindate = DateTime.ParseExact(Encoding.ASCII.GetString(ipbin.release_date), "MMddyyyy", provider); - } + try { ipbindate = DateTime.ParseExact(Encoding.ASCII.GetString(ipbin.release_date), "MMddyyyy", provider); } catch { try { - ipbindate = DateTime.ParseExact(Encoding.ASCII.GetString(ipbin.release_date2), "yyyy.MMM", provider); + ipbindate = DateTime.ParseExact(Encoding.ASCII.GetString(ipbin.release_date2), "yyyy.MMM", + provider); } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { } @@ -218,20 +212,26 @@ namespace DiscImageChef.Decoders.Sega //IPBinInformation.AppendFormat("System version: {0}", Encoding.ASCII.GetString(ipbin.system_version)).AppendLine(); IPBinInformation.AppendFormat("Initial program address: 0x{0:X8}", ipbin.ip_address).AppendLine(); IPBinInformation.AppendFormat("Initial program load size: {0} bytes", ipbin.ip_loadsize).AppendLine(); - IPBinInformation.AppendFormat("Initial program entry address: 0x{0:X8}", ipbin.ip_entry_address).AppendLine(); + IPBinInformation.AppendFormat("Initial program entry address: 0x{0:X8}", ipbin.ip_entry_address) + .AppendLine(); IPBinInformation.AppendFormat("Initial program work RAM: {0} bytes", ipbin.ip_work_ram_size).AppendLine(); IPBinInformation.AppendFormat("System program address: 0x{0:X8}", ipbin.sp_address).AppendLine(); IPBinInformation.AppendFormat("System program load size: {0} bytes", ipbin.sp_loadsize).AppendLine(); - IPBinInformation.AppendFormat("System program entry address: 0x{0:X8}", ipbin.sp_entry_address).AppendLine(); + IPBinInformation.AppendFormat("System program entry address: 0x{0:X8}", ipbin.sp_entry_address) + .AppendLine(); IPBinInformation.AppendFormat("System program work RAM: {0} bytes", ipbin.sp_work_ram_size).AppendLine(); if(ipbindate != DateTime.MinValue) IPBinInformation.AppendFormat("Release date: {0}", ipbindate).AppendLine(); //IPBinInformation.AppendFormat("Release date (other format): {0}", Encoding.ASCII.GetString(release_date2)).AppendLine(); IPBinInformation.AppendFormat("Hardware ID: {0}", Encoding.ASCII.GetString(ipbin.hardware_id)).AppendLine(); - IPBinInformation.AppendFormat("Developer code: {0}", Encoding.ASCII.GetString(ipbin.developer_code)).AppendLine(); - IPBinInformation.AppendFormat("Domestic title: {0}", Encoding.ASCII.GetString(ipbin.domestic_title)).AppendLine(); - IPBinInformation.AppendFormat("Overseas title: {0}", Encoding.ASCII.GetString(ipbin.overseas_title)).AppendLine(); - IPBinInformation.AppendFormat("Product code: {0}", Encoding.ASCII.GetString(ipbin.product_code)).AppendLine(); + IPBinInformation.AppendFormat("Developer code: {0}", Encoding.ASCII.GetString(ipbin.developer_code)) + .AppendLine(); + IPBinInformation.AppendFormat("Domestic title: {0}", Encoding.ASCII.GetString(ipbin.domestic_title)) + .AppendLine(); + IPBinInformation.AppendFormat("Overseas title: {0}", Encoding.ASCII.GetString(ipbin.overseas_title)) + .AppendLine(); + IPBinInformation.AppendFormat("Product code: {0}", Encoding.ASCII.GetString(ipbin.product_code)) + .AppendLine(); IPBinInformation.AppendFormat("Peripherals:").AppendLine(); foreach(byte peripheral in ipbin.peripherals) { @@ -270,13 +270,13 @@ namespace DiscImageChef.Decoders.Sega case 'V': IPBinInformation.AppendLine("Game supports paddle controller."); break; - case ' ': - break; + case ' ': break; default: IPBinInformation.AppendFormat("Game supports unknown peripheral {0}.", peripheral).AppendLine(); break; } } + IPBinInformation.AppendLine("Regions supported:"); foreach(byte region in ipbin.region_codes) { @@ -291,8 +291,7 @@ namespace DiscImageChef.Decoders.Sega case 'E': IPBinInformation.AppendLine("Europe PAL."); break; - case ' ': - break; + case ' ': break; default: IPBinInformation.AppendFormat("Game supports unknown region {0}.", region).AppendLine(); break; @@ -302,4 +301,4 @@ namespace DiscImageChef.Decoders.Sega return IPBinInformation.ToString(); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Sega/Dreamcast.cs b/DiscImageChef.Decoders/Sega/Dreamcast.cs index ac121e50..74fbe8ef 100644 --- a/DiscImageChef.Decoders/Sega/Dreamcast.cs +++ b/DiscImageChef.Decoders/Sega/Dreamcast.cs @@ -44,18 +44,15 @@ namespace DiscImageChef.Decoders.Sega public struct IPBin { /// Must be "SEGA SEGAKATANA " - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] SegaHardwareID; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] SegaHardwareID; /// 0x010, "SEGA ENTERPRISES" - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] maker_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] maker_id; /// 0x020, CRC of product_no and product_version public uint dreamcast_crc; /// 0x024, " " public byte spare_space1; /// 0x025, "GD-ROM" - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] dreamcast_media; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] dreamcast_media; /// 0x02B, Disc number public byte disc_no; /// 0x02C, '/' @@ -63,49 +60,36 @@ namespace DiscImageChef.Decoders.Sega /// 0x02D, Total number of discs public byte disc_total_nos; /// 0x02E, " " - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] spare_space2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] spare_space2; /// 0x030, Region codes, space-filled - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] region_codes; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] region_codes; /// 0x038, Supported peripherals, bitwise - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] - public byte[] peripherals; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public byte[] peripherals; /// 0x03F, ' ' public byte spare_space3; /// 0x040, Product number - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] product_no; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] product_no; /// 0x04A, Product version - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] product_version; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] product_version; /// 0x050, YYYYMMDD - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] release_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] release_date; /// 0x058, " " - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] spare_space4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] spare_space4; /// 0x060, Usually "1ST_READ.BIN" or "0WINCE.BIN " - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] boot_filename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] boot_filename; /// 0x06C, " " - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] spare_space5; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] spare_space5; /// 0x070, Game producer, space-filled - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] producer; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] producer; /// 0x080, Game name, space-filled - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] product_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] product_name; } public static IPBin? DecodeIPBin(byte[] ipbin_sector) { - if(ipbin_sector == null) - return null; + if(ipbin_sector == null) return null; - if(ipbin_sector.Length < 512) - return null; + if(ipbin_sector.Length < 512) return null; IPBin ipbin = new IPBin(); IntPtr ptr = Marshal.AllocHGlobal(512); @@ -113,30 +97,44 @@ namespace DiscImageChef.Decoders.Sega ipbin = (IPBin)Marshal.PtrToStructure(ptr, typeof(IPBin)); Marshal.FreeHGlobal(ptr); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.maker_id = \"{0}\"", Encoding.ASCII.GetString(ipbin.maker_id)); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.spare_space1 = \"{0}\"", (char)ipbin.spare_space1); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.dreamcast_media = \"{0}\"", Encoding.ASCII.GetString(ipbin.dreamcast_media)); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.maker_id = \"{0}\"", + Encoding.ASCII.GetString(ipbin.maker_id)); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.spare_space1 = \"{0}\"", + (char)ipbin.spare_space1); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.dreamcast_media = \"{0}\"", + Encoding.ASCII.GetString(ipbin.dreamcast_media)); DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.disc_no = {0}", (char)ipbin.disc_no); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.disc_no_separator = \"{0}\"", (char)ipbin.disc_no_separator); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.disc_total_nos = \"{0}\"", (char)ipbin.disc_total_nos); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.spare_space2 = \"{0}\"", Encoding.ASCII.GetString(ipbin.spare_space2)); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.region_codes = \"{0}\"", Encoding.ASCII.GetString(ipbin.region_codes)); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.peripherals = \"{0}\"", Encoding.ASCII.GetString(ipbin.peripherals)); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.product_no = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_no)); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.product_version = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_version)); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.release_date = \"{0}\"", Encoding.ASCII.GetString(ipbin.release_date)); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.spare_space3 = \"{0}\"", (char)ipbin.spare_space3); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.boot_filename = \"{0}\"", Encoding.ASCII.GetString(ipbin.boot_filename)); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.producer = \"{0}\"", Encoding.ASCII.GetString(ipbin.producer)); - DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.product_name = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_name)); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.disc_no_separator = \"{0}\"", + (char)ipbin.disc_no_separator); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.disc_total_nos = \"{0}\"", + (char)ipbin.disc_total_nos); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.spare_space2 = \"{0}\"", + Encoding.ASCII.GetString(ipbin.spare_space2)); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.region_codes = \"{0}\"", + Encoding.ASCII.GetString(ipbin.region_codes)); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.peripherals = \"{0}\"", + Encoding.ASCII.GetString(ipbin.peripherals)); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.product_no = \"{0}\"", + Encoding.ASCII.GetString(ipbin.product_no)); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.product_version = \"{0}\"", + Encoding.ASCII.GetString(ipbin.product_version)); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.release_date = \"{0}\"", + Encoding.ASCII.GetString(ipbin.release_date)); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.spare_space3 = \"{0}\"", + (char)ipbin.spare_space3); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.boot_filename = \"{0}\"", + Encoding.ASCII.GetString(ipbin.boot_filename)); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.producer = \"{0}\"", + Encoding.ASCII.GetString(ipbin.producer)); + DicConsole.DebugWriteLine("ISO9660 plugin", "dreamcast_ipbin.product_name = \"{0}\"", + Encoding.ASCII.GetString(ipbin.product_name)); return Encoding.ASCII.GetString(ipbin.SegaHardwareID) == "SEGA SEGAKATANA " ? ipbin : (IPBin?)null; } public static string Prettify(IPBin? decoded) { - if(decoded == null) - return null; + if(decoded == null) return null; IPBin ipbin = decoded.Value; @@ -150,12 +148,16 @@ namespace DiscImageChef.Decoders.Sega DateTime ipbindate; CultureInfo provider = CultureInfo.InvariantCulture; ipbindate = DateTime.ParseExact(Encoding.ASCII.GetString(ipbin.release_date), "yyyyMMdd", provider); - IPBinInformation.AppendFormat("Product name: {0}", Encoding.ASCII.GetString(ipbin.product_name)).AppendLine(); - IPBinInformation.AppendFormat("Product version: {0}", Encoding.ASCII.GetString(ipbin.product_version)).AppendLine(); + IPBinInformation.AppendFormat("Product name: {0}", Encoding.ASCII.GetString(ipbin.product_name)) + .AppendLine(); + IPBinInformation.AppendFormat("Product version: {0}", Encoding.ASCII.GetString(ipbin.product_version)) + .AppendLine(); IPBinInformation.AppendFormat("Product CRC: 0x{0:X8}", ipbin.dreamcast_crc).AppendLine(); IPBinInformation.AppendFormat("Producer: {0}", Encoding.ASCII.GetString(ipbin.producer)).AppendLine(); - IPBinInformation.AppendFormat("Disc media: {0}", Encoding.ASCII.GetString(ipbin.dreamcast_media)).AppendLine(); - IPBinInformation.AppendFormat("Disc number {0} of {1}", (char)ipbin.disc_no, (char)ipbin.disc_total_nos).AppendLine(); + IPBinInformation.AppendFormat("Disc media: {0}", Encoding.ASCII.GetString(ipbin.dreamcast_media)) + .AppendLine(); + IPBinInformation.AppendFormat("Disc number {0} of {1}", (char)ipbin.disc_no, (char)ipbin.disc_total_nos) + .AppendLine(); IPBinInformation.AppendFormat("Release date: {0}", ipbindate).AppendLine(); switch(Encoding.ASCII.GetString(ipbin.boot_filename)) { @@ -166,9 +168,11 @@ namespace DiscImageChef.Decoders.Sega IPBinInformation.AppendLine("Disc boots using Windows CE."); break; default: - IPBinInformation.AppendFormat("Disc boots using unknown loader: {0}.", Encoding.ASCII.GetString(ipbin.boot_filename)).AppendLine(); + IPBinInformation.AppendFormat("Disc boots using unknown loader: {0}.", + Encoding.ASCII.GetString(ipbin.boot_filename)).AppendLine(); break; } + IPBinInformation.AppendLine("Regions supported:"); foreach(byte region in ipbin.region_codes) { @@ -183,8 +187,7 @@ namespace DiscImageChef.Decoders.Sega case 'E': IPBinInformation.AppendLine("Europe PAL."); break; - case ' ': - break; + case ' ': break; default: IPBinInformation.AppendFormat("Game supports unknown region {0}.", region).AppendLine(); break; @@ -193,33 +196,22 @@ namespace DiscImageChef.Decoders.Sega int iPeripherals = int.Parse(Encoding.ASCII.GetString(ipbin.peripherals), NumberStyles.HexNumber); - if((iPeripherals & 0x00000001) == 0x00000001) - IPBinInformation.AppendLine("Game uses Windows CE."); + if((iPeripherals & 0x00000001) == 0x00000001) IPBinInformation.AppendLine("Game uses Windows CE."); IPBinInformation.AppendFormat("Peripherals:").AppendLine(); - if((iPeripherals & 0x00000010) == 0x00000010) - IPBinInformation.AppendLine("Game supports the VGA Box."); - if((iPeripherals & 0x00000100) == 0x00000100) - IPBinInformation.AppendLine("Game supports other expansion."); - if((iPeripherals & 0x00000200) == 0x00000200) - IPBinInformation.AppendLine("Game supports Puru Puru pack."); - if((iPeripherals & 0x00000400) == 0x00000400) - IPBinInformation.AppendLine("Game supports Mike Device."); - if((iPeripherals & 0x00000800) == 0x00000800) - IPBinInformation.AppendLine("Game supports Memory Card."); + if((iPeripherals & 0x00000010) == 0x00000010) IPBinInformation.AppendLine("Game supports the VGA Box."); + if((iPeripherals & 0x00000100) == 0x00000100) IPBinInformation.AppendLine("Game supports other expansion."); + if((iPeripherals & 0x00000200) == 0x00000200) IPBinInformation.AppendLine("Game supports Puru Puru pack."); + if((iPeripherals & 0x00000400) == 0x00000400) IPBinInformation.AppendLine("Game supports Mike Device."); + if((iPeripherals & 0x00000800) == 0x00000800) IPBinInformation.AppendLine("Game supports Memory Card."); if((iPeripherals & 0x00001000) == 0x00001000) IPBinInformation.AppendLine("Game requires A + B + Start buttons and D-Pad."); - if((iPeripherals & 0x00002000) == 0x00002000) - IPBinInformation.AppendLine("Game requires C button."); - if((iPeripherals & 0x00004000) == 0x00004000) - IPBinInformation.AppendLine("Game requires D button."); - if((iPeripherals & 0x00008000) == 0x00008000) - IPBinInformation.AppendLine("Game requires X button."); - if((iPeripherals & 0x00010000) == 0x00010000) - IPBinInformation.AppendLine("Game requires Y button."); - if((iPeripherals & 0x00020000) == 0x00020000) - IPBinInformation.AppendLine("Game requires Z button."); + if((iPeripherals & 0x00002000) == 0x00002000) IPBinInformation.AppendLine("Game requires C button."); + if((iPeripherals & 0x00004000) == 0x00004000) IPBinInformation.AppendLine("Game requires D button."); + if((iPeripherals & 0x00008000) == 0x00008000) IPBinInformation.AppendLine("Game requires X button."); + if((iPeripherals & 0x00010000) == 0x00010000) IPBinInformation.AppendLine("Game requires Y button."); + if((iPeripherals & 0x00020000) == 0x00020000) IPBinInformation.AppendLine("Game requires Z button."); if((iPeripherals & 0x00040000) == 0x00040000) IPBinInformation.AppendLine("Game requires expanded direction buttons."); if((iPeripherals & 0x00080000) == 0x00080000) @@ -234,12 +226,9 @@ namespace DiscImageChef.Decoders.Sega IPBinInformation.AppendLine("Game requires expanded analog horizontal controller."); if((iPeripherals & 0x01000000) == 0x01000000) IPBinInformation.AppendLine("Game requires expanded analog vertical controller."); - if((iPeripherals & 0x02000000) == 0x02000000) - IPBinInformation.AppendLine("Game supports Gun."); - if((iPeripherals & 0x04000000) == 0x04000000) - IPBinInformation.AppendLine("Game supports Keyboard."); - if((iPeripherals & 0x08000000) == 0x08000000) - IPBinInformation.AppendLine("Game supports Mouse."); + if((iPeripherals & 0x02000000) == 0x02000000) IPBinInformation.AppendLine("Game supports Gun."); + if((iPeripherals & 0x04000000) == 0x04000000) IPBinInformation.AppendLine("Game supports Keyboard."); + if((iPeripherals & 0x08000000) == 0x08000000) IPBinInformation.AppendLine("Game supports Mouse."); if((iPeripherals & 0xEE) != 0) IPBinInformation.AppendFormat("Game supports unknown peripherals mask {0:X2}", (iPeripherals & 0xEE)); @@ -247,4 +236,4 @@ namespace DiscImageChef.Decoders.Sega return IPBinInformation.ToString(); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Sega/Saturn.cs b/DiscImageChef.Decoders/Sega/Saturn.cs index e875b72b..7b475d47 100644 --- a/DiscImageChef.Decoders/Sega/Saturn.cs +++ b/DiscImageChef.Decoders/Sega/Saturn.cs @@ -44,23 +44,17 @@ namespace DiscImageChef.Decoders.Sega public struct IPBin { /// Must be "SEGA SEGASATURN " - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] SegaHardwareID; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] SegaHardwareID; /// 0x010, "SEGA ENTERPRISES" - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] maker_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] maker_id; /// 0x020, Product number - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] product_no; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] product_no; /// 0x02A, Product version - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] product_version; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] product_version; /// 0x030, YYYYMMDD - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] release_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] release_date; /// 0x038, "CD-" - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] saturn_media; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] saturn_media; /// 0x03B, Disc number public byte disc_no; /// // 0x03C, '/' @@ -68,26 +62,20 @@ namespace DiscImageChef.Decoders.Sega /// // 0x03D, Total number of discs public byte disc_total_nos; /// 0x03E, " " - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] spare_space1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] spare_space1; /// 0x040, Region codes, space-filled - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] region_codes; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] region_codes; /// 0x050, Supported peripherals, see above - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] peripherals; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] peripherals; /// 0x060, Game name, space-filled - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 112)] - public byte[] product_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 112)] public byte[] product_name; } public static IPBin? DecodeIPBin(byte[] ipbin_sector) { - if(ipbin_sector == null) - return null; + if(ipbin_sector == null) return null; - if(ipbin_sector.Length < 512) - return null; + if(ipbin_sector.Length < 512) return null; IPBin ipbin = new IPBin(); IntPtr ptr = Marshal.AllocHGlobal(512); @@ -95,27 +83,38 @@ namespace DiscImageChef.Decoders.Sega ipbin = (IPBin)Marshal.PtrToStructure(ptr, typeof(IPBin)); Marshal.FreeHGlobal(ptr); - DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.maker_id = \"{0}\"", Encoding.ASCII.GetString(ipbin.maker_id)); - DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.product_no = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_no)); - DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.product_version = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_version)); - DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.release_datedate = \"{0}\"", Encoding.ASCII.GetString(ipbin.release_date)); - DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.saturn_media = \"{0}\"", Encoding.ASCII.GetString(ipbin.saturn_media)); + DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.maker_id = \"{0}\"", + Encoding.ASCII.GetString(ipbin.maker_id)); + DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.product_no = \"{0}\"", + Encoding.ASCII.GetString(ipbin.product_no)); + DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.product_version = \"{0}\"", + Encoding.ASCII.GetString(ipbin.product_version)); + DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.release_datedate = \"{0}\"", + Encoding.ASCII.GetString(ipbin.release_date)); + DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.saturn_media = \"{0}\"", + Encoding.ASCII.GetString(ipbin.saturn_media)); DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.disc_no = {0}", (char)ipbin.disc_no); - DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.disc_no_separator = \"{0}\"", (char)ipbin.disc_no_separator); - DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.disc_total_nos = {0}", (char)ipbin.disc_total_nos); - DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.release_date = \"{0}\"", Encoding.ASCII.GetString(ipbin.release_date)); - DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.spare_space1 = \"{0}\"", Encoding.ASCII.GetString(ipbin.spare_space1)); - DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.region_codes = \"{0}\"", Encoding.ASCII.GetString(ipbin.region_codes)); - DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.peripherals = \"{0}\"", Encoding.ASCII.GetString(ipbin.peripherals)); - DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.product_name = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_name)); + DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.disc_no_separator = \"{0}\"", + (char)ipbin.disc_no_separator); + DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.disc_total_nos = {0}", + (char)ipbin.disc_total_nos); + DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.release_date = \"{0}\"", + Encoding.ASCII.GetString(ipbin.release_date)); + DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.spare_space1 = \"{0}\"", + Encoding.ASCII.GetString(ipbin.spare_space1)); + DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.region_codes = \"{0}\"", + Encoding.ASCII.GetString(ipbin.region_codes)); + DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.peripherals = \"{0}\"", + Encoding.ASCII.GetString(ipbin.peripherals)); + DicConsole.DebugWriteLine("ISO9660 plugin", "saturn_ipbin.product_name = \"{0}\"", + Encoding.ASCII.GetString(ipbin.product_name)); return Encoding.ASCII.GetString(ipbin.SegaHardwareID) == "SEGA SEGASATURN " ? ipbin : (IPBin?)null; } public static string Prettify(IPBin? decoded) { - if(decoded == null) - return null; + if(decoded == null) return null; IPBin ipbin = decoded.Value; @@ -129,11 +128,15 @@ namespace DiscImageChef.Decoders.Sega DateTime ipbindate; CultureInfo provider = CultureInfo.InvariantCulture; ipbindate = DateTime.ParseExact(Encoding.ASCII.GetString(ipbin.release_date), "yyyyMMdd", provider); - IPBinInformation.AppendFormat("Product name: {0}", Encoding.ASCII.GetString(ipbin.product_name)).AppendLine(); - IPBinInformation.AppendFormat("Product number: {0}", Encoding.ASCII.GetString(ipbin.product_no)).AppendLine(); - IPBinInformation.AppendFormat("Product version: {0}", Encoding.ASCII.GetString(ipbin.product_version)).AppendLine(); + IPBinInformation.AppendFormat("Product name: {0}", Encoding.ASCII.GetString(ipbin.product_name)) + .AppendLine(); + IPBinInformation.AppendFormat("Product number: {0}", Encoding.ASCII.GetString(ipbin.product_no)) + .AppendLine(); + IPBinInformation.AppendFormat("Product version: {0}", Encoding.ASCII.GetString(ipbin.product_version)) + .AppendLine(); IPBinInformation.AppendFormat("Release date: {0}", ipbindate).AppendLine(); - IPBinInformation.AppendFormat("Disc number {0} of {1}", (char)ipbin.disc_no, (char)ipbin.disc_total_nos).AppendLine(); + IPBinInformation.AppendFormat("Disc number {0} of {1}", (char)ipbin.disc_no, (char)ipbin.disc_total_nos) + .AppendLine(); IPBinInformation.AppendFormat("Peripherals:").AppendLine(); foreach(byte peripheral in ipbin.peripherals) @@ -158,13 +161,13 @@ namespace DiscImageChef.Decoders.Sega case 'T': IPBinInformation.AppendLine("Game supports multitap."); break; - case ' ': - break; + case ' ': break; default: IPBinInformation.AppendFormat("Game supports unknown peripheral {0}.", peripheral).AppendLine(); break; } } + IPBinInformation.AppendLine("Regions supported:"); foreach(byte region in ipbin.region_codes) { @@ -182,8 +185,7 @@ namespace DiscImageChef.Decoders.Sega case 'T': IPBinInformation.AppendLine("Asia NTSC."); break; - case ' ': - break; + case ' ': break; default: IPBinInformation.AppendFormat("Game supports unknown region {0}.", region).AppendLine(); break; @@ -193,4 +195,4 @@ namespace DiscImageChef.Decoders.Sega return IPBinInformation.ToString(); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Xbox/DMI.cs b/DiscImageChef.Decoders/Xbox/DMI.cs index 04dddbc9..d2d72bf7 100644 --- a/DiscImageChef.Decoders/Xbox/DMI.cs +++ b/DiscImageChef.Decoders/Xbox/DMI.cs @@ -39,44 +39,30 @@ namespace DiscImageChef.Decoders.Xbox { public static bool IsXbox(byte[] dmi) { - if(dmi == null) - return false; - if(dmi.Length != 2052) - return false; + if(dmi == null) return false; + if(dmi.Length != 2052) return false; // Version is 1 - if(BitConverter.ToUInt32(dmi, 4) != 1) - return false; + if(BitConverter.ToUInt32(dmi, 4) != 1) return false; // Catalogue number is two letters, five numbers, one letter - for(int i = 12; i < 14; i++) - { - if(dmi[i] < 0x41 || dmi[i] > 0x5A) - return false; - } - for(int i = 14; i < 19; i++) - { - if(dmi[i] < 0x30 || dmi[i] > 0x39) - return false; - } - if(dmi[19] < 0x41 || dmi[19] > 0x5A) - return false; + for(int i = 12; i < 14; i++) { if(dmi[i] < 0x41 || dmi[i] > 0x5A) return false; } + for(int i = 14; i < 19; i++) { if(dmi[i] < 0x30 || dmi[i] > 0x39) return false; } + + if(dmi[19] < 0x41 || dmi[19] > 0x5A) return false; long timestamp = BitConverter.ToInt64(dmi, 20); // Game cannot exist before the Xbox - if(timestamp < 0x1BD164833DFC000) - return false; + if(timestamp < 0x1BD164833DFC000) return false; return true; } public static bool IsXbox360(byte[] dmi) { - if(dmi == null) - return false; - if(dmi.Length != 2052) - return false; + if(dmi == null) return false; + if(dmi.Length != 2052) return false; uint signature = BitConverter.ToUInt32(dmi, 0x7EC); @@ -167,8 +153,7 @@ namespace DiscImageChef.Decoders.Xbox public static XboxDMI? DecodeXbox(byte[] response) { bool isXbox = IsXbox(response); - if(!isXbox) - return null; + if(!isXbox) return null; XboxDMI dmi = new XboxDMI(); @@ -188,8 +173,7 @@ namespace DiscImageChef.Decoders.Xbox public static Xbox360DMI? DecodeXbox360(byte[] response) { bool isX360 = IsXbox360(response); - if(!isX360) - return null; + if(!isX360) return null; Xbox360DMI dmi = new Xbox360DMI(); @@ -205,26 +189,24 @@ namespace DiscImageChef.Decoders.Xbox Array.Copy(response, 68, tmp, 0, 16); dmi.CatalogNumber = StringHandlers.CToString(tmp); - if(dmi.CatalogNumber == null || dmi.CatalogNumber.Length < 13) - return null; + if(dmi.CatalogNumber == null || dmi.CatalogNumber.Length < 13) return null; return dmi; } public static string PrettifyXbox(XboxDMI? dmi) { - if(dmi == null) - return null; + if(dmi == null) return null; XboxDMI decoded = dmi.Value; StringBuilder sb = new StringBuilder(); sb.Append("Catalogue number: "); - for(int i = 0; i < 2; i++) - sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + for(int i = 0; i < 2; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + sb.Append("-"); - for(int i = 2; i < 7; i++) - sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + for(int i = 2; i < 7; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + sb.Append("-"); sb.AppendFormat("{0}", decoded.CatalogNumber[7]); sb.AppendLine(); @@ -236,55 +218,54 @@ namespace DiscImageChef.Decoders.Xbox public static string PrettifyXbox360(Xbox360DMI? dmi) { - if(dmi == null) - return null; + if(dmi == null) return null; Xbox360DMI decoded = dmi.Value; StringBuilder sb = new StringBuilder(); sb.Append("Catalogue number: "); - for(int i = 0; i < 2; i++) - sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + for(int i = 0; i < 2; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + sb.Append("-"); - for(int i = 2; i < 6; i++) - sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + for(int i = 2; i < 6; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + sb.Append("-"); - for(int i = 6; i < 8; i++) - sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + for(int i = 6; i < 8; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + sb.Append("-"); if(decoded.CatalogNumber.Length == 13) { - for(int i = 8; i < 10; i++) - sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + for(int i = 8; i < 10; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + sb.Append("-"); - for(int i = 10; i < 13; i++) - sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + for(int i = 10; i < 13; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); } else if(decoded.CatalogNumber.Length == 14) { - for(int i = 8; i < 11; i++) - sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + for(int i = 8; i < 11; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + sb.Append("-"); - for(int i = 11; i < 14; i++) - sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + for(int i = 11; i < 14; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); } else { for(int i = 8; i < decoded.CatalogNumber.Length - 3; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); + sb.Append("-"); for(int i = decoded.CatalogNumber.Length - 3; i < decoded.CatalogNumber.Length; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); } + sb.AppendLine(); sb.Append("Media ID: "); - for(int i = 0; i < 12; i++) - sb.AppendFormat("{0:X2}", decoded.MediaID[i]); + for(int i = 0; i < 12; i++) sb.AppendFormat("{0:X2}", decoded.MediaID[i]); + sb.Append("-"); - for(int i = 12; i < 16; i++) - sb.AppendFormat("{0:X2}", decoded.MediaID[i]); + for(int i = 12; i < 16; i++) sb.AppendFormat("{0:X2}", decoded.MediaID[i]); + sb.AppendLine(); sb.AppendFormat("Timestamp: {0}", DateTime.FromFileTimeUtc(decoded.Timestamp)).AppendLine(); @@ -302,5 +283,4 @@ namespace DiscImageChef.Decoders.Xbox return PrettifyXbox360(DecodeXbox360(response)); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Decoders/Xbox/SS.cs b/DiscImageChef.Decoders/Xbox/SS.cs index 88f8ec1d..769e5935 100644 --- a/DiscImageChef.Decoders/Xbox/SS.cs +++ b/DiscImageChef.Decoders/Xbox/SS.cs @@ -217,11 +217,9 @@ namespace DiscImageChef.Decoders.Xbox public static SecuritySector? Decode(byte[] response) { - if(response == null) - return null; + if(response == null) return null; - if(response.Length < 2048) - return null; + if(response.Length < 2048) return null; SecuritySector ss = new SecuritySector(); @@ -257,10 +255,15 @@ namespace DiscImageChef.Decoders.Xbox ss.ChallengeEntries[i] = new ChallengeEntry(); ss.ChallengeEntries[i].Level = response[770 + i * 11 + 0]; ss.ChallengeEntries[i].ChallengeId = response[770 + i * 11 + 1]; - ss.ChallengeEntries[i].ChallengeValue = (uint)((response[770 + i * 11 + 2] << 24) + (response[770 + i * 11 + 3] << 16) + (response[770 + i * 11 + 4] << 8) + response[770 + i * 11 + 5]); + ss.ChallengeEntries[i].ChallengeValue = + (uint)((response[770 + i * 11 + 2] << 24) + (response[770 + i * 11 + 3] << 16) + + (response[770 + i * 11 + 4] << 8) + response[770 + i * 11 + 5]); ss.ChallengeEntries[i].ResponseModifier = response[770 + i * 11 + 6]; - ss.ChallengeEntries[i].ResponseValue = (uint)((response[770 + i * 11 + 7] << 24) + (response[770 + i * 11 + 8] << 16) + (response[770 + i * 11 + 9] << 8) + response[770 + i * 11 + 10]); + ss.ChallengeEntries[i].ResponseValue = + (uint)((response[770 + i * 11 + 7] << 24) + (response[770 + i * 11 + 8] << 16) + + (response[770 + i * 11 + 9] << 8) + response[770 + i * 11 + 10]); } + ss.Unknown6 = response[1023]; ss.Unknown7 = new byte[48]; Array.Copy(response, 1052, ss.Unknown7, 0, 48); @@ -276,25 +279,32 @@ namespace DiscImageChef.Decoders.Xbox for(int i = 0; i < 23; i++) { ss.Extents[i] = new SecuritySectorExtent(); - ss.Extents[i].Unknown = (uint)((response[1633 + i * 9 + 0] << 16) + (response[1633 + i * 9 + 1] << 8) + response[1633 + i * 9 + 2]); - ss.Extents[i].StartPSN = (uint)((response[1633 + i * 9 + 3] << 16) + (response[1633 + i * 9 + 4] << 8) + response[1633 + i * 9 + 5]); - ss.Extents[i].EndPSN = (uint)((response[1633 + i * 9 + 6] << 16) + (response[1633 + i * 9 + 7] << 8) + response[1633 + i * 9 + 8]); + ss.Extents[i].Unknown = (uint)((response[1633 + i * 9 + 0] << 16) + (response[1633 + i * 9 + 1] << 8) + + response[1633 + i * 9 + 2]); + ss.Extents[i].StartPSN = (uint)((response[1633 + i * 9 + 3] << 16) + (response[1633 + i * 9 + 4] << 8) + + response[1633 + i * 9 + 5]); + ss.Extents[i].EndPSN = (uint)((response[1633 + i * 9 + 6] << 16) + (response[1633 + i * 9 + 7] << 8) + + response[1633 + i * 9 + 8]); } + ss.ExtentsCopy = new SecuritySectorExtent[23]; for(int i = 0; i < 23; i++) { ss.ExtentsCopy[i] = new SecuritySectorExtent(); - ss.ExtentsCopy[i].Unknown = (uint)((response[1840 + i * 9 + 0] << 16) + (response[1840 + i * 9 + 1] << 8) + response[1840 + i * 9 + 2]); - ss.ExtentsCopy[i].StartPSN = (uint)((response[1840 + i * 9 + 3] << 16) + (response[1840 + i * 9 + 4] << 8) + response[1840 + i * 9 + 5]); - ss.ExtentsCopy[i].EndPSN = (uint)((response[1840 + i * 9 + 6] << 16) + (response[1840 + i * 9 + 7] << 8) + response[1840 + i * 9 + 8]); + ss.ExtentsCopy[i].Unknown = (uint)((response[1840 + i * 9 + 0] << 16) + + (response[1840 + i * 9 + 1] << 8) + response[1840 + i * 9 + 2]); + ss.ExtentsCopy[i].StartPSN = (uint)((response[1840 + i * 9 + 3] << 16) + + (response[1840 + i * 9 + 4] << 8) + response[1840 + i * 9 + 5]); + ss.ExtentsCopy[i].EndPSN = (uint)((response[1840 + i * 9 + 6] << 16) + + (response[1840 + i * 9 + 7] << 8) + response[1840 + i * 9 + 8]); } + return ss; } public static string Prettify(SecuritySector? ss) { - if(ss == null) - return null; + if(ss == null) return null; SecuritySector decoded = ss.Value; StringBuilder sb = new StringBuilder(); @@ -321,10 +331,12 @@ namespace DiscImageChef.Decoders.Xbox sb.AppendFormat(categorySentence, sizeString, "Xbox Game Disc", decoded.PartVersion).AppendLine(); break; case DiskCategory.DVDPRDL: - sb.AppendFormat(categorySentence, sizeString, "Xbox 360 Game Disc", decoded.PartVersion).AppendLine(); + sb.AppendFormat(categorySentence, sizeString, "Xbox 360 Game Disc", decoded.PartVersion) + .AppendLine(); break; default: - sb.AppendFormat(categorySentence, sizeString, "unknown disc type", decoded.PartVersion).AppendLine(); + sb.AppendFormat(categorySentence, sizeString, "unknown disc type", decoded.PartVersion) + .AppendLine(); break; } @@ -349,15 +361,14 @@ namespace DiscImageChef.Decoders.Xbox sb.AppendLine("Disc maximum transfer rate is unspecified."); break; default: - sb.AppendFormat("Disc maximum transfer rate is specified by unknown key {0}", decoded.MaximumRate).AppendLine(); + sb.AppendFormat("Disc maximum transfer rate is specified by unknown key {0}", decoded.MaximumRate) + .AppendLine(); break; } sb.AppendFormat("Disc has {0} layers", decoded.Layers + 1).AppendLine(); - if(decoded.TrackPath && decoded.Layers == 1) - sb.AppendLine("Layers are in parallel track path"); - else if(!decoded.TrackPath && decoded.Layers == 1) - sb.AppendLine("Layers are in opposite track path"); + if(decoded.TrackPath && decoded.Layers == 1) sb.AppendLine("Layers are in parallel track path"); + else if(!decoded.TrackPath && decoded.Layers == 1) sb.AppendLine("Layers are in opposite track path"); switch(decoded.LinearDensity) { @@ -418,11 +429,9 @@ namespace DiscImageChef.Decoders.Xbox if(decoded.Layers == 1 && !decoded.TrackPath) sb.AppendFormat("Layer 0 ends at PSN {0:X}h", decoded.Layer0EndPSN).AppendLine(); } - else - sb.AppendLine("Disc is empty"); + else sb.AppendLine("Disc is empty"); } - else - sb.AppendLine("Disc is empty"); + else sb.AppendLine("Disc is empty"); sb.AppendLine("Challenges:"); foreach(ChallengeEntry entry in decoded.ChallengeEntries) @@ -435,7 +444,8 @@ namespace DiscImageChef.Decoders.Xbox } for(int i = 0; i < 16; i++) - sb.AppendFormat("Extent starts at PSN {0:X6}h and ends at PSN {1:X6}h", decoded.Extents[i].StartPSN, decoded.Extents[i].EndPSN).AppendLine(); + sb.AppendFormat("Extent starts at PSN {0:X6}h and ends at PSN {1:X6}h", decoded.Extents[i].StartPSN, + decoded.Extents[i].EndPSN).AppendLine(); return sb.ToString(); } @@ -445,4 +455,4 @@ namespace DiscImageChef.Decoders.Xbox return Prettify(Decode(response)); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Device.Report/ata.h b/DiscImageChef.Device.Report/ata.h index e981fecb..8cb0bc65 100644 --- a/DiscImageChef.Device.Report/ata.h +++ b/DiscImageChef.Device.Report/ata.h @@ -875,44 +875,45 @@ typedef struct uint8_t Checksum; } IdentifyDevice; -unsigned char *AtaToCString (unsigned char *string, int len); +unsigned char *AtaToCString(unsigned char *string, int len); -int SendAtaCommandChs (int fd, AtaRegistersCHS registers, AtaErrorRegistersCHS **errorRegisters, int protocol, - int transferRegister, unsigned char *buffer, unsigned int buffer_len, int transferBlocks); +int SendAtaCommandChs(int fd, AtaRegistersCHS registers, AtaErrorRegistersCHS **errorRegisters, int protocol, + int transferRegister, unsigned char *buffer, unsigned int buffer_len, int transferBlocks); -int SendAtaCommandLba28 (int fd, AtaRegistersLBA28 registers, AtaErrorRegistersLBA28 **errorRegisters, int protocol, - int transferRegister, unsigned char *buffer, unsigned int buffer_len, int transferBlocks); +int SendAtaCommandLba28(int fd, AtaRegistersLBA28 registers, AtaErrorRegistersLBA28 **errorRegisters, int protocol, + int transferRegister, unsigned char *buffer, unsigned int buffer_len, int transferBlocks); -int SendAtaCommandLba48 (int fd, AtaRegistersLBA48 registers, AtaErrorRegistersLBA48 **errorRegisters, int protocol, - int transferRegister, unsigned char *buffer, unsigned int buffer_len, int transferBlocks); +int SendAtaCommandLba48(int fd, AtaRegistersLBA48 registers, AtaErrorRegistersLBA48 **errorRegisters, int protocol, + int transferRegister, unsigned char *buffer, unsigned int buffer_len, int transferBlocks); -int Identify (int fd, unsigned char **buffer, AtaErrorRegistersCHS **errorRegisters); - -int Read (int fd, unsigned char **buffer, AtaErrorRegistersCHS **statusRegisters, int retry, uint16_t cylinder, - uint8_t head, uint8_t sector, uint8_t count); - -int ReadLong (int fd, unsigned char **buffer, AtaErrorRegistersCHS **statusRegisters, int retry, uint16_t cylinder, - uint8_t head, uint8_t sector, uint32_t blockSize); - -int Seek (int fd, AtaErrorRegistersCHS **statusRegisters, uint16_t cylinder, uint8_t head, uint8_t sector); - -int ReadDma (int fd, unsigned char **buffer, AtaErrorRegistersCHS **statusRegisters, int retry, uint16_t cylinder, - uint8_t head, uint8_t sector, uint8_t count); - -int ReadDmaLba (int fd, unsigned char **buffer, AtaErrorRegistersLBA28 **statusRegisters, int retry, uint32_t lba, - uint8_t count); - -int ReadLba (int fd, unsigned char **buffer, AtaErrorRegistersLBA28 **statusRegisters, int retry, uint32_t lba, - uint8_t count); - -int ReadLongLba (int fd, unsigned char **buffer, AtaErrorRegistersLBA28 **statusRegisters, int retry, uint32_t lba, - uint32_t blockSize); - -int SeekLba (int fd, AtaErrorRegistersLBA28 **statusRegisters, uint32_t lba); +int Identify(int fd, unsigned char **buffer, AtaErrorRegistersCHS **errorRegisters); int -ReadDmaLba48 (int fd, unsigned char **buffer, AtaErrorRegistersLBA48 **statusRegisters, uint64_t lba, uint16_t count); +Read(int fd, unsigned char **buffer, AtaErrorRegistersCHS **statusRegisters, int retry, uint16_t cylinder, uint8_t head, + uint8_t sector, uint8_t count); -int ReadLba48 (int fd, unsigned char **buffer, AtaErrorRegistersLBA48 **statusRegisters, uint64_t lba, uint16_t count); +int ReadLong(int fd, unsigned char **buffer, AtaErrorRegistersCHS **statusRegisters, int retry, uint16_t cylinder, + uint8_t head, uint8_t sector, uint32_t blockSize); + +int Seek(int fd, AtaErrorRegistersCHS **statusRegisters, uint16_t cylinder, uint8_t head, uint8_t sector); + +int ReadDma(int fd, unsigned char **buffer, AtaErrorRegistersCHS **statusRegisters, int retry, uint16_t cylinder, + uint8_t head, uint8_t sector, uint8_t count); + +int ReadDmaLba(int fd, unsigned char **buffer, AtaErrorRegistersLBA28 **statusRegisters, int retry, uint32_t lba, + uint8_t count); + +int ReadLba(int fd, unsigned char **buffer, AtaErrorRegistersLBA28 **statusRegisters, int retry, uint32_t lba, + uint8_t count); + +int ReadLongLba(int fd, unsigned char **buffer, AtaErrorRegistersLBA28 **statusRegisters, int retry, uint32_t lba, + uint32_t blockSize); + +int SeekLba(int fd, AtaErrorRegistersLBA28 **statusRegisters, uint32_t lba); + +int +ReadDmaLba48(int fd, unsigned char **buffer, AtaErrorRegistersLBA48 **statusRegisters, uint64_t lba, uint16_t count); + +int ReadLba48(int fd, unsigned char **buffer, AtaErrorRegistersLBA48 **statusRegisters, uint64_t lba, uint16_t count); #endif //DISCIMAGECHEF_DEVICE_REPORT_ATA_H diff --git a/DiscImageChef.Device.Report/main.c b/DiscImageChef.Device.Report/main.c index 4d669d0a..d62d2ea5 100644 --- a/DiscImageChef.Device.Report/main.c +++ b/DiscImageChef.Device.Report/main.c @@ -37,7 +37,6 @@ Copyright © 2011-2018 Natalia Portillo #include #include #include -#include #include #include "main.h" #include "scsi.h" @@ -56,13 +55,13 @@ int main(int argc, void *argv[]) unsigned char *atapi_ident = NULL; AtaErrorRegistersCHS *ata_error_chs; int scsi_error, ata_error; - unsigned char *manufacturer; - unsigned char *product; - unsigned char *revision; - int deviceType = DEVICE_TYPE_UNKNOWN; - char *xmlFilename = malloc(NAME_MAX + 1); - xmlTextWriterPtr xmlWriter; - const char *ataName = "ATA"; + unsigned char *manufacturer; + unsigned char *product; + unsigned char *revision; + int deviceType = DEVICE_TYPE_UNKNOWN; + char *xmlFilename = malloc(NAME_MAX + 1); + xmlTextWriterPtr xmlWriter; + const char *ataName = "ATA"; printf("The Disc Image Chef Device Reporter for Linux %s\n", DIC_VERSION); printf("%s\n", DIC_COPYRIGHT); diff --git a/DiscImageChef.Device.Report/scsi_report.c b/DiscImageChef.Device.Report/scsi_report.c index 81b13f11..d8992ba2 100644 --- a/DiscImageChef.Device.Report/scsi_report.c +++ b/DiscImageChef.Device.Report/scsi_report.c @@ -377,8 +377,9 @@ void ScsiReport(int fd, xmlTextWriterPtr xmlWriter) if(!error) { xmlTextWriterWriteFormatElement(xmlWriter, BAD_CAST "SupportsReadCapacity", "%s", "true"); - blocks = (uint64_t)(buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + (buffer[3]) + - 1; + blocks = + (uint64_t)(buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + (buffer[3]) + + 1; blockSize = (uint32_t)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + (buffer[7])); } diff --git a/DiscImageChef.Devices/Command.cs b/DiscImageChef.Devices/Command.cs index a85d71a4..3d894bf6 100644 --- a/DiscImageChef.Devices/Command.cs +++ b/DiscImageChef.Devices/Command.cs @@ -51,11 +51,13 @@ namespace DiscImageChef.Devices /// SCSI command transfer direction /// Time it took to execute the command in milliseconds /// True if SCSI error returned non-OK status and contains SCSI sense - public static int SendScsiCommand(object fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiDirection direction, out double duration, out bool sense) + public static int SendScsiCommand(object fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, + uint timeout, ScsiDirection direction, out double duration, out bool sense) { Interop.PlatformID ptID = DetectOS.GetRealPlatformID(); - return SendScsiCommand(ptID, fd, cdb, ref buffer, out senseBuffer, timeout, direction, out duration, out sense); + return SendScsiCommand(ptID, fd, cdb, ref buffer, out senseBuffer, timeout, direction, out duration, + out sense); } /// @@ -71,54 +73,58 @@ namespace DiscImageChef.Devices /// SCSI command transfer direction /// Time it took to execute the command in milliseconds /// True if SCSI error returned non-OK status and contains SCSI sense - public static int SendScsiCommand(Interop.PlatformID ptID, object fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiDirection direction, out double duration, out bool sense) + public static int SendScsiCommand(Interop.PlatformID ptID, object fd, byte[] cdb, ref byte[] buffer, + out byte[] senseBuffer, uint timeout, ScsiDirection direction, + out double duration, out bool sense) { switch(ptID) { case Interop.PlatformID.Win32NT: + { + Windows.ScsiIoctlDirection dir; + + switch(direction) { - Windows.ScsiIoctlDirection dir; - - switch(direction) - { - case ScsiDirection.In: - dir = Windows.ScsiIoctlDirection.In; - break; - case ScsiDirection.Out: - dir = Windows.ScsiIoctlDirection.Out; - break; - default: - dir = Windows.ScsiIoctlDirection.Unspecified; - break; - } - - return Windows.Command.SendScsiCommand((SafeFileHandle)fd, cdb, ref buffer, out senseBuffer, timeout, dir, out duration, out sense); + case ScsiDirection.In: + dir = Windows.ScsiIoctlDirection.In; + break; + case ScsiDirection.Out: + dir = Windows.ScsiIoctlDirection.Out; + break; + default: + dir = Windows.ScsiIoctlDirection.Unspecified; + break; } + + return Windows.Command.SendScsiCommand((SafeFileHandle)fd, cdb, ref buffer, out senseBuffer, + timeout, dir, out duration, out sense); + } case Interop.PlatformID.Linux: + { + Linux.ScsiIoctlDirection dir; + + switch(direction) { - Linux.ScsiIoctlDirection dir; - - switch(direction) - { - case ScsiDirection.In: - dir = Linux.ScsiIoctlDirection.In; - break; - case ScsiDirection.Out: - dir = Linux.ScsiIoctlDirection.Out; - break; - case ScsiDirection.Bidirectional: - dir = Linux.ScsiIoctlDirection.Unspecified; - break; - case ScsiDirection.None: - dir = Linux.ScsiIoctlDirection.None; - break; - default: - dir = Linux.ScsiIoctlDirection.Unknown; - break; - } - - return Linux.Command.SendScsiCommand((int)fd, cdb, ref buffer, out senseBuffer, timeout, dir, out duration, out sense); + case ScsiDirection.In: + dir = Linux.ScsiIoctlDirection.In; + break; + case ScsiDirection.Out: + dir = Linux.ScsiIoctlDirection.Out; + break; + case ScsiDirection.Bidirectional: + dir = Linux.ScsiIoctlDirection.Unspecified; + break; + case ScsiDirection.None: + dir = Linux.ScsiIoctlDirection.None; + break; + default: + dir = Linux.ScsiIoctlDirection.Unknown; + break; } + + return Linux.Command.SendScsiCommand((int)fd, cdb, ref buffer, out senseBuffer, timeout, dir, + out duration, out sense); + } case Interop.PlatformID.FreeBSD: { FreeBSD.ccb_flags flags = 0; @@ -140,192 +146,184 @@ namespace DiscImageChef.Devices } return IntPtr.Size == 8 - ? FreeBSD.Command.SendScsiCommand64((IntPtr)fd, cdb, ref buffer, out senseBuffer, timeout, - flags, out duration, out sense) + ? FreeBSD.Command.SendScsiCommand64((IntPtr)fd, cdb, ref buffer, out senseBuffer, + timeout, flags, out duration, out sense) : FreeBSD.Command.SendScsiCommand((IntPtr)fd, cdb, ref buffer, out senseBuffer, timeout, flags, out duration, out sense); } - default: - throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID)); + default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID)); } } - public static int SendAtaCommand(object fd, AtaRegistersCHS registers, - out AtaErrorRegistersCHS errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + public static int SendAtaCommand(object fd, AtaRegistersCHS registers, out AtaErrorRegistersCHS errorRegisters, + AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, + uint timeout, bool transferBlocks, out double duration, out bool sense) { Interop.PlatformID ptID = DetectOS.GetRealPlatformID(); - return SendAtaCommand(ptID, fd, registers, out errorRegisters, protocol, - transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense); + return SendAtaCommand(ptID, fd, registers, out errorRegisters, protocol, transferRegister, ref buffer, + timeout, transferBlocks, out duration, out sense); } public static int SendAtaCommand(Interop.PlatformID ptID, object fd, AtaRegistersCHS registers, - out AtaErrorRegistersCHS errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + out AtaErrorRegistersCHS errorRegisters, AtaProtocol protocol, + AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, + bool transferBlocks, out double duration, out bool sense) { switch(ptID) { case Interop.PlatformID.Win32NT: - { - if( - ( // Windows XP <= SP1 - Environment.OSVersion.Version.Major == 5 && - Environment.OSVersion.Version.Minor == 1 && - (Environment.OSVersion.ServicePack == "Service Pack 1" || Environment.OSVersion.ServicePack == "")) || - ( // Windows 2000 - Environment.OSVersion.Version.Major == 5 && - Environment.OSVersion.Version.Minor == 0) - ) - return Windows.Command.SendIdeCommand((SafeFileHandle)fd, registers, out errorRegisters, - protocol, ref buffer, timeout, out duration, out sense); - // Windows NT 4 or earlier, requires special ATA pass thru SCSI. But DiscImageChef cannot run there (or can it?) - if( - Environment.OSVersion.Version.Major <= 4 - ) - throw new InvalidOperationException("Windows NT 4.0 or earlier is not supported."); - - return Windows.Command.SendAtaCommand((SafeFileHandle)fd, registers, out errorRegisters, + { + if(( // Windows XP <= SP1 + Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor == 1 && + (Environment.OSVersion.ServicePack == "Service Pack 1" || + Environment.OSVersion.ServicePack == "")) || ( // Windows 2000 + Environment.OSVersion.Version.Major == 5 && + Environment.OSVersion.Version.Minor == 0)) + return Windows.Command.SendIdeCommand((SafeFileHandle)fd, registers, out errorRegisters, protocol, ref buffer, timeout, out duration, out sense); - } + // Windows NT 4 or earlier, requires special ATA pass thru SCSI. But DiscImageChef cannot run there (or can it?) + if(Environment.OSVersion.Version.Major <= 4) + throw new InvalidOperationException("Windows NT 4.0 or earlier is not supported."); + + return Windows.Command.SendAtaCommand((SafeFileHandle)fd, registers, out errorRegisters, protocol, + ref buffer, timeout, out duration, out sense); + } case Interop.PlatformID.Linux: - { - return Linux.Command.SendAtaCommand((int)fd, registers, out errorRegisters, protocol, - transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense); - } + { + return Linux.Command.SendAtaCommand((int)fd, registers, out errorRegisters, protocol, + transferRegister, ref buffer, timeout, transferBlocks, + out duration, out sense); + } case Interop.PlatformID.FreeBSD: { return FreeBSD.Command.SendAtaCommand((IntPtr)fd, registers, out errorRegisters, protocol, ref buffer, timeout, out duration, out sense); } - default: - throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID)); + default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID)); } } public static int SendAtaCommand(object fd, AtaRegistersLBA28 registers, - out AtaErrorRegistersLBA28 errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + out AtaErrorRegistersLBA28 errorRegisters, AtaProtocol protocol, + AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, + bool transferBlocks, out double duration, out bool sense) { Interop.PlatformID ptID = DetectOS.GetRealPlatformID(); - return SendAtaCommand(ptID, fd, registers, out errorRegisters, protocol, - transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense); + return SendAtaCommand(ptID, fd, registers, out errorRegisters, protocol, transferRegister, ref buffer, + timeout, transferBlocks, out duration, out sense); } public static int SendAtaCommand(Interop.PlatformID ptID, object fd, AtaRegistersLBA28 registers, - out AtaErrorRegistersLBA28 errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + out AtaErrorRegistersLBA28 errorRegisters, AtaProtocol protocol, + AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, + bool transferBlocks, out double duration, out bool sense) { switch(ptID) { case Interop.PlatformID.Win32NT: - { - if( - ( // Windows XP <= SP1 - Environment.OSVersion.Version.Major == 5 && - Environment.OSVersion.Version.Minor == 1 && - (Environment.OSVersion.ServicePack == "Service Pack 1" || Environment.OSVersion.ServicePack == "")) || - ( // Windows 2000 - Environment.OSVersion.Version.Major == 5 && - Environment.OSVersion.Version.Minor == 0) - ) - return Windows.Command.SendIdeCommand((SafeFileHandle)fd, registers, out errorRegisters, - protocol, ref buffer, timeout, out duration, out sense); - // Windows NT 4 or earlier, requires special ATA pass thru SCSI. But DiscImageChef cannot run there (or can it?) - if( - Environment.OSVersion.Version.Major <= 4 - ) - throw new InvalidOperationException("Windows NT 4.0 or earlier is not supported."); - - return Windows.Command.SendAtaCommand((SafeFileHandle)fd, registers, out errorRegisters, + { + if(( // Windows XP <= SP1 + Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor == 1 && + (Environment.OSVersion.ServicePack == "Service Pack 1" || + Environment.OSVersion.ServicePack == "")) || ( // Windows 2000 + Environment.OSVersion.Version.Major == 5 && + Environment.OSVersion.Version.Minor == 0)) + return Windows.Command.SendIdeCommand((SafeFileHandle)fd, registers, out errorRegisters, protocol, ref buffer, timeout, out duration, out sense); - } + // Windows NT 4 or earlier, requires special ATA pass thru SCSI. But DiscImageChef cannot run there (or can it?) + if(Environment.OSVersion.Version.Major <= 4) + throw new InvalidOperationException("Windows NT 4.0 or earlier is not supported."); + + return Windows.Command.SendAtaCommand((SafeFileHandle)fd, registers, out errorRegisters, protocol, + ref buffer, timeout, out duration, out sense); + } case Interop.PlatformID.Linux: - { - return Linux.Command.SendAtaCommand((int)fd, registers, out errorRegisters, protocol, - transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense); - } + { + return Linux.Command.SendAtaCommand((int)fd, registers, out errorRegisters, protocol, + transferRegister, ref buffer, timeout, transferBlocks, + out duration, out sense); + } case Interop.PlatformID.FreeBSD: { return FreeBSD.Command.SendAtaCommand((IntPtr)fd, registers, out errorRegisters, protocol, ref buffer, timeout, out duration, out sense); } - default: - throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID)); + default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID)); } } public static int SendAtaCommand(object fd, AtaRegistersLBA48 registers, - out AtaErrorRegistersLBA48 errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + out AtaErrorRegistersLBA48 errorRegisters, AtaProtocol protocol, + AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, + bool transferBlocks, out double duration, out bool sense) { Interop.PlatformID ptID = DetectOS.GetRealPlatformID(); - return SendAtaCommand(ptID, fd, registers, out errorRegisters, protocol, - transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense); + return SendAtaCommand(ptID, fd, registers, out errorRegisters, protocol, transferRegister, ref buffer, + timeout, transferBlocks, out duration, out sense); } public static int SendAtaCommand(Interop.PlatformID ptID, object fd, AtaRegistersLBA48 registers, - out AtaErrorRegistersLBA48 errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + out AtaErrorRegistersLBA48 errorRegisters, AtaProtocol protocol, + AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, + bool transferBlocks, out double duration, out bool sense) { switch(ptID) { case Interop.PlatformID.Win32NT: - { - // No check for Windows version. A 48-bit ATA disk simply does not work on earlier systems - return Windows.Command.SendAtaCommand((SafeFileHandle)fd, registers, out errorRegisters, - protocol, ref buffer, timeout, out duration, out sense); - } + { + // No check for Windows version. A 48-bit ATA disk simply does not work on earlier systems + return Windows.Command.SendAtaCommand((SafeFileHandle)fd, registers, out errorRegisters, protocol, + ref buffer, timeout, out duration, out sense); + } case Interop.PlatformID.Linux: - { - return Linux.Command.SendAtaCommand((int)fd, registers, out errorRegisters, protocol, - transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense); - } + { + return Linux.Command.SendAtaCommand((int)fd, registers, out errorRegisters, protocol, + transferRegister, ref buffer, timeout, transferBlocks, + out duration, out sense); + } case Interop.PlatformID.FreeBSD: { return FreeBSD.Command.SendAtaCommand((IntPtr)fd, registers, out errorRegisters, protocol, ref buffer, timeout, out duration, out sense); } - default: - throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID)); + default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID)); } } - public static int SendMmcCommand(object fd, MmcCommands command, bool write, bool isApplication, - MmcFlags flags, uint argument, uint blockSize, uint blocks, - ref byte[] buffer, out uint[] response, out double duration, out bool sense, uint timeout = 0) + public static int SendMmcCommand(object fd, MmcCommands command, bool write, bool isApplication, MmcFlags flags, + uint argument, uint blockSize, uint blocks, ref byte[] buffer, + out uint[] response, out double duration, out bool sense, uint timeout = 0) { Interop.PlatformID ptID = DetectOS.GetRealPlatformID(); - return SendMmcCommand(ptID, (int)fd, command, write, isApplication, flags, argument, blockSize, blocks, ref buffer, out response, out duration, out sense, timeout); + return SendMmcCommand(ptID, (int)fd, command, write, isApplication, flags, argument, blockSize, blocks, + ref buffer, out response, out duration, out sense, timeout); } - public static int SendMmcCommand(Interop.PlatformID ptID, object fd, MmcCommands command, bool write, bool isApplication, - MmcFlags flags, uint argument, uint blockSize, uint blocks, ref byte[] buffer, - out uint[] response, out double duration, out bool sense, uint timeout = 0) + public static int SendMmcCommand(Interop.PlatformID ptID, object fd, MmcCommands command, bool write, + bool isApplication, MmcFlags flags, uint argument, uint blockSize, uint blocks, + ref byte[] buffer, out uint[] response, out double duration, out bool sense, + uint timeout = 0) { switch(ptID) { case Interop.PlatformID.Win32NT: - { - return Windows.Command.SendMmcCommand((SafeFileHandle)fd, command, write, isApplication, flags, argument, blockSize, blocks, ref buffer, out response, out duration, out sense, timeout); - } + { + return Windows.Command.SendMmcCommand((SafeFileHandle)fd, command, write, isApplication, flags, + argument, blockSize, blocks, ref buffer, out response, + out duration, out sense, timeout); + } case Interop.PlatformID.Linux: - { - return Linux.Command.SendMmcCommand((int)fd, command, write, isApplication, flags, argument, blockSize, blocks, ref buffer, out response, out duration, out sense, timeout); - } - default: - throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID)); + { + return Linux.Command.SendMmcCommand((int)fd, command, write, isApplication, flags, argument, + blockSize, blocks, ref buffer, out response, out duration, + out sense, timeout); + } + default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID)); } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs b/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs index ee6dbe26..d471929c 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs @@ -37,7 +37,8 @@ namespace DiscImageChef.Devices { public partial class Device { - public bool ReadBuffer(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration) + public bool ReadBuffer(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, + out double duration) { buffer = new byte[512]; AtaRegistersLBA28 registers = new AtaRegistersLBA28(); @@ -45,8 +46,9 @@ namespace DiscImageChef.Devices registers.command = (byte)AtaCommands.ReadBuffer; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "READ BUFFER took {0} ms.", duration); @@ -54,7 +56,8 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadBufferDma(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration) + public bool ReadBufferDma(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, + out double duration) { buffer = new byte[512]; AtaRegistersLBA28 registers = new AtaRegistersLBA28(); @@ -71,24 +74,22 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, byte count, uint timeout, out double duration) + public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, byte count, + uint timeout, out double duration) { return ReadDma(out buffer, out statusRegisters, true, lba, count, timeout, out duration); } - public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba, byte count, uint timeout, out double duration) + public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba, + byte count, uint timeout, out double duration) { - if(count == 0) - buffer = new byte[512 * 256]; - else - buffer = new byte[512 * count]; + if(count == 0) buffer = new byte[512 * 256]; + else buffer = new byte[512 * count]; AtaRegistersLBA28 registers = new AtaRegistersLBA28(); bool sense; - if(retry) - registers.command = (byte)AtaCommands.ReadDmaRetry; - else - registers.command = (byte)AtaCommands.ReadDma; + if(retry) registers.command = (byte)AtaCommands.ReadDmaRetry; + else registers.command = (byte)AtaCommands.ReadDma; registers.sectorCount = count; registers.deviceHead = (byte)((lba & 0xF000000) / 0x1000000); registers.lbaHigh = (byte)((lba & 0xFF0000) / 0x10000); @@ -105,12 +106,11 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, byte count, uint timeout, out double duration) + public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, byte count, + uint timeout, out double duration) { - if(count == 0) - buffer = new byte[512 * 256]; - else - buffer = new byte[512 * count]; + if(count == 0) buffer = new byte[512 * 256]; + else buffer = new byte[512 * count]; AtaRegistersLBA28 registers = new AtaRegistersLBA28(); bool sense; @@ -122,8 +122,9 @@ namespace DiscImageChef.Devices registers.lbaLow = (byte)((lba & 0xFF) / 0x1); registers.deviceHead += 0x40; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE took {0} ms.", duration); @@ -131,7 +132,8 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadNativeMaxAddress(out uint lba, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration) + public bool ReadNativeMaxAddress(out uint lba, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, + out double duration) { lba = 0; byte[] buffer = new byte[0]; @@ -141,8 +143,9 @@ namespace DiscImageChef.Devices registers.command = (byte)AtaCommands.ReadNativeMaxAddress; registers.deviceHead += 0x40; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; if((statusRegisters.status & 0x23) == 0) @@ -159,24 +162,22 @@ namespace DiscImageChef.Devices return sense; } - public bool Read(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, byte count, uint timeout, out double duration) + public bool Read(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, byte count, + uint timeout, out double duration) { return Read(out buffer, out statusRegisters, true, lba, count, timeout, out duration); } - public bool Read(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba, byte count, uint timeout, out double duration) + public bool Read(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba, + byte count, uint timeout, out double duration) { - if(count == 0) - buffer = new byte[512 * 256]; - else - buffer = new byte[512 * count]; + if(count == 0) buffer = new byte[512 * 256]; + else buffer = new byte[512 * count]; AtaRegistersLBA28 registers = new AtaRegistersLBA28(); bool sense; - if(retry) - registers.command = (byte)AtaCommands.ReadRetry; - else - registers.command = (byte)AtaCommands.Read; + if(retry) registers.command = (byte)AtaCommands.ReadRetry; + else registers.command = (byte)AtaCommands.Read; registers.sectorCount = count; registers.deviceHead = (byte)((lba & 0xF000000) / 0x1000000); registers.lbaHigh = (byte)((lba & 0xFF0000) / 0x10000); @@ -184,8 +185,9 @@ namespace DiscImageChef.Devices registers.lbaLow = (byte)((lba & 0xFF) / 0x1); registers.deviceHead += 0x40; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "READ SECTORS took {0} ms.", duration); @@ -193,22 +195,21 @@ namespace DiscImageChef.Devices return sense; } - - public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, uint blockSize, uint timeout, out double duration) + public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, uint blockSize, + uint timeout, out double duration) { return ReadLong(out buffer, out statusRegisters, true, lba, blockSize, timeout, out duration); } - public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba, uint blockSize, uint timeout, out double duration) + public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba, + uint blockSize, uint timeout, out double duration) { buffer = new byte[blockSize]; AtaRegistersLBA28 registers = new AtaRegistersLBA28(); bool sense; - if(retry) - registers.command = (byte)AtaCommands.ReadLongRetry; - else - registers.command = (byte)AtaCommands.ReadLong; + if(retry) registers.command = (byte)AtaCommands.ReadLongRetry; + else registers.command = (byte)AtaCommands.ReadLong; registers.sectorCount = 1; registers.deviceHead = (byte)((lba & 0xF000000) / 0x1000000); registers.lbaHigh = (byte)((lba & 0xFF0000) / 0x10000); @@ -216,8 +217,9 @@ namespace DiscImageChef.Devices registers.lbaLow = (byte)((lba & 0xFF) / 0x1); registers.deviceHead += 0x40; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "READ LONG took {0} ms.", duration); @@ -238,8 +240,9 @@ namespace DiscImageChef.Devices registers.lbaLow = (byte)((lba & 0xFF) / 0x1); registers.deviceHead += 0x40; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "SEEK took {0} ms.", duration); @@ -247,5 +250,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs b/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs index 26519e36..1a4a749c 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs @@ -37,7 +37,8 @@ namespace DiscImageChef.Devices { public partial class Device { - public bool GetNativeMaxAddressExt(out ulong lba, out AtaErrorRegistersLBA48 statusRegisters, uint timeout, out double duration) + public bool GetNativeMaxAddressExt(out ulong lba, out AtaErrorRegistersLBA48 statusRegisters, uint timeout, + out double duration) { lba = 0; AtaRegistersLBA48 registers = new AtaRegistersLBA48(); @@ -47,8 +48,9 @@ namespace DiscImageChef.Devices registers.command = (byte)AtaCommands.NativeMaxAddress; registers.feature = 0x0000; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; if((statusRegisters.status & 0x23) == 0) @@ -64,12 +66,11 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count, uint timeout, out double duration) + public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count, + uint timeout, out double duration) { - if(count == 0) - buffer = new byte[512 * 65536]; - else - buffer = new byte[512 * count]; + if(count == 0) buffer = new byte[512 * 65536]; + else buffer = new byte[512 * count]; AtaRegistersLBA48 registers = new AtaRegistersLBA48(); bool sense; @@ -89,7 +90,8 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadLog(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, byte logAddress, ushort pageNumber, ushort count, uint timeout, out double duration) + public bool ReadLog(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, byte logAddress, + ushort pageNumber, ushort count, uint timeout, out double duration) { buffer = new byte[512 * count]; AtaRegistersLBA48 registers = new AtaRegistersLBA48(); @@ -101,8 +103,9 @@ namespace DiscImageChef.Devices registers.lbaLow += logAddress; registers.lbaHigh = (ushort)((pageNumber & 0xFF00) / 0x100); - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "READ LOG EXT took {0} ms.", duration); @@ -110,7 +113,8 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadLogDma(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, byte logAddress, ushort pageNumber, ushort count, uint timeout, out double duration) + public bool ReadLogDma(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, byte logAddress, + ushort pageNumber, ushort count, uint timeout, out double duration) { buffer = new byte[512 * count]; AtaRegistersLBA48 registers = new AtaRegistersLBA48(); @@ -131,12 +135,11 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count, uint timeout, out double duration) + public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count, + uint timeout, out double duration) { - if(count == 0) - buffer = new byte[512 * 65536]; - else - buffer = new byte[512 * count]; + if(count == 0) buffer = new byte[512 * 65536]; + else buffer = new byte[512 * count]; AtaRegistersLBA48 registers = new AtaRegistersLBA48(); bool sense; @@ -147,8 +150,9 @@ namespace DiscImageChef.Devices registers.lbaLow = (ushort)((lba & 0xFFFF) / 0x1); registers.deviceHead += 0x40; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE EXT took {0} ms.", duration); @@ -156,7 +160,8 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadNativeMaxAddress(out ulong lba, out AtaErrorRegistersLBA48 statusRegisters, uint timeout, out double duration) + public bool ReadNativeMaxAddress(out ulong lba, out AtaErrorRegistersLBA48 statusRegisters, uint timeout, + out double duration) { lba = 0; byte[] buffer = new byte[0]; @@ -166,8 +171,9 @@ namespace DiscImageChef.Devices registers.command = (byte)AtaCommands.ReadNativeMaxAddressExt; registers.deviceHead += 0x40; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; if((statusRegisters.status & 0x23) == 0) @@ -183,12 +189,11 @@ namespace DiscImageChef.Devices return sense; } - public bool Read(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count, uint timeout, out double duration) + public bool Read(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count, + uint timeout, out double duration) { - if(count == 0) - buffer = new byte[512 * 65536]; - else - buffer = new byte[512 * count]; + if(count == 0) buffer = new byte[512 * 65536]; + else buffer = new byte[512 * count]; AtaRegistersLBA48 registers = new AtaRegistersLBA48(); bool sense; @@ -199,8 +204,9 @@ namespace DiscImageChef.Devices registers.lbaLow = (ushort)((lba & 0xFFFF) / 0x1); registers.deviceHead += 0x40; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "READ SECTORS EXT took {0} ms.", duration); diff --git a/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs b/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs index ebbeed96..d739245d 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs @@ -81,7 +81,8 @@ namespace DiscImageChef.Devices /// Status registers. /// Timeout. /// Duration. - public bool AtaIdentify(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, uint timeout, out double duration) + public bool AtaIdentify(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, uint timeout, + out double duration) { buffer = new byte[512]; AtaRegistersCHS registers = new AtaRegistersCHS(); @@ -89,8 +90,9 @@ namespace DiscImageChef.Devices registers.command = (byte)AtaCommands.IdentifyDevice; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "IDENTIFY DEVICE took {0} ms.", duration); @@ -98,24 +100,22 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadDma(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, byte sector, byte count, uint timeout, out double duration) + public bool ReadDma(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, + byte sector, byte count, uint timeout, out double duration) { return ReadDma(out buffer, out statusRegisters, true, cylinder, head, sector, count, timeout, out duration); } - public bool ReadDma(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, bool retry, ushort cylinder, byte head, byte sector, byte count, uint timeout, out double duration) + public bool ReadDma(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, bool retry, ushort cylinder, + byte head, byte sector, byte count, uint timeout, out double duration) { - if(count == 0) - buffer = new byte[512 * 256]; - else - buffer = new byte[512 * count]; + if(count == 0) buffer = new byte[512 * 256]; + else buffer = new byte[512 * count]; AtaRegistersCHS registers = new AtaRegistersCHS(); bool sense; - if(retry) - registers.command = (byte)AtaCommands.ReadDmaRetry; - else - registers.command = (byte)AtaCommands.ReadDma; + if(retry) registers.command = (byte)AtaCommands.ReadDmaRetry; + else registers.command = (byte)AtaCommands.ReadDma; registers.sectorCount = count; registers.cylinderHigh = (byte)((cylinder & 0xFF00) / 0x100); registers.cylinderLow = (byte)((cylinder & 0xFF) / 0x1); @@ -131,12 +131,11 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, byte sector, byte count, uint timeout, out double duration) + public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, + byte head, byte sector, byte count, uint timeout, out double duration) { - if(count == 0) - buffer = new byte[512 * 256]; - else - buffer = new byte[512 * count]; + if(count == 0) buffer = new byte[512 * 256]; + else buffer = new byte[512 * count]; AtaRegistersCHS registers = new AtaRegistersCHS(); bool sense; @@ -147,8 +146,9 @@ namespace DiscImageChef.Devices registers.deviceHead = (byte)(head & 0x0F); registers.sector = sector; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE took {0} ms.", duration); @@ -156,33 +156,31 @@ namespace DiscImageChef.Devices return sense; } - - public bool Read(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, byte sector, byte count, uint timeout, out double duration) + public bool Read(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, + byte sector, byte count, uint timeout, out double duration) { return Read(out buffer, out statusRegisters, true, cylinder, head, sector, count, timeout, out duration); } - public bool Read(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, bool retry, ushort cylinder, byte head, byte sector, byte count, uint timeout, out double duration) + public bool Read(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, bool retry, ushort cylinder, + byte head, byte sector, byte count, uint timeout, out double duration) { - if(count == 0) - buffer = new byte[512 * 256]; - else - buffer = new byte[512 * count]; + if(count == 0) buffer = new byte[512 * 256]; + else buffer = new byte[512 * count]; AtaRegistersCHS registers = new AtaRegistersCHS(); bool sense; - if(retry) - registers.command = (byte)AtaCommands.ReadRetry; - else - registers.command = (byte)AtaCommands.Read; + if(retry) registers.command = (byte)AtaCommands.ReadRetry; + else registers.command = (byte)AtaCommands.Read; registers.sectorCount = count; registers.cylinderHigh = (byte)((cylinder & 0xFF00) / 0x100); registers.cylinderLow = (byte)((cylinder & 0xFF) / 0x1); registers.deviceHead = (byte)(head & 0x0F); registers.sector = sector; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "READ SECTORS took {0} ms.", duration); @@ -190,29 +188,31 @@ namespace DiscImageChef.Devices return sense; } - public bool ReadLong(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, byte sector, uint blockSize, uint timeout, out double duration) + public bool ReadLong(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, + byte sector, uint blockSize, uint timeout, out double duration) { - return ReadLong(out buffer, out statusRegisters, true, cylinder, head, sector, blockSize, timeout, out duration); + return ReadLong(out buffer, out statusRegisters, true, cylinder, head, sector, blockSize, timeout, + out duration); } - public bool ReadLong(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, bool retry, ushort cylinder, byte head, byte sector, uint blockSize, uint timeout, out double duration) + public bool ReadLong(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, bool retry, ushort cylinder, + byte head, byte sector, uint blockSize, uint timeout, out double duration) { buffer = new byte[blockSize]; AtaRegistersCHS registers = new AtaRegistersCHS(); bool sense; - if(retry) - registers.command = (byte)AtaCommands.ReadLongRetry; - else - registers.command = (byte)AtaCommands.ReadLong; + if(retry) registers.command = (byte)AtaCommands.ReadLongRetry; + else registers.command = (byte)AtaCommands.ReadLong; registers.sectorCount = 1; registers.cylinderHigh = (byte)((cylinder & 0xFF00) / 0x100); registers.cylinderLow = (byte)((cylinder & 0xFF) / 0x1); registers.deviceHead = (byte)(head & 0x0F); registers.sector = sector; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "READ LONG took {0} ms.", duration); @@ -220,7 +220,8 @@ namespace DiscImageChef.Devices return sense; } - public bool Seek(out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, byte sector, uint timeout, out double duration) + public bool Seek(out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, byte sector, + uint timeout, out double duration) { byte[] buffer = new byte[0]; AtaRegistersCHS registers = new AtaRegistersCHS(); @@ -232,8 +233,9 @@ namespace DiscImageChef.Devices registers.deviceHead = (byte)(head & 0x0F); registers.sector = sector; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, true, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, true, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "SEEK took {0} ms.", duration); @@ -241,5 +243,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/AtaCommands/Atapi.cs b/DiscImageChef.Devices/Device/AtaCommands/Atapi.cs index 028ac2cc..984984dc 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Atapi.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Atapi.cs @@ -81,7 +81,8 @@ namespace DiscImageChef.Devices /// Status registers. /// Timeout. /// Duration. - public bool AtapiIdentify(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, uint timeout, out double duration) + public bool AtapiIdentify(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, uint timeout, + out double duration) { buffer = new byte[512]; AtaRegistersCHS registers = new AtaRegistersCHS(); @@ -89,8 +90,9 @@ namespace DiscImageChef.Devices registers.command = (byte)AtaCommands.IdentifyPacketDevice; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "IDENTIFY PACKET DEVICE took {0} ms.", duration); @@ -98,5 +100,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/AtaCommands/Cfa.cs b/DiscImageChef.Devices/Device/AtaCommands/Cfa.cs index fc14fb96..43833990 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Cfa.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Cfa.cs @@ -37,7 +37,8 @@ namespace DiscImageChef.Devices { public partial class Device { - public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, uint timeout, out double duration) + public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, + uint timeout, out double duration) { buffer = new byte[512]; AtaRegistersLBA28 registers = new AtaRegistersLBA28(); @@ -50,8 +51,9 @@ namespace DiscImageChef.Devices registers.lbaLow = (byte)((lba & 0xFF) / 0x1); registers.deviceHead += 0x40; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "CFA TRANSLATE SECTOR took {0} ms.", duration); @@ -59,7 +61,8 @@ namespace DiscImageChef.Devices return sense; } - public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, byte sector, uint timeout, out double duration) + public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, + byte head, byte sector, uint timeout, out double duration) { buffer = new byte[512]; AtaRegistersCHS registers = new AtaRegistersCHS(); @@ -71,8 +74,9 @@ namespace DiscImageChef.Devices registers.sector = sector; registers.deviceHead = (byte)(head & 0x0F); - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "CFA TRANSLATE SECTOR took {0} ms.", duration); @@ -80,7 +84,8 @@ namespace DiscImageChef.Devices return sense; } - public bool RequestExtendedErrorCode(out byte errorCode, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration) + public bool RequestExtendedErrorCode(out byte errorCode, out AtaErrorRegistersLBA28 statusRegisters, + uint timeout, out double duration) { byte[] buffer = new byte[0]; AtaRegistersLBA28 registers = new AtaRegistersLBA28(); @@ -88,8 +93,9 @@ namespace DiscImageChef.Devices registers.command = (byte)AtaCommands.RequestSense; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; errorCode = statusRegisters.error; @@ -99,5 +105,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/AtaCommands/MCPT.cs b/DiscImageChef.Devices/Device/AtaCommands/MCPT.cs index 6ad8ad70..af4cbdd3 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/MCPT.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/MCPT.cs @@ -37,17 +37,20 @@ namespace DiscImageChef.Devices { public partial class Device { - public bool EnableMediaCardPassThrough(out AtaErrorRegistersCHS statusRegisters, uint timeout, out double duration) + public bool EnableMediaCardPassThrough(out AtaErrorRegistersCHS statusRegisters, uint timeout, + out double duration) { return CheckMediaCardType(1, out statusRegisters, timeout, out duration); } - public bool DisableMediaCardPassThrough(out AtaErrorRegistersCHS statusRegisters, uint timeout, out double duration) + public bool DisableMediaCardPassThrough(out AtaErrorRegistersCHS statusRegisters, uint timeout, + out double duration) { return CheckMediaCardType(0, out statusRegisters, timeout, out duration); } - public bool CheckMediaCardType(byte feature, out AtaErrorRegistersCHS statusRegisters, uint timeout, out double duration) + public bool CheckMediaCardType(byte feature, out AtaErrorRegistersCHS statusRegisters, uint timeout, + out double duration) { byte[] buffer = new byte[0]; AtaRegistersCHS registers = new AtaRegistersCHS(); @@ -56,8 +59,9 @@ namespace DiscImageChef.Devices registers.command = (byte)AtaCommands.CheckMediaCardType; registers.feature = feature; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "CHECK MEDIA CARD TYPE took {0} ms.", duration); @@ -65,5 +69,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/AtaCommands/Smart.cs b/DiscImageChef.Devices/Device/AtaCommands/Smart.cs index 02a68500..186f8f13 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Smart.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Smart.cs @@ -48,8 +48,9 @@ namespace DiscImageChef.Devices registers.lbaHigh = 0xC2; registers.lbaMid = 0x4F; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "SMART DISABLE OPERATIONS took {0} ms.", duration); @@ -57,7 +58,8 @@ namespace DiscImageChef.Devices return sense; } - public bool SmartEnableAttributeAutosave(out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration) + public bool SmartEnableAttributeAutosave(out AtaErrorRegistersLBA28 statusRegisters, uint timeout, + out double duration) { byte[] buffer = new byte[0]; AtaRegistersLBA28 registers = new AtaRegistersLBA28(); @@ -69,8 +71,9 @@ namespace DiscImageChef.Devices registers.lbaMid = 0x4F; registers.sectorCount = 0xF1; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "SMART ENABLE ATTRIBUTE AUTOSAVE took {0} ms.", duration); @@ -78,7 +81,8 @@ namespace DiscImageChef.Devices return sense; } - public bool SmartDisableAttributeAutosave(out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration) + public bool SmartDisableAttributeAutosave(out AtaErrorRegistersLBA28 statusRegisters, uint timeout, + out double duration) { byte[] buffer = new byte[0]; AtaRegistersLBA28 registers = new AtaRegistersLBA28(); @@ -89,8 +93,9 @@ namespace DiscImageChef.Devices registers.lbaHigh = 0xC2; registers.lbaMid = 0x4F; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "SMART DISABLE ATTRIBUTE AUTOSAVE took {0} ms.", duration); @@ -109,8 +114,9 @@ namespace DiscImageChef.Devices registers.lbaHigh = 0xC2; registers.lbaMid = 0x4F; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "SMART ENABLE OPERATIONS took {0} ms.", duration); @@ -118,7 +124,8 @@ namespace DiscImageChef.Devices return sense; } - public bool SmartExecuteOffLineImmediate(out AtaErrorRegistersLBA28 statusRegisters, byte subcommand, uint timeout, out double duration) + public bool SmartExecuteOffLineImmediate(out AtaErrorRegistersLBA28 statusRegisters, byte subcommand, + uint timeout, out double duration) { byte[] buffer = new byte[0]; AtaRegistersLBA28 registers = new AtaRegistersLBA28(); @@ -130,8 +137,9 @@ namespace DiscImageChef.Devices registers.lbaMid = 0x4F; registers.lbaLow = subcommand; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "SMART EXECUTE OFF-LINE IMMEDIATE took {0} ms.", duration); @@ -139,7 +147,8 @@ namespace DiscImageChef.Devices return sense; } - public bool SmartReadData(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration) + public bool SmartReadData(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, + out double duration) { buffer = new byte[512]; AtaRegistersLBA28 registers = new AtaRegistersLBA28(); @@ -150,8 +159,9 @@ namespace DiscImageChef.Devices registers.lbaHigh = 0xC2; registers.lbaMid = 0x4F; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "SMART READ DATA took {0} ms.", duration); @@ -159,7 +169,8 @@ namespace DiscImageChef.Devices return sense; } - public bool SmartReadLog(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, byte logAddress, uint timeout, out double duration) + public bool SmartReadLog(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, byte logAddress, + uint timeout, out double duration) { buffer = new byte[512]; AtaRegistersLBA28 registers = new AtaRegistersLBA28(); @@ -171,8 +182,9 @@ namespace DiscImageChef.Devices registers.lbaMid = 0x4F; registers.lbaLow = logAddress; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "SMART READ LOG took {0} ms.", duration); @@ -191,8 +203,9 @@ namespace DiscImageChef.Devices registers.lbaHigh = 0xC2; registers.lbaMid = 0x4F; - lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out sense); + lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, + AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("ATA Device", "SMART RETURN STATUS took {0} ms.", duration); diff --git a/DiscImageChef.Devices/Device/Commands.cs b/DiscImageChef.Devices/Device/Commands.cs index 385de288..b89c747c 100644 --- a/DiscImageChef.Devices/Device/Commands.cs +++ b/DiscImageChef.Devices/Device/Commands.cs @@ -47,9 +47,11 @@ namespace DiscImageChef.Devices /// SCSI command transfer direction /// Time it took to execute the command in milliseconds /// True if SCSI command returned non-OK status and contains SCSI sense - public int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiDirection direction, out double duration, out bool sense) + public int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, + ScsiDirection direction, out double duration, out bool sense) { - return Command.SendScsiCommand(platformID, fd, cdb, ref buffer, out senseBuffer, timeout, direction, out duration, out sense); + return Command.SendScsiCommand(platformID, fd, cdb, ref buffer, out senseBuffer, timeout, direction, + out duration, out sense); } /// @@ -66,11 +68,11 @@ namespace DiscImageChef.Devices /// Time it took to execute the command in milliseconds /// True if ATA/ATAPI command returned non-OK status public int SendAtaCommand(AtaRegistersCHS registers, out AtaErrorRegistersCHS errorRegisters, - AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, + uint timeout, bool transferBlocks, out double duration, out bool sense) { return Command.SendAtaCommand(platformID, fd, registers, out errorRegisters, protocol, transferRegister, - ref buffer, timeout, transferBlocks, out duration, out sense); + ref buffer, timeout, transferBlocks, out duration, out sense); } /// @@ -87,11 +89,11 @@ namespace DiscImageChef.Devices /// Time it took to execute the command in milliseconds /// True if ATA/ATAPI command returned non-OK status public int SendAtaCommand(AtaRegistersLBA28 registers, out AtaErrorRegistersLBA28 errorRegisters, - AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, + uint timeout, bool transferBlocks, out double duration, out bool sense) { return Command.SendAtaCommand(platformID, fd, registers, out errorRegisters, protocol, transferRegister, - ref buffer, timeout, transferBlocks, out duration, out sense); + ref buffer, timeout, transferBlocks, out duration, out sense); } /// @@ -108,11 +110,11 @@ namespace DiscImageChef.Devices /// Time it took to execute the command in milliseconds /// True if ATA/ATAPI command returned non-OK status public int SendAtaCommand(AtaRegistersLBA48 registers, out AtaErrorRegistersLBA48 errorRegisters, - AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, + uint timeout, bool transferBlocks, out double duration, out bool sense) { return Command.SendAtaCommand(platformID, fd, registers, out errorRegisters, protocol, transferRegister, - ref buffer, timeout, transferBlocks, out duration, out sense); + ref buffer, timeout, transferBlocks, out duration, out sense); } /// @@ -131,8 +133,8 @@ namespace DiscImageChef.Devices /// Command argument /// Response registers /// Size of block in bytes - public int SendMmcCommand(MmcCommands command, bool write, bool isApplication, MmcFlags flags, - uint argument, uint blockSize, uint blocks, ref byte[] buffer, out uint[] response, + public int SendMmcCommand(MmcCommands command, bool write, bool isApplication, MmcFlags flags, uint argument, + uint blockSize, uint blocks, ref byte[] buffer, out uint[] response, out double duration, out bool sense, uint timeout = 0) { if(command == MmcCommands.SendCID && cachedCid != null) @@ -184,9 +186,8 @@ namespace DiscImageChef.Devices return 0; } - return Command.SendMmcCommand(platformID, fd, command, write, isApplication, flags, argument, blockSize, blocks, - ref buffer, out response, out duration, out sense, timeout); + return Command.SendMmcCommand(platformID, fd, command, write, isApplication, flags, argument, blockSize, + blocks, ref buffer, out response, out duration, out sense, timeout); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/Constructor.cs b/DiscImageChef.Devices/Device/Constructor.cs index 5854d106..0e70027d 100644 --- a/DiscImageChef.Devices/Device/Constructor.cs +++ b/DiscImageChef.Devices/Device/Constructor.cs @@ -54,33 +54,33 @@ namespace DiscImageChef.Devices switch(platformID) { case Interop.PlatformID.Win32NT: + { + fd = Windows.Extern.CreateFile(devicePath, + Windows.FileAccess.GenericRead | Windows.FileAccess.GenericWrite, + Windows.FileShare.Read | Windows.FileShare.Write, IntPtr.Zero, + Windows.FileMode.OpenExisting, Windows.FileAttributes.Normal, + IntPtr.Zero); + + if(((SafeFileHandle)fd).IsInvalid) { - fd = Windows.Extern.CreateFile(devicePath, - Windows.FileAccess.GenericRead | Windows.FileAccess.GenericWrite, - Windows.FileShare.Read | Windows.FileShare.Write, - IntPtr.Zero, Windows.FileMode.OpenExisting, - Windows.FileAttributes.Normal, IntPtr.Zero); - - if(((SafeFileHandle)fd).IsInvalid) - { - error = true; - lastError = Marshal.GetLastWin32Error(); - } - - break; + error = true; + lastError = Marshal.GetLastWin32Error(); } + + break; + } case Interop.PlatformID.Linux: + { + fd = Linux.Extern.open(devicePath, Linux.FileFlags.Readonly | Linux.FileFlags.NonBlocking); + + if((int)fd < 0) { - fd = Linux.Extern.open(devicePath, Linux.FileFlags.Readonly | Linux.FileFlags.NonBlocking); - - if((int)fd < 0) - { - error = true; - lastError = Marshal.GetLastWin32Error(); - } - - break; + error = true; + lastError = Marshal.GetLastWin32Error(); } + + break; + } case Interop.PlatformID.FreeBSD: { fd = FreeBSD.Extern.cam_open_device(devicePath, FreeBSD.FileFlags.ReadWrite); @@ -93,9 +93,10 @@ namespace DiscImageChef.Devices FreeBSD.cam_device camDevice = (FreeBSD.cam_device)Marshal.PtrToStructure((IntPtr)fd, typeof(FreeBSD.cam_device)); - + if(StringHandlers.CToString(camDevice.sim_name) == "ata") - throw new InvalidOperationException("Parallel ATA devices are not supported on FreeBSD due to upstream bug #224250."); + throw new + InvalidOperationException("Parallel ATA devices are not supported on FreeBSD due to upstream bug #224250."); break; } @@ -103,8 +104,7 @@ namespace DiscImageChef.Devices throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", platformID)); } - if(error) - throw new SystemException(string.Format("Error {0} opening device.", lastError)); + if(error) throw new SystemException(string.Format("Error {0} opening device.", lastError)); type = DeviceType.Unknown; scsiType = Decoders.SCSI.PeripheralDeviceTypes.UnknownDevice; @@ -115,8 +115,7 @@ namespace DiscImageChef.Devices byte[] senseBuf; byte[] inqBuf = null; - if(error) - throw new SystemException(string.Format("Error {0} trying device.", lastError)); + if(error) throw new SystemException(string.Format("Error {0} trying device.", lastError)); bool scsiSense = true; string ntDevicePath = null; @@ -135,21 +134,24 @@ namespace DiscImageChef.Devices uint returned = 0; int error = 0; - bool hasError = !Windows.Extern.DeviceIoControlStorageQuery((SafeFileHandle)fd, Windows.WindowsIoctl.IOCTL_STORAGE_QUERY_PROPERTY, ref query, (uint)Marshal.SizeOf(query), descriptorPtr, 1000, ref returned, IntPtr.Zero); + bool hasError = !Windows.Extern.DeviceIoControlStorageQuery((SafeFileHandle)fd, + Windows.WindowsIoctl + .IOCTL_STORAGE_QUERY_PROPERTY, + ref query, (uint)Marshal.SizeOf(query), + descriptorPtr, 1000, ref returned, + IntPtr.Zero); - if(hasError) - error = Marshal.GetLastWin32Error(); + if(hasError) error = Marshal.GetLastWin32Error(); Marshal.Copy(descriptorPtr, descriptor_b, 0, 1000); if(!hasError && error == 0) { - Windows.StorageDeviceDescriptor descriptor = new Windows.StorageDeviceDescriptor(); descriptor.Version = BitConverter.ToUInt32(descriptor_b, 0); descriptor.Size = BitConverter.ToUInt32(descriptor_b, 4); descriptor.DeviceType = descriptor_b[8]; - descriptor.DeviceTypeModifier= descriptor_b[9]; + descriptor.DeviceTypeModifier = descriptor_b[9]; descriptor.RemovableMedia = descriptor_b[10] > 0; descriptor.CommandQueueing = descriptor_b[11] > 0; descriptor.VendorIdOffset = BitConverter.ToUInt32(descriptor_b, 12); @@ -207,14 +209,12 @@ namespace DiscImageChef.Devices type = DeviceType.ATAPI; Identify.IdentifyDevice? ATAID = Identify.Decode(ataBuf); - if(ATAID.HasValue) - scsiSense = ScsiInquiry(out inqBuf, out senseBuf); + if(ATAID.HasValue) scsiSense = ScsiInquiry(out inqBuf, out senseBuf); } - else - manufacturer = "ATA"; + else manufacturer = "ATA"; } } - + ntDevicePath = Windows.Command.GetDevicePath((SafeFileHandle)fd); DicConsole.DebugWriteLine("Windows devices", "NT device path: {0}", ntDevicePath); Marshal.FreeHGlobal(descriptorPtr); @@ -224,9 +224,11 @@ namespace DiscImageChef.Devices byte[] sdBuffer = new byte[16]; bool sense = false; - lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCSD, false, false, MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC, - 0, 16, 1, ref sdBuffer, out uint[] response, out double duration, out sense, 0); - + lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCSD, false, false, + MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | + MmcFlags.CommandAC, 0, 16, 1, ref sdBuffer, + out uint[] response, out double duration, out sense, 0); + if(!sense) { cachedCsd = new byte[16]; @@ -236,8 +238,10 @@ namespace DiscImageChef.Devices sdBuffer = new byte[16]; sense = false; - lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCID, false, false, MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC, - 0, 16, 1, ref sdBuffer, out response, out duration, out sense, 0); + lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCID, false, false, + MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | + MmcFlags.CommandAC, 0, 16, 1, ref sdBuffer, out response, + out duration, out sense, 0); if(!sense) { @@ -248,8 +252,11 @@ namespace DiscImageChef.Devices sdBuffer = new byte[8]; sense = false; - lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, (MmcCommands)SecureDigitalCommands.SendSCR, false, true, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, - 0, 8, 1, ref sdBuffer, out response, out duration, out sense, 0); + lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, + (MmcCommands)SecureDigitalCommands.SendSCR, false, true, + MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | + MmcFlags.CommandADTC, 0, 8, 1, ref sdBuffer, + out response, out duration, out sense, 0); if(!sense) { @@ -262,8 +269,12 @@ namespace DiscImageChef.Devices sdBuffer = new byte[4]; sense = false; - lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, (MmcCommands)SecureDigitalCommands.SendOperatingCondition, false, true, MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR, - 0, 4, 1, ref sdBuffer, out response, out duration, out sense, 0); + lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, + (MmcCommands)SecureDigitalCommands + .SendOperatingCondition, false, true, + MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | + MmcFlags.CommandBCR, 0, 4, 1, ref sdBuffer, + out response, out duration, out sense, 0); if(!sense) { @@ -276,8 +287,11 @@ namespace DiscImageChef.Devices sdBuffer = new byte[4]; sense = false; - lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendOpCond, false, true, MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR, - 0, 4, 1, ref sdBuffer, out response, out duration, out sense, 0); + lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendOpCond, false, + true, + MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | + MmcFlags.CommandBCR, 0, 4, 1, ref sdBuffer, + out response, out duration, out sense, 0); if(!sense) { @@ -289,7 +303,9 @@ namespace DiscImageChef.Devices } else if(platformID == Interop.PlatformID.Linux) { - if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || devicePath.StartsWith("/dev/st", StringComparison.Ordinal)) + if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || + devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || + devicePath.StartsWith("/dev/st", StringComparison.Ordinal)) scsiSense = ScsiInquiry(out inqBuf, out senseBuf); // MultiMediaCard and SecureDigital go here else if(devicePath.StartsWith("/dev/mmcblk", StringComparison.Ordinal)) @@ -298,31 +314,26 @@ namespace DiscImageChef.Devices if(System.IO.File.Exists("/sys/block/" + devPath + "/device/csd")) { int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/csd", out cachedCsd); - if(len == 0) - cachedCsd = null; + if(len == 0) cachedCsd = null; } if(System.IO.File.Exists("/sys/block/" + devPath + "/device/cid")) { int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/cid", out cachedCid); - if(len == 0) - cachedCid = null; + if(len == 0) cachedCid = null; } if(System.IO.File.Exists("/sys/block/" + devPath + "/device/scr")) { int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/scr", out cachedScr); - if(len == 0) - cachedScr = null; + if(len == 0) cachedScr = null; } if(System.IO.File.Exists("/sys/block/" + devPath + "/device/ocr")) { int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/ocr", out cachedOcr); - if(len == 0) - cachedOcr = null; + if(len == 0) cachedOcr = null; } } } - else - scsiSense = ScsiInquiry(out inqBuf, out senseBuf); + else scsiSense = ScsiInquiry(out inqBuf, out senseBuf); #region SecureDigital / MultiMediaCard if(cachedCid != null) @@ -336,7 +347,8 @@ namespace DiscImageChef.Devices Decoders.SecureDigital.CID decoded = Decoders.SecureDigital.Decoders.DecodeCID(cachedCid); manufacturer = Decoders.SecureDigital.VendorString.Prettify(decoded.Manufacturer); model = decoded.ProductName; - revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4, decoded.ProductRevision & 0x0F); + revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4, + decoded.ProductRevision & 0x0F); serial = string.Format("{0}", decoded.ProductSerialNumber); } else @@ -345,14 +357,14 @@ namespace DiscImageChef.Devices Decoders.MMC.CID decoded = Decoders.MMC.Decoders.DecodeCID(cachedCid); manufacturer = Decoders.MMC.VendorString.Prettify(decoded.Manufacturer); model = decoded.ProductName; - revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4, decoded.ProductRevision & 0x0F); + revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4, + decoded.ProductRevision & 0x0F); serial = string.Format("{0}", decoded.ProductSerialNumber); } } #endregion SecureDigital / MultiMediaCard - - #region USB + #region USB if(platformID == Interop.PlatformID.Linux) { if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || @@ -378,7 +390,8 @@ namespace DiscImageChef.Devices string usbTemp; usbFs = new System.IO.FileStream(resolvedLink + "/descriptors", - System.IO.FileMode.Open, System.IO.FileAccess.Read); + System.IO.FileMode.Open, + System.IO.FileAccess.Read); byte[] usbBuf = new byte[65536]; int usbCount = usbFs.Read(usbBuf, 0, 65536); usbDescriptors = new byte[usbCount]; @@ -388,13 +401,13 @@ namespace DiscImageChef.Devices usbSr = new System.IO.StreamReader(resolvedLink + "/idProduct"); usbTemp = usbSr.ReadToEnd(); ushort.TryParse(usbTemp, System.Globalization.NumberStyles.HexNumber, - System.Globalization.CultureInfo.InvariantCulture, out usbProduct); + System.Globalization.CultureInfo.InvariantCulture, out usbProduct); usbSr.Close(); usbSr = new System.IO.StreamReader(resolvedLink + "/idVendor"); usbTemp = usbSr.ReadToEnd(); ushort.TryParse(usbTemp, System.Globalization.NumberStyles.HexNumber, - System.Globalization.CultureInfo.InvariantCulture, out usbVendor); + System.Globalization.CultureInfo.InvariantCulture, out usbVendor); usbSr.Close(); if(System.IO.File.Exists(resolvedLink + "/manufacturer")) @@ -429,13 +442,16 @@ namespace DiscImageChef.Devices else if(platformID == Interop.PlatformID.Win32NT) { Windows.Usb.USBDevice usbDevice = null; - + // I have to search for USB disks, floppies and CD-ROMs as separate device types - foreach(string devGuid in new [] { Windows.Usb.GUID_DEVINTERFACE_FLOPPY, Windows.Usb.GUID_DEVINTERFACE_CDROM , Windows.Usb.GUID_DEVINTERFACE_DISK }) + foreach(string devGuid in new[] + { + Windows.Usb.GUID_DEVINTERFACE_FLOPPY, Windows.Usb.GUID_DEVINTERFACE_CDROM, + Windows.Usb.GUID_DEVINTERFACE_DISK + }) { usbDevice = Windows.Usb.FindDrivePath(devicePath, devGuid); - if (usbDevice != null) - break; + if(usbDevice != null) break; } if(usbDevice != null) @@ -445,19 +461,20 @@ namespace DiscImageChef.Devices usbProduct = (ushort)usbDevice.DeviceDescriptor.idProduct; usbManufacturerString = usbDevice.Manufacturer; usbProductString = usbDevice.Product; - usbSerialString = usbDevice.SerialNumber; // This is incorrect filled by Windows with SCSI/ATA serial number + usbSerialString = + usbDevice.SerialNumber; // This is incorrect filled by Windows with SCSI/ATA serial number } - } // TODO: Implement for other operating systems - else - usb = false; + else usb = false; #endregion USB #region FireWire if(platformID == Interop.PlatformID.Linux) { - if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || devicePath.StartsWith("/dev/st", StringComparison.Ordinal)) + if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || + devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || + devicePath.StartsWith("/dev/st", StringComparison.Ordinal)) { string devPath = devicePath.Substring(5); if(System.IO.Directory.Exists("/sys/block/" + devPath)) @@ -470,25 +487,29 @@ namespace DiscImageChef.Devices { resolvedLink = System.IO.Path.GetDirectoryName(resolvedLink); if(System.IO.File.Exists(resolvedLink + "/model") && - System.IO.File.Exists(resolvedLink + "/vendor") && - System.IO.File.Exists(resolvedLink + "/guid")) + System.IO.File.Exists(resolvedLink + "/vendor") && + System.IO.File.Exists(resolvedLink + "/guid")) { System.IO.StreamReader fwSr; string fwTemp; fwSr = new System.IO.StreamReader(resolvedLink + "/model"); fwTemp = fwSr.ReadToEnd(); - uint.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out firewireModel); + uint.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber, + System.Globalization.CultureInfo.InvariantCulture, out firewireModel); fwSr.Close(); fwSr = new System.IO.StreamReader(resolvedLink + "/vendor"); fwTemp = fwSr.ReadToEnd(); - uint.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out firewireVendor); + uint.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber, + System.Globalization.CultureInfo.InvariantCulture, + out firewireVendor); fwSr.Close(); fwSr = new System.IO.StreamReader(resolvedLink + "/guid"); fwTemp = fwSr.ReadToEnd(); - ulong.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out firewireGuid); + ulong.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber, + System.Globalization.CultureInfo.InvariantCulture, out firewireGuid); fwSr.Close(); if(System.IO.File.Exists(resolvedLink + "/model_name")) @@ -514,14 +535,15 @@ namespace DiscImageChef.Devices } } // TODO: Implement for other operating systems - else - firewire = false; + else firewire = false; #endregion FireWire #region PCMCIA if(platformID == Interop.PlatformID.Linux) { - if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || devicePath.StartsWith("/dev/st", StringComparison.Ordinal)) + if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || + devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || + devicePath.StartsWith("/dev/st", StringComparison.Ordinal)) { string devPath = devicePath.Substring(5); if(System.IO.Directory.Exists("/sys/block/" + devPath)) @@ -535,17 +557,23 @@ namespace DiscImageChef.Devices resolvedLink = System.IO.Path.GetDirectoryName(resolvedLink); if(System.IO.Directory.Exists(resolvedLink + "/pcmcia_socket")) { - string[] subdirs = System.IO.Directory.GetDirectories(resolvedLink + "/pcmcia_socket", "pcmcia_socket*", System.IO.SearchOption.TopDirectoryOnly); + string[] subdirs = + System.IO.Directory.GetDirectories(resolvedLink + "/pcmcia_socket", + "pcmcia_socket*", + System.IO.SearchOption.TopDirectoryOnly); if(subdirs.Length > 0) { - string possibleDir = System.IO.Path.Combine(resolvedLink, "pcmcia_socket", subdirs[0]); + string possibleDir = + System.IO.Path.Combine(resolvedLink, "pcmcia_socket", subdirs[0]); if(System.IO.File.Exists(possibleDir + "/card_type") && System.IO.File.Exists(possibleDir + "/cis")) { System.IO.FileStream cisFs; - cisFs = new System.IO.FileStream(possibleDir + "/cis", System.IO.FileMode.Open, System.IO.FileAccess.Read); + cisFs = new System.IO.FileStream(possibleDir + "/cis", + System.IO.FileMode.Open, + System.IO.FileAccess.Read); byte[] cisBuf = new byte[65536]; int cisCount = cisFs.Read(cisBuf, 0, 65536); cis = new byte[cisCount]; @@ -563,8 +591,7 @@ namespace DiscImageChef.Devices } } // TODO: Implement for other operating systems - else - pcmcia = false; + else pcmcia = false; #endregion PCMCIA if(!scsiSense) @@ -573,20 +600,16 @@ namespace DiscImageChef.Devices type = DeviceType.SCSI; bool serialSense = ScsiInquiry(out inqBuf, out senseBuf, 0x80); - if(!serialSense) - serial = Decoders.SCSI.EVPD.DecodePage80(inqBuf); + if(!serialSense) serial = Decoders.SCSI.EVPD.DecodePage80(inqBuf); if(Inquiry.HasValue) { string tmp = StringHandlers.CToString(Inquiry.Value.ProductRevisionLevel); - if(tmp != null) - revision = tmp.Trim(); + if(tmp != null) revision = tmp.Trim(); tmp = StringHandlers.CToString(Inquiry.Value.ProductIdentification); - if(tmp != null) - model = tmp.Trim(); + if(tmp != null) model = tmp.Trim(); tmp = StringHandlers.CToString(Inquiry.Value.VendorIdentification); - if(tmp != null) - manufacturer = tmp.Trim(); + if(tmp != null) manufacturer = tmp.Trim(); removable = Inquiry.Value.RMB; scsiType = (Decoders.SCSI.PeripheralDeviceTypes)Inquiry.Value.PeripheralDeviceType; @@ -599,8 +622,7 @@ namespace DiscImageChef.Devices type = DeviceType.ATAPI; Identify.IdentifyDevice? ATAID = Identify.Decode(ataBuf); - if(ATAID.HasValue) - serial = ATAID.Value.SerialNumber; + if(ATAID.HasValue) serial = ATAID.Value.SerialNumber; } else { @@ -609,7 +631,7 @@ namespace DiscImageChef.Devices } } - if ((scsiSense && (usb || firewire)) || manufacturer == "ATA") + if((scsiSense && (usb || firewire)) || manufacturer == "ATA") { bool ataSense = AtaIdentify(out ataBuf, out errorRegisters); if(!ataSense) @@ -621,8 +643,7 @@ namespace DiscImageChef.Devices { string[] separated = ATAID.Value.Model.Split(' '); - if(separated.Length == 1) - model = separated[0]; + if(separated.Length == 1) model = separated[0]; else { manufacturer = separated[0]; @@ -636,10 +657,11 @@ namespace DiscImageChef.Devices if((ushort)ATAID.Value.GeneralConfiguration != 0x848A) { - removable |= (ATAID.Value.GeneralConfiguration & Identify.GeneralConfigurationBit.Removable) == Identify.GeneralConfigurationBit.Removable; + removable |= + (ATAID.Value.GeneralConfiguration & Identify.GeneralConfigurationBit.Removable) == + Identify.GeneralConfigurationBit.Removable; } - else - compactFlash = true; + else compactFlash = true; } } } @@ -654,37 +676,20 @@ namespace DiscImageChef.Devices if(usb) { - if(string.IsNullOrEmpty(manufacturer)) - manufacturer = usbManufacturerString; - if(string.IsNullOrEmpty(model)) - model = usbProductString; - if(string.IsNullOrEmpty(serial)) - serial = usbSerialString; - else - { - foreach(char c in serial) - { - if(char.IsControl(c)) - serial = usbSerialString; - } - } + if(string.IsNullOrEmpty(manufacturer)) manufacturer = usbManufacturerString; + if(string.IsNullOrEmpty(model)) model = usbProductString; + if(string.IsNullOrEmpty(serial)) serial = usbSerialString; + else { foreach(char c in serial) { if(char.IsControl(c)) serial = usbSerialString; } } } if(firewire) { - if(string.IsNullOrEmpty(manufacturer)) - manufacturer = firewireVendorName; - if(string.IsNullOrEmpty(model)) - model = firewireModelName; - if(string.IsNullOrEmpty(serial)) - serial = string.Format("{0:X16}", firewireGuid); + if(string.IsNullOrEmpty(manufacturer)) manufacturer = firewireVendorName; + if(string.IsNullOrEmpty(model)) model = firewireModelName; + if(string.IsNullOrEmpty(serial)) serial = string.Format("{0:X16}", firewireGuid); else { - foreach(char c in serial) - { - if(char.IsControl(c)) - serial = string.Format("{0:X16}", firewireGuid); - } + foreach(char c in serial) { if(char.IsControl(c)) serial = string.Format("{0:X16}", firewireGuid); } } } } @@ -698,20 +703,16 @@ namespace DiscImageChef.Devices try { - for(int i = 0; i < ins.Length; i+=2) + for(int i = 0; i < ins.Length; i += 2) { - outBuf[i/2] = Convert.ToByte(ins.Substring(i, 2), 16); + outBuf[i / 2] = Convert.ToByte(ins.Substring(i, 2), 16); count++; } } - catch - { - count = 0; - } + catch { count = 0; } sr.Close(); return count; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/Destructor.cs b/DiscImageChef.Devices/Device/Destructor.cs index 5914d2f4..6f0224f5 100644 --- a/DiscImageChef.Devices/Device/Destructor.cs +++ b/DiscImageChef.Devices/Device/Destructor.cs @@ -60,5 +60,4 @@ namespace DiscImageChef.Devices } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/List.cs b/DiscImageChef.Devices/Device/List.cs index bd391f39..9f381c60 100644 --- a/DiscImageChef.Devices/Device/List.cs +++ b/DiscImageChef.Devices/Device/List.cs @@ -50,16 +50,13 @@ namespace DiscImageChef.Devices { switch(Interop.DetectOS.GetRealPlatformID()) { - case Interop.PlatformID.Win32NT: - return Windows.ListDevices.GetList(); - case Interop.PlatformID.Linux: - return Linux.ListDevices.GetList(); - case Interop.PlatformID.FreeBSD: - return FreeBSD.ListDevices.GetList(); + case Interop.PlatformID.Win32NT: return Windows.ListDevices.GetList(); + case Interop.PlatformID.Linux: return Linux.ListDevices.GetList(); + case Interop.PlatformID.FreeBSD: return FreeBSD.ListDevices.GetList(); default: - throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", Interop.DetectOS.GetRealPlatformID())); + throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", + Interop.DetectOS.GetRealPlatformID())); } - } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/MmcCommands/MMC.cs b/DiscImageChef.Devices/Device/MmcCommands/MMC.cs index e0c5b3d8..a7b8b955 100644 --- a/DiscImageChef.Devices/Device/MmcCommands/MMC.cs +++ b/DiscImageChef.Devices/Device/MmcCommands/MMC.cs @@ -41,8 +41,9 @@ namespace DiscImageChef.Devices buffer = new byte[16]; bool sense = false; - lastError = SendMmcCommand(MmcCommands.SendCSD, false, false, MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC, - 0, 16, 1, ref buffer, out response, out duration, out sense, timeout); + lastError = SendMmcCommand(MmcCommands.SendCSD, false, false, + MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC, 0, 16, 1, + ref buffer, out response, out duration, out sense, timeout); error = lastError != 0; DicConsole.DebugWriteLine("MMC Device", "SEND_CSD took {0} ms.", duration); @@ -55,8 +56,9 @@ namespace DiscImageChef.Devices buffer = new byte[16]; bool sense = false; - lastError = SendMmcCommand(MmcCommands.SendCID, false, false, MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC, - 0, 16, 1, ref buffer, out response, out duration, out sense, timeout); + lastError = SendMmcCommand(MmcCommands.SendCID, false, false, + MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC, 0, 16, 1, + ref buffer, out response, out duration, out sense, timeout); error = lastError != 0; DicConsole.DebugWriteLine("MMC Device", "SEND_CID took {0} ms.", duration); @@ -69,8 +71,9 @@ namespace DiscImageChef.Devices buffer = new byte[4]; bool sense = false; - lastError = SendMmcCommand(MmcCommands.SendOpCond, false, true, MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR, - 0, 4, 1, ref buffer, out response, out duration, out sense, timeout); + lastError = SendMmcCommand(MmcCommands.SendOpCond, false, true, + MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR, 0, 4, 1, + ref buffer, out response, out duration, out sense, timeout); error = lastError != 0; DicConsole.DebugWriteLine("SecureDigital Device", "SEND_OP_COND took {0} ms.", duration); @@ -83,8 +86,9 @@ namespace DiscImageChef.Devices buffer = new byte[512]; bool sense = false; - lastError = SendMmcCommand(MmcCommands.SendExtCSD, false, false, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, - 0, 512, 1, ref buffer, out response, out duration, out sense, timeout); + lastError = SendMmcCommand(MmcCommands.SendExtCSD, false, false, + MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, 0, 512, 1, + ref buffer, out response, out duration, out sense, timeout); error = lastError != 0; DicConsole.DebugWriteLine("MMC Device", "SEND_EXT_CSD took {0} ms.", duration); @@ -97,8 +101,9 @@ namespace DiscImageChef.Devices byte[] buffer = new byte[0]; bool sense = false; - lastError = SendMmcCommand(MmcCommands.SetBlocklen, false, false, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandAC, - length, 0, 0, ref buffer, out response, out duration, out sense, timeout); + lastError = SendMmcCommand(MmcCommands.SetBlocklen, false, false, + MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandAC, length, 0, + 0, ref buffer, out response, out duration, out sense, timeout); error = lastError != 0; DicConsole.DebugWriteLine("MMC Device", "SET_BLOCKLEN took {0} ms.", duration); @@ -106,36 +111,35 @@ namespace DiscImageChef.Devices return sense; } - public bool Read(out byte[] buffer, out uint[] response, uint lba, uint blockSize, uint transferLength, bool byteAddressed, uint timeout, out double duration) + public bool Read(out byte[] buffer, out uint[] response, uint lba, uint blockSize, uint transferLength, + bool byteAddressed, uint timeout, out double duration) { buffer = new byte[transferLength * blockSize]; bool sense = false; uint address; - if(byteAddressed) - address = lba * blockSize; - else - address = lba; + if(byteAddressed) address = lba * blockSize; + else address = lba; MmcCommands command; - if(transferLength > 1) - command = MmcCommands.ReadMultipleBlock; - else - command = MmcCommands.ReadSingleBlock; + if(transferLength > 1) command = MmcCommands.ReadMultipleBlock; + else command = MmcCommands.ReadSingleBlock; - lastError = SendMmcCommand(command, false, false, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, - address, blockSize, transferLength, ref buffer, out response, out duration, out sense, timeout); + lastError = SendMmcCommand(command, false, false, + MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, address, + blockSize, transferLength, ref buffer, out response, out duration, out sense, + timeout); error = lastError != 0; if(transferLength > 1) { byte[] foo = new byte[0]; - SendMmcCommand(MmcCommands.StopTransmission, false, false, MmcFlags.Response_R1b | MmcFlags.ResponseSPI_R1b | MmcFlags.CommandAC, - 0, 0, 0, ref foo, out uint[] responseStop, out double stopDuration, out bool stopSense, timeout); + SendMmcCommand(MmcCommands.StopTransmission, false, false, + MmcFlags.Response_R1b | MmcFlags.ResponseSPI_R1b | MmcFlags.CommandAC, 0, 0, 0, ref foo, + out uint[] responseStop, out double stopDuration, out bool stopSense, timeout); duration += stopDuration; DicConsole.DebugWriteLine("MMC Device", "READ_MULTIPLE_BLOCK took {0} ms.", duration); } - else - DicConsole.DebugWriteLine("MMC Device", "READ_SINGLE_BLOCK took {0} ms.", duration); + else DicConsole.DebugWriteLine("MMC Device", "READ_SINGLE_BLOCK took {0} ms.", duration); return sense; } @@ -145,8 +149,9 @@ namespace DiscImageChef.Devices buffer = new byte[4]; bool sense = false; - lastError = SendMmcCommand(MmcCommands.SendStatus, false, true, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandAC, - 0, 4, 1, ref buffer, out response, out duration, out sense, timeout); + lastError = SendMmcCommand(MmcCommands.SendStatus, false, true, + MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandAC, 0, 4, 1, + ref buffer, out response, out duration, out sense, timeout); error = lastError != 0; DicConsole.DebugWriteLine("SecureDigital Device", "SEND_STATUS took {0} ms.", duration); @@ -154,4 +159,4 @@ namespace DiscImageChef.Devices return sense; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/MmcCommands/SecureDigital.cs b/DiscImageChef.Devices/Device/MmcCommands/SecureDigital.cs index cf35ef18..11b396db 100644 --- a/DiscImageChef.Devices/Device/MmcCommands/SecureDigital.cs +++ b/DiscImageChef.Devices/Device/MmcCommands/SecureDigital.cs @@ -41,8 +41,9 @@ namespace DiscImageChef.Devices buffer = new byte[64]; bool sense = false; - lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendStatus, false, true, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, - 0, 64, 1, ref buffer, out response, out duration, out sense, timeout); + lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendStatus, false, true, + MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, 0, 64, 1, + ref buffer, out response, out duration, out sense, timeout); error = lastError != 0; DicConsole.DebugWriteLine("SecureDigital Device", "SD_STATUS took {0} ms.", duration); @@ -55,22 +56,24 @@ namespace DiscImageChef.Devices buffer = new byte[4]; bool sense = false; - lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendOperatingCondition, false, true, MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR, - 0, 4, 1, ref buffer, out response, out duration, out sense, timeout); + lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendOperatingCondition, false, true, + MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR, 0, 4, 1, + ref buffer, out response, out duration, out sense, timeout); error = lastError != 0; DicConsole.DebugWriteLine("SecureDigital Device", "SD_SEND_OP_COND took {0} ms.", duration); return sense; } - + public bool ReadSCR(out byte[] buffer, out uint[] response, uint timeout, out double duration) { buffer = new byte[8]; bool sense = false; - lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendSCR, false, true, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, - 0, 8, 1, ref buffer, out response, out duration, out sense, timeout); + lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendSCR, false, true, + MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, 0, 8, 1, + ref buffer, out response, out duration, out sense, timeout); error = lastError != 0; DicConsole.DebugWriteLine("SecureDigital Device", "SEND_SCR took {0} ms.", duration); @@ -78,4 +81,4 @@ namespace DiscImageChef.Devices return sense; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs b/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs index a9d46f11..360e84de 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs @@ -46,7 +46,8 @@ namespace DiscImageChef.Devices /// SCSI Logical Block Address. /// Timeout. /// Duration. - public bool AdaptecTranslate(out byte[] buffer, out byte[] senseBuffer, uint lba, uint timeout, out double duration) + public bool AdaptecTranslate(out byte[] buffer, out byte[] senseBuffer, uint lba, uint timeout, + out double duration) { return AdaptecTranslate(out buffer, out senseBuffer, false, lba, timeout, out duration); } @@ -60,7 +61,8 @@ namespace DiscImageChef.Devices /// SCSI Logical Block Address. /// Timeout. /// Duration. - public bool AdaptecTranslate(out byte[] buffer, out byte[] senseBuffer, bool drive1, uint lba, uint timeout, out double duration) + public bool AdaptecTranslate(out byte[] buffer, out byte[] senseBuffer, bool drive1, uint lba, uint timeout, + out double duration) { buffer = new byte[8]; byte[] cdb = new byte[6]; @@ -71,10 +73,10 @@ namespace DiscImageChef.Devices cdb[1] = (byte)((lba & 0x1F0000) >> 16); cdb[2] = (byte)((lba & 0xFF00) >> 8); cdb[3] = (byte)(lba & 0xFF); - if(drive1) - cdb[1] += 0x20; + if(drive1) cdb[1] += 0x20; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC TRANSLATE took {0} ms.", duration); @@ -104,7 +106,8 @@ namespace DiscImageChef.Devices /// If set to true set the threshold from drive 1. /// Timeout. /// Duration. - public bool AdaptecSetErrorThreshold(byte threshold, out byte[] senseBuffer, bool drive1, uint timeout, out double duration) + public bool AdaptecSetErrorThreshold(byte threshold, out byte[] senseBuffer, bool drive1, uint timeout, + out double duration) { byte[] buffer = new byte[1]; buffer[0] = threshold; @@ -113,11 +116,11 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.Adaptec_SetErrorThreshold; - if(drive1) - cdb[1] += 0x20; + if(drive1) cdb[1] += 0x20; cdb[4] = 1; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC SET ERROR THRESHOLD took {0} ms.", duration); @@ -132,7 +135,8 @@ namespace DiscImageChef.Devices /// Sense buffer. /// Timeout. /// Duration. - public bool AdaptecReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) + public bool AdaptecReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, uint timeout, + out double duration) { return AdaptecReadUsageCounter(out buffer, out senseBuffer, false, timeout, out duration); } @@ -145,7 +149,8 @@ namespace DiscImageChef.Devices /// If set to true get the counters from drive 1. /// Timeout. /// Duration. - public bool AdaptecReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, bool drive1, uint timeout, out double duration) + public bool AdaptecReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, bool drive1, uint timeout, + out double duration) { buffer = new byte[9]; byte[] cdb = new byte[6]; @@ -153,11 +158,11 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.Adaptec_Translate; - if(drive1) - cdb[1] += 0x20; + if(drive1) cdb[1] += 0x20; cdb[4] = (byte)buffer.Length; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC READ/RESET USAGE COUNTER took {0} ms.", duration); @@ -175,10 +180,8 @@ namespace DiscImageChef.Devices public bool AdaptecWriteBuffer(byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { byte[] oneKBuffer = new byte[1024]; - if(buffer.Length < 1024) - Array.Copy(buffer, 0, oneKBuffer, 0, buffer.Length); - else - Array.Copy(buffer, 0, oneKBuffer, 0, 1024); + if(buffer.Length < 1024) Array.Copy(buffer, 0, oneKBuffer, 0, buffer.Length); + else Array.Copy(buffer, 0, oneKBuffer, 0, 1024); byte[] cdb = new byte[6]; senseBuffer = new byte[32]; @@ -186,7 +189,8 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.Adaptec_WriteBuffer; - lastError = SendScsiCommand(cdb, ref oneKBuffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out sense); + lastError = SendScsiCommand(cdb, ref oneKBuffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC WRITE DATA BUFFER took {0} ms.", duration); @@ -210,7 +214,8 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.Adaptec_ReadBuffer; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC READ DATA BUFFER took {0} ms.", duration); @@ -218,5 +223,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs b/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs index 9c12cd4f..626b0b5f 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs @@ -43,7 +43,8 @@ namespace DiscImageChef.Devices /// Sense buffer. /// Timeout. /// Duration. - public bool ArchiveCorpRequestBlockAddress(out byte[] buffer, out byte[] senseBuffer, uint lba, uint timeout, out double duration) + public bool ArchiveCorpRequestBlockAddress(out byte[] buffer, out byte[] senseBuffer, uint lba, uint timeout, + out double duration) { buffer = new byte[3]; byte[] cdb = new byte[6]; @@ -56,7 +57,8 @@ namespace DiscImageChef.Devices cdb[3] = (byte)(lba & 0xFF); cdb[4] = 3; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "ARCHIVE CORP. REQUEST BLOCK ADDRESS took {0} ms.", duration); @@ -84,7 +86,8 @@ namespace DiscImageChef.Devices /// Logical Block Address, starting from 1. /// Timeout. /// Duration. - public bool ArchiveCorpSeekBlock(out byte[] senseBuffer, bool immediate, uint lba, uint timeout, out double duration) + public bool ArchiveCorpSeekBlock(out byte[] senseBuffer, bool immediate, uint lba, uint timeout, + out double duration) { byte[] buffer = new byte[0]; byte[] cdb = new byte[6]; @@ -95,10 +98,10 @@ namespace DiscImageChef.Devices cdb[1] = (byte)((lba & 0x1F0000) >> 16); cdb[2] = (byte)((lba & 0xFF00) >> 8); cdb[3] = (byte)(lba & 0xFF); - if(immediate) - cdb[1] += 0x01; + if(immediate) cdb[1] += 0x01; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "ARCHIVE CORP. SEEK BLOCK took {0} ms.", duration); @@ -106,5 +109,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs b/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs index 74f9bb13..6db6e258 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs @@ -73,10 +73,10 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.Certance_ParkUnpark; - if(park) - cdb[4] = 1; + if(park) cdb[4] = 1; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "CERTANCE PARK UNPARK took {0} ms.", duration); @@ -84,5 +84,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs b/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs index 07f4a0ba..0e19f119 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs @@ -37,7 +37,8 @@ namespace DiscImageChef.Devices { public partial class Device { - public bool FujitsuDisplay(out byte[] senseBuffer, bool flash, FujitsuDisplayModes mode, string firstHalf, string secondHalf, uint timeout, out double duration) + public bool FujitsuDisplay(out byte[] senseBuffer, bool flash, FujitsuDisplayModes mode, string firstHalf, + string secondHalf, uint timeout, out double duration) { byte[] tmp; byte[] firstHalfBytes = new byte[8]; @@ -62,19 +63,19 @@ namespace DiscImageChef.Devices if(mode != FujitsuDisplayModes.Half) { if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && - !ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) + !ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) { displayLen = true; halfMsg = false; } else if(ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && - !ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) + !ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) { displayLen = false; halfMsg = false; } else if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && - ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) + ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) { displayLen = false; halfMsg = true; @@ -87,12 +88,9 @@ namespace DiscImageChef.Devices } buffer[0] = (byte)((byte)mode << 5); - if(displayLen) - buffer[0] += 0x10; - if(flash) - buffer[0] += 0x08; - if(halfMsg) - buffer[0] += 0x04; + if(displayLen) buffer[0] += 0x10; + if(flash) buffer[0] += 0x08; + if(halfMsg) buffer[0] += 0x04; buffer[0] += 0x01; // Always ASCII Array.Copy(firstHalfBytes, 0, buffer, 1, 8); @@ -101,7 +99,8 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.Fujitsu_Display; cdb[6] = (byte)buffer.Length; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "FUJITSU DISPLAY took {0} ms.", duration); @@ -109,5 +108,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs b/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs index 8ed78461..3edd78af 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs @@ -46,7 +46,8 @@ namespace DiscImageChef.Devices /// Duration in milliseconds it took for the device to execute the command. /// Start block address. /// How many blocks to read. - public bool HlDtStReadRawDvd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, uint timeout, out double duration) + public bool HlDtStReadRawDvd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, + uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -65,7 +66,8 @@ namespace DiscImageChef.Devices cdb[10] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[11] = (byte)(buffer.Length & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "HL-DT-ST READ DVD (RAW) took {0} ms.", duration); @@ -73,5 +75,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/HP.cs b/DiscImageChef.Devices/Device/ScsiCommands/HP.cs index 06147122..f2512c32 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/HP.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/HP.cs @@ -48,9 +48,11 @@ namespace DiscImageChef.Devices /// If set to true address contain physical block address. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool HPReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort blockBytes, bool pba, uint timeout, out double duration) + public bool HPReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort blockBytes, + bool pba, uint timeout, out double duration) { - return HPReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout, out duration); + return HPReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout, + out duration); } /// @@ -67,32 +69,30 @@ namespace DiscImageChef.Devices /// If set to true is a count of secors to read. Otherwise it will be ignored /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool HPReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout, out double duration) + public bool HPReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, + ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout, + out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; bool sense; cdb[0] = (byte)ScsiCommands.ReadLong; - if(relAddr) - cdb[1] += 0x01; + if(relAddr) cdb[1] += 0x01; cdb[2] = (byte)((address & 0xFF000000) >> 24); cdb[3] = (byte)((address & 0xFF0000) >> 16); cdb[4] = (byte)((address & 0xFF00) >> 8); cdb[5] = (byte)(address & 0xFF); cdb[7] = (byte)((transferLen & 0xFF00) >> 8); cdb[8] = (byte)(transferLen & 0xFF); - if(pba) - cdb[9] += 0x80; - if(sectorCount) - cdb[9] += 0x40; + if(pba) cdb[9] += 0x80; + if(sectorCount) cdb[9] += 0x40; - if(sectorCount) - buffer = new byte[blockBytes * transferLen]; - else - buffer = new byte[transferLen]; + if(sectorCount) buffer = new byte[blockBytes * transferLen]; + else buffer = new byte[transferLen]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "HP READ LONG took {0} ms.", duration); @@ -100,5 +100,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs b/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs index 7d6afe72..bb02ae1c 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs @@ -56,7 +56,8 @@ namespace DiscImageChef.Devices cdb[2] = 0x01; cdb[3] = 0x01; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "KREON DEPRECATED UNLOCK took {0} ms.", duration); @@ -121,7 +122,8 @@ namespace DiscImageChef.Devices cdb[3] = 0x11; cdb[4] = (byte)state; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "KREON SET LOCK STATE took {0} ms.", duration); @@ -137,7 +139,8 @@ namespace DiscImageChef.Devices /// Timeout. /// Duration. /// Features supported by drive. - public bool KreonGetFeatureList(out byte[] senseBuffer, out KreonFeatures features, uint timeout, out double duration) + public bool KreonGetFeatureList(out byte[] senseBuffer, out KreonFeatures features, uint timeout, + out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[6]; @@ -150,23 +153,21 @@ namespace DiscImageChef.Devices cdb[2] = 0x01; cdb[3] = 0x10; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "KREON GET FEATURE LIST took {0} ms.", duration); - if(sense) - return sense; + if(sense) return sense; - if(buffer[0] != 0xA5 || buffer[1] != 0x5A || buffer[2] != 0x5A || buffer[3] != 0xA5) - return true; + if(buffer[0] != 0xA5 || buffer[1] != 0x5A || buffer[2] != 0x5A || buffer[3] != 0xA5) return true; for(int i = 4; i < 26; i += 2) { ushort feature = BitConverter.ToUInt16(buffer, i); - if(feature == 0x0000) - break; + if(feature == 0x0000) break; switch(feature) { @@ -214,7 +215,8 @@ namespace DiscImageChef.Devices /// Timeout. /// Duration. /// The SS sector. - public bool KreonExtractSS(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration, byte requestNumber = 0x00) + public bool KreonExtractSS(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration, + byte requestNumber = 0x00) { buffer = new byte[2048]; byte[] cdb = new byte[12]; @@ -234,7 +236,8 @@ namespace DiscImageChef.Devices cdb[10] = requestNumber; cdb[11] = 0xC0; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "KREON EXTRACT SS took {0} ms.", duration); @@ -242,5 +245,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs b/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs index 72422707..cd215112 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs @@ -47,7 +47,8 @@ namespace DiscImageChef.Devices /// Duration in milliseconds it took for the device to execute the command. public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - return GetConfiguration(out buffer, out senseBuffer, 0x0000, MmcGetConfigurationRt.All, timeout, out duration); + return GetConfiguration(out buffer, out senseBuffer, 0x0000, MmcGetConfigurationRt.All, timeout, + out duration); } /// @@ -59,9 +60,11 @@ namespace DiscImageChef.Devices /// Feature number where the feature list should start from /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, ushort startingFeatureNumber, uint timeout, out double duration) + public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, ushort startingFeatureNumber, + uint timeout, out double duration) { - return GetConfiguration(out buffer, out senseBuffer, startingFeatureNumber, MmcGetConfigurationRt.All, timeout, out duration); + return GetConfiguration(out buffer, out senseBuffer, startingFeatureNumber, MmcGetConfigurationRt.All, + timeout, out duration); } /// @@ -74,7 +77,8 @@ namespace DiscImageChef.Devices /// Duration in milliseconds it took for the device to execute the command. /// Starting Feature number. /// Return type, . - public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, ushort startingFeatureNumber, MmcGetConfigurationRt RT, uint timeout, out double duration) + public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, ushort startingFeatureNumber, + MmcGetConfigurationRt RT, uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; @@ -89,11 +93,11 @@ namespace DiscImageChef.Devices cdb[8] = (byte)(buffer.Length & 0xFF); cdb[9] = 0; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; - if(sense) - return true; + if(sense) return true; #pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens ushort confLength = (ushort)(((int)buffer[2] << 8) + buffer[3] + 4); @@ -103,7 +107,8 @@ namespace DiscImageChef.Devices cdb[8] = (byte)(buffer.Length & 0xFF); senseBuffer = new byte[32]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "GET CONFIGURATION took {0} ms.", duration); @@ -124,7 +129,9 @@ namespace DiscImageChef.Devices /// Which disc structure are we requesting /// AGID used in medium copy protection /// Duration in milliseconds it took for the device to execute the command. - public bool ReadDiscStructure(out byte[] buffer, out byte[] senseBuffer, MmcDiscStructureMediaType mediaType, uint address, byte layerNumber, MmcDiscStructureFormat format, byte AGID, uint timeout, out double duration) + public bool ReadDiscStructure(out byte[] buffer, out byte[] senseBuffer, MmcDiscStructureMediaType mediaType, + uint address, byte layerNumber, MmcDiscStructureFormat format, byte AGID, + uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -143,11 +150,11 @@ namespace DiscImageChef.Devices cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((AGID & 0x03) << 6); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; - if(sense) - return true; + if(sense) return true; #pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens ushort strctLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2); @@ -157,7 +164,8 @@ namespace DiscImageChef.Devices cdb[9] = (byte)(buffer.Length & 0xFF); senseBuffer = new byte[32]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ DISC STRUCTURE took {0} ms.", duration); @@ -189,7 +197,8 @@ namespace DiscImageChef.Devices /// Start TOC from this track /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool ReadToc(out byte[] buffer, out byte[] senseBuffer, bool MSF, byte track, uint timeout, out double duration) + public bool ReadToc(out byte[] buffer, out byte[] senseBuffer, bool MSF, byte track, uint timeout, + out double duration) { return ReadTocPmaAtip(out buffer, out senseBuffer, MSF, 0, track, timeout, out duration); } @@ -216,7 +225,8 @@ namespace DiscImageChef.Devices /// If true, request data in MM:SS:FF units, otherwise, in blocks /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool ReadSessionInfo(out byte[] buffer, out byte[] senseBuffer, bool MSF, uint timeout, out double duration) + public bool ReadSessionInfo(out byte[] buffer, out byte[] senseBuffer, bool MSF, uint timeout, + out double duration) { return ReadTocPmaAtip(out buffer, out senseBuffer, MSF, 1, 0, timeout, out duration); } @@ -230,7 +240,8 @@ namespace DiscImageChef.Devices /// Session which TOC to get /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool ReadRawToc(out byte[] buffer, out byte[] senseBuffer, byte sessionNumber, uint timeout, out double duration) + public bool ReadRawToc(out byte[] buffer, out byte[] senseBuffer, byte sessionNumber, uint timeout, + out double duration) { return ReadTocPmaAtip(out buffer, out senseBuffer, true, 2, sessionNumber, timeout, out duration); } @@ -285,27 +296,26 @@ namespace DiscImageChef.Devices /// Track/Session number /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool ReadTocPmaAtip(out byte[] buffer, out byte[] senseBuffer, bool MSF, byte format, byte trackSessionNumber, uint timeout, out double duration) + public bool ReadTocPmaAtip(out byte[] buffer, out byte[] senseBuffer, bool MSF, byte format, + byte trackSessionNumber, uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; byte[] tmpBuffer; bool sense; - if((format & 0x0F)== 5) - tmpBuffer = new byte[32768]; - else - tmpBuffer = new byte[1024]; + if((format & 0x0F) == 5) tmpBuffer = new byte[32768]; + else tmpBuffer = new byte[1024]; cdb[0] = (byte)ScsiCommands.ReadTocPmaAtip; - if(MSF) - cdb[1] = 0x02; + if(MSF) cdb[1] = 0x02; cdb[2] = (byte)(format & 0x0F); cdb[6] = trackSessionNumber; cdb[7] = (byte)((tmpBuffer.Length & 0xFF00) >> 8); cdb[8] = (byte)(tmpBuffer.Length & 0xFF); - lastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; #pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens @@ -322,7 +332,8 @@ namespace DiscImageChef.Devices double tmpDuration = duration; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; duration += tmpDuration; @@ -340,7 +351,8 @@ namespace DiscImageChef.Devices /// Duration in milliseconds it took for the device to execute the command. public bool ReadDiscInformation(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - return ReadDiscInformation(out buffer, out senseBuffer, MmcDiscInformationDataTypes.DiscInformation, timeout, out duration); + return ReadDiscInformation(out buffer, out senseBuffer, MmcDiscInformationDataTypes.DiscInformation, + timeout, out duration); } /// @@ -352,7 +364,8 @@ namespace DiscImageChef.Devices /// Which disc information to read /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool ReadDiscInformation(out byte[] buffer, out byte[] senseBuffer, MmcDiscInformationDataTypes dataType, uint timeout, out double duration) + public bool ReadDiscInformation(out byte[] buffer, out byte[] senseBuffer, MmcDiscInformationDataTypes dataType, + uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; @@ -364,7 +377,8 @@ namespace DiscImageChef.Devices cdb[7] = (byte)((tmpBuffer.Length & 0xFF00) >> 8); cdb[8] = (byte)(tmpBuffer.Length & 0xFF); - lastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; #pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens @@ -398,8 +412,10 @@ namespace DiscImageChef.Devices /// If set to true we request the EDC/ECC fields for data sectors. /// C2 error options. /// Subchannel selection. - public bool ReadCd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint transferLength, MmcSectorTypes expectedSectorType, - bool DAP, bool relAddr, bool sync, MmcHeaderCodes headerCodes, bool userData, bool edcEcc, MmcErrorField C2Error, MmcSubchannel subchannel, uint timeout, out double duration) + public bool ReadCd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint transferLength, + MmcSectorTypes expectedSectorType, bool DAP, bool relAddr, bool sync, + MmcHeaderCodes headerCodes, bool userData, bool edcEcc, MmcErrorField C2Error, + MmcSubchannel subchannel, uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -407,10 +423,8 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.ReadCd; cdb[1] = (byte)((byte)expectedSectorType << 2); - if(DAP) - cdb[1] += 0x02; - if(relAddr) - cdb[1] += 0x01; + if(DAP) cdb[1] += 0x02; + if(relAddr) cdb[1] += 0x01; cdb[2] = (byte)((lba & 0xFF000000) >> 24); cdb[3] = (byte)((lba & 0xFF0000) >> 16); cdb[4] = (byte)((lba & 0xFF00) >> 8); @@ -420,17 +434,15 @@ namespace DiscImageChef.Devices cdb[8] = (byte)(transferLength & 0xFF); cdb[9] = (byte)((byte)C2Error << 1); cdb[9] += (byte)((byte)headerCodes << 5); - if(sync) - cdb[9] += 0x80; - if(userData) - cdb[9] += 0x10; - if(edcEcc) - cdb[9] += 0x08; + if(sync) cdb[9] += 0x80; + if(userData) cdb[9] += 0x10; + if(edcEcc) cdb[9] += 0x08; cdb[10] = (byte)subchannel; buffer = new byte[blockSize * transferLength]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ CD took {0} ms.", duration); @@ -457,8 +469,10 @@ namespace DiscImageChef.Devices /// If set to true we request the EDC/ECC fields for data sectors. /// C2 error options. /// Subchannel selection. - public bool ReadCdMsf(out byte[] buffer, out byte[] senseBuffer, uint startMsf, uint endMsf, uint blockSize, MmcSectorTypes expectedSectorType, - bool DAP, bool sync, MmcHeaderCodes headerCodes, bool userData, bool edcEcc, MmcErrorField C2Error, MmcSubchannel subchannel, uint timeout, out double duration) + public bool ReadCdMsf(out byte[] buffer, out byte[] senseBuffer, uint startMsf, uint endMsf, uint blockSize, + MmcSectorTypes expectedSectorType, bool DAP, bool sync, MmcHeaderCodes headerCodes, + bool userData, bool edcEcc, MmcErrorField C2Error, MmcSubchannel subchannel, uint timeout, + out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -466,8 +480,7 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.ReadCdMsf; cdb[1] = (byte)((byte)expectedSectorType << 2); - if(DAP) - cdb[1] += 0x02; + if(DAP) cdb[1] += 0x02; cdb[3] = (byte)((startMsf & 0xFF0000) >> 16); cdb[4] = (byte)((startMsf & 0xFF00) >> 8); cdb[5] = (byte)(startMsf & 0xFF); @@ -476,19 +489,17 @@ namespace DiscImageChef.Devices cdb[8] = (byte)(endMsf & 0xFF); cdb[9] = (byte)((byte)C2Error << 1); cdb[9] += (byte)((byte)headerCodes << 5); - if(sync) - cdb[9] += 0x80; - if(userData) - cdb[9] += 0x10; - if(edcEcc) - cdb[9] += 0x08; + if(sync) cdb[9] += 0x80; + if(userData) cdb[9] += 0x10; + if(edcEcc) cdb[9] += 0x08; cdb[10] = (byte)subchannel; uint transferLength = (uint)((cdb[6] - cdb[3]) * 60 * 75 + (cdb[7] - cdb[4]) * 75 + (cdb[8] - cdb[5])); buffer = new byte[blockSize * transferLength]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ CD MSF took {0} ms.", duration); @@ -506,7 +517,8 @@ namespace DiscImageChef.Devices return PreventAllowMediumRemoval(out senseBuffer, false, false, timeout, out duration); } - public bool PreventAllowMediumRemoval(out byte[] senseBuffer, bool persistent, bool prevent, uint timeout, out double duration) + public bool PreventAllowMediumRemoval(out byte[] senseBuffer, bool persistent, bool prevent, uint timeout, + out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[6]; @@ -514,12 +526,11 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval; - if(prevent) - cdb[4] += 0x01; - if(persistent) - cdb[4] += 0x02; + if(prevent) cdb[4] += 0x01; + if(persistent) cdb[4] += 0x02; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PREVENT ALLOW MEDIUM REMOVAL took {0} ms.", duration); @@ -547,7 +558,8 @@ namespace DiscImageChef.Devices return StartStopUnit(out senseBuffer, false, 0, 0, false, false, false, timeout, out duration); } - public bool StartStopUnit(out byte[] senseBuffer, bool immediate, byte formatLayer, byte powerConditions, bool changeFormatLayer, bool loadEject, bool start, uint timeout, out double duration) + public bool StartStopUnit(out byte[] senseBuffer, bool immediate, byte formatLayer, byte powerConditions, + bool changeFormatLayer, bool loadEject, bool start, uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[6]; @@ -555,8 +567,7 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.StartStopUnit; - if(immediate) - cdb[1] += 0x01; + if(immediate) cdb[1] += 0x01; if(changeFormatLayer) { cdb[3] = (byte)(formatLayer & 0x03); @@ -564,21 +575,18 @@ namespace DiscImageChef.Devices } else { - if(loadEject) - cdb[4] += 0x02; - if(start) - cdb[4] += 0x01; + if(loadEject) cdb[4] += 0x02; + if(start) cdb[4] += 0x01; } cdb[4] += (byte)((powerConditions & 0x0F) << 4); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "START STOP UNIT took {0} ms.", duration); return sense; } - } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs b/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs index de787fa7..8bfe3913 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs @@ -46,7 +46,8 @@ namespace DiscImageChef.Devices /// Duration in milliseconds it took for the device to execute the command. /// Start block address. /// How many blocks to read. - public bool NecReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, uint timeout, out double duration) + public bool NecReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, uint timeout, + out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; @@ -62,7 +63,8 @@ namespace DiscImageChef.Devices buffer = new byte[2352 * transferLength]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ CD-DA took {0} ms.", duration); @@ -70,5 +72,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs b/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs index 5fa7fdee..45e9c433 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs @@ -48,7 +48,9 @@ namespace DiscImageChef.Devices /// How many blocks to read. /// Block size. /// Subchannel selection. - public bool PioneerReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint transferLength, PioneerSubchannel subchannel, uint timeout, out double duration) + public bool PioneerReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, + uint transferLength, PioneerSubchannel subchannel, uint timeout, + out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -66,7 +68,8 @@ namespace DiscImageChef.Devices buffer = new byte[blockSize * transferLength]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PIONEER READ CD-DA took {0} ms.", duration); @@ -86,7 +89,8 @@ namespace DiscImageChef.Devices /// End MM:SS:FF of read encoded as 0x00MMSSFF. /// Block size. /// Subchannel selection. - public bool PioneerReadCdDaMsf(out byte[] buffer, out byte[] senseBuffer, uint startMsf, uint endMsf, uint blockSize, PioneerSubchannel subchannel, uint timeout, out double duration) + public bool PioneerReadCdDaMsf(out byte[] buffer, out byte[] senseBuffer, uint startMsf, uint endMsf, + uint blockSize, PioneerSubchannel subchannel, uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -104,7 +108,8 @@ namespace DiscImageChef.Devices uint transferLength = (uint)((cdb[7] - cdb[3]) * 60 * 75 + (cdb[8] - cdb[4]) * 75 + (cdb[9] - cdb[5])); buffer = new byte[blockSize * transferLength]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PIONEER READ CD-DA MSF took {0} ms.", duration); @@ -124,7 +129,8 @@ namespace DiscImageChef.Devices /// If set to true, returns all 2352 bytes of sector data. /// Start block address. /// How many blocks to read. - public bool PioneerReadCdXa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, bool errorFlags, bool wholeSector, uint timeout, out double duration) + public bool PioneerReadCdXa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, + bool errorFlags, bool wholeSector, uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -155,7 +161,8 @@ namespace DiscImageChef.Devices cdb[6] = 0x00; } - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PIONEER READ CD-XA took {0} ms.", duration); @@ -163,5 +170,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs b/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs index 748bef86..753bf727 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs @@ -48,9 +48,11 @@ namespace DiscImageChef.Devices /// If set to true address contain physical block address. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort blockBytes, bool pba, uint timeout, out double duration) + public bool PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, + ushort blockBytes, bool pba, uint timeout, out double duration) { - return HPReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout, out duration); + return HPReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout, + out duration); } /// @@ -67,9 +69,12 @@ namespace DiscImageChef.Devices /// If set to true is a count of secors to read. Otherwise it will be ignored /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout, out double duration) + public bool PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, + ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout, + out double duration) { - return HPReadLong(out buffer, out senseBuffer, relAddr, address, transferLen, blockBytes, pba, sectorCount, timeout, out duration); + return HPReadLong(out buffer, out senseBuffer, relAddr, address, transferLen, blockBytes, pba, sectorCount, + timeout, out duration); } /// @@ -82,7 +87,8 @@ namespace DiscImageChef.Devices /// If set to true address contain a physical block address. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool PlasmonReadSectorLocation(out byte[] buffer, out byte[] senseBuffer, uint address, bool pba, uint timeout, out double duration) + public bool PlasmonReadSectorLocation(out byte[] buffer, out byte[] senseBuffer, uint address, bool pba, + uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; @@ -93,12 +99,12 @@ namespace DiscImageChef.Devices cdb[3] = (byte)((address & 0xFF0000) >> 16); cdb[4] = (byte)((address & 0xFF00) >> 8); cdb[5] = (byte)(address & 0xFF); - if(pba) - cdb[9] += 0x80; + if(pba) cdb[9] += 0x80; buffer = new byte[8]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLASMON READ SECTOR LOCATION took {0} ms.", duration); @@ -106,5 +112,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs b/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs index d073344e..fbd4a1e6 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs @@ -49,7 +49,9 @@ namespace DiscImageChef.Devices /// How many blocks to read. /// Block size. /// Subchannel selection. - public bool PlextorReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint transferLength, PlextorSubchannel subchannel, uint timeout, out double duration) + public bool PlextorReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, + uint transferLength, PlextorSubchannel subchannel, uint timeout, + out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -68,7 +70,8 @@ namespace DiscImageChef.Devices buffer = new byte[blockSize * transferLength]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ CD-DA took {0} ms.", duration); @@ -86,7 +89,8 @@ namespace DiscImageChef.Devices /// Duration in milliseconds it took for the device to execute the command. /// Start block address. /// How many blocks to read. - public bool PlextorReadRawDvd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, uint timeout, out double duration) + public bool PlextorReadRawDvd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, + uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; @@ -102,7 +106,8 @@ namespace DiscImageChef.Devices cdb[4] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[5] = (byte)(buffer.Length & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "Plextor READ DVD (RAW) took {0} ms.", duration); @@ -128,7 +133,8 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.Plextor_ReadEeprom; cdb[8] = 1; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration); @@ -154,7 +160,8 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.Plextor_ReadEeprom; cdb[8] = 2; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration); @@ -172,7 +179,8 @@ namespace DiscImageChef.Devices /// How many bytes are in the EEPROM block /// Timeout. /// Duration. - public bool PlextorReadEepromBlock(out byte[] buffer, out byte[] senseBuffer, byte block, ushort blockSize, uint timeout, out double duration) + public bool PlextorReadEepromBlock(out byte[] buffer, out byte[] senseBuffer, byte block, ushort blockSize, + uint timeout, out double duration) { buffer = new byte[blockSize]; senseBuffer = new byte[32]; @@ -185,7 +193,8 @@ namespace DiscImageChef.Devices cdb[8] = (byte)((blockSize & 0xFF00) >> 8); cdb[9] = (byte)(blockSize & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration); @@ -203,7 +212,8 @@ namespace DiscImageChef.Devices /// Last actual speed. /// Timeout. /// Duration. - public bool PlextorGetSpeeds(out byte[] senseBuffer, out ushort selected, out ushort max, out ushort last, uint timeout, out double duration) + public bool PlextorGetSpeeds(out byte[] senseBuffer, out ushort selected, out ushort max, out ushort last, + uint timeout, out double duration) { byte[] buf = new byte[10]; senseBuffer = new byte[32]; @@ -217,7 +227,8 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.Plextor_PoweRec; cdb[9] = (byte)buf.Length; - lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration); @@ -242,7 +253,8 @@ namespace DiscImageChef.Devices /// PoweRec recommended speed. /// Timeout. /// Duration. - public bool PlextorGetPoweRec(out byte[] senseBuffer, out bool enabled, out ushort speed, uint timeout, out double duration) + public bool PlextorGetPoweRec(out byte[] senseBuffer, out bool enabled, out ushort speed, uint timeout, + out double duration) { byte[] buf = new byte[8]; senseBuffer = new byte[32]; @@ -256,7 +268,8 @@ namespace DiscImageChef.Devices cdb[1] = (byte)PlextorSubCommands.GetMode; cdb[9] = (byte)buf.Length; - lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration); @@ -292,7 +305,8 @@ namespace DiscImageChef.Devices cdb[3] = 4; cdb[10] = (byte)buffer.Length; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SILENT MODE took {0} ms.", duration); @@ -320,7 +334,8 @@ namespace DiscImageChef.Devices cdb[2] = (byte)PlextorSubCommands.GigaRec; cdb[10] = (byte)buffer.Length; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET GIGAREC took {0} ms.", duration); @@ -336,7 +351,8 @@ namespace DiscImageChef.Devices /// Sense buffer. /// Timeout. /// Duration. - public bool PlextorGetVariRec(out byte[] buffer, out byte[] senseBuffer, bool dvd, uint timeout, out double duration) + public bool PlextorGetVariRec(out byte[] buffer, out byte[] senseBuffer, bool dvd, uint timeout, + out double duration) { buffer = new byte[8]; senseBuffer = new byte[32]; @@ -348,12 +364,11 @@ namespace DiscImageChef.Devices cdb[2] = (byte)PlextorSubCommands.VariRec; cdb[10] = (byte)buffer.Length; - if(dvd) - cdb[3] = 0x12; - else - cdb[3] = 0x02; + if(dvd) cdb[3] = 0x12; + else cdb[3] = 0x02; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET VARIREC took {0} ms.", duration); @@ -380,7 +395,8 @@ namespace DiscImageChef.Devices cdb[2] = (byte)PlextorSubCommands.SecuRec; cdb[10] = (byte)buffer.Length; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SECUREC took {0} ms.", duration); @@ -408,7 +424,8 @@ namespace DiscImageChef.Devices cdb[2] = (byte)PlextorSubCommands.SpeedRead; cdb[10] = (byte)buffer.Length; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SPEEDREAD took {0} ms.", duration); @@ -436,7 +453,8 @@ namespace DiscImageChef.Devices cdb[2] = (byte)PlextorSubCommands.SessionHide; cdb[9] = (byte)buffer.Length; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SINGLE-SESSION / HIDE CD-R took {0} ms.", duration); @@ -452,7 +470,8 @@ namespace DiscImageChef.Devices /// Sense buffer. /// Timeout. /// Duration. - public bool PlextorGetBitsetting(out byte[] buffer, out byte[] senseBuffer, bool dualLayer, uint timeout, out double duration) + public bool PlextorGetBitsetting(out byte[] buffer, out byte[] senseBuffer, bool dualLayer, uint timeout, + out double duration) { buffer = new byte[8]; senseBuffer = new byte[32]; @@ -464,12 +483,11 @@ namespace DiscImageChef.Devices cdb[2] = (byte)PlextorSubCommands.BitSet; cdb[9] = (byte)buffer.Length; - if(dualLayer) - cdb[3] = (byte)PlextorSubCommands.BitSetRDL; - else - cdb[3] = (byte)PlextorSubCommands.BitSetR; + if(dualLayer) cdb[3] = (byte)PlextorSubCommands.BitSetRDL; + else cdb[3] = (byte)PlextorSubCommands.BitSetR; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET BOOK BITSETTING took {0} ms.", duration); @@ -485,7 +503,8 @@ namespace DiscImageChef.Devices /// Sense buffer. /// Timeout. /// Duration. - public bool PlextorGetTestWriteDvdPlus(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) + public bool PlextorGetTestWriteDvdPlus(out byte[] buffer, out byte[] senseBuffer, uint timeout, + out double duration) { buffer = new byte[8]; senseBuffer = new byte[32]; @@ -497,7 +516,8 @@ namespace DiscImageChef.Devices cdb[2] = (byte)PlextorSubCommands.TestWriteDvdPlus; cdb[10] = (byte)buffer.Length; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET TEST WRITE DVD+ took {0} ms.", duration); @@ -505,5 +525,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SBC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SBC.cs index d7297b98..4aef6863 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SBC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SBC.cs @@ -47,7 +47,8 @@ namespace DiscImageChef.Devices /// Duration in milliseconds it took for the device to execute the command. /// Starting block. /// Block size in bytes. - public bool Read6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout, out double duration) + public bool Read6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout, + out double duration) { return Read6(out buffer, out senseBuffer, lba, blockSize, 1, timeout, out duration); } @@ -63,7 +64,8 @@ namespace DiscImageChef.Devices /// Starting block. /// Block size in bytes. /// How many blocks to read. - public bool Read6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, byte transferLength, uint timeout, out double duration) + public bool Read6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, byte transferLength, + uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[6]; @@ -75,12 +77,11 @@ namespace DiscImageChef.Devices cdb[3] = (byte)(lba & 0xFF); cdb[4] = transferLength; - if(transferLength == 0) - buffer = new byte[256 * blockSize]; - else - buffer = new byte[transferLength * blockSize]; + if(transferLength == 0) buffer = new byte[256 * blockSize]; + else buffer = new byte[transferLength * blockSize]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ (6) took {0} ms.", duration); @@ -105,7 +106,9 @@ namespace DiscImageChef.Devices /// Group number where attributes associated with this command should be collected. /// How many blocks to read. /// If set to true address is relative to current position. - public bool Read10(out byte[] buffer, out byte[] senseBuffer, byte rdprotect, bool dpo, bool fua, bool fuaNv, bool relAddr, uint lba, uint blockSize, byte groupNumber, ushort transferLength, uint timeout, out double duration) + public bool Read10(out byte[] buffer, out byte[] senseBuffer, byte rdprotect, bool dpo, bool fua, bool fuaNv, + bool relAddr, uint lba, uint blockSize, byte groupNumber, ushort transferLength, + uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; @@ -113,14 +116,10 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.Read10; cdb[1] = (byte)((rdprotect & 0x07) << 5); - if(dpo) - cdb[1] += 0x10; - if(fua) - cdb[1] += 0x08; - if(fuaNv) - cdb[1] += 0x02; - if(relAddr) - cdb[1] += 0x01; + if(dpo) cdb[1] += 0x10; + if(fua) cdb[1] += 0x08; + if(fuaNv) cdb[1] += 0x02; + if(relAddr) cdb[1] += 0x01; cdb[2] = (byte)((lba & 0xFF000000) >> 24); cdb[3] = (byte)((lba & 0xFF0000) >> 16); cdb[4] = (byte)((lba & 0xFF00) >> 8); @@ -131,7 +130,8 @@ namespace DiscImageChef.Devices buffer = new byte[transferLength * blockSize]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ (10) took {0} ms.", duration); @@ -157,7 +157,9 @@ namespace DiscImageChef.Devices /// How many blocks to read. /// If set to true the stream playback operation should be used (MMC only). /// If set to true address is relative to current position. - public bool Read12(out byte[] buffer, out byte[] senseBuffer, byte rdprotect, bool dpo, bool fua, bool fuaNv, bool relAddr, uint lba, uint blockSize, byte groupNumber, uint transferLength, bool streaming, uint timeout, out double duration) + public bool Read12(out byte[] buffer, out byte[] senseBuffer, byte rdprotect, bool dpo, bool fua, bool fuaNv, + bool relAddr, uint lba, uint blockSize, byte groupNumber, uint transferLength, + bool streaming, uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[12]; @@ -165,14 +167,10 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.Read12; cdb[1] = (byte)((rdprotect & 0x07) << 5); - if(dpo) - cdb[1] += 0x10; - if(fua) - cdb[1] += 0x08; - if(fuaNv) - cdb[1] += 0x02; - if(relAddr) - cdb[1] += 0x01; + if(dpo) cdb[1] += 0x10; + if(fua) cdb[1] += 0x08; + if(fuaNv) cdb[1] += 0x02; + if(relAddr) cdb[1] += 0x01; cdb[2] = (byte)((lba & 0xFF000000) >> 24); cdb[3] = (byte)((lba & 0xFF0000) >> 16); cdb[4] = (byte)((lba & 0xFF00) >> 8); @@ -182,12 +180,12 @@ namespace DiscImageChef.Devices cdb[8] = (byte)((transferLength & 0xFF00) >> 8); cdb[9] = (byte)(transferLength & 0xFF); cdb[10] = (byte)(groupNumber & 0x1F); - if(streaming) - cdb[10] += 0x80; + if(streaming) cdb[10] += 0x80; buffer = new byte[transferLength * blockSize]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ (12) took {0} ms.", duration); @@ -212,7 +210,9 @@ namespace DiscImageChef.Devices /// Group number where attributes associated with this command should be collected. /// How many blocks to read. /// If set to true the stream playback operation should be used (MMC only). - public bool Read16(out byte[] buffer, out byte[] senseBuffer, byte rdprotect, bool dpo, bool fua, bool fuaNv, ulong lba, uint blockSize, byte groupNumber, uint transferLength, bool streaming, uint timeout, out double duration) + public bool Read16(out byte[] buffer, out byte[] senseBuffer, byte rdprotect, bool dpo, bool fua, bool fuaNv, + ulong lba, uint blockSize, byte groupNumber, uint transferLength, bool streaming, + uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[16]; @@ -221,12 +221,9 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.Read16; cdb[1] = (byte)((rdprotect & 0x07) << 5); - if(dpo) - cdb[1] += 0x10; - if(fua) - cdb[1] += 0x08; - if(fuaNv) - cdb[1] += 0x02; + if(dpo) cdb[1] += 0x10; + if(fua) cdb[1] += 0x08; + if(fuaNv) cdb[1] += 0x02; cdb[2] = lbaBytes[7]; cdb[3] = lbaBytes[6]; cdb[4] = lbaBytes[5]; @@ -240,12 +237,12 @@ namespace DiscImageChef.Devices cdb[12] = (byte)((transferLength & 0xFF00) >> 8); cdb[13] = (byte)(transferLength & 0xFF); cdb[14] = (byte)(groupNumber & 0x1F); - if(streaming) - cdb[14] += 0x80; + if(streaming) cdb[14] += 0x80; buffer = new byte[transferLength * blockSize]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ (16) took {0} ms.", duration); @@ -265,17 +262,16 @@ namespace DiscImageChef.Devices /// If set to true ask the drive to try to correct errors in the sector. /// LBA to read. /// How many bytes to read. If the number is not exactly the drive's size, the command will fail and incidate a delta of the size in SENSE. - public bool ReadLong10(out byte[] buffer, out byte[] senseBuffer, bool correct, bool relAddr, uint lba, ushort transferBytes, uint timeout, out double duration) + public bool ReadLong10(out byte[] buffer, out byte[] senseBuffer, bool correct, bool relAddr, uint lba, + ushort transferBytes, uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; bool sense; cdb[0] = (byte)ScsiCommands.ReadLong; - if(correct) - cdb[1] += 0x02; - if(relAddr) - cdb[1] += 0x01; + if(correct) cdb[1] += 0x02; + if(relAddr) cdb[1] += 0x01; cdb[2] = (byte)((lba & 0xFF000000) >> 24); cdb[3] = (byte)((lba & 0xFF0000) >> 16); cdb[4] = (byte)((lba & 0xFF00) >> 8); @@ -285,7 +281,8 @@ namespace DiscImageChef.Devices buffer = new byte[transferBytes]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ LONG (10) took {0} ms.", duration); @@ -304,7 +301,8 @@ namespace DiscImageChef.Devices /// If set to true ask the drive to try to correct errors in the sector. /// LBA to read. /// How many bytes to read. If the number is not exactly the drive's size, the command will fail and incidate a delta of the size in SENSE. - public bool ReadLong16(out byte[] buffer, out byte[] senseBuffer, bool correct, ulong lba, uint transferBytes, uint timeout, out double duration) + public bool ReadLong16(out byte[] buffer, out byte[] senseBuffer, bool correct, ulong lba, uint transferBytes, + uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[16]; @@ -323,12 +321,12 @@ namespace DiscImageChef.Devices cdb[9] = lbaBytes[0]; cdb[12] = (byte)((transferBytes & 0xFF00) >> 8); cdb[13] = (byte)(transferBytes & 0xFF); - if(correct) - cdb[14] += 0x01; + if(correct) cdb[14] += 0x01; buffer = new byte[transferBytes]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ LONG (16) took {0} ms.", duration); @@ -355,7 +353,8 @@ namespace DiscImageChef.Devices cdb[2] = (byte)((lba & 0xFF00) >> 8); cdb[3] = (byte)(lba & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "SEEK (6) took {0} ms.", duration); @@ -383,7 +382,8 @@ namespace DiscImageChef.Devices cdb[4] = (byte)((lba & 0xFF00) >> 8); cdb[5] = (byte)(lba & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "SEEK (10) took {0} ms.", duration); @@ -391,5 +391,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs index f4c3309d..b0317095 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs @@ -50,7 +50,9 @@ namespace DiscImageChef.Devices /// If set to true device can return cached data. /// Timeout. /// Duration. - public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, ushort element, byte elementType, byte volume, byte partition, ushort firstAttribute, bool cache, uint timeout, out double duration) + public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, ushort element, + byte elementType, byte volume, byte partition, ushort firstAttribute, bool cache, + uint timeout, out double duration) { buffer = new byte[256]; byte[] cdb = new byte[16]; @@ -70,17 +72,17 @@ namespace DiscImageChef.Devices cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16); cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[13] = (byte)(buffer.Length & 0xFF); - if(cache) - cdb[14] += 0x01; + if(cache) cdb[14] += 0x01; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; - if(sense) - return true; + if(sense) return true; #pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens - uint attrLen = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) + buffer[3] + 4); + uint attrLen = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) + buffer[3] + + 4); #pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens buffer = new byte[attrLen]; cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24); @@ -89,7 +91,8 @@ namespace DiscImageChef.Devices cdb[13] = (byte)(buffer.Length & 0xFF); senseBuffer = new byte[32]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ ATTRIBUTE took {0} ms.", duration); @@ -97,5 +100,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs index c57aca03..8a581b8e 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs @@ -85,22 +85,23 @@ namespace DiscImageChef.Devices { buffer = new byte[36]; senseBuffer = new byte[32]; - byte[] cdb = { (byte)ScsiCommands.Inquiry, 0, 0, 0, 36, 0 }; + byte[] cdb = {(byte)ScsiCommands.Inquiry, 0, 0, 0, 36, 0}; bool sense; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; - if(sense) - return true; + if(sense) return true; byte pagesLength = (byte)(buffer[4] + 5); - cdb = new byte[] { (byte)ScsiCommands.Inquiry, 0, 0, 0, pagesLength, 0 }; + cdb = new byte[] {(byte)ScsiCommands.Inquiry, 0, 0, 0, pagesLength, 0}; buffer = new byte[pagesLength]; senseBuffer = new byte[32]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "INQUIRY took {0} ms.", duration); @@ -160,26 +161,26 @@ namespace DiscImageChef.Devices { buffer = new byte[36]; senseBuffer = new byte[32]; - byte[] cdb = { (byte)ScsiCommands.Inquiry, 1, page, 0, 36, 0 }; + byte[] cdb = {(byte)ScsiCommands.Inquiry, 1, page, 0, 36, 0}; bool sense; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; - if(sense) - return true; + if(sense) return true; // This is because INQ was returned instead of EVPD - if(buffer[1] != page) - return true; + if(buffer[1] != page) return true; byte pagesLength = (byte)(buffer[3] + 4); - cdb = new byte[] { (byte)ScsiCommands.Inquiry, 1, page, 0, pagesLength, 0 }; + cdb = new byte[] {(byte)ScsiCommands.Inquiry, 1, page, 0, pagesLength, 0}; buffer = new byte[pagesLength]; senseBuffer = new byte[32]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "INQUIRY took {0} ms.", duration); @@ -197,11 +198,12 @@ namespace DiscImageChef.Devices public bool ScsiTestUnitReady(out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[32]; - byte[] cdb = { (byte)ScsiCommands.TestUnitReady, 0, 0, 0, 0, 0 }; + byte[] cdb = {(byte)ScsiCommands.TestUnitReady, 0, 0, 0, 0, 0}; bool sense; byte[] buffer = new byte[0]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "TEST UNIT READY took {0} ms.", duration); @@ -219,7 +221,8 @@ namespace DiscImageChef.Devices /// Duration in milliseconds it took for the device to execute the command. public bool ModeSense(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - return ModeSense6(out buffer, out senseBuffer, false, ScsiModeSensePageControl.Current, 0, 0, timeout, out duration); + return ModeSense6(out buffer, out senseBuffer, false, ScsiModeSensePageControl.Current, 0, 0, timeout, + out duration); } /// @@ -233,7 +236,8 @@ namespace DiscImageChef.Devices /// If set to true device MUST not return any block descriptor. /// Page control. /// Page code. - public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool DBD, ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration) + public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool DBD, + ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration) { return ModeSense6(out buffer, out senseBuffer, DBD, pageControl, pageCode, 0, timeout, out duration); } @@ -250,7 +254,9 @@ namespace DiscImageChef.Devices /// Page control. /// Page code. /// Sub-page code. - public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool DBD, ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout, out double duration) + public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool DBD, + ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout, + out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[6]; @@ -258,26 +264,26 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.ModeSense; - if(DBD) - cdb[1] = 0x08; + if(DBD) cdb[1] = 0x08; cdb[2] |= (byte)pageControl; cdb[2] |= (byte)(pageCode & 0x3F); cdb[3] = subPageCode; cdb[4] = (byte)buffer.Length; cdb[5] = 0; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; - if(sense) - return true; + if(sense) return true; byte modeLength = (byte)(buffer[0] + 1); buffer = new byte[modeLength]; cdb[4] = (byte)buffer.Length; senseBuffer = new byte[32]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "MODE SENSE(6) took {0} ms.", duration); @@ -296,9 +302,11 @@ namespace DiscImageChef.Devices /// If set to true device MUST not return any block descriptor. /// Page control. /// Page code. - public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool DBD, ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration) + public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool DBD, + ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration) { - return ModeSense10(out buffer, out senseBuffer, false, DBD, pageControl, pageCode, 0, timeout, out duration); + return ModeSense10(out buffer, out senseBuffer, false, DBD, pageControl, pageCode, 0, timeout, + out duration); } /// @@ -313,9 +321,11 @@ namespace DiscImageChef.Devices /// Page control. /// Page code. /// If set means 64-bit LBAs are accepted by the caller. - public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool LLBAA, bool DBD, ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration) + public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool LLBAA, bool DBD, + ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration) { - return ModeSense10(out buffer, out senseBuffer, LLBAA, DBD, pageControl, pageCode, 0, timeout, out duration); + return ModeSense10(out buffer, out senseBuffer, LLBAA, DBD, pageControl, pageCode, 0, timeout, + out duration); } /// @@ -331,7 +341,9 @@ namespace DiscImageChef.Devices /// Page code. /// Sub-page code. /// If set means 64-bit LBAs are accepted by the caller. - public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool LLBAA, bool DBD, ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout, out double duration) + public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool LLBAA, bool DBD, + ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout, + out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; @@ -339,10 +351,8 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.ModeSense10; - if(LLBAA) - cdb[1] |= 0x10; - if(DBD) - cdb[1] |= 0x08; + if(LLBAA) cdb[1] |= 0x10; + if(DBD) cdb[1] |= 0x08; cdb[2] |= (byte)pageControl; cdb[2] |= (byte)(pageCode & 0x3F); cdb[3] = subPageCode; @@ -350,11 +360,11 @@ namespace DiscImageChef.Devices cdb[8] = (byte)(buffer.Length & 0xFF); cdb[9] = 0; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; - if(sense) - return true; + if(sense) return true; #pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens ushort modeLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2); @@ -364,7 +374,8 @@ namespace DiscImageChef.Devices cdb[8] = (byte)(buffer.Length & 0xFF); senseBuffer = new byte[32]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "MODE SENSE(10) took {0} ms.", duration); @@ -404,10 +415,12 @@ namespace DiscImageChef.Devices /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// true to prevent medium removal, false to allow it. - public bool SpcPreventAllowMediumRemoval(out byte[] senseBuffer, bool prevent, uint timeout, out double duration) + public bool SpcPreventAllowMediumRemoval(out byte[] senseBuffer, bool prevent, uint timeout, + out double duration) { if(prevent) - return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Prevent, timeout, out duration); + return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Prevent, timeout, + out duration); else return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Allow, timeout, out duration); } @@ -420,7 +433,8 @@ namespace DiscImageChef.Devices /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// Prevention mode. - public bool SpcPreventAllowMediumRemoval(out byte[] senseBuffer, ScsiPreventAllowMode preventMode, uint timeout, out double duration) + public bool SpcPreventAllowMediumRemoval(out byte[] senseBuffer, ScsiPreventAllowMode preventMode, uint timeout, + out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[6]; @@ -430,7 +444,8 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval; cdb[4] = (byte)((byte)preventMode & 0x03); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PREVENT ALLOW MEDIUM REMOVAL took {0} ms.", duration); @@ -462,7 +477,8 @@ namespace DiscImageChef.Devices /// If set, it is requesting partial media capacity /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool ReadCapacity(out byte[] buffer, out byte[] senseBuffer, bool RelAddr, uint address, bool PMI, uint timeout, out double duration) + public bool ReadCapacity(out byte[] buffer, out byte[] senseBuffer, bool RelAddr, uint address, bool PMI, + uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; @@ -474,8 +490,7 @@ namespace DiscImageChef.Devices if(PMI) { cdb[8] = 0x01; - if(RelAddr) - cdb[1] = 0x01; + if(RelAddr) cdb[1] = 0x01; cdb[2] = (byte)((address & 0xFF000000) >> 24); cdb[3] = (byte)((address & 0xFF0000) >> 16); @@ -483,7 +498,8 @@ namespace DiscImageChef.Devices cdb[5] = (byte)(address & 0xFF); } - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ CAPACITY took {0} ms.", duration); @@ -514,7 +530,8 @@ namespace DiscImageChef.Devices /// If set, it is requesting partial media capacity /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool ReadCapacity16(out byte[] buffer, out byte[] senseBuffer, ulong address, bool PMI, uint timeout, out double duration) + public bool ReadCapacity16(out byte[] buffer, out byte[] senseBuffer, ulong address, bool PMI, uint timeout, + out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[16]; @@ -543,7 +560,8 @@ namespace DiscImageChef.Devices cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[13] = (byte)(buffer.Length & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ CAPACITY(16) took {0} ms.", duration); @@ -573,14 +591,15 @@ namespace DiscImageChef.Devices cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[9] = (byte)(buffer.Length & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; - if(sense) - return true; + if(sense) return true; #pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens - uint strctLength = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) + buffer[3] + 4); + uint strctLength = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) + + buffer[3] + 4); #pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens buffer = new byte[strctLength]; cdb[6] = (byte)((buffer.Length & 0xFF000000) >> 24); @@ -589,7 +608,8 @@ namespace DiscImageChef.Devices cdb[9] = (byte)(buffer.Length & 0xFF); senseBuffer = new byte[32]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ MEDIA SERIAL NUMBER took {0} ms.", duration); @@ -608,9 +628,11 @@ namespace DiscImageChef.Devices /// If set to true device can return cached data. /// Timeout. /// Duration. - public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte partition, ushort firstAttribute, bool cache, uint timeout, out double duration) + public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte partition, + ushort firstAttribute, bool cache, uint timeout, out double duration) { - return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, partition, firstAttribute, cache, timeout, out duration); + return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, partition, firstAttribute, cache, + timeout, out duration); } /// @@ -623,9 +645,11 @@ namespace DiscImageChef.Devices /// If set to true device can return cached data. /// Timeout. /// Duration. - public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, ushort firstAttribute, bool cache, uint timeout, out double duration) + public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, + ushort firstAttribute, bool cache, uint timeout, out double duration) { - return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, 0, firstAttribute, cache, timeout, out duration); + return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, 0, firstAttribute, cache, timeout, + out duration); } /// @@ -638,9 +662,11 @@ namespace DiscImageChef.Devices /// First attribute identifier. /// Timeout. /// Duration. - public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte partition, ushort firstAttribute, uint timeout, out double duration) + public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte partition, + ushort firstAttribute, uint timeout, out double duration) { - return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, partition, firstAttribute, false, timeout, out duration); + return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, partition, firstAttribute, false, + timeout, out duration); } /// @@ -652,9 +678,11 @@ namespace DiscImageChef.Devices /// First attribute identifier. /// Timeout. /// Duration. - public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, ushort firstAttribute, uint timeout, out double duration) + public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, + ushort firstAttribute, uint timeout, out double duration) { - return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, 0, firstAttribute, false, timeout, out duration); + return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, 0, firstAttribute, false, timeout, + out duration); } /// @@ -668,9 +696,11 @@ namespace DiscImageChef.Devices /// First attribute identifier. /// Timeout. /// Duration. - public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte volume, byte partition, ushort firstAttribute, uint timeout, out double duration) + public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte volume, + byte partition, ushort firstAttribute, uint timeout, out double duration) { - return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, volume, partition, firstAttribute, false, timeout, out duration); + return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, volume, partition, firstAttribute, false, + timeout, out duration); } /// @@ -685,9 +715,11 @@ namespace DiscImageChef.Devices /// If set to true device can return cached data. /// Timeout. /// Duration. - public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte volume, byte partition, ushort firstAttribute, bool cache, uint timeout, out double duration) + public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte volume, + byte partition, ushort firstAttribute, bool cache, uint timeout, out double duration) { - return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, volume, partition, firstAttribute, cache, timeout, out duration); + return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, volume, partition, firstAttribute, cache, + timeout, out duration); } /// @@ -698,17 +730,19 @@ namespace DiscImageChef.Devices /// Sense buffer. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool ModeSelect(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout, out double duration) + public bool ModeSelect(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout, + out double duration) { senseBuffer = new byte[32]; // Prevent overflows if(buffer.Length > 255) { - if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && platformID != Interop.PlatformID.WindowsPhone && platformID != Interop.PlatformID.Xbox) - lastError = 75; - else - lastError = 111; + if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && + platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && + platformID != Interop.PlatformID.WindowsPhone && + platformID != Interop.PlatformID.Xbox) lastError = 75; + else lastError = 111; error = true; duration = 0; return true; @@ -718,13 +752,12 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.ModeSelect; - if(pageFormat) - cdb[1] += 0x10; - if(savePages) - cdb[1] += 0x01; + if(pageFormat) cdb[1] += 0x10; + if(savePages) cdb[1] += 0x01; cdb[4] = (byte)buffer.Length; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "MODE SELECT(6) took {0} ms.", duration); @@ -740,17 +773,19 @@ namespace DiscImageChef.Devices /// Sense buffer. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool ModeSelect10(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout, out double duration) + public bool ModeSelect10(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout, + out double duration) { senseBuffer = new byte[32]; // Prevent overflows if(buffer.Length > 65535) { - if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && platformID != Interop.PlatformID.WindowsPhone && platformID != Interop.PlatformID.Xbox) - lastError = 75; - else - lastError = 111; + if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && + platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && + platformID != Interop.PlatformID.WindowsPhone && + platformID != Interop.PlatformID.Xbox) lastError = 75; + else lastError = 111; error = true; duration = 0; return true; @@ -760,14 +795,13 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.ModeSelect10; - if(pageFormat) - cdb[1] += 0x10; - if(savePages) - cdb[1] += 0x01; + if(pageFormat) cdb[1] += 0x10; + if(savePages) cdb[1] += 0x01; cdb[7] = (byte)((buffer.Length & 0xFF00) << 8); cdb[8] = (byte)(buffer.Length & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "MODE SELECT(10) took {0} ms.", duration); @@ -788,14 +822,14 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.RequestSense; - if(descriptor) - cdb[1] = 0x01; + if(descriptor) cdb[1] = 0x01; cdb[2] = 0; cdb[3] = 0; cdb[4] = (byte)buffer.Length; cdb[5] = 0; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "REQUEST SENSE took {0} ms.", duration); @@ -803,5 +837,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs index 364bec5d..34b0f2d7 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs @@ -73,7 +73,8 @@ namespace DiscImageChef.Devices /// If set to true and is also set to true, moves the medium to the drive but does not prepare it for reading. /// Timeout. /// Duration. - public bool LoadUnload(out byte[] senseBuffer, bool immediate, bool load, bool retense, bool endOfTape, bool hold, uint timeout, out double duration) + public bool LoadUnload(out byte[] senseBuffer, bool immediate, bool load, bool retense, bool endOfTape, + bool hold, uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[6]; @@ -81,18 +82,14 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.LoadUnload; - if(immediate) - cdb[1] = 0x01; - if(load) - cdb[4] += 0x01; - if(retense) - cdb[4] += 0x02; - if(endOfTape) - cdb[4] += 0x04; - if(hold) - cdb[4] += 0x08; + if(immediate) cdb[1] = 0x01; + if(load) cdb[4] += 0x01; + if(retense) cdb[4] += 0x02; + if(endOfTape) cdb[4] += 0x04; + if(hold) cdb[4] += 0x08; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "LOAD UNLOAD (6) took {0} ms.", duration); @@ -147,7 +144,8 @@ namespace DiscImageChef.Devices /// Logical block address. /// Timeout. /// Duration. - public bool Locate(out byte[] senseBuffer, bool immediate, byte partition, uint lba, uint timeout, out double duration) + public bool Locate(out byte[] senseBuffer, bool immediate, byte partition, uint lba, uint timeout, + out double duration) { return Locate(out senseBuffer, immediate, false, true, partition, lba, timeout, out duration); } @@ -163,7 +161,8 @@ namespace DiscImageChef.Devices /// Object identifier. /// Timeout. /// Duration. - public bool Locate(out byte[] senseBuffer, bool immediate, bool blockType, bool changePartition, byte partition, uint objectId, uint timeout, out double duration) + public bool Locate(out byte[] senseBuffer, bool immediate, bool blockType, bool changePartition, byte partition, + uint objectId, uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; @@ -171,19 +170,17 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.Locate; - if(immediate) - cdb[1] += 0x01; - if(changePartition) - cdb[1] += 0x02; - if(blockType) - cdb[1] += 0x04; + if(immediate) cdb[1] += 0x01; + if(changePartition) cdb[1] += 0x02; + if(blockType) cdb[1] += 0x04; cdb[3] = (byte)((objectId & 0xFF000000) >> 24); cdb[4] = (byte)((objectId & 0xFF0000) >> 16); cdb[5] = (byte)((objectId & 0xFF00) >> 8); cdb[6] = (byte)(objectId & 0xFF); cdb[8] = partition; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "LOCATE (10) took {0} ms.", duration); @@ -200,7 +197,8 @@ namespace DiscImageChef.Devices /// Duration. public bool Locate16(out byte[] senseBuffer, ulong lba, uint timeout, out double duration) { - return Locate16(out senseBuffer, false, false, SscLogicalIdTypes.ObjectId, false, 0, lba, timeout, out duration); + return Locate16(out senseBuffer, false, false, SscLogicalIdTypes.ObjectId, false, 0, lba, timeout, + out duration); } /// @@ -213,7 +211,8 @@ namespace DiscImageChef.Devices /// Duration. public bool Locate16(out byte[] senseBuffer, byte partition, ulong lba, uint timeout, out double duration) { - return Locate16(out senseBuffer, false, true, SscLogicalIdTypes.ObjectId, false, partition, lba, timeout, out duration); + return Locate16(out senseBuffer, false, true, SscLogicalIdTypes.ObjectId, false, partition, lba, timeout, + out duration); } /// @@ -226,7 +225,8 @@ namespace DiscImageChef.Devices /// Duration. public bool Locate16(out byte[] senseBuffer, bool immediate, ulong lba, uint timeout, out double duration) { - return Locate16(out senseBuffer, immediate, false, SscLogicalIdTypes.ObjectId, false, 0, lba, timeout, out duration); + return Locate16(out senseBuffer, immediate, false, SscLogicalIdTypes.ObjectId, false, 0, lba, timeout, + out duration); } /// @@ -238,9 +238,11 @@ namespace DiscImageChef.Devices /// Logical block address. /// Timeout. /// Duration. - public bool Locate16(out byte[] senseBuffer, bool immediate, byte partition, ulong lba, uint timeout, out double duration) + public bool Locate16(out byte[] senseBuffer, bool immediate, byte partition, ulong lba, uint timeout, + out double duration) { - return Locate16(out senseBuffer, immediate, true, SscLogicalIdTypes.ObjectId, false, partition, lba, timeout, out duration); + return Locate16(out senseBuffer, immediate, true, SscLogicalIdTypes.ObjectId, false, partition, lba, + timeout, out duration); } /// @@ -255,7 +257,8 @@ namespace DiscImageChef.Devices /// Destination identifier. /// Timeout. /// Duration. - public bool Locate16(out byte[] senseBuffer, bool immediate, bool changePartition, SscLogicalIdTypes destType, bool bam, byte partition, ulong identifier, uint timeout, out double duration) + public bool Locate16(out byte[] senseBuffer, bool immediate, bool changePartition, SscLogicalIdTypes destType, + bool bam, byte partition, ulong identifier, uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[16]; @@ -265,12 +268,9 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.Locate16; cdb[1] = (byte)((byte)destType << 3); - if(immediate) - cdb[1] += 0x01; - if(changePartition) - cdb[1] += 0x02; - if(bam) - cdb[2] = 0x01; + if(immediate) cdb[1] += 0x01; + if(changePartition) cdb[1] += 0x02; + if(bam) cdb[2] = 0x01; cdb[3] = partition; cdb[4] = idBytes[7]; @@ -282,7 +282,8 @@ namespace DiscImageChef.Devices cdb[10] = idBytes[1]; cdb[11] = idBytes[0]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "LOCATE (16) took {0} ms.", duration); @@ -314,7 +315,8 @@ namespace DiscImageChef.Devices /// Block size in bytes. /// Timeout. /// Duration. - public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize, uint timeout, out double duration) + public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize, + uint timeout, out double duration) { return Read6(out buffer, out senseBuffer, sili, false, transferLen, blockSize, timeout, out duration); } @@ -330,26 +332,24 @@ namespace DiscImageChef.Devices /// Block size in bytes. /// Timeout. /// Duration. - public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, uint transferLen, uint blockSize, uint timeout, out double duration) + public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, uint transferLen, + uint blockSize, uint timeout, out double duration) { - if(fixedLen) - buffer = new byte[blockSize * transferLen]; - else - buffer = new byte[transferLen]; + if(fixedLen) buffer = new byte[blockSize * transferLen]; + else buffer = new byte[transferLen]; byte[] cdb = new byte[6]; senseBuffer = new byte[32]; bool sense; cdb[0] = (byte)ScsiCommands.Read6; - if(fixedLen) - cdb[1] += 0x01; - if(sili) - cdb[1] += 0x02; + if(fixedLen) cdb[1] += 0x01; + if(sili) cdb[1] += 0x02; cdb[2] = (byte)((transferLen & 0xFF0000) >> 16); cdb[3] = (byte)((transferLen & 0xFF00) >> 8); cdb[4] = (byte)(transferLen & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ (6) took {0} ms.", duration); @@ -368,9 +368,11 @@ namespace DiscImageChef.Devices /// Object size in bytes. /// Timeout. /// Duration. - public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration) + public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks, + uint blockSize, uint timeout, out double duration) { - return Read16(out buffer, out senseBuffer, sili, false, 0, objectId, blocks, blockSize, timeout, out duration); + return Read16(out buffer, out senseBuffer, sili, false, 0, objectId, blocks, blockSize, timeout, + out duration); } /// @@ -385,9 +387,11 @@ namespace DiscImageChef.Devices /// Object size in bytes. /// Timeout. /// Duration. - public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration) + public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId, + uint blocks, uint blockSize, uint timeout, out double duration) { - return Read16(out buffer, out senseBuffer, sili, false, partition, objectId, blocks, blockSize, timeout, out duration); + return Read16(out buffer, out senseBuffer, sili, false, partition, objectId, blocks, blockSize, timeout, + out duration); } /// @@ -400,9 +404,11 @@ namespace DiscImageChef.Devices /// Object size in bytes. /// Timeout. /// Duration. - public bool Read16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration) + public bool Read16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, uint blockSize, + uint timeout, out double duration) { - return Read16(out buffer, out senseBuffer, false, true, 0, objectId, blocks, blockSize, timeout, out duration); + return Read16(out buffer, out senseBuffer, false, true, 0, objectId, blocks, blockSize, timeout, + out duration); } /// @@ -416,9 +422,11 @@ namespace DiscImageChef.Devices /// Object size in bytes. /// Timeout. /// Duration. - public bool Read16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration) + public bool Read16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId, uint blocks, + uint blockSize, uint timeout, out double duration) { - return Read16(out buffer, out senseBuffer, false, true, partition, objectId, blocks, blockSize, timeout, out duration); + return Read16(out buffer, out senseBuffer, false, true, partition, objectId, blocks, blockSize, timeout, + out duration); } /// @@ -434,22 +442,19 @@ namespace DiscImageChef.Devices /// Object size in bytes. /// Timeout. /// Duration. - public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, byte partition, ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration) + public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, byte partition, + ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration) { - if(fixedLen) - buffer = new byte[objectSize * transferLen]; - else - buffer = new byte[transferLen]; + if(fixedLen) buffer = new byte[objectSize * transferLen]; + else buffer = new byte[transferLen]; byte[] cdb = new byte[6]; senseBuffer = new byte[32]; bool sense; byte[] idBytes = BitConverter.GetBytes(objectId); cdb[0] = (byte)ScsiCommands.Read16; - if(fixedLen) - cdb[1] += 0x01; - if(sili) - cdb[1] += 0x02; + if(fixedLen) cdb[1] += 0x01; + if(sili) cdb[1] += 0x02; cdb[3] = partition; cdb[4] = idBytes[7]; cdb[5] = idBytes[6]; @@ -463,7 +468,8 @@ namespace DiscImageChef.Devices cdb[13] = (byte)((transferLen & 0xFF00) >> 8); cdb[14] = (byte)(transferLen & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ (16) took {0} ms.", duration); @@ -487,7 +493,8 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.ReadBlockLimits; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ BLOCK LIMITS took {0} ms.", duration); @@ -529,15 +536,13 @@ namespace DiscImageChef.Devices /// Requests current logical position. /// Timeout. /// Duration. - public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, bool vendorType, bool longForm, bool totalPosition, uint timeout, out double duration) + public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, bool vendorType, bool longForm, + bool totalPosition, uint timeout, out double duration) { byte responseForm = 0; - if(vendorType) - responseForm += 0x01; - if(longForm) - responseForm += 0x02; - if(totalPosition) - responseForm += 0x04; + if(vendorType) responseForm += 0x01; + if(longForm) responseForm += 0x02; + if(totalPosition) responseForm += 0x04; return ReadPosition(out buffer, out senseBuffer, (SscPositionForms)responseForm, timeout, out duration); } @@ -550,7 +555,8 @@ namespace DiscImageChef.Devices /// Response form. /// Timeout. /// Duration. - public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, SscPositionForms responseForm, uint timeout, out double duration) + public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, SscPositionForms responseForm, uint timeout, + out double duration) { switch(responseForm) { @@ -571,6 +577,7 @@ namespace DiscImageChef.Devices buffer = new byte[32]; // Invalid break; } + byte[] cdb = new byte[10]; senseBuffer = new byte[32]; bool sense; @@ -583,7 +590,8 @@ namespace DiscImageChef.Devices cdb[8] = (byte)(buffer.Length & 0xFF); } - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ POSITION took {0} ms.", duration); @@ -600,9 +608,11 @@ namespace DiscImageChef.Devices /// Block size in bytes. /// Timeout. /// Duration. - public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, uint blocks, uint blockSize, uint timeout, out double duration) + public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, uint blocks, uint blockSize, uint timeout, + out double duration) { - return ReadReverse6(out buffer, out senseBuffer, false, false, true, blocks, blockSize, timeout, out duration); + return ReadReverse6(out buffer, out senseBuffer, false, false, true, blocks, blockSize, timeout, + out duration); } /// @@ -615,9 +625,11 @@ namespace DiscImageChef.Devices /// Block size in bytes. /// Timeout. /// Duration. - public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize, uint timeout, out double duration) + public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize, + uint timeout, out double duration) { - return ReadReverse6(out buffer, out senseBuffer, false, sili, false, transferLen, blockSize, timeout, out duration); + return ReadReverse6(out buffer, out senseBuffer, false, sili, false, transferLen, blockSize, timeout, + out duration); } /// @@ -632,28 +644,25 @@ namespace DiscImageChef.Devices /// Block size in bytes. /// Timeout. /// Duration. - public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, uint transferLen, uint blockSize, uint timeout, out double duration) + public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, + uint transferLen, uint blockSize, uint timeout, out double duration) { - if(fixedLen) - buffer = new byte[blockSize * transferLen]; - else - buffer = new byte[transferLen]; + if(fixedLen) buffer = new byte[blockSize * transferLen]; + else buffer = new byte[transferLen]; byte[] cdb = new byte[6]; senseBuffer = new byte[32]; bool sense; cdb[0] = (byte)ScsiCommands.ReadReverse; - if(fixedLen) - cdb[1] += 0x01; - if(sili) - cdb[1] += 0x02; - if(byteOrder) - cdb[1] += 0x04; + if(fixedLen) cdb[1] += 0x01; + if(sili) cdb[1] += 0x02; + if(byteOrder) cdb[1] += 0x04; cdb[2] = (byte)((transferLen & 0xFF0000) >> 16); cdb[3] = (byte)((transferLen & 0xFF00) >> 8); cdb[4] = (byte)(transferLen & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ REVERSE (6) took {0} ms.", duration); @@ -672,9 +681,11 @@ namespace DiscImageChef.Devices /// Object size in bytes. /// Timeout. /// Duration. - public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration) + public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks, + uint blockSize, uint timeout, out double duration) { - return ReadReverse16(out buffer, out senseBuffer, false, sili, false, 0, objectId, blocks, blockSize, timeout, out duration); + return ReadReverse16(out buffer, out senseBuffer, false, sili, false, 0, objectId, blocks, blockSize, + timeout, out duration); } /// @@ -689,9 +700,11 @@ namespace DiscImageChef.Devices /// Object size in bytes. /// Timeout. /// Duration. - public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration) + public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId, + uint blocks, uint blockSize, uint timeout, out double duration) { - return ReadReverse16(out buffer, out senseBuffer, false, sili, false, partition, objectId, blocks, blockSize, timeout, out duration); + return ReadReverse16(out buffer, out senseBuffer, false, sili, false, partition, objectId, blocks, + blockSize, timeout, out duration); } /// @@ -704,9 +717,11 @@ namespace DiscImageChef.Devices /// Object size in bytes. /// Timeout. /// Duration. - public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration) + public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, + uint blockSize, uint timeout, out double duration) { - return ReadReverse16(out buffer, out senseBuffer, false, false, true, 0, objectId, blocks, blockSize, timeout, out duration); + return ReadReverse16(out buffer, out senseBuffer, false, false, true, 0, objectId, blocks, blockSize, + timeout, out duration); } /// @@ -720,9 +735,11 @@ namespace DiscImageChef.Devices /// Object size in bytes. /// Timeout. /// Duration. - public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration) + public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId, + uint blocks, uint blockSize, uint timeout, out double duration) { - return ReadReverse16(out buffer, out senseBuffer, false, false, true, partition, objectId, blocks, blockSize, timeout, out duration); + return ReadReverse16(out buffer, out senseBuffer, false, false, true, partition, objectId, blocks, + blockSize, timeout, out duration); } /// @@ -739,24 +756,21 @@ namespace DiscImageChef.Devices /// Object size in bytes. /// Timeout. /// Duration. - public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, byte partition, ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration) + public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, + byte partition, ulong objectId, uint transferLen, uint objectSize, uint timeout, + out double duration) { - if(fixedLen) - buffer = new byte[objectSize * transferLen]; - else - buffer = new byte[transferLen]; + if(fixedLen) buffer = new byte[objectSize * transferLen]; + else buffer = new byte[transferLen]; byte[] cdb = new byte[6]; senseBuffer = new byte[32]; bool sense; byte[] idBytes = BitConverter.GetBytes(objectId); cdb[0] = (byte)ScsiCommands.Read16; - if(fixedLen) - cdb[1] += 0x01; - if(sili) - cdb[1] += 0x02; - if(byteOrder) - cdb[1] += 0x04; + if(fixedLen) cdb[1] += 0x01; + if(sili) cdb[1] += 0x02; + if(byteOrder) cdb[1] += 0x04; cdb[3] = partition; cdb[4] = idBytes[7]; cdb[5] = idBytes[6]; @@ -770,7 +784,8 @@ namespace DiscImageChef.Devices cdb[13] = (byte)((transferLen & 0xFF00) >> 8); cdb[14] = (byte)(transferLen & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "READ REVERSE (16) took {0} ms.", duration); @@ -787,9 +802,11 @@ namespace DiscImageChef.Devices /// Block size in bytes. /// Timeout. /// Duration. - public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, uint blocks, uint blockSize, uint timeout, out double duration) + public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, uint blocks, uint blockSize, + uint timeout, out double duration) { - return RecoverBufferedData(out buffer, out senseBuffer, false, true, blocks, blockSize, timeout, out duration); + return RecoverBufferedData(out buffer, out senseBuffer, false, true, blocks, blockSize, timeout, + out duration); } /// @@ -802,9 +819,11 @@ namespace DiscImageChef.Devices /// Block size in bytes. /// Timeout. /// Duration. - public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize, uint timeout, out double duration) + public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, + uint blockSize, uint timeout, out double duration) { - return RecoverBufferedData(out buffer, out senseBuffer, sili, false, transferLen, blockSize, timeout, out duration); + return RecoverBufferedData(out buffer, out senseBuffer, sili, false, transferLen, blockSize, timeout, + out duration); } /// @@ -818,26 +837,24 @@ namespace DiscImageChef.Devices /// Block size in bytes. /// Timeout. /// Duration. - public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, uint transferLen, uint blockSize, uint timeout, out double duration) + public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, + uint transferLen, uint blockSize, uint timeout, out double duration) { - if(fixedLen) - buffer = new byte[blockSize * transferLen]; - else - buffer = new byte[transferLen]; + if(fixedLen) buffer = new byte[blockSize * transferLen]; + else buffer = new byte[transferLen]; byte[] cdb = new byte[6]; senseBuffer = new byte[32]; bool sense; cdb[0] = (byte)ScsiCommands.RecoverBufferedData; - if(fixedLen) - cdb[1] += 0x01; - if(sili) - cdb[1] += 0x02; + if(fixedLen) cdb[1] += 0x01; + if(sili) cdb[1] += 0x02; cdb[2] = (byte)((transferLen & 0xFF0000) >> 16); cdb[3] = (byte)((transferLen & 0xFF00) >> 8); cdb[4] = (byte)(transferLen & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "RECOVER BUFFERED DATA took {0} ms.", duration); @@ -865,7 +882,8 @@ namespace DiscImageChef.Devices /// If set to true descriptors should apply to currently inserted media. /// Timeout. /// Duration. - public bool ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, bool currentMedia, uint timeout, out double duration) + public bool ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, bool currentMedia, uint timeout, + out double duration) { return ReportDensitySupport(out buffer, out senseBuffer, false, currentMedia, timeout, out duration); } @@ -879,7 +897,8 @@ namespace DiscImageChef.Devices /// If set to true descriptors should apply to currently inserted media. /// Timeout. /// Duration. - public bool ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, bool mediumType, bool currentMedia, uint timeout, out double duration) + public bool ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, bool mediumType, bool currentMedia, + uint timeout, out double duration) { buffer = new byte[256]; byte[] cdb = new byte[10]; @@ -887,18 +906,16 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.ReportDensitySupport; - if(currentMedia) - cdb[1] += 0x01; - if(mediumType) - cdb[1] += 0x02; + if(currentMedia) cdb[1] += 0x01; + if(mediumType) cdb[1] += 0x02; cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[8] = (byte)(buffer.Length & 0xFF); - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; - if(sense) - return true; + if(sense) return true; #pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens ushort availableLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2); @@ -908,7 +925,8 @@ namespace DiscImageChef.Devices cdb[8] = (byte)(buffer.Length & 0xFF); senseBuffer = new byte[32]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "REPORT DENSITY SUPPORT took {0} ms.", duration); @@ -942,10 +960,10 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.Rewind; - if(immediate) - cdb[1] += 0x01; + if(immediate) cdb[1] += 0x01; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "REWIND took {0} ms.", duration); @@ -971,7 +989,8 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.TrackSelect; cdb[5] = track; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "TRACK SELECT took {0} ms.", duration); @@ -993,7 +1012,8 @@ namespace DiscImageChef.Devices cdb[3] = count_b[1]; cdb[4] = count_b[0]; - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "SPACE took {0} ms.", duration); @@ -1001,5 +1021,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs b/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs index 1cdc84e1..8d100d9e 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs @@ -46,7 +46,8 @@ namespace DiscImageChef.Devices /// Duration in milliseconds it took for the device to execute the command. /// Starting block. /// Block size in bytes. - public bool SyQuestRead6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout, out double duration) + public bool SyQuestRead6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout, + out double duration) { return SyQuestRead6(out buffer, out senseBuffer, lba, blockSize, 1, false, false, timeout, out duration); } @@ -61,7 +62,8 @@ namespace DiscImageChef.Devices /// Duration in milliseconds it took for the device to execute the command. /// Starting block. /// Block size in bytes. - public bool SyQuestReadLong6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout, out double duration) + public bool SyQuestReadLong6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout, + out double duration) { return SyQuestRead6(out buffer, out senseBuffer, lba, blockSize, 1, false, true, timeout, out duration); } @@ -79,7 +81,8 @@ namespace DiscImageChef.Devices /// If set to true drive will return ECC bytes and disable error detection. /// Block size in bytes. /// How many blocks to read. - public bool SyQuestRead6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, byte transferLength, bool inhibitDma, bool readLong, uint timeout, out double duration) + public bool SyQuestRead6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, + byte transferLength, bool inhibitDma, bool readLong, uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[6]; @@ -90,30 +93,27 @@ namespace DiscImageChef.Devices cdb[2] = (byte)((lba & 0xFF00) >> 8); cdb[3] = (byte)(lba & 0xFF); cdb[4] = transferLength; - if(inhibitDma) - cdb[5] += 0x80; - if(readLong) - cdb[5] += 0x40; + if(inhibitDma) cdb[5] += 0x80; + if(readLong) cdb[5] += 0x40; if(!inhibitDma && !readLong) { - if(transferLength == 0) - buffer = new byte[256 * blockSize]; - else - buffer = new byte[transferLength * blockSize]; + if(transferLength == 0) buffer = new byte[256 * blockSize]; + else buffer = new byte[transferLength * blockSize]; } else if(readLong) { buffer = new byte[blockSize]; cdb[4] = 1; } - else - buffer = new byte[0]; + else buffer = new byte[0]; if(!inhibitDma) - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); else - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; @@ -129,7 +129,8 @@ namespace DiscImageChef.Devices /// Sense buffer. /// Timeout. /// Duration. - public bool SyQuestReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) + public bool SyQuestReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, uint timeout, + out double duration) { return AdaptecReadUsageCounter(out buffer, out senseBuffer, false, timeout, out duration); } @@ -144,7 +145,8 @@ namespace DiscImageChef.Devices /// Duration in milliseconds it took for the device to execute the command. /// Starting block. /// Block size in bytes. - public bool SyQuestReadLong10(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout, out double duration) + public bool SyQuestReadLong10(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout, + out double duration) { return SyQuestRead10(out buffer, out senseBuffer, lba, blockSize, 1, false, true, timeout, out duration); } @@ -162,7 +164,9 @@ namespace DiscImageChef.Devices /// If set to true drive will return ECC bytes and disable error detection. /// Block size in bytes. /// How many blocks to read. - public bool SyQuestRead10(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, ushort transferLength, bool inhibitDma, bool readLong, uint timeout, out double duration) + public bool SyQuestRead10(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, + ushort transferLength, bool inhibitDma, bool readLong, uint timeout, + out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; @@ -175,27 +179,23 @@ namespace DiscImageChef.Devices cdb[5] = (byte)(lba & 0xFF); cdb[7] = (byte)((transferLength & 0xFF00) >> 8); cdb[8] = (byte)(transferLength & 0xFF); - if(inhibitDma) - cdb[9] += 0x80; - if(readLong) - cdb[9] += 0x40; + if(inhibitDma) cdb[9] += 0x80; + if(readLong) cdb[9] += 0x40; - if(!inhibitDma && !readLong) - { - buffer = new byte[transferLength * blockSize]; - } + if(!inhibitDma && !readLong) { buffer = new byte[transferLength * blockSize]; } else if(readLong) { buffer = new byte[blockSize]; cdb[4] = 1; } - else - buffer = new byte[0]; + else buffer = new byte[0]; if(!inhibitDma) - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out sense); else - lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, + out sense); error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "SYQUEST READ (10) took {0} ms.", duration); @@ -203,5 +203,4 @@ namespace DiscImageChef.Devices return sense; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Device/Variables.cs b/DiscImageChef.Devices/Device/Variables.cs index 62dfd74f..9a01bc21 100644 --- a/DiscImageChef.Devices/Device/Variables.cs +++ b/DiscImageChef.Devices/Device/Variables.cs @@ -75,10 +75,7 @@ namespace DiscImageChef.Devices /// The Platform ID public Interop.PlatformID PlatformID { - get - { - return platformID; - } + get { return platformID; } } /// @@ -87,21 +84,14 @@ namespace DiscImageChef.Devices /// The file handle public object FileHandle { - get - { - return fd; - } + get { return fd; } } /// /// Gets or sets the standard timeout for commands sent to this device /// /// The timeout in seconds - public uint Timeout - { - get; - set; - } + public uint Timeout { get; set; } /// /// Gets a value indicating whether this is in error. @@ -109,10 +99,7 @@ namespace DiscImageChef.Devices /// true if error; otherwise, false. public bool Error { - get - { - return error; - } + get { return error; } } /// @@ -121,10 +108,7 @@ namespace DiscImageChef.Devices /// The last error. public int LastError { - get - { - return lastError; - } + get { return lastError; } } /// @@ -133,10 +117,7 @@ namespace DiscImageChef.Devices /// The device type. public DeviceType Type { - get - { - return type; - } + get { return type; } } /// @@ -145,10 +126,7 @@ namespace DiscImageChef.Devices /// The manufacturer. public string Manufacturer { - get - { - return manufacturer; - } + get { return manufacturer; } } /// @@ -157,10 +135,7 @@ namespace DiscImageChef.Devices /// The model. public string Model { - get - { - return model; - } + get { return model; } } /// @@ -169,10 +144,7 @@ namespace DiscImageChef.Devices /// The revision. public string Revision { - get - { - return revision; - } + get { return revision; } } /// @@ -181,10 +153,7 @@ namespace DiscImageChef.Devices /// The serial number. public string Serial { - get - { - return serial; - } + get { return serial; } } /// @@ -193,10 +162,7 @@ namespace DiscImageChef.Devices /// The SCSI peripheral device type. public Decoders.SCSI.PeripheralDeviceTypes SCSIType { - get - { - return scsiType; - } + get { return scsiType; } } /// @@ -205,10 +171,7 @@ namespace DiscImageChef.Devices /// true if this device's media is removable; otherwise, false. public bool IsRemovable { - get - { - return removable; - } + get { return removable; } } /// @@ -217,10 +180,7 @@ namespace DiscImageChef.Devices /// true if this device is attached via USB; otherwise, false. public bool IsUSB { - get - { - return usb; - } + get { return usb; } } /// @@ -229,10 +189,7 @@ namespace DiscImageChef.Devices /// The USB vendor ID. public ushort USBVendorID { - get - { - return usbVendor; - } + get { return usbVendor; } } /// @@ -241,10 +198,7 @@ namespace DiscImageChef.Devices /// The USB product ID. public ushort USBProductID { - get - { - return usbProduct; - } + get { return usbProduct; } } /// @@ -253,10 +207,7 @@ namespace DiscImageChef.Devices /// The USB descriptors. public byte[] USBDescriptors { - get - { - return usbDescriptors; - } + get { return usbDescriptors; } } /// @@ -265,10 +216,7 @@ namespace DiscImageChef.Devices /// The USB manufacturer string. public string USBManufacturerString { - get - { - return usbManufacturerString; - } + get { return usbManufacturerString; } } /// @@ -277,10 +225,7 @@ namespace DiscImageChef.Devices /// The USB product string. public string USBProductString { - get - { - return usbProductString; - } + get { return usbProductString; } } /// @@ -289,47 +234,62 @@ namespace DiscImageChef.Devices /// The USB serial string. public string USBSerialString { - get - { - return usbSerialString; - } + get { return usbSerialString; } } /// /// Gets a value indicating whether this device is attached via FireWire. /// /// true if this device is attached via FireWire; otherwise, false. - public bool IsFireWire { get { return firewire; } } + public bool IsFireWire + { + get { return firewire; } + } /// /// Gets the FireWire GUID /// /// The FireWire GUID. - public ulong FireWireGUID { get { return firewireGuid; } } + public ulong FireWireGUID + { + get { return firewireGuid; } + } /// /// Gets the FireWire model number /// /// The FireWire model. - public uint FireWireModel { get { return firewireModel; } } + public uint FireWireModel + { + get { return firewireModel; } + } /// /// Gets the FireWire model name. /// /// The FireWire model name. - public string FireWireModelName { get { return firewireModelName; } } + public string FireWireModelName + { + get { return firewireModelName; } + } /// /// Gets the FireWire vendor number. /// /// The FireWire vendor number. - public uint FireWireVendor { get { return firewireVendor; } } + public uint FireWireVendor + { + get { return firewireVendor; } + } /// /// Gets the FireWire vendor name. /// /// The FireWire vendor name. - public string FireWireVendorName { get { return firewireVendorName; } } + public string FireWireVendorName + { + get { return firewireVendorName; } + } /// /// Gets a value indicating whether this device is a CompactFlash device. @@ -337,10 +297,7 @@ namespace DiscImageChef.Devices /// true if this device is a CompactFlash device; otherwise, false. public bool IsCompactFlash { - get - { - return compactFlash; - } + get { return compactFlash; } } /// @@ -349,10 +306,7 @@ namespace DiscImageChef.Devices /// true if this device is a PCMCIA device; otherwise, false. public bool IsPCMCIA { - get - { - return pcmcia; - } + get { return pcmcia; } } /// @@ -360,11 +314,7 @@ namespace DiscImageChef.Devices /// public byte[] CIS { - get - { - return cis; - } + get { return cis; } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Enums.cs b/DiscImageChef.Devices/Enums.cs index ebc48656..7b267cbf 100644 --- a/DiscImageChef.Devices/Enums.cs +++ b/DiscImageChef.Devices/Enums.cs @@ -52,7 +52,6 @@ namespace DiscImageChef.Devices public enum AtaCommands : byte { #region Commands defined on Western Digital WD1000 Winchester Disk Controller - /// /// Formats a track /// @@ -81,7 +80,6 @@ namespace DiscImageChef.Devices #endregion Commands defined on Western Digital WD1000 Winchester Disk Controller #region Commands defined on ATA rev. 4c - /// /// Acknowledges media change /// @@ -349,7 +347,6 @@ namespace DiscImageChef.Devices #endregion Commands defined on ATA rev. 4c #region Commands defined on ATA-2 rev. 4c - /// /// Alters the device microcode /// @@ -361,7 +358,6 @@ namespace DiscImageChef.Devices #endregion Commands defined on ATA-2 rev. 4c #region Commands defined on ATA-3 rev. 7b - /// /// Gets a sector containing drive identification and capabilities /// @@ -397,7 +393,6 @@ namespace DiscImageChef.Devices #endregion Commands defined on ATA-3 rev. 7b #region Commands defined on CompactFlash Specification - /// /// Pre-erases and conditions data sectors /// @@ -426,7 +421,6 @@ namespace DiscImageChef.Devices #endregion Commands defined on CompactFlash Specification #region Commands defined on ATA/ATAPI-4 rev. 18 - /// /// Resets a device /// @@ -482,7 +476,6 @@ namespace DiscImageChef.Devices #endregion Commands defined on ATA/ATAPI-4 rev. 18 #region Commands defined on ATA/ATAPI-6 rev. 3b - /// /// Determines if the device supports the Media Card Pass Through Command feature set /// @@ -554,7 +547,6 @@ namespace DiscImageChef.Devices #endregion Commands defined on ATA/ATAPI-6 rev. 3b #region Commands defined on ATA/ATAPI-7 rev. 4b - /// /// Configurates the operating parameters for a stream /// @@ -578,7 +570,6 @@ namespace DiscImageChef.Devices #endregion Commands defined on ATA/ATAPI-7 rev. 4b #region Commands defined on ATA/ATAPI-8 rev. 3f - /// /// Sends a Non Volatile Cache subcommand. /// @@ -618,7 +609,6 @@ namespace DiscImageChef.Devices #endregion Commands defined on ATA/ATAPI-8 rev. 3f #region Commands defined on ATA/ATAPI Command Set 2 (ACS-2) rev. 2 - /// /// Provides information for device optimization /// In SSDs, this contains trimming @@ -660,7 +650,6 @@ namespace DiscImageChef.Devices #endregion Commands defined on ATA/ATAPI Command Set 2 (ACS-2) rev. 2 #region Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 - /// /// Sends /// @@ -669,7 +658,6 @@ namespace DiscImageChef.Devices /// Sets the device date and time /// SetDateAndTimeExt = 0x77, - #endregion Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 #region Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 6 @@ -685,7 +673,6 @@ namespace DiscImageChef.Devices public enum AtaSmartSubCommands : byte { #region Commands defined on ATA-3 rev. 7b - /// /// Disables all SMART capabilities /// @@ -717,7 +704,6 @@ namespace DiscImageChef.Devices #endregion Commands defined on ATA-3 rev. 7b #region Commands defined on ATA/ATAPI-4 rev. 18 - /// /// Causes the device to immediately initiate a SMART data collection and saves it to the device /// @@ -729,7 +715,6 @@ namespace DiscImageChef.Devices #endregion Commands defined on ATA/ATAPI-4 rev. 18 #region Commands defined on ATA/ATAPI-5 rev. 3 - /// /// Returns the indicated log to the host /// @@ -738,7 +723,6 @@ namespace DiscImageChef.Devices /// Writes data to the indicated log /// WriteLog = 0xD6 - #endregion Commands defined on ATA/ATAPI-5 rev. 3 } #endregion ATA SMART SubCommands @@ -750,7 +734,6 @@ namespace DiscImageChef.Devices public enum AtaDeviceConfigurationSubCommands : byte { #region Commands defined on ATA/ATAPI-6 rev. 3b - /// /// Disables any change made by /// @@ -767,7 +750,6 @@ namespace DiscImageChef.Devices /// Modifies the commands, modes and features sets the device will obey to /// Set = 0xC3 - #endregion Commands defined on ATA/ATAPI-6 rev. 3b } #endregion ATA Device Configuration Overlay SubCommands @@ -779,7 +761,6 @@ namespace DiscImageChef.Devices public enum AtaSetMaxSubCommands : byte { #region Commands defined on ATA/ATAPI-6 rev. 3b - /// /// Redefines the maximum user-accessible address space /// @@ -811,7 +792,6 @@ namespace DiscImageChef.Devices public enum AtaNonVolatileCacheSubCommands : byte { #region Commands defined on ATA/ATAPI-8 rev. 3f - /// /// Adds the specified LBA to the Non Volatile Cache /// @@ -841,7 +821,6 @@ namespace DiscImageChef.Devices /// Enables the Non Volatile Cache Power Mode, so the device tries to serve all accesses from the Non Volatile Cache /// SetNvCachePowerMode = 0x00 - #endregion Commands defined on ATA/ATAPI-8 rev. 3f } #endregion ATA Non Volatile Cache SubCommands @@ -853,7 +832,6 @@ namespace DiscImageChef.Devices public enum AtaSanitizeSubCommands : ushort { #region Commands defined on ATA/ATAPI Command Set 2 (ACS-2) rev. 2 - /// /// Causes a block erase on all user data /// @@ -877,12 +855,10 @@ namespace DiscImageChef.Devices #endregion Commands defined on ATA/ATAPI Command Set 2 (ACS-2) rev. 2 #region Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 - /// /// Disables the command /// AntiFreezeLockExt = 0x0040 - #endregion Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 } #endregion ATA Sanitize SubCommands @@ -894,7 +870,6 @@ namespace DiscImageChef.Devices public enum AtaNCQQueueManagementSubcommands : byte { #region Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 - /// /// Aborts pending NCQ commands /// @@ -914,11 +889,11 @@ namespace DiscImageChef.Devices /// Commands 0x40 to 0x5F are 8-byte /// Commands 0xA0 to 0xBF are 12-byte /// + #region SASI Commands public enum SasiCommands : byte { #region SASI Class 0 commands - /// /// Returns zero status if requested unit is on and ready. /// SASI rev. 0a @@ -1101,7 +1076,6 @@ namespace DiscImageChef.Devices #endregion SASI Class 0 commands #region SASI Class 1 commands - /// /// SASI rev. 0a /// Unknown @@ -1162,11 +1136,9 @@ namespace DiscImageChef.Devices /// ANSI X3T9.3 No. 185 (SASI) /// SearchDataLow = 0x32, - #endregion SASI Class 1 commands #region SASI Class 2 commands - /// /// Unknown /// SASI rev. 0a @@ -1275,7 +1247,6 @@ namespace DiscImageChef.Devices #endregion SASI Class 2 commands #region SASI Class 3 commands - /// /// SASI rev. 0a /// @@ -1307,7 +1278,6 @@ namespace DiscImageChef.Devices #endregion SASI Class 3 commands #region SASI Class 5 commands - /// /// Gets the number of blocks in device. /// ANSI X3T9.3 No. 185 (SASI) @@ -1318,11 +1288,9 @@ namespace DiscImageChef.Devices /// ANSI X3T9.3 No. 185 (SASI) /// SetBlockLimits = 0xA9, - #endregion SASI Class 5 commands #region SASI Class 6 commands - /// /// SASI rev. 0a /// @@ -1346,7 +1314,6 @@ namespace DiscImageChef.Devices #endregion SASI Class 6 commands #region SASI Class 7 commands - /// /// SASI rev. 0a /// @@ -1375,7 +1342,6 @@ namespace DiscImageChef.Devices /// Found on a vendor document /// WriteLong = 0xE6 - #endregion SASI Class 7 commands } #endregion SASI Commands @@ -1387,7 +1353,6 @@ namespace DiscImageChef.Devices public enum ScsiCommands : byte { #region SCSI Primary Commands (SPC) - /// /// Commands used to obtain information about the access controls that are active /// SPC-4 rev. 16 @@ -1581,7 +1546,6 @@ namespace DiscImageChef.Devices #endregion SCSI Primary Commands (SPC) #region SCSI Block Commands (SBC) - /// /// Compares blocks with sent data, and if equal, writes those block to device, atomically /// SBC-3 rev. 25 @@ -1799,7 +1763,6 @@ namespace DiscImageChef.Devices #endregion SCSI Block Commands (SBC) #region SCSI Streaming Commands (SSC) - /// /// Prepares the medium for use by the LUN /// SSC-1 rev. 22 @@ -1883,7 +1846,6 @@ namespace DiscImageChef.Devices #endregion SCSI Streaming Commands (SSC) #region SCSI Streaming Commands for Printers (SSC) - /// /// Assures that the data in the buffer has been printed, or, for other devices, written to media /// ECMA-111 (SCSI-1) @@ -1917,7 +1879,6 @@ namespace DiscImageChef.Devices #endregion SCSI Streaming Commands for Printers (SSC) #region SCSI Processor Commands - /// /// Transfers data from the device /// ECMA-111 (SCSI-1) @@ -1931,7 +1892,6 @@ namespace DiscImageChef.Devices #endregion SCSI Processor Commands #region SCSI Multimedia Commands (MMC) - /// /// Erases any part of a CD-RW /// MMC-1 rev. 9 @@ -2150,7 +2110,6 @@ namespace DiscImageChef.Devices #endregion SCSI Multimedia Commands (MMC) #region SCSI Scanner Commands - /// /// Gets information about the data buffer /// SCSI-2 X3T9.2/375R rev. 10l @@ -2184,7 +2143,6 @@ namespace DiscImageChef.Devices #endregion SCSI Scanner Commands #region SCSI Block Commands for Optical Media (SBC) - /// /// Erases the specified number of blocks /// @@ -2257,7 +2215,6 @@ namespace DiscImageChef.Devices #endregion SCSI Block Commands for Optical Media (SBC) #region SCSI Medium Changer Commands (SMC) - /// /// Provides a means to exchange the medium in the source element with the medium at destination element /// SCSI-2 X3T9.2/375R rev. 10l @@ -2341,7 +2298,6 @@ namespace DiscImageChef.Devices #endregion SCSI Medium Changer Commands (SMC) #region SCSI Communication Commands - /// /// Gets data from the device /// SCSI-2 X3T9.2/375R rev. 10l @@ -2375,7 +2331,6 @@ namespace DiscImageChef.Devices #endregion SCSI Communication Commands #region SCSI Controller Commands - /// /// Commands that get information about redundancy groups /// SCC-2 rev. 4 @@ -2399,7 +2354,6 @@ namespace DiscImageChef.Devices #endregion SCSI Controller Commands #region Pioneer CD-ROM SCSI-2 Command Set - /// /// Scans for a block playing a block on each track cross /// @@ -2436,7 +2390,6 @@ namespace DiscImageChef.Devices #endregion #region ATA Command Pass-Through - /// /// Sends a 24-bit ATA command to the device /// Clashes with @@ -2451,7 +2404,6 @@ namespace DiscImageChef.Devices #endregion ATA Command Pass-Through #region 6-byte CDB aliases - ModeSelect6 = ModeSelect, ModeSense6 = ModeSense, Read6 = Read, @@ -2460,7 +2412,6 @@ namespace DiscImageChef.Devices #endregion 6-byte CDB aliases #region SCSI Zoned Block Commands - /// /// ZBC commands with host->device information /// @@ -2472,7 +2423,6 @@ namespace DiscImageChef.Devices #endregion #region SCSI Commands with unknown meaning, mostly vendor specific - SetCdSpeedUnk = 0xB8, WriteCdMsf = 0xA2, WriteCd = 0xAA, @@ -2489,7 +2439,6 @@ namespace DiscImageChef.Devices #endregion SCSI Commands with unknown meaning, mostly vendor specific #region SEGA Packet Interface (all are 12-byte CDB) - /// /// Verifies that the device can be accessed /// Sega SPI ver. 1.30 @@ -2864,13 +2813,11 @@ namespace DiscImageChef.Devices /// /// Allows medium removal from data transport but prevents it from medium changer /// - [Obsolete] - PreventChanger = 0x02, + [Obsolete] PreventChanger = 0x02, /// /// Prevents medium removal from both data transport and medium changer /// - [Obsolete] - PreventAll = 0x03 + [Obsolete] PreventAll = 0x03 } public enum MmcGetConfigurationRt : byte @@ -3528,8 +3475,7 @@ namespace DiscImageChef.Devices /// /// Reads data stream from device, starting at given address, until a follows (ADTC, R1) /// - [Obsolete] - ReadDatUntilStop = 11, + [Obsolete] ReadDatUntilStop = 11, /// /// Terminates a read/write stream/multiple block operation (AC, R1 / R1b) /// @@ -3577,8 +3523,7 @@ namespace DiscImageChef.Devices /// /// Writes data stream from host until a follows (ADTC, R1) /// - [Obsolete] - WriteDatUntilStop = 20, + [Obsolete] WriteDatUntilStop = 20, #endregion Class 3 MMC Commands (Stream write) #region Class 4 MMC Commands (Block-oriented write) @@ -3868,5 +3813,4 @@ namespace DiscImageChef.Devices Xtreme = 1, Wxripper = 2 } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/FreeBSD/Command.cs b/DiscImageChef.Devices/FreeBSD/Command.cs index af45b9b2..9f6fe3d1 100644 --- a/DiscImageChef.Devices/FreeBSD/Command.cs +++ b/DiscImageChef.Devices/FreeBSD/Command.cs @@ -55,14 +55,14 @@ namespace DiscImageChef.Devices.FreeBSD /// SCSI command transfer direction /// Time it took to execute the command in milliseconds /// True if SCSI error returned non-OK status and contains SCSI sense - internal static int SendScsiCommand64(IntPtr dev, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ccb_flags direction, out double duration, out bool sense) + internal static int SendScsiCommand64(IntPtr dev, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, + uint timeout, ccb_flags direction, out double duration, out bool sense) { senseBuffer = null; duration = 0; sense = false; - if(buffer == null) - return -1; + if(buffer == null) return -1; IntPtr ccbPtr = cam_getccb(dev); IntPtr cdbPtr = IntPtr.Zero; @@ -87,8 +87,7 @@ namespace DiscImageChef.Devices.FreeBSD // TODO: Create enum? csio.tag_action = 0x20; csio.cdb_bytes = new byte[CAM_MAX_CDBLEN]; - if(cdb.Length <= CAM_MAX_CDBLEN) - Array.Copy(cdb, 0, csio.cdb_bytes, 0, cdb.Length); + if(cdb.Length <= CAM_MAX_CDBLEN) Array.Copy(cdb, 0, csio.cdb_bytes, 0, cdb.Length); else { cdbPtr = Marshal.AllocHGlobal(cdb.Length); @@ -105,8 +104,7 @@ namespace DiscImageChef.Devices.FreeBSD int error = cam_send_ccb(dev, ccbPtr); DateTime end = DateTime.UtcNow; - if(error < 0) - error = Marshal.GetLastWin32Error(); + if(error < 0) error = Marshal.GetLastWin32Error(); csio = (ccb_scsiio64)Marshal.PtrToStructure(ccbPtr, typeof(ccb_scsiio64)); @@ -142,12 +140,10 @@ namespace DiscImageChef.Devices.FreeBSD Marshal.Copy(csio.data_ptr, buffer, 0, buffer.Length); if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER)) Marshal.Copy(new IntPtr(BitConverter.ToInt64(csio.cdb_bytes, 0)), cdb, 0, cdb.Length); - else - Array.Copy(csio.cdb_bytes, 0, cdb, 0, cdb.Length); + else Array.Copy(csio.cdb_bytes, 0, cdb, 0, cdb.Length); duration = (end - start).TotalMilliseconds; - if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER)) - Marshal.FreeHGlobal(cdbPtr); + if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER)) Marshal.FreeHGlobal(cdbPtr); Marshal.FreeHGlobal(csio.data_ptr); cam_freeccb(ccbPtr); @@ -166,14 +162,14 @@ namespace DiscImageChef.Devices.FreeBSD /// SCSI command transfer direction /// Time it took to execute the command in milliseconds /// True if SCSI error returned non-OK status and contains SCSI sense - internal static int SendScsiCommand(IntPtr dev, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ccb_flags direction, out double duration, out bool sense) + internal static int SendScsiCommand(IntPtr dev, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, + uint timeout, ccb_flags direction, out double duration, out bool sense) { senseBuffer = null; duration = 0; sense = false; - if(buffer == null) - return -1; + if(buffer == null) return -1; IntPtr ccbPtr = cam_getccb(dev); IntPtr cdbPtr = IntPtr.Zero; @@ -198,8 +194,7 @@ namespace DiscImageChef.Devices.FreeBSD // TODO: Create enum? csio.tag_action = 0x20; csio.cdb_bytes = new byte[CAM_MAX_CDBLEN]; - if(cdb.Length <= CAM_MAX_CDBLEN) - Array.Copy(cdb, 0, csio.cdb_bytes, 0, cdb.Length); + if(cdb.Length <= CAM_MAX_CDBLEN) Array.Copy(cdb, 0, csio.cdb_bytes, 0, cdb.Length); else { cdbPtr = Marshal.AllocHGlobal(cdb.Length); @@ -216,8 +211,7 @@ namespace DiscImageChef.Devices.FreeBSD int error = cam_send_ccb(dev, ccbPtr); DateTime end = DateTime.UtcNow; - if(error < 0) - error = Marshal.GetLastWin32Error(); + if(error < 0) error = Marshal.GetLastWin32Error(); csio = (ccb_scsiio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_scsiio)); @@ -253,12 +247,10 @@ namespace DiscImageChef.Devices.FreeBSD Marshal.Copy(csio.data_ptr, buffer, 0, buffer.Length); if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER)) Marshal.Copy(new IntPtr(BitConverter.ToInt32(csio.cdb_bytes, 0)), cdb, 0, cdb.Length); - else - Array.Copy(csio.cdb_bytes, 0, cdb, 0, cdb.Length); + else Array.Copy(csio.cdb_bytes, 0, cdb, 0, cdb.Length); duration = (end - start).TotalMilliseconds; - if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER)) - Marshal.FreeHGlobal(cdbPtr); + if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER)) Marshal.FreeHGlobal(cdbPtr); Marshal.FreeHGlobal(csio.data_ptr); cam_freeccb(ccbPtr); @@ -274,16 +266,12 @@ namespace DiscImageChef.Devices.FreeBSD case AtaProtocol.HardReset: case AtaProtocol.NonData: case AtaProtocol.SoftReset: - case AtaProtocol.ReturnResponse: - return ccb_flags.CAM_DIR_NONE; + case AtaProtocol.ReturnResponse: return ccb_flags.CAM_DIR_NONE; case AtaProtocol.PioIn: - case AtaProtocol.UDmaIn: - return ccb_flags.CAM_DIR_IN; + case AtaProtocol.UDmaIn: return ccb_flags.CAM_DIR_IN; case AtaProtocol.PioOut: - case AtaProtocol.UDmaOut: - return ccb_flags.CAM_DIR_OUT; - default: - return ccb_flags.CAM_DIR_NONE; + case AtaProtocol.UDmaOut: return ccb_flags.CAM_DIR_OUT; + default: return ccb_flags.CAM_DIR_NONE; } } @@ -470,7 +458,7 @@ namespace DiscImageChef.Devices.FreeBSD // 48-bit ATA CAM commands can crash FreeBSD < 9.2-RELEASE if((System.Environment.Version.Major == 9 && System.Environment.Version.Minor < 2) || System.Environment.Version.Major < 9) return -1; - + if(buffer == null) return -1; IntPtr ccbPtr = cam_getccb(dev); @@ -554,5 +542,4 @@ namespace DiscImageChef.Devices.FreeBSD return error; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/FreeBSD/Enums.cs b/DiscImageChef.Devices/FreeBSD/Enums.cs index cadf61f7..581bce79 100644 --- a/DiscImageChef.Devices/FreeBSD/Enums.cs +++ b/DiscImageChef.Devices/FreeBSD/Enums.cs @@ -174,8 +174,7 @@ namespace DiscImageChef.Devices.FreeBSD /// Set device type information XPT_SDEV_TYPE = 0x07, /// (Re)Scan the SCSI Bus - XPT_SCAN_BUS = 0x08 | XPT_FC_QUEUED | XPT_FC_USER_CCB - | XPT_FC_XPT_ONLY, + XPT_SCAN_BUS = 0x08 | XPT_FC_QUEUED | XPT_FC_USER_CCB | XPT_FC_XPT_ONLY, /// Get EDT entries matching the given pattern XPT_DEV_MATCH = 0x09 | XPT_FC_XPT_ONLY, /// Turn on debugging for a bus, target or lun @@ -187,11 +186,9 @@ namespace DiscImageChef.Devices.FreeBSD /// Get/Set Device advanced information XPT_DEV_ADVINFO = 0x0e, /// Asynchronous event - XPT_ASYNC = 0x0f | XPT_FC_QUEUED | XPT_FC_USER_CCB - | XPT_FC_XPT_ONLY, + XPT_ASYNC = 0x0f | XPT_FC_QUEUED | XPT_FC_USER_CCB | XPT_FC_XPT_ONLY, /// SCSI Control Functions: 0x10->0x1F - /// Abort the specified CCB XPT_ABORT = 0x10, /// Reset the specified SCSI bus @@ -201,8 +198,7 @@ namespace DiscImageChef.Devices.FreeBSD /// Terminate the I/O process XPT_TERM_IO = 0x13, /// Scan Logical Unit - XPT_SCAN_LUN = 0x14 | XPT_FC_QUEUED | XPT_FC_USER_CCB - | XPT_FC_XPT_ONLY, + XPT_SCAN_LUN = 0x14 | XPT_FC_QUEUED | XPT_FC_USER_CCB | XPT_FC_XPT_ONLY, /// Get default/user transfer settings for the target XPT_GET_TRAN_SETTINGS = 0x15, /// Set transfer rate/width negotiation settings @@ -222,8 +218,7 @@ namespace DiscImageChef.Devices.FreeBSD /// Serial Management Protocol XPT_SMP_IO = 0x1b | XPT_FC_DEV_QUEUED, /// Scan Target - XPT_SCAN_TGT = 0x1E | XPT_FC_QUEUED | XPT_FC_USER_CCB - | XPT_FC_XPT_ONLY, + XPT_SCAN_TGT = 0x1E | XPT_FC_QUEUED | XPT_FC_USER_CCB | XPT_FC_XPT_ONLY, // HBA engine commands 0x20->0x2F @@ -280,7 +275,7 @@ namespace DiscImageChef.Devices.FreeBSD PERIPH_MATCH_LUN = 0x004, PERIPH_MATCH_NAME = 0x008, PERIPH_MATCH_UNIT = 0x010, - // PERIPH_MATCH_ANY = 0x01f + // PERIPH_MATCH_ANY = 0x01f } [Flags] @@ -292,7 +287,7 @@ namespace DiscImageChef.Devices.FreeBSD DEV_MATCH_LUN = 0x004, DEV_MATCH_INQUIRY = 0x008, DEV_MATCH_DEVID = 0x010, - // DEV_MATCH_ANY = 0x00f + // DEV_MATCH_ANY = 0x00f } [Flags] @@ -303,7 +298,7 @@ namespace DiscImageChef.Devices.FreeBSD BUS_MATCH_NAME = 0x002, BUS_MATCH_UNIT = 0x004, BUS_MATCH_BUS_ID = 0x008, - // BUS_MATCH_ANY = 0x00f + // BUS_MATCH_ANY = 0x00f } [Flags] @@ -382,11 +377,11 @@ namespace DiscImageChef.Devices.FreeBSD CAM_DEV_POS_DEVICE = 0x004, CAM_DEV_POS_PERIPH = 0x008, CAM_DEV_POS_PDPTR = 0x010, - // CAM_DEV_POS_TYPEMASK = 0xf00, + // CAM_DEV_POS_TYPEMASK = 0xf00, CAM_DEV_POS_EDT = 0x100, CAM_DEV_POS_PDRV = 0x200 } - + enum FreebsdIoctl : uint { CAMIOCOMMAND = 0xC4D81802, @@ -564,176 +559,174 @@ namespace DiscImageChef.Devices.FreeBSD CAM_UNLOCKED = 0x80000000 } - enum cam_status : uint - { - /// CCB request is in progress - CAM_REQ_INPROG = 0x00, + enum cam_status : uint + { + /// CCB request is in progress + CAM_REQ_INPROG = 0x00, - /// CCB request completed without error - CAM_REQ_CMP = 0x01, + /// CCB request completed without error + CAM_REQ_CMP = 0x01, - /// CCB request aborted by the host - CAM_REQ_ABORTED = 0x02, + /// CCB request aborted by the host + CAM_REQ_ABORTED = 0x02, - /// Unable to abort CCB request - CAM_UA_ABORT = 0x03, + /// Unable to abort CCB request + CAM_UA_ABORT = 0x03, - /// CCB request completed with an error - CAM_REQ_CMP_ERR = 0x04, + /// CCB request completed with an error + CAM_REQ_CMP_ERR = 0x04, - /// CAM subsystem is busy - CAM_BUSY = 0x05, + /// CAM subsystem is busy + CAM_BUSY = 0x05, - /// CCB request was invalid - CAM_REQ_INVALID = 0x06, + /// CCB request was invalid + CAM_REQ_INVALID = 0x06, - /// Supplied Path ID is invalid - CAM_PATH_INVALID = 0x07, + /// Supplied Path ID is invalid + CAM_PATH_INVALID = 0x07, - /// SCSI Device Not Installed/there - CAM_DEV_NOT_THERE = 0x08, + /// SCSI Device Not Installed/there + CAM_DEV_NOT_THERE = 0x08, - /// Unable to terminate I/O CCB request - CAM_UA_TERMIO = 0x09, + /// Unable to terminate I/O CCB request + CAM_UA_TERMIO = 0x09, - /// Target Selection Timeout - CAM_SEL_TIMEOUT = 0x0a, + /// Target Selection Timeout + CAM_SEL_TIMEOUT = 0x0a, - /// Command timeout - CAM_CMD_TIMEOUT = 0x0b, + /// Command timeout + CAM_CMD_TIMEOUT = 0x0b, - /// SCSI error, look at error code in CCB - CAM_SCSI_STATUS_ERROR = 0x0c, + /// SCSI error, look at error code in CCB + CAM_SCSI_STATUS_ERROR = 0x0c, - /// Message Reject Received - CAM_MSG_REJECT_REC = 0x0d, + /// Message Reject Received + CAM_MSG_REJECT_REC = 0x0d, - /// SCSI Bus Reset Sent/Received - CAM_SCSI_BUS_RESET = 0x0e, + /// SCSI Bus Reset Sent/Received + CAM_SCSI_BUS_RESET = 0x0e, - /// Uncorrectable parity error occurred - CAM_UNCOR_PARITY = 0x0f, + /// Uncorrectable parity error occurred + CAM_UNCOR_PARITY = 0x0f, - /// Autosense: request sense cmd fail - CAM_AUTOSENSE_FAIL = 0x10, + /// Autosense: request sense cmd fail + CAM_AUTOSENSE_FAIL = 0x10, - /// No HBA Detected error - CAM_NO_HBA = 0x11, + /// No HBA Detected error + CAM_NO_HBA = 0x11, - /// Data Overrun error - CAM_DATA_RUN_ERR = 0x12, + /// Data Overrun error + CAM_DATA_RUN_ERR = 0x12, - /// Unexpected Bus Free - CAM_UNEXP_BUSFREE = 0x13, + /// Unexpected Bus Free + CAM_UNEXP_BUSFREE = 0x13, - /// Target Bus Phase Sequence Failure - CAM_SEQUENCE_FAIL = 0x14, + /// Target Bus Phase Sequence Failure + CAM_SEQUENCE_FAIL = 0x14, - /// CCB length supplied is inadequate - CAM_CCB_LEN_ERR = 0x15, + /// CCB length supplied is inadequate + CAM_CCB_LEN_ERR = 0x15, - /// Unable to provide requested capability - CAM_PROVIDE_FAIL = 0x16, + /// Unable to provide requested capability + CAM_PROVIDE_FAIL = 0x16, - /// A SCSI BDR msg was sent to target - CAM_BDR_SENT = 0x17, + /// A SCSI BDR msg was sent to target + CAM_BDR_SENT = 0x17, - /// CCB request terminated by the host - CAM_REQ_TERMIO = 0x18, + /// CCB request terminated by the host + CAM_REQ_TERMIO = 0x18, - /// Unrecoverable Host Bus Adapter Error - CAM_UNREC_HBA_ERROR = 0x19, + /// Unrecoverable Host Bus Adapter Error + CAM_UNREC_HBA_ERROR = 0x19, - /// Request was too large for this host - CAM_REQ_TOO_BIG = 0x1a, + /// Request was too large for this host + CAM_REQ_TOO_BIG = 0x1a, - /// This request should be requeued to preserve transaction ordering. This typically occurs when the SIM recognizes an error that should freeze the queue and must place additional requests for the target at the sim level back into the XPT queue. - CAM_REQUEUE_REQ = 0x1b, + /// This request should be requeued to preserve transaction ordering. This typically occurs when the SIM recognizes an error that should freeze the queue and must place additional requests for the target at the sim level back into the XPT queue. + CAM_REQUEUE_REQ = 0x1b, - /// ATA error, look at error code in CCB - CAM_ATA_STATUS_ERROR = 0x1c, + /// ATA error, look at error code in CCB + CAM_ATA_STATUS_ERROR = 0x1c, - /// Initiator/Target Nexus lost. - CAM_SCSI_IT_NEXUS_LOST = 0x1d, + /// Initiator/Target Nexus lost. + CAM_SCSI_IT_NEXUS_LOST = 0x1d, - /// SMP error, look at error code in CCB - CAM_SMP_STATUS_ERROR = 0x1e, + /// SMP error, look at error code in CCB + CAM_SMP_STATUS_ERROR = 0x1e, - /// Command completed without error but exceeded the soft timeout threshold. - CAM_REQ_SOFTTIMEOUT = 0x1f, + /// Command completed without error but exceeded the soft timeout threshold. + CAM_REQ_SOFTTIMEOUT = 0x1f, - /* - * 0x20 - 0x32 are unassigned - */ + /* + * 0x20 - 0x32 are unassigned + */ - /// Initiator Detected Error - CAM_IDE = 0x33, + /// Initiator Detected Error + CAM_IDE = 0x33, - /// Resource Unavailable - CAM_RESRC_UNAVAIL = 0x34, + /// Resource Unavailable + CAM_RESRC_UNAVAIL = 0x34, - /// Unacknowledged Event by Host - CAM_UNACKED_EVENT = 0x35, + /// Unacknowledged Event by Host + CAM_UNACKED_EVENT = 0x35, - /// Message Received in Host Target Mode - CAM_MESSAGE_RECV = 0x36, + /// Message Received in Host Target Mode + CAM_MESSAGE_RECV = 0x36, - /// Invalid CDB received in Host Target Mode - CAM_INVALID_CDB = 0x37, + /// Invalid CDB received in Host Target Mode + CAM_INVALID_CDB = 0x37, - /// Lun supplied is invalid - CAM_LUN_INVALID = 0x38, + /// Lun supplied is invalid + CAM_LUN_INVALID = 0x38, - /// Target ID supplied is invalid - CAM_TID_INVALID = 0x39, + /// Target ID supplied is invalid + CAM_TID_INVALID = 0x39, - /// The requested function is not available - CAM_FUNC_NOTAVAIL = 0x3a, + /// The requested function is not available + CAM_FUNC_NOTAVAIL = 0x3a, - /// Nexus is not established - CAM_NO_NEXUS = 0x3b, + /// Nexus is not established + CAM_NO_NEXUS = 0x3b, - /// The initiator ID is invalid - CAM_IID_INVALID = 0x3c, + /// The initiator ID is invalid + CAM_IID_INVALID = 0x3c, - /// The SCSI CDB has been received - CAM_CDB_RECVD = 0x3d, + /// The SCSI CDB has been received + CAM_CDB_RECVD = 0x3d, - /// The LUN is already enabled for target mode - CAM_LUN_ALRDY_ENA = 0x3e, + /// The LUN is already enabled for target mode + CAM_LUN_ALRDY_ENA = 0x3e, - /// SCSI Bus Busy - CAM_SCSI_BUSY = 0x3f, + /// SCSI Bus Busy + CAM_SCSI_BUSY = 0x3f, + /* + * Flags + */ - /* - * Flags - */ + /// The DEV queue is frozen w/this err + CAM_DEV_QFRZN = 0x40, - /// The DEV queue is frozen w/this err - CAM_DEV_QFRZN = 0x40, + /// Autosense data valid for target + CAM_AUTOSNS_VALID = 0x80, - /// Autosense data valid for target - CAM_AUTOSNS_VALID = 0x80, + /// SIM ready to take more commands + CAM_RELEASE_SIMQ = 0x100, - /// SIM ready to take more commands - CAM_RELEASE_SIMQ = 0x100, + /// SIM has this command in its queue + CAM_SIM_QUEUED = 0x200, - /// SIM has this command in its queue - CAM_SIM_QUEUED = 0x200, + /// Quality of service data is valid + CAM_QOS_VALID = 0x400, - /// Quality of service data is valid - CAM_QOS_VALID = 0x400, + /// Mask bits for just the status # + CAM_STATUS_MASK = 0x3F, - /// Mask bits for just the status # - CAM_STATUS_MASK = 0x3F, - - /* - * Target Specific Adjunct Status - */ - - /// sent sense with status - CAM_SENT_SENSE = 0x40000000 - } -} + /* + * Target Specific Adjunct Status + */ + /// sent sense with status + CAM_SENT_SENSE = 0x40000000 + } +} \ No newline at end of file diff --git a/DiscImageChef.Devices/FreeBSD/Extern.cs b/DiscImageChef.Devices/FreeBSD/Extern.cs index 6846665a..4ff22b8b 100644 --- a/DiscImageChef.Devices/FreeBSD/Extern.cs +++ b/DiscImageChef.Devices/FreeBSD/Extern.cs @@ -39,19 +39,13 @@ namespace DiscImageChef.Devices.FreeBSD static class Extern { [DllImport("libc", CharSet = CharSet.Ansi, SetLastError = true)] - internal static extern int open( - string pathname, - [MarshalAs(UnmanagedType.U4)] - FileFlags flags); + internal static extern int open(string pathname, [MarshalAs(UnmanagedType.U4)] FileFlags flags); [DllImport("libc")] internal static extern int close(int fd); [DllImport("libcam", CharSet = CharSet.Ansi, SetLastError = true)] - internal static extern IntPtr cam_open_device( - string path, - [MarshalAs(UnmanagedType.U4)] - FileFlags flags); + internal static extern IntPtr cam_open_device(string path, [MarshalAs(UnmanagedType.U4)] FileFlags flags); [DllImport("libcam", CharSet = CharSet.Ansi, SetLastError = true)] internal static extern void cam_close_device(IntPtr dev); @@ -68,5 +62,4 @@ namespace DiscImageChef.Devices.FreeBSD [DllImport("libc")] internal static extern int ioctl(int fd, FreebsdIoctl request, IntPtr argp); } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/FreeBSD/ListDevices.cs b/DiscImageChef.Devices/FreeBSD/ListDevices.cs index c95ea2d1..fc5b3a66 100644 --- a/DiscImageChef.Devices/FreeBSD/ListDevices.cs +++ b/DiscImageChef.Devices/FreeBSD/ListDevices.cs @@ -121,7 +121,6 @@ namespace DiscImageChef.Devices.FreeBSD } case cam_proto.PROTO_SCSI: { - Decoders.SCSI.Inquiry.SCSIInquiry? inq = Decoders.SCSI.Inquiry.Decode(cgd.inq_data); if(inq.HasValue) { diff --git a/DiscImageChef.Devices/FreeBSD/Structs.cs b/DiscImageChef.Devices/FreeBSD/Structs.cs index 9e368e6d..307899ed 100644 --- a/DiscImageChef.Devices/FreeBSD/Structs.cs +++ b/DiscImageChef.Devices/FreeBSD/Structs.cs @@ -165,10 +165,8 @@ namespace DiscImageChef.Devices.FreeBSD public ulong target_lun; public ccb_flags flags; public uint xflags; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public IntPtr[] periph_priv; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public IntPtr[] sim_priv; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public IntPtr[] periph_priv; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public IntPtr[] sim_priv; public ccb_qos_area qos; public uint timeout; public timeval softtimeout; @@ -257,7 +255,7 @@ namespace DiscImageChef.Devices.FreeBSD public sbyte sense_resid; /// Transfer residual length: 2's comp public int resid; - public uint alignment; + public uint alignment; /// /// Area for the CDB send, or pointer to the CDB bytes to send /// @@ -274,6 +272,7 @@ namespace DiscImageChef.Devices.FreeBSD /// initiator id of who selected public uint init_id; } + /// /// ATA I/O Request CCB used for the XPT_ATA_IO function code. /// @@ -787,5 +786,4 @@ namespace DiscImageChef.Devices.FreeBSD public byte serial_num_len; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public IntPtr[] padding; } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Linux/Command.cs b/DiscImageChef.Devices/Linux/Command.cs index a86e4b6f..290c0240 100644 --- a/DiscImageChef.Devices/Linux/Command.cs +++ b/DiscImageChef.Devices/Linux/Command.cs @@ -51,14 +51,14 @@ namespace DiscImageChef.Devices.Linux /// SCSI command transfer direction /// Time it took to execute the command in milliseconds /// True if SCSI error returned non-OK status and contains SCSI sense - internal static int SendScsiCommand(int fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiIoctlDirection direction, out double duration, out bool sense) + internal static int SendScsiCommand(int fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, + ScsiIoctlDirection direction, out double duration, out bool sense) { senseBuffer = null; duration = 0; sense = false; - if(buffer == null) - return -1; + if(buffer == null) return -1; sg_io_hdr_t io_hdr = new sg_io_hdr_t(); @@ -82,8 +82,7 @@ namespace DiscImageChef.Devices.Linux int error = Extern.ioctlSg(fd, LinuxIoctl.SG_IO, ref io_hdr); DateTime end = DateTime.UtcNow; - if(error < 0) - error = Marshal.GetLastWin32Error(); + if(error < 0) error = Marshal.GetLastWin32Error(); Marshal.Copy(io_hdr.dxferp, buffer, 0, buffer.Length); Marshal.Copy(io_hdr.cmdp, cdb, 0, cdb.Length); @@ -91,10 +90,8 @@ namespace DiscImageChef.Devices.Linux sense |= (io_hdr.info & SgInfo.OkMask) != SgInfo.Ok; - if(io_hdr.duration > 0) - duration = io_hdr.duration; - else - duration = (end - start).TotalMilliseconds; + if(io_hdr.duration > 0) duration = io_hdr.duration; + else duration = (end - start).TotalMilliseconds; Marshal.FreeHGlobal(io_hdr.dxferp); Marshal.FreeHGlobal(io_hdr.cmdp); @@ -112,36 +109,30 @@ namespace DiscImageChef.Devices.Linux case AtaProtocol.HardReset: case AtaProtocol.NonData: case AtaProtocol.SoftReset: - case AtaProtocol.ReturnResponse: - return ScsiIoctlDirection.None; + case AtaProtocol.ReturnResponse: return ScsiIoctlDirection.None; case AtaProtocol.PioIn: - case AtaProtocol.UDmaIn: - return ScsiIoctlDirection.In; + case AtaProtocol.UDmaIn: return ScsiIoctlDirection.In; case AtaProtocol.PioOut: - case AtaProtocol.UDmaOut: - return ScsiIoctlDirection.Out; - default: - return ScsiIoctlDirection.Unspecified; + case AtaProtocol.UDmaOut: return ScsiIoctlDirection.Out; + default: return ScsiIoctlDirection.Unspecified; } } - internal static int SendAtaCommand(int fd, AtaRegistersCHS registers, - out AtaErrorRegistersCHS errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + internal static int SendAtaCommand(int fd, AtaRegistersCHS registers, out AtaErrorRegistersCHS errorRegisters, + AtaProtocol protocol, AtaTransferRegister transferRegister, + ref byte[] buffer, uint timeout, bool transferBlocks, out double duration, + out bool sense) { duration = 0; sense = false; errorRegisters = new AtaErrorRegistersCHS(); - if(buffer == null) - return -1; + if(buffer == null) return -1; byte[] cdb = new byte[16]; cdb[0] = (byte)ScsiCommands.AtaPassThrough16; cdb[1] = (byte)(((byte)protocol << 1) & 0x1E); - if(transferRegister != AtaTransferRegister.NoTransfer && - protocol != AtaProtocol.NonData) + if(transferRegister != AtaTransferRegister.NoTransfer && protocol != AtaProtocol.NonData) { switch(protocol) { @@ -154,8 +145,7 @@ namespace DiscImageChef.Devices.Linux break; } - if(transferBlocks) - cdb[2] |= 0x04; + if(transferBlocks) cdb[2] |= 0x04; cdb[2] |= (byte)((int)transferRegister & 0x03); } @@ -171,10 +161,10 @@ namespace DiscImageChef.Devices.Linux cdb[14] = registers.command; byte[] senseBuffer; - int error = SendScsiCommand(fd, cdb, ref buffer, out senseBuffer, timeout, AtaProtocolToScsiDirection(protocol), out duration, out sense); + int error = SendScsiCommand(fd, cdb, ref buffer, out senseBuffer, timeout, + AtaProtocolToScsiDirection(protocol), out duration, out sense); - if(senseBuffer.Length < 22 || (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) - return error; + if(senseBuffer.Length < 22 || (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) return error; errorRegisters.error = senseBuffer[11]; @@ -191,22 +181,20 @@ namespace DiscImageChef.Devices.Linux } internal static int SendAtaCommand(int fd, AtaRegistersLBA28 registers, - out AtaErrorRegistersLBA28 errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + out AtaErrorRegistersLBA28 errorRegisters, AtaProtocol protocol, + AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, + bool transferBlocks, out double duration, out bool sense) { duration = 0; sense = false; errorRegisters = new AtaErrorRegistersLBA28(); - if(buffer == null) - return -1; + if(buffer == null) return -1; byte[] cdb = new byte[16]; cdb[0] = (byte)ScsiCommands.AtaPassThrough16; cdb[1] = (byte)(((byte)protocol << 1) & 0x1E); - if(transferRegister != AtaTransferRegister.NoTransfer && - protocol != AtaProtocol.NonData) + if(transferRegister != AtaTransferRegister.NoTransfer && protocol != AtaProtocol.NonData) { switch(protocol) { @@ -219,8 +207,7 @@ namespace DiscImageChef.Devices.Linux break; } - if(transferBlocks) - cdb[2] |= 0x04; + if(transferBlocks) cdb[2] |= 0x04; cdb[2] |= (byte)((int)transferRegister & 0x03); } @@ -236,10 +223,10 @@ namespace DiscImageChef.Devices.Linux cdb[14] = registers.command; byte[] senseBuffer; - int error = SendScsiCommand(fd, cdb, ref buffer, out senseBuffer, timeout, AtaProtocolToScsiDirection(protocol), out duration, out sense); + int error = SendScsiCommand(fd, cdb, ref buffer, out senseBuffer, timeout, + AtaProtocolToScsiDirection(protocol), out duration, out sense); - if(senseBuffer.Length < 22 || (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) - return error; + if(senseBuffer.Length < 22 || (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) return error; errorRegisters.error = senseBuffer[11]; @@ -256,23 +243,21 @@ namespace DiscImageChef.Devices.Linux } internal static int SendAtaCommand(int fd, AtaRegistersLBA48 registers, - out AtaErrorRegistersLBA48 errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + out AtaErrorRegistersLBA48 errorRegisters, AtaProtocol protocol, + AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, + bool transferBlocks, out double duration, out bool sense) { duration = 0; sense = false; errorRegisters = new AtaErrorRegistersLBA48(); - if(buffer == null) - return -1; + if(buffer == null) return -1; byte[] cdb = new byte[16]; cdb[0] = (byte)ScsiCommands.AtaPassThrough16; cdb[1] = (byte)(((byte)protocol << 1) & 0x1E); cdb[1] |= 0x01; - if(transferRegister != AtaTransferRegister.NoTransfer && - protocol != AtaProtocol.NonData) + if(transferRegister != AtaTransferRegister.NoTransfer && protocol != AtaProtocol.NonData) { switch(protocol) { @@ -285,8 +270,7 @@ namespace DiscImageChef.Devices.Linux break; } - if(transferBlocks) - cdb[2] |= 0x04; + if(transferBlocks) cdb[2] |= 0x04; cdb[2] |= (byte)((int)transferRegister & 0x03); } @@ -307,10 +291,10 @@ namespace DiscImageChef.Devices.Linux cdb[14] = registers.command; byte[] senseBuffer; - int error = SendScsiCommand(fd, cdb, ref buffer, out senseBuffer, timeout, AtaProtocolToScsiDirection(protocol), out duration, out sense); + int error = SendScsiCommand(fd, cdb, ref buffer, out senseBuffer, timeout, + AtaProtocolToScsiDirection(protocol), out duration, out sense); - if(senseBuffer.Length < 22 || (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) - return error; + if(senseBuffer.Length < 22 || (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) return error; errorRegisters.error = senseBuffer[11]; @@ -345,14 +329,15 @@ namespace DiscImageChef.Devices.Linux /// Command argument /// Response registers /// Size of block in bytes - internal static int SendMmcCommand(int fd, MmcCommands command, bool write, bool isApplication, MmcFlags flags, uint argument, uint blockSize, uint blocks, ref byte[] buffer, out uint[] response, out double duration, out bool sense, uint timeout = 0) + internal static int SendMmcCommand(int fd, MmcCommands command, bool write, bool isApplication, MmcFlags flags, + uint argument, uint blockSize, uint blocks, ref byte[] buffer, + out uint[] response, out double duration, out bool sense, uint timeout = 0) { response = null; duration = 0; sense = false; - if(buffer == null) - return -1; + if(buffer == null) return -1; mmc_ioc_cmd io_cmd = new mmc_ioc_cmd(); @@ -380,8 +365,7 @@ namespace DiscImageChef.Devices.Linux sense |= error < 0; - if(error < 0) - error = Marshal.GetLastWin32Error(); + if(error < 0) error = Marshal.GetLastWin32Error(); Marshal.Copy(bufPtr, buffer, 0, buffer.Length); @@ -401,16 +385,14 @@ namespace DiscImageChef.Devices.Linux if(Interop.DetectOS.Is64Bit()) { long result64 = Extern.readlink64(path, buf, 4096); - if(result64 <= 0) - return null; + if(result64 <= 0) return null; resultSize = (int)result64; } else { int result = Extern.readlink(path, buf, 4096); - if(result <= 0) - return null; + if(result <= 0) return null; resultSize = result; } @@ -421,5 +403,4 @@ namespace DiscImageChef.Devices.Linux return System.Text.Encoding.ASCII.GetString(resultString); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Linux/Enums.cs b/DiscImageChef.Devices/Linux/Enums.cs index c628f1a1..52c010a4 100644 --- a/DiscImageChef.Devices/Linux/Enums.cs +++ b/DiscImageChef.Devices/Linux/Enums.cs @@ -182,5 +182,4 @@ namespace DiscImageChef.Devices.Linux /// MixedIo = 0x04 } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Linux/Extern.cs b/DiscImageChef.Devices/Linux/Extern.cs index 386e832d..36a86723 100644 --- a/DiscImageChef.Devices/Linux/Extern.cs +++ b/DiscImageChef.Devices/Linux/Extern.cs @@ -39,10 +39,7 @@ namespace DiscImageChef.Devices.Linux static class Extern { [DllImport("libc", CharSet = CharSet.Ansi, SetLastError = true)] - internal static extern int open( - string pathname, - [MarshalAs(UnmanagedType.U4)] - FileFlags flags); + internal static extern int open(string pathname, [MarshalAs(UnmanagedType.U4)] FileFlags flags); [DllImport("libc")] internal static extern int close(int fd); @@ -66,10 +63,10 @@ namespace DiscImageChef.Devices.Linux internal static extern IntPtr udev_new(); [DllImport("libudev", CharSet = CharSet.Ansi, SetLastError = true)] - internal static extern IntPtr udev_device_new_from_subsystem_sysname(IntPtr udev, string subsystem, string sysname); + internal static extern IntPtr udev_device_new_from_subsystem_sysname( + IntPtr udev, string subsystem, string sysname); [DllImport("libudev", CharSet = CharSet.Ansi, SetLastError = true)] internal static extern string udev_device_get_property_value(IntPtr udev_device, string key); } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Linux/ListDevices.cs b/DiscImageChef.Devices/Linux/ListDevices.cs index 1d47eb9c..1fb1e0c5 100644 --- a/DiscImageChef.Devices/Linux/ListDevices.cs +++ b/DiscImageChef.Devices/Linux/ListDevices.cs @@ -55,10 +55,7 @@ namespace DiscImageChef.Devices.Linux udev = Extern.udev_new(); hasUdev = udev != IntPtr.Zero; } - catch - { - hasUdev = false; - } + catch { hasUdev = false; } for(int i = 0; i < sysdevs.Length; i++) { @@ -67,11 +64,11 @@ namespace DiscImageChef.Devices.Linux if(hasUdev) { - udevDev = Extern.udev_device_new_from_subsystem_sysname(udev, "block", Path.GetFileName(sysdevs[i])); + udevDev = Extern.udev_device_new_from_subsystem_sysname(udev, "block", + Path.GetFileName(sysdevs[i])); devices[i].vendor = Extern.udev_device_get_property_value(udevDev, "ID_VENDOR"); devices[i].model = Extern.udev_device_get_property_value(udevDev, "ID_MODEL"); - if(!string.IsNullOrEmpty(devices[i].model)) - devices[i].model = devices[i].model.Replace('_', ' '); + if(!string.IsNullOrEmpty(devices[i].model)) devices[i].model = devices[i].model.Replace('_', ' '); devices[i].serial = Extern.udev_device_get_property_value(udevDev, "ID_SCSI_SERIAL"); if(string.IsNullOrEmpty(devices[i].serial)) devices[i].serial = Extern.udev_device_get_property_value(udevDev, "ID_SERIAL_SHORT"); @@ -86,7 +83,8 @@ namespace DiscImageChef.Devices.Linux else if(devices[i].path.StartsWith("/dev/loop", StringComparison.CurrentCulture)) devices[i].vendor = "Linux"; - if(File.Exists(Path.Combine(sysdevs[i], "device/model")) && (string.IsNullOrEmpty(devices[i].model) || devices[i].bus == "ata")) + if(File.Exists(Path.Combine(sysdevs[i], "device/model")) && + (string.IsNullOrEmpty(devices[i].model) || devices[i].bus == "ata")) { sr = new StreamReader(Path.Combine(sysdevs[i], "device/model"), Encoding.ASCII); devices[i].model = sr.ReadLine().Trim(); @@ -123,8 +121,7 @@ namespace DiscImageChef.Devices.Linux else if(devices[i].path.StartsWith("/dev/mmc", StringComparison.CurrentCulture)) devices[i].bus = "MMC/SD"; } - else - devices[i].bus = devices[i].bus.ToUpper(); + else devices[i].bus = devices[i].bus.ToUpper(); switch(devices[i].bus) { @@ -143,4 +140,4 @@ namespace DiscImageChef.Devices.Linux return devices; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Linux/Structs.cs b/DiscImageChef.Devices/Linux/Structs.cs index 4e7e68a9..7a1b1128 100644 --- a/DiscImageChef.Devices/Linux/Structs.cs +++ b/DiscImageChef.Devices/Linux/Structs.cs @@ -42,28 +42,28 @@ namespace DiscImageChef.Devices.Linux /// /// Always 'S' for SG v3 /// - public int interface_id; /* [i] 'S' (required) */ - public ScsiIoctlDirection dxfer_direction; /* [i] */ - public byte cmd_len; /* [i] */ - public byte mx_sb_len; /* [i] */ + public int interface_id; /* [i] 'S' (required) */ + public ScsiIoctlDirection dxfer_direction; /* [i] */ + public byte cmd_len; /* [i] */ + public byte mx_sb_len; /* [i] */ public ushort iovec_count; /* [i] */ - public uint dxfer_len; /* [i] */ - public IntPtr dxferp; /* [i], [*io] */ - public IntPtr cmdp; /* [i], [*i] */ - public IntPtr sbp; /* [i], [*o] */ - public uint timeout; /* [i] unit: millisecs */ - public uint flags; /* [i] */ - public int pack_id; /* [i->o] */ - public IntPtr usr_ptr; /* [i->o] */ - public byte status; /* [o] */ - public byte masked_status;/* [o] */ - public byte msg_status; /* [o] */ - public byte sb_len_wr; /* [o] */ + public uint dxfer_len; /* [i] */ + public IntPtr dxferp; /* [i], [*io] */ + public IntPtr cmdp; /* [i], [*i] */ + public IntPtr sbp; /* [i], [*o] */ + public uint timeout; /* [i] unit: millisecs */ + public uint flags; /* [i] */ + public int pack_id; /* [i->o] */ + public IntPtr usr_ptr; /* [i->o] */ + public byte status; /* [o] */ + public byte masked_status; /* [o] */ + public byte msg_status; /* [o] */ + public byte sb_len_wr; /* [o] */ public ushort host_status; /* [o] */ - public ushort driver_status;/* [o] */ - public int resid; /* [o] */ - public uint duration; /* [o] */ - public SgInfo info; /* [o] */ + public ushort driver_status; /* [o] */ + public int resid; /* [o] */ + public uint duration; /* [o] */ + public SgInfo info; /* [o] */ } [StructLayout(LayoutKind.Sequential)] @@ -82,8 +82,7 @@ namespace DiscImageChef.Devices.Linux /// /// CMD response /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public uint[] response; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] response; public MmcFlags flags; public uint blksz; public uint blocks; @@ -122,5 +121,4 @@ namespace DiscImageChef.Devices.Linux /// public ulong data_ptr; } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Properties/AssemblyInfo.cs b/DiscImageChef.Devices/Properties/AssemblyInfo.cs index b0bbf610..6cdb91b3 100644 --- a/DiscImageChef.Devices/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Devices/Properties/AssemblyInfo.cs @@ -54,5 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Devices/Windows/Command.cs b/DiscImageChef.Devices/Windows/Command.cs index a2059982..48882167 100644 --- a/DiscImageChef.Devices/Windows/Command.cs +++ b/DiscImageChef.Devices/Windows/Command.cs @@ -53,14 +53,15 @@ namespace DiscImageChef.Devices.Windows /// SCSI command transfer direction /// Time it took to execute the command in milliseconds /// True if SCSI error returned non-OK status and contains SCSI sense - internal static int SendScsiCommand(SafeFileHandle fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiIoctlDirection direction, out double duration, out bool sense) + internal static int SendScsiCommand(SafeFileHandle fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, + uint timeout, ScsiIoctlDirection direction, out double duration, + out bool sense) { senseBuffer = null; duration = 0; sense = false; - if(buffer == null) - return -1; + if(buffer == null) return -1; ScsiPassThroughDirectAndSenseBuffer sptd_sb = new ScsiPassThroughDirectAndSenseBuffer(); sptd_sb.sptd = new ScsiPassThroughDirect(); @@ -82,12 +83,12 @@ namespace DiscImageChef.Devices.Windows Marshal.Copy(buffer, 0, sptd_sb.sptd.DataBuffer, buffer.Length); DateTime start = DateTime.Now; - bool hasError = !Extern.DeviceIoControlScsi(fd, WindowsIoctl.IOCTL_SCSI_PASS_THROUGH_DIRECT, ref sptd_sb, (uint)Marshal.SizeOf(sptd_sb), ref sptd_sb, - (uint)Marshal.SizeOf(sptd_sb), ref k, IntPtr.Zero); + bool hasError = !Extern.DeviceIoControlScsi(fd, WindowsIoctl.IOCTL_SCSI_PASS_THROUGH_DIRECT, ref sptd_sb, + (uint)Marshal.SizeOf(sptd_sb), ref sptd_sb, + (uint)Marshal.SizeOf(sptd_sb), ref k, IntPtr.Zero); DateTime end = DateTime.Now; - if(hasError) - error = Marshal.GetLastWin32Error(); + if(hasError) error = Marshal.GetLastWin32Error(); Marshal.Copy(sptd_sb.sptd.DataBuffer, buffer, 0, buffer.Length); @@ -103,15 +104,15 @@ namespace DiscImageChef.Devices.Windows return error; } - internal static int SendAtaCommand(SafeFileHandle fd, AtaRegistersCHS registers, out AtaErrorRegistersCHS errorRegisters, - AtaProtocol protocol, ref byte[] buffer, uint timeout, out double duration, out bool sense) + internal static int SendAtaCommand(SafeFileHandle fd, AtaRegistersCHS registers, + out AtaErrorRegistersCHS errorRegisters, AtaProtocol protocol, + ref byte[] buffer, uint timeout, out double duration, out bool sense) { duration = 0; sense = false; errorRegisters = new AtaErrorRegistersCHS(); - if(buffer == null) - return -1; + if(buffer == null) return -1; uint offsetForBuffer = (uint)(Marshal.SizeOf(typeof(AtaPassThroughDirect)) + Marshal.SizeOf(typeof(uint))); @@ -138,7 +139,7 @@ namespace DiscImageChef.Devices.Windows dataBuffer = new byte[64 * 512] }; - if (protocol == AtaProtocol.PioIn || protocol == AtaProtocol.UDmaIn || protocol == AtaProtocol.Dma) + if(protocol == AtaProtocol.PioIn || protocol == AtaProtocol.UDmaIn || protocol == AtaProtocol.Dma) aptd_buf.aptd.AtaFlags = AtaFlags.DataIn; else if(protocol == AtaProtocol.PioOut || protocol == AtaProtocol.UDmaOut) aptd_buf.aptd.AtaFlags = AtaFlags.DataOut; @@ -163,12 +164,12 @@ namespace DiscImageChef.Devices.Windows Array.Copy(buffer, 0, aptd_buf.dataBuffer, 0, buffer.Length); DateTime start = DateTime.Now; - sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd_buf, (uint)Marshal.SizeOf(aptd_buf), ref aptd_buf, - (uint)Marshal.SizeOf(aptd_buf), ref k, IntPtr.Zero); + sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd_buf, + (uint)Marshal.SizeOf(aptd_buf), ref aptd_buf, + (uint)Marshal.SizeOf(aptd_buf), ref k, IntPtr.Zero); DateTime end = DateTime.Now; - if(sense) - error = Marshal.GetLastWin32Error(); + if(sense) error = Marshal.GetLastWin32Error(); Array.Copy(aptd_buf.dataBuffer, 0, buffer, 0, buffer.Length); @@ -188,15 +189,15 @@ namespace DiscImageChef.Devices.Windows return error; } - internal static int SendAtaCommand(SafeFileHandle fd, AtaRegistersLBA28 registers, out AtaErrorRegistersLBA28 errorRegisters, - AtaProtocol protocol, ref byte[] buffer, uint timeout, out double duration, out bool sense) + internal static int SendAtaCommand(SafeFileHandle fd, AtaRegistersLBA28 registers, + out AtaErrorRegistersLBA28 errorRegisters, AtaProtocol protocol, + ref byte[] buffer, uint timeout, out double duration, out bool sense) { duration = 0; sense = false; errorRegisters = new AtaErrorRegistersLBA28(); - if(buffer == null) - return -1; + if(buffer == null) return -1; uint offsetForBuffer = (uint)(Marshal.SizeOf(typeof(AtaPassThroughDirect)) + Marshal.SizeOf(typeof(uint))); @@ -248,12 +249,12 @@ namespace DiscImageChef.Devices.Windows Array.Copy(buffer, 0, aptd_buf.dataBuffer, 0, buffer.Length); DateTime start = DateTime.Now; - sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd_buf, (uint)Marshal.SizeOf(aptd_buf), ref aptd_buf, - (uint)Marshal.SizeOf(aptd_buf), ref k, IntPtr.Zero); + sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd_buf, + (uint)Marshal.SizeOf(aptd_buf), ref aptd_buf, + (uint)Marshal.SizeOf(aptd_buf), ref k, IntPtr.Zero); DateTime end = DateTime.Now; - if(sense) - error = Marshal.GetLastWin32Error(); + if(sense) error = Marshal.GetLastWin32Error(); Array.Copy(aptd_buf.dataBuffer, 0, buffer, 0, buffer.Length); @@ -273,15 +274,15 @@ namespace DiscImageChef.Devices.Windows return error; } - internal static int SendAtaCommand(SafeFileHandle fd, AtaRegistersLBA48 registers, out AtaErrorRegistersLBA48 errorRegisters, - AtaProtocol protocol, ref byte[] buffer, uint timeout, out double duration, out bool sense) + internal static int SendAtaCommand(SafeFileHandle fd, AtaRegistersLBA48 registers, + out AtaErrorRegistersLBA48 errorRegisters, AtaProtocol protocol, + ref byte[] buffer, uint timeout, out double duration, out bool sense) { duration = 0; sense = false; errorRegisters = new AtaErrorRegistersLBA48(); - if(buffer == null) - return -1; + if(buffer == null) return -1; uint offsetForBuffer = (uint)(Marshal.SizeOf(typeof(AtaPassThroughDirect)) + Marshal.SizeOf(typeof(uint))); @@ -293,14 +294,15 @@ namespace DiscImageChef.Devices.Windows DataBuffer = (IntPtr)offsetForBuffer, Length = (ushort)Marshal.SizeOf(typeof(AtaPassThroughDirect)), DataTransferLength = (uint)buffer.Length, - PreviousTaskFile = new AtaTaskFile - { - CylinderHigh = (byte)((registers.lbaHigh & 0xFF00) >> 8), - CylinderLow = (byte)((registers.lbaMid & 0xFF00) >> 8), - Features = (byte)((registers.feature & 0xFF00) >> 8), - SectorCount = (byte)((registers.sectorCount & 0xFF00) >> 8), - SectorNumber = (byte)((registers.lbaLow & 0xFF00) >> 8) - }, + PreviousTaskFile = + new AtaTaskFile + { + CylinderHigh = (byte)((registers.lbaHigh & 0xFF00) >> 8), + CylinderLow = (byte)((registers.lbaMid & 0xFF00) >> 8), + Features = (byte)((registers.feature & 0xFF00) >> 8), + SectorCount = (byte)((registers.sectorCount & 0xFF00) >> 8), + SectorNumber = (byte)((registers.lbaLow & 0xFF00) >> 8) + }, CurrentTaskFile = new AtaTaskFile { Command = registers.command, @@ -340,21 +342,25 @@ namespace DiscImageChef.Devices.Windows Array.Copy(buffer, 0, aptd_buf.dataBuffer, 0, buffer.Length); DateTime start = DateTime.Now; - sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd_buf, (uint)Marshal.SizeOf(aptd_buf), ref aptd_buf, - (uint)Marshal.SizeOf(aptd_buf), ref k, IntPtr.Zero); + sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd_buf, + (uint)Marshal.SizeOf(aptd_buf), ref aptd_buf, + (uint)Marshal.SizeOf(aptd_buf), ref k, IntPtr.Zero); DateTime end = DateTime.Now; - if(sense) - error = Marshal.GetLastWin32Error(); + if(sense) error = Marshal.GetLastWin32Error(); Array.Copy(aptd_buf.dataBuffer, 0, buffer, 0, buffer.Length); duration = (end - start).TotalMilliseconds; - errorRegisters.sectorCount = (ushort)((aptd_buf.aptd.PreviousTaskFile.SectorCount << 8) + aptd_buf.aptd.CurrentTaskFile.SectorCount); - errorRegisters.lbaLow = (ushort)((aptd_buf.aptd.PreviousTaskFile.SectorNumber << 8) + aptd_buf.aptd.CurrentTaskFile.SectorNumber); - errorRegisters.lbaMid = (ushort)((aptd_buf.aptd.PreviousTaskFile.CylinderLow << 8) + aptd_buf.aptd.CurrentTaskFile.CylinderLow); - errorRegisters.lbaHigh = (ushort)((aptd_buf.aptd.PreviousTaskFile.CylinderHigh << 8) + aptd_buf.aptd.CurrentTaskFile.CylinderHigh); + errorRegisters.sectorCount = (ushort)((aptd_buf.aptd.PreviousTaskFile.SectorCount << 8) + + aptd_buf.aptd.CurrentTaskFile.SectorCount); + errorRegisters.lbaLow = (ushort)((aptd_buf.aptd.PreviousTaskFile.SectorNumber << 8) + + aptd_buf.aptd.CurrentTaskFile.SectorNumber); + errorRegisters.lbaMid = (ushort)((aptd_buf.aptd.PreviousTaskFile.CylinderLow << 8) + + aptd_buf.aptd.CurrentTaskFile.CylinderLow); + errorRegisters.lbaHigh = (ushort)((aptd_buf.aptd.PreviousTaskFile.CylinderHigh << 8) + + aptd_buf.aptd.CurrentTaskFile.CylinderHigh); errorRegisters.command = aptd_buf.aptd.CurrentTaskFile.Command; errorRegisters.deviceHead = aptd_buf.aptd.CurrentTaskFile.DeviceHead; errorRegisters.error = aptd_buf.aptd.CurrentTaskFile.Error; @@ -365,15 +371,15 @@ namespace DiscImageChef.Devices.Windows return error; } - internal static int SendIdeCommand(SafeFileHandle fd, AtaRegistersCHS registers, out AtaErrorRegistersCHS errorRegisters, - AtaProtocol protocol, ref byte[] buffer, uint timeout, out double duration, out bool sense) + internal static int SendIdeCommand(SafeFileHandle fd, AtaRegistersCHS registers, + out AtaErrorRegistersCHS errorRegisters, AtaProtocol protocol, + ref byte[] buffer, uint timeout, out double duration, out bool sense) { duration = 0; sense = false; errorRegisters = new AtaErrorRegistersCHS(); - if(buffer == null || buffer.Length > 512) - return -1; + if(buffer == null || buffer.Length > 512) return -1; IdePassThroughDirect iptd = new IdePassThroughDirect { @@ -397,12 +403,12 @@ namespace DiscImageChef.Devices.Windows Array.Copy(buffer, 0, iptd.DataBuffer, 0, buffer.Length); DateTime start = DateTime.Now; - sense = !Extern.DeviceIoControlIde(fd, WindowsIoctl.IOCTL_IDE_PASS_THROUGH, ref iptd, (uint)Marshal.SizeOf(iptd), ref iptd, - (uint)Marshal.SizeOf(iptd), ref k, IntPtr.Zero); + sense = !Extern.DeviceIoControlIde(fd, WindowsIoctl.IOCTL_IDE_PASS_THROUGH, ref iptd, + (uint)Marshal.SizeOf(iptd), ref iptd, (uint)Marshal.SizeOf(iptd), ref k, + IntPtr.Zero); DateTime end = DateTime.Now; - if(sense) - error = Marshal.GetLastWin32Error(); + if(sense) error = Marshal.GetLastWin32Error(); buffer = new byte[k - 12]; Array.Copy(iptd.DataBuffer, 0, buffer, 0, buffer.Length); @@ -423,15 +429,15 @@ namespace DiscImageChef.Devices.Windows return error; } - internal static int SendIdeCommand(SafeFileHandle fd, AtaRegistersLBA28 registers, out AtaErrorRegistersLBA28 errorRegisters, - AtaProtocol protocol, ref byte[] buffer, uint timeout, out double duration, out bool sense) + internal static int SendIdeCommand(SafeFileHandle fd, AtaRegistersLBA28 registers, + out AtaErrorRegistersLBA28 errorRegisters, AtaProtocol protocol, + ref byte[] buffer, uint timeout, out double duration, out bool sense) { duration = 0; sense = false; errorRegisters = new AtaErrorRegistersLBA28(); - if(buffer == null) - return -1; + if(buffer == null) return -1; uint offsetForBuffer = (uint)(Marshal.SizeOf(typeof(AtaPassThroughDirect)) + Marshal.SizeOf(typeof(uint))); @@ -457,12 +463,12 @@ namespace DiscImageChef.Devices.Windows Array.Copy(buffer, 0, iptd.DataBuffer, 0, buffer.Length); DateTime start = DateTime.Now; - sense = !Extern.DeviceIoControlIde(fd, WindowsIoctl.IOCTL_IDE_PASS_THROUGH, ref iptd, (uint)Marshal.SizeOf(iptd), ref iptd, - (uint)Marshal.SizeOf(iptd), ref k, IntPtr.Zero); + sense = !Extern.DeviceIoControlIde(fd, WindowsIoctl.IOCTL_IDE_PASS_THROUGH, ref iptd, + (uint)Marshal.SizeOf(iptd), ref iptd, (uint)Marshal.SizeOf(iptd), ref k, + IntPtr.Zero); DateTime end = DateTime.Now; - if(sense) - error = Marshal.GetLastWin32Error(); + if(sense) error = Marshal.GetLastWin32Error(); buffer = new byte[k - 12]; Array.Copy(iptd.DataBuffer, 0, buffer, 0, buffer.Length); @@ -486,13 +492,11 @@ namespace DiscImageChef.Devices.Windows internal static uint GetDeviceNumber(SafeFileHandle deviceHandle) { StorageDeviceNumber sdn = new StorageDeviceNumber(); - sdn.deviceNumber = - 1; + sdn.deviceNumber = -1; uint k = 0; - if(!Extern.DeviceIoControlGetDeviceNumber(deviceHandle, WindowsIoctl.IOCTL_STORAGE_GET_DEVICE_NUMBER, IntPtr.Zero, - 0, ref sdn, (uint)Marshal.SizeOf(sdn), ref k, IntPtr.Zero)) - { - return uint.MaxValue; - } + if(!Extern.DeviceIoControlGetDeviceNumber(deviceHandle, WindowsIoctl.IOCTL_STORAGE_GET_DEVICE_NUMBER, + IntPtr.Zero, 0, ref sdn, (uint)Marshal.SizeOf(sdn), ref k, + IntPtr.Zero)) { return uint.MaxValue; } return (uint)sdn.deviceNumber; } @@ -501,28 +505,27 @@ namespace DiscImageChef.Devices.Windows { uint devNumber = GetDeviceNumber(fd); - if(devNumber == uint.MaxValue) - return null; + if(devNumber == uint.MaxValue) return null; SafeFileHandle hDevInfo = Extern.SetupDiGetClassDevs(ref Consts.GUID_DEVINTERFACE_DISK, IntPtr.Zero, - IntPtr.Zero, DeviceGetClassFlags.Present | DeviceGetClassFlags.DeviceInterface); + IntPtr.Zero, + DeviceGetClassFlags.Present | + DeviceGetClassFlags.DeviceInterface); - if(hDevInfo.IsInvalid) - return null; + if(hDevInfo.IsInvalid) return null; uint index = 0; DeviceInterfaceData spdid = new DeviceInterfaceData(); spdid.cbSize = Marshal.SizeOf(spdid); - + byte[] buffer; - + while(true) { buffer = new byte[2048]; - + if(!Extern.SetupDiEnumDeviceInterfaces(hDevInfo, IntPtr.Zero, ref Consts.GUID_DEVINTERFACE_DISK, index, - ref spdid)) - break; + ref spdid)) break; uint size = 0; @@ -530,13 +533,16 @@ namespace DiscImageChef.Devices.Windows if(size > 0 && size < buffer.Length) { - buffer[0] = (byte)(IntPtr.Size == 8 ? IntPtr.Size : IntPtr.Size + Marshal.SystemDefaultCharSize); // Funny... + buffer[0] = (byte)(IntPtr.Size == 8 + ? IntPtr.Size + : IntPtr.Size + Marshal.SystemDefaultCharSize); // Funny... IntPtr pspdidd = Marshal.AllocHGlobal(buffer.Length); Marshal.Copy(buffer, 0, pspdidd, buffer.Length); bool result = - Extern.SetupDiGetDeviceInterfaceDetail(hDevInfo, ref spdid, pspdidd, size, ref size, IntPtr.Zero); + Extern.SetupDiGetDeviceInterfaceDetail(hDevInfo, ref spdid, pspdidd, size, ref size, + IntPtr.Zero); buffer = new byte[size]; Marshal.Copy(pspdidd, buffer, 0, buffer.Length); @@ -546,7 +552,7 @@ namespace DiscImageChef.Devices.Windows { string devicePath = Encoding.Unicode.GetString(buffer, 4, (int)size - 4); SafeFileHandle hDrive = Extern.CreateFile(devicePath, 0, FileShare.Read | FileShare.Write, - IntPtr.Zero, FileMode.OpenExisting, 0, IntPtr.Zero); + IntPtr.Zero, FileMode.OpenExisting, 0, IntPtr.Zero); if(!hDrive.IsInvalid) { @@ -558,11 +564,11 @@ namespace DiscImageChef.Devices.Windows return devicePath; } } - + Extern.CloseHandle(hDrive); } } - + index++; } @@ -575,8 +581,8 @@ namespace DiscImageChef.Devices.Windows SffdiskQueryDeviceProtocolData queryData1 = new SffdiskQueryDeviceProtocolData(); queryData1.size = (ushort)Marshal.SizeOf(queryData1); uint bytesReturned; - Extern.DeviceIoControl(fd, WindowsIoctl.IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL, IntPtr.Zero, 0, - ref queryData1, queryData1.size, out bytesReturned, IntPtr.Zero); + Extern.DeviceIoControl(fd, WindowsIoctl.IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL, IntPtr.Zero, 0, ref queryData1, + queryData1.size, out bytesReturned, IntPtr.Zero); return queryData1.protocolGuid.Equals(Consts.GUID_SFF_PROTOCOL_SD); } @@ -598,8 +604,9 @@ namespace DiscImageChef.Devices.Windows /// Response registers /// Size of block in bytes internal static int SendMmcCommand(SafeFileHandle fd, MmcCommands command, bool write, bool isApplication, - MmcFlags flags, uint argument, uint blockSize, uint blocks, ref byte[] buffer, out uint[] response, - out double duration, out bool sense, uint timeout = 0) + MmcFlags flags, uint argument, uint blockSize, uint blocks, + ref byte[] buffer, out uint[] response, out double duration, out bool sense, + uint timeout = 0) { SffdiskDeviceCommandData commandData = new SffdiskDeviceCommandData(); SdCmdDescriptor commandDescriptor = new SdCmdDescriptor(); @@ -610,7 +617,9 @@ namespace DiscImageChef.Devices.Windows commandDescriptor.commandCode = (byte)command; commandDescriptor.cmdClass = isApplication ? SdCommandClass.AppCmd : SdCommandClass.Standard; commandDescriptor.transferDirection = write ? SdTransferDirection.Write : SdTransferDirection.Read; - commandDescriptor.transferType = flags.HasFlag(MmcFlags.CommandADTC) ? SdTransferType.SingleBlock : SdTransferType.CmdOnly; + commandDescriptor.transferType = flags.HasFlag(MmcFlags.CommandADTC) + ? SdTransferType.SingleBlock + : SdTransferType.CmdOnly; commandDescriptor.responseType = 0; if(flags.HasFlag(MmcFlags.Response_R1) || flags.HasFlag(MmcFlags.ResponseSPI_R1)) @@ -625,10 +634,10 @@ namespace DiscImageChef.Devices.Windows commandDescriptor.responseType = SdResponseType.R4; if(flags.HasFlag(MmcFlags.Response_R5) || flags.HasFlag(MmcFlags.ResponseSPI_R5)) commandDescriptor.responseType = SdResponseType.R5; - if(flags.HasFlag(MmcFlags.Response_R6)) - commandDescriptor.responseType = SdResponseType.R6; + if(flags.HasFlag(MmcFlags.Response_R6)) commandDescriptor.responseType = SdResponseType.R6; - byte[] command_b = new byte[commandData.size + commandData.protocolArgumentSize + commandData.deviceDataBufferSize]; + byte[] command_b = new byte[commandData.size + commandData.protocolArgumentSize + + commandData.deviceDataBufferSize]; IntPtr hBuf = Marshal.AllocHGlobal(command_b.Length); Marshal.StructureToPtr(commandData, hBuf, true); IntPtr descriptorOffset = new IntPtr(hBuf.ToInt32() + commandData.size); @@ -640,20 +649,19 @@ namespace DiscImageChef.Devices.Windows int error = 0; DateTime start = DateTime.Now; sense = !Extern.DeviceIoControl(fd, WindowsIoctl.IOCTL_SFFDISK_DEVICE_COMMAND, command_b, - (uint)command_b.Length, command_b, (uint)command_b.Length, out bytesReturned, IntPtr.Zero); + (uint)command_b.Length, command_b, (uint)command_b.Length, + out bytesReturned, IntPtr.Zero); DateTime end = DateTime.Now; - if(sense) - error = Marshal.GetLastWin32Error(); + if(sense) error = Marshal.GetLastWin32Error(); buffer = new byte[blockSize * blocks]; Buffer.BlockCopy(command_b, command_b.Length - buffer.Length, buffer, 0, buffer.Length); - + response = new uint[4]; duration = (end - start).TotalMilliseconds; return error; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Windows/Enums.cs b/DiscImageChef.Devices/Windows/Enums.cs index 60322e38..da0099be 100644 --- a/DiscImageChef.Devices/Windows/Enums.cs +++ b/DiscImageChef.Devices/Windows/Enums.cs @@ -343,8 +343,8 @@ namespace DiscImageChef.Devices.Windows IOCTL_STORAGE_QUERY_PROPERTY = 0x2D1400, IOCTL_IDE_PASS_THROUGH = 0x4D028, IOCTL_STORAGE_GET_DEVICE_NUMBER = 0x2D1080, - IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL = 0x71E80, - IOCTL_SFFDISK_DEVICE_COMMAND = 0x79E84, + IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL = 0x71E80, + IOCTL_SFFDISK_DEVICE_COMMAND = 0x79E84, } [Flags] @@ -423,7 +423,7 @@ namespace DiscImageChef.Devices.Windows FileBackedVirtual = 0xF, NVMe = 0x11, } - + [Flags] enum DeviceGetClassFlags : uint { @@ -448,7 +448,7 @@ namespace DiscImageChef.Devices.Windows /// DeviceInterface = 0x10, } - + public enum SdCommandClass : uint { Standard, @@ -492,10 +492,11 @@ namespace DiscImageChef.Devices.Windows UnlockChannel, DeviceCommand }; - + static class Consts { public static Guid GUID_SFF_PROTOCOL_SD = new Guid("AD7536A8-D055-4C40-AA4D-96312DDB6B38"); - public static Guid GUID_DEVINTERFACE_DISK = new Guid(0x53F56307, 0xB6BF, 0x11D0, 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B); + public static Guid GUID_DEVINTERFACE_DISK = + new Guid(0x53F56307, 0xB6BF, 0x11D0, 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B); } -} +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Windows/Extern.cs b/DiscImageChef.Devices/Windows/Extern.cs index ed6562d7..3e80bc66 100644 --- a/DiscImageChef.Devices/Windows/Extern.cs +++ b/DiscImageChef.Devices/Windows/Extern.cs @@ -40,123 +40,77 @@ namespace DiscImageChef.Devices.Windows static class Extern { [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] - internal static extern SafeFileHandle CreateFile( - [MarshalAs(UnmanagedType.LPTStr)] string filename, - [MarshalAs(UnmanagedType.U4)] FileAccess access, - [MarshalAs(UnmanagedType.U4)] FileShare share, - IntPtr securityAttributes, // optional SECURITY_ATTRIBUTES struct or IntPtr.Zero - [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, - [MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes, - IntPtr templateFile); + internal static extern SafeFileHandle CreateFile([MarshalAs(UnmanagedType.LPTStr)] string filename, + [MarshalAs(UnmanagedType.U4)] FileAccess access, + [MarshalAs(UnmanagedType.U4)] FileShare share, + IntPtr securityAttributes, // optional SECURITY_ATTRIBUTES struct or IntPtr.Zero + [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, + [MarshalAs(UnmanagedType.U4)] + FileAttributes flagsAndAttributes, IntPtr templateFile); [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)] - internal static extern bool DeviceIoControlScsi( - SafeFileHandle hDevice, - WindowsIoctl IoControlCode, - ref ScsiPassThroughDirectAndSenseBuffer InBuffer, - uint nInBufferSize, - ref ScsiPassThroughDirectAndSenseBuffer OutBuffer, - uint nOutBufferSize, - ref uint pBytesReturned, - IntPtr Overlapped - ); + internal static extern bool DeviceIoControlScsi(SafeFileHandle hDevice, WindowsIoctl IoControlCode, + ref ScsiPassThroughDirectAndSenseBuffer InBuffer, + uint nInBufferSize, + ref ScsiPassThroughDirectAndSenseBuffer OutBuffer, + uint nOutBufferSize, ref uint pBytesReturned, + IntPtr Overlapped); [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)] - internal static extern bool DeviceIoControlAta( - SafeFileHandle hDevice, - WindowsIoctl IoControlCode, - ref AtaPassThroughDirectWithBuffer InBuffer, - uint nInBufferSize, - ref AtaPassThroughDirectWithBuffer OutBuffer, - uint nOutBufferSize, - ref uint pBytesReturned, - IntPtr Overlapped - ); + internal static extern bool DeviceIoControlAta(SafeFileHandle hDevice, WindowsIoctl IoControlCode, + ref AtaPassThroughDirectWithBuffer InBuffer, uint nInBufferSize, + ref AtaPassThroughDirectWithBuffer OutBuffer, + uint nOutBufferSize, ref uint pBytesReturned, IntPtr Overlapped); [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)] - internal static extern bool DeviceIoControlStorageQuery( - SafeFileHandle hDevice, - WindowsIoctl IoControlCode, - ref StoragePropertyQuery InBuffer, - uint nInBufferSize, - IntPtr OutBuffer, - uint nOutBufferSize, - ref uint pBytesReturned, - IntPtr Overlapped - ); + internal static extern bool DeviceIoControlStorageQuery(SafeFileHandle hDevice, WindowsIoctl IoControlCode, + ref StoragePropertyQuery InBuffer, uint nInBufferSize, + IntPtr OutBuffer, uint nOutBufferSize, + ref uint pBytesReturned, IntPtr Overlapped); [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)] - internal static extern bool DeviceIoControlIde( - SafeFileHandle hDevice, - WindowsIoctl IoControlCode, - ref IdePassThroughDirect InBuffer, - uint nInBufferSize, - ref IdePassThroughDirect OutBuffer, - uint nOutBufferSize, - ref uint pBytesReturned, - IntPtr Overlapped - ); + internal static extern bool DeviceIoControlIde(SafeFileHandle hDevice, WindowsIoctl IoControlCode, + ref IdePassThroughDirect InBuffer, uint nInBufferSize, + ref IdePassThroughDirect OutBuffer, uint nOutBufferSize, + ref uint pBytesReturned, IntPtr Overlapped); [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)] - internal static extern bool DeviceIoControlGetDeviceNumber( - SafeFileHandle hDevice, - WindowsIoctl IoControlCode, - IntPtr InBuffer, - uint nInBufferSize, - ref StorageDeviceNumber OutBuffer, - uint nOutBufferSize, - ref uint pBytesReturned, - IntPtr Overlapped - ); + internal static extern bool DeviceIoControlGetDeviceNumber(SafeFileHandle hDevice, WindowsIoctl IoControlCode, + IntPtr InBuffer, uint nInBufferSize, + ref StorageDeviceNumber OutBuffer, + uint nOutBufferSize, ref uint pBytesReturned, + IntPtr Overlapped); [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)] - internal static extern bool DeviceIoControl( - SafeFileHandle hDevice, - WindowsIoctl IoControlCode, - IntPtr InBuffer, - uint nInBufferSize, - ref SffdiskQueryDeviceProtocolData OutBuffer, - uint nOutBufferSize, - out uint pBytesReturned, - IntPtr Overlapped - ); + internal static extern bool DeviceIoControl(SafeFileHandle hDevice, WindowsIoctl IoControlCode, IntPtr InBuffer, + uint nInBufferSize, ref SffdiskQueryDeviceProtocolData OutBuffer, + uint nOutBufferSize, out uint pBytesReturned, IntPtr Overlapped); [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)] internal static extern bool DeviceIoControl(SafeFileHandle hDevice, WindowsIoctl IoControlCode, byte[] InBuffer, - uint nInBufferSize, byte[] OutBuffer, uint nOutBufferSize, out uint pBytesReturned, IntPtr Overlapped); + uint nInBufferSize, byte[] OutBuffer, uint nOutBufferSize, + out uint pBytesReturned, IntPtr Overlapped); [DllImport("setupapi.dll", CharSet = CharSet.Auto)] - internal static extern SafeFileHandle SetupDiGetClassDevs( - ref Guid ClassGuid, - IntPtr Enumerator, - IntPtr hwndParent, - DeviceGetClassFlags Flags - ); - + internal static extern SafeFileHandle SetupDiGetClassDevs(ref Guid ClassGuid, IntPtr Enumerator, + IntPtr hwndParent, DeviceGetClassFlags Flags); + [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern bool SetupDiEnumDeviceInterfaces( - SafeFileHandle hDevInfo, - IntPtr devInfo, - ref Guid interfaceClassGuid, - uint memberIndex, - ref DeviceInterfaceData deviceInterfaceData - ); - + public static extern bool SetupDiEnumDeviceInterfaces(SafeFileHandle hDevInfo, IntPtr devInfo, + ref Guid interfaceClassGuid, uint memberIndex, + ref DeviceInterfaceData deviceInterfaceData); + [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern bool SetupDiGetDeviceInterfaceDetail( - SafeFileHandle hDevInfo, - ref DeviceInterfaceData deviceInterfaceData, - IntPtr deviceInterfaceDetailData, - UInt32 deviceInterfaceDetailDataSize, - ref UInt32 requiredSize, - IntPtr deviceInfoData - ); - + public static extern bool SetupDiGetDeviceInterfaceDetail(SafeFileHandle hDevInfo, + ref DeviceInterfaceData deviceInterfaceData, + IntPtr deviceInterfaceDetailData, + UInt32 deviceInterfaceDetailDataSize, + ref UInt32 requiredSize, IntPtr deviceInfoData); + [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern bool SetupDiDestroyDeviceInfoList(SafeFileHandle hDevInfo); [DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] internal static extern bool CloseHandle(SafeFileHandle hDevice); } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Windows/ListDevices.cs b/DiscImageChef.Devices/Windows/ListDevices.cs index 068421dc..ee3d0b8d 100644 --- a/DiscImageChef.Devices/Windows/ListDevices.cs +++ b/DiscImageChef.Devices/Windows/ListDevices.cs @@ -47,23 +47,21 @@ namespace DiscImageChef.Devices.Windows try { - ManagementObjectSearcher mgmtObjSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive"); + ManagementObjectSearcher mgmtObjSearcher = + new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive"); ManagementObjectCollection objCol = mgmtObjSearcher.Get(); - foreach (ManagementObject drive in objCol) - DeviceIDs.Add((string)drive["DeviceID"]); + foreach(ManagementObject drive in objCol) DeviceIDs.Add((string)drive["DeviceID"]); mgmtObjSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_TapeDrive"); objCol = mgmtObjSearcher.Get(); - foreach (ManagementObject drive in objCol) - DeviceIDs.Add((string)drive["DeviceID"]); + foreach(ManagementObject drive in objCol) DeviceIDs.Add((string)drive["DeviceID"]); mgmtObjSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_CDROMDrive"); objCol = mgmtObjSearcher.Get(); - foreach (ManagementObject drive in objCol) - DeviceIDs.Add((string)drive["Drive"]); + foreach(ManagementObject drive in objCol) DeviceIDs.Add((string)drive["Drive"]); } catch(Exception ex) { @@ -76,15 +74,14 @@ namespace DiscImageChef.Devices.Windows List dev_list = new List(); - foreach (string devId in DeviceIDs) + foreach(string devId in DeviceIDs) { string physId = devId; // TODO: This can be done better - if (devId.Length == 2 && devId[1] == ':') - physId = "\\\\?\\" + devId; - SafeFileHandle fd = Extern.CreateFile(physId, 0, FileShare.Read | FileShare.Write, IntPtr.Zero, FileMode.OpenExisting, 0, IntPtr.Zero); - if (fd.IsInvalid) - continue; + if(devId.Length == 2 && devId[1] == ':') physId = "\\\\?\\" + devId; + SafeFileHandle fd = Extern.CreateFile(physId, 0, FileShare.Read | FileShare.Write, IntPtr.Zero, + FileMode.OpenExisting, 0, IntPtr.Zero); + if(fd.IsInvalid) continue; StoragePropertyQuery query = new StoragePropertyQuery(); query.PropertyId = StoragePropertyId.Device; @@ -100,15 +97,15 @@ namespace DiscImageChef.Devices.Windows uint returned = 0; int error = 0; - bool hasError = !Extern.DeviceIoControlStorageQuery(fd, WindowsIoctl.IOCTL_STORAGE_QUERY_PROPERTY, ref query, (uint)Marshal.SizeOf(query), descriptorPtr, 1000, ref returned, IntPtr.Zero); + bool hasError = !Extern.DeviceIoControlStorageQuery(fd, WindowsIoctl.IOCTL_STORAGE_QUERY_PROPERTY, + ref query, (uint)Marshal.SizeOf(query), + descriptorPtr, 1000, ref returned, IntPtr.Zero); - if (hasError) - error = Marshal.GetLastWin32Error(); + if(hasError) error = Marshal.GetLastWin32Error(); Marshal.Copy(descriptorPtr, descriptor_b, 0, 1000); - if (hasError && error != 0) - continue; + if(hasError && error != 0) continue; StorageDeviceDescriptor descriptor = new StorageDeviceDescriptor(); descriptor.Version = BitConverter.ToUInt32(descriptor_b, 0); @@ -116,7 +113,7 @@ namespace DiscImageChef.Devices.Windows descriptor.DeviceType = descriptor_b[8]; descriptor.DeviceTypeModifier = descriptor_b[9]; descriptor.RemovableMedia = BitConverter.ToBoolean(descriptor_b, 10); - descriptor.CommandQueueing= BitConverter.ToBoolean(descriptor_b, 11); + descriptor.CommandQueueing = BitConverter.ToBoolean(descriptor_b, 11); descriptor.VendorIdOffset = BitConverter.ToUInt32(descriptor_b, 12); descriptor.ProductIdOffset = BitConverter.ToUInt32(descriptor_b, 16); descriptor.ProductRevisionOffset = BitConverter.ToUInt32(descriptor_b, 20); @@ -124,31 +121,31 @@ namespace DiscImageChef.Devices.Windows descriptor.BusType = (StorageBusType)BitConverter.ToUInt32(descriptor_b, 28); descriptor.RawPropertiesLength = BitConverter.ToUInt32(descriptor_b, 32); - DeviceInfo info = new DeviceInfo - { - path = physId, - bus = descriptor.BusType.ToString() - }; + DeviceInfo info = new DeviceInfo {path = physId, bus = descriptor.BusType.ToString()}; - if (descriptor.VendorIdOffset > 0) - info.vendor = StringHandlers.CToString(descriptor_b, Encoding.ASCII, start: (int)descriptor.VendorIdOffset); - if (descriptor.ProductIdOffset > 0) - info.model = StringHandlers.CToString(descriptor_b, Encoding.ASCII, start: (int)descriptor.ProductIdOffset); + if(descriptor.VendorIdOffset > 0) + info.vendor = + StringHandlers.CToString(descriptor_b, Encoding.ASCII, start: (int)descriptor.VendorIdOffset); + if(descriptor.ProductIdOffset > 0) + info.model = + StringHandlers.CToString(descriptor_b, Encoding.ASCII, start: (int)descriptor.ProductIdOffset); // TODO: Get serial number of SCSI and USB devices, probably also FireWire (untested) - if (descriptor.SerialNumberOffset > 0) - info.serial = StringHandlers.CToString(descriptor_b, Encoding.ASCII, start: (int)descriptor.SerialNumberOffset); + if(descriptor.SerialNumberOffset > 0) + info.serial = + StringHandlers.CToString(descriptor_b, Encoding.ASCII, + start: (int)descriptor.SerialNumberOffset); - if (string.IsNullOrEmpty(info.vendor) || info.vendor == "ATA") + if(string.IsNullOrEmpty(info.vendor) || info.vendor == "ATA") { string[] pieces = info.model.Split(' '); - if (pieces.Length > 1) + if(pieces.Length > 1) { info.vendor = pieces[0]; info.model = info.model.Substring(pieces[0].Length + 1); } } - switch (descriptor.BusType) + switch(descriptor.BusType) { case StorageBusType.SCSI: case StorageBusType.ATAPI: @@ -173,4 +170,4 @@ namespace DiscImageChef.Devices.Windows return devices; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Windows/Structs.cs b/DiscImageChef.Devices/Windows/Structs.cs index 9f4363f3..37e9b5d1 100644 --- a/DiscImageChef.Devices/Windows/Structs.cs +++ b/DiscImageChef.Devices/Windows/Structs.cs @@ -46,22 +46,19 @@ namespace DiscImageChef.Devices.Windows public byte Lun; public byte CdbLength; public byte SenseInfoLength; - [MarshalAs(UnmanagedType.U1)] - public ScsiIoctlDirection DataIn; + [MarshalAs(UnmanagedType.U1)] public ScsiIoctlDirection DataIn; public uint DataTransferLength; public uint TimeOutValue; public IntPtr DataBuffer; public uint SenseInfoOffset; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] Cdb; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] Cdb; }; [StructLayout(LayoutKind.Sequential)] struct ScsiPassThroughDirectAndSenseBuffer { public ScsiPassThroughDirect sptd; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] SenseBuf; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] SenseBuf; } [StructLayout(LayoutKind.Sequential)] @@ -74,8 +71,7 @@ namespace DiscImageChef.Devices.Windows /// /// Indicates transfer direction and kind of operation /// - [MarshalAs(UnmanagedType.U2)] - public AtaFlags AtaFlags; + [MarshalAs(UnmanagedType.U2)] public AtaFlags AtaFlags; /// /// Indicates IDE port or bus, set by driver /// @@ -123,49 +119,35 @@ namespace DiscImageChef.Devices.Windows { public AtaPassThroughDirect aptd; public uint filler; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64 * 512)] - public byte[] dataBuffer; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64 * 512)] public byte[] dataBuffer; } [StructLayout(LayoutKind.Explicit)] struct AtaTaskFile { // Fields for commands sent - [FieldOffset(0)] - public byte Features; - [FieldOffset(6)] - public byte Command; + [FieldOffset(0)] public byte Features; + [FieldOffset(6)] public byte Command; // Fields on command return - [FieldOffset(0)] - public byte Error; - [FieldOffset(6)] - public byte Status; + [FieldOffset(0)] public byte Error; + [FieldOffset(6)] public byte Status; // Common fields - [FieldOffset(1)] - public byte SectorCount; - [FieldOffset(2)] - public byte SectorNumber; - [FieldOffset(3)] - public byte CylinderLow; - [FieldOffset(4)] - public byte CylinderHigh; - [FieldOffset(5)] - public byte DeviceHead; - [FieldOffset(7)] - public byte Reserved; + [FieldOffset(1)] public byte SectorCount; + [FieldOffset(2)] public byte SectorNumber; + [FieldOffset(3)] public byte CylinderLow; + [FieldOffset(4)] public byte CylinderHigh; + [FieldOffset(5)] public byte DeviceHead; + [FieldOffset(7)] public byte Reserved; } [StructLayout(LayoutKind.Sequential)] struct StoragePropertyQuery { - [MarshalAs(UnmanagedType.U4)] - public StoragePropertyId PropertyId; - [MarshalAs(UnmanagedType.U4)] - public StorageQueryType QueryType; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] - public byte[] AdditionalParameters; + [MarshalAs(UnmanagedType.U4)] public StoragePropertyId PropertyId; + [MarshalAs(UnmanagedType.U4)] public StorageQueryType QueryType; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] AdditionalParameters; } [StructLayout(LayoutKind.Sequential)] @@ -182,10 +164,8 @@ namespace DiscImageChef.Devices.Windows public uint Size; public byte DeviceType; public byte DeviceTypeModifier; - [MarshalAs(UnmanagedType.U1)] - public bool RemovableMedia; - [MarshalAs(UnmanagedType.U1)] - public bool CommandQueueing; + [MarshalAs(UnmanagedType.U1)] public bool RemovableMedia; + [MarshalAs(UnmanagedType.U1)] public bool CommandQueueing; public uint VendorIdOffset; public uint ProductIdOffset; public uint ProductRevisionOffset; @@ -209,8 +189,7 @@ namespace DiscImageChef.Devices.Windows /// /// Data buffer /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] - public byte[] DataBuffer; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] DataBuffer; } [StructLayout(LayoutKind.Sequential)] @@ -220,7 +199,7 @@ namespace DiscImageChef.Devices.Windows public int deviceNumber; public int partitionNumber; } - + [StructLayout(LayoutKind.Sequential)] struct DeviceInfoData { @@ -229,7 +208,7 @@ namespace DiscImageChef.Devices.Windows public uint devInst; public IntPtr reserved; } - + [StructLayout(LayoutKind.Sequential)] struct DeviceInterfaceData { @@ -238,7 +217,7 @@ namespace DiscImageChef.Devices.Windows public uint flags; private IntPtr reserved; } - + [StructLayout(LayoutKind.Sequential)] struct USB_SETUP_PACKET { @@ -248,7 +227,7 @@ namespace DiscImageChef.Devices.Windows public short wIndex; public short wLength; } - + [StructLayout(LayoutKind.Sequential)] struct USB_DESCRIPTOR_REQUEST { @@ -256,7 +235,7 @@ namespace DiscImageChef.Devices.Windows public USB_SETUP_PACKET SetupPacket; //public byte[] Data; } - + [StructLayout(LayoutKind.Sequential)] struct SffdiskQueryDeviceProtocolData { @@ -264,7 +243,7 @@ namespace DiscImageChef.Devices.Windows public ushort reserved; public Guid protocolGuid; } - + [StructLayout(LayoutKind.Sequential)] struct SffdiskDeviceCommandData { @@ -275,7 +254,7 @@ namespace DiscImageChef.Devices.Windows public uint deviceDataBufferSize; public uint information; } - + [StructLayout(LayoutKind.Sequential)] struct SdCmdDescriptor { @@ -285,5 +264,4 @@ namespace DiscImageChef.Devices.Windows public SdTransferType transferType; public SdResponseType responseType; } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Windows/Usb.cs b/DiscImageChef.Devices/Windows/Usb.cs index 0ebb5ada..c6386c59 100644 --- a/DiscImageChef.Devices/Windows/Usb.cs +++ b/DiscImageChef.Devices/Windows/Usb.cs @@ -41,7 +41,6 @@ namespace DiscImageChef.Devices.Windows public partial class Usb { #region "API Region" - // ********************** Constants ************************ const int GENERIC_WRITE = 0x40000000; @@ -373,19 +372,10 @@ namespace DiscImageChef.Devices.Windows //); [DllImport("setupapi.dll", CharSet = CharSet.Auto)] static extern IntPtr SetupDiGetClassDevs( // 1st form using a ClassGUID - ref Guid ClassGuid, - int Enumerator, - IntPtr hwndParent, - int Flags - ); + ref Guid ClassGuid, int Enumerator, IntPtr hwndParent, int Flags); [DllImport("setupapi.dll", CharSet = CharSet.Auto)] // 2nd form uses an Enumerator - static extern IntPtr SetupDiGetClassDevs( - int ClassGuid, - string Enumerator, - IntPtr hwndParent, - int Flags - ); + static extern IntPtr SetupDiGetClassDevs(int ClassGuid, string Enumerator, IntPtr hwndParent, int Flags); //BOOL SetupDiEnumDeviceInterfaces( // HDEVINFO DeviceInfoSet, @@ -395,13 +385,9 @@ namespace DiscImageChef.Devices.Windows // PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData //); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool SetupDiEnumDeviceInterfaces( - IntPtr DeviceInfoSet, - IntPtr DeviceInfoData, - ref Guid InterfaceClassGuid, - int MemberIndex, - ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData - ); + static extern bool SetupDiEnumDeviceInterfaces(IntPtr DeviceInfoSet, IntPtr DeviceInfoData, + ref Guid InterfaceClassGuid, int MemberIndex, + ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData); //BOOL SetupDiGetDeviceInterfaceDetail( // HDEVINFO DeviceInfoSet, @@ -412,14 +398,12 @@ namespace DiscImageChef.Devices.Windows // PSP_DEVINFO_DATA DeviceInfoData //); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool SetupDiGetDeviceInterfaceDetail( - IntPtr DeviceInfoSet, - ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData, - ref SP_DEVICE_INTERFACE_DETAIL_DATA DeviceInterfaceDetailData, - int DeviceInterfaceDetailDataSize, - ref int RequiredSize, - ref SP_DEVINFO_DATA DeviceInfoData - ); + static extern bool SetupDiGetDeviceInterfaceDetail(IntPtr DeviceInfoSet, + ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData, + ref SP_DEVICE_INTERFACE_DETAIL_DATA + DeviceInterfaceDetailData, + int DeviceInterfaceDetailDataSize, ref int RequiredSize, + ref SP_DEVINFO_DATA DeviceInfoData); //BOOL SetupDiGetDeviceRegistryProperty( // HDEVINFO DeviceInfoSet, @@ -431,15 +415,10 @@ namespace DiscImageChef.Devices.Windows // PDWORD RequiredSize //); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool SetupDiGetDeviceRegistryProperty( - IntPtr DeviceInfoSet, - ref SP_DEVINFO_DATA DeviceInfoData, - int iProperty, - ref int PropertyRegDataType, - IntPtr PropertyBuffer, - int PropertyBufferSize, - ref int RequiredSize - ); + static extern bool SetupDiGetDeviceRegistryProperty(IntPtr DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData, + int iProperty, ref int PropertyRegDataType, + IntPtr PropertyBuffer, int PropertyBufferSize, + ref int RequiredSize); //BOOL SetupDiEnumDeviceInfo( // HDEVINFO DeviceInfoSet, @@ -447,19 +426,14 @@ namespace DiscImageChef.Devices.Windows // PSP_DEVINFO_DATA DeviceInfoData //); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool SetupDiEnumDeviceInfo( - IntPtr DeviceInfoSet, - int MemberIndex, - ref SP_DEVINFO_DATA DeviceInfoData - ); + static extern bool SetupDiEnumDeviceInfo(IntPtr DeviceInfoSet, int MemberIndex, + ref SP_DEVINFO_DATA DeviceInfoData); //BOOL SetupDiDestroyDeviceInfoList( // HDEVINFO DeviceInfoSet //); [DllImport("setupapi.dll", SetLastError = true)] - static extern bool SetupDiDestroyDeviceInfoList( - IntPtr DeviceInfoSet - ); + static extern bool SetupDiDestroyDeviceInfoList(IntPtr DeviceInfoSet); //WINSETUPAPI BOOL WINAPI SetupDiGetDeviceInstanceId( // IN HDEVINFO DeviceInfoSet, @@ -469,13 +443,9 @@ namespace DiscImageChef.Devices.Windows // OUT PDWORD RequiredSize OPTIONAL //); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool SetupDiGetDeviceInstanceId( - IntPtr DeviceInfoSet, - ref SP_DEVINFO_DATA DeviceInfoData, - StringBuilder DeviceInstanceId, - int DeviceInstanceIdSize, - out int RequiredSize - ); + static extern bool SetupDiGetDeviceInstanceId(IntPtr DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData, + StringBuilder DeviceInstanceId, int DeviceInstanceIdSize, + out int RequiredSize); //BOOL DeviceIoControl( // HANDLE hDevice, @@ -488,16 +458,9 @@ namespace DiscImageChef.Devices.Windows // LPOVERLAPPED lpOverlapped //); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool DeviceIoControl( - IntPtr hDevice, - int dwIoControlCode, - IntPtr lpInBuffer, - int nInBufferSize, - IntPtr lpOutBuffer, - int nOutBufferSize, - out int lpBytesReturned, - IntPtr lpOverlapped - ); + static extern bool DeviceIoControl(IntPtr hDevice, int dwIoControlCode, IntPtr lpInBuffer, int nInBufferSize, + IntPtr lpOutBuffer, int nOutBufferSize, out int lpBytesReturned, + IntPtr lpOverlapped); //HANDLE CreateFile( // LPCTSTR lpFileName, @@ -509,24 +472,15 @@ namespace DiscImageChef.Devices.Windows // HANDLE hTemplateFile //); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern IntPtr CreateFile( - string lpFileName, - int dwDesiredAccess, - int dwShareMode, - IntPtr lpSecurityAttributes, - int dwCreationDisposition, - int dwFlagsAndAttributes, - IntPtr hTemplateFile - ); + static extern IntPtr CreateFile(string lpFileName, int dwDesiredAccess, int dwShareMode, + IntPtr lpSecurityAttributes, int dwCreationDisposition, + int dwFlagsAndAttributes, IntPtr hTemplateFile); //BOOL CloseHandle( // HANDLE hObject //); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool CloseHandle( - IntPtr hObject - ); - + static extern bool CloseHandle(IntPtr hObject); #endregion // @@ -578,12 +532,12 @@ namespace DiscImageChef.Devices.Windows int RegType = REG_SZ; if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref RegType, ptrBuf, - BUFFER_SIZE, ref RequiredSize)) + BUFFER_SIZE, ref RequiredSize)) { host.ControllerDeviceDesc = Marshal.PtrToStringAuto(ptrBuf); } if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref RegType, ptrBuf, - BUFFER_SIZE, ref RequiredSize)) + BUFFER_SIZE, ref RequiredSize)) { host.ControllerDriverKeyName = Marshal.PtrToStringAuto(ptrBuf); } @@ -591,7 +545,8 @@ namespace DiscImageChef.Devices.Windows HostList.Add(host); } i++; - } while(Success); + } + while(Success); Marshal.FreeHGlobal(ptrBuf); SetupDiDestroyDeviceInfoList(h); @@ -652,7 +607,7 @@ namespace DiscImageChef.Devices.Windows // Open a handle to the Host Controller h = CreateFile(ControllerDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, - IntPtr.Zero); + IntPtr.Zero); if(h.ToInt32() != INVALID_HANDLE_VALUE) { int nBytesReturned; @@ -662,7 +617,7 @@ namespace DiscImageChef.Devices.Windows // get the Hub Name if(DeviceIoControl(h, IOCTL_USB_GET_ROOT_HUB_NAME, ptrHubName, nBytes, ptrHubName, nBytes, - out nBytesReturned, IntPtr.Zero)) + out nBytesReturned, IntPtr.Zero)) { HubName = (USB_ROOT_HUB_NAME)Marshal.PtrToStructure(ptrHubName, typeof(USB_ROOT_HUB_NAME)); Root.HubDevicePath = @"\\.\" + HubName.RootHubName; @@ -672,7 +627,7 @@ namespace DiscImageChef.Devices.Windows // Now let's open the Hub (based upon the HubName we got above) h2 = CreateFile(Root.HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, - IntPtr.Zero); + IntPtr.Zero); if(h2.ToInt32() != INVALID_HANDLE_VALUE) { USB_NODE_INFORMATION NodeInfo = new USB_NODE_INFORMATION(); @@ -683,10 +638,10 @@ namespace DiscImageChef.Devices.Windows // get the Hub Information if(DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, - out nBytesReturned, IntPtr.Zero)) + out nBytesReturned, IntPtr.Zero)) { NodeInfo = (USB_NODE_INFORMATION)Marshal.PtrToStructure(ptrNodeInfo, - typeof(USB_NODE_INFORMATION)); + typeof(USB_NODE_INFORMATION)); Root.HubIsBusPowered = Convert.ToBoolean(NodeInfo.HubInformation.HubIsBusPowered); Root.HubPortCount = NodeInfo.HubInformation.HubDescriptor.bNumberOfPorts; } @@ -790,7 +745,7 @@ namespace DiscImageChef.Devices.Windows // Open a handle to the Hub device IntPtr h = CreateFile(HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, - IntPtr.Zero); + IntPtr.Zero); if(h.ToInt32() != INVALID_HANDLE_VALUE) { int nBytes = Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX)); @@ -806,11 +761,13 @@ namespace DiscImageChef.Devices.Windows Marshal.StructureToPtr(NodeConnection, ptrNodeConnection, true); if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, ptrNodeConnection, nBytes, - ptrNodeConnection, nBytes, out nBytesReturned, IntPtr.Zero)) + ptrNodeConnection, nBytes, out nBytesReturned, IntPtr.Zero)) { NodeConnection = (USB_NODE_CONNECTION_INFORMATION_EX)Marshal.PtrToStructure(ptrNodeConnection, - typeof(USB_NODE_CONNECTION_INFORMATION_EX)); + typeof( + USB_NODE_CONNECTION_INFORMATION_EX + )); // load up the USBPort class USBPort port = new USBPort(); @@ -829,6 +786,7 @@ namespace DiscImageChef.Devices.Windows PortList.Add(port); } } + Marshal.FreeHGlobal(ptrNodeConnection); CloseHandle(h); } @@ -897,10 +855,8 @@ namespace DiscImageChef.Devices.Windows // return a down stream external hub public USBDevice GetDevice() { - if(!PortIsDeviceConnected) - { - return null; - } + if(!PortIsDeviceConnected) { return null; } + USBDevice Device = new USBDevice(); // Copy over some values from the Port class @@ -911,7 +867,7 @@ namespace DiscImageChef.Devices.Windows // Open a handle to the Hub device IntPtr h = CreateFile(PortHubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, - IntPtr.Zero); + IntPtr.Zero); if(h.ToInt32() != INVALID_HANDLE_VALUE) { int nBytesReturned; @@ -938,7 +894,7 @@ namespace DiscImageChef.Devices.Windows // Use an IOCTL call to request the String Descriptor if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, - ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) + ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) { // The location of the string descriptor is immediately after // the Request structure. Because this location is not "covered" @@ -947,7 +903,7 @@ namespace DiscImageChef.Devices.Windows IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(Request)); USB_STRING_DESCRIPTOR StringDesc = (USB_STRING_DESCRIPTOR)Marshal.PtrToStructure(ptrStringDesc, - typeof(USB_STRING_DESCRIPTOR)); + typeof(USB_STRING_DESCRIPTOR)); Device.DeviceManufacturer = StringDesc.bString; } Marshal.FreeHGlobal(ptrRequest); @@ -967,13 +923,13 @@ namespace DiscImageChef.Devices.Windows // Use an IOCTL call to request the String Descriptor if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, - ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) + ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) { // the location of the string descriptor is immediately after the Request structure IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(Request)); USB_STRING_DESCRIPTOR StringDesc = (USB_STRING_DESCRIPTOR)Marshal.PtrToStructure(ptrStringDesc, - typeof(USB_STRING_DESCRIPTOR)); + typeof(USB_STRING_DESCRIPTOR)); Device.DeviceProduct = StringDesc.bString; } Marshal.FreeHGlobal(ptrRequest); @@ -993,13 +949,13 @@ namespace DiscImageChef.Devices.Windows // Use an IOCTL call to request the String Descriptor if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, - ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) + ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) { // the location of the string descriptor is immediately after the Request structure IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(Request)); USB_STRING_DESCRIPTOR StringDesc = (USB_STRING_DESCRIPTOR)Marshal.PtrToStructure(ptrStringDesc, - typeof(USB_STRING_DESCRIPTOR)); + typeof(USB_STRING_DESCRIPTOR)); Device.DeviceSerialNumber = StringDesc.bString; } Marshal.FreeHGlobal(ptrRequest); @@ -1010,14 +966,14 @@ namespace DiscImageChef.Devices.Windows dcrRequest.ConnectionIndex = PortPortNumber; dcrRequest.SetupPacket.wValue = (short)((USB_CONFIGURATION_DESCRIPTOR_TYPE << 8)); dcrRequest.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(dcrRequest)); - dcrRequest.SetupPacket.wIndex = 0; + dcrRequest.SetupPacket.wIndex = 0; // Geez, I wish C# had a Marshal.MemSet() method IntPtr dcrPtrRequest = Marshal.StringToHGlobalAuto(NullString); Marshal.StructureToPtr(dcrRequest, dcrPtrRequest, true); // Use an IOCTL call to request the String Descriptor if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, dcrPtrRequest, nBytes, - dcrPtrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) + dcrPtrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) { IntPtr ptrStringDesc = new IntPtr(dcrPtrRequest.ToInt32() + Marshal.SizeOf(dcrRequest)); Device.BinaryDeviceDescriptors = new byte[nBytesReturned]; @@ -1034,10 +990,12 @@ namespace DiscImageChef.Devices.Windows // Use an IOCTL call to request the Driver Key Name if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, ptrDriverKey, nBytes, - ptrDriverKey, nBytes, out nBytesReturned, IntPtr.Zero)) + ptrDriverKey, nBytes, out nBytesReturned, IntPtr.Zero)) { DriverKey = (USB_NODE_CONNECTION_DRIVERKEY_NAME)Marshal.PtrToStructure(ptrDriverKey, - typeof(USB_NODE_CONNECTION_DRIVERKEY_NAME)); + typeof( + USB_NODE_CONNECTION_DRIVERKEY_NAME + )); Device.DeviceDriverKey = DriverKey.DriverKeyName; // use the DriverKeyName to get the Device Description and Instance ID @@ -1053,10 +1011,8 @@ namespace DiscImageChef.Devices.Windows // return a down stream external hub public USBHub GetHub() { - if(!PortIsHub) - { - return null; - } + if(!PortIsHub) { return null; } + USBHub Hub = new USBHub(); IntPtr h, h2; Hub.HubIsRootHub = false; @@ -1064,7 +1020,7 @@ namespace DiscImageChef.Devices.Windows // Open a handle to the Host Controller h = CreateFile(PortHubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, - IntPtr.Zero); + IntPtr.Zero); if(h.ToInt32() != INVALID_HANDLE_VALUE) { // Get the DevicePath for downstream hub @@ -1077,16 +1033,16 @@ namespace DiscImageChef.Devices.Windows // Use an IOCTL call to request the Node Name if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_NAME, ptrNodeName, nBytes, ptrNodeName, nBytes, - out nBytesReturned, IntPtr.Zero)) + out nBytesReturned, IntPtr.Zero)) { NodeName = (USB_NODE_CONNECTION_NAME)Marshal.PtrToStructure(ptrNodeName, - typeof(USB_NODE_CONNECTION_NAME)); + typeof(USB_NODE_CONNECTION_NAME)); Hub.HubDevicePath = @"\\.\" + NodeName.NodeName; } // Now let's open the Hub (based upon the HubName we got above) h2 = CreateFile(Hub.HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, - IntPtr.Zero); + IntPtr.Zero); if(h2.ToInt32() != INVALID_HANDLE_VALUE) { USB_NODE_INFORMATION NodeInfo = new USB_NODE_INFORMATION(); @@ -1097,10 +1053,10 @@ namespace DiscImageChef.Devices.Windows // get the Hub Information if(DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, - out nBytesReturned, IntPtr.Zero)) + out nBytesReturned, IntPtr.Zero)) { NodeInfo = (USB_NODE_INFORMATION)Marshal.PtrToStructure(ptrNodeInfo, - typeof(USB_NODE_INFORMATION)); + typeof(USB_NODE_INFORMATION)); Hub.HubIsBusPowered = Convert.ToBoolean(NodeInfo.HubInformation.HubIsBusPowered); Hub.HubPortCount = NodeInfo.HubInformation.HubDescriptor.bNumberOfPorts; } @@ -1193,7 +1149,7 @@ namespace DiscImageChef.Devices.Windows { get { return DeviceSerialNumber; } } - + public byte[] BinaryDescriptors { get { return BinaryDeviceDescriptors; } @@ -1233,7 +1189,7 @@ namespace DiscImageChef.Devices.Windows KeyName = ""; if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref RegType, ptrBuf, BUFFER_SIZE, - ref RequiredSize)) + ref RequiredSize)) { KeyName = Marshal.PtrToStringAuto(ptrBuf); } @@ -1242,19 +1198,22 @@ namespace DiscImageChef.Devices.Windows if(KeyName == DriverKeyName) { if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref RegType, ptrBuf, - BUFFER_SIZE, ref RequiredSize)) + BUFFER_SIZE, ref RequiredSize)) { ans = Marshal.PtrToStringAuto(ptrBuf); } break; } } + i++; - } while(Success); + } + while(Success); Marshal.FreeHGlobal(ptrBuf); SetupDiDestroyDeviceInfoList(h); } + return ans; } @@ -1291,7 +1250,7 @@ namespace DiscImageChef.Devices.Windows KeyName = ""; if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref RegType, ptrBuf, BUFFER_SIZE, - ref RequiredSize)) + ref RequiredSize)) { KeyName = Marshal.PtrToStringAuto(ptrBuf); } @@ -1306,13 +1265,16 @@ namespace DiscImageChef.Devices.Windows break; } } + i++; - } while(Success); + } + while(Success); Marshal.FreeHGlobal(ptrBuf); SetupDiDestroyDeviceInfoList(h); } + return ans; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Devices/Windows/UsbFunctions.cs b/DiscImageChef.Devices/Windows/UsbFunctions.cs index 51d8bdfd..690ac462 100644 --- a/DiscImageChef.Devices/Windows/UsbFunctions.cs +++ b/DiscImageChef.Devices/Windows/UsbFunctions.cs @@ -37,14 +37,12 @@ using System.Runtime.InteropServices; // Copyright "Fort Hood TX", public domain, 2007 namespace DiscImageChef.Devices.Windows { - // // A place for "higher level" related functions // You might not want to keep these in the USB class... your choice // public partial class Usb { - // // Get a list of all connected devices // @@ -52,10 +50,8 @@ namespace DiscImageChef.Devices.Windows { List DevList = new List(); - foreach(USBController Controller in GetHostControllers()) - { - ListHub(Controller.GetRootHub(), DevList); - } + foreach(USBController Controller in GetHostControllers()) { ListHub(Controller.GetRootHub(), DevList); } + return DevList; } @@ -69,13 +65,7 @@ namespace DiscImageChef.Devices.Windows // recursive ListHub(Port.GetHub(), DevList); } - else - { - if(Port.IsDeviceConnected) - { - DevList.Add(Port.GetDevice()); - } - } + else { if(Port.IsDeviceConnected) { DevList.Add(Port.GetDevice()); } } } } @@ -89,9 +79,9 @@ namespace DiscImageChef.Devices.Windows foreach(USBController Controller in GetHostControllers()) { SearchHubDriverKeyName(Controller.GetRootHub(), ref FoundDevice, DriverKeyName); - if(FoundDevice != null) - break; + if(FoundDevice != null) break; } + return FoundDevice; } @@ -130,9 +120,9 @@ namespace DiscImageChef.Devices.Windows foreach(USBController Controller in GetHostControllers()) { SearchHubInstanceID(Controller.GetRootHub(), ref FoundDevice, InstanceID); - if(FoundDevice != null) - break; + if(FoundDevice != null) break; } + return FoundDevice; } @@ -185,11 +175,7 @@ namespace DiscImageChef.Devices.Windows // IN ULONG ulFlags //); [DllImport("setupapi.dll")] - static extern int CM_Get_Parent( - out IntPtr pdnDevInst, - IntPtr dnDevInst, - int ulFlags - ); + static extern int CM_Get_Parent(out IntPtr pdnDevInst, IntPtr dnDevInst, int ulFlags); //CMAPI CONFIGRET WINAPI CM_Get_Device_ID( // IN DEVINST dnDevInst, @@ -198,12 +184,7 @@ namespace DiscImageChef.Devices.Windows // IN ULONG ulFlags //); [DllImport("setupapi.dll", CharSet = CharSet.Auto)] - static extern int CM_Get_Device_ID( - IntPtr dnDevInst, - IntPtr Buffer, - int BufferLen, - int ulFlags - ); + static extern int CM_Get_Device_ID(IntPtr dnDevInst, IntPtr Buffer, int BufferLen, int ulFlags); // // Find a device based upon a Drive Letter @@ -217,10 +198,7 @@ namespace DiscImageChef.Devices.Windows // DriveLetter. We'll use this later to find a matching // DevicePath "symbolic name" int DevNum = GetDeviceNumber(@"\\.\" + DriveLetter.TrimEnd('\\')); - if(DevNum < 0) - { - return null; - } + if(DevNum < 0) { return null; } return FindDeviceNumber(DevNum, deviceGuid); } @@ -234,10 +212,7 @@ namespace DiscImageChef.Devices.Windows // DriveLetter. We'll use this later to find a matching // DevicePath "symbolic name" int DevNum = GetDeviceNumber(DrivePath); - if(DevNum < 0) - { - return null; - } + if(DevNum < 0) { return null; } return FindDeviceNumber(DevNum, deviceGuid); } @@ -304,15 +279,14 @@ namespace DiscImageChef.Devices.Windows } } i++; - } while(Success); + } + while(Success); + SetupDiDestroyDeviceInfoList(h); } // Did we find an InterfaceID of a USB device? - if(InstanceID.StartsWith("USB\\")) - { - FoundDevice = FindDeviceByInstanceID(InstanceID); - } + if(InstanceID.StartsWith("USB\\")) { FoundDevice = FindDeviceByInstanceID(InstanceID); } return FoundDevice; } @@ -330,7 +304,7 @@ namespace DiscImageChef.Devices.Windows IntPtr ptrSdn = Marshal.AllocHGlobal(nBytes); if(DeviceIoControl(h, IOCTL_STORAGE_GET_DEVICE_NUMBER, IntPtr.Zero, 0, ptrSdn, nBytes, out requiredSize, - IntPtr.Zero)) + IntPtr.Zero)) { Sdn = (STORAGE_DEVICE_NUMBER)Marshal.PtrToStructure(ptrSdn, typeof(STORAGE_DEVICE_NUMBER)); // just my way of combining the relevant parts of the @@ -343,4 +317,4 @@ namespace DiscImageChef.Devices.Windows return ans; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/Alcohol120.cs b/DiscImageChef.DiscImages/Alcohol120.cs index 8778ddde..d7172f93 100644 --- a/DiscImageChef.DiscImages/Alcohol120.cs +++ b/DiscImageChef.DiscImages/Alcohol120.cs @@ -41,29 +41,23 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class Alcohol120 : ImagePlugin + public class Alcohol120 : ImagePlugin { #region Internal Structures [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AlcoholHeader { - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] - public string signature; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] version; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string signature; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] version; public AlcoholMediumType type; public ushort sessions; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public ushort[] unknown1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public ushort[] unknown1; public ushort bcaLength; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public uint[] unknown2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] unknown2; public uint bcaOffset; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public uint[] unknown3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public uint[] unknown3; public uint structuresOffset; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public uint[] unknown4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] unknown4; public uint sessionOffset; public uint dpmOffset; } @@ -99,14 +93,12 @@ namespace DiscImageChef.ImagePlugins public byte pframe; public uint extraOffset; public ushort sectorSize; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] - public byte[] unknown; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] public byte[] unknown; public uint startLba; public ulong startOffset; public uint files; public uint footerOffset; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] - public byte[] unknown2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] unknown2; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -145,7 +137,7 @@ namespace DiscImageChef.ImagePlugins Mode2 = 0xAB, Mode2F1 = 0xAC, Mode2F2 = 0xAD, - Mode2F1Alt = 0xEC + Mode2F1Alt = 0xEC } enum AlcoholSubchannelMode : byte @@ -156,7 +148,6 @@ namespace DiscImageChef.ImagePlugins #endregion Internal enumerations #region Internal variables - Dictionary offsetmap; List partitions; Dictionary alcSessions; @@ -172,11 +163,9 @@ namespace DiscImageChef.ImagePlugins bool isDvd; byte[] dmi; byte[] pfi; - #endregion #region Public Methods - public Alcohol120() { Name = "Alcohol 120% Media Descriptor Structure"; @@ -208,8 +197,7 @@ namespace DiscImageChef.ImagePlugins { Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 88) - return false; + if(stream.Length < 88) return false; byte[] hdr = new byte[88]; stream.Read(hdr, 0, 88); @@ -226,8 +214,7 @@ namespace DiscImageChef.ImagePlugins { Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 88) - return false; + if(stream.Length < 88) return false; isDvd = false; byte[] hdr = new byte[88]; @@ -239,20 +226,29 @@ namespace DiscImageChef.ImagePlugins Marshal.FreeHGlobal(hdrPtr); DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.signature = {0}", header.signature); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.version = {0}.{1}", header.version[0], header.version[1]); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.version = {0}.{1}", header.version[0], + header.version[1]); DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.type = {0}", header.type); DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.sessions = {0}", header.sessions); for(int i = 0; i < header.unknown1.Length; i++) - DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.unknown1[{1}] = 0x{0:X4}", header.unknown1[i], i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.unknown1[{1}] = 0x{0:X4}", header.unknown1[i], + i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.bcaLength = {0}", header.bcaLength); for(int i = 0; i < header.unknown2.Length; i++) - DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.unknown2[{1}] = 0x{0:X8}", header.unknown2[i], i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.unknown2[{1}] = 0x{0:X8}", header.unknown2[i], + i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.bcaOffset = {0}", header.bcaOffset); for(int i = 0; i < header.unknown3.Length; i++) - DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.unknown3[{1}] = 0x{0:X8}", header.unknown3[i], i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.unknown3[{1}] = 0x{0:X8}", header.unknown3[i], + i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.structuresOffset = {0}", header.structuresOffset); for(int i = 0; i < header.unknown4.Length; i++) - DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.unknown4[{1}] = 0x{0:X8}", header.unknown4[i], i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.unknown4[{1}] = 0x{0:X8}", header.unknown4[i], + i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.sessionOffset = {0}", header.sessionOffset); DicConsole.DebugWriteLine("Alcohol 120% plugin", "header.dpmOffset = {0}", header.dpmOffset); @@ -268,15 +264,21 @@ namespace DiscImageChef.ImagePlugins session = (AlcoholSession)Marshal.PtrToStructure(sesPtr, typeof(AlcoholSession)); Marshal.FreeHGlobal(sesPtr); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].sessionStart = {0}", session.sessionStart, i); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].sessionEnd = {0}", session.sessionEnd, i); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].sessionSequence = {0}", session.sessionSequence, i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].sessionStart = {0}", + session.sessionStart, i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].sessionEnd = {0}", session.sessionEnd, + i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].sessionSequence = {0}", + session.sessionSequence, i); DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].allBlocks = {0}", session.allBlocks, i); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].nonTrackBlocks = {0}", session.nonTrackBlocks, i); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].firstTrack = {0}", session.firstTrack, i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].nonTrackBlocks = {0}", + session.nonTrackBlocks, i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].firstTrack = {0}", session.firstTrack, + i); DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].lastTrack = {0}", session.lastTrack, i); DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].unknown = 0x{0:X8}", session.unknown, i); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].trackOffset = {0}", session.trackOffset, i); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{1}].trackOffset = {0}", session.trackOffset, + i); alcSessions.Add(session.sessionSequence, session); } @@ -303,40 +305,56 @@ namespace DiscImageChef.ImagePlugins track = (AlcoholTrack)Marshal.PtrToStructure(trkPtr, typeof(AlcoholTrack)); Marshal.FreeHGlobal(trkPtr); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].mode = {0}", track.mode, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].subMode = {0}", track.subMode, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].adrCtl = {0}", track.adrCtl, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].tno = {0}", track.tno, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].point = {0:X2}", track.point, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].min = {0}", track.min, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].sec = {0}", track.sec, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].frame = {0}", track.frame, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].zero = {0}", track.zero, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].pmin = {0}", track.pmin, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].psec = {0}", track.psec, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].pframe = {0}", track.pframe, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].extraOffset = {0}", track.extraOffset, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].sectorSize = {0}", track.sectorSize, track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].mode = {0}", track.mode, + track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].subMode = {0}", + track.subMode, track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].adrCtl = {0}", + track.adrCtl, track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].tno = {0}", track.tno, + track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].point = {0:X2}", + track.point, track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].min = {0}", track.min, + track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].sec = {0}", track.sec, + track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].frame = {0}", track.frame, + track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].zero = {0}", track.zero, + track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].pmin = {0}", track.pmin, + track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].psec = {0}", track.psec, + track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].pframe = {0}", + track.pframe, track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].extraOffset = {0}", + track.extraOffset, track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].sectorSize = {0}", + track.sectorSize, track.point, session.sessionSequence); //for(int j = 0; j < track.unknown.Length; j++) // DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].unknown[{2}] = {0}", track.unknown[j], i, j, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].startLba = {0}", track.startLba, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].startOffset = {0}", track.startOffset, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].files = {0}", track.files, track.point, session.sessionSequence); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].footerOffset = {0}", track.footerOffset, track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].startLba = {0}", + track.startLba, track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].startOffset = {0}", + track.startOffset, track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].files = {0}", track.files, + track.point, session.sessionSequence); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].footerOffset = {0}", + track.footerOffset, track.point, session.sessionSequence); //for(int j = 0; j < track.unknown2.Length; j++) // DicConsole.DebugWriteLine("Alcohol 120% plugin", "session[{2}].track[{1}].unknown2[{2}] = {0}", track.unknown2[j], i, j, session.sessionSequence); - if(!sesToc.ContainsKey(track.point)) - sesToc.Add(track.point, track); + if(!sesToc.ContainsKey(track.point)) sesToc.Add(track.point, track); - if(track.point < 0xA0) - alcTracks.Add(track.point, track); + if(track.point < 0xA0) alcTracks.Add(track.point, track); - if(footerOff == 0) - footerOff = track.footerOffset; + if(footerOff == 0) footerOff = track.footerOffset; isDvd |= track.mode == AlcoholTrackMode.DVD; } + alcToc.Add(session.sessionSequence, sesToc); } @@ -354,8 +372,10 @@ namespace DiscImageChef.ImagePlugins extra = (AlcoholTrackExtra)Marshal.PtrToStructure(extPtr, typeof(AlcoholTrackExtra)); Marshal.FreeHGlobal(extPtr); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "track[{1}].extra.pregap = {0}", extra.pregap, track.point); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "track[{1}].extra.sectors = {0}", extra.sectors, track.point); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "track[{1}].extra.pregap = {0}", extra.pregap, + track.point); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "track[{1}].extra.sectors = {0}", extra.sectors, + track.point); alcTrackExtras.Add(track.point, extra); } @@ -378,7 +398,8 @@ namespace DiscImageChef.ImagePlugins alcFooter = (AlcoholFooter)Marshal.PtrToStructure(footPtr, typeof(AlcoholFooter)); Marshal.FreeHGlobal(footPtr); - DicConsole.DebugWriteLine("Alcohol 120% plugin", "footer.filenameOffset = {0}", alcFooter.filenameOffset); + DicConsole.DebugWriteLine("Alcohol 120% plugin", "footer.filenameOffset = {0}", + alcFooter.filenameOffset); DicConsole.DebugWriteLine("Alcohol 120% plugin", "footer.widechar = {0}", alcFooter.widechar); DicConsole.DebugWriteLine("Alcohol 120% plugin", "footer.unknown1 = 0x{0:X8}", alcFooter.unknown1); DicConsole.DebugWriteLine("Alcohol 120% plugin", "footer.unknown2 = 0x{0:X8}", alcFooter.unknown2); @@ -390,21 +411,18 @@ namespace DiscImageChef.ImagePlugins { stream.Seek(alcFooter.filenameOffset, SeekOrigin.Begin); byte[] filename; - if(header.dpmOffset == 0) - filename = new byte[stream.Length - stream.Position]; - else - filename = new byte[header.dpmOffset - stream.Position]; + if(header.dpmOffset == 0) filename = new byte[stream.Length - stream.Position]; + else filename = new byte[header.dpmOffset - stream.Position]; stream.Read(filename, 0, filename.Length); - if(alcFooter.widechar == 1) - alcFile = Encoding.Unicode.GetString(filename); - else - alcFile = Encoding.Default.GetString(filename); + if(alcFooter.widechar == 1) alcFile = Encoding.Unicode.GetString(filename); + else alcFile = Encoding.Default.GetString(filename); DicConsole.DebugWriteLine("Alcohol 120% plugin", "footer.filename = {0}", alcFile); } - if(alcFooter.filenameOffset == 0 || string.Compare(alcFile, "*.mdf", StringComparison.InvariantCultureIgnoreCase) == 0) + if(alcFooter.filenameOffset == 0 || + string.Compare(alcFile, "*.mdf", StringComparison.InvariantCultureIgnoreCase) == 0) alcFile = Path.GetFileNameWithoutExtension(imageFilter.GetBasePath()) + ".mdf"; if(header.bcaLength > 0 && header.bcaOffset > 0 && isDvd) @@ -467,10 +485,8 @@ namespace DiscImageChef.ImagePlugins ImageInfo.mediaType = MediaType.DVDPRWDL; break; case Decoders.DVD.DiskCategory.DVDR: - if(pfi0.Value.PartVersion == 6) - ImageInfo.mediaType = MediaType.DVDRDL; - else - ImageInfo.mediaType = MediaType.DVDR; + if(pfi0.Value.PartVersion == 6) ImageInfo.mediaType = MediaType.DVDRDL; + else ImageInfo.mediaType = MediaType.DVDR; break; case Decoders.DVD.DiskCategory.DVDRAM: ImageInfo.mediaType = MediaType.DVDRAM; @@ -479,10 +495,8 @@ namespace DiscImageChef.ImagePlugins ImageInfo.mediaType = MediaType.DVDROM; break; case Decoders.DVD.DiskCategory.DVDRW: - if(pfi0.Value.PartVersion == 3) - ImageInfo.mediaType = MediaType.DVDRWDL; - else - ImageInfo.mediaType = MediaType.DVDRW; + if(pfi0.Value.PartVersion == 3) ImageInfo.mediaType = MediaType.DVDRWDL; + else ImageInfo.mediaType = MediaType.DVDRW; break; case Decoders.DVD.DiskCategory.HDDVDR: ImageInfo.mediaType = MediaType.HDDVDR; @@ -499,20 +513,17 @@ namespace DiscImageChef.ImagePlugins case Decoders.DVD.DiskCategory.Nintendo: if(pfi0.Value.DiscSize == Decoders.DVD.DVDSize.Eighty) ImageInfo.mediaType = MediaType.GOD; - else - ImageInfo.mediaType = MediaType.WOD; + else ImageInfo.mediaType = MediaType.WOD; break; case Decoders.DVD.DiskCategory.UMD: ImageInfo.mediaType = MediaType.UMD; break; } - if(Decoders.Xbox.DMI.IsXbox(dmi)) - ImageInfo.mediaType = MediaType.XGD; - else if(Decoders.Xbox.DMI.IsXbox360(dmi)) - ImageInfo.mediaType = MediaType.XGD2; + if(Decoders.Xbox.DMI.IsXbox(dmi)) ImageInfo.mediaType = MediaType.XGD; + else if(Decoders.Xbox.DMI.IsXbox360(dmi)) ImageInfo.mediaType = MediaType.XGD2; - ImageInfo.readableMediaTags.Add(MediaTagType.DVD_PFI); + ImageInfo.readableMediaTags.Add(MediaTagType.DVD_PFI); ImageInfo.readableMediaTags.Add(MediaTagType.DVD_DMI); } } @@ -549,16 +560,11 @@ namespace DiscImageChef.ImagePlugins } } - if(!data && !firstdata) - ImageInfo.mediaType = MediaType.CDDA; - else if(firstaudio && data && sessions.Count > 1 && mode2) - ImageInfo.mediaType = MediaType.CDPLUS; - else if((firstdata && audio) || mode2) - ImageInfo.mediaType = MediaType.CDROMXA; - else if(!audio) - ImageInfo.mediaType = MediaType.CDROM; - else - ImageInfo.mediaType = MediaType.CD; + if(!data && !firstdata) ImageInfo.mediaType = MediaType.CDDA; + else if(firstaudio && data && sessions.Count > 1 && mode2) ImageInfo.mediaType = MediaType.CDPLUS; + else if((firstdata && audio) || mode2) ImageInfo.mediaType = MediaType.CDROMXA; + else if(!audio) ImageInfo.mediaType = MediaType.CDROM; + else ImageInfo.mediaType = MediaType.CD; } DicConsole.DebugWriteLine("Alcohol 120% plugin", "ImageInfo.mediaType = {0}", ImageInfo.mediaType); @@ -571,12 +577,9 @@ namespace DiscImageChef.ImagePlugins AlcoholTrack enTrk; AlcoholTrackExtra enTrkExt; - if(!alcTracks.TryGetValue(alcSes.firstTrack, out stTrk)) - break; - if(!alcTracks.TryGetValue(alcSes.lastTrack, out enTrk)) - break; - if(!alcTrackExtras.TryGetValue(alcSes.lastTrack, out enTrkExt)) - break; + if(!alcTracks.TryGetValue(alcSes.firstTrack, out stTrk)) break; + if(!alcTracks.TryGetValue(alcSes.lastTrack, out enTrk)) break; + if(!alcTrackExtras.TryGetValue(alcSes.lastTrack, out enTrkExt)) break; session.StartSector = stTrk.startLba; session.StartTrack = alcSes.firstTrack; @@ -611,15 +614,14 @@ namespace DiscImageChef.ImagePlugins byte_offset += partition.Size; } - if(!offsetmap.ContainsKey(trk.point)) - offsetmap.Add(trk.point, trk.startLba); + if(!offsetmap.ContainsKey(trk.point)) offsetmap.Add(trk.point, trk.startLba); switch(trk.mode) { case AlcoholTrackMode.Mode1: - case AlcoholTrackMode.Mode2F1: - case AlcoholTrackMode.Mode2F1Alt: - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + case AlcoholTrackMode.Mode2F1: + case AlcoholTrackMode.Mode2F1Alt: + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); @@ -633,16 +635,14 @@ namespace DiscImageChef.ImagePlugins ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - if(ImageInfo.sectorSize < 2048) - ImageInfo.sectorSize = 2048; + if(ImageInfo.sectorSize < 2048) ImageInfo.sectorSize = 2048; break; case AlcoholTrackMode.Mode2: if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(ImageInfo.sectorSize < 2336) - ImageInfo.sectorSize = 2336; + if(ImageInfo.sectorSize < 2336) ImageInfo.sectorSize = 2336; break; case AlcoholTrackMode.Mode2F2: if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) @@ -653,8 +653,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - if(ImageInfo.sectorSize < 2324) - ImageInfo.sectorSize = 2324; + if(ImageInfo.sectorSize < 2324) ImageInfo.sectorSize = 2324; break; case AlcoholTrackMode.DVD: ImageInfo.sectorSize = 2048; @@ -685,8 +684,7 @@ namespace DiscImageChef.ImagePlugins FiltersList filtersList = new FiltersList(); alcImage = filtersList.GetFilter(alcFile); - if(alcImage == null) - throw new Exception("Cannot open data file"); + if(alcImage == null) throw new Exception("Cannot open data file"); ImageInfo.imageSize = (ulong)alcImage.GetDataForkLength(); ImageInfo.imageCreationTime = alcImage.GetCreationTime(); @@ -700,13 +698,11 @@ namespace DiscImageChef.ImagePlugins byte firstSession = byte.MaxValue; byte lastSession = 0; MemoryStream tocMs = new MemoryStream(); - tocMs.Write(new byte[] { 0, 0, 0, 0 }, 0, 4); // Reserved for TOC response size and session numbers + tocMs.Write(new byte[] {0, 0, 0, 0}, 0, 4); // Reserved for TOC response size and session numbers foreach(KeyValuePair> sessionToc in alcToc) { - if(sessionToc.Key < firstSession) - firstSession = (byte)sessionToc.Key; - if(sessionToc.Key > lastSession) - lastSession = (byte)sessionToc.Key; + if(sessionToc.Key < firstSession) firstSession = (byte)sessionToc.Key; + if(sessionToc.Key > lastSession) lastSession = (byte)sessionToc.Key; foreach(AlcoholTrack sessionTrack in sessionToc.Value.Values) { @@ -723,6 +719,7 @@ namespace DiscImageChef.ImagePlugins tocMs.WriteByte(sessionTrack.pframe); } } + fullToc = tocMs.ToArray(); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; byte[] fullTocSize = BigEndianBitConverter.GetBytes((short)(fullToc.Length - 2)); @@ -738,20 +735,19 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("Alcohol 120% plugin", "TOC not correctly rebuilt"); fullToc = null; } - else - ImageInfo.readableMediaTags.Add(MediaTagType.CD_FullTOC); + else ImageInfo.readableMediaTags.Add(MediaTagType.CD_FullTOC); ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackFlags); } - if(ImageInfo.mediaType == MediaType.XGD2) - { - // All XGD3 all have the same number of blocks - if(ImageInfo.sectors == 25063 || // Locked (or non compatible drive) - ImageInfo.sectors == 4229664 || // Xtreme unlock - ImageInfo.sectors == 4246304) // Wxripper unlock - ImageInfo.mediaType = MediaType.XGD3; - } + if(ImageInfo.mediaType == MediaType.XGD2) + { + // All XGD3 all have the same number of blocks + if(ImageInfo.sectors == 25063 || // Locked (or non compatible drive) + ImageInfo.sectors == 4229664 || // Xtreme unlock + ImageInfo.sectors == 4246304) // Wxripper unlock + ImageInfo.mediaType = MediaType.XGD3; + } DicConsole.VerboseWriteLine("Alcohol 120% image describes a disc of type {0}", ImageInfo.mediaType); @@ -783,37 +779,29 @@ namespace DiscImageChef.ImagePlugins switch(tag) { case MediaTagType.DVD_BCA: - { - if(bca != null) - { - return (byte[])bca.Clone(); - } - throw new FeatureNotPresentImageException("Image does not contain BCA information."); - } + { + if(bca != null) { return (byte[])bca.Clone(); } + + throw new FeatureNotPresentImageException("Image does not contain BCA information."); + } case MediaTagType.DVD_PFI: - { - if(pfi != null) - { - return (byte[])pfi.Clone(); - } - throw new FeatureNotPresentImageException("Image does not contain PFI."); - } + { + if(pfi != null) { return (byte[])pfi.Clone(); } + + throw new FeatureNotPresentImageException("Image does not contain PFI."); + } case MediaTagType.DVD_DMI: - { - if(dmi != null) - { - return (byte[])dmi.Clone(); - } - throw new FeatureNotPresentImageException("Image does not contain DMI."); - } + { + if(dmi != null) { return (byte[])dmi.Clone(); } + + throw new FeatureNotPresentImageException("Image does not contain DMI."); + } case MediaTagType.CD_FullTOC: - { - if(fullToc != null) - { - return (byte[])fullToc.Clone(); - } - throw new FeatureNotPresentImageException("Image does not contain TOC information."); - } + { + if(fullToc != null) { return (byte[])fullToc.Clone(); } + + throw new FeatureNotPresentImageException("Image does not contain TOC information."); + } default: throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format"); } @@ -892,7 +880,10 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length + sectorAddress > _extra.sectors) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length + sectorAddress, _extra.sectors)); + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length + sectorAddress, _extra.sectors)); uint sector_offset; uint sector_size; @@ -901,50 +892,49 @@ namespace DiscImageChef.ImagePlugins switch(_track.mode) { case AlcoholTrackMode.Mode1: - { - sector_offset = 16; - sector_size = 2048; - sector_skip = 288; - break; - } + { + sector_offset = 16; + sector_size = 2048; + sector_skip = 288; + break; + } case AlcoholTrackMode.Mode2: - { - sector_offset = 16; - sector_size = 2336; - sector_skip = 0; - break; - } + { + sector_offset = 16; + sector_size = 2336; + sector_skip = 0; + break; + } case AlcoholTrackMode.Mode2F1: - case AlcoholTrackMode.Mode2F1Alt: - { - sector_offset = 24; - sector_size = 2048; - sector_skip = 280; - break; - } + case AlcoholTrackMode.Mode2F1Alt: + { + sector_offset = 24; + sector_size = 2048; + sector_skip = 280; + break; + } case AlcoholTrackMode.Mode2F2: - { - sector_offset = 24; - sector_size = 2324; - sector_skip = 4; - break; - } + { + sector_offset = 24; + sector_size = 2324; + sector_skip = 4; + break; + } case AlcoholTrackMode.Audio: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } case AlcoholTrackMode.DVD: - { - sector_offset = 0; - sector_size = 2048; - sector_skip = 0; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + { + sector_offset = 0; + sector_size = 2048; + sector_skip = 0; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } switch(_track.subMode) @@ -955,17 +945,17 @@ namespace DiscImageChef.ImagePlugins case AlcoholSubchannelMode.Interleaved: sector_skip += 96; break; - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); } byte[] buffer = new byte[sector_size * length]; imageStream = alcImage.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.startOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + br.BaseStream + .Seek((long)_track.startOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -990,7 +980,10 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length + sectorAddress > _extra.sectors) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length, _extra.sectors)); + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length, _extra.sectors)); uint sector_offset; uint sector_size; @@ -1008,274 +1001,270 @@ namespace DiscImageChef.ImagePlugins case SectorTagType.CDSectorHeader: case SectorTagType.CDSectorSubchannel: case SectorTagType.CDSectorSubHeader: - case SectorTagType.CDSectorSync: - break; - case SectorTagType.CDTrackFlags: - return new byte[] { ((byte)(_track.adrCtl & 0x0F)) }; - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + case SectorTagType.CDSectorSync: break; + case SectorTagType.CDTrackFlags: return new byte[] {((byte)(_track.adrCtl & 0x0F))}; + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } switch(_track.mode) { case AlcoholTrackMode.Mode1: - switch(tag) + switch(tag) { case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } + { + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; + } case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } case SectorTagType.CDSectorSubHeader: throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - sector_skip = 104; - break; - } - case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2064; - sector_size = 4; - sector_skip = 284; - break; - } - case SectorTagType.CDSectorSubchannel: - { - switch(_track.subMode) - { - case AlcoholSubchannelMode.Interleaved: - - sector_offset = 2352; - sector_size = 96; - sector_skip = 0; - break; - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - break; - case AlcoholTrackMode.Mode2: - { - switch(tag) { - case SectorTagType.CDSectorSync: - case SectorTagType.CDSectorHeader: - case SectorTagType.CDSectorECC: - case SectorTagType.CDSectorECC_P: - case SectorTagType.CDSectorECC_Q: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorSubHeader: - { - sector_offset = 0; - sector_size = 8; - sector_skip = 2328; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2332; - sector_size = 4; + sector_offset = 2076; + sector_size = 276; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorECC_P: + { + sector_offset = 2076; + sector_size = 172; + sector_skip = 104; + break; + } + case SectorTagType.CDSectorECC_Q: + { + sector_offset = 2248; + sector_size = 104; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2064; + sector_size = 4; + sector_skip = 284; + break; + } + case SectorTagType.CDSectorSubchannel: + { + switch(_track.subMode) + { + case AlcoholSubchannelMode.Interleaved: + + sector_offset = 2352; + sector_size = 96; sector_skip = 0; break; - } - case SectorTagType.CDSectorSubchannel: - { - switch(_track.subMode) - { - case AlcoholSubchannelMode.Interleaved: + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } - sector_offset = 2352; - sector_size = 96; - sector_skip = 0; - break; - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + break; } - break; + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } - case AlcoholTrackMode.Mode2F1: - case AlcoholTrackMode.Mode2F1Alt: - switch(tag) + + break; + case AlcoholTrackMode.Mode2: + { + switch(tag) { case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } - case SectorTagType.CDSectorSubHeader: - { - sector_offset = 16; - sector_size = 8; - sector_skip = 2328; - break; - } case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - sector_skip = 0; - break; - } case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - sector_skip = 104; - break; - } case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - sector_skip = 0; - break; - } + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + case SectorTagType.CDSectorSubHeader: + { + sector_offset = 0; + sector_size = 8; + sector_skip = 2328; + break; + } case SectorTagType.CDSectorEDC: - { - sector_offset = 2072; - sector_size = 4; - sector_skip = 276; - break; - } + { + sector_offset = 2332; + sector_size = 4; + sector_skip = 0; + break; + } case SectorTagType.CDSectorSubchannel: + { + switch(_track.subMode) { - switch(_track.subMode) - { - case AlcoholSubchannelMode.Interleaved: + case AlcoholSubchannelMode.Interleaved: - sector_offset = 2352; - sector_size = 96; - sector_skip = 0; - break; - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - break; + sector_offset = 2352; + sector_size = 96; + sector_skip = 0; + break; + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } + + break; + } + case AlcoholTrackMode.Mode2F1: + case AlcoholTrackMode.Mode2F1Alt: + switch(tag) + { + case SectorTagType.CDSectorSync: + { + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; + } + case SectorTagType.CDSectorHeader: + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } + case SectorTagType.CDSectorSubHeader: + { + sector_offset = 16; + sector_size = 8; + sector_skip = 2328; + break; + } + case SectorTagType.CDSectorECC: + { + sector_offset = 2076; + sector_size = 276; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorECC_P: + { + sector_offset = 2076; + sector_size = 172; + sector_skip = 104; + break; + } + case SectorTagType.CDSectorECC_Q: + { + sector_offset = 2248; + sector_size = 104; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2072; + sector_size = 4; + sector_skip = 276; + break; + } + case SectorTagType.CDSectorSubchannel: + { + switch(_track.subMode) + { + case AlcoholSubchannelMode.Interleaved: + + sector_offset = 2352; + sector_size = 96; + sector_skip = 0; + break; + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + break; case AlcoholTrackMode.Mode2F2: switch(tag) { case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } + { + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; + } case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } case SectorTagType.CDSectorSubHeader: - { - sector_offset = 16; - sector_size = 8; - sector_skip = 2328; - break; - } + { + sector_offset = 16; + sector_size = 8; + sector_skip = 2328; + break; + } case SectorTagType.CDSectorEDC: - { - sector_offset = 2348; - sector_size = 4; - sector_skip = 0; - break; - } + { + sector_offset = 2348; + sector_size = 4; + sector_skip = 0; + break; + } case SectorTagType.CDSectorSubchannel: + { + switch(_track.subMode) { - switch(_track.subMode) - { - case AlcoholSubchannelMode.Interleaved: + case AlcoholSubchannelMode.Interleaved: - sector_offset = 2352; - sector_size = 96; - sector_skip = 0; - break; - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - break; + sector_offset = 2352; + sector_size = 96; + sector_skip = 0; + break; + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } + break; case AlcoholTrackMode.Audio: + { + switch(tag) { - switch(tag) + case SectorTagType.CDSectorSubchannel: { - case SectorTagType.CDSectorSubchannel: - { - switch(_track.subMode) - { - case AlcoholSubchannelMode.Interleaved: + switch(_track.subMode) + { + case AlcoholSubchannelMode.Interleaved: - sector_offset = 2352; - sector_size = 96; - sector_skip = 0; - break; - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } + sector_offset = 2352; + sector_size = 96; + sector_skip = 0; break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + + break; } - break; + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } switch(_track.subMode) @@ -1284,20 +1273,19 @@ namespace DiscImageChef.ImagePlugins sector_skip += 0; break; case AlcoholSubchannelMode.Interleaved: - if(tag != SectorTagType.CDSectorSubchannel) - sector_skip += 96; + if(tag != SectorTagType.CDSectorSubchannel) sector_skip += 96; break; - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); } byte[] buffer = new byte[sector_size * length]; imageStream = alcImage.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.startOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + br.BaseStream + .Seek((long)_track.startOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -1354,7 +1342,10 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length + sectorAddress > _extra.sectors) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length, _extra.sectors)); + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length, _extra.sectors)); uint sector_offset; uint sector_size; @@ -1363,27 +1354,28 @@ namespace DiscImageChef.ImagePlugins switch(_track.mode) { case AlcoholTrackMode.Mode1: - case AlcoholTrackMode.Mode2: + case AlcoholTrackMode.Mode2: case AlcoholTrackMode.Mode2F1: - case AlcoholTrackMode.Mode2F1Alt: - case AlcoholTrackMode.Mode2F2: + case AlcoholTrackMode.Mode2F1Alt: + case AlcoholTrackMode.Mode2F2: case AlcoholTrackMode.Audio: case AlcoholTrackMode.DVD: - { - sector_offset = 0; - sector_size = _track.sectorSize; - sector_skip = 0; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + { + sector_offset = 0; + sector_size = _track.sectorSize; + sector_skip = 0; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; imageStream = alcImage.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.startOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); + br.BaseStream + .Seek((long)_track.startOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); buffer = br.ReadBytes((int)(sector_size * length)); return buffer; @@ -1424,8 +1416,7 @@ namespace DiscImageChef.ImagePlugins foreach(Session session in sessions) { - if(track.point >= session.StartTrack || - track.point <= session.EndTrack) + if(track.point >= session.StartTrack || track.point <= session.EndTrack) { sessionNo = session.SessionSequence; break; @@ -1474,10 +1465,8 @@ namespace DiscImageChef.ImagePlugins public override List GetSessionTracks(Session session) { - if(sessions.Contains(session)) - { - return GetSessionTracks(session.SessionSequence); - } + if(sessions.Contains(session)) { return GetSessionTracks(session.SessionSequence); } + throw new ImageNotSupportedException("Session does not exist in disc image"); } @@ -1491,8 +1480,7 @@ namespace DiscImageChef.ImagePlugins foreach(Session ses in sessions) { - if(track.point >= ses.StartTrack || - track.point <= ses.EndTrack) + if(track.point >= ses.StartTrack || track.point <= ses.EndTrack) { sessionNo = ses.SessionSequence; break; @@ -1556,7 +1544,8 @@ namespace DiscImageChef.ImagePlugins return Checksums.CDChecksums.CheckCDSector(buffer); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, out List UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, + out List UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); @@ -1580,14 +1569,14 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, out List UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, + out List UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length, track); int bps = (int)(buffer.Length / length); @@ -1611,10 +1600,9 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } @@ -1631,15 +1619,12 @@ namespace DiscImageChef.ImagePlugins { case AlcoholTrackMode.Audio: case AlcoholTrackMode.Mode1: - case AlcoholTrackMode.Mode2: + case AlcoholTrackMode.Mode2: case AlcoholTrackMode.Mode2F2: case AlcoholTrackMode.Mode2F1: - case AlcoholTrackMode.Mode2F1Alt: - return 2352; - case AlcoholTrackMode.DVD: - return 2048; - default: - return 0; + case AlcoholTrackMode.Mode2F1Alt: return 2352; + case AlcoholTrackMode.DVD: return 2048; + default: return 0; } } @@ -1648,19 +1633,13 @@ namespace DiscImageChef.ImagePlugins switch(trackMode) { case AlcoholTrackMode.Mode1: - case AlcoholTrackMode.Mode2F1: - case AlcoholTrackMode.Mode2F1Alt: - return 2048; - case AlcoholTrackMode.Mode2F2: - return 2324; - case AlcoholTrackMode.Mode2: - return 2336; - case AlcoholTrackMode.Audio: - return 2352; - case AlcoholTrackMode.DVD: - return 2048; - default: - return 0; + case AlcoholTrackMode.Mode2F1: + case AlcoholTrackMode.Mode2F1Alt: return 2048; + case AlcoholTrackMode.Mode2F2: return 2324; + case AlcoholTrackMode.Mode2: return 2336; + case AlcoholTrackMode.Audio: return 2352; + case AlcoholTrackMode.DVD: return 2048; + default: return 0; } } @@ -1668,19 +1647,13 @@ namespace DiscImageChef.ImagePlugins { switch(trackType) { - case AlcoholTrackMode.Mode1: - return TrackType.CDMode1; + case AlcoholTrackMode.Mode1: return TrackType.CDMode1; case AlcoholTrackMode.Mode2F1: - case AlcoholTrackMode.Mode2F1Alt: - return TrackType.CDMode2Form1; - case AlcoholTrackMode.Mode2F2: - return TrackType.CDMode2Form2; - case AlcoholTrackMode.Mode2: - return TrackType.CDMode2Formless; - case AlcoholTrackMode.Audio: - return TrackType.Audio; - default: - return TrackType.Data; + case AlcoholTrackMode.Mode2F1Alt: return TrackType.CDMode2Form1; + case AlcoholTrackMode.Mode2F2: return TrackType.CDMode2Form2; + case AlcoholTrackMode.Mode2: return TrackType.CDMode2Formless; + case AlcoholTrackMode.Audio: return TrackType.Audio; + default: return TrackType.Data; } } @@ -1688,18 +1661,12 @@ namespace DiscImageChef.ImagePlugins { switch(discType) { - case AlcoholMediumType.CD: - return MediaType.CD; - case AlcoholMediumType.CDR: - return MediaType.CDR; - case AlcoholMediumType.CDRW: - return MediaType.CDRW; - case AlcoholMediumType.DVD: - return MediaType.DVDROM; - case AlcoholMediumType.DVDR: - return MediaType.DVDR; - default: - return MediaType.Unknown; + case AlcoholMediumType.CD: return MediaType.CD; + case AlcoholMediumType.CDR: return MediaType.CDR; + case AlcoholMediumType.CDRW: return MediaType.CDRW; + case AlcoholMediumType.DVD: return MediaType.DVDROM; + case AlcoholMediumType.DVDR: return MediaType.DVDR; + default: return MediaType.Unknown; } } #endregion Private methods @@ -1786,5 +1753,4 @@ namespace DiscImageChef.ImagePlugins } #endregion Unsupported features } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/Anex86.cs b/DiscImageChef.DiscImages/Anex86.cs index dc444289..0243a050 100644 --- a/DiscImageChef.DiscImages/Anex86.cs +++ b/DiscImageChef.DiscImages/Anex86.cs @@ -40,515 +40,510 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class Anex86 : ImagePlugin - { - #region Internal structures - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct Anex86Header - { - public int unknown; - public int hddtype; - public int hdrSize; - public int dskSize; - public int bps; - public int spt; - public int heads; - public int cylinders; - } - #endregion - - public Anex86() - { - Name = "Anex86 Disk Image"; - PluginUUID = new Guid("0410003E-6E7B-40E6-9328-BA5651ADF6B7"); - ImageInfo = new ImageInfo() - { - readableSectorTags = new List(), - readableMediaTags = new List(), - imageHasPartitions = false, - imageHasSessions = false, - imageVersion = null, - imageApplication = null, - imageApplicationVersion = null, - imageCreator = null, - imageComments = null, - mediaManufacturer = null, - mediaModel = null, - mediaSerialNumber = null, - mediaBarcode = null, - mediaPartNumber = null, - mediaSequence = 0, - lastMediaSequence = 0, - driveManufacturer = null, - driveModel = null, - driveSerialNumber = null, - driveFirmwareRevision = null - }; - } - - Anex86Header fdihdr; - Filter anexImageFilter; - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - fdihdr = new Anex86Header(); - - if(stream.Length < Marshal.SizeOf(fdihdr)) - return false; - - byte[] hdr_b = new byte[Marshal.SizeOf(fdihdr)]; - stream.Read(hdr_b, 0, hdr_b.Length); - - GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); - fdihdr = (Anex86Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Anex86Header)); - handle.Free(); - - DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.unknown = {0}", fdihdr.unknown); - DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.hddtype = {0}", fdihdr.hddtype); - DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.hdrSize = {0}", fdihdr.hdrSize); - DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.dskSize = {0}", fdihdr.dskSize); - DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.bps = {0}", fdihdr.bps); - DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.spt = {0}", fdihdr.spt); - DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.heads = {0}", fdihdr.heads); - DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.cylinders = {0}", fdihdr.cylinders); - - return stream.Length == fdihdr.hdrSize + fdihdr.dskSize && fdihdr.dskSize == fdihdr.bps * fdihdr.spt * fdihdr.heads * fdihdr.cylinders; - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - fdihdr = new Anex86Header(); - - if(stream.Length < Marshal.SizeOf(fdihdr)) - return false; - - byte[] hdr_b = new byte[Marshal.SizeOf(fdihdr)]; - stream.Read(hdr_b, 0, hdr_b.Length); - - GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); - fdihdr = (Anex86Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Anex86Header)); - handle.Free(); - - ImageInfo.mediaType = MediaType.GENERIC_HDD; - - switch(fdihdr.cylinders) - { - case 40: - switch(fdihdr.bps) - { - case 512: - switch(fdihdr.spt) - { - case 8: - if(fdihdr.heads == 1) - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; - else if(fdihdr.heads == 2) - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; - break; - case 9: - if(fdihdr.heads == 1) - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; - else if(fdihdr.heads == 2) - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; - break; - } - break; - } - break; - case 70: - switch(fdihdr.bps) - { - case 512: - switch(fdihdr.spt) - { - case 9: - if(fdihdr.heads == 1) - ImageInfo.mediaType = MediaType.Apricot_35; - break; - } - break; - } - break; - case 77: - switch(fdihdr.bps) - { - case 128: - switch(fdihdr.spt) - { - case 26: - if(fdihdr.heads == 2) - ImageInfo.mediaType = MediaType.NEC_8_SD; - break; - } - break; - case 256: - switch(fdihdr.spt) - { - case 26: - if(fdihdr.heads == 2) - ImageInfo.mediaType = MediaType.NEC_8_DD; - break; - } - break; - case 512: - switch(fdihdr.spt) - { - case 8: - if(fdihdr.heads == 1) - ImageInfo.mediaType = MediaType.Apricot_35; - break; - } - break; - case 1024: - switch(fdihdr.spt) - { - case 8: - if(fdihdr.heads == 2) - ImageInfo.mediaType = MediaType.NEC_525_HD; - break; - } - break; - } - break; - case 80: - switch(fdihdr.bps) - { - case 256: - switch(fdihdr.spt) - { - case 16: - if(fdihdr.heads == 1) - ImageInfo.mediaType = MediaType.NEC_525_SS; - else if(fdihdr.heads == 2) - ImageInfo.mediaType = MediaType.NEC_525_DS; - break; - } - break; - case 512: - switch(fdihdr.spt) - { - case 8: - if(fdihdr.heads == 1) - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; - else if(fdihdr.heads == 2) - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; - break; - case 9: - if(fdihdr.heads == 1) - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; - else if(fdihdr.heads == 2) - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; - break; - case 15: - if(fdihdr.heads == 2) - ImageInfo.mediaType = MediaType.NEC_35_HD_15; - break; - case 18: - if(fdihdr.heads == 2) - ImageInfo.mediaType = MediaType.DOS_35_HD; - break; - case 36: - if(fdihdr.heads == 2) - ImageInfo.mediaType = MediaType.DOS_35_ED; - break; - } - break; - } - break; - case 240: - switch(fdihdr.bps) - { - case 512: - switch(fdihdr.spt) - { - case 38: - if(fdihdr.heads == 2) - ImageInfo.mediaType = MediaType.NEC_35_TD; - break; - } - break; - } - break; - } - DicConsole.DebugWriteLine("Anex86 plugin", "MediaType: {0}", ImageInfo.mediaType); - - ImageInfo.imageSize = (ulong)fdihdr.dskSize; - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.sectors = (ulong)(fdihdr.cylinders * fdihdr.heads * fdihdr.spt); - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.sectorSize = (uint)fdihdr.bps; - ImageInfo.cylinders = (uint)fdihdr.cylinders; - ImageInfo.heads = (uint)fdihdr.heads; - ImageInfo.sectorsPerTrack = (uint)fdihdr.spt; - - anexImageFilter = imageFilter; - - return true; - } - - public override bool ImageHasPartitions() - { - return false; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override string GetImageFormat() - { - return "Anex86 disk image"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] buffer = new byte[length * ImageInfo.sectorSize]; - - Stream stream = anexImageFilter.GetDataForkStream(); - - stream.Seek((long)((ulong)fdihdr.hdrSize + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); - - stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); - - return buffer; - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetMediaManufacturer() - { - return null; - } - - public override string GetMediaModel() - { - return null; - } - - public override string GetMediaSerialNumber() - { - return null; - } - - public override string GetMediaBarcode() - { - return null; - } - - public override string GetMediaPartNumber() - { - return null; - } - - public override int GetMediaSequence() - { - return 0; - } - - public override int GetLastDiskSequence() - { - return 0; - } - - public override string GetDriveManufacturer() - { - return null; - } - - public override string GetDriveModel() - { - return null; - } - - public override string GetDriveSerialNumber() - { - return null; - } - - public override List GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, out List UnknownLBAs) - { - FailingLBAs = new List(); - UnknownLBAs = new List(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, out List UnknownLBAs) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifyMediaImage() - { - return null; - } - - #endregion - } + public class Anex86 : ImagePlugin + { + #region Internal structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct Anex86Header + { + public int unknown; + public int hddtype; + public int hdrSize; + public int dskSize; + public int bps; + public int spt; + public int heads; + public int cylinders; + } + #endregion + + public Anex86() + { + Name = "Anex86 Disk Image"; + PluginUUID = new Guid("0410003E-6E7B-40E6-9328-BA5651ADF6B7"); + ImageInfo = new ImageInfo() + { + readableSectorTags = new List(), + readableMediaTags = new List(), + imageHasPartitions = false, + imageHasSessions = false, + imageVersion = null, + imageApplication = null, + imageApplicationVersion = null, + imageCreator = null, + imageComments = null, + mediaManufacturer = null, + mediaModel = null, + mediaSerialNumber = null, + mediaBarcode = null, + mediaPartNumber = null, + mediaSequence = 0, + lastMediaSequence = 0, + driveManufacturer = null, + driveModel = null, + driveSerialNumber = null, + driveFirmwareRevision = null + }; + } + + Anex86Header fdihdr; + Filter anexImageFilter; + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + fdihdr = new Anex86Header(); + + if(stream.Length < Marshal.SizeOf(fdihdr)) return false; + + byte[] hdr_b = new byte[Marshal.SizeOf(fdihdr)]; + stream.Read(hdr_b, 0, hdr_b.Length); + + GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); + fdihdr = (Anex86Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Anex86Header)); + handle.Free(); + + DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.unknown = {0}", fdihdr.unknown); + DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.hddtype = {0}", fdihdr.hddtype); + DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.hdrSize = {0}", fdihdr.hdrSize); + DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.dskSize = {0}", fdihdr.dskSize); + DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.bps = {0}", fdihdr.bps); + DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.spt = {0}", fdihdr.spt); + DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.heads = {0}", fdihdr.heads); + DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.cylinders = {0}", fdihdr.cylinders); + + return stream.Length == fdihdr.hdrSize + fdihdr.dskSize && + fdihdr.dskSize == fdihdr.bps * fdihdr.spt * fdihdr.heads * fdihdr.cylinders; + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + fdihdr = new Anex86Header(); + + if(stream.Length < Marshal.SizeOf(fdihdr)) return false; + + byte[] hdr_b = new byte[Marshal.SizeOf(fdihdr)]; + stream.Read(hdr_b, 0, hdr_b.Length); + + GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); + fdihdr = (Anex86Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Anex86Header)); + handle.Free(); + + ImageInfo.mediaType = MediaType.GENERIC_HDD; + + switch(fdihdr.cylinders) + { + case 40: + switch(fdihdr.bps) + { + case 512: + switch(fdihdr.spt) + { + case 8: + if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; + else if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; + break; + case 9: + if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; + else if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; + break; + } + + break; + } + + break; + case 70: + switch(fdihdr.bps) + { + case 512: + switch(fdihdr.spt) + { + case 9: + if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.Apricot_35; + break; + } + + break; + } + + break; + case 77: + switch(fdihdr.bps) + { + case 128: + switch(fdihdr.spt) + { + case 26: + if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.NEC_8_SD; + break; + } + + break; + case 256: + switch(fdihdr.spt) + { + case 26: + if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.NEC_8_DD; + break; + } + + break; + case 512: + switch(fdihdr.spt) + { + case 8: + if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.Apricot_35; + break; + } + + break; + case 1024: + switch(fdihdr.spt) + { + case 8: + if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.NEC_525_HD; + break; + } + + break; + } + + break; + case 80: + switch(fdihdr.bps) + { + case 256: + switch(fdihdr.spt) + { + case 16: + if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.NEC_525_SS; + else if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.NEC_525_DS; + break; + } + + break; + case 512: + switch(fdihdr.spt) + { + case 8: + if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; + else if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; + break; + case 9: + if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; + else if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; + break; + case 15: + if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.NEC_35_HD_15; + break; + case 18: + if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.DOS_35_HD; + break; + case 36: + if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.DOS_35_ED; + break; + } + + break; + } + + break; + case 240: + switch(fdihdr.bps) + { + case 512: + switch(fdihdr.spt) + { + case 38: + if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.NEC_35_TD; + break; + } + + break; + } + + break; + } + + DicConsole.DebugWriteLine("Anex86 plugin", "MediaType: {0}", ImageInfo.mediaType); + + ImageInfo.imageSize = (ulong)fdihdr.dskSize; + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.sectors = (ulong)(fdihdr.cylinders * fdihdr.heads * fdihdr.spt); + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.sectorSize = (uint)fdihdr.bps; + ImageInfo.cylinders = (uint)fdihdr.cylinders; + ImageInfo.heads = (uint)fdihdr.heads; + ImageInfo.sectorsPerTrack = (uint)fdihdr.spt; + + anexImageFilter = imageFilter; + + return true; + } + + public override bool ImageHasPartitions() + { + return false; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override string GetImageFormat() + { + return "Anex86 disk image"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] buffer = new byte[length * ImageInfo.sectorSize]; + + Stream stream = anexImageFilter.GetDataForkStream(); + + stream.Seek((long)((ulong)fdihdr.hdrSize + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); + + stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); + + return buffer; + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetMediaManufacturer() + { + return null; + } + + public override string GetMediaModel() + { + return null; + } + + public override string GetMediaSerialNumber() + { + return null; + } + + public override string GetMediaBarcode() + { + return null; + } + + public override string GetMediaPartNumber() + { + return null; + } + + public override int GetMediaSequence() + { + return 0; + } + + public override int GetLastDiskSequence() + { + return 0; + } + + public override string GetDriveManufacturer() + { + return null; + } + + public override string GetDriveModel() + { + return null; + } + + public override string GetDriveSerialNumber() + { + return null; + } + + public override List GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, + out List UnknownLBAs) + { + FailingLBAs = new List(); + UnknownLBAs = new List(); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, + out List UnknownLBAs) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifyMediaImage() + { + return null; + } + #endregion + } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/Apple2MG.cs b/DiscImageChef.DiscImages/Apple2MG.cs index f75860e5..94e1330d 100644 --- a/DiscImageChef.DiscImages/Apple2MG.cs +++ b/DiscImageChef.DiscImages/Apple2MG.cs @@ -40,10 +40,9 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class Apple2MG : ImagePlugin + public class Apple2MG : ImagePlugin { #region Internal Structures - // DiskCopy 4.2 header, big-endian, data-fork, start of file, 84 bytes struct A2IMGHeader { @@ -116,11 +115,9 @@ namespace DiscImageChef.ImagePlugins /// public uint reserved4; } - #endregion #region Internal Constants - /// /// Magic number, "2IMG" /// @@ -161,14 +158,11 @@ namespace DiscImageChef.ImagePlugins public const uint LockedDisk = 0x80000000; public const uint ValidVolumeNumber = 0x00000100; public const uint VolumeNumberMask = 0x000000FF; - #endregion #region Internal variables - A2IMGHeader ImageHeader; Filter a2mgImageFilter; - #endregion public Apple2MG() @@ -203,38 +197,30 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 65) - return false; + if(stream.Length < 65) return false; byte[] header = new byte[64]; stream.Read(header, 0, 64); uint magic = BitConverter.ToUInt32(header, 0x00); - if(magic != MAGIC) - return false; + if(magic != MAGIC) return false; uint dataoff = BitConverter.ToUInt32(header, 0x18); - if(dataoff > stream.Length) - return false; + if(dataoff > stream.Length) return false; uint datasize = BitConverter.ToUInt32(header, 0x1C); // There seems to be incorrect endian in some images on the wild - if(datasize == 0x00800C00) - datasize = 0x000C8000; - if(dataoff + datasize > stream.Length) - return false; + if(datasize == 0x00800C00) datasize = 0x000C8000; + if(dataoff + datasize > stream.Length) return false; uint commentoff = BitConverter.ToUInt32(header, 0x20); - if(commentoff > stream.Length) - return false; + if(commentoff > stream.Length) return false; uint commentsize = BitConverter.ToUInt32(header, 0x24); - if(commentoff + commentsize > stream.Length) - return false; + if(commentoff + commentsize > stream.Length) return false; uint creatoroff = BitConverter.ToUInt32(header, 0x28); - if(creatoroff > stream.Length) - return false; + if(creatoroff > stream.Length) return false; uint creatorsize = BitConverter.ToUInt32(header, 0x2C); return creatoroff + creatorsize <= stream.Length; @@ -290,21 +276,21 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.dataSize = {0}", ImageHeader.dataSize); DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.commentOffset = 0x{0:X8}", ImageHeader.commentOffset); DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.commentSize = {0}", ImageHeader.commentSize); - DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.creatorSpecificOffset = 0x{0:X8}", ImageHeader.creatorSpecificOffset); - DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.creatorSpecificSize = {0}", ImageHeader.creatorSpecificSize); + DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.creatorSpecificOffset = 0x{0:X8}", + ImageHeader.creatorSpecificOffset); + DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.creatorSpecificSize = {0}", + ImageHeader.creatorSpecificSize); DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.reserved1 = 0x{0:X8}", ImageHeader.reserved1); DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.reserved2 = 0x{0:X8}", ImageHeader.reserved2); DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.reserved3 = 0x{0:X8}", ImageHeader.reserved3); DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.reserved4 = 0x{0:X8}", ImageHeader.reserved4); - if(ImageHeader.dataSize == 0 && ImageHeader.blocks == 0 && ImageHeader.imageFormat != ProDOSSectorOrder) - return false; + if(ImageHeader.dataSize == 0 && ImageHeader.blocks == 0 && + ImageHeader.imageFormat != ProDOSSectorOrder) return false; - if(ImageHeader.imageFormat == ProDOSSectorOrder && ImageHeader.blocks == 0) - return false; + if(ImageHeader.imageFormat == ProDOSSectorOrder && ImageHeader.blocks == 0) return false; - if(ImageHeader.imageFormat == ProDOSSectorOrder) - ImageHeader.dataSize = ImageHeader.blocks * 512; + if(ImageHeader.imageFormat == ProDOSSectorOrder) ImageHeader.dataSize = ImageHeader.blocks * 512; else if(ImageHeader.blocks == 0 && ImageHeader.dataSize != 0) ImageHeader.blocks = ImageHeader.dataSize / 256; else if(ImageHeader.dataSize == 0 && ImageHeader.blocks != 0) @@ -317,7 +303,6 @@ namespace DiscImageChef.ImagePlugins switch(ImageHeader.creator) { - case CreatorAsimov: ImageInfo.imageApplication = "ASIMOV2"; break; @@ -340,7 +325,8 @@ namespace DiscImageChef.ImagePlugins ImageInfo.imageApplication = "CiderPress"; break; default: - ImageInfo.imageApplication = string.Format("Unknown creator code \"{0}\"", Encoding.ASCII.GetString(creator)); + ImageInfo.imageApplication = + string.Format("Unknown creator code \"{0}\"", Encoding.ASCII.GetString(creator)); break; } @@ -358,7 +344,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.mediaType = GetMediaType(); + ImageInfo.mediaType = GetMediaType(); a2mgImageFilter = imageFilter; @@ -368,43 +354,43 @@ namespace DiscImageChef.ImagePlugins if(!string.IsNullOrEmpty(ImageInfo.imageComments)) DicConsole.VerboseWriteLine("2MG comments: {0}", ImageInfo.imageComments); - switch(ImageInfo.mediaType) - { - case MediaType.Apple32SS: - ImageInfo.cylinders = 35; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 13; - break; - case MediaType.Apple32DS: - ImageInfo.cylinders = 35; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 13; - break; - case MediaType.Apple33SS: - ImageInfo.cylinders = 35; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 16; - break; - case MediaType.Apple33DS: - ImageInfo.cylinders = 35; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 16; - break; - case MediaType.AppleSonySS: - ImageInfo.cylinders = 80; - ImageInfo.heads = 1; - // Variable sectors per track, this suffices - ImageInfo.sectorsPerTrack = 10; - break; - case MediaType.AppleSonyDS: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - // Variable sectors per track, this suffices - ImageInfo.sectorsPerTrack = 10; - break; - } + switch(ImageInfo.mediaType) + { + case MediaType.Apple32SS: + ImageInfo.cylinders = 35; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 13; + break; + case MediaType.Apple32DS: + ImageInfo.cylinders = 35; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 13; + break; + case MediaType.Apple33SS: + ImageInfo.cylinders = 35; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 16; + break; + case MediaType.Apple33DS: + ImageInfo.cylinders = 35; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 16; + break; + case MediaType.AppleSonySS: + ImageInfo.cylinders = 80; + ImageInfo.heads = 1; + // Variable sectors per track, this suffices + ImageInfo.sectorsPerTrack = 10; + break; + case MediaType.AppleSonyDS: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + // Variable sectors per track, this suffices + ImageInfo.sectorsPerTrack = 10; + break; + } - return true; + return true; } public override bool ImageHasPartitions() @@ -476,20 +462,13 @@ namespace DiscImageChef.ImagePlugins { switch(ImageInfo.sectors) { - case 455: - return MediaType.Apple32SS; - case 910: - return MediaType.Apple32DS; - case 560: - return MediaType.Apple33SS; - case 1120: - return MediaType.Apple33DS; - case 800: - return MediaType.AppleSonySS; - case 1600: - return MediaType.AppleSonyDS; - default: - return MediaType.Unknown; + case 455: return MediaType.Apple32SS; + case 910: return MediaType.Apple32DS; + case 560: return MediaType.Apple33SS; + case 1120: return MediaType.Apple33DS; + case 800: return MediaType.AppleSonySS; + case 1600: return MediaType.AppleSonyDS; + default: return MediaType.Unknown; } } @@ -518,7 +497,6 @@ namespace DiscImageChef.ImagePlugins } #region Unsupported features - public override byte[] ReadDiskTag(MediaTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -659,16 +637,18 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, out List UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, + out List UnknownLBAs) { FailingLBAs = new List(); UnknownLBAs = new List(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, out List UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, + out List UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -677,7 +657,6 @@ namespace DiscImageChef.ImagePlugins { return null; } - #endregion } -} +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/AppleDOS.cs b/DiscImageChef.DiscImages/AppleDOS.cs index f28d565a..5e8518eb 100644 --- a/DiscImageChef.DiscImages/AppleDOS.cs +++ b/DiscImageChef.DiscImages/AppleDOS.cs @@ -38,360 +38,353 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - // Checked using several images and strings inside Apple's DiskImages.framework - public class AppleDOS : ImagePlugin - { - #region Internal variables - - byte[] deinterleaved; - string extension; - - #endregion - - public AppleDOS() - { - Name = "Apple ][ Interleaved Disk Image"; - PluginUUID = new Guid("A5828AC0-62C9-4304-81D4-EFD4AAE47360"); - ImageInfo = new ImageInfo - { - readableSectorTags = new List(), - readableMediaTags = new List(), - imageHasPartitions = false, - imageHasSessions = false, - imageVersion = null, - imageApplication = null, - imageApplicationVersion = null, - imageCreator = null, - imageComments = null, - mediaManufacturer = null, - mediaModel = null, - mediaSerialNumber = null, - mediaBarcode = null, - mediaPartNumber = null, - mediaSequence = 0, - lastMediaSequence = 0, - driveManufacturer = null, - driveModel = null, - driveSerialNumber = null, - driveFirmwareRevision = null - }; - } - - public override bool IdentifyImage(Filter imageFilter) - { - extension = Path.GetExtension(imageFilter.GetFilename()).ToLower(); - - if(imageFilter.GetDataForkLength() == 143360 && (extension == ".po" || extension == ".do")) - return true; - - return false; - } - - readonly int[] dosOffsets = { 0, 7, 14, 6, 13, 5, 12, 4, 11, 3, 10, 2, 9, 1, 8, 15 }; - readonly int[] prodosOffsets = { 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 }; - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - byte[] tmp = new byte[imageFilter.GetDataForkLength()]; - stream.Read(tmp, 0, tmp.Length); - - deinterleaved = new byte[tmp.Length]; - - extension = Path.GetExtension(imageFilter.GetFilename()).ToLower(); - - int[] offsets; - - if(extension == ".do") - offsets = dosOffsets; - else - offsets = prodosOffsets; - - for(int t = 0; t < 35; t++) - { - for(int s = 0; s < 16; s++) - Array.Copy(tmp, (t * 16 * 256) + (s * 256), deinterleaved, (t * 16 * 256) + (offsets[s] * 256), 256); - } - - ImageInfo.sectorSize = 256; - ImageInfo.imageSize = (ulong)imageFilter.GetDataForkLength(); - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.sectors = 560; - ImageInfo.mediaType = MediaType.Apple33SS; - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.cylinders = 35; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 16; - - return true; - } - - public override bool ImageHasPartitions() - { - return ImageInfo.imageHasPartitions; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] buffer = new byte[length * ImageInfo.sectorSize]; - - Array.Copy(deinterleaved, (int)(sectorAddress * ImageInfo.sectorSize), buffer, 0, buffer.Length); - - return buffer; - } - - public override string GetImageFormat() - { - if(extension == ".po") - return "Apple ][ Interleaved Disk Image (ProDOS order)"; - return "Apple ][ Interleaved Disk Image (DOS order)"; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, out List UnknownLBAs) - { - FailingLBAs = new List(); - UnknownLBAs = new List(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, out List UnknownLBAs) - { - FailingLBAs = new List(); - UnknownLBAs = new List(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifyMediaImage() - { - return null; - } - - public override List GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - #region Unsupported features - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override string GetMediaManufacturer() - { - return ImageInfo.mediaManufacturer; - } - - public override string GetMediaModel() - { - return ImageInfo.mediaModel; - } - - public override string GetMediaSerialNumber() - { - return ImageInfo.mediaSerialNumber; - } - - public override string GetMediaBarcode() - { - return ImageInfo.mediaBarcode; - } - - public override string GetMediaPartNumber() - { - return ImageInfo.mediaPartNumber; - } - - public override int GetMediaSequence() - { - return ImageInfo.mediaSequence; - } - - public override int GetLastDiskSequence() - { - return ImageInfo.lastMediaSequence; - } - - public override string GetDriveManufacturer() - { - return ImageInfo.driveManufacturer; - } - - public override string GetDriveModel() - { - return ImageInfo.driveModel; - } - - public override string GetDriveSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - - public override List GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - #endregion Unsupported features - } -} - + // Checked using several images and strings inside Apple's DiskImages.framework + public class AppleDOS : ImagePlugin + { + #region Internal variables + byte[] deinterleaved; + string extension; + #endregion + + public AppleDOS() + { + Name = "Apple ][ Interleaved Disk Image"; + PluginUUID = new Guid("A5828AC0-62C9-4304-81D4-EFD4AAE47360"); + ImageInfo = new ImageInfo + { + readableSectorTags = new List(), + readableMediaTags = new List(), + imageHasPartitions = false, + imageHasSessions = false, + imageVersion = null, + imageApplication = null, + imageApplicationVersion = null, + imageCreator = null, + imageComments = null, + mediaManufacturer = null, + mediaModel = null, + mediaSerialNumber = null, + mediaBarcode = null, + mediaPartNumber = null, + mediaSequence = 0, + lastMediaSequence = 0, + driveManufacturer = null, + driveModel = null, + driveSerialNumber = null, + driveFirmwareRevision = null + }; + } + + public override bool IdentifyImage(Filter imageFilter) + { + extension = Path.GetExtension(imageFilter.GetFilename()).ToLower(); + + if(imageFilter.GetDataForkLength() == 143360 && (extension == ".po" || extension == ".do")) return true; + + return false; + } + + readonly int[] dosOffsets = {0, 7, 14, 6, 13, 5, 12, 4, 11, 3, 10, 2, 9, 1, 8, 15}; + readonly int[] prodosOffsets = {0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15}; + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + byte[] tmp = new byte[imageFilter.GetDataForkLength()]; + stream.Read(tmp, 0, tmp.Length); + + deinterleaved = new byte[tmp.Length]; + + extension = Path.GetExtension(imageFilter.GetFilename()).ToLower(); + + int[] offsets; + + if(extension == ".do") offsets = dosOffsets; + else offsets = prodosOffsets; + + for(int t = 0; t < 35; t++) + { + for(int s = 0; s < 16; s++) + Array.Copy(tmp, (t * 16 * 256) + (s * 256), deinterleaved, (t * 16 * 256) + (offsets[s] * 256), + 256); + } + + ImageInfo.sectorSize = 256; + ImageInfo.imageSize = (ulong)imageFilter.GetDataForkLength(); + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.sectors = 560; + ImageInfo.mediaType = MediaType.Apple33SS; + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.cylinders = 35; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 16; + + return true; + } + + public override bool ImageHasPartitions() + { + return ImageInfo.imageHasPartitions; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] buffer = new byte[length * ImageInfo.sectorSize]; + + Array.Copy(deinterleaved, (int)(sectorAddress * ImageInfo.sectorSize), buffer, 0, buffer.Length); + + return buffer; + } + + public override string GetImageFormat() + { + if(extension == ".po") return "Apple ][ Interleaved Disk Image (ProDOS order)"; + + return "Apple ][ Interleaved Disk Image (DOS order)"; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, + out List UnknownLBAs) + { + FailingLBAs = new List(); + UnknownLBAs = new List(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, + out List UnknownLBAs) + { + FailingLBAs = new List(); + UnknownLBAs = new List(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifyMediaImage() + { + return null; + } + + public override List GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + #region Unsupported features + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override string GetMediaManufacturer() + { + return ImageInfo.mediaManufacturer; + } + + public override string GetMediaModel() + { + return ImageInfo.mediaModel; + } + + public override string GetMediaSerialNumber() + { + return ImageInfo.mediaSerialNumber; + } + + public override string GetMediaBarcode() + { + return ImageInfo.mediaBarcode; + } + + public override string GetMediaPartNumber() + { + return ImageInfo.mediaPartNumber; + } + + public override int GetMediaSequence() + { + return ImageInfo.mediaSequence; + } + + public override int GetLastDiskSequence() + { + return ImageInfo.lastMediaSequence; + } + + public override string GetDriveManufacturer() + { + return ImageInfo.driveManufacturer; + } + + public override string GetDriveModel() + { + return ImageInfo.driveModel; + } + + public override string GetDriveSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + + public override List GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + #endregion Unsupported features + } +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/AppleNIB.cs b/DiscImageChef.DiscImages/AppleNIB.cs index 1fef816a..1e4f1d60 100644 --- a/DiscImageChef.DiscImages/AppleNIB.cs +++ b/DiscImageChef.DiscImages/AppleNIB.cs @@ -41,537 +41,531 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - // TODO: Checksum sectors - public class AppleNIB : ImagePlugin - { - Dictionary longSectors; - Dictionary cookedSectors; - Dictionary addressFields; - - readonly ulong[] dosSkewing = { 0, 7, 14, 6, 13, 5, 12, 4, 11, 3, 10, 2, 9, 1, 8, 15 }; - readonly ulong[] proDosSkewing = { 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 }; - - readonly byte[] pascal_sign = { 0x08, 0xA5, 0x0F, 0x29 }; - readonly byte[] pascal2_sign = { 0xFF, 0xA2, 0x00, 0x8E }; - readonly byte[] dos_sign = { 0xA2, 0x02, 0x8E, 0x52 }; - readonly byte[] sos_sign = { 0xC9, 0x20, 0xF0, 0x3E }; - readonly byte[] apple3_sign = { 0x8D, 0xD0, 0x03, 0x4C, 0xC7, 0xA4 }; - readonly byte[] cpm_sign = { 0xA2, 0x55, 0xA9, 0x00, 0x9D, 0x00, 0x0D, 0xCA }; - readonly byte[] prodos_string = { 0x50, 0x52, 0x4F, 0x44, 0x4F, 0x53 }; - readonly byte[] pascal_string = { 0x53, 0x59, 0x53, 0x54, 0x45, 0x2E, 0x41, 0x50, 0x50, 0x4C, 0x45 }; - readonly byte[] dri_string = { 0x43, 0x4F, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x28, 0x43, - 0x29, 0x20, 0x31, 0x39, 0x37, 0x39, 0x2C, 0x20, 0x44, 0x49, 0x47, 0x49, 0x54, 0x41, 0x4C, 0x20, - 0x52, 0x45, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48}; - - public AppleNIB() - { - Name = "Apple NIB"; - PluginUUID = new Guid("AE171AE8-6747-49CC-B861-9D450B7CD42E"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List(); - ImageInfo.readableMediaTags = new List(); - ImageInfo.imageHasPartitions = false; - ImageInfo.imageHasSessions = false; - ImageInfo.imageVersion = null; - ImageInfo.imageApplication = null; - ImageInfo.imageApplicationVersion = null; - ImageInfo.imageCreator = null; - ImageInfo.imageComments = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaSerialNumber = null; - ImageInfo.mediaBarcode = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - if(stream.Length < 512) - return false; - - byte[] test = new byte[512]; - stream.Read(test, 0, 512); - - return Apple2.IsApple2GCR(test); - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - if(stream.Length < 512) - return false; - - byte[] buffer = new byte[stream.Length]; - stream.Read(buffer, 0, buffer.Length); - - DicConsole.DebugWriteLine("Apple NIB Plugin", "Decoding whole image"); - List tracks = Apple2.MarshalDisk(buffer); - DicConsole.DebugWriteLine("Apple NIB Plugin", "Got {0} tracks", tracks.Count); - - Dictionary rawSectors = new Dictionary(); - - int spt = 0; - bool allTracksEqual = true; - for(int i = 1; i < tracks.Count; i++) - { - allTracksEqual &= tracks[i - 1].sectors.Length == tracks[i].sectors.Length; - } - - if(allTracksEqual) - spt = tracks[0].sectors.Length; - - bool skewed = spt == 16; - ulong[] skewing = dosSkewing; - - // Detect ProDOS skewed disks - if(skewed) - { - byte[] sector1 = null; - byte[] sector0 = null; - - foreach(Apple2.RawSector sector in tracks[0].sectors) - { - if(sector.addressField.sector.SequenceEqual(new byte[] { 170, 171 })) - sector1 = Apple2.DecodeSector(sector); - if(sector.addressField.sector.SequenceEqual(new byte[] { 170, 170 })) - sector0 = Apple2.DecodeSector(sector); - } - - if(sector1 != null) - { - byte[] tmpAt0Sz4 = new byte[4]; - byte[] tmpAt0Sz6 = new byte[6]; - byte[] tmpAt0Sz8 = new byte[8]; - byte[] tmpAt3Sz6 = new byte[6]; - byte[] tmpAt24Sz36 = new byte[36]; - byte[] tmpAt33Sz6 = new byte[6]; - - Array.Copy(sector1, 0, tmpAt0Sz4, 0, 4); - Array.Copy(sector1, 0, tmpAt0Sz6, 0, 6); - Array.Copy(sector1, 0, tmpAt0Sz8, 0, 8); - Array.Copy(sector1, 3, tmpAt3Sz6, 0, 6); - Array.Copy(sector1, 24, tmpAt24Sz36, 0, 36); - Array.Copy(sector1, 33, tmpAt33Sz6, 0, 6); - - if(tmpAt0Sz4.SequenceEqual(sos_sign)) - skewing = proDosSkewing; - if(tmpAt0Sz4.SequenceEqual(dos_sign)) - skewing = proDosSkewing; - if(tmpAt0Sz4.SequenceEqual(pascal2_sign)) - skewing = proDosSkewing; - if(tmpAt0Sz6.SequenceEqual(apple3_sign)) - skewing = proDosSkewing; - if(tmpAt0Sz8.SequenceEqual(cpm_sign)) - skewing = proDosSkewing; - if(tmpAt3Sz6.SequenceEqual(prodos_string)) - skewing = proDosSkewing; - if(tmpAt24Sz36.SequenceEqual(dri_string)) - skewing = proDosSkewing; - if(tmpAt33Sz6.SequenceEqual(prodos_string)) - skewing = proDosSkewing; - - if(sector0 != null) - { - byte[] tmpAt215Sz12 = new byte[12]; - Array.Copy(sector0, 215, tmpAt215Sz12, 0, 12); - if(tmpAt215Sz12.SequenceEqual(pascal_string) && tmpAt0Sz4.SequenceEqual(pascal_sign)) - skewing = proDosSkewing; - } - - DicConsole.DebugWriteLine("Apple NIB Plugin", "Image is skewed"); - } - } - - for(int i = 0; i < tracks.Count; i++) - { - foreach(Apple2.RawSector sector in tracks[i].sectors) - { - if(skewed && spt != 0) - { - ulong sectorNo = (ulong)((((sector.addressField.sector[0] & 0x55) << 1) | (sector.addressField.sector[1] & 0x55)) & 0xFF); - DicConsole.DebugWriteLine("Apple NIB Plugin", "Hardware sector {0} of track {1} goes to logical sector {2}", sectorNo, i, skewing[sectorNo] + (ulong)(i * spt)); - rawSectors.Add(skewing[sectorNo] + (ulong)(i * spt), sector); - ImageInfo.sectors++; - } - else - { - rawSectors.Add(ImageInfo.sectors, sector); - ImageInfo.sectors++; - } - } - } - - DicConsole.DebugWriteLine("Apple NIB Plugin", "Got {0} sectors", ImageInfo.sectors); - - DicConsole.DebugWriteLine("Apple NIB Plugin", "Cooking sectors"); - - longSectors = new Dictionary(); - cookedSectors = new Dictionary(); - addressFields = new Dictionary(); - - foreach(KeyValuePair kvp in rawSectors) - { - byte[] cooked = Apple2.DecodeSector(kvp.Value); - byte[] raw = Apple2.MarshalSector(kvp.Value); - byte[] addr = Apple2.MarshalAddressField(kvp.Value.addressField); - longSectors.Add(kvp.Key, raw); - cookedSectors.Add(kvp.Key, cooked); - addressFields.Add(kvp.Key, addr); - } - - ImageInfo.imageSize = (ulong)imageFilter.GetDataForkLength(); - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - if(ImageInfo.sectors == 455) - ImageInfo.mediaType = MediaType.Apple32SS; - else if(ImageInfo.sectors == 560) - ImageInfo.mediaType = MediaType.Apple33SS; - else - ImageInfo.mediaType = MediaType.Unknown; - ImageInfo.sectorSize = 256; - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.readableSectorTags.Add(SectorTagType.FloppyAddressMark); - switch(ImageInfo.mediaType) - { - case MediaType.Apple32SS: - ImageInfo.cylinders = 35; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 13; - break; - case MediaType.Apple33SS: - ImageInfo.cylinders = 35; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 16; - break; - } - - return true; - } - - public override bool ImageHasPartitions() - { - return false; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override string GetImageFormat() - { - return "Apple nibbles"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override MediaType GetMediaType() - { - switch(ImageInfo.sectors) - { - case 455: - return MediaType.Apple32SS; - case 560: - return MediaType.Apple33SS; - default: - return MediaType.Unknown; - } - } - - public override byte[] ReadSector(ulong sectorAddress) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - byte[] temp; - cookedSectors.TryGetValue(sectorAddress, out temp); - return temp; - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - MemoryStream ms = new MemoryStream(); - - for(uint i = 0; i < length; i++) - { - byte[] sector = ReadSector(sectorAddress + i); - ms.Write(sector, 0, sector.Length); - } - - return ms.ToArray(); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if(tag != SectorTagType.FloppyAddressMark) - throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); - - byte[] temp; - addressFields.TryGetValue(sectorAddress, out temp); - return temp; - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - if(tag != SectorTagType.FloppyAddressMark) - throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); - - MemoryStream ms = new MemoryStream(); - - for(uint i = 0; i < length; i++) - { - byte[] sector = ReadSectorTag(sectorAddress + i, tag); - ms.Write(sector, 0, sector.Length); - } - - return ms.ToArray(); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - byte[] temp; - longSectors.TryGetValue(sectorAddress, out temp); - return temp; - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - MemoryStream ms = new MemoryStream(); - - for(uint i = 0; i < length; i++) - { - byte[] sector = ReadSectorLong(sectorAddress + i); - ms.Write(sector, 0, sector.Length); - } - - return ms.ToArray(); - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetMediaManufacturer() - { - return null; - } - - public override string GetMediaModel() - { - return null; - } - - public override string GetMediaSerialNumber() - { - return null; - } - - public override string GetMediaBarcode() - { - return null; - } - - public override string GetMediaPartNumber() - { - return null; - } - - public override int GetMediaSequence() - { - return 0; - } - - public override int GetLastDiskSequence() - { - return 0; - } - - public override string GetDriveManufacturer() - { - return null; - } - - public override string GetDriveModel() - { - return null; - } - - public override string GetDriveSerialNumber() - { - return null; - } - - public override List GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, out List UnknownLBAs) - { - FailingLBAs = new List(); - UnknownLBAs = new List(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, out List UnknownLBAs) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifyMediaImage() - { - return null; - } - - #endregion - } + // TODO: Checksum sectors + public class AppleNIB : ImagePlugin + { + Dictionary longSectors; + Dictionary cookedSectors; + Dictionary addressFields; + + readonly ulong[] dosSkewing = {0, 7, 14, 6, 13, 5, 12, 4, 11, 3, 10, 2, 9, 1, 8, 15}; + readonly ulong[] proDosSkewing = {0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15}; + + readonly byte[] pascal_sign = {0x08, 0xA5, 0x0F, 0x29}; + readonly byte[] pascal2_sign = {0xFF, 0xA2, 0x00, 0x8E}; + readonly byte[] dos_sign = {0xA2, 0x02, 0x8E, 0x52}; + readonly byte[] sos_sign = {0xC9, 0x20, 0xF0, 0x3E}; + readonly byte[] apple3_sign = {0x8D, 0xD0, 0x03, 0x4C, 0xC7, 0xA4}; + readonly byte[] cpm_sign = {0xA2, 0x55, 0xA9, 0x00, 0x9D, 0x00, 0x0D, 0xCA}; + readonly byte[] prodos_string = {0x50, 0x52, 0x4F, 0x44, 0x4F, 0x53}; + readonly byte[] pascal_string = {0x53, 0x59, 0x53, 0x54, 0x45, 0x2E, 0x41, 0x50, 0x50, 0x4C, 0x45}; + readonly byte[] dri_string = + { + 0x43, 0x4F, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x28, 0x43, 0x29, 0x20, 0x31, 0x39, 0x37, 0x39, + 0x2C, 0x20, 0x44, 0x49, 0x47, 0x49, 0x54, 0x41, 0x4C, 0x20, 0x52, 0x45, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48 + }; + + public AppleNIB() + { + Name = "Apple NIB"; + PluginUUID = new Guid("AE171AE8-6747-49CC-B861-9D450B7CD42E"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List(); + ImageInfo.readableMediaTags = new List(); + ImageInfo.imageHasPartitions = false; + ImageInfo.imageHasSessions = false; + ImageInfo.imageVersion = null; + ImageInfo.imageApplication = null; + ImageInfo.imageApplicationVersion = null; + ImageInfo.imageCreator = null; + ImageInfo.imageComments = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaSerialNumber = null; + ImageInfo.mediaBarcode = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + if(stream.Length < 512) return false; + + byte[] test = new byte[512]; + stream.Read(test, 0, 512); + + return Apple2.IsApple2GCR(test); + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + if(stream.Length < 512) return false; + + byte[] buffer = new byte[stream.Length]; + stream.Read(buffer, 0, buffer.Length); + + DicConsole.DebugWriteLine("Apple NIB Plugin", "Decoding whole image"); + List tracks = Apple2.MarshalDisk(buffer); + DicConsole.DebugWriteLine("Apple NIB Plugin", "Got {0} tracks", tracks.Count); + + Dictionary rawSectors = new Dictionary(); + + int spt = 0; + bool allTracksEqual = true; + for(int i = 1; i < tracks.Count; i++) + { + allTracksEqual &= tracks[i - 1].sectors.Length == tracks[i].sectors.Length; + } + + if(allTracksEqual) spt = tracks[0].sectors.Length; + + bool skewed = spt == 16; + ulong[] skewing = dosSkewing; + + // Detect ProDOS skewed disks + if(skewed) + { + byte[] sector1 = null; + byte[] sector0 = null; + + foreach(Apple2.RawSector sector in tracks[0].sectors) + { + if(sector.addressField.sector.SequenceEqual(new byte[] {170, 171})) + sector1 = Apple2.DecodeSector(sector); + if(sector.addressField.sector.SequenceEqual(new byte[] {170, 170})) + sector0 = Apple2.DecodeSector(sector); + } + + if(sector1 != null) + { + byte[] tmpAt0Sz4 = new byte[4]; + byte[] tmpAt0Sz6 = new byte[6]; + byte[] tmpAt0Sz8 = new byte[8]; + byte[] tmpAt3Sz6 = new byte[6]; + byte[] tmpAt24Sz36 = new byte[36]; + byte[] tmpAt33Sz6 = new byte[6]; + + Array.Copy(sector1, 0, tmpAt0Sz4, 0, 4); + Array.Copy(sector1, 0, tmpAt0Sz6, 0, 6); + Array.Copy(sector1, 0, tmpAt0Sz8, 0, 8); + Array.Copy(sector1, 3, tmpAt3Sz6, 0, 6); + Array.Copy(sector1, 24, tmpAt24Sz36, 0, 36); + Array.Copy(sector1, 33, tmpAt33Sz6, 0, 6); + + if(tmpAt0Sz4.SequenceEqual(sos_sign)) skewing = proDosSkewing; + if(tmpAt0Sz4.SequenceEqual(dos_sign)) skewing = proDosSkewing; + if(tmpAt0Sz4.SequenceEqual(pascal2_sign)) skewing = proDosSkewing; + if(tmpAt0Sz6.SequenceEqual(apple3_sign)) skewing = proDosSkewing; + if(tmpAt0Sz8.SequenceEqual(cpm_sign)) skewing = proDosSkewing; + if(tmpAt3Sz6.SequenceEqual(prodos_string)) skewing = proDosSkewing; + if(tmpAt24Sz36.SequenceEqual(dri_string)) skewing = proDosSkewing; + if(tmpAt33Sz6.SequenceEqual(prodos_string)) skewing = proDosSkewing; + + if(sector0 != null) + { + byte[] tmpAt215Sz12 = new byte[12]; + Array.Copy(sector0, 215, tmpAt215Sz12, 0, 12); + if(tmpAt215Sz12.SequenceEqual(pascal_string) && tmpAt0Sz4.SequenceEqual(pascal_sign)) + skewing = proDosSkewing; + } + + DicConsole.DebugWriteLine("Apple NIB Plugin", "Image is skewed"); + } + } + + for(int i = 0; i < tracks.Count; i++) + { + foreach(Apple2.RawSector sector in tracks[i].sectors) + { + if(skewed && spt != 0) + { + ulong sectorNo = (ulong)((((sector.addressField.sector[0] & 0x55) << 1) | + (sector.addressField.sector[1] & 0x55)) & 0xFF); + DicConsole.DebugWriteLine("Apple NIB Plugin", + "Hardware sector {0} of track {1} goes to logical sector {2}", + sectorNo, i, skewing[sectorNo] + (ulong)(i * spt)); + rawSectors.Add(skewing[sectorNo] + (ulong)(i * spt), sector); + ImageInfo.sectors++; + } + else + { + rawSectors.Add(ImageInfo.sectors, sector); + ImageInfo.sectors++; + } + } + } + + DicConsole.DebugWriteLine("Apple NIB Plugin", "Got {0} sectors", ImageInfo.sectors); + + DicConsole.DebugWriteLine("Apple NIB Plugin", "Cooking sectors"); + + longSectors = new Dictionary(); + cookedSectors = new Dictionary(); + addressFields = new Dictionary(); + + foreach(KeyValuePair kvp in rawSectors) + { + byte[] cooked = Apple2.DecodeSector(kvp.Value); + byte[] raw = Apple2.MarshalSector(kvp.Value); + byte[] addr = Apple2.MarshalAddressField(kvp.Value.addressField); + longSectors.Add(kvp.Key, raw); + cookedSectors.Add(kvp.Key, cooked); + addressFields.Add(kvp.Key, addr); + } + + ImageInfo.imageSize = (ulong)imageFilter.GetDataForkLength(); + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + if(ImageInfo.sectors == 455) ImageInfo.mediaType = MediaType.Apple32SS; + else if(ImageInfo.sectors == 560) ImageInfo.mediaType = MediaType.Apple33SS; + else ImageInfo.mediaType = MediaType.Unknown; + ImageInfo.sectorSize = 256; + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.readableSectorTags.Add(SectorTagType.FloppyAddressMark); + switch(ImageInfo.mediaType) + { + case MediaType.Apple32SS: + ImageInfo.cylinders = 35; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 13; + break; + case MediaType.Apple33SS: + ImageInfo.cylinders = 35; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 16; + break; + } + + return true; + } + + public override bool ImageHasPartitions() + { + return false; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override string GetImageFormat() + { + return "Apple nibbles"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override MediaType GetMediaType() + { + switch(ImageInfo.sectors) + { + case 455: return MediaType.Apple32SS; + case 560: return MediaType.Apple33SS; + default: return MediaType.Unknown; + } + } + + public override byte[] ReadSector(ulong sectorAddress) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + byte[] temp; + cookedSectors.TryGetValue(sectorAddress, out temp); + return temp; + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + MemoryStream ms = new MemoryStream(); + + for(uint i = 0; i < length; i++) + { + byte[] sector = ReadSector(sectorAddress + i); + ms.Write(sector, 0, sector.Length); + } + + return ms.ToArray(); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if(tag != SectorTagType.FloppyAddressMark) + throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); + + byte[] temp; + addressFields.TryGetValue(sectorAddress, out temp); + return temp; + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + if(tag != SectorTagType.FloppyAddressMark) + throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); + + MemoryStream ms = new MemoryStream(); + + for(uint i = 0; i < length; i++) + { + byte[] sector = ReadSectorTag(sectorAddress + i, tag); + ms.Write(sector, 0, sector.Length); + } + + return ms.ToArray(); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + byte[] temp; + longSectors.TryGetValue(sectorAddress, out temp); + return temp; + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + MemoryStream ms = new MemoryStream(); + + for(uint i = 0; i < length; i++) + { + byte[] sector = ReadSectorLong(sectorAddress + i); + ms.Write(sector, 0, sector.Length); + } + + return ms.ToArray(); + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetMediaManufacturer() + { + return null; + } + + public override string GetMediaModel() + { + return null; + } + + public override string GetMediaSerialNumber() + { + return null; + } + + public override string GetMediaBarcode() + { + return null; + } + + public override string GetMediaPartNumber() + { + return null; + } + + public override int GetMediaSequence() + { + return 0; + } + + public override int GetLastDiskSequence() + { + return 0; + } + + public override string GetDriveManufacturer() + { + return null; + } + + public override string GetDriveModel() + { + return null; + } + + public override string GetDriveSerialNumber() + { + return null; + } + + public override List GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, + out List UnknownLBAs) + { + FailingLBAs = new List(); + UnknownLBAs = new List(); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, + out List UnknownLBAs) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifyMediaImage() + { + return null; + } + #endregion + } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/Apridisk.cs b/DiscImageChef.DiscImages/Apridisk.cs index 20f4f468..be99512a 100644 --- a/DiscImageChef.DiscImages/Apridisk.cs +++ b/DiscImageChef.DiscImages/Apridisk.cs @@ -41,580 +41,586 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class Apridisk : ImagePlugin - { - #region Internal enumerations - enum RecordType : uint - { - Deleted = 0xE31D0000, - Sector = 0xE31D0001, - Comment = 0xE31D0002, - Creator = 0xE31D0003, - } - - enum CompressType : ushort - { - Uncompresed = 0x9E90, - Compressed = 0x3E5A, - } - #endregion - - #region Internal constants - readonly byte[] signature = { - 0x41, 0x43, 0x54, 0x20, 0x41, 0x70, 0x72, 0x69, 0x63, 0x6F, 0x74, 0x20, 0x64, 0x69, 0x73, 0x6B, - 0x20, 0x69, 0x6D, 0x61, 0x67, 0x65, 0x1A, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; - - #endregion - - #region Internal structures - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ApridiskRecord - { - public RecordType type; - public CompressType compression; - public ushort headerSize; - public uint dataSize; - public byte head; - public byte sector; - public ushort cylinder; - } - #endregion - - // Cylinder by head, sector data matrix - byte[][][][] sectorsData; - - public Apridisk() - { - Name = "ACT Apricot Disk Image"; - PluginUUID = new Guid("43408CF3-6DB3-449F-A779-2B0E497C5B14"); - ImageInfo = new ImageInfo() - { - readableSectorTags = new List(), - readableMediaTags = new List(), - imageHasPartitions = false, - imageHasSessions = false, - imageVersion = null, - imageApplication = null, - imageApplicationVersion = null, - imageCreator = null, - imageComments = null, - mediaManufacturer = null, - mediaModel = null, - mediaSerialNumber = null, - mediaBarcode = null, - mediaPartNumber = null, - mediaSequence = 0, - lastMediaSequence = 0, - driveManufacturer = null, - driveModel = null, - driveSerialNumber = null, - driveFirmwareRevision = null - }; - } - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - if(stream.Length < signature.Length) - return false; - - byte[] sig_b = new byte[signature.Length]; - stream.Read(sig_b, 0, signature.Length); - - return sig_b.SequenceEqual(signature); - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - // Skip signature - stream.Seek(signature.Length, SeekOrigin.Begin); - - int totalCylinders = -1; - int totalHeads = -1; - int maxSector = - 1; - int recordSize = Marshal.SizeOf(typeof(ApridiskRecord)); - - // Count cylinders - while(stream.Position < stream.Length) - { - ApridiskRecord record = new ApridiskRecord(); - byte[] rec_b = new byte[recordSize]; - stream.Read(rec_b, 0, recordSize); - - GCHandle handle = GCHandle.Alloc(rec_b, GCHandleType.Pinned); - record = (ApridiskRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ApridiskRecord)); - handle.Free(); - - switch(record.type) - { - // Deleted record, just skip it - case RecordType.Deleted: - DicConsole.DebugWriteLine("Apridisk plugin", "Found deleted record at {0}", stream.Position); - stream.Seek((record.headerSize - recordSize) + record.dataSize, SeekOrigin.Current); - break; - case RecordType.Comment: - DicConsole.DebugWriteLine("Apridisk plugin", "Found comment record at {0}", stream.Position); - stream.Seek(record.headerSize - recordSize, SeekOrigin.Current); - byte[] comment_b = new byte[record.dataSize]; - stream.Read(comment_b, 0, comment_b.Length); - ImageInfo.imageComments = StringHandlers.CToString(comment_b); - DicConsole.DebugWriteLine("Apridisk plugin", "Comment: \"{0}\"", ImageInfo.imageComments); - break; - case RecordType.Creator: - DicConsole.DebugWriteLine("Apridisk plugin", "Found creator record at {0}", stream.Position); - stream.Seek(record.headerSize - recordSize, SeekOrigin.Current); - byte[] creator_b = new byte[record.dataSize]; - stream.Read(creator_b, 0, creator_b.Length); - ImageInfo.imageCreator = StringHandlers.CToString(creator_b); - DicConsole.DebugWriteLine("Apridisk plugin", "Creator: \"{0}\"", ImageInfo.imageCreator); - break; - case RecordType.Sector: - if(record.compression != CompressType.Compressed && record.compression != CompressType.Uncompresed) - throw new ImageNotSupportedException(string.Format("Found record with unknown compression type 0x{0:X4} at {1}", (ushort)record.compression, stream.Position)); - - DicConsole.DebugWriteLine("Apridisk plugin", "Found {4} sector record at {0} for cylinder {1} head {2} sector {3}", stream.Position, record.cylinder, record.head, - record.sector, record.compression == CompressType.Compressed ? "compressed" : "uncompressed"); - - if(record.cylinder > totalCylinders) - totalCylinders = record.cylinder; - if(record.head > totalHeads) - totalHeads = record.head; - if(record.sector > maxSector) - maxSector = record.sector; - - stream.Seek((record.headerSize - recordSize) + record.dataSize, SeekOrigin.Current); - break; - default: - throw new ImageNotSupportedException(string.Format("Found record with unknown type 0x{0:X8} at {1}", (uint)record.type, stream.Position)); - } - } - - totalCylinders++; - totalHeads++; - - if(totalCylinders <= 0 || totalHeads <= 0) - throw new ImageNotSupportedException("No cylinders or heads found"); - - sectorsData = new byte[totalCylinders][][][]; - // Total sectors per track - uint[][] spts = new uint[totalCylinders][]; - - ImageInfo.cylinders = (ushort)totalCylinders; - ImageInfo.heads = (byte)totalHeads; - - DicConsole.DebugWriteLine("Apridisk plugin", "Found {0} cylinders and {1} heads with a maximum sector number of {2}", totalCylinders, totalHeads, maxSector); - - // Create heads - for(int i = 0; i < totalCylinders; i++) - { - sectorsData[i] = new byte[totalHeads][][]; - spts[i] = new uint[totalHeads]; - - for(int j = 0; j < totalHeads; j++) - sectorsData[i][j] = new byte[maxSector + 1][]; - } - - ImageInfo.sectorSize = uint.MaxValue; - - ulong headersizes = 0; - - // Read sectors - stream.Seek(signature.Length, SeekOrigin.Begin); - while(stream.Position < stream.Length) - { - ApridiskRecord record = new ApridiskRecord(); - byte[] rec_b = new byte[recordSize]; - stream.Read(rec_b, 0, recordSize); - - GCHandle handle = GCHandle.Alloc(rec_b, GCHandleType.Pinned); - record = (ApridiskRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ApridiskRecord)); - handle.Free(); - - switch(record.type) - { - // Not sector record, just skip it - case RecordType.Deleted: - case RecordType.Comment: - case RecordType.Creator: - stream.Seek((record.headerSize - recordSize) + record.dataSize, SeekOrigin.Current); - headersizes += record.headerSize + record.dataSize; - break; - case RecordType.Sector: - stream.Seek(record.headerSize - recordSize, SeekOrigin.Current); - - byte[] data = new byte[record.dataSize]; - stream.Read(data, 0, data.Length); - - spts[record.cylinder][record.head]++; - uint realLength = record.dataSize; - - if(record.compression == CompressType.Compressed) - realLength = Decompress(data, out sectorsData[record.cylinder][record.head][record.sector]); - else - sectorsData[record.cylinder][record.head][record.sector] = data; - - if(realLength < ImageInfo.sectorSize) - ImageInfo.sectorSize = realLength; - - headersizes += record.headerSize + record.dataSize; - - break; - } - } - - DicConsole.DebugWriteLine("Apridisk plugin", "Found a minimum of {0} bytes per sector", ImageInfo.sectorSize); - - // Count sectors per track - uint spt = uint.MaxValue; - for(ushort cyl = 0; cyl < ImageInfo.cylinders; cyl++) - { - for(ushort head = 0; head < ImageInfo.heads; head++) - { - if(spts[cyl][head] < spt) - spt = spts[cyl][head]; - } - } - ImageInfo.sectorsPerTrack = spt; - - DicConsole.DebugWriteLine("Apridisk plugin", "Found a minimum of {0} sectors per track", ImageInfo.sectorsPerTrack); - - if(ImageInfo.cylinders == 70 && ImageInfo.heads == 1 && ImageInfo.sectorsPerTrack == 9) - ImageInfo.mediaType = MediaType.Apricot_35; - else if(ImageInfo.cylinders == 80 && ImageInfo.heads == 1 && ImageInfo.sectorsPerTrack == 9) - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; - else if(ImageInfo.cylinders == 80 && ImageInfo.heads == 2 && ImageInfo.sectorsPerTrack == 9) - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; - - ImageInfo.imageSize = (ulong)stream.Length - headersizes; - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.sectors = ImageInfo.cylinders * ImageInfo.heads * ImageInfo.sectorsPerTrack; - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - - /* - FileStream debugFs = new FileStream("debug.img", FileMode.CreateNew, FileAccess.Write); - for(ulong i = 0; i < ImageInfo.sectors; i++) - debugFs.Write(ReadSector(i), 0, (int)ImageInfo.sectorSize); - debugFs.Dispose(); - */ - - return true; - } - - static uint Decompress(byte[] compressed, out byte[] decompressed) - { - int readp = 0; - ushort blklen; - uint u_len = 0; - int c_len = compressed.Length; - MemoryStream buffer = new MemoryStream(); - - u_len = 0; - - while(c_len >= 3) - { - blklen = BitConverter.ToUInt16(compressed, readp); - readp += 2; - - for(int i = 0; i < blklen; i++) - buffer.WriteByte(compressed[readp]); - - u_len += blklen; - readp++; - c_len -= 3; - } - - decompressed = buffer.ToArray(); - return u_len; - } - - public override bool ImageHasPartitions() - { - return false; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override string GetImageFormat() - { - return "ACT Apricot disk image"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - (ushort cylinder, byte head, byte sector) = LbaToChs(sectorAddress); - - if(cylinder >= sectorsData.Length) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(head >= sectorsData[cylinder].Length) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sector > sectorsData[cylinder][head].Length) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - return sectorsData[cylinder][head][sector]; - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - MemoryStream buffer = new MemoryStream(); - for(uint i = 0; i < length; i++) - { - byte[] sector = ReadSector(sectorAddress + i); - buffer.Write(sector, 0, sector.Length); - } - - return buffer.ToArray(); - } - - (ushort cylinder, byte head, byte sector) LbaToChs(ulong lba) - { - ushort cylinder = (ushort)(lba / (ImageInfo.heads * ImageInfo.sectorsPerTrack)); - byte head = (byte)((lba / ImageInfo.sectorsPerTrack) % ImageInfo.heads); - byte sector = (byte)((lba % ImageInfo.sectorsPerTrack) + 1); - - return (cylinder, head, sector); - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetMediaManufacturer() - { - return null; - } - - public override string GetMediaModel() - { - return null; - } - - public override string GetMediaSerialNumber() - { - return null; - } - - public override string GetMediaBarcode() - { - return null; - } - - public override string GetMediaPartNumber() - { - return null; - } - - public override int GetMediaSequence() - { - return 0; - } - - public override int GetLastDiskSequence() - { - return 0; - } - - public override string GetDriveManufacturer() - { - return null; - } - - public override string GetDriveModel() - { - return null; - } - - public override string GetDriveSerialNumber() - { - return null; - } - - public override List GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, out List UnknownLBAs) - { - FailingLBAs = new List(); - UnknownLBAs = new List(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, out List UnknownLBAs) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifyMediaImage() - { - return null; - } - - #endregion - } + public class Apridisk : ImagePlugin + { + #region Internal enumerations + enum RecordType : uint + { + Deleted = 0xE31D0000, + Sector = 0xE31D0001, + Comment = 0xE31D0002, + Creator = 0xE31D0003, + } + + enum CompressType : ushort + { + Uncompresed = 0x9E90, + Compressed = 0x3E5A, + } + #endregion + + #region Internal constants + readonly byte[] signature = + { + 0x41, 0x43, 0x54, 0x20, 0x41, 0x70, 0x72, 0x69, 0x63, 0x6F, 0x74, 0x20, 0x64, 0x69, 0x73, 0x6B, 0x20, 0x69, + 0x6D, 0x61, 0x67, 0x65, 0x1A, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 + }; + #endregion + + #region Internal structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ApridiskRecord + { + public RecordType type; + public CompressType compression; + public ushort headerSize; + public uint dataSize; + public byte head; + public byte sector; + public ushort cylinder; + } + #endregion + + // Cylinder by head, sector data matrix + byte[][][][] sectorsData; + + public Apridisk() + { + Name = "ACT Apricot Disk Image"; + PluginUUID = new Guid("43408CF3-6DB3-449F-A779-2B0E497C5B14"); + ImageInfo = new ImageInfo() + { + readableSectorTags = new List(), + readableMediaTags = new List(), + imageHasPartitions = false, + imageHasSessions = false, + imageVersion = null, + imageApplication = null, + imageApplicationVersion = null, + imageCreator = null, + imageComments = null, + mediaManufacturer = null, + mediaModel = null, + mediaSerialNumber = null, + mediaBarcode = null, + mediaPartNumber = null, + mediaSequence = 0, + lastMediaSequence = 0, + driveManufacturer = null, + driveModel = null, + driveSerialNumber = null, + driveFirmwareRevision = null + }; + } + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + if(stream.Length < signature.Length) return false; + + byte[] sig_b = new byte[signature.Length]; + stream.Read(sig_b, 0, signature.Length); + + return sig_b.SequenceEqual(signature); + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + // Skip signature + stream.Seek(signature.Length, SeekOrigin.Begin); + + int totalCylinders = -1; + int totalHeads = -1; + int maxSector = -1; + int recordSize = Marshal.SizeOf(typeof(ApridiskRecord)); + + // Count cylinders + while(stream.Position < stream.Length) + { + ApridiskRecord record = new ApridiskRecord(); + byte[] rec_b = new byte[recordSize]; + stream.Read(rec_b, 0, recordSize); + + GCHandle handle = GCHandle.Alloc(rec_b, GCHandleType.Pinned); + record = (ApridiskRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ApridiskRecord)); + handle.Free(); + + switch(record.type) + { + // Deleted record, just skip it + case RecordType.Deleted: + DicConsole.DebugWriteLine("Apridisk plugin", "Found deleted record at {0}", stream.Position); + stream.Seek((record.headerSize - recordSize) + record.dataSize, SeekOrigin.Current); + break; + case RecordType.Comment: + DicConsole.DebugWriteLine("Apridisk plugin", "Found comment record at {0}", stream.Position); + stream.Seek(record.headerSize - recordSize, SeekOrigin.Current); + byte[] comment_b = new byte[record.dataSize]; + stream.Read(comment_b, 0, comment_b.Length); + ImageInfo.imageComments = StringHandlers.CToString(comment_b); + DicConsole.DebugWriteLine("Apridisk plugin", "Comment: \"{0}\"", ImageInfo.imageComments); + break; + case RecordType.Creator: + DicConsole.DebugWriteLine("Apridisk plugin", "Found creator record at {0}", stream.Position); + stream.Seek(record.headerSize - recordSize, SeekOrigin.Current); + byte[] creator_b = new byte[record.dataSize]; + stream.Read(creator_b, 0, creator_b.Length); + ImageInfo.imageCreator = StringHandlers.CToString(creator_b); + DicConsole.DebugWriteLine("Apridisk plugin", "Creator: \"{0}\"", ImageInfo.imageCreator); + break; + case RecordType.Sector: + if(record.compression != CompressType.Compressed && + record.compression != CompressType.Uncompresed) + throw new + ImageNotSupportedException(string + .Format("Found record with unknown compression type 0x{0:X4} at {1}", + (ushort)record.compression, stream.Position)); + + DicConsole.DebugWriteLine("Apridisk plugin", + "Found {4} sector record at {0} for cylinder {1} head {2} sector {3}", + stream.Position, record.cylinder, record.head, record.sector, + record.compression == CompressType.Compressed + ? "compressed" + : "uncompressed"); + + if(record.cylinder > totalCylinders) totalCylinders = record.cylinder; + if(record.head > totalHeads) totalHeads = record.head; + if(record.sector > maxSector) maxSector = record.sector; + + stream.Seek((record.headerSize - recordSize) + record.dataSize, SeekOrigin.Current); + break; + default: + throw new + ImageNotSupportedException(string.Format("Found record with unknown type 0x{0:X8} at {1}", + (uint)record.type, stream.Position)); + } + } + + totalCylinders++; + totalHeads++; + + if(totalCylinders <= 0 || totalHeads <= 0) + throw new ImageNotSupportedException("No cylinders or heads found"); + + sectorsData = new byte[totalCylinders][][][]; + // Total sectors per track + uint[][] spts = new uint[totalCylinders][]; + + ImageInfo.cylinders = (ushort)totalCylinders; + ImageInfo.heads = (byte)totalHeads; + + DicConsole.DebugWriteLine("Apridisk plugin", + "Found {0} cylinders and {1} heads with a maximum sector number of {2}", + totalCylinders, totalHeads, maxSector); + + // Create heads + for(int i = 0; i < totalCylinders; i++) + { + sectorsData[i] = new byte[totalHeads][][]; + spts[i] = new uint[totalHeads]; + + for(int j = 0; j < totalHeads; j++) sectorsData[i][j] = new byte[maxSector + 1][]; + } + + ImageInfo.sectorSize = uint.MaxValue; + + ulong headersizes = 0; + + // Read sectors + stream.Seek(signature.Length, SeekOrigin.Begin); + while(stream.Position < stream.Length) + { + ApridiskRecord record = new ApridiskRecord(); + byte[] rec_b = new byte[recordSize]; + stream.Read(rec_b, 0, recordSize); + + GCHandle handle = GCHandle.Alloc(rec_b, GCHandleType.Pinned); + record = (ApridiskRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ApridiskRecord)); + handle.Free(); + + switch(record.type) + { + // Not sector record, just skip it + case RecordType.Deleted: + case RecordType.Comment: + case RecordType.Creator: + stream.Seek((record.headerSize - recordSize) + record.dataSize, SeekOrigin.Current); + headersizes += record.headerSize + record.dataSize; + break; + case RecordType.Sector: + stream.Seek(record.headerSize - recordSize, SeekOrigin.Current); + + byte[] data = new byte[record.dataSize]; + stream.Read(data, 0, data.Length); + + spts[record.cylinder][record.head]++; + uint realLength = record.dataSize; + + if(record.compression == CompressType.Compressed) + realLength = Decompress(data, out sectorsData[record.cylinder][record.head][record.sector]); + else sectorsData[record.cylinder][record.head][record.sector] = data; + + if(realLength < ImageInfo.sectorSize) ImageInfo.sectorSize = realLength; + + headersizes += record.headerSize + record.dataSize; + + break; + } + } + + DicConsole.DebugWriteLine("Apridisk plugin", "Found a minimum of {0} bytes per sector", + ImageInfo.sectorSize); + + // Count sectors per track + uint spt = uint.MaxValue; + for(ushort cyl = 0; cyl < ImageInfo.cylinders; cyl++) + { + for(ushort head = 0; head < ImageInfo.heads; head++) + { + if(spts[cyl][head] < spt) spt = spts[cyl][head]; + } + } + + ImageInfo.sectorsPerTrack = spt; + + DicConsole.DebugWriteLine("Apridisk plugin", "Found a minimum of {0} sectors per track", + ImageInfo.sectorsPerTrack); + + if(ImageInfo.cylinders == 70 && ImageInfo.heads == 1 && ImageInfo.sectorsPerTrack == 9) + ImageInfo.mediaType = MediaType.Apricot_35; + else if(ImageInfo.cylinders == 80 && ImageInfo.heads == 1 && ImageInfo.sectorsPerTrack == 9) + ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; + else if(ImageInfo.cylinders == 80 && ImageInfo.heads == 2 && ImageInfo.sectorsPerTrack == 9) + ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; + + ImageInfo.imageSize = (ulong)stream.Length - headersizes; + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.sectors = ImageInfo.cylinders * ImageInfo.heads * ImageInfo.sectorsPerTrack; + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + + /* + FileStream debugFs = new FileStream("debug.img", FileMode.CreateNew, FileAccess.Write); + for(ulong i = 0; i < ImageInfo.sectors; i++) + debugFs.Write(ReadSector(i), 0, (int)ImageInfo.sectorSize); + debugFs.Dispose(); + */ + + return true; + } + + static uint Decompress(byte[] compressed, out byte[] decompressed) + { + int readp = 0; + ushort blklen; + uint u_len = 0; + int c_len = compressed.Length; + MemoryStream buffer = new MemoryStream(); + + u_len = 0; + + while(c_len >= 3) + { + blklen = BitConverter.ToUInt16(compressed, readp); + readp += 2; + + for(int i = 0; i < blklen; i++) buffer.WriteByte(compressed[readp]); + + u_len += blklen; + readp++; + c_len -= 3; + } + + decompressed = buffer.ToArray(); + return u_len; + } + + public override bool ImageHasPartitions() + { + return false; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override string GetImageFormat() + { + return "ACT Apricot disk image"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + (ushort cylinder, byte head, byte sector) = LbaToChs(sectorAddress); + + if(cylinder >= sectorsData.Length) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(head >= sectorsData[cylinder].Length) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sector > sectorsData[cylinder][head].Length) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + return sectorsData[cylinder][head][sector]; + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + MemoryStream buffer = new MemoryStream(); + for(uint i = 0; i < length; i++) + { + byte[] sector = ReadSector(sectorAddress + i); + buffer.Write(sector, 0, sector.Length); + } + + return buffer.ToArray(); + } + + (ushort cylinder, byte head, byte sector) LbaToChs(ulong lba) + { + ushort cylinder = (ushort)(lba / (ImageInfo.heads * ImageInfo.sectorsPerTrack)); + byte head = (byte)((lba / ImageInfo.sectorsPerTrack) % ImageInfo.heads); + byte sector = (byte)((lba % ImageInfo.sectorsPerTrack) + 1); + + return (cylinder, head, sector); + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetMediaManufacturer() + { + return null; + } + + public override string GetMediaModel() + { + return null; + } + + public override string GetMediaSerialNumber() + { + return null; + } + + public override string GetMediaBarcode() + { + return null; + } + + public override string GetMediaPartNumber() + { + return null; + } + + public override int GetMediaSequence() + { + return 0; + } + + public override int GetLastDiskSequence() + { + return 0; + } + + public override string GetDriveManufacturer() + { + return null; + } + + public override string GetDriveModel() + { + return null; + } + + public override string GetDriveSerialNumber() + { + return null; + } + + public override List GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, + out List UnknownLBAs) + { + FailingLBAs = new List(); + UnknownLBAs = new List(); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, + out List UnknownLBAs) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifyMediaImage() + { + return null; + } + #endregion + } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/BLU.cs b/DiscImageChef.DiscImages/BLU.cs index 4e08bee4..dca25dc9 100644 --- a/DiscImageChef.DiscImages/BLU.cs +++ b/DiscImageChef.DiscImages/BLU.cs @@ -39,7 +39,7 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class BLU : ImagePlugin + public class BLU : ImagePlugin { #region Internal Structures struct BLUHeader @@ -52,18 +52,16 @@ namespace DiscImageChef.ImagePlugins #endregion Internal Structures #region Internal Constants - const string profileName = "PROFILE "; + const string profileName = "PROFILE "; const string profile10Name = "PROFILE 10 "; - const string widgetName = "WIDGET-10 "; - const string priamName = "PRIAMDTATOWER"; + const string widgetName = "WIDGET-10 "; + const string priamName = "PRIAMDTATOWER"; #endregion Internal Constants #region Internal variables - BLUHeader ImageHeader; Filter bluImageFilter; int bptag; - #endregion Internal variables #region Public methods @@ -99,8 +97,7 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 0x200) - return false; + if(stream.Length < 0x200) return false; byte[] header = new byte[0x17]; stream.Read(header, 0, 0x17); @@ -114,14 +111,9 @@ namespace DiscImageChef.ImagePlugins tmpHdr.deviceBlocks = BigEndianBitConverter.ToUInt32(header, 0x11) & 0x00FFFFFF; tmpHdr.bytesPerBlock = BigEndianBitConverter.ToUInt16(header, 0x15); - for(int i = 0; i < 0xD; i++) - { - if(tmpHdr.deviceName[i] < 0x20) - return false; - } + for(int i = 0; i < 0xD; i++) { if(tmpHdr.deviceName[i] < 0x20) return false; } - if((tmpHdr.bytesPerBlock & 0xFE00) != 0x200) - return false; + if((tmpHdr.bytesPerBlock & 0xFE00) != 0x200) return false; return true; } @@ -142,25 +134,20 @@ namespace DiscImageChef.ImagePlugins ImageHeader.deviceBlocks = BigEndianBitConverter.ToUInt32(header, 0x11) & 0x00FFFFFF; ImageHeader.bytesPerBlock = BigEndianBitConverter.ToUInt16(header, 0x15); - DicConsole.DebugWriteLine("BLU plugin", "ImageHeader.deviceName = \"{0}\"", StringHandlers.CToString(ImageHeader.deviceName)); + DicConsole.DebugWriteLine("BLU plugin", "ImageHeader.deviceName = \"{0}\"", + StringHandlers.CToString(ImageHeader.deviceName)); DicConsole.DebugWriteLine("BLU plugin", "ImageHeader.deviceType = {0}", ImageHeader.deviceType); DicConsole.DebugWriteLine("BLU plugin", "ImageHeader.deviceBlock = {0}", ImageHeader.deviceBlocks); DicConsole.DebugWriteLine("BLU plugin", "ImageHeader.bytesPerBlock = {0}", ImageHeader.bytesPerBlock); - for(int i = 0; i < 0xD; i++) - { - if(ImageHeader.deviceName[i] < 0x20) - return false; - } + for(int i = 0; i < 0xD; i++) { if(ImageHeader.deviceName[i] < 0x20) return false; } - if((ImageHeader.bytesPerBlock & 0xFE00) != 0x200) - return false; + if((ImageHeader.bytesPerBlock & 0xFE00) != 0x200) return false; stream.Seek(0, SeekOrigin.Begin); header = new byte[ImageHeader.bytesPerBlock]; stream.Read(header, 0, ImageHeader.bytesPerBlock); - ImageInfo.sectorSize = 0x200; ImageInfo.sectors = ImageHeader.deviceBlocks; @@ -172,47 +159,39 @@ namespace DiscImageChef.ImagePlugins switch(StringHandlers.CToString(ImageHeader.deviceName)) { case profileName: - if(ImageInfo.sectors == 0x2600) - ImageInfo.mediaType = MediaType.AppleProfile; - else - ImageInfo.mediaType = MediaType.GENERIC_HDD; - ImageInfo.cylinders = 152; - ImageInfo.heads = 4; - ImageInfo.sectorsPerTrack = 16; - break; + if(ImageInfo.sectors == 0x2600) ImageInfo.mediaType = MediaType.AppleProfile; + else ImageInfo.mediaType = MediaType.GENERIC_HDD; + ImageInfo.cylinders = 152; + ImageInfo.heads = 4; + ImageInfo.sectorsPerTrack = 16; + break; case profile10Name: - if(ImageInfo.sectors == 0x4C00) - ImageInfo.mediaType = MediaType.AppleProfile; - else - ImageInfo.mediaType = MediaType.GENERIC_HDD; - ImageInfo.cylinders = 304; - ImageInfo.heads = 4; - ImageInfo.sectorsPerTrack = 16; - break; + if(ImageInfo.sectors == 0x4C00) ImageInfo.mediaType = MediaType.AppleProfile; + else ImageInfo.mediaType = MediaType.GENERIC_HDD; + ImageInfo.cylinders = 304; + ImageInfo.heads = 4; + ImageInfo.sectorsPerTrack = 16; + break; case widgetName: - if(ImageInfo.sectors == 0x4C00) - ImageInfo.mediaType = MediaType.AppleWidget; - else - ImageInfo.mediaType = MediaType.GENERIC_HDD; - ImageInfo.cylinders = 304; - ImageInfo.heads = 4; - ImageInfo.sectorsPerTrack = 16; - break; + if(ImageInfo.sectors == 0x4C00) ImageInfo.mediaType = MediaType.AppleWidget; + else ImageInfo.mediaType = MediaType.GENERIC_HDD; + ImageInfo.cylinders = 304; + ImageInfo.heads = 4; + ImageInfo.sectorsPerTrack = 16; + break; case priamName: - if(ImageInfo.sectors == 0x022C7C) - ImageInfo.mediaType = MediaType.PriamDataTower; - else - ImageInfo.mediaType = MediaType.GENERIC_HDD; - // This values are invented... - ImageInfo.cylinders = 419; - ImageInfo.heads = 4; - ImageInfo.sectorsPerTrack = 85; - break; + if(ImageInfo.sectors == 0x022C7C) ImageInfo.mediaType = MediaType.PriamDataTower; + else ImageInfo.mediaType = MediaType.GENERIC_HDD; + // This values are invented... + ImageInfo.cylinders = 419; + ImageInfo.heads = 4; + ImageInfo.sectorsPerTrack = 85; + break; default: ImageInfo.mediaType = MediaType.GENERIC_HDD; - ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); - ImageInfo.heads = 16; - ImageInfo.sectorsPerTrack = 63; + ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); + ImageInfo.heads = 16; + ImageInfo.sectorsPerTrack = 63; break; } @@ -226,8 +205,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - if(bptag > 0) - ImageInfo.readableSectorTags.Add(SectorTagType.AppleSectorTag); + if(bptag > 0) ImageInfo.readableSectorTags.Add(SectorTagType.AppleSectorTag); DicConsole.VerboseWriteLine("BLU image contains a disk of type {0}", ImageInfo.mediaType); @@ -245,24 +223,24 @@ namespace DiscImageChef.ImagePlugins return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, out List UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, + out List UnknownLBAs) { FailingLBAs = new List(); UnknownLBAs = new List(); - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, out List UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, + out List UnknownLBAs) { FailingLBAs = new List(); UnknownLBAs = new List(); - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); return null; } @@ -336,8 +314,7 @@ namespace DiscImageChef.ImagePlugins if(tag != SectorTagType.AppleSectorTag) throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); - if(bptag == 0) - throw new FeatureNotPresentImageException("Disk image does not have tags"); + if(bptag == 0) throw new FeatureNotPresentImageException("Disk image does not have tags"); if(sectorAddress > ImageInfo.sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); @@ -428,7 +405,6 @@ namespace DiscImageChef.ImagePlugins #endregion Public methods #region Unsupported features - public override byte[] ReadDiskTag(MediaTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -548,8 +524,6 @@ namespace DiscImageChef.ImagePlugins { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - #endregion Unsupported features - } -} +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/BlindWrite4.cs b/DiscImageChef.DiscImages/BlindWrite4.cs index 4b163bd1..3cb6b79d 100644 --- a/DiscImageChef.DiscImages/BlindWrite4.cs +++ b/DiscImageChef.DiscImages/BlindWrite4.cs @@ -43,11 +43,15 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class BlindWrite4 : ImagePlugin + public class BlindWrite4 : ImagePlugin { #region Internal Constants /// "BLINDWRITE TOC FILE" - readonly byte[] BW4_Signature = { 0x42, 0x4C, 0x49, 0x4E, 0x44, 0x57, 0x52, 0x49, 0x54, 0x45, 0x20, 0x54, 0x4F, 0x43, 0x20, 0x46, 0x49, 0x4C, 0x45 }; + readonly byte[] BW4_Signature = + { + 0x42, 0x4C, 0x49, 0x4E, 0x44, 0x57, 0x52, 0x49, 0x54, 0x45, 0x20, 0x54, 0x4F, 0x43, 0x20, 0x46, 0x49, 0x4C, + 0x45 + }; #endregion Internal Constants #region Internal Structures @@ -88,8 +92,7 @@ namespace DiscImageChef.ImagePlugins public byte[] filenameBytes; public uint offset; public byte subchannel; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] unknown1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] unknown1; public uint unknown2; public byte unknown3; public byte session; @@ -108,8 +111,7 @@ namespace DiscImageChef.ImagePlugins public byte unknown12; public int pregap; public int startSector; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public uint[] unknown13; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] unknown13; public uint titleLen; public byte[] titleBytes; public uint performerLen; @@ -170,7 +172,6 @@ namespace DiscImageChef.ImagePlugins } #endregion Internal enumerations - #region Internal variables BW4_Header header; List bwTracks; @@ -212,8 +213,7 @@ namespace DiscImageChef.ImagePlugins { Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 19) - return false; + if(stream.Length < 19) return false; byte[] signature = new byte[19]; stream.Read(signature, 0, 19); @@ -225,8 +225,7 @@ namespace DiscImageChef.ImagePlugins { Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 19) - return false; + if(stream.Length < 19) return false; byte[] tmpArray = new byte[19]; byte[] tmpUShort = new byte[2]; @@ -235,8 +234,7 @@ namespace DiscImageChef.ImagePlugins stream.Read(tmpArray, 0, 19); - if(!BW4_Signature.SequenceEqual(tmpArray)) - return false; + if(!BW4_Signature.SequenceEqual(tmpArray)) return false; header = new BW4_Header(); header.signature = tmpArray; @@ -293,7 +291,8 @@ namespace DiscImageChef.ImagePlugins stream.Read(tmpArray, 0, header.unknown3); header.unknown4 = tmpArray; - DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.signature = {0}", StringHandlers.CToString(header.signature)); + DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.signature = {0}", + StringHandlers.CToString(header.signature)); DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.unknown1 = {0}", header.unknown1); DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.timestamp = {0}", header.timestamp); DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.volumeIdLength = {0}", header.volumeIdLength); @@ -306,7 +305,8 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.dataFileLength = {0}", header.dataFileLength); DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.dataFilter = {0}", header.dataFilter); DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.dataFile = {0}", header.dataFile); - DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.subchannelFileLength = {0}", header.subchannelFileLength); + DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.subchannelFileLength = {0}", + header.subchannelFileLength); DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.subchannelFilter = {0}", header.subchannelFilter); DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.subchannelFile = {0}", header.subchannelFile); DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.unknown2 = {0}", header.unknown2); @@ -484,7 +484,9 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.offset = {0}", track.offset); DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.subchannel = {0}", track.subchannel); for(int j = 0; j < track.unknown1.Length; j++) - DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown1[{1}] = 0x{0:X8}", track.unknown1[j], j); + DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown1[{1}] = 0x{0:X8}", track.unknown1[j], + j); + DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown2 = {0}", track.unknown2); DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown3 = {0}", track.unknown3); DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.session = {0}", track.session); @@ -504,7 +506,9 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.pregap = {0}", track.pregap); DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.startSector = {0}", track.startSector); for(int j = 0; j < track.unknown13.Length; j++) - DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown13[{1}] = 0x{0:X8}", track.unknown13[j], j); + DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown13[{1}] = 0x{0:X8}", + track.unknown13[j], j); + DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.titleLen = {0}", track.titleLen); DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.title = {0}", track.title); DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.performerLen = {0}", track.performerLen); @@ -545,77 +549,87 @@ namespace DiscImageChef.ImagePlugins { while(true) { - dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - header.dataFile)); - if(dataFilter != null) - break; + dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), header.dataFile)); + if(dataFilter != null) break; dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - header.dataFile.ToLower(CultureInfo.CurrentCulture))); - if(dataFilter != null) - break; + header.dataFile.ToLower(CultureInfo + .CurrentCulture))); + if(dataFilter != null) break; dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - header.dataFile.ToUpper(CultureInfo.CurrentCulture))); - if(dataFilter != null) - break; + header.dataFile.ToUpper(CultureInfo + .CurrentCulture))); + if(dataFilter != null) break; dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - header.dataFile.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Last())); - if(dataFilter != null) - break; + header.dataFile.Split(new char[] {'\\'}, + StringSplitOptions + .RemoveEmptyEntries) + .Last())); + if(dataFilter != null) break; dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - header.dataFile.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Last().ToLower(CultureInfo.CurrentCulture))); - if(dataFilter != null) - break; + header.dataFile.Split(new char[] {'\\'}, + StringSplitOptions + .RemoveEmptyEntries) + .Last() + .ToLower(CultureInfo.CurrentCulture))); + if(dataFilter != null) break; dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - header.dataFile.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Last().ToUpper(CultureInfo.CurrentCulture))); - if(dataFilter != null) - break; + header.dataFile.Split(new char[] {'\\'}, + StringSplitOptions + .RemoveEmptyEntries) + .Last() + .ToUpper(CultureInfo.CurrentCulture))); + if(dataFilter != null) break; throw new ArgumentException(string.Format("Data file {0} not found", header.dataFile)); } } - else - throw new ArgumentException("Unable to find data file"); + else throw new ArgumentException("Unable to find data file"); if(!string.IsNullOrEmpty(header.subchannelFile)) { - filtersList = new FiltersList(); + filtersList = new FiltersList(); do { - subFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - header.subchannelFile)); - if(subFilter != null) - break; + subFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), header.subchannelFile)); + if(subFilter != null) break; subFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - header.subchannelFile.ToLower(CultureInfo.CurrentCulture))); - if(subFilter != null) - break; + header.subchannelFile.ToLower(CultureInfo + .CurrentCulture))); + if(subFilter != null) break; subFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - header.subchannelFile.ToUpper(CultureInfo.CurrentCulture))); - if(subFilter != null) - break; + header.subchannelFile.ToUpper(CultureInfo + .CurrentCulture))); + if(subFilter != null) break; subFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - header.subchannelFile.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Last())); - if(subFilter != null) - break; + header.subchannelFile.Split(new char[] {'\\'}, + StringSplitOptions + .RemoveEmptyEntries) + .Last())); + if(subFilter != null) break; subFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - header.subchannelFile.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Last().ToLower(CultureInfo.CurrentCulture))); - if(subFilter != null) - break; + header.subchannelFile.Split(new char[] {'\\'}, + StringSplitOptions + .RemoveEmptyEntries) + .Last().ToLower(CultureInfo.CurrentCulture))); + if(subFilter != null) break; subFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - header.subchannelFile.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Last().ToUpper(CultureInfo.CurrentCulture))); - if(subFilter != null) - break; + header.subchannelFile.Split(new char[] {'\\'}, + StringSplitOptions + .RemoveEmptyEntries) + .Last().ToUpper(CultureInfo.CurrentCulture))); + if(subFilter != null) break; subFilter = null; break; @@ -641,40 +655,52 @@ namespace DiscImageChef.ImagePlugins { do { - track.TrackFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - bwTrack.filename)); - if(track.TrackFilter != null) - break; + track.TrackFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), bwTrack.filename)); + if(track.TrackFilter != null) break; - track.TrackFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - bwTrack.filename.ToLower(CultureInfo.CurrentCulture))); - if(track.TrackFilter != null) - break; + track.TrackFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + bwTrack.filename.ToLower(CultureInfo + .CurrentCulture))); + if(track.TrackFilter != null) break; - track.TrackFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - bwTrack.filename.ToUpper(CultureInfo.CurrentCulture))); - if(track.TrackFilter != null) - break; + track.TrackFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + bwTrack.filename.ToUpper(CultureInfo + .CurrentCulture))); + if(track.TrackFilter != null) break; - track.TrackFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - bwTrack.filename.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Last())); - if(track.TrackFilter != null) - break; + track.TrackFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + bwTrack.filename.Split(new char[] {'\\'}, + StringSplitOptions + .RemoveEmptyEntries) + .Last())); + if(track.TrackFilter != null) break; - track.TrackFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - bwTrack.filename.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Last().ToLower(CultureInfo.CurrentCulture))); - if(track.TrackFilter != null) - break; + track.TrackFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + bwTrack.filename.Split(new char[] {'\\'}, + StringSplitOptions + .RemoveEmptyEntries) + .Last() + .ToLower(CultureInfo.CurrentCulture))); + if(track.TrackFilter != null) break; - track.TrackFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), - bwTrack.filename.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Last().ToUpper(CultureInfo.CurrentCulture))); + track.TrackFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + bwTrack.filename.Split(new char[] {'\\'}, + StringSplitOptions + .RemoveEmptyEntries) + .Last() + .ToUpper(CultureInfo.CurrentCulture))); track.TrackFilter = dataFilter; } while(true); } - else - track.TrackFilter = dataFilter; + else track.TrackFilter = dataFilter; track.TrackFile = dataFilter.GetFilename(); track.TrackFileOffset = bwTrack.offset; @@ -685,8 +711,7 @@ namespace DiscImageChef.ImagePlugins track.TrackRawBytesPerSector = 2352; track.TrackSequence = bwTrack.point; track.TrackSession = bwTrack.session; - if(track.TrackSession > maxSession) - maxSession = track.TrackSession; + if(track.TrackSession > maxSession) maxSession = track.TrackSession; track.TrackStartSector = (ulong)bwTrack.startSector; track.TrackSubchannelFilter = subFilter; track.TrackSubchannelFile = subFilter.GetFilename(); @@ -697,8 +722,7 @@ namespace DiscImageChef.ImagePlugins if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubchannel); } - else - track.TrackSubchannelType = TrackSubchannelType.None; + else track.TrackSubchannelType = TrackSubchannelType.None; switch(bwTrack.trackMode) { @@ -723,8 +747,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - if(ImageInfo.sectorSize < 2048) - ImageInfo.sectorSize = 2048; + if(ImageInfo.sectorSize < 2048) ImageInfo.sectorSize = 2048; track.TrackBytesPerSector = 2048; break; case BW4_TrackType.Mode2: @@ -733,8 +756,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(ImageInfo.sectorSize < 2336) - ImageInfo.sectorSize = 2336; + if(ImageInfo.sectorSize < 2336) ImageInfo.sectorSize = 2336; track.TrackBytesPerSector = 2336; break; default: @@ -746,13 +768,11 @@ namespace DiscImageChef.ImagePlugins } track.Indexes = new Dictionary(); - if(bwTrack.pregap > 0) - track.Indexes.Add(0, (ulong)bwTrack.pregap); + if(bwTrack.pregap > 0) track.Indexes.Add(0, (ulong)bwTrack.pregap); track.Indexes.Add(1, (ulong)bwTrack.startSector); Partition partition = new Partition(); - if(bwTrack.pregap > 0) - currentPos += (ulong)(bwTrack.startSector - bwTrack.pregap) * 2352; + if(bwTrack.pregap > 0) currentPos += (ulong)(bwTrack.startSector - bwTrack.pregap) * 2352; partition.Description = track.TrackDescription; partition.Size = (track.TrackEndSector - track.TrackStartSector + 1) * 2352; partition.Length = track.TrackEndSector - track.TrackStartSector; @@ -779,7 +799,8 @@ namespace DiscImageChef.ImagePlugins ImageInfo.mediaSerialNumber = bwTrack.discId; ImageInfo.imageName = bwTrack.title; - if(!string.IsNullOrEmpty(bwTrack.isrcUpc) && !ImageInfo.readableMediaTags.Contains(MediaTagType.CD_MCN)) + if(!string.IsNullOrEmpty(bwTrack.isrcUpc) && + !ImageInfo.readableMediaTags.Contains(MediaTagType.CD_MCN)) ImageInfo.readableMediaTags.Add(MediaTagType.CD_MCN); } } @@ -796,14 +817,10 @@ namespace DiscImageChef.ImagePlugins { if(track.TrackSession == i) { - if(track.TrackSequence < session.StartTrack) - session.StartTrack = track.TrackSequence; - if(track.TrackSequence > session.EndTrack) - session.StartTrack = track.TrackSequence; - if(track.TrackStartSector < session.StartSector) - session.StartSector = track.TrackStartSector; - if(track.TrackEndSector > session.EndSector) - session.EndSector = track.TrackEndSector; + if(track.TrackSequence < session.StartTrack) session.StartTrack = track.TrackSequence; + if(track.TrackSequence > session.EndTrack) session.StartTrack = track.TrackSequence; + if(track.TrackStartSector < session.StartSector) session.StartSector = track.TrackStartSector; + if(track.TrackEndSector > session.EndSector) session.EndSector = track.TrackEndSector; } } @@ -849,16 +866,11 @@ namespace DiscImageChef.ImagePlugins } } - if(!data && !firstdata) - ImageInfo.mediaType = MediaType.CDDA; - else if(firstaudio && data && sessions.Count > 1 && mode2) - ImageInfo.mediaType = MediaType.CDPLUS; - else if((firstdata && audio) || mode2) - ImageInfo.mediaType = MediaType.CDROMXA; - else if(!audio) - ImageInfo.mediaType = MediaType.CDROM; - else - ImageInfo.mediaType = MediaType.CD; + if(!data && !firstdata) ImageInfo.mediaType = MediaType.CDDA; + else if(firstaudio && data && sessions.Count > 1 && mode2) ImageInfo.mediaType = MediaType.CDPLUS; + else if((firstdata && audio) || mode2) ImageInfo.mediaType = MediaType.CDROMXA; + else if(!audio) ImageInfo.mediaType = MediaType.CDROM; + else ImageInfo.mediaType = MediaType.CD; ImageInfo.imageComments = header.comments; @@ -894,13 +906,14 @@ namespace DiscImageChef.ImagePlugins switch(tag) { case MediaTagType.CD_MCN: + { + if(ImageInfo.mediaSerialNumber != null) { - if(ImageInfo.mediaSerialNumber != null) - { - return Encoding.ASCII.GetBytes(ImageInfo.mediaSerialNumber); - } - throw new FeatureNotPresentImageException("Image does not contain MCN information."); + return Encoding.ASCII.GetBytes(ImageInfo.mediaSerialNumber); } + + throw new FeatureNotPresentImageException("Image does not contain MCN information."); + } default: throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format"); } @@ -985,7 +998,12 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length + sectorAddress > (_track.TrackEndSector - _track.TrackStartSector + 1)) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length + sectorAddress, (_track.TrackEndSector - _track.TrackStartSector + 1))); + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length + sectorAddress, + (_track.TrackEndSector - _track.TrackStartSector + + 1))); uint sector_offset; uint sector_size; @@ -994,44 +1012,44 @@ namespace DiscImageChef.ImagePlugins switch(_track.TrackType) { case TrackType.CDMode1: - { - sector_offset = 16; - sector_size = 2048; - sector_skip = 288; - break; - } + { + sector_offset = 16; + sector_size = 2048; + sector_skip = 288; + break; + } case TrackType.CDMode2Formless: - { - sector_offset = 16; - sector_size = 2336; - sector_skip = 0; - break; - } + { + sector_offset = 16; + sector_size = 2336; + sector_skip = 0; + break; + } case TrackType.Audio: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } case TrackType.Data: - { - sector_offset = 0; - sector_size = 2048; - sector_skip = 0; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + { + sector_offset = 0; + sector_size = 2048; + sector_skip = 0; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; imageStream = _track.TrackFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.TrackFileOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + br.BaseStream + .Seek((long)_track.TrackFileOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -1066,7 +1084,12 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length + sectorAddress > (_track.TrackEndSector - _track.TrackStartSector + 1)) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length + sectorAddress, (_track.TrackEndSector - _track.TrackStartSector + 1))); + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length + sectorAddress, + (_track.TrackEndSector - _track.TrackStartSector + + 1))); uint sector_offset; uint sector_size; @@ -1084,15 +1107,13 @@ namespace DiscImageChef.ImagePlugins case SectorTagType.CDSectorHeader: case SectorTagType.CDSectorSubchannel: case SectorTagType.CDSectorSubHeader: - case SectorTagType.CDSectorSync: - break; + case SectorTagType.CDSectorSync: break; case SectorTagType.CDTrackFlags: byte flag; - if(trackFlags.TryGetValue(track, out flag)) - return new byte[] { flag }; - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - default: + if(trackFlags.TryGetValue(track, out flag)) return new byte[] {flag}; + throw new ArgumentException("Unsupported tag requested", nameof(tag)); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } switch(_track.TrackType) @@ -1101,107 +1122,106 @@ namespace DiscImageChef.ImagePlugins switch(tag) { case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } + { + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; + } case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } case SectorTagType.CDSectorSubHeader: throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - sector_skip = 0; - break; - } + { + sector_offset = 2076; + sector_size = 276; + sector_skip = 0; + break; + } case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - sector_skip = 104; - break; - } + { + sector_offset = 2076; + sector_size = 172; + sector_skip = 104; + break; + } case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - sector_skip = 0; - break; - } + { + sector_offset = 2248; + sector_size = 104; + sector_skip = 0; + break; + } case SectorTagType.CDSectorEDC: - { - sector_offset = 2064; - sector_size = 4; - sector_skip = 284; - break; - } + { + sector_offset = 2064; + sector_size = 4; + sector_skip = 284; + break; + } case SectorTagType.CDSectorSubchannel: throw new NotImplementedException("Packed subchannel not yet supported"); - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } + break; case TrackType.CDMode2Formless: + { + switch(tag) { - switch(tag) + case SectorTagType.CDSectorSync: + case SectorTagType.CDSectorHeader: + case SectorTagType.CDSectorECC: + case SectorTagType.CDSectorECC_P: + case SectorTagType.CDSectorECC_Q: + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + case SectorTagType.CDSectorSubHeader: { - case SectorTagType.CDSectorSync: - case SectorTagType.CDSectorHeader: - case SectorTagType.CDSectorECC: - case SectorTagType.CDSectorECC_P: - case SectorTagType.CDSectorECC_Q: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorSubHeader: - { - sector_offset = 0; - sector_size = 8; - sector_skip = 2328; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2332; - sector_size = 4; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorSubchannel: - throw new NotImplementedException("Packed subchannel not yet supported"); - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + sector_offset = 0; + sector_size = 8; + sector_skip = 2328; + break; } - break; + case SectorTagType.CDSectorEDC: + { + sector_offset = 2332; + sector_size = 4; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorSubchannel: + throw new NotImplementedException("Packed subchannel not yet supported"); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } + + break; + } case TrackType.Audio: + { + switch(tag) { - switch(tag) - { - case SectorTagType.CDSectorSubchannel: - throw new NotImplementedException("Packed subchannel not yet supported"); - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } + case SectorTagType.CDSectorSubchannel: + throw new NotImplementedException("Packed subchannel not yet supported"); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; imageStream = _track.TrackFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.TrackFileOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + br.BaseStream + .Seek((long)_track.TrackFileOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -1266,7 +1286,12 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length + sectorAddress > (_track.TrackEndSector - _track.TrackStartSector + 1)) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length + sectorAddress, (_track.TrackEndSector - _track.TrackStartSector + 1))); + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length + sectorAddress, + (_track.TrackEndSector - _track.TrackStartSector + + 1))); uint sector_offset; uint sector_size; @@ -1278,21 +1303,22 @@ namespace DiscImageChef.ImagePlugins case TrackType.CDMode1: case TrackType.CDMode2Formless: case TrackType.Data: - { - sector_offset = 0; - sector_size = (uint)_track.TrackRawBytesPerSector; - sector_skip = 0; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + { + sector_offset = 0; + sector_size = (uint)_track.TrackRawBytesPerSector; + sector_skip = 0; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; imageStream = _track.TrackFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.TrackFileOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); + br.BaseStream + .Seek((long)_track.TrackFileOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); buffer = br.ReadBytes((int)(sector_size * length)); return buffer; @@ -1330,24 +1356,19 @@ namespace DiscImageChef.ImagePlugins public override List GetSessionTracks(Session session) { - if(sessions.Contains(session)) - { - return GetSessionTracks(session.SessionSequence); - } + if(sessions.Contains(session)) { return GetSessionTracks(session.SessionSequence); } + throw new ImageNotSupportedException("Session does not exist in disc image"); } public override List GetSessionTracks(ushort session) { List _tracks = new List(); - foreach(Track _track in tracks) - { - if(_track.TrackSession == session) - _tracks.Add(_track); - } + foreach(Track _track in tracks) { if(_track.TrackSession == session) _tracks.Add(_track); } return _tracks; } + public override List GetSessions() { return sessions; @@ -1365,7 +1386,8 @@ namespace DiscImageChef.ImagePlugins return Checksums.CDChecksums.CheckCDSector(buffer); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, out List UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, + out List UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); @@ -1389,14 +1411,14 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, out List UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, + out List UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length, track); int bps = (int)(buffer.Length / length); @@ -1420,10 +1442,9 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } @@ -1515,5 +1536,4 @@ namespace DiscImageChef.ImagePlugins } #endregion Unsupported features } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/BlindWrite5.cs b/DiscImageChef.DiscImages/BlindWrite5.cs index 80b1f353..212a7c22 100644 --- a/DiscImageChef.DiscImages/BlindWrite5.cs +++ b/DiscImageChef.DiscImages/BlindWrite5.cs @@ -44,13 +44,15 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class BlindWrite5 : ImagePlugin + public class BlindWrite5 : ImagePlugin { #region Internal Constants /// "BWT5 STREAM SIGN" - readonly byte[] BW5_Signature = { 0x42, 0x57, 0x54, 0x35, 0x20, 0x53, 0x54, 0x52, 0x45, 0x41, 0x4D, 0x20, 0x53, 0x49, 0x47, 0x4E }; + readonly byte[] BW5_Signature = + {0x42, 0x57, 0x54, 0x35, 0x20, 0x53, 0x54, 0x52, 0x45, 0x41, 0x4D, 0x20, 0x53, 0x49, 0x47, 0x4E}; /// "BWT5 STREAM FOOT" - readonly byte[] BW5_Footer = { 0x42, 0x57, 0x54, 0x35, 0x20, 0x53, 0x54, 0x52, 0x45, 0x41, 0x4D, 0x20, 0x46, 0x4F, 0x4F, 0x54 }; + readonly byte[] BW5_Footer = + {0x42, 0x57, 0x54, 0x35, 0x20, 0x53, 0x54, 0x52, 0x45, 0x41, 0x4D, 0x20, 0x46, 0x4F, 0x4F, 0x54}; #endregion Internal Constants #region Internal enumerations @@ -77,42 +79,29 @@ namespace DiscImageChef.ImagePlugins [StructLayout(LayoutKind.Sequential, Pack = 1)] struct BW5_Header { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] signature; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public uint[] unknown1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] signature; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public uint[] unknown1; public ProfileNumber profile; public ushort sessions; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public uint[] unknown2; - [MarshalAs(UnmanagedType.U1, SizeConst = 3)] - public bool mcnIsValid; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] - public byte[] mcn; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] unknown2; + [MarshalAs(UnmanagedType.U1, SizeConst = 3)] public bool mcnIsValid; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] public byte[] mcn; public ushort unknown3; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public uint[] unknown4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] unknown4; public ushort pmaLen; public ushort atipLen; public ushort cdtLen; public ushort cdInfoLen; public uint bcaLen; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public uint[] unknown5; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] unknown5; public uint dvdStrLen; public uint dvdInfoLen; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] unknown6; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] manufacturer; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] product; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] revision; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] vendor; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] volumeId; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] unknown6; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] manufacturer; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] product; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] revision; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] vendor; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] volumeId; public uint mode2ALen; public uint unkBlkLen; public uint dataLen; @@ -124,11 +113,9 @@ namespace DiscImageChef.ImagePlugins { public uint type; public uint length; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public uint[] unknown1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] unknown1; public uint offset; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public uint[] unknown2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] unknown2; public int startLba; public int sectors; public uint filenameLen; @@ -142,8 +129,7 @@ namespace DiscImageChef.ImagePlugins struct BW5_TrackDescriptor { public BW5_TrackType type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] unknown1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] unknown1; public uint unknown2; public BW5_TrackSubchannel subchannel; public byte unknown3; @@ -160,17 +146,14 @@ namespace DiscImageChef.ImagePlugins public byte pframe; public byte unknown5; public uint pregap; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public uint[] unknown6; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] unknown6; public int startLba; public int sectors; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public uint[] unknown7; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] unknown7; public uint session; public ushort unknown8; // Seems to be only on non DVD track descriptors - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public uint[] unknown9; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] unknown9; } struct BW5_SessionDescriptor @@ -250,8 +233,7 @@ namespace DiscImageChef.ImagePlugins { Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 276) - return false; + if(stream.Length < 276) return false; byte[] signature = new byte[16]; stream.Read(signature, 0, 16); @@ -267,8 +249,7 @@ namespace DiscImageChef.ImagePlugins { Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 276) - return false; + if(stream.Length < 276) return false; byte[] hdr = new byte[260]; stream.Read(hdr, 0, 260); @@ -278,34 +259,50 @@ namespace DiscImageChef.ImagePlugins header = (BW5_Header)Marshal.PtrToStructure(hdrPtr, typeof(BW5_Header)); Marshal.FreeHGlobal(hdrPtr); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.signature = {0}", StringHandlers.CToString(header.signature)); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.signature = {0}", + StringHandlers.CToString(header.signature)); for(int i = 0; i < header.unknown1.Length; i++) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.unknown1[{1}] = 0x{0:X8}", header.unknown1[i], i); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.unknown1[{1}] = 0x{0:X8}", header.unknown1[i], + i); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.profile = {0}", header.profile); DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.sessions = {0}", header.sessions); for(int i = 0; i < header.unknown2.Length; i++) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.unknown2[{1}] = 0x{0:X8}", header.unknown2[i], i); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.unknown2[{1}] = 0x{0:X8}", header.unknown2[i], + i); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.mcnIsValid = {0}", header.mcnIsValid); DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.mcn = {0}", StringHandlers.CToString(header.mcn)); DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.unknown3 = 0x{0:X4}", header.unknown3); for(int i = 0; i < header.unknown4.Length; i++) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.unknown4[{1}] = 0x{0:X8}", header.unknown4[i], i); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.unknown4[{1}] = 0x{0:X8}", header.unknown4[i], + i); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.pmaLen = {0}", header.pmaLen); DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.atipLen = {0}", header.atipLen); DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.cdtLen = {0}", header.cdtLen); DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.cdInfoLen = {0}", header.cdInfoLen); DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.bcaLen = {0}", header.bcaLen); for(int i = 0; i < header.unknown5.Length; i++) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.unknown5[{1}] = 0x{0:X8}", header.unknown5[i], i); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.unknown5[{1}] = 0x{0:X8}", header.unknown5[i], + i); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.dvdStrLen = {0}", header.dvdStrLen); DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.dvdInfoLen = {0}", header.dvdInfoLen); for(int i = 0; i < header.unknown6.Length; i++) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.unknown6[{1}] = 0x{0:X2}", header.unknown6[i], i); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.manufacturer = {0}", StringHandlers.CToString(header.manufacturer)); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.product = {0}", StringHandlers.CToString(header.product)); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.revision = {0}", StringHandlers.CToString(header.revision)); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.vendor = {0}", StringHandlers.CToString(header.vendor)); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.volumeId = {0}", StringHandlers.CToString(header.volumeId)); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.unknown6[{1}] = 0x{0:X2}", header.unknown6[i], + i); + + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.manufacturer = {0}", + StringHandlers.CToString(header.manufacturer)); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.product = {0}", + StringHandlers.CToString(header.product)); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.revision = {0}", + StringHandlers.CToString(header.revision)); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.vendor = {0}", + StringHandlers.CToString(header.vendor)); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.volumeId = {0}", + StringHandlers.CToString(header.volumeId)); DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.mode2ALen = {0}", header.mode2ALen); DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.unkBlkLen = {0}", header.unkBlkLen); DicConsole.DebugWriteLine("BlindWrite5 plugin", "header.dataLen = {0}", header.dataLen); @@ -319,14 +316,13 @@ namespace DiscImageChef.ImagePlugins mode2A[1] -= 2; Decoders.SCSI.Modes.ModePage_2A? decoded2A = Decoders.SCSI.Modes.DecodeModePage_2A(mode2A); if(decoded2A.HasValue) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "mode page 2A: {0}", Decoders.SCSI.Modes.PrettifyModePage_2A(decoded2A)); - else - mode2A = null; + DicConsole.DebugWriteLine("BlindWrite5 plugin", "mode page 2A: {0}", + Decoders.SCSI.Modes.PrettifyModePage_2A(decoded2A)); + else mode2A = null; } unkBlock = new byte[header.unkBlkLen]; - if(unkBlock.Length > 0) - stream.Read(unkBlock, 0, unkBlock.Length); + if(unkBlock.Length > 0) stream.Read(unkBlock, 0, unkBlock.Length); byte[] temp = new byte[header.pmaLen]; if(temp.Length > 0) @@ -341,8 +337,7 @@ namespace DiscImageChef.ImagePlugins Decoders.CD.PMA.CDPMA? decodedPma = Decoders.CD.PMA.Decode(pma); if(decodedPma.HasValue) DicConsole.DebugWriteLine("BlindWrite5 plugin", "PMA: {0}", Decoders.CD.PMA.Prettify(decodedPma)); - else - pma = null; + else pma = null; } temp = new byte[header.atipLen]; @@ -357,9 +352,9 @@ namespace DiscImageChef.ImagePlugins Decoders.CD.ATIP.CDATIP? decodedAtip = Decoders.CD.ATIP.Decode(atip); if(decodedAtip.HasValue) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "ATIP: {0}", Decoders.CD.ATIP.Prettify(decodedAtip)); - else - atip = null; + DicConsole.DebugWriteLine("BlindWrite5 plugin", "ATIP: {0}", + Decoders.CD.ATIP.Prettify(decodedAtip)); + else atip = null; } temp = new byte[header.cdtLen]; @@ -374,16 +369,14 @@ namespace DiscImageChef.ImagePlugins Decoders.CD.CDTextOnLeadIn.CDText? decodedCdText = Decoders.CD.CDTextOnLeadIn.Decode(cdtext); if(decodedCdText.HasValue) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "CD-Text: {0}", Decoders.CD.CDTextOnLeadIn.Prettify(decodedCdText)); - else - cdtext = null; + DicConsole.DebugWriteLine("BlindWrite5 plugin", "CD-Text: {0}", + Decoders.CD.CDTextOnLeadIn.Prettify(decodedCdText)); + else cdtext = null; } bca = new byte[header.bcaLen]; - if(bca.Length > 0) - stream.Read(bca, 0, bca.Length); - else - bca = null; + if(bca.Length > 0) stream.Read(bca, 0, bca.Length); + else bca = null; temp = new byte[header.dvdStrLen]; if(temp.Length > 0) @@ -431,10 +424,10 @@ namespace DiscImageChef.ImagePlugins if(discInformation.Length > 0) { stream.Read(discInformation, 0, discInformation.Length); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "Disc information: {0}", PrintHex.ByteArrayToHexArrayString(discInformation, 40)); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "Disc information: {0}", + PrintHex.ByteArrayToHexArrayString(discInformation, 40)); } - else - discInformation = null; + else discInformation = null; // How many data blocks byte[] tmpArray = new byte[4]; @@ -485,10 +478,14 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("BlindWrite5 plugin", "dataFile.type = 0x{0:X8}", dataFile.type); DicConsole.DebugWriteLine("BlindWrite5 plugin", "dataFile.length = {0}", dataFile.length); for(int i = 0; i < dataFile.unknown1.Length; i++) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "dataFile.unknown1[{1}] = {0}", dataFile.unknown1[i], i); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "dataFile.unknown1[{1}] = {0}", + dataFile.unknown1[i], i); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "dataFile.offset = {0}", dataFile.offset); for(int i = 0; i < dataFile.unknown2.Length; i++) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "dataFile.unknown2[{1}] = {0}", dataFile.unknown2[i], i); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "dataFile.unknown2[{1}] = {0}", + dataFile.unknown2[i], i); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "dataFile.startLba = {0}", dataFile.startLba); DicConsole.DebugWriteLine("BlindWrite5 plugin", "dataFile.sectors = {0}", dataFile.sectors); DicConsole.DebugWriteLine("BlindWrite5 plugin", "dataFile.filenameLen = {0}", dataFile.filenameLen); @@ -516,7 +513,8 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].unknown = {1}", ses, session.unknown); DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].start = {1}", ses, session.start); DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].end = {1}", ses, session.end); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].firstTrack = {1}", ses, session.firstTrack); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].firstTrack = {1}", ses, + session.firstTrack); DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].lastTrack = {1}", ses, session.lastTrack); for(int tSeq = 0; tSeq < session.entries; tSeq++) @@ -526,7 +524,8 @@ namespace DiscImageChef.ImagePlugins session.tracks[tSeq] = new BW5_TrackDescriptor(); IntPtr trkPtr = Marshal.AllocHGlobal(72); Marshal.Copy(trk, 0, trkPtr, 72); - session.tracks[tSeq] = (BW5_TrackDescriptor)Marshal.PtrToStructure(trkPtr, typeof(BW5_TrackDescriptor)); + session.tracks[tSeq] = + (BW5_TrackDescriptor)Marshal.PtrToStructure(trkPtr, typeof(BW5_TrackDescriptor)); Marshal.FreeHGlobal(trkPtr); if(session.tracks[tSeq].type == BW5_TrackType.DVD || @@ -537,38 +536,70 @@ namespace DiscImageChef.ImagePlugins stream.Seek(-8, SeekOrigin.Current); } - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].type = {2}", ses, tSeq, session.tracks[tSeq].type); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].type = {2}", ses, tSeq, + session.tracks[tSeq].type); for(int i = 0; i < session.tracks[tSeq].unknown1.Length; i++) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown1[{2}] = 0x{3:X2}", ses, tSeq, i, session.tracks[tSeq].unknown1[i]); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown2 = 0x{2:X8}", ses, tSeq, session.tracks[tSeq].unknown2); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].subchannel = {2}", ses, tSeq, session.tracks[tSeq].subchannel); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown3 = 0x{2:X2}", ses, tSeq, session.tracks[tSeq].unknown3); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].ctl = {2}", ses, tSeq, session.tracks[tSeq].ctl); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].adr = {2}", ses, tSeq, session.tracks[tSeq].adr); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].point = {2}", ses, tSeq, session.tracks[tSeq].point); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown4 = 0x{2:X2}", ses, tSeq, session.tracks[tSeq].unknown4); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].min = {2}", ses, tSeq, session.tracks[tSeq].min); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].sec = {2}", ses, tSeq, session.tracks[tSeq].sec); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].frame = {2}", ses, tSeq, session.tracks[tSeq].frame); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].zero = {2}", ses, tSeq, session.tracks[tSeq].zero); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].pmin = {2}", ses, tSeq, session.tracks[tSeq].pmin); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].psec = {2}", ses, tSeq, session.tracks[tSeq].psec); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].pframe = {2}", ses, tSeq, session.tracks[tSeq].pframe); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown5 = 0x{2:X2}", ses, tSeq, session.tracks[tSeq].unknown5); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].pregap = {2}", ses, tSeq, session.tracks[tSeq].pregap); + DicConsole.DebugWriteLine("BlindWrite5 plugin", + "session[{0}].track[{1}].unknown1[{2}] = 0x{3:X2}", ses, tSeq, i, + session.tracks[tSeq].unknown1[i]); + + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown2 = 0x{2:X8}", ses, + tSeq, session.tracks[tSeq].unknown2); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].subchannel = {2}", ses, + tSeq, session.tracks[tSeq].subchannel); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown3 = 0x{2:X2}", ses, + tSeq, session.tracks[tSeq].unknown3); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].ctl = {2}", ses, tSeq, + session.tracks[tSeq].ctl); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].adr = {2}", ses, tSeq, + session.tracks[tSeq].adr); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].point = {2}", ses, tSeq, + session.tracks[tSeq].point); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown4 = 0x{2:X2}", ses, + tSeq, session.tracks[tSeq].unknown4); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].min = {2}", ses, tSeq, + session.tracks[tSeq].min); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].sec = {2}", ses, tSeq, + session.tracks[tSeq].sec); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].frame = {2}", ses, tSeq, + session.tracks[tSeq].frame); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].zero = {2}", ses, tSeq, + session.tracks[tSeq].zero); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].pmin = {2}", ses, tSeq, + session.tracks[tSeq].pmin); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].psec = {2}", ses, tSeq, + session.tracks[tSeq].psec); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].pframe = {2}", ses, tSeq, + session.tracks[tSeq].pframe); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown5 = 0x{2:X2}", ses, + tSeq, session.tracks[tSeq].unknown5); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].pregap = {2}", ses, tSeq, + session.tracks[tSeq].pregap); for(int i = 0; i < session.tracks[tSeq].unknown6.Length; i++) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown6[{2}] = 0x{3:X8}", ses, tSeq, i, session.tracks[tSeq].unknown6[i]); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].startLba = {2}", ses, tSeq, session.tracks[tSeq].startLba); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].sectors = {2}", ses, tSeq, session.tracks[tSeq].sectors); + DicConsole.DebugWriteLine("BlindWrite5 plugin", + "session[{0}].track[{1}].unknown6[{2}] = 0x{3:X8}", ses, tSeq, i, + session.tracks[tSeq].unknown6[i]); + + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].startLba = {2}", ses, tSeq, + session.tracks[tSeq].startLba); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].sectors = {2}", ses, tSeq, + session.tracks[tSeq].sectors); for(int i = 0; i < session.tracks[tSeq].unknown7.Length; i++) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown7[{2}] = 0x{3:X8}", ses, tSeq, i, session.tracks[tSeq].unknown7[i]); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].session = {2}", ses, tSeq, session.tracks[tSeq].session); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown8 = 0x{2:X4}", ses, tSeq, session.tracks[tSeq].unknown8); + DicConsole.DebugWriteLine("BlindWrite5 plugin", + "session[{0}].track[{1}].unknown7[{2}] = 0x{3:X8}", ses, tSeq, i, + session.tracks[tSeq].unknown7[i]); + + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].session = {2}", ses, tSeq, + session.tracks[tSeq].session); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown8 = 0x{2:X4}", ses, + tSeq, session.tracks[tSeq].unknown8); if(session.tracks[tSeq].type != BW5_TrackType.DVD && session.tracks[tSeq].type != BW5_TrackType.NotData) { for(int i = 0; i < session.tracks[tSeq].unknown9.Length; i++) - DicConsole.DebugWriteLine("BlindWrite5 plugin", "session[{0}].track[{1}].unknown9[{2}] = 0x{3:X8}", ses, tSeq, i, session.tracks[tSeq].unknown9[i]); + DicConsole.DebugWriteLine("BlindWrite5 plugin", + "session[{0}].track[{1}].unknown9[{2}] = 0x{3:X8}", ses, tSeq, i, + session.tracks[tSeq].unknown9[i]); } } @@ -588,16 +619,17 @@ namespace DiscImageChef.ImagePlugins if(BW5_Footer.SequenceEqual(footer)) DicConsole.DebugWriteLine("BlindWrite5 plugin", "Correctly arrived end of image"); else - DicConsole.ErrorWriteLine("BlindWrite5 image ends after expected position. Probably new version with different data. Errors may occur."); + DicConsole + .ErrorWriteLine("BlindWrite5 image ends after expected position. Probably new version with different data. Errors may occur."); - FiltersList filtersList; + FiltersList filtersList; filePaths = new List(); foreach(BW5_DataFile dataFile in dataFiles) { DataFileCharacteristics chars = new DataFileCharacteristics(); string path = Path.Combine(dataPath, dataFile.filename); - filtersList = new FiltersList(); + filtersList = new FiltersList(); if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)) != null) { @@ -625,7 +657,8 @@ namespace DiscImageChef.ImagePlugins path = Path.Combine(dataPath.ToLower(CultureInfo.CurrentCulture), dataFile.filename); if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)) != null) { - chars.fileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)); + chars.fileFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)); chars.filePath = path; } else @@ -633,36 +666,63 @@ namespace DiscImageChef.ImagePlugins path = Path.Combine(dataPath.ToUpper(CultureInfo.CurrentCulture), dataFile.filename); if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)) != null) { - chars.fileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)); + chars.fileFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)); chars.filePath = path; } else { path = Path.Combine(dataPath, dataFile.filename); - if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path.ToLower(CultureInfo.CurrentCulture))) != null) + if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + path.ToLower(CultureInfo.CurrentCulture))) != + null) { chars.filePath = path.ToLower(CultureInfo.CurrentCulture); - chars.fileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path.ToLower(CultureInfo.CurrentCulture))); + chars.fileFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + path.ToLower(CultureInfo + .CurrentCulture))); } - else if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path.ToUpper(CultureInfo.CurrentCulture))) != null) + else if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + path.ToUpper(CultureInfo + .CurrentCulture))) != + null) { chars.filePath = path.ToUpper(CultureInfo.CurrentCulture); - chars.fileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path.ToUpper(CultureInfo.CurrentCulture))); + chars.fileFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + path.ToUpper(CultureInfo + .CurrentCulture))); } - else if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), dataFile.filename.ToLower(CultureInfo.CurrentCulture))) != null) + else if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + dataFile.filename.ToLower(CultureInfo + .CurrentCulture))) != + null) { chars.filePath = dataFile.filename.ToLower(CultureInfo.CurrentCulture); - chars.fileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), dataFile.filename.ToLower(CultureInfo.CurrentCulture))); + chars.fileFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + dataFile.filename.ToLower(CultureInfo + .CurrentCulture))); } - else if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), dataFile.filename.ToUpper(CultureInfo.CurrentCulture))) != null) + else if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + dataFile.filename.ToUpper(CultureInfo + .CurrentCulture))) != + null) { chars.filePath = dataFile.filename.ToUpper(CultureInfo.CurrentCulture); - chars.fileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), dataFile.filename.ToUpper(CultureInfo.CurrentCulture))); + chars.fileFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + dataFile.filename.ToUpper(CultureInfo + .CurrentCulture))); } - else if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), dataFile.filename)) != null) + else if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + dataFile.filename)) != null) { chars.filePath = dataFile.filename; - chars.fileFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), dataFile.filename)); + chars.fileFilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + dataFile.filename)); } else { @@ -678,18 +738,16 @@ namespace DiscImageChef.ImagePlugins long sectorSize = dataFile.length / dataFile.sectors; if(sectorSize > 2352) { - if((sectorSize - 2352) == 16) - chars.subchannel = TrackSubchannelType.Q16Interleaved; - else if((sectorSize - 2352) == 96) - chars.subchannel = TrackSubchannelType.PackedInterleaved; + if((sectorSize - 2352) == 16) chars.subchannel = TrackSubchannelType.Q16Interleaved; + else if((sectorSize - 2352) == 96) chars.subchannel = TrackSubchannelType.PackedInterleaved; else { DicConsole.ErrorWriteLine("BlindWrite5 found unknown subchannel size: {0}", sectorSize - 2352); return false; } } - else - chars.subchannel = TrackSubchannelType.None; + else chars.subchannel = TrackSubchannelType.None; + chars.sectorSize = sectorSize; chars.startLba = dataFile.startLba; chars.sectors = dataFile.sectors; @@ -701,7 +759,7 @@ namespace DiscImageChef.ImagePlugins tracks = new List(); partitions = new List(); MemoryStream fullTocStream = new MemoryStream(); - fullTocStream.Write(new byte[] { 0, 0, 0, 0 }, 0, 4); + fullTocStream.Write(new byte[] {0, 0, 0, 0}, 0, 4); ulong offsetBytes = 0; offsetmap = new Dictionary(); bool isDvd = false; @@ -715,18 +773,14 @@ namespace DiscImageChef.ImagePlugins { Session session = new Session(); session.SessionSequence = ses.sequence; - if(ses.start < 0) - session.StartSector = 0; - else - session.StartSector = (ulong)ses.start; + if(ses.start < 0) session.StartSector = 0; + else session.StartSector = (ulong)ses.start; session.EndSector = (ulong)ses.end; session.StartTrack = ses.firstTrack; session.EndTrack = ses.lastTrack; - if(ses.sequence < firstSession) - firstSession = (byte)ses.sequence; - if(ses.sequence > lastSession) - lastSession = (byte)ses.sequence; + if(ses.sequence < firstSession) firstSession = (byte)ses.sequence; + if(ses.sequence > lastSession) lastSession = (byte)ses.sequence; foreach(BW5_TrackDescriptor trk in ses.tracks) { @@ -755,8 +809,7 @@ namespace DiscImageChef.ImagePlugins case BW5_TrackType.Audio: track.TrackBytesPerSector = 2352; track.TrackRawBytesPerSector = 2352; - if(ImageInfo.sectorSize < 2352) - ImageInfo.sectorSize = 2352; + if(ImageInfo.sectorSize < 2352) ImageInfo.sectorSize = 2352; break; case BW5_TrackType.Mode1: case BW5_TrackType.Mode2F1: @@ -776,8 +829,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); track.TrackBytesPerSector = 2048; track.TrackRawBytesPerSector = 2352; - if(ImageInfo.sectorSize < 2048) - ImageInfo.sectorSize = 2048; + if(ImageInfo.sectorSize < 2048) ImageInfo.sectorSize = 2048; break; case BW5_TrackType.Mode2: if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) @@ -786,8 +838,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); track.TrackBytesPerSector = 2336; track.TrackRawBytesPerSector = 2352; - if(ImageInfo.sectorSize < 2336) - ImageInfo.sectorSize = 2336; + if(ImageInfo.sectorSize < 2336) ImageInfo.sectorSize = 2336; break; case BW5_TrackType.Mode2F2: if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) @@ -800,14 +851,12 @@ namespace DiscImageChef.ImagePlugins ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); track.TrackBytesPerSector = 2336; track.TrackRawBytesPerSector = 2352; - if(ImageInfo.sectorSize < 2324) - ImageInfo.sectorSize = 2324; + if(ImageInfo.sectorSize < 2324) ImageInfo.sectorSize = 2324; break; case BW5_TrackType.DVD: track.TrackBytesPerSector = 2048; track.TrackRawBytesPerSector = 2048; - if(ImageInfo.sectorSize < 2048) - ImageInfo.sectorSize = 2048; + if(ImageInfo.sectorSize < 2048) ImageInfo.sectorSize = 2048; isDvd = true; break; } @@ -818,14 +867,14 @@ namespace DiscImageChef.ImagePlugins foreach(DataFileCharacteristics chars in filePaths) { - if(trk.startLba >= chars.startLba && (trk.startLba + trk.sectors) <= (chars.startLba + chars.sectors)) + if(trk.startLba >= chars.startLba && + (trk.startLba + trk.sectors) <= (chars.startLba + chars.sectors)) { track.TrackFilter = chars.fileFilter; track.TrackFile = chars.fileFilter.GetFilename(); if(trk.startLba >= 0) - track.TrackFileOffset = (ulong)((trk.startLba - chars.startLba) * chars.sectorSize); - else - track.TrackFileOffset = (ulong)((trk.startLba * -1) * chars.sectorSize); + track.TrackFileOffset = (ulong)((trk.startLba - chars.startLba) * chars.sectorSize); + else track.TrackFileOffset = (ulong)((trk.startLba * -1) * chars.sectorSize); track.TrackFileType = "BINARY"; if(chars.subchannel != TrackSubchannelType.None) { @@ -838,7 +887,6 @@ namespace DiscImageChef.ImagePlugins { if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubchannel); - } } @@ -853,7 +901,8 @@ namespace DiscImageChef.ImagePlugins track.Indexes.Add(1, track.TrackStartSector); partition.Description = track.TrackDescription; - partition.Size = (track.TrackEndSector - track.TrackStartSector) * (ulong)track.TrackRawBytesPerSector; + partition.Size = (track.TrackEndSector - track.TrackStartSector) * + (ulong)track.TrackRawBytesPerSector; partition.Length = (track.TrackEndSector - track.TrackStartSector); partition.Sequence = track.TrackSequence; partition.Offset = offsetBytes; @@ -876,7 +925,8 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("BlindWrite5 plugin", "Partition sequence: {0}", track.TrackSequence); DicConsole.DebugWriteLine("BlindWrite5 plugin", "\tPartition description: {0}", track.TrackDescription); DicConsole.DebugWriteLine("BlindWrite5 plugin", "\tPartition type: {0}", track.TrackType); - DicConsole.DebugWriteLine("BlindWrite5 plugin", "\tPartition starting sector: {0}", track.TrackStartSector); + DicConsole.DebugWriteLine("BlindWrite5 plugin", "\tPartition starting sector: {0}", + track.TrackStartSector); DicConsole.DebugWriteLine("BlindWrite5 plugin", "\tPartition ending sector: {0}", track.TrackEndSector); } @@ -913,10 +963,7 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("BlindWrite5 plugin", "TOC not correctly rebuilt"); fullToc = null; } - else - { - DicConsole.DebugWriteLine("BlindWrite5 plugin", "TOC correctly rebuilt"); - } + else { DicConsole.DebugWriteLine("BlindWrite5 plugin", "TOC correctly rebuilt"); } ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackFlags); } @@ -925,7 +972,6 @@ namespace DiscImageChef.ImagePlugins if(dmi != null && pfi != null) { - Decoders.DVD.PFI.PhysicalFormatInformation? pfi0 = Decoders.DVD.PFI.Decode(pfi); // All discs I tested the disk category and part version (as well as the start PSN for DVD-RAM) where modified by Alcohol @@ -947,10 +993,8 @@ namespace DiscImageChef.ImagePlugins ImageInfo.mediaType = MediaType.DVDPRWDL; break; case Decoders.DVD.DiskCategory.DVDR: - if(pfi0.Value.PartVersion == 6) - ImageInfo.mediaType = MediaType.DVDRDL; - else - ImageInfo.mediaType = MediaType.DVDR; + if(pfi0.Value.PartVersion == 6) ImageInfo.mediaType = MediaType.DVDRDL; + else ImageInfo.mediaType = MediaType.DVDR; break; case Decoders.DVD.DiskCategory.DVDRAM: ImageInfo.mediaType = MediaType.DVDRAM; @@ -959,10 +1003,8 @@ namespace DiscImageChef.ImagePlugins ImageInfo.mediaType = MediaType.DVDROM; break; case Decoders.DVD.DiskCategory.DVDRW: - if(pfi0.Value.PartVersion == 3) - ImageInfo.mediaType = MediaType.DVDRWDL; - else - ImageInfo.mediaType = MediaType.DVDRW; + if(pfi0.Value.PartVersion == 3) ImageInfo.mediaType = MediaType.DVDRWDL; + else ImageInfo.mediaType = MediaType.DVDRW; break; case Decoders.DVD.DiskCategory.HDDVDR: ImageInfo.mediaType = MediaType.HDDVDR; @@ -977,20 +1019,16 @@ namespace DiscImageChef.ImagePlugins ImageInfo.mediaType = MediaType.HDDVDRW; break; case Decoders.DVD.DiskCategory.Nintendo: - if(pfi0.Value.DiscSize == Decoders.DVD.DVDSize.Eighty) - ImageInfo.mediaType = MediaType.GOD; - else - ImageInfo.mediaType = MediaType.WOD; + if(pfi0.Value.DiscSize == Decoders.DVD.DVDSize.Eighty) ImageInfo.mediaType = MediaType.GOD; + else ImageInfo.mediaType = MediaType.WOD; break; case Decoders.DVD.DiskCategory.UMD: ImageInfo.mediaType = MediaType.UMD; break; } - if(Decoders.Xbox.DMI.IsXbox(dmi)) - ImageInfo.mediaType = MediaType.XGD; - else if(Decoders.Xbox.DMI.IsXbox360(dmi)) - ImageInfo.mediaType = MediaType.XGD2; + if(Decoders.Xbox.DMI.IsXbox(dmi)) ImageInfo.mediaType = MediaType.XGD; + else if(Decoders.Xbox.DMI.IsXbox360(dmi)) ImageInfo.mediaType = MediaType.XGD2; } } else if(ImageInfo.mediaType == MediaType.CD || ImageInfo.mediaType == MediaType.CDROM) @@ -1025,26 +1063,21 @@ namespace DiscImageChef.ImagePlugins } } - if(!data && !firstdata) - ImageInfo.mediaType = MediaType.CDDA; - else if(firstaudio && data && sessions.Count > 1 && mode2) - ImageInfo.mediaType = MediaType.CDPLUS; - else if((firstdata && audio) || mode2) - ImageInfo.mediaType = MediaType.CDROMXA; - else if(!audio) - ImageInfo.mediaType = MediaType.CDROM; - else - ImageInfo.mediaType = MediaType.CD; + if(!data && !firstdata) ImageInfo.mediaType = MediaType.CDDA; + else if(firstaudio && data && sessions.Count > 1 && mode2) ImageInfo.mediaType = MediaType.CDPLUS; + else if((firstdata && audio) || mode2) ImageInfo.mediaType = MediaType.CDROMXA; + else if(!audio) ImageInfo.mediaType = MediaType.CDROM; + else ImageInfo.mediaType = MediaType.CD; } ImageInfo.driveManufacturer = StringHandlers.CToString(header.manufacturer); ImageInfo.driveModel = StringHandlers.CToString(header.product); ImageInfo.driveFirmwareRevision = StringHandlers.CToString(header.revision); ImageInfo.imageApplication = "BlindWrite"; - if(string.Compare(Path.GetExtension(imageFilter.GetFilename()), "B5T", StringComparison.OrdinalIgnoreCase) == 0) - ImageInfo.imageApplicationVersion = "5"; - else if(string.Compare(Path.GetExtension(imageFilter.GetFilename()), "B6T", StringComparison.OrdinalIgnoreCase) == 0) - ImageInfo.imageApplicationVersion = "6"; + if(string.Compare(Path.GetExtension(imageFilter.GetFilename()), "B5T", + StringComparison.OrdinalIgnoreCase) == 0) ImageInfo.imageApplicationVersion = "5"; + else if(string.Compare(Path.GetExtension(imageFilter.GetFilename()), "B6T", + StringComparison.OrdinalIgnoreCase) == 0) ImageInfo.imageApplicationVersion = "6"; ImageInfo.imageVersion = "5"; ImageInfo.imageSize = (ulong)imageFilter.GetDataForkLength(); @@ -1070,10 +1103,8 @@ namespace DiscImageChef.ImagePlugins { Decoders.CD.ATIP.CDATIP atip0 = Decoders.CD.ATIP.Decode(atip).Value; - if(atip0.DiscType) - ImageInfo.mediaType = MediaType.CDRW; - else - ImageInfo.mediaType = MediaType.CDR; + if(atip0.DiscType) ImageInfo.mediaType = MediaType.CDRW; + else ImageInfo.mediaType = MediaType.CDR; if(atip0.LeadInStartMin == 97) { @@ -1084,8 +1115,7 @@ namespace DiscImageChef.ImagePlugins } bool isBD = false; - if(ImageInfo.mediaType == MediaType.BDR || - ImageInfo.mediaType == MediaType.BDRE || + if(ImageInfo.mediaType == MediaType.BDR || ImageInfo.mediaType == MediaType.BDRE || ImageInfo.mediaType == MediaType.BDROM) { isDvd = false; @@ -1094,44 +1124,33 @@ namespace DiscImageChef.ImagePlugins if(isBD && ImageInfo.sectors > 24438784) { - if(ImageInfo.mediaType == MediaType.BDR) - ImageInfo.mediaType = MediaType.BDRXL; - if(ImageInfo.mediaType == MediaType.BDRE) - ImageInfo.mediaType = MediaType.BDREXL; + if(ImageInfo.mediaType == MediaType.BDR) ImageInfo.mediaType = MediaType.BDRXL; + if(ImageInfo.mediaType == MediaType.BDRE) ImageInfo.mediaType = MediaType.BDREXL; } DicConsole.DebugWriteLine("BlindWrite5 plugin", "ImageInfo.mediaType = {0}", ImageInfo.mediaType); - if(mode2A != null) - ImageInfo.readableMediaTags.Add(MediaTagType.SCSI_MODEPAGE_2A); - if(pma != null) - ImageInfo.readableMediaTags.Add(MediaTagType.CD_PMA); - if(atip != null) - ImageInfo.readableMediaTags.Add(MediaTagType.CD_ATIP); - if(cdtext != null) - ImageInfo.readableMediaTags.Add(MediaTagType.CD_TEXT); + if(mode2A != null) ImageInfo.readableMediaTags.Add(MediaTagType.SCSI_MODEPAGE_2A); + if(pma != null) ImageInfo.readableMediaTags.Add(MediaTagType.CD_PMA); + if(atip != null) ImageInfo.readableMediaTags.Add(MediaTagType.CD_ATIP); + if(cdtext != null) ImageInfo.readableMediaTags.Add(MediaTagType.CD_TEXT); if(bca != null) { - if(isDvd) - ImageInfo.readableMediaTags.Add(MediaTagType.DVD_BCA); - else if(isBD) - ImageInfo.readableMediaTags.Add(MediaTagType.BD_BCA); + if(isDvd) ImageInfo.readableMediaTags.Add(MediaTagType.DVD_BCA); + else if(isBD) ImageInfo.readableMediaTags.Add(MediaTagType.BD_BCA); } - if(dmi != null) - ImageInfo.readableMediaTags.Add(MediaTagType.DVD_DMI); - if(pfi != null) - ImageInfo.readableMediaTags.Add(MediaTagType.DVD_PFI); - if(fullToc != null) - ImageInfo.readableMediaTags.Add(MediaTagType.CD_FullTOC); + if(dmi != null) ImageInfo.readableMediaTags.Add(MediaTagType.DVD_DMI); + if(pfi != null) ImageInfo.readableMediaTags.Add(MediaTagType.DVD_PFI); + if(fullToc != null) ImageInfo.readableMediaTags.Add(MediaTagType.CD_FullTOC); - if(ImageInfo.mediaType == MediaType.XGD2) - { - // All XGD3 all have the same number of blocks - if(ImageInfo.sectors == 25063 || // Locked (or non compatible drive) - ImageInfo.sectors == 4229664 || // Xtreme unlock - ImageInfo.sectors == 4246304) // Wxripper unlock - ImageInfo.mediaType = MediaType.XGD3; - } + if(ImageInfo.mediaType == MediaType.XGD2) + { + // All XGD3 all have the same number of blocks + if(ImageInfo.sectors == 25063 || // Locked (or non compatible drive) + ImageInfo.sectors == 4229664 || // Xtreme unlock + ImageInfo.sectors == 4246304) // Wxripper unlock + ImageInfo.mediaType = MediaType.XGD3; + } DicConsole.VerboseWriteLine("BlindWrite image describes a disc of type {0}", ImageInfo.mediaType); @@ -1163,70 +1182,54 @@ namespace DiscImageChef.ImagePlugins switch(tag) { case MediaTagType.SCSI_MODEPAGE_2A: - { - if(mode2A != null) - { - return (byte[])mode2A.Clone(); - } - throw new FeatureNotPresentImageException("Image does not contain SCSI MODE PAGE 2Ah."); - } + { + if(mode2A != null) { return (byte[])mode2A.Clone(); } + + throw new FeatureNotPresentImageException("Image does not contain SCSI MODE PAGE 2Ah."); + } case MediaTagType.CD_PMA: - { - if(pma != null) - { - return (byte[])pma.Clone(); - } - throw new FeatureNotPresentImageException("Image does not contain PMA information."); - } + { + if(pma != null) { return (byte[])pma.Clone(); } + + throw new FeatureNotPresentImageException("Image does not contain PMA information."); + } case MediaTagType.CD_ATIP: - { - if(atip != null) - { - return (byte[])atip.Clone(); - } - throw new FeatureNotPresentImageException("Image does not contain ATIP information."); - } + { + if(atip != null) { return (byte[])atip.Clone(); } + + throw new FeatureNotPresentImageException("Image does not contain ATIP information."); + } case MediaTagType.CD_TEXT: - { - if(cdtext != null) - { - return (byte[])cdtext.Clone(); - } - throw new FeatureNotPresentImageException("Image does not contain CD-Text information."); - } + { + if(cdtext != null) { return (byte[])cdtext.Clone(); } + + throw new FeatureNotPresentImageException("Image does not contain CD-Text information."); + } case MediaTagType.DVD_BCA: case MediaTagType.BD_BCA: - { - if(bca != null) - { - return (byte[])bca.Clone(); - } - throw new FeatureNotPresentImageException("Image does not contain BCA information."); - } + { + if(bca != null) { return (byte[])bca.Clone(); } + + throw new FeatureNotPresentImageException("Image does not contain BCA information."); + } case MediaTagType.DVD_PFI: - { - if(pfi != null) - { - return (byte[])pfi.Clone(); - } - throw new FeatureNotPresentImageException("Image does not contain PFI."); - } + { + if(pfi != null) { return (byte[])pfi.Clone(); } + + throw new FeatureNotPresentImageException("Image does not contain PFI."); + } case MediaTagType.DVD_DMI: - { - if(dmi != null) - { - return (byte[])dmi.Clone(); - } - throw new FeatureNotPresentImageException("Image does not contain DMI."); - } + { + if(dmi != null) { return (byte[])dmi.Clone(); } + + throw new FeatureNotPresentImageException("Image does not contain DMI."); + } case MediaTagType.CD_FullTOC: - { - if(fullToc != null) - { - return (byte[])fullToc.Clone(); - } - throw new FeatureNotPresentImageException("Image does not contain TOC information."); - } + { + if(fullToc != null) { return (byte[])fullToc.Clone(); } + + throw new FeatureNotPresentImageException("Image does not contain TOC information."); + } default: throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format"); } @@ -1313,7 +1316,10 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length + sectorAddress > (_track.TrackEndSector)) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length + sectorAddress, _track.TrackEndSector)); + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length + sectorAddress, _track.TrackEndSector)); foreach(DataFileCharacteristics _chars in filePaths) { @@ -1334,49 +1340,48 @@ namespace DiscImageChef.ImagePlugins switch(_track.TrackType) { case TrackType.CDMode1: - { - sector_offset = 16; - sector_size = 2048; - sector_skip = 288; - break; - } + { + sector_offset = 16; + sector_size = 2048; + sector_skip = 288; + break; + } case TrackType.CDMode2Formless: - { - sector_offset = 16; - sector_size = 2336; - sector_skip = 0; - break; - } + { + sector_offset = 16; + sector_size = 2336; + sector_skip = 0; + break; + } case TrackType.CDMode2Form1: - { - sector_offset = 24; - sector_size = 2048; - sector_skip = 280; - break; - } + { + sector_offset = 24; + sector_size = 2048; + sector_skip = 280; + break; + } case TrackType.CDMode2Form2: - { - sector_offset = 24; - sector_size = 2324; - sector_skip = 4; - break; - } + { + sector_offset = 24; + sector_size = 2324; + sector_skip = 4; + break; + } case TrackType.Audio: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } case TrackType.Data: - { - sector_offset = 0; - sector_size = 2048; - sector_skip = 0; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + { + sector_offset = 0; + sector_size = 2048; + sector_skip = 0; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } switch(chars.subchannel) @@ -1390,18 +1395,18 @@ namespace DiscImageChef.ImagePlugins case TrackSubchannelType.PackedInterleaved: sector_skip += 96; break; - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); } byte[] buffer = new byte[sector_size * length]; imageStream = chars.fileFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.TrackFileOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); + br.BaseStream + .Seek((long)_track.TrackFileOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -1438,7 +1443,10 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length + sectorAddress > (_track.TrackEndSector)) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length + sectorAddress, _track.TrackEndSector)); + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length + sectorAddress, _track.TrackEndSector)); foreach(DataFileCharacteristics _chars in filePaths) { @@ -1464,15 +1472,13 @@ namespace DiscImageChef.ImagePlugins case SectorTagType.CDSectorHeader: case SectorTagType.CDSectorSubchannel: case SectorTagType.CDSectorSubHeader: - case SectorTagType.CDSectorSync: - break; + case SectorTagType.CDSectorSync: break; case SectorTagType.CDTrackFlags: byte flag; - if(trackFlags.TryGetValue(track, out flag)) - return new byte[] { flag }; - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - default: + if(trackFlags.TryGetValue(track, out flag)) return new byte[] {flag}; + throw new ArgumentException("Unsupported tag requested", nameof(tag)); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } uint sector_offset; @@ -1485,193 +1491,191 @@ namespace DiscImageChef.ImagePlugins switch(tag) { case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } + { + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; + } case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } case SectorTagType.CDSectorSubHeader: throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - sector_skip = 0; - break; - } + { + sector_offset = 2076; + sector_size = 276; + sector_skip = 0; + break; + } case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - sector_skip = 104; - break; - } + { + sector_offset = 2076; + sector_size = 172; + sector_skip = 104; + break; + } case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - sector_skip = 0; - break; - } + { + sector_offset = 2248; + sector_size = 104; + sector_skip = 0; + break; + } case SectorTagType.CDSectorEDC: - { - sector_offset = 2064; - sector_size = 4; - sector_skip = 284; - break; - } + { + sector_offset = 2064; + sector_size = 4; + sector_skip = 284; + break; + } case SectorTagType.CDSectorSubchannel: throw new NotImplementedException("Packed subchannel not yet supported"); - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } + break; case TrackType.CDMode2Formless: + { + switch(tag) { - switch(tag) + case SectorTagType.CDSectorSync: + case SectorTagType.CDSectorHeader: + case SectorTagType.CDSectorECC: + case SectorTagType.CDSectorECC_P: + case SectorTagType.CDSectorECC_Q: + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + case SectorTagType.CDSectorSubHeader: { - case SectorTagType.CDSectorSync: - case SectorTagType.CDSectorHeader: - case SectorTagType.CDSectorECC: - case SectorTagType.CDSectorECC_P: - case SectorTagType.CDSectorECC_Q: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorSubHeader: - { - sector_offset = 0; - sector_size = 8; - sector_skip = 2328; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2332; - sector_size = 4; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorSubchannel: - throw new NotImplementedException("Packed subchannel not yet supported"); - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + sector_offset = 0; + sector_size = 8; + sector_skip = 2328; + break; } - break; + case SectorTagType.CDSectorEDC: + { + sector_offset = 2332; + sector_size = 4; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorSubchannel: + throw new NotImplementedException("Packed subchannel not yet supported"); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } + + break; + } case TrackType.CDMode2Form1: switch(tag) { case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } + { + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; + } case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } case SectorTagType.CDSectorSubHeader: - { - sector_offset = 16; - sector_size = 8; - sector_skip = 2328; - break; - } + { + sector_offset = 16; + sector_size = 8; + sector_skip = 2328; + break; + } case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - sector_skip = 0; - break; - } + { + sector_offset = 2076; + sector_size = 276; + sector_skip = 0; + break; + } case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - sector_skip = 104; - break; - } + { + sector_offset = 2076; + sector_size = 172; + sector_skip = 104; + break; + } case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - sector_skip = 0; - break; - } + { + sector_offset = 2248; + sector_size = 104; + sector_skip = 0; + break; + } case SectorTagType.CDSectorEDC: - { - sector_offset = 2072; - sector_size = 4; - sector_skip = 276; - break; - } + { + sector_offset = 2072; + sector_size = 4; + sector_skip = 276; + break; + } case SectorTagType.CDSectorSubchannel: throw new NotImplementedException("Packed subchannel not yet supported"); - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } + break; case TrackType.CDMode2Form2: switch(tag) { case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } + { + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; + } case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } case SectorTagType.CDSectorSubHeader: - { - sector_offset = 16; - sector_size = 8; - sector_skip = 2328; - break; - } + { + sector_offset = 16; + sector_size = 8; + sector_skip = 2328; + break; + } case SectorTagType.CDSectorEDC: - { - sector_offset = 2348; - sector_size = 4; - sector_skip = 0; - break; - } + { + sector_offset = 2348; + sector_size = 4; + sector_skip = 0; + break; + } case SectorTagType.CDSectorSubchannel: throw new NotImplementedException("Packed subchannel not yet supported"); - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } + break; case TrackType.Audio: + { + switch(tag) { - switch(tag) - { - case SectorTagType.CDSectorSubchannel: - throw new NotImplementedException("Packed subchannel not yet supported"); - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } + case SectorTagType.CDSectorSubchannel: + throw new NotImplementedException("Packed subchannel not yet supported"); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } switch(chars.subchannel) @@ -1685,17 +1689,17 @@ namespace DiscImageChef.ImagePlugins case TrackSubchannelType.PackedInterleaved: sector_skip += 96; break; - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); } byte[] buffer = new byte[sector_size * length]; imageStream = _track.TrackFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.TrackFileOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + br.BaseStream + .Seek((long)_track.TrackFileOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -1762,7 +1766,10 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length + sectorAddress > (_track.TrackEndSector)) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length + sectorAddress, _track.TrackEndSector)); + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length + sectorAddress, _track.TrackEndSector)); foreach(DataFileCharacteristics _chars in filePaths) { @@ -1787,21 +1794,20 @@ namespace DiscImageChef.ImagePlugins case TrackType.CDMode2Form1: case TrackType.CDMode2Form2: case TrackType.Audio: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } case TrackType.Data: - { - sector_offset = 0; - sector_size = 2048; - sector_skip = 0; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + { + sector_offset = 0; + sector_size = 2048; + sector_skip = 0; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } switch(chars.subchannel) @@ -1815,17 +1821,17 @@ namespace DiscImageChef.ImagePlugins case TrackSubchannelType.PackedInterleaved: sector_skip += 96; break; - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); } byte[] buffer = new byte[sector_size * length]; imageStream = _track.TrackFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.TrackFileOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + br.BaseStream + .Seek((long)_track.TrackFileOffset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -1873,24 +1879,19 @@ namespace DiscImageChef.ImagePlugins public override List GetSessionTracks(Session session) { - if(sessions.Contains(session)) - { - return GetSessionTracks(session.SessionSequence); - } + if(sessions.Contains(session)) { return GetSessionTracks(session.SessionSequence); } + throw new ImageNotSupportedException("Session does not exist in disc image"); } public override List GetSessionTracks(ushort session) { List _tracks = new List(); - foreach(Track _track in tracks) - { - if(_track.TrackSession == session) - _tracks.Add(_track); - } + foreach(Track _track in tracks) { if(_track.TrackSession == session) _tracks.Add(_track); } return _tracks; } + public override List GetSessions() { return sessions; @@ -1908,7 +1909,8 @@ namespace DiscImageChef.ImagePlugins return Checksums.CDChecksums.CheckCDSector(buffer); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, out List UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs, + out List UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); @@ -1932,14 +1934,14 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, out List UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs, + out List UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length, track); int bps = (int)(buffer.Length / length); @@ -1963,10 +1965,9 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } @@ -1981,18 +1982,12 @@ namespace DiscImageChef.ImagePlugins { switch(trackType) { - case BW5_TrackType.Mode1: - return TrackType.CDMode1; - case BW5_TrackType.Mode2F1: - return TrackType.CDMode2Form1; - case BW5_TrackType.Mode2F2: - return TrackType.CDMode2Form2; - case BW5_TrackType.Mode2: - return TrackType.CDMode2Formless; - case BW5_TrackType.Audio: - return TrackType.Audio; - default: - return TrackType.Data; + case BW5_TrackType.Mode1: return TrackType.CDMode1; + case BW5_TrackType.Mode2F1: return TrackType.CDMode2Form1; + case BW5_TrackType.Mode2F2: return TrackType.CDMode2Form2; + case BW5_TrackType.Mode2: return TrackType.CDMode2Formless; + case BW5_TrackType.Audio: return TrackType.Audio; + default: return TrackType.Data; } } @@ -2000,71 +1995,42 @@ namespace DiscImageChef.ImagePlugins { switch(profile) { - case ProfileNumber.BDRE: - return MediaType.BDRE; - case ProfileNumber.BDROM: - return MediaType.BDROM; + case ProfileNumber.BDRE: return MediaType.BDRE; + case ProfileNumber.BDROM: return MediaType.BDROM; case ProfileNumber.BDRRdm: - case ProfileNumber.BDRSeq: - return MediaType.BDR; + case ProfileNumber.BDRSeq: return MediaType.BDR; case ProfileNumber.CDR: - case ProfileNumber.HDBURNR: - return MediaType.CDR; + case ProfileNumber.HDBURNR: return MediaType.CDR; case ProfileNumber.CDROM: - case ProfileNumber.HDBURNROM: - return MediaType.CDROM; + case ProfileNumber.HDBURNROM: return MediaType.CDROM; case ProfileNumber.CDRW: - case ProfileNumber.HDBURNRW: - return MediaType.CDRW; - case ProfileNumber.DDCDR: - return MediaType.DDCDR; - case ProfileNumber.DDCDROM: - return MediaType.DDCD; - case ProfileNumber.DDCDRW: - return MediaType.DDCDRW; - case ProfileNumber.DVDDownload: - return MediaType.DVDDownload; - case ProfileNumber.DVDRAM: - return MediaType.DVDRAM; + case ProfileNumber.HDBURNRW: return MediaType.CDRW; + case ProfileNumber.DDCDR: return MediaType.DDCDR; + case ProfileNumber.DDCDROM: return MediaType.DDCD; + case ProfileNumber.DDCDRW: return MediaType.DDCDRW; + case ProfileNumber.DVDDownload: return MediaType.DVDDownload; + case ProfileNumber.DVDRAM: return MediaType.DVDRAM; case ProfileNumber.DVDRDLJump: - case ProfileNumber.DVDRDLSeq: - return MediaType.DVDRDL; - case ProfileNumber.DVDRDLPlus: - return MediaType.DVDPRDL; - case ProfileNumber.DVDROM: - return MediaType.DVDROM; - case ProfileNumber.DVDRPlus: - return MediaType.DVDPR; - case ProfileNumber.DVDRSeq: - return MediaType.DVDR; - case ProfileNumber.DVDRWDL: - return MediaType.DVDRWDL; - case ProfileNumber.DVDRWDLPlus: - return MediaType.DVDPRWDL; - case ProfileNumber.DVDRWPlus: - return MediaType.DVDPRW; + case ProfileNumber.DVDRDLSeq: return MediaType.DVDRDL; + case ProfileNumber.DVDRDLPlus: return MediaType.DVDPRDL; + case ProfileNumber.DVDROM: return MediaType.DVDROM; + case ProfileNumber.DVDRPlus: return MediaType.DVDPR; + case ProfileNumber.DVDRSeq: return MediaType.DVDR; + case ProfileNumber.DVDRWDL: return MediaType.DVDRWDL; + case ProfileNumber.DVDRWDLPlus: return MediaType.DVDPRWDL; + case ProfileNumber.DVDRWPlus: return MediaType.DVDPRW; case ProfileNumber.DVDRWRes: - case ProfileNumber.DVDRWSeq: - return MediaType.DVDRW; - case ProfileNumber.HDDVDR: - return MediaType.HDDVDR; - case ProfileNumber.HDDVDRAM: - return MediaType.HDDVDRAM; - case ProfileNumber.HDDVDRDL: - return MediaType.HDDVDRDL; - case ProfileNumber.HDDVDROM: - return MediaType.HDDVDROM; - case ProfileNumber.HDDVDRW: - return MediaType.HDDVDRW; - case ProfileNumber.HDDVDRWDL: - return MediaType.HDDVDRWDL; + case ProfileNumber.DVDRWSeq: return MediaType.DVDRW; + case ProfileNumber.HDDVDR: return MediaType.HDDVDR; + case ProfileNumber.HDDVDRAM: return MediaType.HDDVDRAM; + case ProfileNumber.HDDVDRDL: return MediaType.HDDVDRDL; + case ProfileNumber.HDDVDROM: return MediaType.HDDVDROM; + case ProfileNumber.HDDVDRW: return MediaType.HDDVDRW; + case ProfileNumber.HDDVDRWDL: return MediaType.HDDVDRWDL; case ProfileNumber.ASMO: - case ProfileNumber.MOErasable: - return MediaType.UnknownMO; - case ProfileNumber.NonRemovable: - return MediaType.GENERIC_HDD; - default: - return MediaType.CD; + case ProfileNumber.MOErasable: return MediaType.UnknownMO; + case ProfileNumber.NonRemovable: return MediaType.GENERIC_HDD; + default: return MediaType.CD; } } #endregion Private methods @@ -2151,5 +2117,4 @@ namespace DiscImageChef.ImagePlugins } #endregion Unsupported features } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/CDRDAO.cs b/DiscImageChef.DiscImages/CDRDAO.cs index 2862a8e8..ea3d732c 100644 --- a/DiscImageChef.DiscImages/CDRDAO.cs +++ b/DiscImageChef.DiscImages/CDRDAO.cs @@ -41,12 +41,11 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - // TODO: Doesn't support compositing from several files - // TODO: Doesn't support silences that are not in files - public class CDRDAO : ImagePlugin + // TODO: Doesn't support compositing from several files + // TODO: Doesn't support silences that are not in files + public class CDRDAO : ImagePlugin { #region Internal structures - struct CDRDAOTrackFile { /// Track # @@ -138,11 +137,9 @@ namespace DiscImageChef.ImagePlugins /// Disk comment public string comment; } - #endregion Internal structures #region Internal consts - /// Audio track, 2352 bytes/sector const string CDRDAOTrackTypeAudio = "AUDIO"; /// Mode 1 track, cooked, 2048 bytes/sector @@ -159,11 +156,9 @@ namespace DiscImageChef.ImagePlugins const string CDRDAOTrackTypeMode2Mix = "MODE2_FORM_MIX"; /// Mode 2 track, raw, 2352 bytes/sector const string CDRDAOTrackTypeMode2Raw = "MODE2_RAW"; - #endregion Internal consts #region Internal variables - Filter imageFilter; StreamReader tocStream; Stream imageStream; @@ -171,15 +166,15 @@ namespace DiscImageChef.ImagePlugins Dictionary offsetmap; List partitions; CDRDAODisc discimage; - #endregion #region Parsing regexs - const string CommentRegEx = "^\\s*\\/{2}(?.+)$"; const string DiskTypeRegEx = "^\\s*(?(CD_DA|CD_ROM_XA|CD_ROM|CD_I))"; const string MCNRegEx = "^\\s*CATALOG\\s*\"(?[\\d]{13,13})\""; - const string TrackRegEx = "^\\s*TRACK\\s*(?(AUDIO|MODE1_RAW|MODE1|MODE2_FORM1|MODE2_FORM2|MODE2_FORM_MIX|MODE2_RAW|MODE2))\\s*(?(RW_RAW|RW))?"; + const string TrackRegEx = + "^\\s*TRACK\\s*(?(AUDIO|MODE1_RAW|MODE1|MODE2_FORM1|MODE2_FORM2|MODE2_FORM_MIX|MODE2_RAW|MODE2))\\s*(?(RW_RAW|RW))?" + ; const string CopyRegEx = "^\\s*(?NO)?\\s*COPY"; const string EmphasisRegEx = "^\\s*(?NO)?\\s*PRE_EMPHASIS"; const string StereoRegEx = "^\\s*(?(TWO|FOUR))_CHANNEL_AUDIO"; @@ -189,8 +184,11 @@ namespace DiscImageChef.ImagePlugins const string ZeroPregapRegEx = "^\\s*PREGAP\\s*(?\\d+:\\d+:\\d+)"; const string ZeroDataRegEx = "^\\s*ZERO\\s*(?\\d+:\\d+:\\d+)"; const string ZeroAudioRegEx = "^\\s*SILENCE\\s*(?\\d+:\\d+:\\d+)"; - const string AudioFileRegEx = "^\\s*(AUDIO)?FILE\\s*\"(?.+)\"\\s*(#(?\\d+))?\\s*((?[\\d]+:[\\d]+:[\\d]+)|(?\\d+))\\s*(?[\\d]+:[\\d]+:[\\d]+)?"; - const string FileRegEx = "^\\s*DATAFILE\\s*\"(?.+)\"\\s*(#(?\\d+))?\\s*(?[\\d]+:[\\d]+:[\\d]+)?"; + const string AudioFileRegEx = + "^\\s*(AUDIO)?FILE\\s*\"(?.+)\"\\s*(#(?\\d+))?\\s*((?[\\d]+:[\\d]+:[\\d]+)|(?\\d+))\\s*(?[\\d]+:[\\d]+:[\\d]+)?" + ; + const string FileRegEx = + "^\\s*DATAFILE\\s*\"(?.+)\"\\s*(#(?\\d+))?\\s*(?[\\d]+:[\\d]+:[\\d]+)?"; // CD-Text const string TitleRegEx = "^\\s*TITLE\\s*\"(?.+)\""; @@ -208,11 +206,9 @@ namespace DiscImageChef.ImagePlugins const string ClosureRegEx = "^\\s*\\}"; const string LanguageMapRegEx = "^\\s*LANGUAGE_MAP\\s*\\{"; const string LanguageMappingRegEx = "^\\s*(?<code>\\d+)\\s?\\:\\s?(?<language>\\d+|\\w+)"; - #endregion #region Public methods - public CDRDAO() { Name = "CDRDAO tocfile"; @@ -236,7 +232,6 @@ namespace DiscImageChef.ImagePlugins ImageInfo.driveSerialNumber = null; ImageInfo.driveFirmwareRevision = null; } - #endregion Public methods public override bool IdentifyImage(Filter imageFilter) @@ -244,56 +239,54 @@ namespace DiscImageChef.ImagePlugins try { imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); - byte[] testArray = new byte[512]; - imageFilter.GetDataForkStream().Read(testArray, 0, 512); - imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); - // Check for unexpected control characters that shouldn't be present in a text file and can crash this plugin - bool twoConsecutiveNulls = false; - for(int i = 0; i < 512; i++) - { - if(i >= imageFilter.GetDataForkStream().Length) - break; + byte[] testArray = new byte[512]; + imageFilter.GetDataForkStream().Read(testArray, 0, 512); + imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); + // Check for unexpected control characters that shouldn't be present in a text file and can crash this plugin + bool twoConsecutiveNulls = false; + for(int i = 0; i < 512; i++) + { + if(i >= imageFilter.GetDataForkStream().Length) break; - if(testArray[i] == 0) - { - if(twoConsecutiveNulls) - return false; - twoConsecutiveNulls = true; - } - else - twoConsecutiveNulls = false; + if(testArray[i] == 0) + { + if(twoConsecutiveNulls) return false; - if(testArray[i] < 0x20 && testArray[i] != 0x0A && testArray[i] != 0x0D && testArray[i] != 0x00) - return false; - } + twoConsecutiveNulls = true; + } + else twoConsecutiveNulls = false; - tocStream = new StreamReader(imageFilter.GetDataForkStream()); - string _line; + if(testArray[i] < 0x20 && testArray[i] != 0x0A && testArray[i] != 0x0D && testArray[i] != 0x00) + return false; + } - Regex Cr = new Regex(CommentRegEx); - Regex Dr = new Regex(DiskTypeRegEx); - Match Dm; - Match Cm; + tocStream = new StreamReader(imageFilter.GetDataForkStream()); + string _line; - while(tocStream.Peek() >= 0) - { - _line = tocStream.ReadLine(); + Regex Cr = new Regex(CommentRegEx); + Regex Dr = new Regex(DiskTypeRegEx); + Match Dm; + Match Cm; - Dm = Dr.Match(_line); - Cm = Cr.Match(_line); + while(tocStream.Peek() >= 0) + { + _line = tocStream.ReadLine(); - // Skip comments at start of file - if(Cm.Success) - continue; + Dm = Dr.Match(_line); + Cm = Cr.Match(_line); - return Dm.Success; - } + // Skip comments at start of file + if(Cm.Success) continue; - return false; + return Dm.Success; + } + + return false; } catch(Exception ex) { - DicConsole.ErrorWriteLine("Exception trying to identify image file {0}", this.imageFilter.GetFilename()); + DicConsole.ErrorWriteLine("Exception trying to identify image file {0}", + this.imageFilter.GetFilename()); DicConsole.ErrorWriteLine("Exception: {0}", ex.Message); DicConsole.ErrorWriteLine("Stack trace: {0}", ex.StackTrace); return false; @@ -302,10 +295,8 @@ namespace DiscImageChef.ImagePlugins public override bool OpenImage(Filter imageFilter) { - if(imageFilter == null) - return false; - if(imageFilter == null) - return false; + if(imageFilter == null) return false; + if(imageFilter == null) return false; this.imageFilter = imageFilter; @@ -390,35 +381,35 @@ namespace DiscImageChef.ImagePlugins StringBuilder commentBuilder = new StringBuilder(); tocStream = new StreamReader(this.imageFilter.GetDataForkStream()); - string _line; + string _line; - while(tocStream.Peek() >= 0) - { - line++; - _line = tocStream.ReadLine(); + while(tocStream.Peek() >= 0) + { + line++; + _line = tocStream.ReadLine(); - MatchDiskType = RegexDiskType.Match(_line); - MatchComment = RegexComment.Match(_line); + MatchDiskType = RegexDiskType.Match(_line); + MatchComment = RegexComment.Match(_line); - // Skip comments at start of file - if(MatchComment.Success) - continue; + // Skip comments at start of file + if(MatchComment.Success) continue; - if(!MatchDiskType.Success) - { - DicConsole.DebugWriteLine("CDRDAO plugin", "Not a CDRDAO TOC or TOC type not in line {0}.", line); - return false; - } + if(!MatchDiskType.Success) + { + DicConsole.DebugWriteLine("CDRDAO plugin", "Not a CDRDAO TOC or TOC type not in line {0}.", + line); + return false; + } - break; - } + break; + } tocStream = new StreamReader(this.imageFilter.GetDataForkStream()); FiltersList filtersList = new FiltersList(); - line = 0; + line = 0; - tocStream.BaseStream.Position = 0; - while(tocStream.Peek() >= 0) + tocStream.BaseStream.Position = 0; + while(tocStream.Peek() >= 0) { line++; _line = tocStream.ReadLine(); @@ -457,13 +448,15 @@ namespace DiscImageChef.ImagePlugins // Ignore "// Track X" comments if(!MatchComment.Groups["comment"].Value.StartsWith(" Track ", StringComparison.Ordinal)) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found comment \"{1}\" at line {0}", line, MatchComment.Groups["comment"].Value.Trim()); + DicConsole.DebugWriteLine("CDRDAO plugin", "Found comment \"{1}\" at line {0}", line, + MatchComment.Groups["comment"].Value.Trim()); commentBuilder.AppendLine(MatchComment.Groups["comment"].Value.Trim()); } } else if(MatchDiskType.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found {1} at line {0}", line, MatchDiskType.Groups["type"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", "Found {1} at line {0}", line, + MatchDiskType.Groups["type"].Value); discimage.disktypestr = MatchDiskType.Groups["type"].Value; switch(MatchDiskType.Groups["type"].Value) { @@ -486,15 +479,21 @@ namespace DiscImageChef.ImagePlugins } else if(MatchMCN.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found CATALOG \"{1}\" at line {0}", line, MatchMCN.Groups["catalog"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", "Found CATALOG \"{1}\" at line {0}", line, + MatchMCN.Groups["catalog"].Value); discimage.mcn = MatchMCN.Groups["catalog"].Value; } else if(MatchTrack.Success) { if(MatchTrack.Groups["subchan"].Value == "") - DicConsole.DebugWriteLine("CDRDAO plugin", "Found TRACK type \"{1}\" with no subchannel at line {0}", line, MatchTrack.Groups["type"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", + "Found TRACK type \"{1}\" with no subchannel at line {0}", line, + MatchTrack.Groups["type"].Value); else - DicConsole.DebugWriteLine("CDRDAO plugin", "Found TRACK type \"{1}\" subchannel {2} at line {0}", line, MatchTrack.Groups["type"].Value, MatchTrack.Groups["subchan"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", + "Found TRACK type \"{1}\" subchannel {2} at line {0}", line, + MatchTrack.Groups["type"].Value, + MatchTrack.Groups["subchan"].Value); if(intrack) { @@ -529,13 +528,13 @@ namespace DiscImageChef.ImagePlugins currenttrack.bps = 2336; break; default: - throw new NotSupportedException(string.Format("Track mode {0} is unsupported", MatchTrack.Groups["type"].Value)); + throw new NotSupportedException(string.Format("Track mode {0} is unsupported", + MatchTrack.Groups["type"].Value)); } switch(MatchTrack.Groups["subchan"].Value) { - case "": - break; + case "": break; case "RW": currenttrack.packedsubchannel = true; goto case "RW_RAW"; @@ -544,7 +543,9 @@ namespace DiscImageChef.ImagePlugins currenttrack.subchannel = true; break; default: - throw new NotSupportedException(string.Format("Track subchannel mode {0} is unsupported", MatchTrack.Groups["subchan"].Value)); + throw new + NotSupportedException(string.Format("Track subchannel mode {0} is unsupported", + MatchTrack.Groups["subchan"].Value)); } currenttrack.tracktype = MatchTrack.Groups["type"].Value; @@ -554,72 +555,88 @@ namespace DiscImageChef.ImagePlugins } else if(MatchCopy.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found {1} COPY at line {0}", line, MatchCopy.Groups["no"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", "Found {1} COPY at line {0}", line, + MatchCopy.Groups["no"].Value); currenttrack.flag_dcp |= intrack && MatchCopy.Groups["no"].Value == ""; } else if(MatchEmphasis.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found {1} PRE_EMPHASIS at line {0}", line, MatchEmphasis.Groups["no"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", "Found {1} PRE_EMPHASIS at line {0}", line, + MatchEmphasis.Groups["no"].Value); currenttrack.flag_pre |= intrack && MatchCopy.Groups["no"].Value == ""; } else if(MatchStereo.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found {1}_CHANNEL_AUDIO at line {0}", line, MatchStereo.Groups["num"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", "Found {1}_CHANNEL_AUDIO at line {0}", line, + MatchStereo.Groups["num"].Value); currenttrack.flag_4ch |= intrack && MatchCopy.Groups["num"].Value == "FOUR"; } else if(MatchISRC.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found ISRC \"{1}\" at line {0}", line, MatchISRC.Groups["isrc"].Value); - if(intrack) - currenttrack.isrc = MatchISRC.Groups["isrc"].Value; + DicConsole.DebugWriteLine("CDRDAO plugin", "Found ISRC \"{1}\" at line {0}", line, + MatchISRC.Groups["isrc"].Value); + if(intrack) currenttrack.isrc = MatchISRC.Groups["isrc"].Value; } else if(MatchIndex.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found INDEX \"{1}\" at line {0}", line, MatchIndex.Groups["address"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", "Found INDEX \"{1}\" at line {0}", line, + MatchIndex.Groups["address"].Value); - string[] lengthString = MatchFile.Groups["length"].Value.Split(new char[] { ':' }); - ulong nextIndexPos = ulong.Parse(lengthString[0]) * 60 * 75 + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); - currenttrack.indexes.Add(nextindex, nextIndexPos + currenttrack.pregap + currenttrack.startSector); + string[] lengthString = MatchFile.Groups["length"].Value.Split(new char[] {':'}); + ulong nextIndexPos = ulong.Parse(lengthString[0]) * 60 * 75 + + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); + currenttrack.indexes.Add(nextindex, + nextIndexPos + currenttrack.pregap + currenttrack.startSector); } else if(MatchPregap.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found START \"{1}\" at line {0}", line, MatchPregap.Groups["address"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", "Found START \"{1}\" at line {0}", line, + MatchPregap.Groups["address"].Value); currenttrack.indexes.Add(0, currenttrack.startSector); if(MatchPregap.Groups["address"].Value != "") { - string[] lengthString = MatchPregap.Groups["address"].Value.Split(new char[] { ':' }); - currenttrack.pregap = ulong.Parse(lengthString[0]) * 60 * 75 + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); + string[] lengthString = MatchPregap.Groups["address"].Value.Split(new char[] {':'}); + currenttrack.pregap = ulong.Parse(lengthString[0]) * 60 * 75 + + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); } - else - currenttrack.pregap = currenttrack.sectors; + else currenttrack.pregap = currenttrack.sectors; } else if(MatchZeroPregap.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found PREGAP \"{1}\" at line {0}", line, MatchZeroPregap.Groups["length"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", "Found PREGAP \"{1}\" at line {0}", line, + MatchZeroPregap.Groups["length"].Value); currenttrack.indexes.Add(0, currenttrack.startSector); - string[] lengthString = MatchZeroPregap.Groups["length"].Value.Split(new char[] { ':' }); - currenttrack.pregap = ulong.Parse(lengthString[0]) * 60 * 75 + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); + string[] lengthString = MatchZeroPregap.Groups["length"].Value.Split(new char[] {':'}); + currenttrack.pregap = ulong.Parse(lengthString[0]) * 60 * 75 + + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); } else if(MatchZeroData.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found ZERO \"{1}\" at line {0}", line, MatchZeroData.Groups["length"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", "Found ZERO \"{1}\" at line {0}", line, + MatchZeroData.Groups["length"].Value); // Seems can be ignored as the data is still in the image } else if(MatchZeroAudio.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found SILENCE \"{1}\" at line {0}", line, MatchZeroAudio.Groups["length"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", "Found SILENCE \"{1}\" at line {0}", line, + MatchZeroAudio.Groups["length"].Value); // Seems can be ignored as the data is still in the image } else if(MatchAudioFile.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found AUDIOFILE \"{1}\" at line {0}", line, MatchAudioFile.Groups["filename"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", "Found AUDIOFILE \"{1}\" at line {0}", line, + MatchAudioFile.Groups["filename"].Value); - filtersList = new FiltersList(); + filtersList = new FiltersList(); currenttrack.trackfile = new CDRDAOTrackFile(); - currenttrack.trackfile.datafilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), MatchAudioFile.Groups["filename"].Value)); + currenttrack.trackfile.datafilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + MatchAudioFile.Groups["filename"].Value)); currenttrack.trackfile.datafile = MatchAudioFile.Groups["filename"].Value; - currenttrack.trackfile.offset = MatchAudioFile.Groups["base_offset"].Value != "" ? ulong.Parse(MatchAudioFile.Groups["base_offset"].Value) : 0; + currenttrack.trackfile.offset = MatchAudioFile.Groups["base_offset"].Value != "" + ? ulong.Parse(MatchAudioFile.Groups["base_offset"].Value) + : 0; currenttrack.trackfile.filetype = "BINARY"; currenttrack.trackfile.sequence = currentTrackNumber; @@ -628,110 +645,111 @@ namespace DiscImageChef.ImagePlugins if(MatchAudioFile.Groups["start"].Value != "") { - string[] startString = MatchAudioFile.Groups["start"].Value.Split(new char[] { ':' }); - startSectors = ulong.Parse(startString[0]) * 60 * 75 + ulong.Parse(startString[1]) * 75 + ulong.Parse(startString[2]); + string[] startString = MatchAudioFile.Groups["start"].Value.Split(new char[] {':'}); + startSectors = ulong.Parse(startString[0]) * 60 * 75 + ulong.Parse(startString[1]) * 75 + + ulong.Parse(startString[2]); } currenttrack.trackfile.offset += (startSectors * currenttrack.bps); if(MatchAudioFile.Groups["length"].Value != "") { - string[] lengthString = MatchAudioFile.Groups["length"].Value.Split(new char[] { ':' }); - currenttrack.sectors = ulong.Parse(lengthString[0]) * 60 * 75 + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); + string[] lengthString = MatchAudioFile.Groups["length"].Value.Split(new char[] {':'}); + currenttrack.sectors = ulong.Parse(lengthString[0]) * 60 * 75 + + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); } else - currenttrack.sectors = ((ulong)currenttrack.trackfile.datafilter.GetDataForkLength() - currenttrack.trackfile.offset) / currenttrack.bps; + currenttrack.sectors = + ((ulong)currenttrack.trackfile.datafilter.GetDataForkLength() - + currenttrack.trackfile.offset) / currenttrack.bps; } else if(MatchFile.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found DATAFILE \"{1}\" at line {0}", line, MatchFile.Groups["filename"].Value); + DicConsole.DebugWriteLine("CDRDAO plugin", "Found DATAFILE \"{1}\" at line {0}", line, + MatchFile.Groups["filename"].Value); - filtersList = new FiltersList(); - currenttrack.trackfile = new CDRDAOTrackFile(); - currenttrack.trackfile.datafilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), MatchFile.Groups["filename"].Value)); + filtersList = new FiltersList(); + currenttrack.trackfile = new CDRDAOTrackFile(); + currenttrack.trackfile.datafilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + MatchFile.Groups["filename"].Value)); currenttrack.trackfile.datafile = MatchAudioFile.Groups["filename"].Value; - currenttrack.trackfile.offset = MatchFile.Groups["base_offset"].Value != "" ? ulong.Parse(MatchFile.Groups["base_offset"].Value) : 0; + currenttrack.trackfile.offset = MatchFile.Groups["base_offset"].Value != "" + ? ulong.Parse(MatchFile.Groups["base_offset"].Value) + : 0; currenttrack.trackfile.filetype = "BINARY"; currenttrack.trackfile.sequence = currentTrackNumber; if(MatchFile.Groups["length"].Value != "") { - string[] lengthString = MatchFile.Groups["length"].Value.Split(new char[] { ':' }); - currenttrack.sectors = ulong.Parse(lengthString[0]) * 60 * 75 + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); + string[] lengthString = MatchFile.Groups["length"].Value.Split(new char[] {':'}); + currenttrack.sectors = ulong.Parse(lengthString[0]) * 60 * 75 + + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); } else - currenttrack.sectors = ((ulong)currenttrack.trackfile.datafilter.GetDataForkLength() - currenttrack.trackfile.offset) / currenttrack.bps; + currenttrack.sectors = + ((ulong)currenttrack.trackfile.datafilter.GetDataForkLength() - + currenttrack.trackfile.offset) / currenttrack.bps; } else if(MatchTitle.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found TITLE \"{1}\" at line {0}", line, MatchTitle.Groups["title"].Value); - if(intrack) - currenttrack.title = MatchTitle.Groups["title"].Value; - else - discimage.title = MatchTitle.Groups["title"].Value; + DicConsole.DebugWriteLine("CDRDAO plugin", "Found TITLE \"{1}\" at line {0}", line, + MatchTitle.Groups["title"].Value); + if(intrack) currenttrack.title = MatchTitle.Groups["title"].Value; + else discimage.title = MatchTitle.Groups["title"].Value; } else if(MatchPerformer.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found PERFORMER \"{1}\" at line {0}", line, MatchPerformer.Groups["performer"].Value); - if(intrack) - currenttrack.performer = MatchPerformer.Groups["performer"].Value; - else - discimage.performer = MatchPerformer.Groups["performer"].Value; + DicConsole.DebugWriteLine("CDRDAO plugin", "Found PERFORMER \"{1}\" at line {0}", line, + MatchPerformer.Groups["performer"].Value); + if(intrack) currenttrack.performer = MatchPerformer.Groups["performer"].Value; + else discimage.performer = MatchPerformer.Groups["performer"].Value; } else if(MatchSongwriter.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found SONGWRITER \"{1}\" at line {0}", line, MatchSongwriter.Groups["songwriter"].Value); - if(intrack) - currenttrack.songwriter = MatchSongwriter.Groups["songwriter"].Value; - else - discimage.songwriter = MatchSongwriter.Groups["songwriter"].Value; + DicConsole.DebugWriteLine("CDRDAO plugin", "Found SONGWRITER \"{1}\" at line {0}", line, + MatchSongwriter.Groups["songwriter"].Value); + if(intrack) currenttrack.songwriter = MatchSongwriter.Groups["songwriter"].Value; + else discimage.songwriter = MatchSongwriter.Groups["songwriter"].Value; } else if(MatchComposer.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found COMPOSER \"{1}\" at line {0}", line, MatchComposer.Groups["composer"].Value); - if(intrack) - currenttrack.composer = MatchComposer.Groups["composer"].Value; - else - discimage.composer = MatchComposer.Groups["composer"].Value; + DicConsole.DebugWriteLine("CDRDAO plugin", "Found COMPOSER \"{1}\" at line {0}", line, + MatchComposer.Groups["composer"].Value); + if(intrack) currenttrack.composer = MatchComposer.Groups["composer"].Value; + else discimage.composer = MatchComposer.Groups["composer"].Value; } else if(MatchArranger.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found ARRANGER \"{1}\" at line {0}", line, MatchArranger.Groups["arranger"].Value); - if(intrack) - currenttrack.arranger = MatchArranger.Groups["arranger"].Value; - else - discimage.arranger = MatchArranger.Groups["arranger"].Value; + DicConsole.DebugWriteLine("CDRDAO plugin", "Found ARRANGER \"{1}\" at line {0}", line, + MatchArranger.Groups["arranger"].Value); + if(intrack) currenttrack.arranger = MatchArranger.Groups["arranger"].Value; + else discimage.arranger = MatchArranger.Groups["arranger"].Value; } else if(MatchMessage.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found MESSAGE \"{1}\" at line {0}", line, MatchMessage.Groups["message"].Value); - if(intrack) - currenttrack.message = MatchMessage.Groups["message"].Value; - else - discimage.message = MatchMessage.Groups["message"].Value; + DicConsole.DebugWriteLine("CDRDAO plugin", "Found MESSAGE \"{1}\" at line {0}", line, + MatchMessage.Groups["message"].Value); + if(intrack) currenttrack.message = MatchMessage.Groups["message"].Value; + else discimage.message = MatchMessage.Groups["message"].Value; } else if(MatchDiscID.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found DISC_ID \"{1}\" at line {0}", line, MatchDiscID.Groups["discid"].Value); - if(!intrack) - discimage.disk_id = MatchDiscID.Groups["discid"].Value; + DicConsole.DebugWriteLine("CDRDAO plugin", "Found DISC_ID \"{1}\" at line {0}", line, + MatchDiscID.Groups["discid"].Value); + if(!intrack) discimage.disk_id = MatchDiscID.Groups["discid"].Value; } else if(MatchUPC.Success) { - DicConsole.DebugWriteLine("CDRDAO plugin", "Found UPC_EAN \"{1}\" at line {0}", line, MatchUPC.Groups["catalog"].Value); - if(!intrack) - discimage.barcode = MatchUPC.Groups["catalog"].Value; + DicConsole.DebugWriteLine("CDRDAO plugin", "Found UPC_EAN \"{1}\" at line {0}", line, + MatchUPC.Groups["catalog"].Value); + if(!intrack) discimage.barcode = MatchUPC.Groups["catalog"].Value; } // Ignored fields else if(MatchCDText.Success || MatchLanguage.Success || MatchClosure.Success || - MatchLanguageMap.Success || MatchLanguageMapping.Success) - { - - } + MatchLanguageMap.Success || MatchLanguageMapping.Success) { } else if(_line == "") // Empty line, ignore it - { - - } + { } // TODO: Regex CD-TEXT SIZE_INFO /* else // Non-empty unknown field @@ -754,54 +772,39 @@ namespace DiscImageChef.ImagePlugins // DEBUG information DicConsole.DebugWriteLine("CDRDAO plugin", "Disc image parsing results"); DicConsole.DebugWriteLine("CDRDAO plugin", "Disc CD-TEXT:"); - if(discimage.arranger == null) - DicConsole.DebugWriteLine("CDRDAO plugin", "\tArranger is not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\tArranger: {0}", discimage.arranger); - if(discimage.composer == null) - DicConsole.DebugWriteLine("CDRDAO plugin", "\tComposer is not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\tComposer: {0}", discimage.composer); - if(discimage.performer == null) - DicConsole.DebugWriteLine("CDRDAO plugin", "\tPerformer is not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\tPerformer: {0}", discimage.performer); - if(discimage.songwriter == null) - DicConsole.DebugWriteLine("CDRDAO plugin", "\tSongwriter is not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\tSongwriter: {0}", discimage.songwriter); - if(discimage.title == null) - DicConsole.DebugWriteLine("CDRDAO plugin", "\tTitle is not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\tTitle: {0}", discimage.title); + if(discimage.arranger == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tArranger is not set."); + else DicConsole.DebugWriteLine("CDRDAO plugin", "\tArranger: {0}", discimage.arranger); + if(discimage.composer == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tComposer is not set."); + else DicConsole.DebugWriteLine("CDRDAO plugin", "\tComposer: {0}", discimage.composer); + if(discimage.performer == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tPerformer is not set."); + else DicConsole.DebugWriteLine("CDRDAO plugin", "\tPerformer: {0}", discimage.performer); + if(discimage.songwriter == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tSongwriter is not set."); + else DicConsole.DebugWriteLine("CDRDAO plugin", "\tSongwriter: {0}", discimage.songwriter); + if(discimage.title == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tTitle is not set."); + else DicConsole.DebugWriteLine("CDRDAO plugin", "\tTitle: {0}", discimage.title); DicConsole.DebugWriteLine("CDRDAO plugin", "Disc information:"); DicConsole.DebugWriteLine("CDRDAO plugin", "\tGuessed disk type: {0}", discimage.disktype); - if(discimage.barcode == null) - DicConsole.DebugWriteLine("CDRDAO plugin", "\tBarcode not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\tBarcode: {0}", discimage.barcode); - if(discimage.disk_id == null) - DicConsole.DebugWriteLine("CDRDAO plugin", "\tDisc ID not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\tDisc ID: {0}", discimage.disk_id); - if(discimage.mcn == null) - DicConsole.DebugWriteLine("CDRDAO plugin", "\tMCN not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\tMCN: {0}", discimage.mcn); + if(discimage.barcode == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tBarcode not set."); + else DicConsole.DebugWriteLine("CDRDAO plugin", "\tBarcode: {0}", discimage.barcode); + if(discimage.disk_id == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tDisc ID not set."); + else DicConsole.DebugWriteLine("CDRDAO plugin", "\tDisc ID: {0}", discimage.disk_id); + if(discimage.mcn == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tMCN not set."); + else DicConsole.DebugWriteLine("CDRDAO plugin", "\tMCN: {0}", discimage.mcn); if(string.IsNullOrEmpty(discimage.comment)) DicConsole.DebugWriteLine("CDRDAO plugin", "\tComment not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\tComment: \"{0}\"", discimage.comment); + else DicConsole.DebugWriteLine("CDRDAO plugin", "\tComment: \"{0}\"", discimage.comment); DicConsole.DebugWriteLine("CDRDAO plugin", "Track information:"); DicConsole.DebugWriteLine("CDRDAO plugin", "\tDisc contains {0} tracks", discimage.tracks.Count); for(int i = 0; i < discimage.tracks.Count; i++) { - DicConsole.DebugWriteLine("CDRDAO plugin", "\tTrack {0} information:", discimage.tracks[i].sequence); + DicConsole.DebugWriteLine("CDRDAO plugin", "\tTrack {0} information:", + discimage.tracks[i].sequence); DicConsole.DebugWriteLine("CDRDAO plugin", "\t\t{0} bytes per sector", discimage.tracks[i].bps); DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tPregap: {0} sectors", discimage.tracks[i].pregap); - DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tData: {0} sectors starting at sector {1}", discimage.tracks[i].sectors, discimage.tracks[i].startSector); + DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tData: {0} sectors starting at sector {1}", + discimage.tracks[i].sectors, discimage.tracks[i].startSector); DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tPostgap: {0} sectors", discimage.tracks[i].postgap); if(discimage.tracks[i].flag_4ch) @@ -811,26 +814,27 @@ namespace DiscImageChef.ImagePlugins if(discimage.tracks[i].flag_pre) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tTrack has pre-emphasis applied"); - DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tTrack resides in file {0}, type defined as {1}, starting at byte {2}", - discimage.tracks[i].trackfile.datafilter.GetFilename(), discimage.tracks[i].trackfile.filetype, discimage.tracks[i].trackfile.offset); + DicConsole.DebugWriteLine("CDRDAO plugin", + "\t\tTrack resides in file {0}, type defined as {1}, starting at byte {2}", + discimage.tracks[i].trackfile.datafilter.GetFilename(), + discimage.tracks[i].trackfile.filetype, + discimage.tracks[i].trackfile.offset); DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tIndexes:"); foreach(KeyValuePair<int, ulong> kvp in discimage.tracks[i].indexes) - DicConsole.DebugWriteLine("CDRDAO plugin", "\t\t\tIndex {0} starts at sector {1}", kvp.Key, kvp.Value); + DicConsole.DebugWriteLine("CDRDAO plugin", "\t\t\tIndex {0} starts at sector {1}", kvp.Key, + kvp.Value); if(discimage.tracks[i].isrc == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tISRC is not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tISRC: {0}", discimage.tracks[i].isrc); + else DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tISRC: {0}", discimage.tracks[i].isrc); if(discimage.tracks[i].arranger == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tArranger is not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tArranger: {0}", discimage.tracks[i].arranger); + else DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tArranger: {0}", discimage.tracks[i].arranger); if(discimage.tracks[i].composer == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tComposer is not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tComposer: {0}", discimage.tracks[i].composer); + else DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tComposer: {0}", discimage.tracks[i].composer); if(discimage.tracks[i].performer == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tPerformer is not set."); else @@ -838,11 +842,11 @@ namespace DiscImageChef.ImagePlugins if(discimage.tracks[i].songwriter == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tSongwriter is not set."); else - DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tSongwriter: {0}", discimage.tracks[i].songwriter); + DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tSongwriter: {0}", + discimage.tracks[i].songwriter); if(discimage.tracks[i].title == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tTitle is not set."); - else - DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tTitle: {0}", discimage.tracks[i].title); + else DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tTitle: {0}", discimage.tracks[i].title); } DicConsole.DebugWriteLine("CDRDAO plugin", "Building offset map"); @@ -912,15 +916,15 @@ namespace DiscImageChef.ImagePlugins ImageInfo.sectors += track.sectors; } - if(discimage.disktype == MediaType.CDG || discimage.disktype == MediaType.CDEG || discimage.disktype == MediaType.CDMIDI) + if(discimage.disktype == MediaType.CDG || discimage.disktype == MediaType.CDEG || + discimage.disktype == MediaType.CDMIDI) ImageInfo.sectorSize = 2448; // CD+G subchannels ARE user data, as CD+G are useless without them - else if(discimage.disktype != MediaType.CDROMXA && discimage.disktype != MediaType.CDDA && discimage.disktype != MediaType.CDI && discimage.disktype != MediaType.CDPLUS) - ImageInfo.sectorSize = 2048; // Only data tracks - else - ImageInfo.sectorSize = 2352; // All others + else if(discimage.disktype != MediaType.CDROMXA && discimage.disktype != MediaType.CDDA && + discimage.disktype != MediaType.CDI && + discimage.disktype != MediaType.CDPLUS) ImageInfo.sectorSize = 2048; // Only data tracks + else ImageInfo.sectorSize = 2352; // All others - if(discimage.mcn != null) - ImageInfo.readableMediaTags.Add(MediaTagType.CD_MCN); + if(discimage.mcn != null) ImageInfo.readableMediaTags.Add(MediaTagType.CD_MCN); ImageInfo.imageApplication = "CDRDAO"; @@ -945,50 +949,50 @@ namespace DiscImageChef.ImagePlugins switch(track.tracktype) { case CDRDAOTrackTypeAudio: - { - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC); - break; - } + { + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC); + break; + } case CDRDAOTrackTypeMode2: case CDRDAOTrackTypeMode2Mix: - { - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - break; - } + { + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); + break; + } case CDRDAOTrackTypeMode2Raw: - { - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - break; - } + { + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); + break; + } case CDRDAOTrackTypeMode1Raw: - { - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - break; - } + { + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); + break; + } } } @@ -1034,13 +1038,11 @@ namespace DiscImageChef.ImagePlugins switch(tag) { case MediaTagType.CD_MCN: - { - if(discimage.mcn != null) - { - return Encoding.ASCII.GetBytes(discimage.mcn); - } - throw new FeatureNotPresentImageException("Image does not contain MCN information."); - } + { + if(discimage.mcn != null) { return Encoding.ASCII.GetBytes(discimage.mcn); } + + throw new FeatureNotPresentImageException("Image does not contain MCN information."); + } default: throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format"); } @@ -1083,7 +1085,8 @@ namespace DiscImageChef.ImagePlugins } } - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); } public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) @@ -1103,7 +1106,8 @@ namespace DiscImageChef.ImagePlugins } } - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); } public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) @@ -1125,7 +1129,8 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length > _track.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks"); + throw new ArgumentOutOfRangeException(nameof(length), + "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; @@ -1135,62 +1140,61 @@ namespace DiscImageChef.ImagePlugins { case CDRDAOTrackTypeMode1: case CDRDAOTrackTypeMode2Form1: - { - sector_offset = 0; - sector_size = 2048; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2048; + sector_skip = 0; + break; + } case CDRDAOTrackTypeMode2Form2: - { - sector_offset = 0; - sector_size = 2324; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2324; + sector_skip = 0; + break; + } case CDRDAOTrackTypeMode2: case CDRDAOTrackTypeMode2Mix: - { - sector_offset = 0; - sector_size = 2336; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2336; + sector_skip = 0; + break; + } case CDRDAOTrackTypeAudio: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } case CDRDAOTrackTypeMode1Raw: - { - sector_offset = 16; - sector_size = 2048; - sector_skip = 288; - break; - } + { + sector_offset = 16; + sector_size = 2048; + sector_skip = 288; + break; + } case CDRDAOTrackTypeMode2Raw: - { - sector_offset = 16; - sector_size = 2336; - sector_skip = 0; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + { + sector_offset = 16; + sector_size = 2336; + sector_skip = 0; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } - if(_track.subchannel) - sector_skip += 96; + if(_track.subchannel) sector_skip += 96; byte[] buffer = new byte[sector_size * length]; imageStream = _track.trackfile.datafilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + br.BaseStream + .Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -1225,7 +1229,8 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length > _track.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks"); + throw new ArgumentOutOfRangeException(nameof(length), + "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; @@ -1243,30 +1248,23 @@ namespace DiscImageChef.ImagePlugins case SectorTagType.CDSectorHeader: case SectorTagType.CDSectorSubchannel: case SectorTagType.CDSectorSubHeader: - case SectorTagType.CDSectorSync: - break; + case SectorTagType.CDSectorSync: break; case SectorTagType.CDTrackFlags: - { - byte[] flags = new byte[1]; + { + byte[] flags = new byte[1]; - if(_track.tracktype != CDRDAOTrackTypeAudio) - flags[0] += 0x40; + if(_track.tracktype != CDRDAOTrackTypeAudio) flags[0] += 0x40; - if(_track.flag_dcp) - flags[0] += 0x20; + if(_track.flag_dcp) flags[0] += 0x20; - if(_track.flag_pre) - flags[0] += 0x10; + if(_track.flag_pre) flags[0] += 0x10; - if(_track.flag_4ch) - flags[0] += 0x80; + if(_track.flag_4ch) flags[0] += 0x80; - return flags; - } - case SectorTagType.CDTrackISRC: - return Encoding.UTF8.GetBytes(_track.isrc); - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + return flags; + } + case SectorTagType.CDTrackISRC: return Encoding.UTF8.GetBytes(_track.isrc); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } switch(_track.tracktype) @@ -1279,6 +1277,7 @@ namespace DiscImageChef.ImagePlugins sector_size = 96; break; } + throw new ArgumentException("No tags in image for requested track", nameof(tag)); case CDRDAOTrackTypeMode2Form2: case CDRDAOTrackTypeMode2Mix: @@ -1288,6 +1287,7 @@ namespace DiscImageChef.ImagePlugins sector_size = 96; break; } + throw new ArgumentException("No tags in image for requested track", nameof(tag)); case CDRDAOTrackTypeAudio: if(tag == SectorTagType.CDSectorSubchannel) @@ -1296,66 +1296,67 @@ namespace DiscImageChef.ImagePlugins sector_size = 96; break; } + throw new ArgumentException("No tags in image for requested track", nameof(tag)); case CDRDAOTrackTypeMode1Raw: + { + switch(tag) { - switch(tag) + case SectorTagType.CDSectorSync: { - case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } - case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } - case SectorTagType.CDSectorSubchannel: - { - sector_offset = 2352; - sector_size = 96; - break; - } - case SectorTagType.CDSectorSubHeader: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - sector_skip = 104; - break; - } - case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2064; - sector_size = 4; - sector_skip = 284; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; } - break; + case SectorTagType.CDSectorHeader: + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } + case SectorTagType.CDSectorSubchannel: + { + sector_offset = 2352; + sector_size = 96; + break; + } + case SectorTagType.CDSectorSubHeader: + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + case SectorTagType.CDSectorECC: + { + sector_offset = 2076; + sector_size = 276; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorECC_P: + { + sector_offset = 2076; + sector_size = 172; + sector_skip = 104; + break; + } + case SectorTagType.CDSectorECC_Q: + { + sector_offset = 2248; + sector_size = 104; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2064; + sector_size = 4; + sector_skip = 284; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } + + break; + } case CDRDAOTrackTypeMode2Raw: // Requires reading sector if(tag == SectorTagType.CDSectorSubchannel) { @@ -1363,18 +1364,19 @@ namespace DiscImageChef.ImagePlugins sector_size = 96; break; } + throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented"); - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; imageStream = _track.trackfile.datafilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + br.BaseStream + .Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -1439,7 +1441,8 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length > _track.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks"); + throw new ArgumentOutOfRangeException(nameof(length), + "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; @@ -1449,52 +1452,51 @@ namespace DiscImageChef.ImagePlugins { case CDRDAOTrackTypeMode1: case CDRDAOTrackTypeMode2Form1: - { - sector_offset = 0; - sector_size = 2048; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2048; + sector_skip = 0; + break; + } case CDRDAOTrackTypeMode2Form2: - { - sector_offset = 0; - sector_size = 2324; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2324; + sector_skip = 0; + break; + } case CDRDAOTrackTypeMode2: case CDRDAOTrackTypeMode2Mix: - { - sector_offset = 0; - sector_size = 2336; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2336; + sector_skip = 0; + break; + } case CDRDAOTrackTypeMode1Raw: case CDRDAOTrackTypeMode2Raw: case CDRDAOTrackTypeAudio: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 0; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } - if(_track.subchannel) - sector_skip += 96; + if(_track.subchannel) sector_skip += 96; byte[] buffer = new byte[sector_size * length]; imageStream = _track.trackfile.datafilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); + br.BaseStream + .Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -1592,13 +1594,14 @@ namespace DiscImageChef.ImagePlugins _track.TrackBytesPerSector = CDRDAOTrackTypeToCookedBytesPerSector(cdr_track.tracktype); if(cdr_track.subchannel) { - _track.TrackSubchannelType = cdr_track.packedsubchannel ? TrackSubchannelType.PackedInterleaved : TrackSubchannelType.RawInterleaved; - _track.TrackSubchannelFilter = cdr_track.trackfile.datafilter; + _track.TrackSubchannelType = cdr_track.packedsubchannel + ? TrackSubchannelType.PackedInterleaved + : TrackSubchannelType.RawInterleaved; + _track.TrackSubchannelFilter = cdr_track.trackfile.datafilter; _track.TrackSubchannelFile = cdr_track.trackfile.datafilter.GetFilename(); _track.TrackSubchannelOffset = cdr_track.trackfile.offset; } - else - _track.TrackSubchannelType = TrackSubchannelType.None; + else _track.TrackSubchannelType = TrackSubchannelType.None; tracks.Add(_track); } @@ -1613,8 +1616,8 @@ namespace DiscImageChef.ImagePlugins public override List<Track> GetSessionTracks(ushort session) { - if(session == 1) - return GetTracks(); + if(session == 1) return GetTracks(); + throw new ImageNotSupportedException("Session does not exist in disc image"); } @@ -1630,7 +1633,8 @@ namespace DiscImageChef.ImagePlugins return Checksums.CDChecksums.CheckCDSector(buffer); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); @@ -1654,14 +1658,14 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length, track); int bps = (int)(buffer.Length / length); @@ -1685,10 +1689,9 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } @@ -1697,36 +1700,28 @@ namespace DiscImageChef.ImagePlugins return null; } - #region Not implemented methods + #region Not implemented methods + public override List<Session> GetSessions() + { + // TODO + throw new NotImplementedException(); + } + #endregion - public override List<Session> GetSessions() - { - // TODO - throw new NotImplementedException(); - } - - #endregion - - #region Private methods - - static ushort CDRDAOTrackTypeToBytesPerSector(string trackType) + #region Private methods + static ushort CDRDAOTrackTypeToBytesPerSector(string trackType) { switch(trackType) { case CDRDAOTrackTypeMode1: - case CDRDAOTrackTypeMode2Form1: - return 2048; - case CDRDAOTrackTypeMode2Form2: - return 2324; + case CDRDAOTrackTypeMode2Form1: return 2048; + case CDRDAOTrackTypeMode2Form2: return 2324; case CDRDAOTrackTypeMode2: - case CDRDAOTrackTypeMode2Mix: - return 2336; + case CDRDAOTrackTypeMode2Mix: return 2336; case CDRDAOTrackTypeAudio: case CDRDAOTrackTypeMode1Raw: - case CDRDAOTrackTypeMode2Raw: - return 2352; - default: - return 0; + case CDRDAOTrackTypeMode2Raw: return 2352; + default: return 0; } } @@ -1736,18 +1731,13 @@ namespace DiscImageChef.ImagePlugins { case CDRDAOTrackTypeMode1: case CDRDAOTrackTypeMode2Form1: - case CDRDAOTrackTypeMode1Raw: - return 2048; - case CDRDAOTrackTypeMode2Form2: - return 2324; + case CDRDAOTrackTypeMode1Raw: return 2048; + case CDRDAOTrackTypeMode2Form2: return 2324; case CDRDAOTrackTypeMode2: case CDRDAOTrackTypeMode2Mix: - case CDRDAOTrackTypeMode2Raw: - return 2336; - case CDRDAOTrackTypeAudio: - return 2352; - default: - return 0; + case CDRDAOTrackTypeMode2Raw: return 2336; + case CDRDAOTrackTypeAudio: return 2352; + default: return 0; } } @@ -1756,27 +1746,19 @@ namespace DiscImageChef.ImagePlugins switch(trackType) { case CDRDAOTrackTypeMode1: - case CDRDAOTrackTypeMode1Raw: - return TrackType.CDMode1; - case CDRDAOTrackTypeMode2Form1: - return TrackType.CDMode2Form1; - case CDRDAOTrackTypeMode2Form2: - return TrackType.CDMode2Form2; + case CDRDAOTrackTypeMode1Raw: return TrackType.CDMode1; + case CDRDAOTrackTypeMode2Form1: return TrackType.CDMode2Form1; + case CDRDAOTrackTypeMode2Form2: return TrackType.CDMode2Form2; case CDRDAOTrackTypeMode2: case CDRDAOTrackTypeMode2Mix: - case CDRDAOTrackTypeMode2Raw: - return TrackType.CDMode2Formless; - case CDRDAOTrackTypeAudio: - return TrackType.Audio; - default: - return TrackType.Data; + case CDRDAOTrackTypeMode2Raw: return TrackType.CDMode2Formless; + case CDRDAOTrackTypeAudio: return TrackType.Audio; + default: return TrackType.Data; } } - #endregion #region Unsupported features - public override int GetMediaSequence() { return ImageInfo.mediaSequence; @@ -1826,8 +1808,6 @@ namespace DiscImageChef.ImagePlugins { return ImageInfo.imageCreator; } - #endregion } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/CDRWin.cs b/DiscImageChef.DiscImages/CDRWin.cs index 7765e64a..4a2b18f4 100644 --- a/DiscImageChef.DiscImages/CDRWin.cs +++ b/DiscImageChef.DiscImages/CDRWin.cs @@ -41,11 +41,10 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - // TODO: Implement track flags - public class CDRWin : ImagePlugin + // TODO: Implement track flags + public class CDRWin : ImagePlugin { #region Internal structures - struct CDRWinTrackFile { /// <summary>Track #</summary> @@ -101,7 +100,6 @@ namespace DiscImageChef.ImagePlugins /// <summary>Track session</summary> public ushort session; } - #endregion struct CDRWinDisc @@ -139,7 +137,6 @@ namespace DiscImageChef.ImagePlugins } #region Internal consts - // Type for FILE entity /// <summary>Data as-is in little-endian</summary> const string CDRWinDiskTypeLittleEndian = "BINARY"; @@ -239,11 +236,9 @@ namespace DiscImageChef.ImagePlugins const string CDRWinDiskTypeBDRDL = "BD-R DL"; /// <summary>DiskType.BDRE</summary> const string CDRWinDiskTypeBDREDL = "BD-RE DL"; - #endregion #region Internal variables - Filter imageFilter; StreamReader cueStream; Stream imageStream; @@ -251,11 +246,9 @@ namespace DiscImageChef.ImagePlugins Dictionary<uint, ulong> offsetmap; CDRWinDisc discimage; List<Partition> partitions; - #endregion #region Parsing regexs - const string SessionRegEx = "\\bREM\\s+SESSION\\s+(?<number>\\d+).*$"; const string DiskTypeRegEx = "\\bREM\\s+ORIGINAL MEDIA-TYPE:\\s+(?<mediatype>.+)$"; const string LeadOutRegEx = "\\bREM\\s+LEAD-OUT\\s+(?<msf>[\\d]+:[\\d]+:[\\d]+)$"; @@ -279,11 +272,9 @@ namespace DiscImageChef.ImagePlugins const string PregapRegEx = "\\bPREGAP\\s+(?<msf>[\\d]+:[\\d]+:[\\d]+)$"; const string PostgapRegex = "\\bPOSTGAP\\s+(?<msf>[\\d]+:[\\d]+:[\\d]+)$"; const string FlagsRegEx = "\\bFLAGS\\s+(((?<dcp>DCP)|(?<quad>4CH)|(?<pre>PRE)|(?<scms>SCMS))\\s*)+$"; - #endregion #region Methods - public CDRWin() { Name = "CDRWin cuesheet"; @@ -315,31 +306,29 @@ namespace DiscImageChef.ImagePlugins try { - imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); - byte[] testArray = new byte[512]; - imageFilter.GetDataForkStream().Read(testArray, 0, 512); - imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); - // Check for unexpected control characters that shouldn't be present in a text file and can crash this plugin - bool twoConsecutiveNulls = false; - for(int i = 0; i < 512; i++) - { - if(i >= imageFilter.GetDataForkStream().Length) - break; - - if(testArray[i] == 0) - { - if(twoConsecutiveNulls) - return false; - twoConsecutiveNulls = true; - } - else - twoConsecutiveNulls = false; - - if(testArray[i] < 0x20 && testArray[i] != 0x0A && testArray[i] != 0x0D && testArray[i] != 0x00) - return false; - } + imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); + byte[] testArray = new byte[512]; + imageFilter.GetDataForkStream().Read(testArray, 0, 512); + imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); + // Check for unexpected control characters that shouldn't be present in a text file and can crash this plugin + bool twoConsecutiveNulls = false; + for(int i = 0; i < 512; i++) + { + if(i >= imageFilter.GetDataForkStream().Length) break; - cueStream = new StreamReader(this.imageFilter.GetDataForkStream()); + if(testArray[i] == 0) + { + if(twoConsecutiveNulls) return false; + + twoConsecutiveNulls = true; + } + else twoConsecutiveNulls = false; + + if(testArray[i] < 0x20 && testArray[i] != 0x0A && testArray[i] != 0x0D && testArray[i] != 0x00) + return false; + } + + cueStream = new StreamReader(this.imageFilter.GetDataForkStream()); int line = 0; while(cueStream.Peek() >= 0) @@ -366,8 +355,8 @@ namespace DiscImageChef.ImagePlugins Fm = Fr.Match(_line); Tm = Tr.Match(_line); - if(!Sm.Success && !Rm.Success && !Cm.Success && !Fm.Success && !Tm.Success) - return false; + if(!Sm.Success && !Rm.Success && !Cm.Success && !Fm.Success && !Tm.Success) return false; + return true; } @@ -384,8 +373,7 @@ namespace DiscImageChef.ImagePlugins public override bool OpenImage(Filter imageFilter) { - if(imageFilter == null) - return false; + if(imageFilter == null) return false; this.imageFilter = imageFilter; @@ -469,14 +457,16 @@ namespace DiscImageChef.ImagePlugins { uint track_seq = uint.Parse(MatchTrack.Groups[1].Value); if(track_count + 1 != track_seq) - throw new FeatureUnsupportedImageException(string.Format("Found TRACK {0} out of order in line {1}", track_seq, line)); + throw new + FeatureUnsupportedImageException(string + .Format("Found TRACK {0} out of order in line {1}", + track_seq, line)); track_count++; } } - if(track_count == 0) - throw new FeatureUnsupportedImageException("No tracks found"); + if(track_count == 0) throw new FeatureUnsupportedImageException("No tracks found"); cuetracks = new CDRWinTrack[track_count]; @@ -494,7 +484,7 @@ namespace DiscImageChef.ImagePlugins MatchSession = RegexSession.Match(_line); MatchDiskType = RegexDiskType.Match(_line); MatchComment = RegexComment.Match(_line); - MatchLBA = RegexLBA.Match(_line); // Unhandled, just ignored + MatchLBA = RegexLBA.Match(_line); // Unhandled, just ignored MatchLeadOut = RegexLeadOut.Match(_line); // Unhandled, just ignored if(MatchDiskType.Success && !intrack) @@ -504,7 +494,10 @@ namespace DiscImageChef.ImagePlugins } else if(MatchDiskType.Success && intrack) { - throw new FeatureUnsupportedImageException(string.Format("Found REM ORIGINAL MEDIA TYPE field after a track in line {0}", line)); + throw new + FeatureUnsupportedImageException(string + .Format("Found REM ORIGINAL MEDIA TYPE field after a track in line {0}", + line)); } else if(MatchSession.Success) { @@ -526,10 +519,10 @@ namespace DiscImageChef.ImagePlugins else if(MatchComment.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found REM at line {0}", line); - if(discimage.comment == "") - discimage.comment = MatchComment.Groups[1].Value; // First comment + if(discimage.comment == "") discimage.comment = MatchComment.Groups[1].Value; // First comment else - discimage.comment += Environment.NewLine + MatchComment.Groups[1].Value; // Append new comments as new lines + discimage.comment += + Environment.NewLine + MatchComment.Groups[1].Value; // Append new comments as new lines } else { @@ -554,42 +547,44 @@ namespace DiscImageChef.ImagePlugins if(MatchArranger.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found ARRANGER at line {0}", line); - if(intrack) - currenttrack.arranger = MatchArranger.Groups[1].Value; - else - discimage.arranger = MatchArranger.Groups[1].Value; + if(intrack) currenttrack.arranger = MatchArranger.Groups[1].Value; + else discimage.arranger = MatchArranger.Groups[1].Value; } else if(MatchBarCode.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found UPC_EAN at line {0}", line); - if(!intrack) - discimage.barcode = MatchBarCode.Groups[1].Value; + if(!intrack) discimage.barcode = MatchBarCode.Groups[1].Value; else - throw new FeatureUnsupportedImageException(string.Format("Found barcode field in incorrect place at line {0}", line)); + throw new + FeatureUnsupportedImageException(string + .Format("Found barcode field in incorrect place at line {0}", + line)); } else if(MatchCDText.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found CDTEXTFILE at line {0}", line); - if(!intrack) - discimage.cdtextfile = MatchCDText.Groups[1].Value; + if(!intrack) discimage.cdtextfile = MatchCDText.Groups[1].Value; else - throw new FeatureUnsupportedImageException(string.Format("Found CD-Text file field in incorrect place at line {0}", line)); + throw new + FeatureUnsupportedImageException(string + .Format("Found CD-Text file field in incorrect place at line {0}", + line)); } else if(MatchComposer.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found COMPOSER at line {0}", line); - if(intrack) - currenttrack.arranger = MatchComposer.Groups[1].Value; - else - discimage.arranger = MatchComposer.Groups[1].Value; + if(intrack) currenttrack.arranger = MatchComposer.Groups[1].Value; + else discimage.arranger = MatchComposer.Groups[1].Value; } else if(MatchDiskID.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found DISC_ID at line {0}", line); - if(!intrack) - discimage.disk_id = MatchDiskID.Groups[1].Value; + if(!intrack) discimage.disk_id = MatchDiskID.Groups[1].Value; else - throw new FeatureUnsupportedImageException(string.Format("Found CDDB ID field in incorrect place at line {0}", line)); + throw new + FeatureUnsupportedImageException(string + .Format("Found CDDB ID field in incorrect place at line {0}", + line)); } else if(MatchFile.Success) { @@ -597,17 +592,19 @@ namespace DiscImageChef.ImagePlugins if(currenttrack.sequence != 0) { - currentfile.sequence = currenttrack.sequence; + currentfile.sequence = currenttrack.sequence; currenttrack.trackfile = currentfile; - currenttrack.sectors = ((ulong)currentfile.datafilter.GetLength() - currentfile.offset) / CDRWinTrackTypeToBytesPerSector(currenttrack.tracktype); + currenttrack.sectors = + ((ulong)currentfile.datafilter.GetLength() - currentfile.offset) / + CDRWinTrackTypeToBytesPerSector(currenttrack.tracktype); cuetracks[currenttrack.sequence - 1] = currenttrack; intrack = false; currenttrack = new CDRWinTrack(); - currentfile = new CDRWinTrackFile(); - filtersList = new FiltersList(); - } + currentfile = new CDRWinTrackFile(); + filtersList = new FiltersList(); + } - //currentfile = new CDRWinTrackFile(); + //currentfile = new CDRWinTrackFile(); string datafile = MatchFile.Groups[1].Value; currentfile.filetype = MatchFile.Groups[2].Value; @@ -622,7 +619,8 @@ namespace DiscImageChef.ImagePlugins // Check if file exists if(currentfile.datafilter == null) { - if(datafile[0] == '/' || (datafile[0] == '/' && datafile[1] == '.')) // UNIX absolute path + if(datafile[0] == '/' || (datafile[0] == '/' && datafile[1] == '.') + ) // UNIX absolute path { Regex unixpath = new Regex("^(.+)/([^/]+)$"); Match unixpathmatch = unixpath.Match(datafile); @@ -633,21 +631,30 @@ namespace DiscImageChef.ImagePlugins if(currentfile.datafilter == null) { - string path = imageFilter.GetParentFolder() + Path.PathSeparator + unixpathmatch.Groups[1].Value; + string path = imageFilter.GetParentFolder() + Path.PathSeparator + + unixpathmatch.Groups[1].Value; currentfile.datafilter = filtersList.GetFilter(path); if(currentfile.datafilter == null) - throw new FeatureUnsupportedImageException(string.Format("File \"{0}\" not found.", MatchFile.Groups[1].Value)); + throw new + FeatureUnsupportedImageException(string + .Format("File \"{0}\" not found.", + MatchFile + .Groups[1].Value)); } } else - throw new FeatureUnsupportedImageException(string.Format("File \"{0}\" not found.", MatchFile.Groups[1].Value)); + throw new + FeatureUnsupportedImageException(string.Format("File \"{0}\" not found.", + MatchFile.Groups[1].Value)); } else if((datafile[1] == ':' && datafile[2] == '\\') || (datafile[0] == '\\' && datafile[1] == '\\') || ((datafile[0] == '.' && datafile[1] == '\\'))) // Windows absolute path { - Regex winpath = new Regex("^(?:[a-zA-Z]\\:(\\\\|\\/)|file\\:\\/\\/|\\\\\\\\|\\.(\\/|\\\\))([^\\\\\\/\\:\\*\\?\\<\\>\\\"\\|]+(\\\\|\\/){0,1})+$"); + Regex winpath = + new + Regex("^(?:[a-zA-Z]\\:(\\\\|\\/)|file\\:\\/\\/|\\\\\\\\|\\.(\\/|\\\\))([^\\\\\\/\\:\\*\\?\\<\\>\\\"\\|]+(\\\\|\\/){0,1})+$"); Match winpathmatch = winpath.Match(datafile); if(winpathmatch.Success) { @@ -655,15 +662,22 @@ namespace DiscImageChef.ImagePlugins if(currentfile.datafilter == null) { - string path = imageFilter.GetParentFolder() + Path.PathSeparator + winpathmatch.Groups[1].Value; + string path = imageFilter.GetParentFolder() + Path.PathSeparator + + winpathmatch.Groups[1].Value; currentfile.datafilter = filtersList.GetFilter(path); if(currentfile.datafilter == null) - throw new FeatureUnsupportedImageException(string.Format("File \"{0}\" not found.", MatchFile.Groups[1].Value)); + throw new + FeatureUnsupportedImageException(string + .Format("File \"{0}\" not found.", + MatchFile + .Groups[1].Value)); } } else - throw new FeatureUnsupportedImageException(string.Format("File \"{0}\" not found.", MatchFile.Groups[1].Value)); + throw new + FeatureUnsupportedImageException(string.Format("File \"{0}\" not found.", + MatchFile.Groups[1].Value)); } else { @@ -671,24 +685,31 @@ namespace DiscImageChef.ImagePlugins currentfile.datafilter = filtersList.GetFilter(path); if(currentfile.datafilter == null) - throw new FeatureUnsupportedImageException(string.Format("File \"{0}\" not found.", MatchFile.Groups[1].Value)); + throw new + FeatureUnsupportedImageException(string.Format("File \"{0}\" not found.", + MatchFile.Groups[1].Value)); } } // File does exist, process it - DicConsole.DebugWriteLine("CDRWin plugin", "File \"{0}\" found", currentfile.datafilter.GetFilename()); + DicConsole.DebugWriteLine("CDRWin plugin", "File \"{0}\" found", + currentfile.datafilter.GetFilename()); switch(currentfile.filetype) { - case CDRWinDiskTypeLittleEndian: - break; + case CDRWinDiskTypeLittleEndian: break; case CDRWinDiskTypeBigEndian: case CDRWinDiskTypeAIFF: case CDRWinDiskTypeRIFF: case CDRWinDiskTypeMP3: - throw new FeatureSupportedButNotImplementedImageException(string.Format("Unsupported file type {0}", currentfile.filetype)); + throw new + FeatureSupportedButNotImplementedImageException(string + .Format("Unsupported file type {0}", + currentfile + .filetype)); default: - throw new FeatureUnsupportedImageException(string.Format("Unknown file type {0}", currentfile.filetype)); + throw new FeatureUnsupportedImageException(string.Format("Unknown file type {0}", + currentfile.filetype)); } currentfile.offset = 0; @@ -698,7 +719,10 @@ namespace DiscImageChef.ImagePlugins { DicConsole.DebugWriteLine("CDRWin plugin", "Found FLAGS at line {0}", line); if(!intrack) - throw new FeatureUnsupportedImageException(string.Format("Found FLAGS field in incorrect place at line {0}", line)); + throw new + FeatureUnsupportedImageException(string + .Format("Found FLAGS field in incorrect place at line {0}", + line)); currenttrack.flag_dcp |= MatchFile.Groups["dcp"].Value == "DCP"; currenttrack.flag_4ch |= MatchFile.Groups["quad"].Value == "4CH"; @@ -708,39 +732,53 @@ namespace DiscImageChef.ImagePlugins else if(MatchGenre.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found GENRE at line {0}", line); - if(intrack) - currenttrack.genre = MatchGenre.Groups[1].Value; - else - discimage.genre = MatchGenre.Groups[1].Value; + if(intrack) currenttrack.genre = MatchGenre.Groups[1].Value; + else discimage.genre = MatchGenre.Groups[1].Value; } else if(MatchIndex.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found INDEX at line {0}", line); if(!intrack) - throw new FeatureUnsupportedImageException(string.Format("Found INDEX before a track {0}", line)); + throw new + FeatureUnsupportedImageException(string.Format("Found INDEX before a track {0}", + line)); else { int index = int.Parse(MatchIndex.Groups[1].Value); ulong offset = CDRWinMSFToLBA(MatchIndex.Groups[2].Value); if((index != 0 && index != 1) && currenttrack.indexes.Count == 0) - throw new FeatureUnsupportedImageException(string.Format("Found INDEX {0} before INDEX 00 or INDEX 01", index)); + throw new + FeatureUnsupportedImageException(string + .Format("Found INDEX {0} before INDEX 00 or INDEX 01", + index)); if((index == 0 || (index == 1 && !currenttrack.indexes.ContainsKey(0)))) { if((int)(currenttrack.sequence - 2) >= 0 && offset > 1) { cuetracks[currenttrack.sequence - 2].sectors = offset - currentfileoffsetsector; - currentfile.offset += cuetracks[currenttrack.sequence - 2].sectors * cuetracks[currenttrack.sequence - 2].bps; - DicConsole.DebugWriteLine("CDRWin plugin", "Sets currentfile.offset to {0} at line 553", currentfile.offset); - DicConsole.DebugWriteLine("CDRWin plugin", "cuetracks[currenttrack.sequence-2].sectors = {0}", cuetracks[currenttrack.sequence - 2].sectors); - DicConsole.DebugWriteLine("CDRWin plugin", "cuetracks[currenttrack.sequence-2].bps = {0}", cuetracks[currenttrack.sequence - 2].bps); + currentfile.offset += + cuetracks[currenttrack.sequence - 2].sectors * + cuetracks[currenttrack.sequence - 2].bps; + DicConsole.DebugWriteLine("CDRWin plugin", + "Sets currentfile.offset to {0} at line 553", + currentfile.offset); + DicConsole.DebugWriteLine("CDRWin plugin", + "cuetracks[currenttrack.sequence-2].sectors = {0}", + cuetracks[currenttrack.sequence - 2].sectors); + DicConsole.DebugWriteLine("CDRWin plugin", + "cuetracks[currenttrack.sequence-2].bps = {0}", + cuetracks[currenttrack.sequence - 2].bps); } } - if((index == 0 || (index == 1 && !currenttrack.indexes.ContainsKey(0))) && currenttrack.sequence == 1) + if((index == 0 || (index == 1 && !currenttrack.indexes.ContainsKey(0))) && + currenttrack.sequence == 1) { - DicConsole.DebugWriteLine("CDRWin plugin", "Sets currentfile.offset to {0} at line 559", offset * currenttrack.bps); + DicConsole.DebugWriteLine("CDRWin plugin", + "Sets currentfile.offset to {0} at line 559", + offset * currenttrack.bps); currentfile.offset = offset * currenttrack.bps; } @@ -752,66 +790,69 @@ namespace DiscImageChef.ImagePlugins { DicConsole.DebugWriteLine("CDRWin plugin", "Found ISRC at line {0}", line); if(!intrack) - throw new FeatureUnsupportedImageException(string.Format("Found ISRC before a track {0}", line)); + throw new + FeatureUnsupportedImageException(string.Format("Found ISRC before a track {0}", + line)); + currenttrack.isrc = MatchISRC.Groups[1].Value; } else if(MatchMCN.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found CATALOG at line {0}", line); - if(!intrack) - discimage.mcn = MatchMCN.Groups[1].Value; + if(!intrack) discimage.mcn = MatchMCN.Groups[1].Value; else - throw new FeatureUnsupportedImageException(string.Format("Found CATALOG field in incorrect place at line {0}", line)); + throw new + FeatureUnsupportedImageException(string + .Format("Found CATALOG field in incorrect place at line {0}", + line)); } else if(MatchPerformer.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found PERFORMER at line {0}", line); - if(intrack) - currenttrack.performer = MatchPerformer.Groups[1].Value; - else - discimage.performer = MatchPerformer.Groups[1].Value; + if(intrack) currenttrack.performer = MatchPerformer.Groups[1].Value; + else discimage.performer = MatchPerformer.Groups[1].Value; } else if(MatchPostgap.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found POSTGAP at line {0}", line); - if(intrack) - { - currenttrack.postgap = CDRWinMSFToLBA(MatchPostgap.Groups[1].Value); - } + if(intrack) { currenttrack.postgap = CDRWinMSFToLBA(MatchPostgap.Groups[1].Value); } else - throw new FeatureUnsupportedImageException(string.Format("Found POSTGAP field before a track at line {0}", line)); + throw new + FeatureUnsupportedImageException(string + .Format("Found POSTGAP field before a track at line {0}", + line)); } else if(MatchPregap.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found PREGAP at line {0}", line); - if(intrack) - { - currenttrack.pregap = CDRWinMSFToLBA(MatchPregap.Groups[1].Value); - } + if(intrack) { currenttrack.pregap = CDRWinMSFToLBA(MatchPregap.Groups[1].Value); } else - throw new FeatureUnsupportedImageException(string.Format("Found PREGAP field before a track at line {0}", line)); + throw new + FeatureUnsupportedImageException(string + .Format("Found PREGAP field before a track at line {0}", + line)); } else if(MatchSongWriter.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found SONGWRITER at line {0}", line); - if(intrack) - currenttrack.songwriter = MatchSongWriter.Groups[1].Value; - else - discimage.songwriter = MatchSongWriter.Groups[1].Value; + if(intrack) currenttrack.songwriter = MatchSongWriter.Groups[1].Value; + else discimage.songwriter = MatchSongWriter.Groups[1].Value; } else if(MatchTitle.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found TITLE at line {0}", line); - if(intrack) - currenttrack.title = MatchTitle.Groups[1].Value; - else - discimage.title = MatchTitle.Groups[1].Value; + if(intrack) currenttrack.title = MatchTitle.Groups[1].Value; + else discimage.title = MatchTitle.Groups[1].Value; } else if(MatchTrack.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found TRACK at line {0}", line); if(currentfile.datafilter == null) - throw new FeatureUnsupportedImageException(string.Format("Found TRACK field before a file is defined at line {0}", line)); + throw new + FeatureUnsupportedImageException(string + .Format("Found TRACK field before a file is defined at line {0}", + line)); + if(intrack) { if(currenttrack.indexes.ContainsKey(0) && currenttrack.pregap == 0) @@ -825,7 +866,8 @@ namespace DiscImageChef.ImagePlugins currenttrack = new CDRWinTrack(); currenttrack.indexes = new Dictionary<int, ulong>(); currenttrack.sequence = uint.Parse(MatchTrack.Groups[1].Value); - DicConsole.DebugWriteLine("CDRWin plugin", "Setting currenttrack.sequence to {0}", currenttrack.sequence); + DicConsole.DebugWriteLine("CDRWin plugin", "Setting currenttrack.sequence to {0}", + currenttrack.sequence); currentfile.sequence = currenttrack.sequence; currenttrack.bps = CDRWinTrackTypeToBytesPerSector(MatchTrack.Groups[2].Value); currenttrack.tracktype = MatchTrack.Groups[2].Value; @@ -833,12 +875,13 @@ namespace DiscImageChef.ImagePlugins intrack = true; } else if(_line == "") // Empty line, ignore it - { - - } + { } else // Non-empty unknown field { - throw new FeatureUnsupportedImageException(string.Format("Found unknown field defined at line {0}: \"{1}\"", line, _line)); + throw new + FeatureUnsupportedImageException(string + .Format("Found unknown field defined at line {0}: \"{1}\"", + line, _line)); } } } @@ -847,7 +890,8 @@ namespace DiscImageChef.ImagePlugins { currentfile.sequence = currenttrack.sequence; currenttrack.trackfile = currentfile; - currenttrack.sectors = ((ulong)currentfile.datafilter.GetLength() - currentfile.offset) / CDRWinTrackTypeToBytesPerSector(currenttrack.tracktype); + currenttrack.sectors = ((ulong)currentfile.datafilter.GetLength() - currentfile.offset) / + CDRWinTrackTypeToBytesPerSector(currenttrack.tracktype); cuetracks[currenttrack.sequence - 1] = currenttrack; } @@ -856,10 +900,8 @@ namespace DiscImageChef.ImagePlugins { _sessions[s - 1].SessionSequence = 1; - if(s > 1) - _sessions[s - 1].StartSector = _sessions[s - 2].EndSector + 1; - else - _sessions[s - 1].StartSector = 0; + if(s > 1) _sessions[s - 1].StartSector = _sessions[s - 2].EndSector + 1; + else _sessions[s - 1].StartSector = 0; ulong session_sectors = 0; int last_session_track = 0; @@ -869,8 +911,7 @@ namespace DiscImageChef.ImagePlugins if(cuetracks[i].session == s) { session_sectors += cuetracks[i].sectors; - if(i > last_session_track) - last_session_track = i; + if(i > last_session_track) last_session_track = i; } } @@ -878,11 +919,9 @@ namespace DiscImageChef.ImagePlugins _sessions[s - 1].EndSector = session_sectors - 1; } - for(int s = 1; s <= _sessions.Length; s++) - discimage.sessions.Add(_sessions[s - 1]); + for(int s = 1; s <= _sessions.Length; s++) discimage.sessions.Add(_sessions[s - 1]); - for(int t = 1; t <= cuetracks.Length; t++) - discimage.tracks.Add(cuetracks[t - 1]); + for(int t = 1; t <= cuetracks.Length; t++) discimage.tracks.Add(cuetracks[t - 1]); discimage.disktype = CDRWinIsoBusterDiscTypeToMediaType(discimage.disktypestr); @@ -928,90 +967,67 @@ namespace DiscImageChef.ImagePlugins } } - if(!data && !firstdata) - discimage.disktype = MediaType.CDDA; - else if(cdg) - discimage.disktype = MediaType.CDG; - else if(cdi) - discimage.disktype = MediaType.CDI; + if(!data && !firstdata) discimage.disktype = MediaType.CDDA; + else if(cdg) discimage.disktype = MediaType.CDG; + else if(cdi) discimage.disktype = MediaType.CDI; else if(firstaudio && data && discimage.sessions.Count > 1 && mode2) discimage.disktype = MediaType.CDPLUS; - else if((firstdata && audio) || mode2) - discimage.disktype = MediaType.CDROMXA; - else if(!audio) - discimage.disktype = MediaType.CDROM; - else - discimage.disktype = MediaType.CD; + else if((firstdata && audio) || mode2) discimage.disktype = MediaType.CDROMXA; + else if(!audio) discimage.disktype = MediaType.CDROM; + else discimage.disktype = MediaType.CD; } // DEBUG information DicConsole.DebugWriteLine("CDRWin plugin", "Disc image parsing results"); DicConsole.DebugWriteLine("CDRWin plugin", "Disc CD-TEXT:"); - if(discimage.arranger == null) - DicConsole.DebugWriteLine("CDRWin plugin", "\tArranger is not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\tArranger: {0}", discimage.arranger); - if(discimage.composer == null) - DicConsole.DebugWriteLine("CDRWin plugin", "\tComposer is not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\tComposer: {0}", discimage.composer); - if(discimage.genre == null) - DicConsole.DebugWriteLine("CDRWin plugin", "\tGenre is not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\tGenre: {0}", discimage.genre); - if(discimage.performer == null) - DicConsole.DebugWriteLine("CDRWin plugin", "\tPerformer is not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\tPerformer: {0}", discimage.performer); - if(discimage.songwriter == null) - DicConsole.DebugWriteLine("CDRWin plugin", "\tSongwriter is not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\tSongwriter: {0}", discimage.songwriter); - if(discimage.title == null) - DicConsole.DebugWriteLine("CDRWin plugin", "\tTitle is not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\tTitle: {0}", discimage.title); + if(discimage.arranger == null) DicConsole.DebugWriteLine("CDRWin plugin", "\tArranger is not set."); + else DicConsole.DebugWriteLine("CDRWin plugin", "\tArranger: {0}", discimage.arranger); + if(discimage.composer == null) DicConsole.DebugWriteLine("CDRWin plugin", "\tComposer is not set."); + else DicConsole.DebugWriteLine("CDRWin plugin", "\tComposer: {0}", discimage.composer); + if(discimage.genre == null) DicConsole.DebugWriteLine("CDRWin plugin", "\tGenre is not set."); + else DicConsole.DebugWriteLine("CDRWin plugin", "\tGenre: {0}", discimage.genre); + if(discimage.performer == null) DicConsole.DebugWriteLine("CDRWin plugin", "\tPerformer is not set."); + else DicConsole.DebugWriteLine("CDRWin plugin", "\tPerformer: {0}", discimage.performer); + if(discimage.songwriter == null) DicConsole.DebugWriteLine("CDRWin plugin", "\tSongwriter is not set."); + else DicConsole.DebugWriteLine("CDRWin plugin", "\tSongwriter: {0}", discimage.songwriter); + if(discimage.title == null) DicConsole.DebugWriteLine("CDRWin plugin", "\tTitle is not set."); + else DicConsole.DebugWriteLine("CDRWin plugin", "\tTitle: {0}", discimage.title); if(discimage.cdtextfile == null) DicConsole.DebugWriteLine("CDRWin plugin", "\tCD-TEXT binary file not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\tCD-TEXT binary file: {0}", discimage.cdtextfile); + else DicConsole.DebugWriteLine("CDRWin plugin", "\tCD-TEXT binary file: {0}", discimage.cdtextfile); DicConsole.DebugWriteLine("CDRWin plugin", "Disc information:"); if(discimage.disktypestr == null) DicConsole.DebugWriteLine("CDRWin plugin", "\tISOBuster disc type not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\tISOBuster disc type: {0}", discimage.disktypestr); + else DicConsole.DebugWriteLine("CDRWin plugin", "\tISOBuster disc type: {0}", discimage.disktypestr); DicConsole.DebugWriteLine("CDRWin plugin", "\tGuessed disk type: {0}", discimage.disktype); - if(discimage.barcode == null) - DicConsole.DebugWriteLine("CDRWin plugin", "\tBarcode not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\tBarcode: {0}", discimage.barcode); - if(discimage.disk_id == null) - DicConsole.DebugWriteLine("CDRWin plugin", "\tDisc ID not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\tDisc ID: {0}", discimage.disk_id); - if(discimage.mcn == null) - DicConsole.DebugWriteLine("CDRWin plugin", "\tMCN not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\tMCN: {0}", discimage.mcn); - if(discimage.comment == null) - DicConsole.DebugWriteLine("CDRWin plugin", "\tComment not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\tComment: \"{0}\"", discimage.comment); + if(discimage.barcode == null) DicConsole.DebugWriteLine("CDRWin plugin", "\tBarcode not set."); + else DicConsole.DebugWriteLine("CDRWin plugin", "\tBarcode: {0}", discimage.barcode); + if(discimage.disk_id == null) DicConsole.DebugWriteLine("CDRWin plugin", "\tDisc ID not set."); + else DicConsole.DebugWriteLine("CDRWin plugin", "\tDisc ID: {0}", discimage.disk_id); + if(discimage.mcn == null) DicConsole.DebugWriteLine("CDRWin plugin", "\tMCN not set."); + else DicConsole.DebugWriteLine("CDRWin plugin", "\tMCN: {0}", discimage.mcn); + if(discimage.comment == null) DicConsole.DebugWriteLine("CDRWin plugin", "\tComment not set."); + else DicConsole.DebugWriteLine("CDRWin plugin", "\tComment: \"{0}\"", discimage.comment); DicConsole.DebugWriteLine("CDRWin plugin", "Session information:"); DicConsole.DebugWriteLine("CDRWin plugin", "\tDisc contains {0} sessions", discimage.sessions.Count); for(int i = 0; i < discimage.sessions.Count; i++) { DicConsole.DebugWriteLine("CDRWin plugin", "\tSession {0} information:", i + 1); - DicConsole.DebugWriteLine("CDRWin plugin", "\t\tStarting track: {0}", discimage.sessions[i].StartTrack); - DicConsole.DebugWriteLine("CDRWin plugin", "\t\tStarting sector: {0}", discimage.sessions[i].StartSector); + DicConsole.DebugWriteLine("CDRWin plugin", "\t\tStarting track: {0}", + discimage.sessions[i].StartTrack); + DicConsole.DebugWriteLine("CDRWin plugin", "\t\tStarting sector: {0}", + discimage.sessions[i].StartSector); DicConsole.DebugWriteLine("CDRWin plugin", "\t\tEnding track: {0}", discimage.sessions[i].EndTrack); - DicConsole.DebugWriteLine("CDRWin plugin", "\t\tEnding sector: {0}", discimage.sessions[i].EndSector); + DicConsole.DebugWriteLine("CDRWin plugin", "\t\tEnding sector: {0}", + discimage.sessions[i].EndSector); } + DicConsole.DebugWriteLine("CDRWin plugin", "Track information:"); DicConsole.DebugWriteLine("CDRWin plugin", "\tDisc contains {0} tracks", discimage.tracks.Count); for(int i = 0; i < discimage.tracks.Count; i++) { - DicConsole.DebugWriteLine("CDRWin plugin", "\tTrack {0} information:", discimage.tracks[i].sequence); + DicConsole.DebugWriteLine("CDRWin plugin", "\tTrack {0} information:", + discimage.tracks[i].sequence); DicConsole.DebugWriteLine("CDRWin plugin", "\t\t{0} bytes per sector", discimage.tracks[i].bps); DicConsole.DebugWriteLine("CDRWin plugin", "\t\tPregap: {0} sectors", discimage.tracks[i].pregap); @@ -1024,33 +1040,32 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack allows digital copy"); if(discimage.tracks[i].flag_pre) DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack has pre-emphasis applied"); - if(discimage.tracks[i].flag_scms) - DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack has SCMS"); + if(discimage.tracks[i].flag_scms) DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack has SCMS"); - DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack resides in file {0}, type defined as {1}, starting at byte {2}", - discimage.tracks[i].trackfile.datafilter.GetFilename(), discimage.tracks[i].trackfile.filetype, discimage.tracks[i].trackfile.offset); + DicConsole.DebugWriteLine("CDRWin plugin", + "\t\tTrack resides in file {0}, type defined as {1}, starting at byte {2}", + discimage.tracks[i].trackfile.datafilter.GetFilename(), + discimage.tracks[i].trackfile.filetype, + discimage.tracks[i].trackfile.offset); DicConsole.DebugWriteLine("CDRWin plugin", "\t\tIndexes:"); foreach(KeyValuePair<int, ulong> kvp in discimage.tracks[i].indexes) - DicConsole.DebugWriteLine("CDRWin plugin", "\t\t\tIndex {0} starts at sector {1}", kvp.Key, kvp.Value); + DicConsole.DebugWriteLine("CDRWin plugin", "\t\t\tIndex {0} starts at sector {1}", kvp.Key, + kvp.Value); if(discimage.tracks[i].isrc == null) DicConsole.DebugWriteLine("CDRWin plugin", "\t\tISRC is not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\t\tISRC: {0}", discimage.tracks[i].isrc); + else DicConsole.DebugWriteLine("CDRWin plugin", "\t\tISRC: {0}", discimage.tracks[i].isrc); if(discimage.tracks[i].arranger == null) DicConsole.DebugWriteLine("CDRWin plugin", "\t\tArranger is not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\t\tArranger: {0}", discimage.tracks[i].arranger); + else DicConsole.DebugWriteLine("CDRWin plugin", "\t\tArranger: {0}", discimage.tracks[i].arranger); if(discimage.tracks[i].composer == null) DicConsole.DebugWriteLine("CDRWin plugin", "\t\tComposer is not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\t\tComposer: {0}", discimage.tracks[i].composer); + else DicConsole.DebugWriteLine("CDRWin plugin", "\t\tComposer: {0}", discimage.tracks[i].composer); if(discimage.tracks[i].genre == null) DicConsole.DebugWriteLine("CDRWin plugin", "\t\tGenre is not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\t\tGenre: {0}", discimage.tracks[i].genre); + else DicConsole.DebugWriteLine("CDRWin plugin", "\t\tGenre: {0}", discimage.tracks[i].genre); if(discimage.tracks[i].performer == null) DicConsole.DebugWriteLine("CDRWin plugin", "\t\tPerformer is not set."); else @@ -1058,11 +1073,11 @@ namespace DiscImageChef.ImagePlugins if(discimage.tracks[i].songwriter == null) DicConsole.DebugWriteLine("CDRWin plugin", "\t\tSongwriter is not set."); else - DicConsole.DebugWriteLine("CDRWin plugin", "\t\tSongwriter: {0}", discimage.tracks[i].songwriter); + DicConsole.DebugWriteLine("CDRWin plugin", "\t\tSongwriter: {0}", + discimage.tracks[i].songwriter); if(discimage.tracks[i].title == null) DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTitle is not set."); - else - DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTitle: {0}", discimage.tracks[i].title); + else DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTitle: {0}", discimage.tracks[i].title); } DicConsole.DebugWriteLine("CDRWin plugin", "Building offset map"); @@ -1123,7 +1138,8 @@ namespace DiscImageChef.ImagePlugins index_zero |= discimage.tracks[i].indexes.TryGetValue(0, out index_zero_offset); if(!discimage.tracks[i].indexes.TryGetValue(1, out index_one_offset)) - throw new ImageNotSupportedException(string.Format("Track {0} lacks index 01", discimage.tracks[i].sequence)); + throw new ImageNotSupportedException(string.Format("Track {0} lacks index 01", + discimage.tracks[i].sequence)); /*if(index_zero && index_one_offset > index_zero_offset) { @@ -1205,28 +1221,24 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("CDRWin plugin", "\tPartition size in bytes: {0}", partition.Size); } - foreach(CDRWinTrack track in discimage.tracks) - ImageInfo.imageSize += track.bps * track.sectors; - foreach(CDRWinTrack track in discimage.tracks) - ImageInfo.sectors += track.sectors; + foreach(CDRWinTrack track in discimage.tracks) ImageInfo.imageSize += track.bps * track.sectors; + foreach(CDRWinTrack track in discimage.tracks) ImageInfo.sectors += track.sectors; - if(discimage.disktype == MediaType.CDG || discimage.disktype == MediaType.CDEG || discimage.disktype == MediaType.CDMIDI) + if(discimage.disktype == MediaType.CDG || discimage.disktype == MediaType.CDEG || + discimage.disktype == MediaType.CDMIDI) ImageInfo.sectorSize = 2448; // CD+G subchannels ARE user data, as CD+G are useless without them - else if(discimage.disktype != MediaType.CDROMXA && discimage.disktype != MediaType.CDDA && discimage.disktype != MediaType.CDI && discimage.disktype != MediaType.CDPLUS) - ImageInfo.sectorSize = 2048; // Only data tracks - else - ImageInfo.sectorSize = 2352; // All others + else if(discimage.disktype != MediaType.CDROMXA && discimage.disktype != MediaType.CDDA && + discimage.disktype != MediaType.CDI && + discimage.disktype != MediaType.CDPLUS) ImageInfo.sectorSize = 2048; // Only data tracks + else ImageInfo.sectorSize = 2352; // All others - if(discimage.mcn != null) - ImageInfo.readableMediaTags.Add(MediaTagType.CD_MCN); - if(discimage.cdtextfile != null) - ImageInfo.readableMediaTags.Add(MediaTagType.CD_TEXT); + if(discimage.mcn != null) ImageInfo.readableMediaTags.Add(MediaTagType.CD_MCN); + if(discimage.cdtextfile != null) ImageInfo.readableMediaTags.Add(MediaTagType.CD_TEXT); // Detect ISOBuster extensions - if(discimage.disktypestr != null || discimage.comment.ToLower().Contains("isobuster") || discimage.sessions.Count > 1) - ImageInfo.imageApplication = "ISOBuster"; - else - ImageInfo.imageApplication = "CDRWin"; + if(discimage.disktypestr != null || discimage.comment.ToLower().Contains("isobuster") || + discimage.sessions.Count > 1) ImageInfo.imageApplication = "ISOBuster"; + else ImageInfo.imageApplication = "CDRWin"; ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); @@ -1243,59 +1255,59 @@ namespace DiscImageChef.ImagePlugins switch(track.tracktype) { case CDRWinTrackTypeAudio: - { - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC); - break; - } + { + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC); + break; + } case CDRWinTrackTypeCDG: - { - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubchannel); - break; - } + { + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubchannel); + break; + } case CDRWinTrackTypeMode2Formless: case CDRWinTrackTypeCDI: - { - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - break; - } + { + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); + break; + } case CDRWinTrackTypeMode2Raw: case CDRWinTrackTypeCDIRaw: - { - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - break; - } + { + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); + break; + } case CDRWinTrackTypeMode1Raw: - { - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - break; - } + { + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); + break; + } } } @@ -1341,20 +1353,19 @@ namespace DiscImageChef.ImagePlugins switch(tag) { case MediaTagType.CD_MCN: - { - if(discimage.mcn != null) - { - return Encoding.ASCII.GetBytes(discimage.mcn); - } - throw new FeatureNotPresentImageException("Image does not contain MCN information."); - } + { + if(discimage.mcn != null) { return Encoding.ASCII.GetBytes(discimage.mcn); } + + throw new FeatureNotPresentImageException("Image does not contain MCN information."); + } case MediaTagType.CD_TEXT: - { - if(discimage.cdtextfile != null) - // TODO: Check that binary text file exists, open it, read it, send it to caller. - throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented"); - throw new FeatureNotPresentImageException("Image does not contain CD-TEXT information."); - } + { + if(discimage.cdtextfile != null) + // TODO: Check that binary text file exists, open it, read it, send it to caller. + throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented"); + + throw new FeatureNotPresentImageException("Image does not contain CD-TEXT information."); + } default: throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format"); } @@ -1439,7 +1450,8 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length > _track.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks"); + throw new ArgumentOutOfRangeException(nameof(length), + "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; @@ -1449,73 +1461,73 @@ namespace DiscImageChef.ImagePlugins { case CDRWinTrackTypeMode1: case CDRWinTrackTypeMode2Form1: - { - sector_offset = 0; - sector_size = 2048; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2048; + sector_skip = 0; + break; + } case CDRWinTrackTypeMode2Form2: - { - sector_offset = 0; - sector_size = 2324; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2324; + sector_skip = 0; + break; + } case CDRWinTrackTypeMode2Formless: case CDRWinTrackTypeCDI: - { - sector_offset = 0; - sector_size = 2336; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2336; + sector_skip = 0; + break; + } case CDRWinTrackTypeAudio: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } case CDRWinTrackTypeMode1Raw: - { - sector_offset = 16; - sector_size = 2048; - sector_skip = 288; - break; - } + { + sector_offset = 16; + sector_size = 2048; + sector_skip = 288; + break; + } case CDRWinTrackTypeMode2Raw: - { - sector_offset = 16; - sector_size = 2336; - sector_skip = 0; - break; - } + { + sector_offset = 16; + sector_size = 2336; + sector_skip = 0; + break; + } case CDRWinTrackTypeCDIRaw: - { - sector_offset = 16; - sector_size = 2336; - sector_skip = 0; - break; - } + { + sector_offset = 16; + sector_size = 2336; + sector_skip = 0; + break; + } case CDRWinTrackTypeCDG: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 96; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 96; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; imageStream = _track.trackfile.datafilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + br.BaseStream + .Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -1550,7 +1562,8 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length > _track.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks"); + throw new ArgumentOutOfRangeException(nameof(length), + "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; @@ -1565,32 +1578,26 @@ namespace DiscImageChef.ImagePlugins case SectorTagType.CDSectorHeader: case SectorTagType.CDSectorSubchannel: case SectorTagType.CDSectorSubHeader: - case SectorTagType.CDSectorSync: - break; + case SectorTagType.CDSectorSync: break; case SectorTagType.CDTrackFlags: - { - byte[] flags = new byte[1]; + { + byte[] flags = new byte[1]; - if(_track.tracktype != CDRWinTrackTypeAudio && _track.tracktype != CDRWinTrackTypeCDG) - flags[0] += 0x40; + if(_track.tracktype != CDRWinTrackTypeAudio && _track.tracktype != CDRWinTrackTypeCDG) + flags[0] += 0x40; - if(_track.flag_dcp) - flags[0] += 0x20; + if(_track.flag_dcp) flags[0] += 0x20; - if(_track.flag_pre) - flags[0] += 0x10; + if(_track.flag_pre) flags[0] += 0x10; - if(_track.flag_4ch) - flags[0] += 0x80; + if(_track.flag_4ch) flags[0] += 0x80; - return flags; - } - case SectorTagType.CDTrackISRC: - return Encoding.UTF8.GetBytes(_track.isrc); + return flags; + } + case SectorTagType.CDTrackISRC: return Encoding.UTF8.GetBytes(_track.isrc); case SectorTagType.CDTrackText: throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented"); - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } switch(_track.tracktype) @@ -1601,115 +1608,115 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentException("No tags in image for requested track", nameof(tag)); case CDRWinTrackTypeMode2Formless: case CDRWinTrackTypeCDI: + { + switch(tag) { - switch(tag) + case SectorTagType.CDSectorSync: + case SectorTagType.CDSectorHeader: + case SectorTagType.CDSectorSubchannel: + case SectorTagType.CDSectorECC: + case SectorTagType.CDSectorECC_P: + case SectorTagType.CDSectorECC_Q: + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + case SectorTagType.CDSectorSubHeader: { - case SectorTagType.CDSectorSync: - case SectorTagType.CDSectorHeader: - case SectorTagType.CDSectorSubchannel: - case SectorTagType.CDSectorECC: - case SectorTagType.CDSectorECC_P: - case SectorTagType.CDSectorECC_Q: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorSubHeader: - { - sector_offset = 0; - sector_size = 8; - sector_skip = 2328; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2332; - sector_size = 4; - sector_skip = 0; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + sector_offset = 0; + sector_size = 8; + sector_skip = 2328; + break; } - break; + case SectorTagType.CDSectorEDC: + { + sector_offset = 2332; + sector_size = 4; + sector_skip = 0; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } + + break; + } case CDRWinTrackTypeAudio: throw new ArgumentException("There are no tags on audio tracks", nameof(tag)); case CDRWinTrackTypeMode1Raw: + { + switch(tag) { - switch(tag) + case SectorTagType.CDSectorSync: { - case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } - case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } - case SectorTagType.CDSectorSubchannel: - case SectorTagType.CDSectorSubHeader: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - sector_skip = 104; - break; - } - case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2064; - sector_size = 4; - sector_skip = 284; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; } - break; + case SectorTagType.CDSectorHeader: + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } + case SectorTagType.CDSectorSubchannel: + case SectorTagType.CDSectorSubHeader: + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + case SectorTagType.CDSectorECC: + { + sector_offset = 2076; + sector_size = 276; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorECC_P: + { + sector_offset = 2076; + sector_size = 172; + sector_skip = 104; + break; + } + case SectorTagType.CDSectorECC_Q: + { + sector_offset = 2248; + sector_size = 104; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2064; + sector_size = 4; + sector_skip = 284; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } + + break; + } case CDRWinTrackTypeMode2Raw: // Requires reading sector case CDRWinTrackTypeCDIRaw: throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented"); case CDRWinTrackTypeCDG: - { - if(tag != SectorTagType.CDSectorSubchannel) - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + { + if(tag != SectorTagType.CDSectorSubchannel) + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - sector_offset = 2352; - sector_size = 96; - sector_skip = 0; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + sector_offset = 2352; + sector_size = 96; + sector_skip = 0; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; imageStream = _track.trackfile.datafilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + br.BaseStream + .Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -1774,7 +1781,8 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length > _track.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks"); + throw new ArgumentOutOfRangeException(nameof(length), + "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; @@ -1784,46 +1792,45 @@ namespace DiscImageChef.ImagePlugins { case CDRWinTrackTypeMode1: case CDRWinTrackTypeMode2Form1: - { - sector_offset = 0; - sector_size = 2048; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2048; + sector_skip = 0; + break; + } case CDRWinTrackTypeMode2Form2: - { - sector_offset = 0; - sector_size = 2324; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2324; + sector_skip = 0; + break; + } case CDRWinTrackTypeMode2Formless: case CDRWinTrackTypeCDI: - { - sector_offset = 0; - sector_size = 2336; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2336; + sector_skip = 0; + break; + } case CDRWinTrackTypeMode1Raw: case CDRWinTrackTypeMode2Raw: case CDRWinTrackTypeCDIRaw: case CDRWinTrackTypeAudio: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } case CDRWinTrackTypeCDG: - { - sector_offset = 0; - sector_size = 2448; - sector_skip = 0; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + { + sector_offset = 0; + sector_size = 2448; + sector_skip = 0; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; @@ -1831,10 +1838,11 @@ namespace DiscImageChef.ImagePlugins imageStream = _track.trackfile.datafilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); + br.BaseStream + .Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -1939,8 +1947,7 @@ namespace DiscImageChef.ImagePlugins _track.TrackSubchannelOffset = cdr_track.trackfile.offset; _track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; } - else - _track.TrackSubchannelType = TrackSubchannelType.None; + else _track.TrackSubchannelType = TrackSubchannelType.None; tracks.Add(_track); previousStartSector = _track.TrackEndSector + 1; @@ -1951,10 +1958,8 @@ namespace DiscImageChef.ImagePlugins public override List<Track> GetSessionTracks(Session session) { - if(discimage.sessions.Contains(session)) - { - return GetSessionTracks(session.SessionSequence); - } + if(discimage.sessions.Contains(session)) { return GetSessionTracks(session.SessionSequence); } + throw new ImageNotSupportedException("Session does not exist in disc image"); } @@ -1990,8 +1995,7 @@ namespace DiscImageChef.ImagePlugins _track.TrackSubchannelOffset = cdr_track.trackfile.offset; _track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; } - else - _track.TrackSubchannelType = TrackSubchannelType.None; + else _track.TrackSubchannelType = TrackSubchannelType.None; tracks.Add(_track); } @@ -2017,7 +2021,8 @@ namespace DiscImageChef.ImagePlugins return Checksums.CDChecksums.CheckCDSector(buffer); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); @@ -2041,14 +2046,14 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length, track); int bps = (int)(buffer.Length / length); @@ -2072,10 +2077,9 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } @@ -2083,11 +2087,9 @@ namespace DiscImageChef.ImagePlugins { return null; } - #endregion #region Private methods - static ulong CDRWinMSFToLBA(string MSF) { string[] MSFElements; @@ -2108,22 +2110,16 @@ namespace DiscImageChef.ImagePlugins switch(trackType) { case CDRWinTrackTypeMode1: - case CDRWinTrackTypeMode2Form1: - return 2048; - case CDRWinTrackTypeMode2Form2: - return 2324; + case CDRWinTrackTypeMode2Form1: return 2048; + case CDRWinTrackTypeMode2Form2: return 2324; case CDRWinTrackTypeMode2Formless: - case CDRWinTrackTypeCDI: - return 2336; + case CDRWinTrackTypeCDI: return 2336; case CDRWinTrackTypeAudio: case CDRWinTrackTypeMode1Raw: case CDRWinTrackTypeMode2Raw: - case CDRWinTrackTypeCDIRaw: - return 2352; - case CDRWinTrackTypeCDG: - return 2448; - default: - return 0; + case CDRWinTrackTypeCDIRaw: return 2352; + case CDRWinTrackTypeCDG: return 2448; + default: return 0; } } @@ -2133,21 +2129,15 @@ namespace DiscImageChef.ImagePlugins { case CDRWinTrackTypeMode1: case CDRWinTrackTypeMode2Form1: - case CDRWinTrackTypeMode1Raw: - return 2048; - case CDRWinTrackTypeMode2Form2: - return 2324; + case CDRWinTrackTypeMode1Raw: return 2048; + case CDRWinTrackTypeMode2Form2: return 2324; case CDRWinTrackTypeMode2Formless: case CDRWinTrackTypeCDI: case CDRWinTrackTypeMode2Raw: - case CDRWinTrackTypeCDIRaw: - return 2336; - case CDRWinTrackTypeAudio: - return 2352; - case CDRWinTrackTypeCDG: - return 2448; - default: - return 0; + case CDRWinTrackTypeCDIRaw: return 2336; + case CDRWinTrackTypeAudio: return 2352; + case CDRWinTrackTypeCDG: return 2448; + default: return 0; } } @@ -2156,22 +2146,16 @@ namespace DiscImageChef.ImagePlugins switch(trackType) { case CDRWinTrackTypeMode1: - case CDRWinTrackTypeMode1Raw: - return TrackType.CDMode1; - case CDRWinTrackTypeMode2Form1: - return TrackType.CDMode2Form1; - case CDRWinTrackTypeMode2Form2: - return TrackType.CDMode2Form2; + case CDRWinTrackTypeMode1Raw: return TrackType.CDMode1; + case CDRWinTrackTypeMode2Form1: return TrackType.CDMode2Form1; + case CDRWinTrackTypeMode2Form2: return TrackType.CDMode2Form2; case CDRWinTrackTypeCDIRaw: case CDRWinTrackTypeCDI: case CDRWinTrackTypeMode2Raw: - case CDRWinTrackTypeMode2Formless: - return TrackType.CDMode2Formless; + case CDRWinTrackTypeMode2Formless: return TrackType.CDMode2Formless; case CDRWinTrackTypeAudio: - case CDRWinTrackTypeCDG: - return TrackType.Audio; - default: - return TrackType.Data; + case CDRWinTrackTypeCDG: return TrackType.Audio; + default: return TrackType.Data; } } @@ -2179,65 +2163,44 @@ namespace DiscImageChef.ImagePlugins { switch(discType) { - case CDRWinDiskTypeCD: - return MediaType.CD; + case CDRWinDiskTypeCD: return MediaType.CD; case CDRWinDiskTypeCDRW: case CDRWinDiskTypeCDMRW: - case CDRWinDiskTypeCDMRW2: - return MediaType.CDRW; - case CDRWinDiskTypeDVD: - return MediaType.DVDROM; + case CDRWinDiskTypeCDMRW2: return MediaType.CDRW; + case CDRWinDiskTypeDVD: return MediaType.DVDROM; case CDRWinDiskTypeDVDPRW: case CDRWinDiskTypeDVDPMRW: - case CDRWinDiskTypeDVDPMRW2: - return MediaType.DVDPRW; + case CDRWinDiskTypeDVDPMRW2: return MediaType.DVDPRW; case CDRWinDiskTypeDVDPRWDL: case CDRWinDiskTypeDVDPMRWDL: - case CDRWinDiskTypeDVDPMRWDL2: - return MediaType.DVDPRWDL; + case CDRWinDiskTypeDVDPMRWDL2: return MediaType.DVDPRWDL; case CDRWinDiskTypeDVDPR: - case CDRWinDiskTypeDVDPVR: - return MediaType.DVDPR; - case CDRWinDiskTypeDVDPRDL: - return MediaType.DVDPRDL; - case CDRWinDiskTypeDVDRAM: - return MediaType.DVDRAM; + case CDRWinDiskTypeDVDPVR: return MediaType.DVDPR; + case CDRWinDiskTypeDVDPRDL: return MediaType.DVDPRDL; + case CDRWinDiskTypeDVDRAM: return MediaType.DVDRAM; case CDRWinDiskTypeDVDVR: - case CDRWinDiskTypeDVDR: - return MediaType.DVDR; - case CDRWinDiskTypeDVDRDL: - return MediaType.DVDRDL; + case CDRWinDiskTypeDVDR: return MediaType.DVDR; + case CDRWinDiskTypeDVDRDL: return MediaType.DVDRDL; case CDRWinDiskTypeDVDRW: case CDRWinDiskTypeDVDRWDL: - case CDRWinDiskTypeDVDRW2: - return MediaType.DVDRW; - case CDRWinDiskTypeHDDVD: - return MediaType.HDDVDROM; - case CDRWinDiskTypeHDDVDRAM: - return MediaType.HDDVDRAM; + case CDRWinDiskTypeDVDRW2: return MediaType.DVDRW; + case CDRWinDiskTypeHDDVD: return MediaType.HDDVDROM; + case CDRWinDiskTypeHDDVDRAM: return MediaType.HDDVDRAM; case CDRWinDiskTypeHDDVDR: - case CDRWinDiskTypeHDDVDRDL: - return MediaType.HDDVDR; + case CDRWinDiskTypeHDDVDRDL: return MediaType.HDDVDR; case CDRWinDiskTypeHDDVDRW: - case CDRWinDiskTypeHDDVDRWDL: - return MediaType.HDDVDRW; - case CDRWinDiskTypeBD: - return MediaType.BDROM; + case CDRWinDiskTypeHDDVDRWDL: return MediaType.HDDVDRW; + case CDRWinDiskTypeBD: return MediaType.BDROM; case CDRWinDiskTypeBDR: - case CDRWinDiskTypeBDRDL: - return MediaType.BDR; + case CDRWinDiskTypeBDRDL: return MediaType.BDR; case CDRWinDiskTypeBDRE: - case CDRWinDiskTypeBDREDL: - return MediaType.BDRE; - default: - return MediaType.Unknown; + case CDRWinDiskTypeBDREDL: return MediaType.BDRE; + default: return MediaType.Unknown; } } - #endregion #region Unsupported features - public override int GetMediaSequence() { return ImageInfo.mediaSequence; @@ -2287,7 +2250,6 @@ namespace DiscImageChef.ImagePlugins { return ImageInfo.imageCreator; } - #endregion } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/CHD.cs b/DiscImageChef.DiscImages/CHD.cs index 5a1997ec..8d1f0874 100644 --- a/DiscImageChef.DiscImages/CHD.cs +++ b/DiscImageChef.DiscImages/CHD.cs @@ -45,2469 +45,2518 @@ using SharpCompress.Compressors.Deflate; namespace DiscImageChef.ImagePlugins { - // TODO: Implement PCMCIA support - public class CHD : ImagePlugin - { - #region Internal Structures - - enum CHDCompression : uint - { - None = 0, - Zlib = 1, - ZlibPlus = 2, - AV = 3 - } - - enum CHDFlags : uint - { - HasParent = 1, - Writable = 2 - } - - enum CHDV3EntryFlags : byte - { - /// <summary>Invalid</summary> - Invalid = 0, - /// <summary>Compressed with primary codec</summary> - Compressed = 1, - /// <summary>Uncompressed</summary> - Uncompressed = 2, - /// <summary>Use offset as data</summary> - Mini = 3, - /// <summary>Same as another hunk in file</summary> - SelfHunk = 4, - /// <summary>Same as another hunk in parent</summary> - ParentHunk = 5, - /// <summary>Compressed with secondary codec (FLAC)</summary> - SecondCompressed = 6 - } - - enum CHDOldTrackType : uint - { - Mode1 = 0, - Mode1_Raw, - Mode2, - Mode2Form1, - Mode2Form2, - Mode2FormMix, - Mode2Raw, - Audio - } - - enum CHDOldSubType : uint - { - Cooked = 0, - Raw, - None - } - - // Hunks are represented in a 64 bit integer with 44 bit as offset, 20 bits as length - // Sectors are fixed at 512 bytes/sector - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CHDHeaderV1 - { - /// <summary> - /// Magic identifier, 'MComprHD' - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] tag; - /// <summary> - /// Length of header - /// </summary> - public uint length; - /// <summary> - /// Image format version - /// </summary> - public uint version; - /// <summary> - /// Image flags, <see cref="CHDFlags"/> - /// </summary> - public uint flags; - /// <summary> - /// Compression algorithm, <see cref="CHDCompression"/> - /// </summary> - public uint compression; - /// <summary> - /// Sectors per hunk - /// </summary> - public uint hunksize; - /// <summary> - /// Total # of hunk in image - /// </summary> - public uint totalhunks; - /// <summary> - /// Cylinders on disk - /// </summary> - public uint cylinders; - /// <summary> - /// Heads per cylinder - /// </summary> - public uint heads; - /// <summary> - /// Sectors per track - /// </summary> - public uint sectors; - /// <summary> - /// MD5 of raw data - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] md5; - /// <summary> - /// MD5 of parent file - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] parentmd5; - } - - // Hunks are represented in a 64 bit integer with 44 bit as offset, 20 bits as length - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CHDHeaderV2 - { - /// <summary> - /// Magic identifier, 'MComprHD' - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] tag; - /// <summary> - /// Length of header - /// </summary> - public uint length; - /// <summary> - /// Image format version - /// </summary> - public uint version; - /// <summary> - /// Image flags, <see cref="CHDFlags"/> - /// </summary> - public uint flags; - /// <summary> - /// Compression algorithm, <see cref="CHDCompression"/> - /// </summary> - public uint compression; - /// <summary> - /// Sectors per hunk - /// </summary> - public uint hunksize; - /// <summary> - /// Total # of hunk in image - /// </summary> - public uint totalhunks; - /// <summary> - /// Cylinders on disk - /// </summary> - public uint cylinders; - /// <summary> - /// Heads per cylinder - /// </summary> - public uint heads; - /// <summary> - /// Sectors per track - /// </summary> - public uint sectors; - /// <summary> - /// MD5 of raw data - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] md5; - /// <summary> - /// MD5 of parent file - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] parentmd5; - /// <summary> - /// Bytes per sector - /// </summary> - public uint seclen; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CHDHeaderV3 - { - /// <summary> - /// Magic identifier, 'MComprHD' - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] tag; - /// <summary> - /// Length of header - /// </summary> - public uint length; - /// <summary> - /// Image format version - /// </summary> - public uint version; - /// <summary> - /// Image flags, <see cref="CHDFlags"/> - /// </summary> - public uint flags; - /// <summary> - /// Compression algorithm, <see cref="CHDCompression"/> - /// </summary> - public uint compression; - /// <summary> - /// Total # of hunk in image - /// </summary> - public uint totalhunks; - /// <summary> - /// Total bytes in image - /// </summary> - public ulong logicalbytes; - /// <summary> - /// Offset to first metadata blob - /// </summary> - public ulong metaoffset; - /// <summary> - /// MD5 of raw data - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] md5; - /// <summary> - /// MD5 of parent file - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] parentmd5; - /// <summary> - /// Bytes per hunk - /// </summary> - public uint hunkbytes; - /// <summary> - /// SHA1 of raw data - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] sha1; - /// <summary> - /// SHA1 of parent file - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] parentsha1; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CHDMapV3Entry - { - /// <summary> - /// Offset to hunk from start of image - /// </summary> - public ulong offset; - /// <summary> - /// CRC32 of uncompressed hunk - /// </summary> - public uint crc; - /// <summary> - /// Lower 16 bits of length - /// </summary> - public ushort lengthLsb; - /// <summary> - /// Upper 8 bits of length - /// </summary> - public byte length; - /// <summary> - /// Hunk flags - /// </summary> - public byte flags; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CHDTrackOld - { - public uint type; - public uint subType; - public uint dataSize; - public uint subSize; - public uint frames; - public uint extraFrames; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CHDHeaderV4 - { - /// <summary> - /// Magic identifier, 'MComprHD' - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] tag; - /// <summary> - /// Length of header - /// </summary> - public uint length; - /// <summary> - /// Image format version - /// </summary> - public uint version; - /// <summary> - /// Image flags, <see cref="CHDFlags"/> - /// </summary> - public uint flags; - /// <summary> - /// Compression algorithm, <see cref="CHDCompression"/> - /// </summary> - public uint compression; - /// <summary> - /// Total # of hunk in image - /// </summary> - public uint totalhunks; - /// <summary> - /// Total bytes in image - /// </summary> - public ulong logicalbytes; - /// <summary> - /// Offset to first metadata blob - /// </summary> - public ulong metaoffset; - /// <summary> - /// Bytes per hunk - /// </summary> - public uint hunkbytes; - /// <summary> - /// SHA1 of raw+meta data - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] sha1; - /// <summary> - /// SHA1 of parent file - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] parentsha1; - /// <summary> - /// SHA1 of raw data - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] rawsha1; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CHDHeaderV5 - { - /// <summary> - /// Magic identifier, 'MComprHD' - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] tag; - /// <summary> - /// Length of header - /// </summary> - public uint length; - /// <summary> - /// Image format version - /// </summary> - public uint version; - /// <summary> - /// Compressor 0 - /// </summary> - public uint compressor0; - /// <summary> - /// Compressor 1 - /// </summary> - public uint compressor1; - /// <summary> - /// Compressor 2 - /// </summary> - public uint compressor2; - /// <summary> - /// Compressor 3 - /// </summary> - public uint compressor3; - /// <summary> - /// Total bytes in image - /// </summary> - public ulong logicalbytes; - /// <summary> - /// Offset to hunk map - /// </summary> - public ulong mapoffset; - /// <summary> - /// Offset to first metadata blob - /// </summary> - public ulong metaoffset; - /// <summary> - /// Bytes per hunk - /// </summary> - public uint hunkbytes; - /// <summary> - /// Bytes per unit within hunk - /// </summary> - public uint unitbytes; - /// <summary> - /// SHA1 of raw data - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] rawsha1; - /// <summary> - /// SHA1 of raw+meta data - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] sha1; - /// <summary> - /// SHA1 of parent file - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] parentsha1; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CHDCompressedMapHeaderV5 - { - /// <summary> - /// Length of compressed map - /// </summary> - public uint length; - /// <summary> - /// Offset of first block (48 bits) and CRC16 of map (16 bits) - /// </summary> - public ulong startAndCrc; - /// <summary> - /// Bits used to encode compressed length on map entry - /// </summary> - public byte bitsUsedToEncodeCompLength; - /// <summary> - /// Bits used to encode self-refs - /// </summary> - public byte bitsUsedToEncodeSelfRefs; - /// <summary> - /// Bits used to encode parent unit refs - /// </summary> - public byte bitsUsedToEncodeParentUnits; - public byte reserved; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CHDMapV5Entry - { - /// <summary> - /// Compression (8 bits) and length (24 bits) - /// </summary> - public uint compAndLength; - /// <summary> - /// Offset (48 bits) and CRC (16 bits) - /// </summary> - public ulong offsetAndCrc; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CHDMetadataHeader - { - public uint tag; - public uint flagsAndLength; - public ulong next; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct HunkSector - { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public ulong[] hunkEntry; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct HunkSectorSmall - { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public uint[] hunkEntry; - } - #endregion - - #region Internal Constants - - /// <summary>"MComprHD"</summary> - readonly byte[] chdTag = { 0x4D, 0x43, 0x6F, 0x6D, 0x70, 0x72, 0x48, 0x44 }; - /// <summary>"GDDD"</summary> - const uint hardDiskMetadata = 0x47444444; - /// <summary>"IDNT"</summary> - const uint hardDiskIdentMetadata = 0x49444E54; - /// <summary>"KEY "</summary> - const uint hardDiskKeyMetadata = 0x4B455920; - /// <summary>"CIS "</summary> - const uint pcmciaCisMetadata = 0x43495320; - /// <summary>"CHCD"</summary> - const uint cdromOldMetadata = 0x43484344; - /// <summary>"CHTR"</summary> - const uint cdromTrackMetadata = 0x43485452; - /// <summary>"CHT2"</summary> - const uint cdromTrackMetadata2 = 0x43485432; - /// <summary>"CHGT"</summary> - const uint gdromOldMetadata = 0x43484754; - /// <summary>"CHGD"</summary> - const uint gdromMetadata = 0x43484744; - /// <summary>"AVAV"</summary> - const uint avMetadata = 0x41564156; - /// <summary>"AVLD"</summary> - const uint avLaserDiscMetadata = 0x41564C44; - - const string hardDiskMetadataRegEx = "CYLS:(?<cylinders>\\d+),HEADS:(?<heads>\\d+),SECS:(?<sectors>\\d+),BPS:(?<bps>\\d+)"; - const string CdromMetadataRegEx = "TRACK:(?<track>\\d+) TYPE:(?<track_type>\\S+) SUBTYPE:(?<sub_type>\\S+) FRAMES:(?<frames>\\d+)"; - const string CdromMetadata2RegEx = "TRACK:(?<track>\\d+) TYPE:(?<track_type>\\S+) SUBTYPE:(?<sub_type>\\S+) FRAMES:(?<frames>\\d+) PREGAP:(?<pregap>\\d+) PGTYPE:(?<pgtype>\\S+) PGSUB:(?<pgsub>\\S+) POSTGAP:(?<postgap>\\d+)"; - const string GdromMetadataRegEx = "TRACK:(?<track>\\d+) TYPE:(?<track_type>\\S+) SUBTYPE:(?<sub_type>\\S+) FRAMES:(?<frames>\\d+) PAD:(?<pad>\\d+) PREGAP:(?<pregap>\\d+) PGTYPE:(?<pgtype>\\S+) PGSUB:(?<pgsub>\\S+) POSTGAP:(?<postgap>\\d+)"; - - const string TrackTypeMode1 = "MODE1"; - const string TrackTypeMode1_2k = "MODE1/2048"; - const string TrackTypeMode1Raw = "MODE1_RAW"; - const string TrackTypeMode1Raw_2k = "MODE1/2352"; - const string TrackTypeMode2 = "MODE2"; - const string TrackTypeMode2_2k = "MODE2/2336"; - const string TrackTypeMode2F1 = "MODE2_FORM1"; - const string TrackTypeMode2F1_2k = "MODE2/2048"; - const string TrackTypeMode2F2 = "MODE2_FORM2"; - const string TrackTypeMode2F2_2k = "MODE2/2324"; - const string TrackTypeMode2FM = "MODE2_FORM_MIX"; - const string TrackTypeMode2Raw = "MODE2_RAW"; - const string TrackTypeMode2Raw_2k = "MODE2/2352"; - const string TrackTypeAudio = "AUDIO"; - - const string SubTypeCooked = "RW"; - const string SubTypeRaw = "RW_RAW"; - const string SubTypeNone = "NONE"; - - #endregion - - #region Internal variables - - ulong[] hunkTable; - uint[] hunkTableSmall; - uint hdrCompression; - uint hdrCompression1; - uint hdrCompression2; - uint hdrCompression3; - Stream imageStream; - uint sectorsPerHunk; - byte[] hunkMap; - uint mapVersion; - uint bytesPerHunk; - uint totalHunks; - byte[] expectedChecksum; - bool isCdrom; - bool isHdd; - bool isGdrom; - bool swapAudio; - - const int MaxCacheSize = 16777216; - int maxBlockCache; - int maxSectorCache; - - Dictionary<ulong, byte[]> sectorCache; - Dictionary<ulong, byte[]> hunkCache; - - Dictionary<uint, Track> tracks; - List<Partition> partitions; - Dictionary<ulong, uint> offsetmap; - - byte[] identify; - byte[] cis; - - #endregion - - public CHD() - { - Name = "MAME Compressed Hunks of Data"; - PluginUUID = new Guid("0D50233A-08BD-47D4-988B-27EAA0358597"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = false; - ImageInfo.imageHasSessions = false; - ImageInfo.imageApplication = "MAME"; - ImageInfo.imageCreator = null; - ImageInfo.imageComments = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaSerialNumber = null; - ImageInfo.mediaBarcode = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - byte[] magic = new byte[8]; - stream.Read(magic, 0, 8); - - return chdTag.SequenceEqual(magic); - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - byte[] buffer = new byte[8]; - byte[] magic = new byte[8]; - stream.Read(magic, 0, 8); - if(!chdTag.SequenceEqual(magic)) - return false; - // Read length - buffer = new byte[4]; - stream.Read(buffer, 0, 4); - uint length = BitConverter.ToUInt32(buffer.Reverse().ToArray(), 0); - buffer = new byte[4]; - stream.Read(buffer, 0, 4); - uint version = BitConverter.ToUInt32(buffer.Reverse().ToArray(), 0); - - buffer = new byte[length]; - stream.Seek(0, SeekOrigin.Begin); - stream.Read(buffer, 0, (int)length); - - ulong nextMetaOff = 0; - - switch(version) - { - case 1: - { - CHDHeaderV1 hdrV1 = BigEndianMarshal.ByteArrayToStructureBigEndian<CHDHeaderV1>(buffer); - - DicConsole.DebugWriteLine("CHD plugin", "hdrV1.tag = \"{0}\"", Encoding.ASCII.GetString(hdrV1.tag)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV1.length = {0} bytes", hdrV1.length); - DicConsole.DebugWriteLine("CHD plugin", "hdrV1.version = {0}", hdrV1.version); - DicConsole.DebugWriteLine("CHD plugin", "hdrV1.flags = {0}", (CHDFlags)hdrV1.flags); - DicConsole.DebugWriteLine("CHD plugin", "hdrV1.compression = {0}", (CHDCompression)hdrV1.compression); - DicConsole.DebugWriteLine("CHD plugin", "hdrV1.hunksize = {0}", hdrV1.hunksize); - DicConsole.DebugWriteLine("CHD plugin", "hdrV1.totalhunks = {0}", hdrV1.totalhunks); - DicConsole.DebugWriteLine("CHD plugin", "hdrV1.cylinders = {0}", hdrV1.cylinders); - DicConsole.DebugWriteLine("CHD plugin", "hdrV1.heads = {0}", hdrV1.heads); - DicConsole.DebugWriteLine("CHD plugin", "hdrV1.sectors = {0}", hdrV1.sectors); - DicConsole.DebugWriteLine("CHD plugin", "hdrV1.md5 = {0}", ArrayHelpers.ByteArrayToHex(hdrV1.md5)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV1.parentmd5 = {0}", ArrayHelpers.ArrayIsNullOrEmpty(hdrV1.parentmd5) ? "null" : ArrayHelpers.ByteArrayToHex(hdrV1.parentmd5)); - - DicConsole.DebugWriteLine("CHD plugin", "Reading Hunk map."); - DateTime start = DateTime.UtcNow; - - hunkTable = new ulong[hdrV1.totalhunks]; - - uint hunkSectorCount = (uint)Math.Ceiling(((double)hdrV1.totalhunks * 8) / 512); - - byte[] hunkSectorBytes = new byte[512]; - HunkSector hunkSector = new HunkSector(); - - for(int i = 0; i < hunkSectorCount; i++) - { - stream.Read(hunkSectorBytes, 0, 512); - // This does the big-endian trick but reverses the order of elements also - Array.Reverse(hunkSectorBytes); - GCHandle handle = GCHandle.Alloc(hunkSectorBytes, GCHandleType.Pinned); - hunkSector = (HunkSector)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(HunkSector)); - handle.Free(); - // This restores the order of elements - Array.Reverse(hunkSector.hunkEntry); - if(hunkTable.Length >= (i * 512) / 8 + 512 / 8) - Array.Copy(hunkSector.hunkEntry, 0, hunkTable, (i * 512) / 8, 512 / 8); - else - Array.Copy(hunkSector.hunkEntry, 0, hunkTable, (i * 512) / 8, hunkTable.Length - (i * 512) / 8); - } - DateTime end = DateTime.UtcNow; - System.Console.WriteLine("Took {0} seconds", (end - start).TotalSeconds); - - ImageInfo.mediaType = MediaType.GENERIC_HDD; - ImageInfo.sectors = hdrV1.hunksize * hdrV1.totalhunks; - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.sectorSize = 512; - ImageInfo.imageVersion = "1"; - ImageInfo.imageSize = ImageInfo.sectorSize * hdrV1.hunksize * hdrV1.totalhunks; - - totalHunks = hdrV1.totalhunks; - sectorsPerHunk = hdrV1.hunksize; - hdrCompression = hdrV1.compression; - mapVersion = 1; - isHdd = true; - - ImageInfo.cylinders = hdrV1.cylinders; - ImageInfo.heads = hdrV1.heads; - ImageInfo.sectorsPerTrack = hdrV1.sectors; - - break; - } - case 2: - { - CHDHeaderV2 hdrV2 = BigEndianMarshal.ByteArrayToStructureBigEndian<CHDHeaderV2>(buffer); - - DicConsole.DebugWriteLine("CHD plugin", "hdrV2.tag = \"{0}\"", Encoding.ASCII.GetString(hdrV2.tag)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV2.length = {0} bytes", hdrV2.length); - DicConsole.DebugWriteLine("CHD plugin", "hdrV2.version = {0}", hdrV2.version); - DicConsole.DebugWriteLine("CHD plugin", "hdrV2.flags = {0}", (CHDFlags)hdrV2.flags); - DicConsole.DebugWriteLine("CHD plugin", "hdrV2.compression = {0}", (CHDCompression)hdrV2.compression); - DicConsole.DebugWriteLine("CHD plugin", "hdrV2.hunksize = {0}", hdrV2.hunksize); - DicConsole.DebugWriteLine("CHD plugin", "hdrV2.totalhunks = {0}", hdrV2.totalhunks); - DicConsole.DebugWriteLine("CHD plugin", "hdrV2.cylinders = {0}", hdrV2.cylinders); - DicConsole.DebugWriteLine("CHD plugin", "hdrV2.heads = {0}", hdrV2.heads); - DicConsole.DebugWriteLine("CHD plugin", "hdrV2.sectors = {0}", hdrV2.sectors); - DicConsole.DebugWriteLine("CHD plugin", "hdrV2.md5 = {0}", ArrayHelpers.ByteArrayToHex(hdrV2.md5)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV2.parentmd5 = {0}", ArrayHelpers.ArrayIsNullOrEmpty(hdrV2.parentmd5) ? "null" : ArrayHelpers.ByteArrayToHex(hdrV2.parentmd5)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV2.seclen = {0}", hdrV2.seclen); - - DicConsole.DebugWriteLine("CHD plugin", "Reading Hunk map."); - DateTime start = DateTime.UtcNow; - - hunkTable = new ulong[hdrV2.totalhunks]; - - // How many sectors uses the BAT - uint hunkSectorCount = (uint)Math.Ceiling(((double)hdrV2.totalhunks * 8) / 512); - - byte[] hunkSectorBytes = new byte[512]; - HunkSector hunkSector = new HunkSector(); - - for(int i = 0; i < hunkSectorCount; i++) - { - stream.Read(hunkSectorBytes, 0, 512); - // This does the big-endian trick but reverses the order of elements also - Array.Reverse(hunkSectorBytes); - GCHandle handle = GCHandle.Alloc(hunkSectorBytes, GCHandleType.Pinned); - hunkSector = (HunkSector)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(HunkSector)); - handle.Free(); - // This restores the order of elements - Array.Reverse(hunkSector.hunkEntry); - if(hunkTable.Length >= (i * 512) / 8 + 512 / 8) - Array.Copy(hunkSector.hunkEntry, 0, hunkTable, (i * 512) / 8, 512 / 8); - else - Array.Copy(hunkSector.hunkEntry, 0, hunkTable, (i * 512) / 8, hunkTable.Length - (i * 512) / 8); - } - DateTime end = DateTime.UtcNow; - System.Console.WriteLine("Took {0} seconds", (end - start).TotalSeconds); - - ImageInfo.mediaType = MediaType.GENERIC_HDD; - ImageInfo.sectors = hdrV2.hunksize * hdrV2.totalhunks; - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.sectorSize = hdrV2.seclen; - ImageInfo.imageVersion = "2"; - ImageInfo.imageSize = ImageInfo.sectorSize * hdrV2.hunksize * hdrV2.totalhunks; - - totalHunks = hdrV2.totalhunks; - sectorsPerHunk = hdrV2.hunksize; - hdrCompression = hdrV2.compression; - mapVersion = 1; - isHdd = true; - - ImageInfo.cylinders = hdrV2.cylinders; - ImageInfo.heads = hdrV2.heads; - ImageInfo.sectorsPerTrack = hdrV2.sectors; - - break; - } - case 3: - { - CHDHeaderV3 hdrV3 = BigEndianMarshal.ByteArrayToStructureBigEndian<CHDHeaderV3>(buffer); - - DicConsole.DebugWriteLine("CHD plugin", "hdrV3.tag = \"{0}\"", Encoding.ASCII.GetString(hdrV3.tag)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV3.length = {0} bytes", hdrV3.length); - DicConsole.DebugWriteLine("CHD plugin", "hdrV3.version = {0}", hdrV3.version); - DicConsole.DebugWriteLine("CHD plugin", "hdrV3.flags = {0}", (CHDFlags)hdrV3.flags); - DicConsole.DebugWriteLine("CHD plugin", "hdrV3.compression = {0}", (CHDCompression)hdrV3.compression); - DicConsole.DebugWriteLine("CHD plugin", "hdrV3.totalhunks = {0}", hdrV3.totalhunks); - DicConsole.DebugWriteLine("CHD plugin", "hdrV3.logicalbytes = {0}", hdrV3.logicalbytes); - DicConsole.DebugWriteLine("CHD plugin", "hdrV3.metaoffset = {0}", hdrV3.metaoffset); - DicConsole.DebugWriteLine("CHD plugin", "hdrV3.md5 = {0}", ArrayHelpers.ByteArrayToHex(hdrV3.md5)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV3.parentmd5 = {0}", ArrayHelpers.ArrayIsNullOrEmpty(hdrV3.parentmd5) ? "null" : ArrayHelpers.ByteArrayToHex(hdrV3.parentmd5)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV3.hunkbytes = {0}", hdrV3.hunkbytes); - DicConsole.DebugWriteLine("CHD plugin", "hdrV3.sha1 = {0}", ArrayHelpers.ByteArrayToHex(hdrV3.sha1)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV3.parentsha1 = {0}", ArrayHelpers.ArrayIsNullOrEmpty(hdrV3.parentsha1) ? "null" : ArrayHelpers.ByteArrayToHex(hdrV3.parentsha1)); - - DicConsole.DebugWriteLine("CHD plugin", "Reading Hunk map."); - DateTime start = DateTime.UtcNow; - - hunkMap = new byte[hdrV3.totalhunks * 16]; - stream.Read(hunkMap, 0, hunkMap.Length); - - DateTime end = DateTime.UtcNow; - System.Console.WriteLine("Took {0} seconds", (end - start).TotalSeconds); - - nextMetaOff = hdrV3.metaoffset; - - ImageInfo.imageSize = hdrV3.logicalbytes; - ImageInfo.imageVersion = "3"; - - totalHunks = hdrV3.totalhunks; - bytesPerHunk = hdrV3.hunkbytes; - hdrCompression = hdrV3.compression; - mapVersion = 3; - - break; - } - case 4: - { - CHDHeaderV4 hdrV4 = BigEndianMarshal.ByteArrayToStructureBigEndian<CHDHeaderV4>(buffer); - - DicConsole.DebugWriteLine("CHD plugin", "hdrV4.tag = \"{0}\"", Encoding.ASCII.GetString(hdrV4.tag)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV4.length = {0} bytes", hdrV4.length); - DicConsole.DebugWriteLine("CHD plugin", "hdrV4.version = {0}", hdrV4.version); - DicConsole.DebugWriteLine("CHD plugin", "hdrV4.flags = {0}", (CHDFlags)hdrV4.flags); - DicConsole.DebugWriteLine("CHD plugin", "hdrV4.compression = {0}", (CHDCompression)hdrV4.compression); - DicConsole.DebugWriteLine("CHD plugin", "hdrV4.totalhunks = {0}", hdrV4.totalhunks); - DicConsole.DebugWriteLine("CHD plugin", "hdrV4.logicalbytes = {0}", hdrV4.logicalbytes); - DicConsole.DebugWriteLine("CHD plugin", "hdrV4.metaoffset = {0}", hdrV4.metaoffset); - DicConsole.DebugWriteLine("CHD plugin", "hdrV4.hunkbytes = {0}", hdrV4.hunkbytes); - DicConsole.DebugWriteLine("CHD plugin", "hdrV4.sha1 = {0}", ArrayHelpers.ByteArrayToHex(hdrV4.sha1)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV4.parentsha1 = {0}", ArrayHelpers.ArrayIsNullOrEmpty(hdrV4.parentsha1) ? "null" : ArrayHelpers.ByteArrayToHex(hdrV4.parentsha1)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV4.rawsha1 = {0}", ArrayHelpers.ByteArrayToHex(hdrV4.rawsha1)); - - DicConsole.DebugWriteLine("CHD plugin", "Reading Hunk map."); - DateTime start = DateTime.UtcNow; - - hunkMap = new byte[hdrV4.totalhunks * 16]; - stream.Read(hunkMap, 0, hunkMap.Length); - - DateTime end = DateTime.UtcNow; - System.Console.WriteLine("Took {0} seconds", (end - start).TotalSeconds); - - nextMetaOff = hdrV4.metaoffset; - - ImageInfo.imageSize = hdrV4.logicalbytes; - ImageInfo.imageVersion = "4"; - - totalHunks = hdrV4.totalhunks; - bytesPerHunk = hdrV4.hunkbytes; - hdrCompression = hdrV4.compression; - mapVersion = 3; - - break; - } - case 5: - { - CHDHeaderV5 hdrV5 = BigEndianMarshal.ByteArrayToStructureBigEndian<CHDHeaderV5>(buffer); - - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.tag = \"{0}\"", Encoding.ASCII.GetString(hdrV5.tag)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.length = {0} bytes", hdrV5.length); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.version = {0}", hdrV5.version); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.compressor0 = \"{0}\"", Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(hdrV5.compressor0))); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.compressor1 = \"{0}\"", Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(hdrV5.compressor1))); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.compressor2 = \"{0}\"", Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(hdrV5.compressor2))); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.compressor3 = \"{0}\"", Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(hdrV5.compressor3))); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.logicalbytes = {0}", hdrV5.logicalbytes); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.mapoffset = {0}", hdrV5.mapoffset); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.metaoffset = {0}", hdrV5.metaoffset); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.hunkbytes = {0}", hdrV5.hunkbytes); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.unitbytes = {0}", hdrV5.unitbytes); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.sha1 = {0}", ArrayHelpers.ByteArrayToHex(hdrV5.sha1)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.parentsha1 = {0}", ArrayHelpers.ArrayIsNullOrEmpty(hdrV5.parentsha1) ? "null" : ArrayHelpers.ByteArrayToHex(hdrV5.parentsha1)); - DicConsole.DebugWriteLine("CHD plugin", "hdrV5.rawsha1 = {0}", ArrayHelpers.ByteArrayToHex(hdrV5.rawsha1)); - - // TODO: Implement compressed CHD v5 - if(hdrV5.compressor0 == 0) - { - DicConsole.DebugWriteLine("CHD plugin", "Reading Hunk map."); - DateTime start = DateTime.UtcNow; - - hunkTableSmall = new uint[hdrV5.logicalbytes / hdrV5.hunkbytes]; - - uint hunkSectorCount = (uint)Math.Ceiling(((double)hunkTableSmall.Length * 4) / 512); - - byte[] hunkSectorBytes = new byte[512]; - HunkSectorSmall hunkSector = new HunkSectorSmall(); - - stream.Seek((long)hdrV5.mapoffset, SeekOrigin.Begin); - - for(int i = 0; i < hunkSectorCount; i++) - { - stream.Read(hunkSectorBytes, 0, 512); - // This does the big-endian trick but reverses the order of elements also - Array.Reverse(hunkSectorBytes); - GCHandle handle = GCHandle.Alloc(hunkSectorBytes, GCHandleType.Pinned); - hunkSector = (HunkSectorSmall)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(HunkSectorSmall)); - handle.Free(); - // This restores the order of elements - Array.Reverse(hunkSector.hunkEntry); - if(hunkTableSmall.Length >= (i * 512) / 4 + 512 / 4) - Array.Copy(hunkSector.hunkEntry, 0, hunkTableSmall, (i * 512) / 4, 512 / 4); - else - Array.Copy(hunkSector.hunkEntry, 0, hunkTableSmall, (i * 512) / 4, hunkTableSmall.Length - (i * 512) / 4); - } - DateTime end = DateTime.UtcNow; - System.Console.WriteLine("Took {0} seconds", (end - start).TotalSeconds); - } - else - throw new ImageNotSupportedException("Cannot read compressed CHD version 5"); - - nextMetaOff = hdrV5.metaoffset; - - ImageInfo.imageSize = hdrV5.logicalbytes; - ImageInfo.imageVersion = "5"; - - totalHunks = (uint)(hdrV5.logicalbytes / hdrV5.hunkbytes); - bytesPerHunk = hdrV5.hunkbytes; - hdrCompression = hdrV5.compressor0; - hdrCompression1 = hdrV5.compressor1; - hdrCompression2 = hdrV5.compressor2; - hdrCompression3 = hdrV5.compressor3; - mapVersion = 5; - - break; - } - default: - throw new ImageNotSupportedException(string.Format("Unsupported CHD version {0}", version)); - } - - if(mapVersion >= 3) - { - byte[] meta; - isCdrom = false; - isHdd = false; - isGdrom = false; - swapAudio = false; - tracks = new Dictionary<uint, Track>(); - - DicConsole.DebugWriteLine("CHD plugin", "Reading metadata."); - - ulong currentSector = 0; - uint currentTrack = 1; - - while(nextMetaOff > 0) - { - byte[] hdrBytes = new byte[16]; - stream.Seek((long)nextMetaOff, SeekOrigin.Begin); - stream.Read(hdrBytes, 0, hdrBytes.Length); - CHDMetadataHeader header = BigEndianMarshal.ByteArrayToStructureBigEndian<CHDMetadataHeader>(hdrBytes); - meta = new byte[header.flagsAndLength & 0xFFFFFF]; - stream.Read(meta, 0, meta.Length); - DicConsole.DebugWriteLine("CHD plugin", "Found metadata \"{0}\"", Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(header.tag))); - - switch(header.tag) - { - // "GDDD" - case hardDiskMetadata: - if(isCdrom || isGdrom) - throw new ImageNotSupportedException("Image cannot be a hard disk and a C/GD-ROM at the same time, aborting."); - - string gddd = StringHandlers.CToString(meta); - Regex gdddRegEx = new Regex(hardDiskMetadataRegEx); - Match gdddMatch = gdddRegEx.Match(gddd); - if(gdddMatch.Success) - { - isHdd = true; - ImageInfo.sectorSize = uint.Parse(gdddMatch.Groups["bps"].Value); - ImageInfo.cylinders = uint.Parse(gdddMatch.Groups["cylinders"].Value); - ImageInfo.heads = uint.Parse(gdddMatch.Groups["heads"].Value); - ImageInfo.sectorsPerTrack = uint.Parse(gdddMatch.Groups["sectors"].Value); - } - break; - // "CHCD" - case cdromOldMetadata: - if(isHdd) - throw new ImageNotSupportedException("Image cannot be a hard disk and a CD-ROM at the same time, aborting."); - - if(isGdrom) - throw new ImageNotSupportedException("Image cannot be a GD-ROM and a CD-ROM at the same time, aborting."); - - uint _tracks = BigEndianBitConverter.ToUInt32(meta, 0); - - // Byteswapped - if(_tracks > 99) - { - BigEndianBitConverter.IsLittleEndian = !BitConverter.IsLittleEndian; - _tracks = BigEndianBitConverter.ToUInt32(meta, 0); - } - - currentSector = 0; - - for(uint i = 0; i < _tracks; i++) - { - CHDTrackOld _trk = new CHDTrackOld(); - _trk.type = BigEndianBitConverter.ToUInt32(meta, (int)(4 + i * 24 + 0)); - _trk.subType = BigEndianBitConverter.ToUInt32(meta, (int)(4 + i * 24 + 4)); - _trk.dataSize = BigEndianBitConverter.ToUInt32(meta, (int)(4 + i * 24 + 8)); - _trk.subSize = BigEndianBitConverter.ToUInt32(meta, (int)(4 + i * 24 + 12)); - _trk.frames = BigEndianBitConverter.ToUInt32(meta, (int)(4 + i * 24 + 16)); - _trk.extraFrames = BigEndianBitConverter.ToUInt32(meta, (int)(4 + i * 24 + 20)); - - Track _track = new Track(); - switch((CHDOldTrackType)_trk.type) - { - case CHDOldTrackType.Audio: - _track.TrackBytesPerSector = 2352; - _track.TrackRawBytesPerSector = 2352; - _track.TrackType = TrackType.Audio; - break; - case CHDOldTrackType.Mode1: - _track.TrackBytesPerSector = 2048; - _track.TrackRawBytesPerSector = 2048; - _track.TrackType = TrackType.CDMode1; - break; - case CHDOldTrackType.Mode1_Raw: - _track.TrackBytesPerSector = 2048; - _track.TrackRawBytesPerSector = 2352; - _track.TrackType = TrackType.CDMode1; - break; - case CHDOldTrackType.Mode2: - case CHDOldTrackType.Mode2FormMix: - _track.TrackBytesPerSector = 2336; - _track.TrackRawBytesPerSector = 2336; - _track.TrackType = TrackType.CDMode2Formless; - break; - case CHDOldTrackType.Mode2Form1: - _track.TrackBytesPerSector = 2048; - _track.TrackRawBytesPerSector = 2048; - _track.TrackType = TrackType.CDMode2Form1; - break; - case CHDOldTrackType.Mode2Form2: - _track.TrackBytesPerSector = 2324; - _track.TrackRawBytesPerSector = 2324; - _track.TrackType = TrackType.CDMode2Form2; - break; - case CHDOldTrackType.Mode2Raw: - _track.TrackBytesPerSector = 2336; - _track.TrackRawBytesPerSector = 2352; - _track.TrackType = TrackType.CDMode2Formless; - break; - default: - throw new ImageNotSupportedException(string.Format("Unsupported track type {0}", _trk.type)); - } - - switch((CHDOldSubType)_trk.subType) - { - case CHDOldSubType.Cooked: - _track.TrackSubchannelFile = imageFilter.GetFilename(); - _track.TrackSubchannelType = TrackSubchannelType.PackedInterleaved; - _track.TrackSubchannelFilter = imageFilter; - break; - case CHDOldSubType.None: - _track.TrackSubchannelType = TrackSubchannelType.None; - break; - case CHDOldSubType.Raw: - _track.TrackSubchannelFile = imageFilter.GetFilename(); - _track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; - _track.TrackSubchannelFilter = imageFilter; - break; - default: - throw new ImageNotSupportedException(string.Format("Unsupported subchannel type {0}", _trk.type)); - } - - _track.Indexes = new Dictionary<int, ulong>(); - _track.TrackDescription = string.Format("Track {0}", i + 1); - _track.TrackEndSector = currentSector + _trk.frames - 1; - _track.TrackFile = imageFilter.GetFilename(); - _track.TrackFileType = "BINARY"; - _track.TrackFilter = imageFilter; - _track.TrackStartSector = currentSector; - _track.TrackSequence = i + 1; - _track.TrackSession = 1; - currentSector += _trk.frames + _trk.extraFrames; - tracks.Add(_track.TrackSequence, _track); - } - - BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - isCdrom = true; - - break; - // "CHTR" - case cdromTrackMetadata: - if(isHdd) - throw new ImageNotSupportedException("Image cannot be a hard disk and a CD-ROM at the same time, aborting."); - - if(isGdrom) - throw new ImageNotSupportedException("Image cannot be a GD-ROM and a CD-ROM at the same time, aborting."); - - string chtr = StringHandlers.CToString(meta); - Regex chtrRegEx = new Regex(CdromMetadataRegEx); - Match chtrMatch = chtrRegEx.Match(chtr); - if(chtrMatch.Success) - { - isCdrom = true; - - uint trackNo = uint.Parse(chtrMatch.Groups["track"].Value); - uint frames = uint.Parse(chtrMatch.Groups["frames"].Value); - string subtype = chtrMatch.Groups["sub_type"].Value; - string tracktype = chtrMatch.Groups["track_type"].Value; - - if(trackNo != currentTrack) - throw new ImageNotSupportedException("Unsorted tracks, cannot proceed."); - - Track _track = new Track(); - switch(tracktype) - { - case TrackTypeAudio: - _track.TrackBytesPerSector = 2352; - _track.TrackRawBytesPerSector = 2352; - _track.TrackType = TrackType.Audio; - break; - case TrackTypeMode1: - case TrackTypeMode1_2k: - _track.TrackBytesPerSector = 2048; - _track.TrackRawBytesPerSector = 2048; - _track.TrackType = TrackType.CDMode1; - break; - case TrackTypeMode1Raw: - case TrackTypeMode1Raw_2k: - _track.TrackBytesPerSector = 2048; - _track.TrackRawBytesPerSector = 2352; - _track.TrackType = TrackType.CDMode1; - break; - case TrackTypeMode2: - case TrackTypeMode2_2k: - case TrackTypeMode2FM: - _track.TrackBytesPerSector = 2336; - _track.TrackRawBytesPerSector = 2336; - _track.TrackType = TrackType.CDMode2Formless; - break; - case TrackTypeMode2F1: - case TrackTypeMode2F1_2k: - _track.TrackBytesPerSector = 2048; - _track.TrackRawBytesPerSector = 2048; - _track.TrackType = TrackType.CDMode2Form1; - break; - case TrackTypeMode2F2: - case TrackTypeMode2F2_2k: - _track.TrackBytesPerSector = 2324; - _track.TrackRawBytesPerSector = 2324; - _track.TrackType = TrackType.CDMode2Form2; - break; - case TrackTypeMode2Raw: - case TrackTypeMode2Raw_2k: - _track.TrackBytesPerSector = 2336; - _track.TrackRawBytesPerSector = 2352; - _track.TrackType = TrackType.CDMode2Formless; - break; - default: - throw new ImageNotSupportedException(string.Format("Unsupported track type {0}", tracktype)); - } - - switch(subtype) - { - case SubTypeCooked: - _track.TrackSubchannelFile = imageFilter.GetFilename(); - _track.TrackSubchannelType = TrackSubchannelType.PackedInterleaved; - _track.TrackSubchannelFilter = imageFilter; - break; - case SubTypeNone: - _track.TrackSubchannelType = TrackSubchannelType.None; - break; - case SubTypeRaw: - _track.TrackSubchannelFile = imageFilter.GetFilename(); - _track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; - _track.TrackSubchannelFilter = imageFilter; - break; - default: - throw new ImageNotSupportedException(string.Format("Unsupported subchannel type {0}", subtype)); - } - - _track.Indexes = new Dictionary<int, ulong>(); - _track.TrackDescription = string.Format("Track {0}", trackNo); - _track.TrackEndSector = currentSector + frames - 1; - _track.TrackFile = imageFilter.GetFilename(); - _track.TrackFileType = "BINARY"; - _track.TrackFilter = imageFilter; - _track.TrackStartSector = currentSector; - _track.TrackSequence = trackNo; - _track.TrackSession = 1; - currentSector += frames; - currentTrack++; - tracks.Add(_track.TrackSequence, _track); - } - break; - // "CHT2" - case cdromTrackMetadata2: - if(isHdd) - throw new ImageNotSupportedException("Image cannot be a hard disk and a CD-ROM at the same time, aborting."); - - if(isGdrom) - throw new ImageNotSupportedException("Image cannot be a GD-ROM and a CD-ROM at the same time, aborting."); - - string cht2 = StringHandlers.CToString(meta); - Regex cht2RegEx = new Regex(CdromMetadata2RegEx); - Match cht2Match = cht2RegEx.Match(cht2); - if(cht2Match.Success) - { - isCdrom = true; - - uint trackNo = uint.Parse(cht2Match.Groups["track"].Value); - uint frames = uint.Parse(cht2Match.Groups["frames"].Value); - string subtype = cht2Match.Groups["sub_type"].Value; - string tracktype = cht2Match.Groups["track_type"].Value; - // TODO: Check pregap and postgap behaviour - uint pregap = uint.Parse(cht2Match.Groups["pregap"].Value); - string pregapType = cht2Match.Groups["pgtype"].Value; - string pregapSubType = cht2Match.Groups["pgsub"].Value; - uint postgap = uint.Parse(cht2Match.Groups["postgap"].Value); - - if(trackNo != currentTrack) - throw new ImageNotSupportedException("Unsorted tracks, cannot proceed."); - - Track _track = new Track(); - switch(tracktype) - { - case TrackTypeAudio: - _track.TrackBytesPerSector = 2352; - _track.TrackRawBytesPerSector = 2352; - _track.TrackType = TrackType.Audio; - break; - case TrackTypeMode1: - case TrackTypeMode1_2k: - _track.TrackBytesPerSector = 2048; - _track.TrackRawBytesPerSector = 2048; - _track.TrackType = TrackType.CDMode1; - break; - case TrackTypeMode1Raw: - case TrackTypeMode1Raw_2k: - _track.TrackBytesPerSector = 2048; - _track.TrackRawBytesPerSector = 2352; - _track.TrackType = TrackType.CDMode1; - break; - case TrackTypeMode2: - case TrackTypeMode2_2k: - case TrackTypeMode2FM: - _track.TrackBytesPerSector = 2336; - _track.TrackRawBytesPerSector = 2336; - _track.TrackType = TrackType.CDMode2Formless; - break; - case TrackTypeMode2F1: - case TrackTypeMode2F1_2k: - _track.TrackBytesPerSector = 2048; - _track.TrackRawBytesPerSector = 2048; - _track.TrackType = TrackType.CDMode2Form1; - break; - case TrackTypeMode2F2: - case TrackTypeMode2F2_2k: - _track.TrackBytesPerSector = 2324; - _track.TrackRawBytesPerSector = 2324; - _track.TrackType = TrackType.CDMode2Form2; - break; - case TrackTypeMode2Raw: - case TrackTypeMode2Raw_2k: - _track.TrackBytesPerSector = 2336; - _track.TrackRawBytesPerSector = 2352; - _track.TrackType = TrackType.CDMode2Formless; - break; - default: - throw new ImageNotSupportedException(string.Format("Unsupported track type {0}", tracktype)); - } - - switch(subtype) - { - case SubTypeCooked: - _track.TrackSubchannelFile = imageFilter.GetFilename(); - _track.TrackSubchannelType = TrackSubchannelType.PackedInterleaved; - _track.TrackSubchannelFilter = imageFilter; - break; - case SubTypeNone: - _track.TrackSubchannelType = TrackSubchannelType.None; - break; - case SubTypeRaw: - _track.TrackSubchannelFile = imageFilter.GetFilename(); - _track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; - _track.TrackSubchannelFilter = imageFilter; - break; - default: - throw new ImageNotSupportedException(string.Format("Unsupported subchannel type {0}", subtype)); - } - - _track.Indexes = new Dictionary<int, ulong>(); - _track.TrackDescription = string.Format("Track {0}", trackNo); - _track.TrackEndSector = currentSector + frames - 1; - _track.TrackFile = imageFilter.GetFilename(); - _track.TrackFileType = "BINARY"; - _track.TrackFilter = imageFilter; - _track.TrackStartSector = currentSector; - _track.TrackSequence = trackNo; - _track.TrackSession = 1; - currentSector += frames; - currentTrack++; - tracks.Add(_track.TrackSequence, _track); - } - break; - // "CHGT" - case gdromOldMetadata: - swapAudio = true; - goto case gdromMetadata; - // "CHGD" - case gdromMetadata: - if(isHdd) - throw new ImageNotSupportedException("Image cannot be a hard disk and a GD-ROM at the same time, aborting."); - - if(isCdrom) - throw new ImageNotSupportedException("Image cannot be a CD-ROM and a GD-ROM at the same time, aborting."); - - string chgd = StringHandlers.CToString(meta); - Regex chgdRegEx = new Regex(GdromMetadataRegEx); - Match chgdMatch = chgdRegEx.Match(chgd); - if(chgdMatch.Success) - { - isGdrom = true; - - uint trackNo = uint.Parse(chgdMatch.Groups["track"].Value); - uint frames = uint.Parse(chgdMatch.Groups["frames"].Value); - string subtype = chgdMatch.Groups["sub_type"].Value; - string tracktype = chgdMatch.Groups["track_type"].Value; - // TODO: Check pregap, postgap and pad behaviour - uint pregap = uint.Parse(chgdMatch.Groups["pregap"].Value); - string pregapType = chgdMatch.Groups["pgtype"].Value; - string pregapSubType = chgdMatch.Groups["pgsub"].Value; - uint postgap = uint.Parse(chgdMatch.Groups["postgap"].Value); - uint pad = uint.Parse(chgdMatch.Groups["pad"].Value); - - if(trackNo != currentTrack) - throw new ImageNotSupportedException("Unsorted tracks, cannot proceed."); - - Track _track = new Track(); - switch(tracktype) - { - case TrackTypeAudio: - _track.TrackBytesPerSector = 2352; - _track.TrackRawBytesPerSector = 2352; - _track.TrackType = TrackType.Audio; - break; - case TrackTypeMode1: - case TrackTypeMode1_2k: - _track.TrackBytesPerSector = 2048; - _track.TrackRawBytesPerSector = 2048; - _track.TrackType = TrackType.CDMode1; - break; - case TrackTypeMode1Raw: - case TrackTypeMode1Raw_2k: - _track.TrackBytesPerSector = 2048; - _track.TrackRawBytesPerSector = 2352; - _track.TrackType = TrackType.CDMode1; - break; - case TrackTypeMode2: - case TrackTypeMode2_2k: - case TrackTypeMode2FM: - _track.TrackBytesPerSector = 2336; - _track.TrackRawBytesPerSector = 2336; - _track.TrackType = TrackType.CDMode2Formless; - break; - case TrackTypeMode2F1: - case TrackTypeMode2F1_2k: - _track.TrackBytesPerSector = 2048; - _track.TrackRawBytesPerSector = 2048; - _track.TrackType = TrackType.CDMode2Form1; - break; - case TrackTypeMode2F2: - case TrackTypeMode2F2_2k: - _track.TrackBytesPerSector = 2324; - _track.TrackRawBytesPerSector = 2324; - _track.TrackType = TrackType.CDMode2Form2; - break; - case TrackTypeMode2Raw: - case TrackTypeMode2Raw_2k: - _track.TrackBytesPerSector = 2336; - _track.TrackRawBytesPerSector = 2352; - _track.TrackType = TrackType.CDMode2Formless; - break; - default: - throw new ImageNotSupportedException(string.Format("Unsupported track type {0}", tracktype)); - } - - switch(subtype) - { - case SubTypeCooked: - _track.TrackSubchannelFile = imageFilter.GetFilename(); - _track.TrackSubchannelType = TrackSubchannelType.PackedInterleaved; - _track.TrackSubchannelFilter = imageFilter; - break; - case SubTypeNone: - _track.TrackSubchannelType = TrackSubchannelType.None; - break; - case SubTypeRaw: - _track.TrackSubchannelFile = imageFilter.GetFilename(); - _track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; - _track.TrackSubchannelFilter = imageFilter; - break; - default: - throw new ImageNotSupportedException(string.Format("Unsupported subchannel type {0}", subtype)); - } - - _track.Indexes = new Dictionary<int, ulong>(); - _track.TrackDescription = string.Format("Track {0}", trackNo); - _track.TrackEndSector = currentSector + frames - 1; - _track.TrackFile = imageFilter.GetFilename(); - _track.TrackFileType = "BINARY"; - _track.TrackFilter = imageFilter; - _track.TrackStartSector = currentSector; - _track.TrackSequence = trackNo; - _track.TrackSession = (ushort)(trackNo > 2 ? 2 : 1); - currentSector += frames; - currentTrack++; - tracks.Add(_track.TrackSequence, _track); - } - break; - // "IDNT" - case hardDiskIdentMetadata: - Decoders.ATA.Identify.IdentifyDevice? idnt = Decoders.ATA.Identify.Decode(meta); - if(idnt.HasValue) - { - ImageInfo.mediaManufacturer = idnt.Value.MediaManufacturer; - ImageInfo.mediaSerialNumber = idnt.Value.MediaSerial; - ImageInfo.driveModel = idnt.Value.Model; - ImageInfo.driveSerialNumber = idnt.Value.SerialNumber; - ImageInfo.driveFirmwareRevision = idnt.Value.FirmwareRevision; - if(idnt.Value.CurrentCylinders > 0 && idnt.Value.CurrentHeads > 0 && idnt.Value.CurrentSectorsPerTrack > 0) - { - ImageInfo.cylinders = idnt.Value.CurrentCylinders; - ImageInfo.heads = idnt.Value.CurrentHeads; - ImageInfo.sectorsPerTrack = idnt.Value.CurrentSectorsPerTrack; - } - else - { - ImageInfo.cylinders = idnt.Value.Cylinders; - ImageInfo.heads = idnt.Value.Heads; - ImageInfo.sectorsPerTrack = idnt.Value.SectorsPerTrack; - } - } - identify = meta; - if(!ImageInfo.readableMediaTags.Contains(MediaTagType.ATA_IDENTIFY)) - ImageInfo.readableMediaTags.Add(MediaTagType.ATA_IDENTIFY); - break; - case pcmciaCisMetadata: - cis = meta; - if(!ImageInfo.readableMediaTags.Contains(MediaTagType.PCMCIA_CIS)) - ImageInfo.readableMediaTags.Add(MediaTagType.PCMCIA_CIS); - break; - } - - nextMetaOff = header.next; - } - - if(isHdd) - { - sectorsPerHunk = bytesPerHunk / ImageInfo.sectorSize; - ImageInfo.sectors = ImageInfo.imageSize / ImageInfo.sectorSize; - ImageInfo.mediaType = MediaType.GENERIC_HDD; - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - } - else if(isCdrom) - { - // Hardcoded on MAME for CD-ROM - sectorsPerHunk = 8; - ImageInfo.mediaType = MediaType.CDROM; - ImageInfo.xmlMediaType = XmlMediaType.OpticalDisc; - - foreach(Track _trk in tracks.Values) - ImageInfo.sectors += (_trk.TrackEndSector - _trk.TrackStartSector + 1); - } - else if(isGdrom) - { - // Hardcoded on MAME for GD-ROM - sectorsPerHunk = 8; - ImageInfo.mediaType = MediaType.GDROM; - ImageInfo.xmlMediaType = XmlMediaType.OpticalDisc; - - foreach(Track _trk in tracks.Values) - ImageInfo.sectors += (_trk.TrackEndSector - _trk.TrackStartSector + 1); - } - else - throw new ImageNotSupportedException("Image does not represent a known media, aborting"); - } - - if(isCdrom || isGdrom) - { - offsetmap = new Dictionary<ulong, uint>(); - partitions = new List<Partition>(); - ulong partPos = 0; - foreach(Track _track in tracks.Values) - { - Partition partition = new Partition(); - partition.Description = _track.TrackDescription; - partition.Size = (_track.TrackEndSector - _track.TrackStartSector + 1) * (ulong)_track.TrackRawBytesPerSector; - partition.Length = (_track.TrackEndSector - _track.TrackStartSector + 1); - partition.Sequence = _track.TrackSequence; - partition.Offset = partPos; - partition.Start = _track.TrackStartSector; - partition.Type = _track.TrackType.ToString(); - partPos += partition.Length; - offsetmap.Add(_track.TrackStartSector, _track.TrackSequence); - - if(_track.TrackSubchannelType != TrackSubchannelType.None) - { - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubchannel); - } - - switch(_track.TrackType) - { - case TrackType.CDMode1: - case TrackType.CDMode2Form1: - if(_track.TrackRawBytesPerSector == 2352) - { - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - } - break; - case TrackType.CDMode2Form2: - if(_track.TrackRawBytesPerSector == 2352) - { - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - } - break; - case TrackType.CDMode2Formless: - if(_track.TrackRawBytesPerSector == 2352) - { - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - } - break; - } - - if(_track.TrackBytesPerSector > ImageInfo.sectorSize) - ImageInfo.sectorSize = (uint)_track.TrackBytesPerSector; - - partitions.Add(partition); - } - - ImageInfo.imageHasPartitions = true; - ImageInfo.imageHasSessions = true; - } - - maxBlockCache = (int)(MaxCacheSize / (ImageInfo.sectorSize * sectorsPerHunk)); - maxSectorCache = (int)(MaxCacheSize / ImageInfo.sectorSize); - - imageStream = stream; - - sectorCache = new Dictionary<ulong, byte[]>(); - hunkCache = new Dictionary<ulong, byte[]>(); - - // TODO: Detect CompactFlash - // TODO: Get manufacturer and drive name from CIS if applicable - if(cis != null) - ImageInfo.mediaType = MediaType.PCCardTypeI; - - return true; - } - - Track GetTrack(ulong sector) - { - Track track = new Track(); - foreach(KeyValuePair<ulong, uint> kvp in offsetmap) - { - if(sector >= kvp.Key) - tracks.TryGetValue(kvp.Value, out track); - } - return track; - } - - ulong GetAbsoluteSector(ulong relativeSector, uint track) - { - Track _track = new Track(); - tracks.TryGetValue(track, out _track); - return _track.TrackStartSector + relativeSector; - } - - byte[] GetHunk(ulong hunkNo) - { - byte[] hunk; - - if(!hunkCache.TryGetValue(hunkNo, out hunk)) - { - switch(mapVersion) - { - case 1: - ulong offset = (hunkTable[hunkNo] & 0x00000FFFFFFFFFFF); - ulong length = hunkTable[hunkNo] >> 44; - - byte[] compHunk = new byte[length]; - imageStream.Seek((long)offset, SeekOrigin.Begin); - imageStream.Read(compHunk, 0, compHunk.Length); - - if(length == (sectorsPerHunk * ImageInfo.sectorSize)) - { - hunk = compHunk; - } - else if((CHDCompression)hdrCompression > CHDCompression.Zlib) - throw new ImageNotSupportedException(string.Format("Unsupported compression {0}", (CHDCompression)hdrCompression)); - else - { - DeflateStream zStream = new DeflateStream(new MemoryStream(compHunk), CompressionMode.Decompress); - hunk = new byte[sectorsPerHunk * ImageInfo.sectorSize]; - int read = zStream.Read(hunk, 0, (int)(sectorsPerHunk * ImageInfo.sectorSize)); - if(read != sectorsPerHunk * ImageInfo.sectorSize) - throw new IOException(string.Format("Unable to decompress hunk correctly, got {0} bytes, expected {1}", read, sectorsPerHunk * ImageInfo.sectorSize)); - zStream.Close(); - zStream = null; - } - break; - case 3: - byte[] entryBytes = new byte[16]; - Array.Copy(hunkMap, (int)(hunkNo * 16), entryBytes, 0, 16); - CHDMapV3Entry entry = BigEndianMarshal.ByteArrayToStructureBigEndian<CHDMapV3Entry>(entryBytes); - switch((CHDV3EntryFlags)(entry.flags & 0x0F)) - { - case CHDV3EntryFlags.Invalid: - throw new ArgumentException("Invalid hunk found."); - case CHDV3EntryFlags.Compressed: - switch((CHDCompression)hdrCompression) - { - case CHDCompression.None: - goto uncompressedV3; - case CHDCompression.Zlib: - case CHDCompression.ZlibPlus: - if(isHdd) - { - byte[] zHunk = new byte[(entry.lengthLsb << 16) + entry.lengthLsb]; - imageStream.Seek((long)entry.offset, SeekOrigin.Begin); - imageStream.Read(zHunk, 0, zHunk.Length); - DeflateStream zStream = new DeflateStream(new MemoryStream(zHunk), CompressionMode.Decompress); - hunk = new byte[bytesPerHunk]; - int read = zStream.Read(hunk, 0, (int)(bytesPerHunk)); - if(read != bytesPerHunk) - throw new IOException(string.Format("Unable to decompress hunk correctly, got {0} bytes, expected {1}", read, bytesPerHunk)); - zStream.Close(); - zStream = null; - } - // TODO: Guess wth is MAME doing with these hunks - else - throw new ImageNotSupportedException("Compressed CD/GD-ROM hunks are not yet supported"); - break; - case CHDCompression.AV: - throw new ImageNotSupportedException(string.Format("Unsupported compression {0}", (CHDCompression)hdrCompression)); - } - break; - case CHDV3EntryFlags.Uncompressed: - uncompressedV3: - hunk = new byte[bytesPerHunk]; - imageStream.Seek((long)entry.offset, SeekOrigin.Begin); - imageStream.Read(hunk, 0, hunk.Length); - break; - case CHDV3EntryFlags.Mini: - hunk = new byte[bytesPerHunk]; - byte[] mini = new byte[8]; - mini = BigEndianBitConverter.GetBytes(entry.offset); - for(int i = 0; i < bytesPerHunk; i++) - hunk[i] = mini[i % 8]; - break; - case CHDV3EntryFlags.SelfHunk: - return GetHunk(entry.offset); - case CHDV3EntryFlags.ParentHunk: - throw new ImageNotSupportedException("Parent images are not supported"); - case CHDV3EntryFlags.SecondCompressed: - throw new ImageNotSupportedException("FLAC is not supported"); - default: - throw new ImageNotSupportedException(string.Format("Hunk type {0} is not supported", entry.flags & 0xF)); - } - break; - case 5: - if(hdrCompression == 0) - { - hunk = new byte[bytesPerHunk]; - imageStream.Seek(hunkTableSmall[hunkNo] * bytesPerHunk, SeekOrigin.Begin); - imageStream.Read(hunk, 0, hunk.Length); - } - else - throw new ImageNotSupportedException("Compressed v5 hunks not yet supported"); - break; - default: - throw new ImageNotSupportedException(string.Format("Unsupported hunk map version {0}", mapVersion)); - } - - if(hunkCache.Count >= maxBlockCache) - hunkCache.Clear(); - - hunkCache.Add(hunkNo, hunk); - } - - return hunk; - } - - public override bool? VerifySector(ulong sectorAddress) - { - if(isHdd) - return null; - - byte[] buffer = ReadSectorLong(sectorAddress); - return Checksums.CDChecksums.CheckCDSector(buffer); - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - if(isHdd) - throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); - - return VerifySector(GetAbsoluteSector(sectorAddress, track)); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - UnknownLBAs = new List<ulong>(); - FailingLBAs = new List<ulong>(); - if(isHdd) - return null; - - byte[] buffer = ReadSectorsLong(sectorAddress, length); - int bps = (int)(buffer.Length / length); - byte[] sector = new byte[bps]; - - for(int i = 0; i < length; i++) - { - Array.Copy(buffer, i * bps, sector, 0, bps); - bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); - - switch(sectorStatus) - { - case null: - UnknownLBAs.Add((ulong)i + sectorAddress); - break; - case false: - FailingLBAs.Add((ulong)i + sectorAddress); - break; - } - } - - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; - return true; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - UnknownLBAs = new List<ulong>(); - FailingLBAs = new List<ulong>(); - if(isHdd) - return null; - - byte[] buffer = ReadSectorsLong(sectorAddress, length, track); - int bps = (int)(buffer.Length / length); - byte[] sector = new byte[bps]; - - for(int i = 0; i < length; i++) - { - Array.Copy(buffer, i * bps, sector, 0, bps); - bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); - - switch(sectorStatus) - { - case null: - UnknownLBAs.Add((ulong)i + sectorAddress); - break; - case false: - FailingLBAs.Add((ulong)i + sectorAddress); - break; - } - } - - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; - return true; - } - - public override bool? VerifyMediaImage() - { - byte[] calculated; - if(mapVersion >= 3) - { - Checksums.SHA1Context sha1Ctx = new Checksums.SHA1Context(); - sha1Ctx.Init(); - for(uint i = 0; i < totalHunks; i++) - sha1Ctx.Update(GetHunk(i)); - calculated = sha1Ctx.Final(); - } - else - { - Checksums.MD5Context md5Ctx = new Checksums.MD5Context(); - md5Ctx.Init(); - for(uint i = 0; i < totalHunks; i++) - md5Ctx.Update(GetHunk(i)); - calculated = md5Ctx.Final(); - } - - return expectedChecksum.SequenceEqual(calculated); - } - - public override bool ImageHasPartitions() - { - return ImageInfo.imageHasPartitions; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - byte[] sector; - Track track = new Track(); - - if(!sectorCache.TryGetValue(sectorAddress, out sector)) - { - uint sectorSize; - - if(isHdd) - sectorSize = ImageInfo.sectorSize; - else - { - track = GetTrack(sectorAddress); - sectorSize = (uint)track.TrackRawBytesPerSector; - } - - ulong hunkNo = sectorAddress / sectorsPerHunk; - ulong secOff = (sectorAddress * sectorSize) % (sectorsPerHunk * sectorSize); - - byte[] hunk = GetHunk(hunkNo); - - sector = new byte[ImageInfo.sectorSize]; - Array.Copy(hunk, (int)secOff, sector, 0, sector.Length); - - if(sectorCache.Count >= maxSectorCache) - sectorCache.Clear(); - - sectorCache.Add(sectorAddress, sector); - } - - if(isHdd) - return sector; - - uint sector_offset; - uint sector_size; - - switch(track.TrackType) - { - case TrackType.CDMode1: - case TrackType.CDMode2Form1: - { - if(track.TrackRawBytesPerSector == 2352) - { - sector_offset = 16; - sector_size = 2048; - } - else - { - sector_offset = 0; - sector_size = 2048; - } - break; - } - case TrackType.CDMode2Form2: - { - if(track.TrackRawBytesPerSector == 2352) - { - sector_offset = 16; - sector_size = 2324; - } - else - { - sector_offset = 0; - sector_size = 2324; - } - break; - } - case TrackType.CDMode2Formless: - { - if(track.TrackRawBytesPerSector == 2352) - { - sector_offset = 16; - sector_size = 2336; - } - else - { - sector_offset = 0; - sector_size = 2336; - } - break; - } - case TrackType.Audio: - { - sector_offset = 0; - sector_size = 2352; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); - } - - byte[] buffer = new byte[sector_size]; - - if(track.TrackType == TrackType.Audio && swapAudio) - { - for(int i = 0; i < 2352; i += 2) - { - buffer[i + 1] = sector[i]; - buffer[i] = sector[i + 1]; - } - } - else - Array.Copy(sector, sector_offset, buffer, 0, sector_size); - - return buffer; - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - if(isHdd) - throw new FeatureNotPresentImageException("Hard disk images do not have sector tags"); - - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - byte[] sector; - Track track = new Track(); - - if(!sectorCache.TryGetValue(sectorAddress, out sector)) - { - uint sectorSize; - - track = GetTrack(sectorAddress); - sectorSize = (uint)track.TrackRawBytesPerSector; - - ulong hunkNo = sectorAddress / sectorsPerHunk; - ulong secOff = (sectorAddress * sectorSize) % (sectorsPerHunk * sectorSize); - - byte[] hunk = GetHunk(hunkNo); - - sector = new byte[ImageInfo.sectorSize]; - Array.Copy(hunk, (int)secOff, sector, 0, sector.Length); - - if(sectorCache.Count >= maxSectorCache) - sectorCache.Clear(); - - sectorCache.Add(sectorAddress, sector); - } - - if(isHdd) - return sector; - - uint sector_offset; - uint sector_size; - - if(tag == SectorTagType.CDSectorSubchannel) - { - if(track.TrackSubchannelType == TrackSubchannelType.None) - throw new FeatureNotPresentImageException("Requested sector does not contain subchannel"); - else if(track.TrackSubchannelType == TrackSubchannelType.RawInterleaved) - { - sector_offset = (uint)track.TrackRawBytesPerSector; - sector_size = 96; - } - else - throw new FeatureSupportedButNotImplementedImageException(string.Format("Unsupported subchannel type {0}", track.TrackSubchannelType)); - } - else - { - switch(track.TrackType) - { - case TrackType.CDMode1: - case TrackType.CDMode2Form1: - { - if(track.TrackRawBytesPerSector == 2352) - { - switch(tag) - { - case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - break; - } - case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - break; - } - case SectorTagType.CDSectorSubHeader: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - break; - } - case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - break; - } - case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2064; - sector_size = 4; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - } - else - throw new FeatureNotPresentImageException("Requested sector does not contain tags"); - break; - } - case TrackType.CDMode2Form2: - { - if(track.TrackRawBytesPerSector == 2352) - { - switch(tag) - { - case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - break; - } - case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - break; - } - case SectorTagType.CDSectorSubHeader: - { - sector_offset = 16; - sector_size = 8; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2348; - sector_size = 4; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - } - else - { - switch(tag) - { - case SectorTagType.CDSectorSync: - case SectorTagType.CDSectorHeader: - case SectorTagType.CDSectorSubchannel: - case SectorTagType.CDSectorECC: - case SectorTagType.CDSectorECC_P: - case SectorTagType.CDSectorECC_Q: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorSubHeader: - { - sector_offset = 0; - sector_size = 8; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2332; - sector_size = 4; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - } - break; - } - case TrackType.CDMode2Formless: - { - if(track.TrackRawBytesPerSector == 2352) - { - switch(tag) - { - case SectorTagType.CDSectorSync: - case SectorTagType.CDSectorHeader: - case SectorTagType.CDSectorECC: - case SectorTagType.CDSectorECC_P: - case SectorTagType.CDSectorECC_Q: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorSubHeader: - { - sector_offset = 0; - sector_size = 8; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2332; - sector_size = 4; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - } - else - throw new FeatureNotPresentImageException("Requested sector does not contain tags"); - break; - } - case TrackType.Audio: - throw new FeatureNotPresentImageException("Requested sector does not contain tags"); - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); - } - } - - byte[] buffer = new byte[sector_size]; - - if(track.TrackType == TrackType.Audio && swapAudio) - { - for(int i = 0; i < 2352; i += 2) - { - buffer[i + 1] = sector[i]; - buffer[i] = sector[i + 1]; - } - } - else - Array.Copy(sector, sector_offset, buffer, 0, sector_size); - - if(track.TrackType == TrackType.Audio && swapAudio) - { - for(int i = 0; i < 2352; i += 2) - { - buffer[i + 1] = sector[i]; - buffer[i] = sector[i + 1]; - } - } - else - Array.Copy(sector, sector_offset, buffer, 0, sector_size); - - return buffer; - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than available ({1})", sectorAddress + length, ImageInfo.sectors)); - - MemoryStream ms = new MemoryStream(); - - for(uint i = 0; i < length; i++) - { - byte[] sector = ReadSector(sectorAddress + i); - ms.Write(sector, 0, sector.Length); - } - - return ms.ToArray(); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than available ({1})", sectorAddress + length, ImageInfo.sectors)); - - MemoryStream ms = new MemoryStream(); - - for(uint i = 0; i < length; i++) - { - byte[] sector = ReadSectorTag(sectorAddress + i, tag); - ms.Write(sector, 0, sector.Length); - } - - return ms.ToArray(); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - if(isHdd) - return ReadSector(sectorAddress); - - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - byte[] sector; - Track track = new Track(); - - if(!sectorCache.TryGetValue(sectorAddress, out sector)) - { - uint sectorSize; - - track = GetTrack(sectorAddress); - sectorSize = (uint)track.TrackRawBytesPerSector; - - ulong hunkNo = sectorAddress / sectorsPerHunk; - ulong secOff = (sectorAddress * sectorSize) % (sectorsPerHunk * sectorSize); - - byte[] hunk = GetHunk(hunkNo); - - sector = new byte[ImageInfo.sectorSize]; - Array.Copy(hunk, (int)secOff, sector, 0, sector.Length); - - if(sectorCache.Count >= maxSectorCache) - sectorCache.Clear(); - - sectorCache.Add(sectorAddress, sector); - } - - byte[] buffer = new byte[track.TrackRawBytesPerSector]; - - if(track.TrackType == TrackType.Audio && swapAudio) - { - for(int i = 0; i < 2352; i += 2) - { - buffer[i + 1] = sector[i]; - buffer[i] = sector[i + 1]; - } - } - else - Array.Copy(sector, 0, buffer, 0, track.TrackRawBytesPerSector); - - return buffer; - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than available ({1})", sectorAddress + length, ImageInfo.sectors)); - - MemoryStream ms = new MemoryStream(); - - for(uint i = 0; i < length; i++) - { - byte[] sector = ReadSectorLong(sectorAddress + i); - ms.Write(sector, 0, sector.Length); - } - - return ms.ToArray(); - } - - public override string GetImageFormat() - { - return "Compressed Hunks of Data"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - if(ImageInfo.readableMediaTags.Contains(MediaTagType.ATA_IDENTIFY)) - return identify; - - if(ImageInfo.readableMediaTags.Contains(MediaTagType.PCMCIA_CIS)) - return cis; - - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override string GetMediaManufacturer() - { - return ImageInfo.mediaManufacturer; - } - - public override string GetMediaModel() - { - return ImageInfo.mediaModel; - } - - public override string GetMediaSerialNumber() - { - return ImageInfo.mediaSerialNumber; - } - - public override string GetMediaBarcode() - { - return ImageInfo.mediaBarcode; - } - - public override string GetMediaPartNumber() - { - return ImageInfo.mediaPartNumber; - } - - public override int GetMediaSequence() - { - return ImageInfo.mediaSequence; - } - - public override int GetLastDiskSequence() - { - return ImageInfo.lastMediaSequence; - } - - public override string GetDriveManufacturer() - { - return ImageInfo.driveManufacturer; - } - - public override string GetDriveModel() - { - return ImageInfo.driveModel; - } - - public override string GetDriveSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - - public override List<Partition> GetPartitions() - { - if(isHdd) - throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); - - return partitions; - } - - public override List<Track> GetTracks() - { - if(isHdd) - throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); - - List<Track> _trks = new List<Track>(); - foreach(Track track in tracks.Values) - _trks.Add(track); - - return _trks; - } - - public override List<Track> GetSessionTracks(Session session) - { - if(isHdd) - throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); - - return GetSessionTracks(session.SessionSequence); - } - - public override List<Track> GetSessionTracks(ushort session) - { - if(isHdd) - throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); - - List<Track> _trks = new List<Track>(); - foreach(Track track in tracks.Values) - { - if(track.TrackSession == session) - _trks.Add(track); - } - - return _trks; - } - - public override List<Session> GetSessions() - { - if(isHdd) - throw new FeaturedNotSupportedByDiscImageException("Cannot access optical sessions on a hard disk image"); - - throw new NotImplementedException(); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - if(isHdd) - throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); - - return ReadSector(GetAbsoluteSector(sectorAddress, track)); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - if(isHdd) - throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); - - return ReadSectorTag(GetAbsoluteSector(sectorAddress, track), tag); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - if(isHdd) - throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); - - return ReadSectors(GetAbsoluteSector(sectorAddress, track), length); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - if(isHdd) - throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); - - return ReadSectorsTag(GetAbsoluteSector(sectorAddress, track), length, tag); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - if(isHdd) - throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); - - return ReadSectorLong(GetAbsoluteSector(sectorAddress, track)); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - if(isHdd) - throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); - - return ReadSectorLong(GetAbsoluteSector(sectorAddress, track), length); - } - - #endregion Unsupported features - } -} - + // TODO: Implement PCMCIA support + public class CHD : ImagePlugin + { + #region Internal Structures + enum CHDCompression : uint + { + None = 0, + Zlib = 1, + ZlibPlus = 2, + AV = 3 + } + + enum CHDFlags : uint + { + HasParent = 1, + Writable = 2 + } + + enum CHDV3EntryFlags : byte + { + /// <summary>Invalid</summary> + Invalid = 0, + /// <summary>Compressed with primary codec</summary> + Compressed = 1, + /// <summary>Uncompressed</summary> + Uncompressed = 2, + /// <summary>Use offset as data</summary> + Mini = 3, + /// <summary>Same as another hunk in file</summary> + SelfHunk = 4, + /// <summary>Same as another hunk in parent</summary> + ParentHunk = 5, + /// <summary>Compressed with secondary codec (FLAC)</summary> + SecondCompressed = 6 + } + + enum CHDOldTrackType : uint + { + Mode1 = 0, + Mode1_Raw, + Mode2, + Mode2Form1, + Mode2Form2, + Mode2FormMix, + Mode2Raw, + Audio + } + + enum CHDOldSubType : uint + { + Cooked = 0, + Raw, + None + } + + // Hunks are represented in a 64 bit integer with 44 bit as offset, 20 bits as length + // Sectors are fixed at 512 bytes/sector + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CHDHeaderV1 + { + /// <summary> + /// Magic identifier, 'MComprHD' + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] tag; + /// <summary> + /// Length of header + /// </summary> + public uint length; + /// <summary> + /// Image format version + /// </summary> + public uint version; + /// <summary> + /// Image flags, <see cref="CHDFlags"/> + /// </summary> + public uint flags; + /// <summary> + /// Compression algorithm, <see cref="CHDCompression"/> + /// </summary> + public uint compression; + /// <summary> + /// Sectors per hunk + /// </summary> + public uint hunksize; + /// <summary> + /// Total # of hunk in image + /// </summary> + public uint totalhunks; + /// <summary> + /// Cylinders on disk + /// </summary> + public uint cylinders; + /// <summary> + /// Heads per cylinder + /// </summary> + public uint heads; + /// <summary> + /// Sectors per track + /// </summary> + public uint sectors; + /// <summary> + /// MD5 of raw data + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] md5; + /// <summary> + /// MD5 of parent file + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] parentmd5; + } + + // Hunks are represented in a 64 bit integer with 44 bit as offset, 20 bits as length + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CHDHeaderV2 + { + /// <summary> + /// Magic identifier, 'MComprHD' + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] tag; + /// <summary> + /// Length of header + /// </summary> + public uint length; + /// <summary> + /// Image format version + /// </summary> + public uint version; + /// <summary> + /// Image flags, <see cref="CHDFlags"/> + /// </summary> + public uint flags; + /// <summary> + /// Compression algorithm, <see cref="CHDCompression"/> + /// </summary> + public uint compression; + /// <summary> + /// Sectors per hunk + /// </summary> + public uint hunksize; + /// <summary> + /// Total # of hunk in image + /// </summary> + public uint totalhunks; + /// <summary> + /// Cylinders on disk + /// </summary> + public uint cylinders; + /// <summary> + /// Heads per cylinder + /// </summary> + public uint heads; + /// <summary> + /// Sectors per track + /// </summary> + public uint sectors; + /// <summary> + /// MD5 of raw data + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] md5; + /// <summary> + /// MD5 of parent file + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] parentmd5; + /// <summary> + /// Bytes per sector + /// </summary> + public uint seclen; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CHDHeaderV3 + { + /// <summary> + /// Magic identifier, 'MComprHD' + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] tag; + /// <summary> + /// Length of header + /// </summary> + public uint length; + /// <summary> + /// Image format version + /// </summary> + public uint version; + /// <summary> + /// Image flags, <see cref="CHDFlags"/> + /// </summary> + public uint flags; + /// <summary> + /// Compression algorithm, <see cref="CHDCompression"/> + /// </summary> + public uint compression; + /// <summary> + /// Total # of hunk in image + /// </summary> + public uint totalhunks; + /// <summary> + /// Total bytes in image + /// </summary> + public ulong logicalbytes; + /// <summary> + /// Offset to first metadata blob + /// </summary> + public ulong metaoffset; + /// <summary> + /// MD5 of raw data + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] md5; + /// <summary> + /// MD5 of parent file + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] parentmd5; + /// <summary> + /// Bytes per hunk + /// </summary> + public uint hunkbytes; + /// <summary> + /// SHA1 of raw data + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] sha1; + /// <summary> + /// SHA1 of parent file + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] parentsha1; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CHDMapV3Entry + { + /// <summary> + /// Offset to hunk from start of image + /// </summary> + public ulong offset; + /// <summary> + /// CRC32 of uncompressed hunk + /// </summary> + public uint crc; + /// <summary> + /// Lower 16 bits of length + /// </summary> + public ushort lengthLsb; + /// <summary> + /// Upper 8 bits of length + /// </summary> + public byte length; + /// <summary> + /// Hunk flags + /// </summary> + public byte flags; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CHDTrackOld + { + public uint type; + public uint subType; + public uint dataSize; + public uint subSize; + public uint frames; + public uint extraFrames; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CHDHeaderV4 + { + /// <summary> + /// Magic identifier, 'MComprHD' + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] tag; + /// <summary> + /// Length of header + /// </summary> + public uint length; + /// <summary> + /// Image format version + /// </summary> + public uint version; + /// <summary> + /// Image flags, <see cref="CHDFlags"/> + /// </summary> + public uint flags; + /// <summary> + /// Compression algorithm, <see cref="CHDCompression"/> + /// </summary> + public uint compression; + /// <summary> + /// Total # of hunk in image + /// </summary> + public uint totalhunks; + /// <summary> + /// Total bytes in image + /// </summary> + public ulong logicalbytes; + /// <summary> + /// Offset to first metadata blob + /// </summary> + public ulong metaoffset; + /// <summary> + /// Bytes per hunk + /// </summary> + public uint hunkbytes; + /// <summary> + /// SHA1 of raw+meta data + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] sha1; + /// <summary> + /// SHA1 of parent file + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] parentsha1; + /// <summary> + /// SHA1 of raw data + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] rawsha1; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CHDHeaderV5 + { + /// <summary> + /// Magic identifier, 'MComprHD' + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] tag; + /// <summary> + /// Length of header + /// </summary> + public uint length; + /// <summary> + /// Image format version + /// </summary> + public uint version; + /// <summary> + /// Compressor 0 + /// </summary> + public uint compressor0; + /// <summary> + /// Compressor 1 + /// </summary> + public uint compressor1; + /// <summary> + /// Compressor 2 + /// </summary> + public uint compressor2; + /// <summary> + /// Compressor 3 + /// </summary> + public uint compressor3; + /// <summary> + /// Total bytes in image + /// </summary> + public ulong logicalbytes; + /// <summary> + /// Offset to hunk map + /// </summary> + public ulong mapoffset; + /// <summary> + /// Offset to first metadata blob + /// </summary> + public ulong metaoffset; + /// <summary> + /// Bytes per hunk + /// </summary> + public uint hunkbytes; + /// <summary> + /// Bytes per unit within hunk + /// </summary> + public uint unitbytes; + /// <summary> + /// SHA1 of raw data + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] rawsha1; + /// <summary> + /// SHA1 of raw+meta data + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] sha1; + /// <summary> + /// SHA1 of parent file + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] parentsha1; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CHDCompressedMapHeaderV5 + { + /// <summary> + /// Length of compressed map + /// </summary> + public uint length; + /// <summary> + /// Offset of first block (48 bits) and CRC16 of map (16 bits) + /// </summary> + public ulong startAndCrc; + /// <summary> + /// Bits used to encode compressed length on map entry + /// </summary> + public byte bitsUsedToEncodeCompLength; + /// <summary> + /// Bits used to encode self-refs + /// </summary> + public byte bitsUsedToEncodeSelfRefs; + /// <summary> + /// Bits used to encode parent unit refs + /// </summary> + public byte bitsUsedToEncodeParentUnits; + public byte reserved; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CHDMapV5Entry + { + /// <summary> + /// Compression (8 bits) and length (24 bits) + /// </summary> + public uint compAndLength; + /// <summary> + /// Offset (48 bits) and CRC (16 bits) + /// </summary> + public ulong offsetAndCrc; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CHDMetadataHeader + { + public uint tag; + public uint flagsAndLength; + public ulong next; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct HunkSector + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public ulong[] hunkEntry; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct HunkSectorSmall + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public uint[] hunkEntry; + } + #endregion + + #region Internal Constants + /// <summary>"MComprHD"</summary> + readonly byte[] chdTag = {0x4D, 0x43, 0x6F, 0x6D, 0x70, 0x72, 0x48, 0x44}; + /// <summary>"GDDD"</summary> + const uint hardDiskMetadata = 0x47444444; + /// <summary>"IDNT"</summary> + const uint hardDiskIdentMetadata = 0x49444E54; + /// <summary>"KEY "</summary> + const uint hardDiskKeyMetadata = 0x4B455920; + /// <summary>"CIS "</summary> + const uint pcmciaCisMetadata = 0x43495320; + /// <summary>"CHCD"</summary> + const uint cdromOldMetadata = 0x43484344; + /// <summary>"CHTR"</summary> + const uint cdromTrackMetadata = 0x43485452; + /// <summary>"CHT2"</summary> + const uint cdromTrackMetadata2 = 0x43485432; + /// <summary>"CHGT"</summary> + const uint gdromOldMetadata = 0x43484754; + /// <summary>"CHGD"</summary> + const uint gdromMetadata = 0x43484744; + /// <summary>"AVAV"</summary> + const uint avMetadata = 0x41564156; + /// <summary>"AVLD"</summary> + const uint avLaserDiscMetadata = 0x41564C44; + + const string hardDiskMetadataRegEx = + "CYLS:(?<cylinders>\\d+),HEADS:(?<heads>\\d+),SECS:(?<sectors>\\d+),BPS:(?<bps>\\d+)"; + const string CdromMetadataRegEx = + "TRACK:(?<track>\\d+) TYPE:(?<track_type>\\S+) SUBTYPE:(?<sub_type>\\S+) FRAMES:(?<frames>\\d+)"; + const string CdromMetadata2RegEx = + "TRACK:(?<track>\\d+) TYPE:(?<track_type>\\S+) SUBTYPE:(?<sub_type>\\S+) FRAMES:(?<frames>\\d+) PREGAP:(?<pregap>\\d+) PGTYPE:(?<pgtype>\\S+) PGSUB:(?<pgsub>\\S+) POSTGAP:(?<postgap>\\d+)" + ; + const string GdromMetadataRegEx = + "TRACK:(?<track>\\d+) TYPE:(?<track_type>\\S+) SUBTYPE:(?<sub_type>\\S+) FRAMES:(?<frames>\\d+) PAD:(?<pad>\\d+) PREGAP:(?<pregap>\\d+) PGTYPE:(?<pgtype>\\S+) PGSUB:(?<pgsub>\\S+) POSTGAP:(?<postgap>\\d+)" + ; + + const string TrackTypeMode1 = "MODE1"; + const string TrackTypeMode1_2k = "MODE1/2048"; + const string TrackTypeMode1Raw = "MODE1_RAW"; + const string TrackTypeMode1Raw_2k = "MODE1/2352"; + const string TrackTypeMode2 = "MODE2"; + const string TrackTypeMode2_2k = "MODE2/2336"; + const string TrackTypeMode2F1 = "MODE2_FORM1"; + const string TrackTypeMode2F1_2k = "MODE2/2048"; + const string TrackTypeMode2F2 = "MODE2_FORM2"; + const string TrackTypeMode2F2_2k = "MODE2/2324"; + const string TrackTypeMode2FM = "MODE2_FORM_MIX"; + const string TrackTypeMode2Raw = "MODE2_RAW"; + const string TrackTypeMode2Raw_2k = "MODE2/2352"; + const string TrackTypeAudio = "AUDIO"; + + const string SubTypeCooked = "RW"; + const string SubTypeRaw = "RW_RAW"; + const string SubTypeNone = "NONE"; + #endregion + + #region Internal variables + ulong[] hunkTable; + uint[] hunkTableSmall; + uint hdrCompression; + uint hdrCompression1; + uint hdrCompression2; + uint hdrCompression3; + Stream imageStream; + uint sectorsPerHunk; + byte[] hunkMap; + uint mapVersion; + uint bytesPerHunk; + uint totalHunks; + byte[] expectedChecksum; + bool isCdrom; + bool isHdd; + bool isGdrom; + bool swapAudio; + + const int MaxCacheSize = 16777216; + int maxBlockCache; + int maxSectorCache; + + Dictionary<ulong, byte[]> sectorCache; + Dictionary<ulong, byte[]> hunkCache; + + Dictionary<uint, Track> tracks; + List<Partition> partitions; + Dictionary<ulong, uint> offsetmap; + + byte[] identify; + byte[] cis; + #endregion + + public CHD() + { + Name = "MAME Compressed Hunks of Data"; + PluginUUID = new Guid("0D50233A-08BD-47D4-988B-27EAA0358597"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = false; + ImageInfo.imageHasSessions = false; + ImageInfo.imageApplication = "MAME"; + ImageInfo.imageCreator = null; + ImageInfo.imageComments = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaSerialNumber = null; + ImageInfo.mediaBarcode = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + byte[] magic = new byte[8]; + stream.Read(magic, 0, 8); + + return chdTag.SequenceEqual(magic); + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + byte[] buffer = new byte[8]; + byte[] magic = new byte[8]; + stream.Read(magic, 0, 8); + if(!chdTag.SequenceEqual(magic)) return false; + // Read length + buffer = new byte[4]; + stream.Read(buffer, 0, 4); + uint length = BitConverter.ToUInt32(buffer.Reverse().ToArray(), 0); + buffer = new byte[4]; + stream.Read(buffer, 0, 4); + uint version = BitConverter.ToUInt32(buffer.Reverse().ToArray(), 0); + + buffer = new byte[length]; + stream.Seek(0, SeekOrigin.Begin); + stream.Read(buffer, 0, (int)length); + + ulong nextMetaOff = 0; + + switch(version) + { + case 1: + { + CHDHeaderV1 hdrV1 = BigEndianMarshal.ByteArrayToStructureBigEndian<CHDHeaderV1>(buffer); + + DicConsole.DebugWriteLine("CHD plugin", "hdrV1.tag = \"{0}\"", Encoding.ASCII.GetString(hdrV1.tag)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV1.length = {0} bytes", hdrV1.length); + DicConsole.DebugWriteLine("CHD plugin", "hdrV1.version = {0}", hdrV1.version); + DicConsole.DebugWriteLine("CHD plugin", "hdrV1.flags = {0}", (CHDFlags)hdrV1.flags); + DicConsole.DebugWriteLine("CHD plugin", "hdrV1.compression = {0}", + (CHDCompression)hdrV1.compression); + DicConsole.DebugWriteLine("CHD plugin", "hdrV1.hunksize = {0}", hdrV1.hunksize); + DicConsole.DebugWriteLine("CHD plugin", "hdrV1.totalhunks = {0}", hdrV1.totalhunks); + DicConsole.DebugWriteLine("CHD plugin", "hdrV1.cylinders = {0}", hdrV1.cylinders); + DicConsole.DebugWriteLine("CHD plugin", "hdrV1.heads = {0}", hdrV1.heads); + DicConsole.DebugWriteLine("CHD plugin", "hdrV1.sectors = {0}", hdrV1.sectors); + DicConsole.DebugWriteLine("CHD plugin", "hdrV1.md5 = {0}", ArrayHelpers.ByteArrayToHex(hdrV1.md5)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV1.parentmd5 = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(hdrV1.parentmd5) + ? "null" + : ArrayHelpers.ByteArrayToHex(hdrV1.parentmd5)); + + DicConsole.DebugWriteLine("CHD plugin", "Reading Hunk map."); + DateTime start = DateTime.UtcNow; + + hunkTable = new ulong[hdrV1.totalhunks]; + + uint hunkSectorCount = (uint)Math.Ceiling(((double)hdrV1.totalhunks * 8) / 512); + + byte[] hunkSectorBytes = new byte[512]; + HunkSector hunkSector = new HunkSector(); + + for(int i = 0; i < hunkSectorCount; i++) + { + stream.Read(hunkSectorBytes, 0, 512); + // This does the big-endian trick but reverses the order of elements also + Array.Reverse(hunkSectorBytes); + GCHandle handle = GCHandle.Alloc(hunkSectorBytes, GCHandleType.Pinned); + hunkSector = + (HunkSector)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(HunkSector)); + handle.Free(); + // This restores the order of elements + Array.Reverse(hunkSector.hunkEntry); + if(hunkTable.Length >= (i * 512) / 8 + 512 / 8) + Array.Copy(hunkSector.hunkEntry, 0, hunkTable, (i * 512) / 8, 512 / 8); + else + Array.Copy(hunkSector.hunkEntry, 0, hunkTable, (i * 512) / 8, + hunkTable.Length - (i * 512) / 8); + } + + DateTime end = DateTime.UtcNow; + System.Console.WriteLine("Took {0} seconds", (end - start).TotalSeconds); + + ImageInfo.mediaType = MediaType.GENERIC_HDD; + ImageInfo.sectors = hdrV1.hunksize * hdrV1.totalhunks; + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.sectorSize = 512; + ImageInfo.imageVersion = "1"; + ImageInfo.imageSize = ImageInfo.sectorSize * hdrV1.hunksize * hdrV1.totalhunks; + + totalHunks = hdrV1.totalhunks; + sectorsPerHunk = hdrV1.hunksize; + hdrCompression = hdrV1.compression; + mapVersion = 1; + isHdd = true; + + ImageInfo.cylinders = hdrV1.cylinders; + ImageInfo.heads = hdrV1.heads; + ImageInfo.sectorsPerTrack = hdrV1.sectors; + + break; + } + case 2: + { + CHDHeaderV2 hdrV2 = BigEndianMarshal.ByteArrayToStructureBigEndian<CHDHeaderV2>(buffer); + + DicConsole.DebugWriteLine("CHD plugin", "hdrV2.tag = \"{0}\"", Encoding.ASCII.GetString(hdrV2.tag)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV2.length = {0} bytes", hdrV2.length); + DicConsole.DebugWriteLine("CHD plugin", "hdrV2.version = {0}", hdrV2.version); + DicConsole.DebugWriteLine("CHD plugin", "hdrV2.flags = {0}", (CHDFlags)hdrV2.flags); + DicConsole.DebugWriteLine("CHD plugin", "hdrV2.compression = {0}", + (CHDCompression)hdrV2.compression); + DicConsole.DebugWriteLine("CHD plugin", "hdrV2.hunksize = {0}", hdrV2.hunksize); + DicConsole.DebugWriteLine("CHD plugin", "hdrV2.totalhunks = {0}", hdrV2.totalhunks); + DicConsole.DebugWriteLine("CHD plugin", "hdrV2.cylinders = {0}", hdrV2.cylinders); + DicConsole.DebugWriteLine("CHD plugin", "hdrV2.heads = {0}", hdrV2.heads); + DicConsole.DebugWriteLine("CHD plugin", "hdrV2.sectors = {0}", hdrV2.sectors); + DicConsole.DebugWriteLine("CHD plugin", "hdrV2.md5 = {0}", ArrayHelpers.ByteArrayToHex(hdrV2.md5)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV2.parentmd5 = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(hdrV2.parentmd5) + ? "null" + : ArrayHelpers.ByteArrayToHex(hdrV2.parentmd5)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV2.seclen = {0}", hdrV2.seclen); + + DicConsole.DebugWriteLine("CHD plugin", "Reading Hunk map."); + DateTime start = DateTime.UtcNow; + + hunkTable = new ulong[hdrV2.totalhunks]; + + // How many sectors uses the BAT + uint hunkSectorCount = (uint)Math.Ceiling(((double)hdrV2.totalhunks * 8) / 512); + + byte[] hunkSectorBytes = new byte[512]; + HunkSector hunkSector = new HunkSector(); + + for(int i = 0; i < hunkSectorCount; i++) + { + stream.Read(hunkSectorBytes, 0, 512); + // This does the big-endian trick but reverses the order of elements also + Array.Reverse(hunkSectorBytes); + GCHandle handle = GCHandle.Alloc(hunkSectorBytes, GCHandleType.Pinned); + hunkSector = + (HunkSector)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(HunkSector)); + handle.Free(); + // This restores the order of elements + Array.Reverse(hunkSector.hunkEntry); + if(hunkTable.Length >= (i * 512) / 8 + 512 / 8) + Array.Copy(hunkSector.hunkEntry, 0, hunkTable, (i * 512) / 8, 512 / 8); + else + Array.Copy(hunkSector.hunkEntry, 0, hunkTable, (i * 512) / 8, + hunkTable.Length - (i * 512) / 8); + } + + DateTime end = DateTime.UtcNow; + System.Console.WriteLine("Took {0} seconds", (end - start).TotalSeconds); + + ImageInfo.mediaType = MediaType.GENERIC_HDD; + ImageInfo.sectors = hdrV2.hunksize * hdrV2.totalhunks; + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.sectorSize = hdrV2.seclen; + ImageInfo.imageVersion = "2"; + ImageInfo.imageSize = ImageInfo.sectorSize * hdrV2.hunksize * hdrV2.totalhunks; + + totalHunks = hdrV2.totalhunks; + sectorsPerHunk = hdrV2.hunksize; + hdrCompression = hdrV2.compression; + mapVersion = 1; + isHdd = true; + + ImageInfo.cylinders = hdrV2.cylinders; + ImageInfo.heads = hdrV2.heads; + ImageInfo.sectorsPerTrack = hdrV2.sectors; + + break; + } + case 3: + { + CHDHeaderV3 hdrV3 = BigEndianMarshal.ByteArrayToStructureBigEndian<CHDHeaderV3>(buffer); + + DicConsole.DebugWriteLine("CHD plugin", "hdrV3.tag = \"{0}\"", Encoding.ASCII.GetString(hdrV3.tag)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV3.length = {0} bytes", hdrV3.length); + DicConsole.DebugWriteLine("CHD plugin", "hdrV3.version = {0}", hdrV3.version); + DicConsole.DebugWriteLine("CHD plugin", "hdrV3.flags = {0}", (CHDFlags)hdrV3.flags); + DicConsole.DebugWriteLine("CHD plugin", "hdrV3.compression = {0}", + (CHDCompression)hdrV3.compression); + DicConsole.DebugWriteLine("CHD plugin", "hdrV3.totalhunks = {0}", hdrV3.totalhunks); + DicConsole.DebugWriteLine("CHD plugin", "hdrV3.logicalbytes = {0}", hdrV3.logicalbytes); + DicConsole.DebugWriteLine("CHD plugin", "hdrV3.metaoffset = {0}", hdrV3.metaoffset); + DicConsole.DebugWriteLine("CHD plugin", "hdrV3.md5 = {0}", ArrayHelpers.ByteArrayToHex(hdrV3.md5)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV3.parentmd5 = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(hdrV3.parentmd5) + ? "null" + : ArrayHelpers.ByteArrayToHex(hdrV3.parentmd5)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV3.hunkbytes = {0}", hdrV3.hunkbytes); + DicConsole.DebugWriteLine("CHD plugin", "hdrV3.sha1 = {0}", + ArrayHelpers.ByteArrayToHex(hdrV3.sha1)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV3.parentsha1 = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(hdrV3.parentsha1) + ? "null" + : ArrayHelpers.ByteArrayToHex(hdrV3.parentsha1)); + + DicConsole.DebugWriteLine("CHD plugin", "Reading Hunk map."); + DateTime start = DateTime.UtcNow; + + hunkMap = new byte[hdrV3.totalhunks * 16]; + stream.Read(hunkMap, 0, hunkMap.Length); + + DateTime end = DateTime.UtcNow; + System.Console.WriteLine("Took {0} seconds", (end - start).TotalSeconds); + + nextMetaOff = hdrV3.metaoffset; + + ImageInfo.imageSize = hdrV3.logicalbytes; + ImageInfo.imageVersion = "3"; + + totalHunks = hdrV3.totalhunks; + bytesPerHunk = hdrV3.hunkbytes; + hdrCompression = hdrV3.compression; + mapVersion = 3; + + break; + } + case 4: + { + CHDHeaderV4 hdrV4 = BigEndianMarshal.ByteArrayToStructureBigEndian<CHDHeaderV4>(buffer); + + DicConsole.DebugWriteLine("CHD plugin", "hdrV4.tag = \"{0}\"", Encoding.ASCII.GetString(hdrV4.tag)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV4.length = {0} bytes", hdrV4.length); + DicConsole.DebugWriteLine("CHD plugin", "hdrV4.version = {0}", hdrV4.version); + DicConsole.DebugWriteLine("CHD plugin", "hdrV4.flags = {0}", (CHDFlags)hdrV4.flags); + DicConsole.DebugWriteLine("CHD plugin", "hdrV4.compression = {0}", + (CHDCompression)hdrV4.compression); + DicConsole.DebugWriteLine("CHD plugin", "hdrV4.totalhunks = {0}", hdrV4.totalhunks); + DicConsole.DebugWriteLine("CHD plugin", "hdrV4.logicalbytes = {0}", hdrV4.logicalbytes); + DicConsole.DebugWriteLine("CHD plugin", "hdrV4.metaoffset = {0}", hdrV4.metaoffset); + DicConsole.DebugWriteLine("CHD plugin", "hdrV4.hunkbytes = {0}", hdrV4.hunkbytes); + DicConsole.DebugWriteLine("CHD plugin", "hdrV4.sha1 = {0}", + ArrayHelpers.ByteArrayToHex(hdrV4.sha1)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV4.parentsha1 = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(hdrV4.parentsha1) + ? "null" + : ArrayHelpers.ByteArrayToHex(hdrV4.parentsha1)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV4.rawsha1 = {0}", + ArrayHelpers.ByteArrayToHex(hdrV4.rawsha1)); + + DicConsole.DebugWriteLine("CHD plugin", "Reading Hunk map."); + DateTime start = DateTime.UtcNow; + + hunkMap = new byte[hdrV4.totalhunks * 16]; + stream.Read(hunkMap, 0, hunkMap.Length); + + DateTime end = DateTime.UtcNow; + System.Console.WriteLine("Took {0} seconds", (end - start).TotalSeconds); + + nextMetaOff = hdrV4.metaoffset; + + ImageInfo.imageSize = hdrV4.logicalbytes; + ImageInfo.imageVersion = "4"; + + totalHunks = hdrV4.totalhunks; + bytesPerHunk = hdrV4.hunkbytes; + hdrCompression = hdrV4.compression; + mapVersion = 3; + + break; + } + case 5: + { + CHDHeaderV5 hdrV5 = BigEndianMarshal.ByteArrayToStructureBigEndian<CHDHeaderV5>(buffer); + + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.tag = \"{0}\"", Encoding.ASCII.GetString(hdrV5.tag)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.length = {0} bytes", hdrV5.length); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.version = {0}", hdrV5.version); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.compressor0 = \"{0}\"", + Encoding.ASCII.GetString(BigEndianBitConverter + .GetBytes(hdrV5.compressor0))); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.compressor1 = \"{0}\"", + Encoding.ASCII.GetString(BigEndianBitConverter + .GetBytes(hdrV5.compressor1))); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.compressor2 = \"{0}\"", + Encoding.ASCII.GetString(BigEndianBitConverter + .GetBytes(hdrV5.compressor2))); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.compressor3 = \"{0}\"", + Encoding.ASCII.GetString(BigEndianBitConverter + .GetBytes(hdrV5.compressor3))); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.logicalbytes = {0}", hdrV5.logicalbytes); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.mapoffset = {0}", hdrV5.mapoffset); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.metaoffset = {0}", hdrV5.metaoffset); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.hunkbytes = {0}", hdrV5.hunkbytes); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.unitbytes = {0}", hdrV5.unitbytes); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.sha1 = {0}", + ArrayHelpers.ByteArrayToHex(hdrV5.sha1)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.parentsha1 = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(hdrV5.parentsha1) + ? "null" + : ArrayHelpers.ByteArrayToHex(hdrV5.parentsha1)); + DicConsole.DebugWriteLine("CHD plugin", "hdrV5.rawsha1 = {0}", + ArrayHelpers.ByteArrayToHex(hdrV5.rawsha1)); + + // TODO: Implement compressed CHD v5 + if(hdrV5.compressor0 == 0) + { + DicConsole.DebugWriteLine("CHD plugin", "Reading Hunk map."); + DateTime start = DateTime.UtcNow; + + hunkTableSmall = new uint[hdrV5.logicalbytes / hdrV5.hunkbytes]; + + uint hunkSectorCount = (uint)Math.Ceiling(((double)hunkTableSmall.Length * 4) / 512); + + byte[] hunkSectorBytes = new byte[512]; + HunkSectorSmall hunkSector = new HunkSectorSmall(); + + stream.Seek((long)hdrV5.mapoffset, SeekOrigin.Begin); + + for(int i = 0; i < hunkSectorCount; i++) + { + stream.Read(hunkSectorBytes, 0, 512); + // This does the big-endian trick but reverses the order of elements also + Array.Reverse(hunkSectorBytes); + GCHandle handle = GCHandle.Alloc(hunkSectorBytes, GCHandleType.Pinned); + hunkSector = + (HunkSectorSmall)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), + typeof(HunkSectorSmall)); + handle.Free(); + // This restores the order of elements + Array.Reverse(hunkSector.hunkEntry); + if(hunkTableSmall.Length >= (i * 512) / 4 + 512 / 4) + Array.Copy(hunkSector.hunkEntry, 0, hunkTableSmall, (i * 512) / 4, 512 / 4); + else + Array.Copy(hunkSector.hunkEntry, 0, hunkTableSmall, (i * 512) / 4, + hunkTableSmall.Length - (i * 512) / 4); + } + + DateTime end = DateTime.UtcNow; + System.Console.WriteLine("Took {0} seconds", (end - start).TotalSeconds); + } + else throw new ImageNotSupportedException("Cannot read compressed CHD version 5"); + + nextMetaOff = hdrV5.metaoffset; + + ImageInfo.imageSize = hdrV5.logicalbytes; + ImageInfo.imageVersion = "5"; + + totalHunks = (uint)(hdrV5.logicalbytes / hdrV5.hunkbytes); + bytesPerHunk = hdrV5.hunkbytes; + hdrCompression = hdrV5.compressor0; + hdrCompression1 = hdrV5.compressor1; + hdrCompression2 = hdrV5.compressor2; + hdrCompression3 = hdrV5.compressor3; + mapVersion = 5; + + break; + } + default: throw new ImageNotSupportedException(string.Format("Unsupported CHD version {0}", version)); + } + + if(mapVersion >= 3) + { + byte[] meta; + isCdrom = false; + isHdd = false; + isGdrom = false; + swapAudio = false; + tracks = new Dictionary<uint, Track>(); + + DicConsole.DebugWriteLine("CHD plugin", "Reading metadata."); + + ulong currentSector = 0; + uint currentTrack = 1; + + while(nextMetaOff > 0) + { + byte[] hdrBytes = new byte[16]; + stream.Seek((long)nextMetaOff, SeekOrigin.Begin); + stream.Read(hdrBytes, 0, hdrBytes.Length); + CHDMetadataHeader header = + BigEndianMarshal.ByteArrayToStructureBigEndian<CHDMetadataHeader>(hdrBytes); + meta = new byte[header.flagsAndLength & 0xFFFFFF]; + stream.Read(meta, 0, meta.Length); + DicConsole.DebugWriteLine("CHD plugin", "Found metadata \"{0}\"", + Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(header.tag))); + + switch(header.tag) + { + // "GDDD" + case hardDiskMetadata: + if(isCdrom || isGdrom) + throw new + ImageNotSupportedException("Image cannot be a hard disk and a C/GD-ROM at the same time, aborting."); + + string gddd = StringHandlers.CToString(meta); + Regex gdddRegEx = new Regex(hardDiskMetadataRegEx); + Match gdddMatch = gdddRegEx.Match(gddd); + if(gdddMatch.Success) + { + isHdd = true; + ImageInfo.sectorSize = uint.Parse(gdddMatch.Groups["bps"].Value); + ImageInfo.cylinders = uint.Parse(gdddMatch.Groups["cylinders"].Value); + ImageInfo.heads = uint.Parse(gdddMatch.Groups["heads"].Value); + ImageInfo.sectorsPerTrack = uint.Parse(gdddMatch.Groups["sectors"].Value); + } + break; + // "CHCD" + case cdromOldMetadata: + if(isHdd) + throw new + ImageNotSupportedException("Image cannot be a hard disk and a CD-ROM at the same time, aborting."); + + if(isGdrom) + throw new + ImageNotSupportedException("Image cannot be a GD-ROM and a CD-ROM at the same time, aborting."); + + uint _tracks = BigEndianBitConverter.ToUInt32(meta, 0); + + // Byteswapped + if(_tracks > 99) + { + BigEndianBitConverter.IsLittleEndian = !BitConverter.IsLittleEndian; + _tracks = BigEndianBitConverter.ToUInt32(meta, 0); + } + + currentSector = 0; + + for(uint i = 0; i < _tracks; i++) + { + CHDTrackOld _trk = new CHDTrackOld(); + _trk.type = BigEndianBitConverter.ToUInt32(meta, (int)(4 + i * 24 + 0)); + _trk.subType = BigEndianBitConverter.ToUInt32(meta, (int)(4 + i * 24 + 4)); + _trk.dataSize = BigEndianBitConverter.ToUInt32(meta, (int)(4 + i * 24 + 8)); + _trk.subSize = BigEndianBitConverter.ToUInt32(meta, (int)(4 + i * 24 + 12)); + _trk.frames = BigEndianBitConverter.ToUInt32(meta, (int)(4 + i * 24 + 16)); + _trk.extraFrames = BigEndianBitConverter.ToUInt32(meta, (int)(4 + i * 24 + 20)); + + Track _track = new Track(); + switch((CHDOldTrackType)_trk.type) + { + case CHDOldTrackType.Audio: + _track.TrackBytesPerSector = 2352; + _track.TrackRawBytesPerSector = 2352; + _track.TrackType = TrackType.Audio; + break; + case CHDOldTrackType.Mode1: + _track.TrackBytesPerSector = 2048; + _track.TrackRawBytesPerSector = 2048; + _track.TrackType = TrackType.CDMode1; + break; + case CHDOldTrackType.Mode1_Raw: + _track.TrackBytesPerSector = 2048; + _track.TrackRawBytesPerSector = 2352; + _track.TrackType = TrackType.CDMode1; + break; + case CHDOldTrackType.Mode2: + case CHDOldTrackType.Mode2FormMix: + _track.TrackBytesPerSector = 2336; + _track.TrackRawBytesPerSector = 2336; + _track.TrackType = TrackType.CDMode2Formless; + break; + case CHDOldTrackType.Mode2Form1: + _track.TrackBytesPerSector = 2048; + _track.TrackRawBytesPerSector = 2048; + _track.TrackType = TrackType.CDMode2Form1; + break; + case CHDOldTrackType.Mode2Form2: + _track.TrackBytesPerSector = 2324; + _track.TrackRawBytesPerSector = 2324; + _track.TrackType = TrackType.CDMode2Form2; + break; + case CHDOldTrackType.Mode2Raw: + _track.TrackBytesPerSector = 2336; + _track.TrackRawBytesPerSector = 2352; + _track.TrackType = TrackType.CDMode2Formless; + break; + default: + throw new ImageNotSupportedException(string.Format("Unsupported track type {0}", + _trk.type)); + } + + switch((CHDOldSubType)_trk.subType) + { + case CHDOldSubType.Cooked: + _track.TrackSubchannelFile = imageFilter.GetFilename(); + _track.TrackSubchannelType = TrackSubchannelType.PackedInterleaved; + _track.TrackSubchannelFilter = imageFilter; + break; + case CHDOldSubType.None: + _track.TrackSubchannelType = TrackSubchannelType.None; + break; + case CHDOldSubType.Raw: + _track.TrackSubchannelFile = imageFilter.GetFilename(); + _track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; + _track.TrackSubchannelFilter = imageFilter; + break; + default: + throw new + ImageNotSupportedException(string.Format("Unsupported subchannel type {0}", + _trk.type)); + } + + _track.Indexes = new Dictionary<int, ulong>(); + _track.TrackDescription = string.Format("Track {0}", i + 1); + _track.TrackEndSector = currentSector + _trk.frames - 1; + _track.TrackFile = imageFilter.GetFilename(); + _track.TrackFileType = "BINARY"; + _track.TrackFilter = imageFilter; + _track.TrackStartSector = currentSector; + _track.TrackSequence = i + 1; + _track.TrackSession = 1; + currentSector += _trk.frames + _trk.extraFrames; + tracks.Add(_track.TrackSequence, _track); + } + + BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; + isCdrom = true; + + break; + // "CHTR" + case cdromTrackMetadata: + if(isHdd) + throw new + ImageNotSupportedException("Image cannot be a hard disk and a CD-ROM at the same time, aborting."); + + if(isGdrom) + throw new + ImageNotSupportedException("Image cannot be a GD-ROM and a CD-ROM at the same time, aborting."); + + string chtr = StringHandlers.CToString(meta); + Regex chtrRegEx = new Regex(CdromMetadataRegEx); + Match chtrMatch = chtrRegEx.Match(chtr); + if(chtrMatch.Success) + { + isCdrom = true; + + uint trackNo = uint.Parse(chtrMatch.Groups["track"].Value); + uint frames = uint.Parse(chtrMatch.Groups["frames"].Value); + string subtype = chtrMatch.Groups["sub_type"].Value; + string tracktype = chtrMatch.Groups["track_type"].Value; + + if(trackNo != currentTrack) + throw new ImageNotSupportedException("Unsorted tracks, cannot proceed."); + + Track _track = new Track(); + switch(tracktype) + { + case TrackTypeAudio: + _track.TrackBytesPerSector = 2352; + _track.TrackRawBytesPerSector = 2352; + _track.TrackType = TrackType.Audio; + break; + case TrackTypeMode1: + case TrackTypeMode1_2k: + _track.TrackBytesPerSector = 2048; + _track.TrackRawBytesPerSector = 2048; + _track.TrackType = TrackType.CDMode1; + break; + case TrackTypeMode1Raw: + case TrackTypeMode1Raw_2k: + _track.TrackBytesPerSector = 2048; + _track.TrackRawBytesPerSector = 2352; + _track.TrackType = TrackType.CDMode1; + break; + case TrackTypeMode2: + case TrackTypeMode2_2k: + case TrackTypeMode2FM: + _track.TrackBytesPerSector = 2336; + _track.TrackRawBytesPerSector = 2336; + _track.TrackType = TrackType.CDMode2Formless; + break; + case TrackTypeMode2F1: + case TrackTypeMode2F1_2k: + _track.TrackBytesPerSector = 2048; + _track.TrackRawBytesPerSector = 2048; + _track.TrackType = TrackType.CDMode2Form1; + break; + case TrackTypeMode2F2: + case TrackTypeMode2F2_2k: + _track.TrackBytesPerSector = 2324; + _track.TrackRawBytesPerSector = 2324; + _track.TrackType = TrackType.CDMode2Form2; + break; + case TrackTypeMode2Raw: + case TrackTypeMode2Raw_2k: + _track.TrackBytesPerSector = 2336; + _track.TrackRawBytesPerSector = 2352; + _track.TrackType = TrackType.CDMode2Formless; + break; + default: + throw new ImageNotSupportedException(string.Format("Unsupported track type {0}", + tracktype)); + } + + switch(subtype) + { + case SubTypeCooked: + _track.TrackSubchannelFile = imageFilter.GetFilename(); + _track.TrackSubchannelType = TrackSubchannelType.PackedInterleaved; + _track.TrackSubchannelFilter = imageFilter; + break; + case SubTypeNone: + _track.TrackSubchannelType = TrackSubchannelType.None; + break; + case SubTypeRaw: + _track.TrackSubchannelFile = imageFilter.GetFilename(); + _track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; + _track.TrackSubchannelFilter = imageFilter; + break; + default: + throw new + ImageNotSupportedException(string.Format("Unsupported subchannel type {0}", + subtype)); + } + + _track.Indexes = new Dictionary<int, ulong>(); + _track.TrackDescription = string.Format("Track {0}", trackNo); + _track.TrackEndSector = currentSector + frames - 1; + _track.TrackFile = imageFilter.GetFilename(); + _track.TrackFileType = "BINARY"; + _track.TrackFilter = imageFilter; + _track.TrackStartSector = currentSector; + _track.TrackSequence = trackNo; + _track.TrackSession = 1; + currentSector += frames; + currentTrack++; + tracks.Add(_track.TrackSequence, _track); + } + + break; + // "CHT2" + case cdromTrackMetadata2: + if(isHdd) + throw new + ImageNotSupportedException("Image cannot be a hard disk and a CD-ROM at the same time, aborting."); + + if(isGdrom) + throw new + ImageNotSupportedException("Image cannot be a GD-ROM and a CD-ROM at the same time, aborting."); + + string cht2 = StringHandlers.CToString(meta); + Regex cht2RegEx = new Regex(CdromMetadata2RegEx); + Match cht2Match = cht2RegEx.Match(cht2); + if(cht2Match.Success) + { + isCdrom = true; + + uint trackNo = uint.Parse(cht2Match.Groups["track"].Value); + uint frames = uint.Parse(cht2Match.Groups["frames"].Value); + string subtype = cht2Match.Groups["sub_type"].Value; + string tracktype = cht2Match.Groups["track_type"].Value; + // TODO: Check pregap and postgap behaviour + uint pregap = uint.Parse(cht2Match.Groups["pregap"].Value); + string pregapType = cht2Match.Groups["pgtype"].Value; + string pregapSubType = cht2Match.Groups["pgsub"].Value; + uint postgap = uint.Parse(cht2Match.Groups["postgap"].Value); + + if(trackNo != currentTrack) + throw new ImageNotSupportedException("Unsorted tracks, cannot proceed."); + + Track _track = new Track(); + switch(tracktype) + { + case TrackTypeAudio: + _track.TrackBytesPerSector = 2352; + _track.TrackRawBytesPerSector = 2352; + _track.TrackType = TrackType.Audio; + break; + case TrackTypeMode1: + case TrackTypeMode1_2k: + _track.TrackBytesPerSector = 2048; + _track.TrackRawBytesPerSector = 2048; + _track.TrackType = TrackType.CDMode1; + break; + case TrackTypeMode1Raw: + case TrackTypeMode1Raw_2k: + _track.TrackBytesPerSector = 2048; + _track.TrackRawBytesPerSector = 2352; + _track.TrackType = TrackType.CDMode1; + break; + case TrackTypeMode2: + case TrackTypeMode2_2k: + case TrackTypeMode2FM: + _track.TrackBytesPerSector = 2336; + _track.TrackRawBytesPerSector = 2336; + _track.TrackType = TrackType.CDMode2Formless; + break; + case TrackTypeMode2F1: + case TrackTypeMode2F1_2k: + _track.TrackBytesPerSector = 2048; + _track.TrackRawBytesPerSector = 2048; + _track.TrackType = TrackType.CDMode2Form1; + break; + case TrackTypeMode2F2: + case TrackTypeMode2F2_2k: + _track.TrackBytesPerSector = 2324; + _track.TrackRawBytesPerSector = 2324; + _track.TrackType = TrackType.CDMode2Form2; + break; + case TrackTypeMode2Raw: + case TrackTypeMode2Raw_2k: + _track.TrackBytesPerSector = 2336; + _track.TrackRawBytesPerSector = 2352; + _track.TrackType = TrackType.CDMode2Formless; + break; + default: + throw new ImageNotSupportedException(string.Format("Unsupported track type {0}", + tracktype)); + } + + switch(subtype) + { + case SubTypeCooked: + _track.TrackSubchannelFile = imageFilter.GetFilename(); + _track.TrackSubchannelType = TrackSubchannelType.PackedInterleaved; + _track.TrackSubchannelFilter = imageFilter; + break; + case SubTypeNone: + _track.TrackSubchannelType = TrackSubchannelType.None; + break; + case SubTypeRaw: + _track.TrackSubchannelFile = imageFilter.GetFilename(); + _track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; + _track.TrackSubchannelFilter = imageFilter; + break; + default: + throw new + ImageNotSupportedException(string.Format("Unsupported subchannel type {0}", + subtype)); + } + + _track.Indexes = new Dictionary<int, ulong>(); + _track.TrackDescription = string.Format("Track {0}", trackNo); + _track.TrackEndSector = currentSector + frames - 1; + _track.TrackFile = imageFilter.GetFilename(); + _track.TrackFileType = "BINARY"; + _track.TrackFilter = imageFilter; + _track.TrackStartSector = currentSector; + _track.TrackSequence = trackNo; + _track.TrackSession = 1; + currentSector += frames; + currentTrack++; + tracks.Add(_track.TrackSequence, _track); + } + + break; + // "CHGT" + case gdromOldMetadata: + swapAudio = true; + goto case gdromMetadata; + // "CHGD" + case gdromMetadata: + if(isHdd) + throw new + ImageNotSupportedException("Image cannot be a hard disk and a GD-ROM at the same time, aborting."); + + if(isCdrom) + throw new + ImageNotSupportedException("Image cannot be a CD-ROM and a GD-ROM at the same time, aborting."); + + string chgd = StringHandlers.CToString(meta); + Regex chgdRegEx = new Regex(GdromMetadataRegEx); + Match chgdMatch = chgdRegEx.Match(chgd); + if(chgdMatch.Success) + { + isGdrom = true; + + uint trackNo = uint.Parse(chgdMatch.Groups["track"].Value); + uint frames = uint.Parse(chgdMatch.Groups["frames"].Value); + string subtype = chgdMatch.Groups["sub_type"].Value; + string tracktype = chgdMatch.Groups["track_type"].Value; + // TODO: Check pregap, postgap and pad behaviour + uint pregap = uint.Parse(chgdMatch.Groups["pregap"].Value); + string pregapType = chgdMatch.Groups["pgtype"].Value; + string pregapSubType = chgdMatch.Groups["pgsub"].Value; + uint postgap = uint.Parse(chgdMatch.Groups["postgap"].Value); + uint pad = uint.Parse(chgdMatch.Groups["pad"].Value); + + if(trackNo != currentTrack) + throw new ImageNotSupportedException("Unsorted tracks, cannot proceed."); + + Track _track = new Track(); + switch(tracktype) + { + case TrackTypeAudio: + _track.TrackBytesPerSector = 2352; + _track.TrackRawBytesPerSector = 2352; + _track.TrackType = TrackType.Audio; + break; + case TrackTypeMode1: + case TrackTypeMode1_2k: + _track.TrackBytesPerSector = 2048; + _track.TrackRawBytesPerSector = 2048; + _track.TrackType = TrackType.CDMode1; + break; + case TrackTypeMode1Raw: + case TrackTypeMode1Raw_2k: + _track.TrackBytesPerSector = 2048; + _track.TrackRawBytesPerSector = 2352; + _track.TrackType = TrackType.CDMode1; + break; + case TrackTypeMode2: + case TrackTypeMode2_2k: + case TrackTypeMode2FM: + _track.TrackBytesPerSector = 2336; + _track.TrackRawBytesPerSector = 2336; + _track.TrackType = TrackType.CDMode2Formless; + break; + case TrackTypeMode2F1: + case TrackTypeMode2F1_2k: + _track.TrackBytesPerSector = 2048; + _track.TrackRawBytesPerSector = 2048; + _track.TrackType = TrackType.CDMode2Form1; + break; + case TrackTypeMode2F2: + case TrackTypeMode2F2_2k: + _track.TrackBytesPerSector = 2324; + _track.TrackRawBytesPerSector = 2324; + _track.TrackType = TrackType.CDMode2Form2; + break; + case TrackTypeMode2Raw: + case TrackTypeMode2Raw_2k: + _track.TrackBytesPerSector = 2336; + _track.TrackRawBytesPerSector = 2352; + _track.TrackType = TrackType.CDMode2Formless; + break; + default: + throw new ImageNotSupportedException(string.Format("Unsupported track type {0}", + tracktype)); + } + + switch(subtype) + { + case SubTypeCooked: + _track.TrackSubchannelFile = imageFilter.GetFilename(); + _track.TrackSubchannelType = TrackSubchannelType.PackedInterleaved; + _track.TrackSubchannelFilter = imageFilter; + break; + case SubTypeNone: + _track.TrackSubchannelType = TrackSubchannelType.None; + break; + case SubTypeRaw: + _track.TrackSubchannelFile = imageFilter.GetFilename(); + _track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; + _track.TrackSubchannelFilter = imageFilter; + break; + default: + throw new + ImageNotSupportedException(string.Format("Unsupported subchannel type {0}", + subtype)); + } + + _track.Indexes = new Dictionary<int, ulong>(); + _track.TrackDescription = string.Format("Track {0}", trackNo); + _track.TrackEndSector = currentSector + frames - 1; + _track.TrackFile = imageFilter.GetFilename(); + _track.TrackFileType = "BINARY"; + _track.TrackFilter = imageFilter; + _track.TrackStartSector = currentSector; + _track.TrackSequence = trackNo; + _track.TrackSession = (ushort)(trackNo > 2 ? 2 : 1); + currentSector += frames; + currentTrack++; + tracks.Add(_track.TrackSequence, _track); + } + + break; + // "IDNT" + case hardDiskIdentMetadata: + Decoders.ATA.Identify.IdentifyDevice? idnt = Decoders.ATA.Identify.Decode(meta); + if(idnt.HasValue) + { + ImageInfo.mediaManufacturer = idnt.Value.MediaManufacturer; + ImageInfo.mediaSerialNumber = idnt.Value.MediaSerial; + ImageInfo.driveModel = idnt.Value.Model; + ImageInfo.driveSerialNumber = idnt.Value.SerialNumber; + ImageInfo.driveFirmwareRevision = idnt.Value.FirmwareRevision; + if(idnt.Value.CurrentCylinders > 0 && idnt.Value.CurrentHeads > 0 && + idnt.Value.CurrentSectorsPerTrack > 0) + { + ImageInfo.cylinders = idnt.Value.CurrentCylinders; + ImageInfo.heads = idnt.Value.CurrentHeads; + ImageInfo.sectorsPerTrack = idnt.Value.CurrentSectorsPerTrack; + } + else + { + ImageInfo.cylinders = idnt.Value.Cylinders; + ImageInfo.heads = idnt.Value.Heads; + ImageInfo.sectorsPerTrack = idnt.Value.SectorsPerTrack; + } + } + identify = meta; + if(!ImageInfo.readableMediaTags.Contains(MediaTagType.ATA_IDENTIFY)) + ImageInfo.readableMediaTags.Add(MediaTagType.ATA_IDENTIFY); + break; + case pcmciaCisMetadata: + cis = meta; + if(!ImageInfo.readableMediaTags.Contains(MediaTagType.PCMCIA_CIS)) + ImageInfo.readableMediaTags.Add(MediaTagType.PCMCIA_CIS); + break; + } + + nextMetaOff = header.next; + } + + if(isHdd) + { + sectorsPerHunk = bytesPerHunk / ImageInfo.sectorSize; + ImageInfo.sectors = ImageInfo.imageSize / ImageInfo.sectorSize; + ImageInfo.mediaType = MediaType.GENERIC_HDD; + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + } + else if(isCdrom) + { + // Hardcoded on MAME for CD-ROM + sectorsPerHunk = 8; + ImageInfo.mediaType = MediaType.CDROM; + ImageInfo.xmlMediaType = XmlMediaType.OpticalDisc; + + foreach(Track _trk in tracks.Values) + ImageInfo.sectors += (_trk.TrackEndSector - _trk.TrackStartSector + 1); + } + else if(isGdrom) + { + // Hardcoded on MAME for GD-ROM + sectorsPerHunk = 8; + ImageInfo.mediaType = MediaType.GDROM; + ImageInfo.xmlMediaType = XmlMediaType.OpticalDisc; + + foreach(Track _trk in tracks.Values) + ImageInfo.sectors += (_trk.TrackEndSector - _trk.TrackStartSector + 1); + } + else throw new ImageNotSupportedException("Image does not represent a known media, aborting"); + } + + if(isCdrom || isGdrom) + { + offsetmap = new Dictionary<ulong, uint>(); + partitions = new List<Partition>(); + ulong partPos = 0; + foreach(Track _track in tracks.Values) + { + Partition partition = new Partition(); + partition.Description = _track.TrackDescription; + partition.Size = (_track.TrackEndSector - _track.TrackStartSector + 1) * + (ulong)_track.TrackRawBytesPerSector; + partition.Length = (_track.TrackEndSector - _track.TrackStartSector + 1); + partition.Sequence = _track.TrackSequence; + partition.Offset = partPos; + partition.Start = _track.TrackStartSector; + partition.Type = _track.TrackType.ToString(); + partPos += partition.Length; + offsetmap.Add(_track.TrackStartSector, _track.TrackSequence); + + if(_track.TrackSubchannelType != TrackSubchannelType.None) + { + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubchannel); + } + + switch(_track.TrackType) + { + case TrackType.CDMode1: + case TrackType.CDMode2Form1: + if(_track.TrackRawBytesPerSector == 2352) + { + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); + } + break; + case TrackType.CDMode2Form2: + if(_track.TrackRawBytesPerSector == 2352) + { + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); + } + break; + case TrackType.CDMode2Formless: + if(_track.TrackRawBytesPerSector == 2352) + { + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + } + break; + } + + if(_track.TrackBytesPerSector > ImageInfo.sectorSize) + ImageInfo.sectorSize = (uint)_track.TrackBytesPerSector; + + partitions.Add(partition); + } + + ImageInfo.imageHasPartitions = true; + ImageInfo.imageHasSessions = true; + } + + maxBlockCache = (int)(MaxCacheSize / (ImageInfo.sectorSize * sectorsPerHunk)); + maxSectorCache = (int)(MaxCacheSize / ImageInfo.sectorSize); + + imageStream = stream; + + sectorCache = new Dictionary<ulong, byte[]>(); + hunkCache = new Dictionary<ulong, byte[]>(); + + // TODO: Detect CompactFlash + // TODO: Get manufacturer and drive name from CIS if applicable + if(cis != null) ImageInfo.mediaType = MediaType.PCCardTypeI; + + return true; + } + + Track GetTrack(ulong sector) + { + Track track = new Track(); + foreach(KeyValuePair<ulong, uint> kvp in offsetmap) + { + if(sector >= kvp.Key) tracks.TryGetValue(kvp.Value, out track); + } + + return track; + } + + ulong GetAbsoluteSector(ulong relativeSector, uint track) + { + Track _track = new Track(); + tracks.TryGetValue(track, out _track); + return _track.TrackStartSector + relativeSector; + } + + byte[] GetHunk(ulong hunkNo) + { + byte[] hunk; + + if(!hunkCache.TryGetValue(hunkNo, out hunk)) + { + switch(mapVersion) + { + case 1: + ulong offset = (hunkTable[hunkNo] & 0x00000FFFFFFFFFFF); + ulong length = hunkTable[hunkNo] >> 44; + + byte[] compHunk = new byte[length]; + imageStream.Seek((long)offset, SeekOrigin.Begin); + imageStream.Read(compHunk, 0, compHunk.Length); + + if(length == (sectorsPerHunk * ImageInfo.sectorSize)) { hunk = compHunk; } + else if((CHDCompression)hdrCompression > CHDCompression.Zlib) + throw new ImageNotSupportedException(string.Format("Unsupported compression {0}", + (CHDCompression)hdrCompression)); + else + { + DeflateStream zStream = + new DeflateStream(new MemoryStream(compHunk), CompressionMode.Decompress); + hunk = new byte[sectorsPerHunk * ImageInfo.sectorSize]; + int read = zStream.Read(hunk, 0, (int)(sectorsPerHunk * ImageInfo.sectorSize)); + if(read != sectorsPerHunk * ImageInfo.sectorSize) + throw new + IOException(string + .Format("Unable to decompress hunk correctly, got {0} bytes, expected {1}", + read, sectorsPerHunk * ImageInfo.sectorSize)); + + zStream.Close(); + zStream = null; + } + + break; + case 3: + byte[] entryBytes = new byte[16]; + Array.Copy(hunkMap, (int)(hunkNo * 16), entryBytes, 0, 16); + CHDMapV3Entry entry = BigEndianMarshal.ByteArrayToStructureBigEndian<CHDMapV3Entry>(entryBytes); + switch((CHDV3EntryFlags)(entry.flags & 0x0F)) + { + case CHDV3EntryFlags.Invalid: throw new ArgumentException("Invalid hunk found."); + case CHDV3EntryFlags.Compressed: + switch((CHDCompression)hdrCompression) + { + case CHDCompression.None: goto uncompressedV3; + case CHDCompression.Zlib: + case CHDCompression.ZlibPlus: + if(isHdd) + { + byte[] zHunk = new byte[(entry.lengthLsb << 16) + entry.lengthLsb]; + imageStream.Seek((long)entry.offset, SeekOrigin.Begin); + imageStream.Read(zHunk, 0, zHunk.Length); + DeflateStream zStream = + new DeflateStream(new MemoryStream(zHunk), CompressionMode.Decompress); + hunk = new byte[bytesPerHunk]; + int read = zStream.Read(hunk, 0, (int)(bytesPerHunk)); + if(read != bytesPerHunk) + throw new + IOException(string + .Format("Unable to decompress hunk correctly, got {0} bytes, expected {1}", + read, bytesPerHunk)); + + zStream.Close(); + zStream = null; + } + // TODO: Guess wth is MAME doing with these hunks + else + throw new + ImageNotSupportedException("Compressed CD/GD-ROM hunks are not yet supported"); + + break; + case CHDCompression.AV: + throw new + ImageNotSupportedException(string.Format("Unsupported compression {0}", + (CHDCompression)hdrCompression)); + } + + break; + case CHDV3EntryFlags.Uncompressed: + uncompressedV3: + hunk = new byte[bytesPerHunk]; + imageStream.Seek((long)entry.offset, SeekOrigin.Begin); + imageStream.Read(hunk, 0, hunk.Length); + break; + case CHDV3EntryFlags.Mini: + hunk = new byte[bytesPerHunk]; + byte[] mini = new byte[8]; + mini = BigEndianBitConverter.GetBytes(entry.offset); + for(int i = 0; i < bytesPerHunk; i++) hunk[i] = mini[i % 8]; + + break; + case CHDV3EntryFlags.SelfHunk: return GetHunk(entry.offset); + case CHDV3EntryFlags.ParentHunk: + throw new ImageNotSupportedException("Parent images are not supported"); + case CHDV3EntryFlags.SecondCompressed: + throw new ImageNotSupportedException("FLAC is not supported"); + default: + throw new ImageNotSupportedException(string.Format("Hunk type {0} is not supported", + entry.flags & 0xF)); + } + + break; + case 5: + if(hdrCompression == 0) + { + hunk = new byte[bytesPerHunk]; + imageStream.Seek(hunkTableSmall[hunkNo] * bytesPerHunk, SeekOrigin.Begin); + imageStream.Read(hunk, 0, hunk.Length); + } + else throw new ImageNotSupportedException("Compressed v5 hunks not yet supported"); + + break; + default: + throw new ImageNotSupportedException(string.Format("Unsupported hunk map version {0}", + mapVersion)); + } + + if(hunkCache.Count >= maxBlockCache) hunkCache.Clear(); + + hunkCache.Add(hunkNo, hunk); + } + + return hunk; + } + + public override bool? VerifySector(ulong sectorAddress) + { + if(isHdd) return null; + + byte[] buffer = ReadSectorLong(sectorAddress); + return Checksums.CDChecksums.CheckCDSector(buffer); + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + if(isHdd) + throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); + + return VerifySector(GetAbsoluteSector(sectorAddress, track)); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + UnknownLBAs = new List<ulong>(); + FailingLBAs = new List<ulong>(); + if(isHdd) return null; + + byte[] buffer = ReadSectorsLong(sectorAddress, length); + int bps = (int)(buffer.Length / length); + byte[] sector = new byte[bps]; + + for(int i = 0; i < length; i++) + { + Array.Copy(buffer, i * bps, sector, 0, bps); + bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); + + switch(sectorStatus) + { + case null: + UnknownLBAs.Add((ulong)i + sectorAddress); + break; + case false: + FailingLBAs.Add((ulong)i + sectorAddress); + break; + } + } + + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + + return true; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + UnknownLBAs = new List<ulong>(); + FailingLBAs = new List<ulong>(); + if(isHdd) return null; + + byte[] buffer = ReadSectorsLong(sectorAddress, length, track); + int bps = (int)(buffer.Length / length); + byte[] sector = new byte[bps]; + + for(int i = 0; i < length; i++) + { + Array.Copy(buffer, i * bps, sector, 0, bps); + bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); + + switch(sectorStatus) + { + case null: + UnknownLBAs.Add((ulong)i + sectorAddress); + break; + case false: + FailingLBAs.Add((ulong)i + sectorAddress); + break; + } + } + + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + + return true; + } + + public override bool? VerifyMediaImage() + { + byte[] calculated; + if(mapVersion >= 3) + { + Checksums.SHA1Context sha1Ctx = new Checksums.SHA1Context(); + sha1Ctx.Init(); + for(uint i = 0; i < totalHunks; i++) sha1Ctx.Update(GetHunk(i)); + + calculated = sha1Ctx.Final(); + } + else + { + Checksums.MD5Context md5Ctx = new Checksums.MD5Context(); + md5Ctx.Init(); + for(uint i = 0; i < totalHunks; i++) md5Ctx.Update(GetHunk(i)); + + calculated = md5Ctx.Final(); + } + + return expectedChecksum.SequenceEqual(calculated); + } + + public override bool ImageHasPartitions() + { + return ImageInfo.imageHasPartitions; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + byte[] sector; + Track track = new Track(); + + if(!sectorCache.TryGetValue(sectorAddress, out sector)) + { + uint sectorSize; + + if(isHdd) sectorSize = ImageInfo.sectorSize; + else + { + track = GetTrack(sectorAddress); + sectorSize = (uint)track.TrackRawBytesPerSector; + } + + ulong hunkNo = sectorAddress / sectorsPerHunk; + ulong secOff = (sectorAddress * sectorSize) % (sectorsPerHunk * sectorSize); + + byte[] hunk = GetHunk(hunkNo); + + sector = new byte[ImageInfo.sectorSize]; + Array.Copy(hunk, (int)secOff, sector, 0, sector.Length); + + if(sectorCache.Count >= maxSectorCache) sectorCache.Clear(); + + sectorCache.Add(sectorAddress, sector); + } + + if(isHdd) return sector; + + uint sector_offset; + uint sector_size; + + switch(track.TrackType) + { + case TrackType.CDMode1: + case TrackType.CDMode2Form1: + { + if(track.TrackRawBytesPerSector == 2352) + { + sector_offset = 16; + sector_size = 2048; + } + else + { + sector_offset = 0; + sector_size = 2048; + } + break; + } + case TrackType.CDMode2Form2: + { + if(track.TrackRawBytesPerSector == 2352) + { + sector_offset = 16; + sector_size = 2324; + } + else + { + sector_offset = 0; + sector_size = 2324; + } + break; + } + case TrackType.CDMode2Formless: + { + if(track.TrackRawBytesPerSector == 2352) + { + sector_offset = 16; + sector_size = 2336; + } + else + { + sector_offset = 0; + sector_size = 2336; + } + break; + } + case TrackType.Audio: + { + sector_offset = 0; + sector_size = 2352; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + } + + byte[] buffer = new byte[sector_size]; + + if(track.TrackType == TrackType.Audio && swapAudio) + { + for(int i = 0; i < 2352; i += 2) + { + buffer[i + 1] = sector[i]; + buffer[i] = sector[i + 1]; + } + } + else Array.Copy(sector, sector_offset, buffer, 0, sector_size); + + return buffer; + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + if(isHdd) throw new FeatureNotPresentImageException("Hard disk images do not have sector tags"); + + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + byte[] sector; + Track track = new Track(); + + if(!sectorCache.TryGetValue(sectorAddress, out sector)) + { + uint sectorSize; + + track = GetTrack(sectorAddress); + sectorSize = (uint)track.TrackRawBytesPerSector; + + ulong hunkNo = sectorAddress / sectorsPerHunk; + ulong secOff = (sectorAddress * sectorSize) % (sectorsPerHunk * sectorSize); + + byte[] hunk = GetHunk(hunkNo); + + sector = new byte[ImageInfo.sectorSize]; + Array.Copy(hunk, (int)secOff, sector, 0, sector.Length); + + if(sectorCache.Count >= maxSectorCache) sectorCache.Clear(); + + sectorCache.Add(sectorAddress, sector); + } + + if(isHdd) return sector; + + uint sector_offset; + uint sector_size; + + if(tag == SectorTagType.CDSectorSubchannel) + { + if(track.TrackSubchannelType == TrackSubchannelType.None) + throw new FeatureNotPresentImageException("Requested sector does not contain subchannel"); + else if(track.TrackSubchannelType == TrackSubchannelType.RawInterleaved) + { + sector_offset = (uint)track.TrackRawBytesPerSector; + sector_size = 96; + } + else + throw new + FeatureSupportedButNotImplementedImageException(string.Format("Unsupported subchannel type {0}", + track.TrackSubchannelType)); + } + else + { + switch(track.TrackType) + { + case TrackType.CDMode1: + case TrackType.CDMode2Form1: + { + if(track.TrackRawBytesPerSector == 2352) + { + switch(tag) + { + case SectorTagType.CDSectorSync: + { + sector_offset = 0; + sector_size = 12; + break; + } + case SectorTagType.CDSectorHeader: + { + sector_offset = 12; + sector_size = 4; + break; + } + case SectorTagType.CDSectorSubHeader: + throw new ArgumentException("Unsupported tag requested for this track", + nameof(tag)); + case SectorTagType.CDSectorECC: + { + sector_offset = 2076; + sector_size = 276; + break; + } + case SectorTagType.CDSectorECC_P: + { + sector_offset = 2076; + sector_size = 172; + break; + } + case SectorTagType.CDSectorECC_Q: + { + sector_offset = 2248; + sector_size = 104; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2064; + sector_size = 4; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + } + else throw new FeatureNotPresentImageException("Requested sector does not contain tags"); + + break; + } + case TrackType.CDMode2Form2: + { + if(track.TrackRawBytesPerSector == 2352) + { + switch(tag) + { + case SectorTagType.CDSectorSync: + { + sector_offset = 0; + sector_size = 12; + break; + } + case SectorTagType.CDSectorHeader: + { + sector_offset = 12; + sector_size = 4; + break; + } + case SectorTagType.CDSectorSubHeader: + { + sector_offset = 16; + sector_size = 8; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2348; + sector_size = 4; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + } + else + { + switch(tag) + { + case SectorTagType.CDSectorSync: + case SectorTagType.CDSectorHeader: + case SectorTagType.CDSectorSubchannel: + case SectorTagType.CDSectorECC: + case SectorTagType.CDSectorECC_P: + case SectorTagType.CDSectorECC_Q: + throw new ArgumentException("Unsupported tag requested for this track", + nameof(tag)); + case SectorTagType.CDSectorSubHeader: + { + sector_offset = 0; + sector_size = 8; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2332; + sector_size = 4; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + } + + break; + } + case TrackType.CDMode2Formless: + { + if(track.TrackRawBytesPerSector == 2352) + { + switch(tag) + { + case SectorTagType.CDSectorSync: + case SectorTagType.CDSectorHeader: + case SectorTagType.CDSectorECC: + case SectorTagType.CDSectorECC_P: + case SectorTagType.CDSectorECC_Q: + throw new ArgumentException("Unsupported tag requested for this track", + nameof(tag)); + case SectorTagType.CDSectorSubHeader: + { + sector_offset = 0; + sector_size = 8; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2332; + sector_size = 4; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + } + else throw new FeatureNotPresentImageException("Requested sector does not contain tags"); + + break; + } + case TrackType.Audio: + throw new FeatureNotPresentImageException("Requested sector does not contain tags"); + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + } + } + + byte[] buffer = new byte[sector_size]; + + if(track.TrackType == TrackType.Audio && swapAudio) + { + for(int i = 0; i < 2352; i += 2) + { + buffer[i + 1] = sector[i]; + buffer[i] = sector[i + 1]; + } + } + else Array.Copy(sector, sector_offset, buffer, 0, sector_size); + + if(track.TrackType == TrackType.Audio && swapAudio) + { + for(int i = 0; i < 2352; i += 2) + { + buffer[i + 1] = sector[i]; + buffer[i] = sector[i + 1]; + } + } + else Array.Copy(sector, sector_offset, buffer, 0, sector_size); + + return buffer; + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), + string.Format("Requested more sectors ({0}) than available ({1})", + sectorAddress + length, ImageInfo.sectors)); + + MemoryStream ms = new MemoryStream(); + + for(uint i = 0; i < length; i++) + { + byte[] sector = ReadSector(sectorAddress + i); + ms.Write(sector, 0, sector.Length); + } + + return ms.ToArray(); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), + string.Format("Requested more sectors ({0}) than available ({1})", + sectorAddress + length, ImageInfo.sectors)); + + MemoryStream ms = new MemoryStream(); + + for(uint i = 0; i < length; i++) + { + byte[] sector = ReadSectorTag(sectorAddress + i, tag); + ms.Write(sector, 0, sector.Length); + } + + return ms.ToArray(); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + if(isHdd) return ReadSector(sectorAddress); + + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + byte[] sector; + Track track = new Track(); + + if(!sectorCache.TryGetValue(sectorAddress, out sector)) + { + uint sectorSize; + + track = GetTrack(sectorAddress); + sectorSize = (uint)track.TrackRawBytesPerSector; + + ulong hunkNo = sectorAddress / sectorsPerHunk; + ulong secOff = (sectorAddress * sectorSize) % (sectorsPerHunk * sectorSize); + + byte[] hunk = GetHunk(hunkNo); + + sector = new byte[ImageInfo.sectorSize]; + Array.Copy(hunk, (int)secOff, sector, 0, sector.Length); + + if(sectorCache.Count >= maxSectorCache) sectorCache.Clear(); + + sectorCache.Add(sectorAddress, sector); + } + + byte[] buffer = new byte[track.TrackRawBytesPerSector]; + + if(track.TrackType == TrackType.Audio && swapAudio) + { + for(int i = 0; i < 2352; i += 2) + { + buffer[i + 1] = sector[i]; + buffer[i] = sector[i + 1]; + } + } + else Array.Copy(sector, 0, buffer, 0, track.TrackRawBytesPerSector); + + return buffer; + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), + string.Format("Requested more sectors ({0}) than available ({1})", + sectorAddress + length, ImageInfo.sectors)); + + MemoryStream ms = new MemoryStream(); + + for(uint i = 0; i < length; i++) + { + byte[] sector = ReadSectorLong(sectorAddress + i); + ms.Write(sector, 0, sector.Length); + } + + return ms.ToArray(); + } + + public override string GetImageFormat() + { + return "Compressed Hunks of Data"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + if(ImageInfo.readableMediaTags.Contains(MediaTagType.ATA_IDENTIFY)) return identify; + + if(ImageInfo.readableMediaTags.Contains(MediaTagType.PCMCIA_CIS)) return cis; + + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override string GetMediaManufacturer() + { + return ImageInfo.mediaManufacturer; + } + + public override string GetMediaModel() + { + return ImageInfo.mediaModel; + } + + public override string GetMediaSerialNumber() + { + return ImageInfo.mediaSerialNumber; + } + + public override string GetMediaBarcode() + { + return ImageInfo.mediaBarcode; + } + + public override string GetMediaPartNumber() + { + return ImageInfo.mediaPartNumber; + } + + public override int GetMediaSequence() + { + return ImageInfo.mediaSequence; + } + + public override int GetLastDiskSequence() + { + return ImageInfo.lastMediaSequence; + } + + public override string GetDriveManufacturer() + { + return ImageInfo.driveManufacturer; + } + + public override string GetDriveModel() + { + return ImageInfo.driveModel; + } + + public override string GetDriveSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + + public override List<Partition> GetPartitions() + { + if(isHdd) + throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); + + return partitions; + } + + public override List<Track> GetTracks() + { + if(isHdd) + throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); + + List<Track> _trks = new List<Track>(); + foreach(Track track in tracks.Values) _trks.Add(track); + + return _trks; + } + + public override List<Track> GetSessionTracks(Session session) + { + if(isHdd) + throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); + + return GetSessionTracks(session.SessionSequence); + } + + public override List<Track> GetSessionTracks(ushort session) + { + if(isHdd) + throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); + + List<Track> _trks = new List<Track>(); + foreach(Track track in tracks.Values) { if(track.TrackSession == session) _trks.Add(track); } + + return _trks; + } + + public override List<Session> GetSessions() + { + if(isHdd) + throw new + FeaturedNotSupportedByDiscImageException("Cannot access optical sessions on a hard disk image"); + + throw new NotImplementedException(); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + if(isHdd) + throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); + + return ReadSector(GetAbsoluteSector(sectorAddress, track)); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + if(isHdd) + throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); + + return ReadSectorTag(GetAbsoluteSector(sectorAddress, track), tag); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + if(isHdd) + throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); + + return ReadSectors(GetAbsoluteSector(sectorAddress, track), length); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + if(isHdd) + throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); + + return ReadSectorsTag(GetAbsoluteSector(sectorAddress, track), length, tag); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + if(isHdd) + throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); + + return ReadSectorLong(GetAbsoluteSector(sectorAddress, track)); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + if(isHdd) + throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image"); + + return ReadSectorLong(GetAbsoluteSector(sectorAddress, track), length); + } + #endregion Unsupported features + } +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/CPCDSK.cs b/DiscImageChef.DiscImages/CPCDSK.cs index 92f8fbd9..c401b167 100644 --- a/DiscImageChef.DiscImages/CPCDSK.cs +++ b/DiscImageChef.DiscImages/CPCDSK.cs @@ -43,25 +43,37 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class CPCDSK : ImagePlugin + public class CPCDSK : ImagePlugin { #region Internal constants /// <summary> /// Identifier for CPCEMU disk images, "MV - CPCEMU Disk-File" /// </summary> - readonly byte[] CPCDSKId = { 0x4D, 0x56, 0x20, 0x2D, 0x20, 0x43, 0x50, 0x43, 0x45, 0x4D, 0x55, 0x20, 0x44, 0x69, 0x73, 0x6B, 0x2D, 0x46, 0x69, 0x6C, 0x65 }; - /// <summary> - /// Identifier for DU54 disk images, "MV - CPC format Disk Image (DU54)" - /// </summary> - readonly byte[] DU54Id = { 0x4D, 0x56, 0x20, 0x2D, 0x20, 0x43, 0x50, 0x43, 0x20, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x20, 0x44, 0x69, 0x73, 0x6B, 0x20 }; - /// <summary> - /// Identifier for Extended CPCEMU disk images, "EXTENDED CPC DSK File" - /// </summary> - readonly byte[] EDSKId = { 0x45, 0x58, 0x54, 0x45, 0x4E, 0x44, 0x45, 0x44, 0x20, 0x43, 0x50, 0x43, 0x20, 0x44, 0x53, 0x4B, 0x20, 0x46, 0x69, 0x6C, 0x65 }; + readonly byte[] CPCDSKId = + { + 0x4D, 0x56, 0x20, 0x2D, 0x20, 0x43, 0x50, 0x43, 0x45, 0x4D, 0x55, 0x20, 0x44, 0x69, 0x73, 0x6B, 0x2D, 0x46, + 0x69, 0x6C, 0x65 + }; + /// <summary> + /// Identifier for DU54 disk images, "MV - CPC format Disk Image (DU54)" + /// </summary> + readonly byte[] DU54Id = + { + 0x4D, 0x56, 0x20, 0x2D, 0x20, 0x43, 0x50, 0x43, 0x20, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x20, 0x44, 0x69, + 0x73, 0x6B, 0x20 + }; + /// <summary> + /// Identifier for Extended CPCEMU disk images, "EXTENDED CPC DSK File" + /// </summary> + readonly byte[] EDSKId = + { + 0x45, 0x58, 0x54, 0x45, 0x4E, 0x44, 0x45, 0x44, 0x20, 0x43, 0x50, 0x43, 0x20, 0x44, 0x53, 0x4B, 0x20, 0x46, + 0x69, 0x6C, 0x65 + }; /// <summary> /// Identifier for track information, "Track-Info\r\n" /// </summary> - readonly byte[] TrackId = { 0x54, 0x72, 0x61, 0x63, 0x6B, 0x2D, 0x49, 0x6E, 0x66, 0x6F }; + readonly byte[] TrackId = {0x54, 0x72, 0x61, 0x63, 0x6B, 0x2D, 0x49, 0x6E, 0x66, 0x6F}; #endregion #region Internal structures @@ -71,18 +83,15 @@ namespace DiscImageChef.ImagePlugins /// <summary> /// Magic number, "MV - CPCEMU Disk-File" in old files, "EXTENDED CPC DSK File" in extended ones /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 21)] - public byte[] magic; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 21)] public byte[] magic; /// <summary> /// Second part of magic, should be "\r\nDisk-Info\r\n" in all, but some emulators write spaces instead. /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] - public byte[] magic2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] public byte[] magic2; /// <summary> /// Creator application (can be null) /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public byte[] creator; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] creator; /// <summary> /// Tracks /// </summary> @@ -98,8 +107,7 @@ namespace DiscImageChef.ImagePlugins /// <summary> /// Size of each track in the extended format. 0 indicates track is not formatted and not present in image. /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 204)] - public byte[] tracksizeTable; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 204)] public byte[] tracksizeTable; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -108,10 +116,8 @@ namespace DiscImageChef.ImagePlugins /// <summary> /// Magic number, "Track-Info\r\n" /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] magic; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] carriageReturn; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] magic; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] carriageReturn; /// <summary> /// Padding /// </summary> @@ -151,8 +157,7 @@ namespace DiscImageChef.ImagePlugins /// <summary> /// Informatino for up to 32 sectors /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public CPCSectorInfo[] sectorsInfo; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public CPCSectorInfo[] sectorsInfo; } /// <summary> @@ -230,8 +235,7 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] header_b = new byte[256]; stream.Read(header_b, 0, 256); @@ -241,9 +245,11 @@ namespace DiscImageChef.ImagePlugins header = (CPCDiskInfo)Marshal.PtrToStructure(headerPtr, typeof(CPCDiskInfo)); Marshal.FreeHGlobal(headerPtr); - DicConsole.DebugWriteLine("CPCDSK plugin", "header.magic = \"{0}\"", StringHandlers.CToString(header.magic)); + DicConsole.DebugWriteLine("CPCDSK plugin", "header.magic = \"{0}\"", + StringHandlers.CToString(header.magic)); - return CPCDSKId.SequenceEqual(header.magic) || EDSKId.SequenceEqual(header.magic) || DU54Id.SequenceEqual(header.magic); + return CPCDSKId.SequenceEqual(header.magic) || EDSKId.SequenceEqual(header.magic) || + DU54Id.SequenceEqual(header.magic); } public override bool OpenImage(Filter imageFilter) @@ -251,8 +257,7 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] header_b = new byte[256]; stream.Read(header_b, 0, 256); @@ -262,25 +267,28 @@ namespace DiscImageChef.ImagePlugins header = (CPCDiskInfo)Marshal.PtrToStructure(headerPtr, typeof(CPCDiskInfo)); Marshal.FreeHGlobal(headerPtr); - if(!CPCDSKId.SequenceEqual(header.magic) && !EDSKId.SequenceEqual(header.magic) && !DU54Id.SequenceEqual(header.magic)) - return false; + if(!CPCDSKId.SequenceEqual(header.magic) && !EDSKId.SequenceEqual(header.magic) && + !DU54Id.SequenceEqual(header.magic)) return false; extended = EDSKId.SequenceEqual(header.magic); DicConsole.DebugWriteLine("CPCDSK plugin", "Extended = {0}", extended); - DicConsole.DebugWriteLine("CPCDSK plugin", "header.magic = \"{0}\"", StringHandlers.CToString(header.magic)); - DicConsole.DebugWriteLine("CPCDSK plugin", "header.magic2 = \"{0}\"", StringHandlers.CToString(header.magic2)); - DicConsole.DebugWriteLine("CPCDSK plugin", "header.creator = \"{0}\"", StringHandlers.CToString(header.creator)); + DicConsole.DebugWriteLine("CPCDSK plugin", "header.magic = \"{0}\"", + StringHandlers.CToString(header.magic)); + DicConsole.DebugWriteLine("CPCDSK plugin", "header.magic2 = \"{0}\"", + StringHandlers.CToString(header.magic2)); + DicConsole.DebugWriteLine("CPCDSK plugin", "header.creator = \"{0}\"", + StringHandlers.CToString(header.creator)); DicConsole.DebugWriteLine("CPCDSK plugin", "header.tracks = {0}", header.tracks); DicConsole.DebugWriteLine("CPCDSK plugin", "header.sides = {0}", header.sides); - if(!extended) - DicConsole.DebugWriteLine("CPCDSK plugin", "header.tracksize = {0}", header.tracksize); + if(!extended) DicConsole.DebugWriteLine("CPCDSK plugin", "header.tracksize = {0}", header.tracksize); else { for(int i = 0; i < header.tracks; i++) { for(int j = 0; j < header.sides; j++) { - DicConsole.DebugWriteLine("CPCDSK plugin", "Track {0} Side {1} size = {2}", i, j, header.tracksizeTable[i*header.sides + j] * 256); + DicConsole.DebugWriteLine("CPCDSK plugin", "Track {0} Side {1} size = {2}", i, j, + header.tracksizeTable[i * header.sides + j] * 256); } } } @@ -299,8 +307,7 @@ namespace DiscImageChef.ImagePlugins for(int j = 0; j < header.sides; j++) { // Track not stored in image - if(extended && header.tracksizeTable[i * header.sides + j] == 0) - continue; + if(extended && header.tracksizeTable[i * header.sides + j] == 0) continue; long trackPos = stream.Position; @@ -318,23 +325,29 @@ namespace DiscImageChef.ImagePlugins return false; } - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].magic = \"{0}\"", StringHandlers.CToString(trackInfo.magic), i, j); - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].bps = {0}", SizeCodeToBytes(trackInfo.bps), i, j); - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].dataRate = {0}", trackInfo.dataRate, i, j); - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].filler = 0x{0:X2}", trackInfo.filler, i, j); - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].gap3 = 0x{0:X2}", trackInfo.gap3, i, j); - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].padding = {0}", trackInfo.padding, i, j); - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].recordingMode = {0}", trackInfo.recordingMode, i, j); - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sectors = {0}", trackInfo.sectors, i, j); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].magic = \"{0}\"", + StringHandlers.CToString(trackInfo.magic), i, j); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].bps = {0}", + SizeCodeToBytes(trackInfo.bps), i, j); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].dataRate = {0}", trackInfo.dataRate, + i, j); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].filler = 0x{0:X2}", trackInfo.filler, + i, j); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].gap3 = 0x{0:X2}", trackInfo.gap3, i, + j); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].padding = {0}", trackInfo.padding, i, + j); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].recordingMode = {0}", + trackInfo.recordingMode, i, j); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sectors = {0}", trackInfo.sectors, i, + j); DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].side = {0}", trackInfo.side, i, j); DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].track = {0}", trackInfo.track, i, j); if(trackInfo.sectors != sectorsPerTrack) { - if(sectorsPerTrack == 0) - sectorsPerTrack = trackInfo.sectors; - else - allTracksSameSize = false; + if(sectorsPerTrack == 0) sectorsPerTrack = trackInfo.sectors; + else allTracksSameSize = false; } byte[][] thisTrackSectors = new byte[trackInfo.sectors][]; @@ -342,19 +355,24 @@ namespace DiscImageChef.ImagePlugins for(int k = 1; k <= trackInfo.sectors; k++) { - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].id = 0x{0:X2}", trackInfo.sectorsInfo[k - 1].id, i, j, k); - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].len = {0}", trackInfo.sectorsInfo[k - 1].len, i, j, k); - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].side = {0}", trackInfo.sectorsInfo[k - 1].side, i, j, k); - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].size = {0}", SizeCodeToBytes(trackInfo.sectorsInfo[k - 1].size), i, j, k); - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].st1 = 0x{0:X2}", trackInfo.sectorsInfo[k - 1].st1, i, j, k); - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].st2 = 0x{0:X2}", trackInfo.sectorsInfo[k - 1].st2, i, j, k); - DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].track = {0}", trackInfo.sectorsInfo[k - 1].track, i, j, k); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].id = 0x{0:X2}", + trackInfo.sectorsInfo[k - 1].id, i, j, k); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].len = {0}", + trackInfo.sectorsInfo[k - 1].len, i, j, k); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].side = {0}", + trackInfo.sectorsInfo[k - 1].side, i, j, k); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].size = {0}", + SizeCodeToBytes(trackInfo.sectorsInfo[k - 1].size), i, j, k); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].st1 = 0x{0:X2}", + trackInfo.sectorsInfo[k - 1].st1, i, j, k); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].st2 = 0x{0:X2}", + trackInfo.sectorsInfo[k - 1].st2, i, j, k); + DicConsole.DebugWriteLine("CPCDSK plugin", "trackInfo[{1}:{2}].sector[{3}].track = {0}", + trackInfo.sectorsInfo[k - 1].track, i, j, k); int sectLen; - if(extended) - sectLen = trackInfo.sectorsInfo[k - 1].len; - else - sectLen = SizeCodeToBytes(trackInfo.sectorsInfo[k - 1].size); + if(extended) sectLen = trackInfo.sectorsInfo[k - 1].len; + else sectLen = SizeCodeToBytes(trackInfo.sectorsInfo[k - 1].size); byte[] sector = new byte[sectLen]; stream.Read(sector, 0, sectLen); @@ -432,9 +450,9 @@ namespace DiscImageChef.ImagePlugins ImageInfo.mediaType = MediaType.CompactFloppy; ImageInfo.readableSectorTags.Add(SectorTagType.FloppyAddressMark); - // Debug writing full disk as raw - /* - FileStream foo = new FileStream(Path.GetFileNameWithoutExtension(imageFilter.GetFilename()) + ".bin", FileMode.Create); + // Debug writing full disk as raw + /* + FileStream foo = new FileStream(Path.GetFileNameWithoutExtension(imageFilter.GetFilename()) + ".bin", FileMode.Create); for(ulong i = 0; i < (ulong)sectors.Count; i++) { byte[] foob; @@ -444,35 +462,26 @@ namespace DiscImageChef.ImagePlugins foo.Close(); */ - ImageInfo.cylinders = header.tracks; - ImageInfo.heads = header.sides; - ImageInfo.sectorsPerTrack = (uint)(ImageInfo.sectors / (ImageInfo.cylinders * ImageInfo.heads)); + ImageInfo.cylinders = header.tracks; + ImageInfo.heads = header.sides; + ImageInfo.sectorsPerTrack = (uint)(ImageInfo.sectors / (ImageInfo.cylinders * ImageInfo.heads)); - return true; + return true; } static int SizeCodeToBytes(IBMSectorSizeCode code) { switch(code) { - case IBMSectorSizeCode.EighthKilo: - return 128; - case IBMSectorSizeCode.QuarterKilo: - return 256; - case IBMSectorSizeCode.HalfKilo: - return 512; - case IBMSectorSizeCode.Kilo: - return 1024; - case IBMSectorSizeCode.TwiceKilo: - return 2048; - case IBMSectorSizeCode.FriceKilo: - return 4096; - case IBMSectorSizeCode.TwiceFriceKilo: - return 8192; - case IBMSectorSizeCode.FricelyFriceKilo: - return 16384; - default: - return 0; + case IBMSectorSizeCode.EighthKilo: return 128; + case IBMSectorSizeCode.QuarterKilo: return 256; + case IBMSectorSizeCode.HalfKilo: return 512; + case IBMSectorSizeCode.Kilo: return 1024; + case IBMSectorSizeCode.TwiceKilo: return 2048; + case IBMSectorSizeCode.FriceKilo: return 4096; + case IBMSectorSizeCode.TwiceFriceKilo: return 8192; + case IBMSectorSizeCode.FricelyFriceKilo: return 16384; + default: return 0; } } @@ -549,16 +558,17 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSector(ulong sectorAddress) { byte[] sector; - if(sectors.TryGetValue(sectorAddress, out sector)) - return sector; - - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + if(sectors.TryGetValue(sectorAddress, out sector)) return sector; + + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); } public override byte[] ReadSectors(ulong sectorAddress, uint length) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); if(sectorAddress + length > ImageInfo.sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); @@ -580,8 +590,7 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); byte[] addressMark; - if(addressMarks.TryGetValue(sectorAddress, out addressMark)) - return addressMark; + if(addressMarks.TryGetValue(sectorAddress, out addressMark)) return addressMark; throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); } @@ -592,7 +601,8 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); if(sectorAddress + length > ImageInfo.sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); @@ -609,7 +619,6 @@ namespace DiscImageChef.ImagePlugins } #region Unsupported features - public override byte[] ReadDiskTag(MediaTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -740,16 +749,18 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -758,8 +769,6 @@ namespace DiscImageChef.ImagePlugins { return null; } - #endregion } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/CisCopy.cs b/DiscImageChef.DiscImages/CisCopy.cs index eb641a61..f324a43a 100644 --- a/DiscImageChef.DiscImages/CisCopy.cs +++ b/DiscImageChef.DiscImages/CisCopy.cs @@ -39,565 +39,558 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - /* This is a very simple format created by a German application called CisCopy, aka CCOPY.EXE, with extension .DCF. - * First byte indicates the floppy type, limited to standard formats. - * Indeed if the floppy is not DOS formatted, user must choose from the list of supported formats manually. - * Next 80 bytes (for 5.25" DD disks) or 160 bytes (for 5.25" HD and 3.5" disks) indicate if a track has been copied - * or not. - * It offers three copy methods: - * a) All, copies all tracks - * b) FAT, copies all tracks which contain sectors marked as sued by FAT - * c) "Belelung" similarly to FAT. On some disk tests FAT cuts data, while belelung does not. - * Finally, next byte indicates compression: - * 0) No compression - * 1) Normal compression, algorithm unknown - * 2) High compression, algorithm unknown - * Then the data for whole tracks follow. - */ - public class CisCopy : ImagePlugin - { - #region Internal enumerations - enum DiskType : byte - { - MD1DD8 = 1, - MD1DD = 2, - MD2DD8 = 3, - MD2DD = 4, - MF2DD = 5, - MD2HD = 6, - MF2HD = 7 - } - - enum Compression : byte - { - None = 0, - Normal = 1, - High = 2 - } - - enum TrackType : byte - { - Copied = 0x4C, - Omitted = 0xFA, - OmittedAlternate = 0xFE - } - #endregion Internal enumeration - - - #region Internal variables - byte[] decodedDisk; - #endregion Internal variables - - public CisCopy() - { - Name = "CisCopy Disk Image (DC-File)"; - PluginUUID = new Guid("EDF20CC7-6012-49E2-9E92-663A53E42130"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = false; - ImageInfo.imageHasSessions = false; - ImageInfo.imageVersion = null; - ImageInfo.imageApplication = null; - ImageInfo.imageApplicationVersion = null; - ImageInfo.imageCreator = null; - ImageInfo.imageComments = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaSerialNumber = null; - ImageInfo.mediaBarcode = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - #region Public methods - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - DiskType type = (DiskType)stream.ReadByte(); - byte tracks = 0; - - switch(type) - { - case DiskType.MD1DD8: - case DiskType.MD1DD: - case DiskType.MD2DD8: - case DiskType.MD2DD: - tracks = 80; - break; - case DiskType.MF2DD: - case DiskType.MD2HD: - case DiskType.MF2HD: - tracks = 160; - break; - default: - return false; - } - - byte[] trackBytes = new byte[tracks]; - stream.Read(trackBytes, 0, tracks); - - for(int i = 0; i < tracks; i++) - { - if(trackBytes[i] != (byte)TrackType.Copied && trackBytes[i] != (byte)TrackType.Omitted && trackBytes[i] != (byte)TrackType.OmittedAlternate) - return false; - } - - Compression cmpr = (Compression)stream.ReadByte(); - - if(cmpr != Compression.None && cmpr != Compression.Normal && cmpr != Compression.High) - return false; - - switch(type) - { - case DiskType.MD1DD8: - if(stream.Length > 40 * 1 * 8 * 512 + 82) - return false; - break; - case DiskType.MD1DD: - if(stream.Length > 40 * 1 * 9 * 512 + 82) - return false; - break; - case DiskType.MD2DD8: - if(stream.Length > 40 * 2 * 8 * 512 + 82) - return false; - break; - case DiskType.MD2DD: - if(stream.Length > 40 * 2 * 9 * 512 + 82) - return false; - break; - case DiskType.MF2DD: - if(stream.Length > 80 * 2 * 9 * 512 + 162) - return false; - break; - case DiskType.MD2HD: - if(stream.Length > 80 * 2 * 15 * 512 + 162) - return false; - break; - case DiskType.MF2HD: - if(stream.Length > 80 * 2 * 18 * 512 + 162) - return false; - break; - } - - return true; - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - MemoryStream decodedImage; - - DiskType type = (DiskType)stream.ReadByte(); - byte tracks = 0; - - switch(type) - { - case DiskType.MD1DD8: - case DiskType.MD1DD: - case DiskType.MD2DD8: - case DiskType.MD2DD: - tracks = 80; - break; - case DiskType.MF2DD: - case DiskType.MD2HD: - case DiskType.MF2HD: - tracks = 160; - break; - default: - throw new ImageNotSupportedException(string.Format("Incorrect disk type {0}", (byte)type)); - } - - byte[] trackBytes = new byte[tracks]; - stream.Read(trackBytes, 0, tracks); - - Compression cmpr = (Compression)stream.ReadByte(); - - if(cmpr != Compression.None) - throw new FeatureSupportedButNotImplementedImageException("Compressed images are not supported."); - - int tracksize = 0; - - switch(type) - { - case DiskType.MD1DD8: - case DiskType.MD2DD8: - tracksize = 8 * 512; - break; - case DiskType.MD1DD: - case DiskType.MD2DD: - case DiskType.MF2DD: - tracksize = 9 * 512; - break; - case DiskType.MD2HD: - tracksize = 15 * 512; - break; - case DiskType.MF2HD: - tracksize = 18 * 512; - break; - } - - int headstep = 1; - if(type == DiskType.MD1DD || type == DiskType.MD1DD8) - headstep = 2; - - decodedImage = new MemoryStream(); - - for(int i = 0; i < tracks; i += headstep) - { - byte[] track = new byte[tracksize]; - - if((TrackType)trackBytes[i] == TrackType.Copied) - stream.Read(track, 0, tracksize); - else - ArrayHelpers.ArrayFill(track, (byte)0xF6); - - decodedImage.Write(track, 0, tracksize); - } - -/* - FileStream debugStream = new FileStream("debug.img", FileMode.CreateNew, FileAccess.ReadWrite); - debugStream.Write(decodedImage.ToArray(), 0, (int)decodedImage.Length); - debugStream.Close(); -*/ - - ImageInfo.imageApplication = "CisCopy"; - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = imageFilter.GetFilename(); - ImageInfo.imageSize = (ulong)(stream.Length - 2 - trackBytes.Length); - ImageInfo.sectorSize = 512; - - switch(type) - { - case DiskType.MD1DD8: - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; - ImageInfo.sectors = 40 * 1 * 8; - ImageInfo.heads = 1; - ImageInfo.cylinders = 40; - ImageInfo.sectorsPerTrack = 8; - break; - case DiskType.MD2DD8: - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; - ImageInfo.sectors = 40 * 2 * 8; - ImageInfo.heads = 2; - ImageInfo.cylinders = 40; - ImageInfo.sectorsPerTrack = 8; - break; - case DiskType.MD1DD: - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; - ImageInfo.sectors = 40 * 1 * 9; - ImageInfo.heads = 1; - ImageInfo.cylinders = 40; - ImageInfo.sectorsPerTrack = 9; - break; - case DiskType.MD2DD: - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; - ImageInfo.sectors = 40 * 2 * 9; - ImageInfo.heads = 2; - ImageInfo.cylinders = 40; - ImageInfo.sectorsPerTrack = 9; - break; - case DiskType.MF2DD: - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; - ImageInfo.sectors = 80 * 2 * 9; - ImageInfo.heads = 2; - ImageInfo.cylinders = 80; - ImageInfo.sectorsPerTrack = 9; - break; - case DiskType.MD2HD: - ImageInfo.mediaType = MediaType.DOS_525_HD; - ImageInfo.sectors = 80 * 2 * 15; - ImageInfo.heads = 2; - ImageInfo.cylinders = 80; - ImageInfo.sectorsPerTrack = 15; - break; - case DiskType.MF2HD: - ImageInfo.mediaType = MediaType.DOS_35_HD; - ImageInfo.sectors = 80 * 2 * 18; - ImageInfo.heads = 2; - ImageInfo.cylinders = 80; - ImageInfo.sectorsPerTrack = 18; - break; - } - - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - decodedDisk = decodedImage.ToArray(); - - decodedImage.Close(); - - DicConsole.VerboseWriteLine("CisCopy image contains a disk of type {0}", ImageInfo.mediaType); - - return true; - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifyMediaImage() - { - return null; - } - - public override bool ImageHasPartitions() - { - return ImageInfo.imageHasPartitions; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] buffer = new byte[length * ImageInfo.sectorSize]; - - Array.Copy(decodedDisk, (int)sectorAddress * ImageInfo.sectorSize, buffer, 0, length * ImageInfo.sectorSize); - - return buffer; - } - - public override string GetImageFormat() - { - return "CisCopy"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override string GetMediaManufacturer() - { - return ImageInfo.mediaManufacturer; - } - - public override string GetMediaModel() - { - return ImageInfo.mediaModel; - } - - public override string GetMediaSerialNumber() - { - return ImageInfo.mediaSerialNumber; - } - - public override string GetMediaBarcode() - { - return ImageInfo.mediaBarcode; - } - - public override string GetMediaPartNumber() - { - return ImageInfo.mediaPartNumber; - } - - public override int GetMediaSequence() - { - return ImageInfo.mediaSequence; - } - - public override int GetLastDiskSequence() - { - return ImageInfo.lastMediaSequence; - } - - public override string GetDriveManufacturer() - { - return ImageInfo.driveManufacturer; - } - - public override string GetDriveModel() - { - return ImageInfo.driveModel; - } - - public override string GetDriveSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - #endregion Public methods - - #region Unsupported features - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - #endregion Unsupported features - } -} - + /* This is a very simple format created by a German application called CisCopy, aka CCOPY.EXE, with extension .DCF. + * First byte indicates the floppy type, limited to standard formats. + * Indeed if the floppy is not DOS formatted, user must choose from the list of supported formats manually. + * Next 80 bytes (for 5.25" DD disks) or 160 bytes (for 5.25" HD and 3.5" disks) indicate if a track has been copied + * or not. + * It offers three copy methods: + * a) All, copies all tracks + * b) FAT, copies all tracks which contain sectors marked as sued by FAT + * c) "Belelung" similarly to FAT. On some disk tests FAT cuts data, while belelung does not. + * Finally, next byte indicates compression: + * 0) No compression + * 1) Normal compression, algorithm unknown + * 2) High compression, algorithm unknown + * Then the data for whole tracks follow. + */ + public class CisCopy : ImagePlugin + { + #region Internal enumerations + enum DiskType : byte + { + MD1DD8 = 1, + MD1DD = 2, + MD2DD8 = 3, + MD2DD = 4, + MF2DD = 5, + MD2HD = 6, + MF2HD = 7 + } + + enum Compression : byte + { + None = 0, + Normal = 1, + High = 2 + } + + enum TrackType : byte + { + Copied = 0x4C, + Omitted = 0xFA, + OmittedAlternate = 0xFE + } + #endregion Internal enumeration + + #region Internal variables + byte[] decodedDisk; + #endregion Internal variables + + public CisCopy() + { + Name = "CisCopy Disk Image (DC-File)"; + PluginUUID = new Guid("EDF20CC7-6012-49E2-9E92-663A53E42130"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = false; + ImageInfo.imageHasSessions = false; + ImageInfo.imageVersion = null; + ImageInfo.imageApplication = null; + ImageInfo.imageApplicationVersion = null; + ImageInfo.imageCreator = null; + ImageInfo.imageComments = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaSerialNumber = null; + ImageInfo.mediaBarcode = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + #region Public methods + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + DiskType type = (DiskType)stream.ReadByte(); + byte tracks = 0; + + switch(type) + { + case DiskType.MD1DD8: + case DiskType.MD1DD: + case DiskType.MD2DD8: + case DiskType.MD2DD: + tracks = 80; + break; + case DiskType.MF2DD: + case DiskType.MD2HD: + case DiskType.MF2HD: + tracks = 160; + break; + default: return false; + } + + byte[] trackBytes = new byte[tracks]; + stream.Read(trackBytes, 0, tracks); + + for(int i = 0; i < tracks; i++) + { + if(trackBytes[i] != (byte)TrackType.Copied && trackBytes[i] != (byte)TrackType.Omitted && + trackBytes[i] != (byte)TrackType.OmittedAlternate) return false; + } + + Compression cmpr = (Compression)stream.ReadByte(); + + if(cmpr != Compression.None && cmpr != Compression.Normal && cmpr != Compression.High) return false; + + switch(type) + { + case DiskType.MD1DD8: + if(stream.Length > 40 * 1 * 8 * 512 + 82) return false; + + break; + case DiskType.MD1DD: + if(stream.Length > 40 * 1 * 9 * 512 + 82) return false; + + break; + case DiskType.MD2DD8: + if(stream.Length > 40 * 2 * 8 * 512 + 82) return false; + + break; + case DiskType.MD2DD: + if(stream.Length > 40 * 2 * 9 * 512 + 82) return false; + + break; + case DiskType.MF2DD: + if(stream.Length > 80 * 2 * 9 * 512 + 162) return false; + + break; + case DiskType.MD2HD: + if(stream.Length > 80 * 2 * 15 * 512 + 162) return false; + + break; + case DiskType.MF2HD: + if(stream.Length > 80 * 2 * 18 * 512 + 162) return false; + + break; + } + + return true; + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + MemoryStream decodedImage; + + DiskType type = (DiskType)stream.ReadByte(); + byte tracks = 0; + + switch(type) + { + case DiskType.MD1DD8: + case DiskType.MD1DD: + case DiskType.MD2DD8: + case DiskType.MD2DD: + tracks = 80; + break; + case DiskType.MF2DD: + case DiskType.MD2HD: + case DiskType.MF2HD: + tracks = 160; + break; + default: throw new ImageNotSupportedException(string.Format("Incorrect disk type {0}", (byte)type)); + } + + byte[] trackBytes = new byte[tracks]; + stream.Read(trackBytes, 0, tracks); + + Compression cmpr = (Compression)stream.ReadByte(); + + if(cmpr != Compression.None) + throw new FeatureSupportedButNotImplementedImageException("Compressed images are not supported."); + + int tracksize = 0; + + switch(type) + { + case DiskType.MD1DD8: + case DiskType.MD2DD8: + tracksize = 8 * 512; + break; + case DiskType.MD1DD: + case DiskType.MD2DD: + case DiskType.MF2DD: + tracksize = 9 * 512; + break; + case DiskType.MD2HD: + tracksize = 15 * 512; + break; + case DiskType.MF2HD: + tracksize = 18 * 512; + break; + } + + int headstep = 1; + if(type == DiskType.MD1DD || type == DiskType.MD1DD8) headstep = 2; + + decodedImage = new MemoryStream(); + + for(int i = 0; i < tracks; i += headstep) + { + byte[] track = new byte[tracksize]; + + if((TrackType)trackBytes[i] == TrackType.Copied) stream.Read(track, 0, tracksize); + else ArrayHelpers.ArrayFill(track, (byte)0xF6); + + decodedImage.Write(track, 0, tracksize); + } + + /* + FileStream debugStream = new FileStream("debug.img", FileMode.CreateNew, FileAccess.ReadWrite); + debugStream.Write(decodedImage.ToArray(), 0, (int)decodedImage.Length); + debugStream.Close(); + */ + + ImageInfo.imageApplication = "CisCopy"; + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = imageFilter.GetFilename(); + ImageInfo.imageSize = (ulong)(stream.Length - 2 - trackBytes.Length); + ImageInfo.sectorSize = 512; + + switch(type) + { + case DiskType.MD1DD8: + ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; + ImageInfo.sectors = 40 * 1 * 8; + ImageInfo.heads = 1; + ImageInfo.cylinders = 40; + ImageInfo.sectorsPerTrack = 8; + break; + case DiskType.MD2DD8: + ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; + ImageInfo.sectors = 40 * 2 * 8; + ImageInfo.heads = 2; + ImageInfo.cylinders = 40; + ImageInfo.sectorsPerTrack = 8; + break; + case DiskType.MD1DD: + ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; + ImageInfo.sectors = 40 * 1 * 9; + ImageInfo.heads = 1; + ImageInfo.cylinders = 40; + ImageInfo.sectorsPerTrack = 9; + break; + case DiskType.MD2DD: + ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; + ImageInfo.sectors = 40 * 2 * 9; + ImageInfo.heads = 2; + ImageInfo.cylinders = 40; + ImageInfo.sectorsPerTrack = 9; + break; + case DiskType.MF2DD: + ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; + ImageInfo.sectors = 80 * 2 * 9; + ImageInfo.heads = 2; + ImageInfo.cylinders = 80; + ImageInfo.sectorsPerTrack = 9; + break; + case DiskType.MD2HD: + ImageInfo.mediaType = MediaType.DOS_525_HD; + ImageInfo.sectors = 80 * 2 * 15; + ImageInfo.heads = 2; + ImageInfo.cylinders = 80; + ImageInfo.sectorsPerTrack = 15; + break; + case DiskType.MF2HD: + ImageInfo.mediaType = MediaType.DOS_35_HD; + ImageInfo.sectors = 80 * 2 * 18; + ImageInfo.heads = 2; + ImageInfo.cylinders = 80; + ImageInfo.sectorsPerTrack = 18; + break; + } + + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + decodedDisk = decodedImage.ToArray(); + + decodedImage.Close(); + + DicConsole.VerboseWriteLine("CisCopy image contains a disk of type {0}", ImageInfo.mediaType); + + return true; + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifyMediaImage() + { + return null; + } + + public override bool ImageHasPartitions() + { + return ImageInfo.imageHasPartitions; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] buffer = new byte[length * ImageInfo.sectorSize]; + + Array.Copy(decodedDisk, (int)sectorAddress * ImageInfo.sectorSize, buffer, 0, + length * ImageInfo.sectorSize); + + return buffer; + } + + public override string GetImageFormat() + { + return "CisCopy"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override string GetMediaManufacturer() + { + return ImageInfo.mediaManufacturer; + } + + public override string GetMediaModel() + { + return ImageInfo.mediaModel; + } + + public override string GetMediaSerialNumber() + { + return ImageInfo.mediaSerialNumber; + } + + public override string GetMediaBarcode() + { + return ImageInfo.mediaBarcode; + } + + public override string GetMediaPartNumber() + { + return ImageInfo.mediaPartNumber; + } + + public override int GetMediaSequence() + { + return ImageInfo.mediaSequence; + } + + public override int GetLastDiskSequence() + { + return ImageInfo.lastMediaSequence; + } + + public override string GetDriveManufacturer() + { + return ImageInfo.driveManufacturer; + } + + public override string GetDriveModel() + { + return ImageInfo.driveModel; + } + + public override string GetDriveSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + #endregion Public methods + + #region Unsupported features + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + #endregion Unsupported features + } +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/CloneCD.cs b/DiscImageChef.DiscImages/CloneCD.cs index 8e45b1bb..b3e0e58c 100644 --- a/DiscImageChef.DiscImages/CloneCD.cs +++ b/DiscImageChef.DiscImages/CloneCD.cs @@ -43,1514 +43,1546 @@ using DiscImageChef.ImagePlugins; namespace DiscImageChef.DiscImages { - public class CloneCD : ImagePlugin + public class CloneCD : ImagePlugin { - #region Parsing regexs - const string CCD_Identifier = "^\\s*\\[CloneCD\\]"; - const string Disc_Identifier = "^\\s*\\[Disc\\]"; - const string Session_Identifier = "^\\s*\\[Session\\s*(?<number>\\d+)\\]"; - const string Entry_Identifier = "^\\s*\\[Entry\\s*(?<number>\\d+)\\]"; - const string Track_Identifier = "^\\s*\\[TRACK\\s*(?<number>\\d+)\\]"; - const string CDText_Identifier = "^\\s*\\[CDText\\]"; - const string CCD_Version = "^\\s*Version\\s*=\\s*(?<value>\\d+)"; - const string Disc_Entries = "^\\s*TocEntries\\s*=\\s*(?<value>\\d+)"; - const string Disc_Sessions = "^\\s*Sessions\\s*=\\s*(?<value>\\d+)"; - const string Disc_Scrambled = "^\\s*DataTracksScrambled\\s*=\\s*(?<value>\\d+)"; - const string CDText_Length = "^\\s*CDTextLength\\s*=\\s*(?<value>\\d+)"; - const string Disc_Catalog = "^\\s*CATALOG\\s*=\\s*(?<value>\\w+)"; - const string Session_Pregap = "^\\s*PreGapMode\\s*=\\s*(?<value>\\d+)"; - const string Session_Subchannel = "^\\s*PreGapSubC\\s*=\\s*(?<value>\\d+)"; - const string Entry_Session = "^\\s*Session\\s*=\\s*(?<value>\\d+)"; - const string Entry_Point = "^\\s*Point\\s*=\\s*(?<value>[\\w+]+)"; - const string Entry_ADR = "^\\s*ADR\\s*=\\s*(?<value>\\w+)"; - const string Entry_Control = "^\\s*Control\\s*=\\s*(?<value>\\w+)"; - const string Entry_TrackNo = "^\\s*TrackNo\\s*=\\s*(?<value>\\d+)"; - const string Entry_AMin = "^\\s*AMin\\s*=\\s*(?<value>\\d+)"; - const string Entry_ASec = "^\\s*ASec\\s*=\\s*(?<value>\\d+)"; - const string Entry_AFrame = "^\\s*AFrame\\s*=\\s*(?<value>\\d+)"; - const string Entry_ALBA = "^\\s*ALBA\\s*=\\s*(?<value>-?\\d+)"; - const string Entry_Zero = "^\\s*Zero\\s*=\\s*(?<value>\\d+)"; - const string Entry_PMin = "^\\s*PMin\\s*=\\s*(?<value>\\d+)"; - const string Entry_PSec = "^\\s*PSec\\s*=\\s*(?<value>\\d+)"; - const string Entry_PFrame = "^\\s*PFrame\\s*=\\s*(?<value>\\d+)"; - const string Entry_PLBA ="^\\s*PLBA\\s*=\\s*(?<value>\\d+)"; - const string CDText_Entries = "^\\s*Entries\\s*=\\s*(?<value>\\d+)"; - const string CDText_Entry = "^\\s*Entry\\s*(?<number>\\d+)\\s*=\\s*(?<value>([0-9a-fA-F]+\\s*)+)"; - #endregion - - Filter imageFilter; - Filter dataFilter; - Filter subFilter; - StreamReader cueStream; - byte[] fulltoc; - bool scrambled; - string catalog; - List<ImagePlugins.Session> sessions; - List<Partition> partitions; - List<Track> tracks; - Stream dataStream; - Stream subStream; - Dictionary<uint, ulong> offsetmap; - byte[] cdtext; - - public CloneCD() - { - Name = "CloneCD"; - PluginUUID = new Guid("EE9C2975-2E79-427A-8EE9-F86F19165784"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = true; - ImageInfo.imageHasSessions = true; - ImageInfo.imageVersion = null; - ImageInfo.imageApplicationVersion = null; - ImageInfo.imageName = null; - ImageInfo.imageCreator = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - public override bool IdentifyImage(Filter imageFilter) - { - this.imageFilter = imageFilter; - - try - { - imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); - byte[] testArray = new byte[512]; - imageFilter.GetDataForkStream().Read(testArray, 0, 512); - imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); - // Check for unexpected control characters that shouldn't be present in a text file and can crash this plugin - bool twoConsecutiveNulls = false; - for(int i = 0; i < 512; i++) - { - if(i >= imageFilter.GetDataForkStream().Length) - break; - - if(testArray[i] == 0) - { - if(twoConsecutiveNulls) - return false; - twoConsecutiveNulls = true; - } - else - twoConsecutiveNulls = false; - - if(testArray[i] < 0x20 && testArray[i] != 0x0A && testArray[i] != 0x0D && testArray[i] != 0x00) - return false; - } - - cueStream = new StreamReader(this.imageFilter.GetDataForkStream()); - - string _line = cueStream.ReadLine(); - - Regex Hdr = new Regex(CCD_Identifier); - - Match Hdm; - - Hdm = Hdr.Match(_line); - - return Hdm.Success; - } - catch(Exception ex) - { - DicConsole.ErrorWriteLine("Exception trying to identify image file {0}", this.imageFilter); - DicConsole.ErrorWriteLine("Exception: {0}", ex.Message); - DicConsole.ErrorWriteLine("Stack trace: {0}", ex.StackTrace); - return false; - } - } - - public override bool OpenImage(Filter imageFilter) - { - if(imageFilter == null) - return false; - - this.imageFilter = imageFilter; - - try - { - imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); - cueStream = new StreamReader(imageFilter.GetDataForkStream()); - int line = 0; - - Regex CCD_IdRegex = new Regex(CCD_Identifier); - Regex Disc_IdRegex = new Regex(Disc_Identifier); - Regex Sess_IdRegex = new Regex(Session_Identifier); - Regex Entry_IdRegex = new Regex(Entry_Identifier); - Regex Track_IdRegex = new Regex(Track_Identifier); - Regex CDT_IdRegex = new Regex(CDText_Identifier); - Regex CCD_VerRegex = new Regex(CCD_Version); - Regex Disc_EntRegex = new Regex(Disc_Entries); - Regex Disc_SessRegex = new Regex(Disc_Sessions); - Regex Disc_ScrRegex = new Regex(Disc_Scrambled); - Regex CDT_LenRegex = new Regex(CDText_Length); - Regex Disc_CatRegex = new Regex(Disc_Catalog); - Regex Sess_PregRegex = new Regex(Session_Pregap); - Regex Sess_SubcRegex = new Regex(Session_Subchannel); - Regex Ent_SessRegex = new Regex(Entry_Session); - Regex Ent_PointRegex = new Regex(Entry_Point); - Regex Ent_ADRRegex = new Regex(Entry_ADR); - Regex Ent_CtrlRegex = new Regex(Entry_Control); - Regex Ent_TNORegex = new Regex(Entry_TrackNo); - Regex Ent_AMinRegex = new Regex(Entry_AMin); - Regex Ent_ASecRegex = new Regex(Entry_ASec); - Regex Ent_AFrameRegex = new Regex(Entry_AFrame); - Regex Ent_ALBARegex = new Regex(Entry_ALBA); - Regex Ent_ZeroRegex = new Regex(Entry_Zero); - Regex Ent_PMinRegex = new Regex(Entry_PMin); - Regex Ent_PSecRegex = new Regex(Entry_PSec); - Regex Ent_PFrameRegex = new Regex(Entry_PFrame); - Regex Ent_PLBARegex = new Regex(Entry_PLBA); - Regex CDT_EntsRegex = new Regex(CDText_Entries); - Regex CDT_EntRegex = new Regex(CDText_Entry); - - Match CCD_IdMatch; - Match Disc_IdMatch; - Match Sess_IdMatch; - Match Entry_IdMatch; - Match Track_IdMatch; - Match CDT_IdMatch; - Match CCD_VerMatch; - Match Disc_EntMatch; - Match Disc_SessMatch; - Match Disc_ScrMatch; - Match CDT_LenMatch; - Match Disc_CatMatch; - Match Sess_PregMatch; - Match Sess_SubcMatch; - Match Ent_SessMatch; - Match Ent_PointMatch; - Match Ent_ADRMatch; - Match Ent_CtrlMatch; - Match Ent_TNOMatch; - Match Ent_AMinMatch; - Match Ent_ASecMatch; - Match Ent_AFrameMatch; - Match Ent_ALBAMatch; - Match Ent_ZeroMatch; - Match Ent_PMinMatch; - Match Ent_PSecMatch; - Match Ent_PFrameMatch; - Match Ent_PLBAMatch; - Match CDT_EntsMatch; - Match CDT_EntMatch; - - bool inCcd = false; - bool inDisk = false; - bool inSession = false; - bool inEntry = false; - bool inTrack = false; - bool inCDText = false; - MemoryStream cdtMs = new MemoryStream(); - int minSession = int.MaxValue; - int maxSession = int.MinValue; - FullTOC.TrackDataDescriptor currentEntry = new FullTOC.TrackDataDescriptor(); - List<FullTOC.TrackDataDescriptor> entries = new List<FullTOC.TrackDataDescriptor>(); - scrambled = false; - catalog = null; - - while(cueStream.Peek() >= 0) - { - line++; - string _line = cueStream.ReadLine(); - - CCD_IdMatch = CCD_IdRegex.Match(_line); - Disc_IdMatch = Disc_IdRegex.Match(_line); - Sess_IdMatch = Sess_IdRegex.Match(_line); - Entry_IdMatch = Entry_IdRegex.Match(_line); - Track_IdMatch = Track_IdRegex.Match(_line); - CDT_IdMatch = CDT_IdRegex.Match(_line); - - // [CloneCD] - if(CCD_IdMatch.Success) - { - if(inDisk || inSession || inEntry || inTrack || inCDText) - throw new FeatureUnsupportedImageException(string.Format("Found [CloneCD] out of order in line {0}", line)); - - inCcd = true; - inDisk = false; - inSession = false; - inEntry = false; - inTrack = false; - inCDText = false; - } - else if(Disc_IdMatch.Success || Sess_IdMatch.Success || Entry_IdMatch.Success || Track_IdMatch.Success || CDT_IdMatch.Success) - { - if(inEntry) - { - entries.Add(currentEntry); - currentEntry = new FullTOC.TrackDataDescriptor(); - } - - inCcd = false; - inDisk = Disc_IdMatch.Success; - inSession = Sess_IdMatch.Success; - inEntry = Entry_IdMatch.Success; - inTrack = Track_IdMatch.Success; - inCDText = CDT_IdMatch.Success; - } - else - { - if(inCcd) - { - CCD_VerMatch = CCD_VerRegex.Match(_line); - - if(CCD_VerMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found Version at line {0}", line); - - ImageInfo.imageVersion = CCD_VerMatch.Groups["value"].Value; - if(ImageInfo.imageVersion != "2" && ImageInfo.imageVersion != "3") - DicConsole.ErrorWriteLine("(CloneCD plugin): Warning! Unknown CCD image version {0}, may not work!", ImageInfo.imageVersion); - } - } - else if(inDisk) - { - Disc_EntMatch = Disc_EntRegex.Match(_line); - Disc_SessMatch = Disc_SessRegex.Match(_line); - Disc_ScrMatch = Disc_ScrRegex.Match(_line); - CDT_LenMatch = CDT_LenRegex.Match(_line); - Disc_CatMatch = Disc_CatRegex.Match(_line); - - if(Disc_EntMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found TocEntries at line {0}", line); - } - else if(Disc_SessMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found Sessions at line {0}", line); - } - else if(Disc_ScrMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found DataTracksScrambled at line {0}", line); - scrambled |= Disc_ScrMatch.Groups["value"].Value == "1"; - } - else if(CDT_LenMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found CDTextLength at line {0}", line); - } - else if(Disc_CatMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found Catalog at line {0}", line); - catalog = Disc_CatMatch.Groups["value"].Value; - } - } - // TODO: Do not suppose here entries come sorted - else if(inCDText) - { - CDT_EntsMatch = CDT_EntsRegex.Match(_line); - CDT_EntMatch = CDT_EntRegex.Match(_line); - - if(CDT_EntsMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found CD-Text Entries at line {0}", line); - } - else if(CDT_EntMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found CD-Text Entry at line {0}", line); - string[] bytes = CDT_EntMatch.Groups["value"].Value.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - foreach(string byt in bytes) - cdtMs.WriteByte(Convert.ToByte(byt, 16)); - } - } - // Is this useful? - else if(inSession) - { - Sess_PregMatch = Sess_PregRegex.Match(_line); - Sess_SubcMatch = Sess_SubcRegex.Match(_line); - - if(Sess_PregMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found PreGapMode at line {0}", line); - } - else if(Sess_SubcMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found PreGapSubC at line {0}", line); - } - } - else if(inEntry) - { - Ent_SessMatch = Ent_SessRegex.Match(_line); - Ent_PointMatch = Ent_PointRegex.Match(_line); - Ent_ADRMatch = Ent_ADRRegex.Match(_line); - Ent_CtrlMatch = Ent_CtrlRegex.Match(_line); - Ent_TNOMatch = Ent_TNORegex.Match(_line); - Ent_AMinMatch = Ent_AMinRegex.Match(_line); - Ent_ASecMatch = Ent_ASecRegex.Match(_line); - Ent_AFrameMatch = Ent_AFrameRegex.Match(_line); - Ent_ALBAMatch = Ent_ALBARegex.Match(_line); - Ent_ZeroMatch = Ent_ZeroRegex.Match(_line); - Ent_PMinMatch = Ent_PMinRegex.Match(_line); - Ent_PSecMatch = Ent_PSecRegex.Match(_line); - Ent_PFrameMatch = Ent_PFrameRegex.Match(_line); - Ent_PLBAMatch = Ent_PLBARegex.Match(_line); - - if(Ent_SessMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found Session at line {0}", line); - currentEntry.SessionNumber = Convert.ToByte(Ent_SessMatch.Groups["value"].Value, 10); - if(currentEntry.SessionNumber < minSession) - minSession = currentEntry.SessionNumber; - if(currentEntry.SessionNumber > maxSession) - maxSession = currentEntry.SessionNumber; - } - else if(Ent_PointMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found Point at line {0}", line); - currentEntry.POINT = Convert.ToByte(Ent_PointMatch.Groups["value"].Value, 16); - } - else if(Ent_ADRMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found ADR at line {0}", line); - currentEntry.ADR = Convert.ToByte(Ent_ADRMatch.Groups["value"].Value, 16); - } - else if(Ent_CtrlMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found Control at line {0}", line); - currentEntry.CONTROL = Convert.ToByte(Ent_CtrlMatch.Groups["value"].Value, 16); - } - else if(Ent_TNOMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found TrackNo at line {0}", line); - currentEntry.TNO = Convert.ToByte(Ent_TNOMatch.Groups["value"].Value, 10); - } - else if(Ent_AMinMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found AMin at line {0}", line); - currentEntry.Min = Convert.ToByte(Ent_AMinMatch.Groups["value"].Value, 10); - } - else if(Ent_ASecMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found ASec at line {0}", line); - currentEntry.Sec = Convert.ToByte(Ent_ASecMatch.Groups["value"].Value, 10); - } - else if(Ent_AFrameMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found AFrame at line {0}", line); - currentEntry.Frame = Convert.ToByte(Ent_AFrameMatch.Groups["value"].Value, 10); - } - else if(Ent_ALBAMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found ALBA at line {0}", line); - } - else if(Ent_ZeroMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found Zero at line {0}", line); - currentEntry.Zero = Convert.ToByte(Ent_ZeroMatch.Groups["value"].Value, 10); - currentEntry.HOUR = (byte)((currentEntry.Zero & 0xF0) >> 4); - currentEntry.PHOUR = (byte)(currentEntry.Zero & 0x0F); - } - else if(Ent_PMinMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found PMin at line {0}", line); - currentEntry.PMIN = Convert.ToByte(Ent_PMinMatch.Groups["value"].Value, 10); - } - else if(Ent_PSecMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found PSec at line {0}", line); - currentEntry.PSEC = Convert.ToByte(Ent_PSecMatch.Groups["value"].Value, 10); - } - else if(Ent_PFrameMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found PFrame at line {0}", line); - currentEntry.PFRAME = Convert.ToByte(Ent_PFrameMatch.Groups["value"].Value, 10); - } - else if(Ent_PLBAMatch.Success) - { - DicConsole.DebugWriteLine("CloneCD plugin", "Found PLBA at line {0}", line); - } - } - } - } - - if(inEntry) - entries.Add(currentEntry); - - if(entries.Count == 0) - throw new FeatureUnsupportedImageException("Did not find any track."); - - FullTOC.CDFullTOC toc; - toc.TrackDescriptors = entries.ToArray(); - toc.LastCompleteSession = (byte)maxSession; - toc.FirstCompleteSession = (byte)minSession; - toc.DataLength = (ushort)(entries.Count * 11 + 2); - MemoryStream tocMs = new MemoryStream(); - tocMs.Write(BigEndianBitConverter.GetBytes(toc.DataLength), 0, 2); - tocMs.WriteByte(toc.FirstCompleteSession); - tocMs.WriteByte(toc.LastCompleteSession); - foreach(FullTOC.TrackDataDescriptor descriptor in toc.TrackDescriptors) - { - tocMs.WriteByte(descriptor.SessionNumber); - tocMs.WriteByte((byte)((descriptor.ADR << 4) + descriptor.CONTROL)); - tocMs.WriteByte(descriptor.TNO); - tocMs.WriteByte(descriptor.POINT); - tocMs.WriteByte(descriptor.Min); - tocMs.WriteByte(descriptor.Sec); - tocMs.WriteByte(descriptor.Frame); - tocMs.WriteByte(descriptor.Zero); - tocMs.WriteByte(descriptor.PMIN); - tocMs.WriteByte(descriptor.PSEC); - tocMs.WriteByte(descriptor.PFRAME); - } - fulltoc = tocMs.ToArray(); - ImageInfo.readableMediaTags.Add(MediaTagType.CD_FullTOC); - - DicConsole.DebugWriteLine("CloneCD plugin", "{0}", FullTOC.Prettify(toc)); - - string dataFile = Path.GetFileNameWithoutExtension(imageFilter.GetBasePath()) + ".img"; - string subFile = Path.GetFileNameWithoutExtension(imageFilter.GetBasePath()) + ".sub"; - - FiltersList filtersList = new FiltersList(); - dataFilter = filtersList.GetFilter(dataFile); - - if(dataFilter == null) - throw new Exception("Cannot open data file"); - - filtersList = new FiltersList(); - subFilter = filtersList.GetFilter(subFile); - - int curSessionNo = 0; - Track currentTrack = new Track(); - bool firstTrackInSession = true; - tracks = new List<Track>(); - byte discType; - ulong LeadOutStart = 0; - - dataStream = dataFilter.GetDataForkStream(); - if(subFilter != null) - subStream = subFilter.GetDataForkStream(); - - foreach(FullTOC.TrackDataDescriptor descriptor in entries) - { - if(descriptor.SessionNumber > curSessionNo) - { - curSessionNo = descriptor.SessionNumber; - if(!firstTrackInSession) - { - currentTrack.TrackEndSector = LeadOutStart - 1; - tracks.Add(currentTrack); - } - firstTrackInSession = true; - } - - switch(descriptor.ADR) - { - case 1: - case 4: - switch(descriptor.POINT) - { - case 0xA0: - discType = descriptor.PSEC; - DicConsole.DebugWriteLine("CloneCD plugin", "Disc Type: {0}", discType); - break; - case 0xA2: - LeadOutStart = GetLBA(descriptor.PHOUR, descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME); - break; - default: - if(descriptor.POINT >= 0x01 && descriptor.POINT <= 0x63) - { - if(!firstTrackInSession) - { - currentTrack.TrackEndSector = GetLBA(descriptor.PHOUR, descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME) - 1; - tracks.Add(currentTrack); - } - else - firstTrackInSession = false; - - currentTrack = new Track(); - currentTrack.TrackBytesPerSector = 2352; - currentTrack.TrackFile = dataFilter.GetFilename(); - currentTrack.TrackFileType = scrambled ? "SCRAMBLED" : "BINARY"; - currentTrack.TrackFilter = dataFilter; - currentTrack.TrackRawBytesPerSector = 2352; - currentTrack.TrackSequence = descriptor.POINT; - currentTrack.TrackStartSector = GetLBA(descriptor.PHOUR, descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME); - currentTrack.TrackFileOffset = currentTrack.TrackStartSector * 2352; - currentTrack.TrackSession = descriptor.SessionNumber; - - // Need to check exact data type later - if((TOC_CONTROL)(descriptor.CONTROL & 0x0D) == TOC_CONTROL.DataTrack || - (TOC_CONTROL)(descriptor.CONTROL & 0x0D) == TOC_CONTROL.DataTrackIncremental) - currentTrack.TrackType = TrackType.Data; - else - currentTrack.TrackType = TrackType.Audio; - - if(subFilter != null) - { - currentTrack.TrackSubchannelFile = subFilter.GetFilename(); - currentTrack.TrackSubchannelFilter = subFilter; - currentTrack.TrackSubchannelOffset = currentTrack.TrackStartSector * 96; - currentTrack.TrackSubchannelType = TrackSubchannelType.Raw; - } - else - currentTrack.TrackSubchannelType = TrackSubchannelType.None; - - if(currentTrack.TrackType == TrackType.Data) - { - byte[] syncTest = new byte[12]; - byte[] sectTest = new byte[2352]; - dataStream.Seek((long)currentTrack.TrackFileOffset, SeekOrigin.Begin); - dataStream.Read(sectTest, 0, 2352); - Array.Copy(sectTest, 0, syncTest, 0, 12); - - if(Sector.SyncMark.SequenceEqual(syncTest)) - { - if(scrambled) - sectTest = Sector.Scramble(sectTest); - - if(sectTest[15] == 1) - { - currentTrack.TrackBytesPerSector = 2048; - currentTrack.TrackType = TrackType.CDMode1; - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - if(ImageInfo.sectorSize < 2048) - ImageInfo.sectorSize = 2048; - } - else if(sectTest[15] == 2) - { - byte[] subHdr1 = new byte[4]; - byte[] subHdr2 = new byte[4]; - byte[] empHdr = new byte[4]; - - Array.Copy(sectTest, 16, subHdr1, 0, 4); - Array.Copy(sectTest, 20, subHdr2, 0, 4); - - if(subHdr1.SequenceEqual(subHdr2) && !empHdr.SequenceEqual(subHdr1)) - { - if((subHdr1[2] & 0x20) == 0x20) - { - currentTrack.TrackBytesPerSector = 2324; - currentTrack.TrackType = TrackType.CDMode2Form2; - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - if(ImageInfo.sectorSize < 2324) - ImageInfo.sectorSize = 2324; - } - else - { - currentTrack.TrackBytesPerSector = 2048; - currentTrack.TrackType = TrackType.CDMode2Form1; - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - if(ImageInfo.sectorSize < 2048) - ImageInfo.sectorSize = 2048; - } - } - else - { - currentTrack.TrackBytesPerSector = 2336; - currentTrack.TrackType = TrackType.CDMode2Formless; - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(ImageInfo.sectorSize < 2336) - ImageInfo.sectorSize = 2336; - } - } - } - } - else - { - if(ImageInfo.sectorSize < 2352) - ImageInfo.sectorSize = 2352; - } - } - break; - } - break; - case 5: - switch(descriptor.POINT) - { - case 0xC0: - if(descriptor.PMIN == 97) - { - int type = descriptor.PFRAME % 10; - int frm = descriptor.PFRAME - type; - - ImageInfo.mediaManufacturer = ATIP.ManufacturerFromATIP(descriptor.PSEC, frm); - - if(ImageInfo.mediaManufacturer != "") - DicConsole.DebugWriteLine("CloneCD plugin", "Disc manufactured by: {0}", ImageInfo.mediaManufacturer); - } - break; - } - break; - case 6: - { - uint id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame); - DicConsole.DebugWriteLine("CloneCD plugin", "Disc ID: {0:X6}", id & 0x00FFFFFF); - ImageInfo.mediaSerialNumber = string.Format("{0:X6}", id & 0x00FFFFFF); - break; - } - } - } - if(!firstTrackInSession) - { - currentTrack.TrackEndSector = LeadOutStart - 1; - tracks.Add(currentTrack); - } - - if(subFilter != null && !ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubchannel); - - sessions = new List<ImagePlugins.Session>(); - ImagePlugins.Session currentSession = new ImagePlugins.Session(); - currentSession.EndTrack = uint.MinValue; - currentSession.StartTrack = uint.MaxValue; - currentSession.SessionSequence = 1; - partitions = new List<Partition>(); - offsetmap = new Dictionary<uint, ulong>(); - - foreach(Track track in tracks) - { - if(track.TrackSession == currentSession.SessionSequence) - { - if(track.TrackSequence > currentSession.EndTrack) - { - currentSession.EndSector = track.TrackEndSector; - currentSession.EndTrack = track.TrackSequence; - } - - if(track.TrackSequence < currentSession.StartTrack) - { - currentSession.StartSector = track.TrackStartSector; - currentSession.StartTrack = track.TrackSequence; - } - } - else - { - sessions.Add(currentSession); - currentSession = new ImagePlugins.Session(); - currentSession.EndTrack = uint.MinValue; - currentSession.StartTrack = uint.MaxValue; - currentSession.SessionSequence = track.TrackSession; - } - - Partition partition = new Partition(); - partition.Description = track.TrackDescription; - partition.Size = ((track.TrackEndSector - track.TrackStartSector) + 1) * (ulong)track.TrackRawBytesPerSector; - partition.Length = (track.TrackEndSector - track.TrackStartSector) + 1; - ImageInfo.sectors += partition.Length; - partition.Sequence = track.TrackSequence; - partition.Offset = track.TrackFileOffset; - partition.Start = track.TrackStartSector; - partition.Type = track.TrackType.ToString(); - partitions.Add(partition); - offsetmap.Add(track.TrackSequence, track.TrackStartSector); - } - - bool data = false; - bool mode2 = false; - bool firstaudio = false; - bool firstdata = false; - bool audio = false; - - for(int i = 0; i < tracks.Count; i++) - { - // First track is audio - firstaudio |= i == 0 && tracks[i].TrackType == TrackType.Audio; - - // First track is data - firstdata |= i == 0 && tracks[i].TrackType != TrackType.Audio; - - // Any non first track is data - data |= i != 0 && tracks[i].TrackType != TrackType.Audio; - - // Any non first track is audio - audio |= i != 0 && tracks[i].TrackType == TrackType.Audio; - - switch(tracks[i].TrackType) - { - case TrackType.CDMode2Form1: - case TrackType.CDMode2Form2: - case TrackType.CDMode2Formless: - mode2 = true; - break; - } - } - - // TODO: Check format - cdtext = cdtMs.ToArray(); - - if(!data && !firstdata) - ImageInfo.mediaType = MediaType.CDDA; - else if(firstaudio && data && sessions.Count > 1 && mode2) - ImageInfo.mediaType = MediaType.CDPLUS; - else if((firstdata && audio) || mode2) - ImageInfo.mediaType = MediaType.CDROMXA; - else if(!audio) - ImageInfo.mediaType = MediaType.CDROM; - else - ImageInfo.mediaType = MediaType.CD; - - ImageInfo.imageApplication = "CloneCD"; - ImageInfo.imageSize = (ulong)imageFilter.GetDataForkLength(); - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.xmlMediaType = XmlMediaType.OpticalDisc; - - return true; - } - catch(Exception ex) - { - DicConsole.ErrorWriteLine("Exception trying to identify image file {0}", imageFilter.GetFilename()); - DicConsole.ErrorWriteLine("Exception: {0}", ex.Message); - DicConsole.ErrorWriteLine("Stack trace: {0}", ex.StackTrace); - return false; - } - } - - static ulong GetLBA(int hour, int minute, int second, int frame) - { - return (ulong)((hour * 60 * 60 * 75) + (minute * 60 * 75) + (second * 75) + frame - 150); - } - - public override bool ImageHasPartitions() - { - return ImageInfo.imageHasPartitions; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override byte[] ReadDiskTag(MediaTagType tag) - { - switch(tag) - { - case MediaTagType.CD_FullTOC: - { - return fulltoc; - } - case MediaTagType.CD_TEXT: - { - if(cdtext != null && cdtext.Length > 0) - return cdtext; - throw new FeatureNotPresentImageException("Image does not contain CD-TEXT information."); - } - default: - throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format"); - } - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - return ReadSectorsTag(sectorAddress, 1, tag); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - return ReadSectors(sectorAddress, 1, track); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - return ReadSectorsTag(sectorAddress, 1, track, tag); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - foreach(KeyValuePair<uint, ulong> kvp in offsetmap) - { - if(sectorAddress >= kvp.Value) - { - foreach(Track _track in tracks) - { - if(_track.TrackSequence == kvp.Key) - { - if(sectorAddress <= _track.TrackEndSector) - return ReadSectors((sectorAddress - kvp.Value), length, kvp.Key); - } - } - } - } - - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - foreach(KeyValuePair<uint, ulong> kvp in offsetmap) - { - if(sectorAddress >= kvp.Value) - { - foreach(Track _track in tracks) - { - if(_track.TrackSequence == kvp.Key) - { - if(sectorAddress <= _track.TrackEndSector) - return ReadSectorsTag((sectorAddress - kvp.Value), length, kvp.Key, tag); - } - } - } - } - - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - Track _track = new Track(); - - _track.TrackSequence = 0; - - foreach(Track __track in tracks) - { - if(__track.TrackSequence == track) - { - _track = __track; - break; - } - } - - if(_track.TrackSequence == 0) - throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); - - if((length + sectorAddress) - 1 > _track.TrackEndSector) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0} {2}) than present in track ({1}), won't cross tracks", length + sectorAddress, _track.TrackEndSector, sectorAddress)); - - uint sector_offset; - uint sector_size; - uint sector_skip; - - switch(_track.TrackType) - { - case TrackType.Audio: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 0; - break; - } - case TrackType.CDMode1: - { - sector_offset = 16; - sector_size = 2048; - sector_skip = 288; - break; - } - case TrackType.CDMode2Formless: - { - sector_offset = 16; - sector_size = 2336; - sector_skip = 0; - break; - } - case TrackType.CDMode2Form1: - { - sector_offset = 24; - sector_size = 2048; - sector_skip = 280; - break; - } - case TrackType.CDMode2Form2: - { - sector_offset = 24; - sector_size = 2324; - sector_skip = 4; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); - } - - byte[] buffer = new byte[sector_size * length]; - - dataStream.Seek((long)(_track.TrackFileOffset + sectorAddress * 2352), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - dataStream.Read(buffer, 0, buffer.Length); - else - { - for(int i = 0; i < length; i++) - { - byte[] sector = new byte[sector_size]; - dataStream.Seek(sector_offset, SeekOrigin.Current); - dataStream.Read(sector, 0, sector.Length); - dataStream.Seek(sector_skip, SeekOrigin.Current); - Array.Copy(sector, 0, buffer, i * sector_size, sector_size); - } - } - - return buffer; - } - - // TODO: Flags - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - Track _track = new Track(); - - _track.TrackSequence = 0; - - foreach(Track __track in tracks) - { - if(__track.TrackSequence == track) - { - _track = __track; - break; - } - } - - if(_track.TrackSequence == 0) - throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); - - if((length + sectorAddress) - 1 > (_track.TrackEndSector)) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length + sectorAddress, _track.TrackEndSector)); - - if(_track.TrackType == TrackType.Data) - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - - byte[] buffer; - - switch(tag) - { - case SectorTagType.CDSectorECC: - case SectorTagType.CDSectorECC_P: - case SectorTagType.CDSectorECC_Q: - case SectorTagType.CDSectorEDC: - case SectorTagType.CDSectorHeader: - case SectorTagType.CDSectorSubHeader: - case SectorTagType.CDSectorSync: - break; - case SectorTagType.CDSectorSubchannel: - buffer = new byte[96 * length]; - subStream.Seek((long)(_track.TrackSubchannelOffset + sectorAddress * 96), SeekOrigin.Begin); - subStream.Read(buffer, 0, buffer.Length); - return buffer; - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - - uint sector_offset; - uint sector_size; - uint sector_skip; - - switch(_track.TrackType) - { - case TrackType.CDMode1: - switch(tag) - { - case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } - case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } - case SectorTagType.CDSectorSubHeader: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - sector_skip = 104; - break; - } - case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2064; - sector_size = 4; - sector_skip = 284; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - break; - case TrackType.CDMode2Formless: - { - switch(tag) - { - case SectorTagType.CDSectorSync: - case SectorTagType.CDSectorHeader: - case SectorTagType.CDSectorECC: - case SectorTagType.CDSectorECC_P: - case SectorTagType.CDSectorECC_Q: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorSubHeader: - { - sector_offset = 0; - sector_size = 8; - sector_skip = 2328; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2332; - sector_size = 4; - sector_skip = 0; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - break; - } - case TrackType.CDMode2Form1: - switch(tag) - { - case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } - case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } - case SectorTagType.CDSectorSubHeader: - { - sector_offset = 16; - sector_size = 8; - sector_skip = 2328; - break; - } - case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - sector_skip = 104; - break; - } - case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2072; - sector_size = 4; - sector_skip = 276; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - break; - case TrackType.CDMode2Form2: - switch(tag) - { - case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } - case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } - case SectorTagType.CDSectorSubHeader: - { - sector_offset = 16; - sector_size = 8; - sector_skip = 2328; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2348; - sector_size = 4; - sector_skip = 0; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - break; - case TrackType.Audio: - { - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); - } - - buffer = new byte[sector_size * length]; - - dataStream.Seek((long)(_track.TrackFileOffset + sectorAddress * 2352), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - dataStream.Read(buffer, 0, buffer.Length); - else - { - for(int i = 0; i < length; i++) - { - byte[] sector = new byte[sector_size]; - dataStream.Seek(sector_offset, SeekOrigin.Current); - dataStream.Read(sector, 0, sector.Length); - dataStream.Seek(sector_skip, SeekOrigin.Current); - Array.Copy(sector, 0, buffer, i * sector_size, sector_size); - } - } - - return buffer; - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - return ReadSectorsLong(sectorAddress, 1); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - return ReadSectorsLong(sectorAddress, 1, track); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - foreach(KeyValuePair<uint, ulong> kvp in offsetmap) - { - if(sectorAddress >= kvp.Value) - { - foreach(Track track in tracks) - { - if(track.TrackSequence == kvp.Key) - { - if((sectorAddress - kvp.Value) < ((track.TrackEndSector - track.TrackStartSector) + 1)) - return ReadSectorsLong((sectorAddress - kvp.Value), length, kvp.Key); - } - } - } - } - - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - Track _track = new Track(); - - _track.TrackSequence = 0; - - foreach(Track __track in tracks) - { - if(__track.TrackSequence == track) - { - _track = __track; - break; - } - } - - if(_track.TrackSequence == 0) - throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); - - if((length + sectorAddress) - 1 > (_track.TrackEndSector)) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length + sectorAddress, _track.TrackEndSector)); - - byte[] buffer = new byte[2352 * length]; - - dataStream.Seek((long)(_track.TrackFileOffset + sectorAddress * 2352), SeekOrigin.Begin); - dataStream.Read(buffer, 0, buffer.Length); - - return buffer; - } - - public override string GetImageFormat() - { - return "CloneCD"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override string GetMediaManufacturer() - { - return ImageInfo.mediaManufacturer; - } - - public override string GetMediaModel() - { - return ImageInfo.mediaModel; - } - - public override string GetMediaSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - - public override string GetMediaBarcode() - { - return ImageInfo.mediaBarcode; - } - - public override string GetMediaPartNumber() - { - return ImageInfo.mediaPartNumber; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - public override int GetMediaSequence() - { - return ImageInfo.mediaSequence; - } - - public override int GetLastDiskSequence() - { - return ImageInfo.lastMediaSequence; - } - - public override string GetDriveManufacturer() - { - return ImageInfo.driveManufacturer; - } - - public override string GetDriveModel() - { - return ImageInfo.driveModel; - } - - public override string GetDriveSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - - public override List<Partition> GetPartitions() - { - return partitions; - } - - public override List<Track> GetTracks() - { - return tracks; - } - - public override List<Track> GetSessionTracks(ImagePlugins.Session session) - { - if(sessions.Contains(session)) - { - return GetSessionTracks(session.SessionSequence); - } - throw new ImageNotSupportedException("Session does not exist in disc image"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - List<Track> _tracks = new List<Track>(); - foreach(Track _track in tracks) - { - if(_track.TrackSession == session) - _tracks.Add(_track); - } - - return _tracks; - } - - public override List<ImagePlugins.Session> GetSessions() - { - return sessions; - } - - public override bool? VerifySector(ulong sectorAddress) - { - byte[] buffer = ReadSectorLong(sectorAddress); - return Checksums.CDChecksums.CheckCDSector(buffer); - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - byte[] buffer = ReadSectorLong(sectorAddress, track); - return Checksums.CDChecksums.CheckCDSector(buffer); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - byte[] buffer = ReadSectorsLong(sectorAddress, length); - int bps = (int)(buffer.Length / length); - byte[] sector = new byte[bps]; - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(int i = 0; i < length; i++) - { - Array.Copy(buffer, i * bps, sector, 0, bps); - bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); - - switch(sectorStatus) - { - case null: - UnknownLBAs.Add((ulong)i + sectorAddress); - break; - case false: - FailingLBAs.Add((ulong)i + sectorAddress); - break; - } - } - - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; - return true; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - byte[] buffer = ReadSectorsLong(sectorAddress, length, track); - int bps = (int)(buffer.Length / length); - byte[] sector = new byte[bps]; - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(int i = 0; i < length; i++) - { - Array.Copy(buffer, i * bps, sector, 0, bps); - bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); - - switch(sectorStatus) - { - case null: - UnknownLBAs.Add((ulong)i + sectorAddress); - break; - case false: - FailingLBAs.Add((ulong)i + sectorAddress); - break; - } - } - - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; - return true; - } - - public override bool? VerifyMediaImage() - { - return null; - } - } -} + #region Parsing regexs + const string CCD_Identifier = "^\\s*\\[CloneCD\\]"; + const string Disc_Identifier = "^\\s*\\[Disc\\]"; + const string Session_Identifier = "^\\s*\\[Session\\s*(?<number>\\d+)\\]"; + const string Entry_Identifier = "^\\s*\\[Entry\\s*(?<number>\\d+)\\]"; + const string Track_Identifier = "^\\s*\\[TRACK\\s*(?<number>\\d+)\\]"; + const string CDText_Identifier = "^\\s*\\[CDText\\]"; + const string CCD_Version = "^\\s*Version\\s*=\\s*(?<value>\\d+)"; + const string Disc_Entries = "^\\s*TocEntries\\s*=\\s*(?<value>\\d+)"; + const string Disc_Sessions = "^\\s*Sessions\\s*=\\s*(?<value>\\d+)"; + const string Disc_Scrambled = "^\\s*DataTracksScrambled\\s*=\\s*(?<value>\\d+)"; + const string CDText_Length = "^\\s*CDTextLength\\s*=\\s*(?<value>\\d+)"; + const string Disc_Catalog = "^\\s*CATALOG\\s*=\\s*(?<value>\\w+)"; + const string Session_Pregap = "^\\s*PreGapMode\\s*=\\s*(?<value>\\d+)"; + const string Session_Subchannel = "^\\s*PreGapSubC\\s*=\\s*(?<value>\\d+)"; + const string Entry_Session = "^\\s*Session\\s*=\\s*(?<value>\\d+)"; + const string Entry_Point = "^\\s*Point\\s*=\\s*(?<value>[\\w+]+)"; + const string Entry_ADR = "^\\s*ADR\\s*=\\s*(?<value>\\w+)"; + const string Entry_Control = "^\\s*Control\\s*=\\s*(?<value>\\w+)"; + const string Entry_TrackNo = "^\\s*TrackNo\\s*=\\s*(?<value>\\d+)"; + const string Entry_AMin = "^\\s*AMin\\s*=\\s*(?<value>\\d+)"; + const string Entry_ASec = "^\\s*ASec\\s*=\\s*(?<value>\\d+)"; + const string Entry_AFrame = "^\\s*AFrame\\s*=\\s*(?<value>\\d+)"; + const string Entry_ALBA = "^\\s*ALBA\\s*=\\s*(?<value>-?\\d+)"; + const string Entry_Zero = "^\\s*Zero\\s*=\\s*(?<value>\\d+)"; + const string Entry_PMin = "^\\s*PMin\\s*=\\s*(?<value>\\d+)"; + const string Entry_PSec = "^\\s*PSec\\s*=\\s*(?<value>\\d+)"; + const string Entry_PFrame = "^\\s*PFrame\\s*=\\s*(?<value>\\d+)"; + const string Entry_PLBA = "^\\s*PLBA\\s*=\\s*(?<value>\\d+)"; + const string CDText_Entries = "^\\s*Entries\\s*=\\s*(?<value>\\d+)"; + const string CDText_Entry = "^\\s*Entry\\s*(?<number>\\d+)\\s*=\\s*(?<value>([0-9a-fA-F]+\\s*)+)"; + #endregion + + Filter imageFilter; + Filter dataFilter; + Filter subFilter; + StreamReader cueStream; + byte[] fulltoc; + bool scrambled; + string catalog; + List<ImagePlugins.Session> sessions; + List<Partition> partitions; + List<Track> tracks; + Stream dataStream; + Stream subStream; + Dictionary<uint, ulong> offsetmap; + byte[] cdtext; + + public CloneCD() + { + Name = "CloneCD"; + PluginUUID = new Guid("EE9C2975-2E79-427A-8EE9-F86F19165784"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = true; + ImageInfo.imageHasSessions = true; + ImageInfo.imageVersion = null; + ImageInfo.imageApplicationVersion = null; + ImageInfo.imageName = null; + ImageInfo.imageCreator = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + public override bool IdentifyImage(Filter imageFilter) + { + this.imageFilter = imageFilter; + + try + { + imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); + byte[] testArray = new byte[512]; + imageFilter.GetDataForkStream().Read(testArray, 0, 512); + imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); + // Check for unexpected control characters that shouldn't be present in a text file and can crash this plugin + bool twoConsecutiveNulls = false; + for(int i = 0; i < 512; i++) + { + if(i >= imageFilter.GetDataForkStream().Length) break; + + if(testArray[i] == 0) + { + if(twoConsecutiveNulls) return false; + + twoConsecutiveNulls = true; + } + else twoConsecutiveNulls = false; + + if(testArray[i] < 0x20 && testArray[i] != 0x0A && testArray[i] != 0x0D && testArray[i] != 0x00) + return false; + } + + cueStream = new StreamReader(this.imageFilter.GetDataForkStream()); + + string _line = cueStream.ReadLine(); + + Regex Hdr = new Regex(CCD_Identifier); + + Match Hdm; + + Hdm = Hdr.Match(_line); + + return Hdm.Success; + } + catch(Exception ex) + { + DicConsole.ErrorWriteLine("Exception trying to identify image file {0}", this.imageFilter); + DicConsole.ErrorWriteLine("Exception: {0}", ex.Message); + DicConsole.ErrorWriteLine("Stack trace: {0}", ex.StackTrace); + return false; + } + } + + public override bool OpenImage(Filter imageFilter) + { + if(imageFilter == null) return false; + + this.imageFilter = imageFilter; + + try + { + imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); + cueStream = new StreamReader(imageFilter.GetDataForkStream()); + int line = 0; + + Regex CCD_IdRegex = new Regex(CCD_Identifier); + Regex Disc_IdRegex = new Regex(Disc_Identifier); + Regex Sess_IdRegex = new Regex(Session_Identifier); + Regex Entry_IdRegex = new Regex(Entry_Identifier); + Regex Track_IdRegex = new Regex(Track_Identifier); + Regex CDT_IdRegex = new Regex(CDText_Identifier); + Regex CCD_VerRegex = new Regex(CCD_Version); + Regex Disc_EntRegex = new Regex(Disc_Entries); + Regex Disc_SessRegex = new Regex(Disc_Sessions); + Regex Disc_ScrRegex = new Regex(Disc_Scrambled); + Regex CDT_LenRegex = new Regex(CDText_Length); + Regex Disc_CatRegex = new Regex(Disc_Catalog); + Regex Sess_PregRegex = new Regex(Session_Pregap); + Regex Sess_SubcRegex = new Regex(Session_Subchannel); + Regex Ent_SessRegex = new Regex(Entry_Session); + Regex Ent_PointRegex = new Regex(Entry_Point); + Regex Ent_ADRRegex = new Regex(Entry_ADR); + Regex Ent_CtrlRegex = new Regex(Entry_Control); + Regex Ent_TNORegex = new Regex(Entry_TrackNo); + Regex Ent_AMinRegex = new Regex(Entry_AMin); + Regex Ent_ASecRegex = new Regex(Entry_ASec); + Regex Ent_AFrameRegex = new Regex(Entry_AFrame); + Regex Ent_ALBARegex = new Regex(Entry_ALBA); + Regex Ent_ZeroRegex = new Regex(Entry_Zero); + Regex Ent_PMinRegex = new Regex(Entry_PMin); + Regex Ent_PSecRegex = new Regex(Entry_PSec); + Regex Ent_PFrameRegex = new Regex(Entry_PFrame); + Regex Ent_PLBARegex = new Regex(Entry_PLBA); + Regex CDT_EntsRegex = new Regex(CDText_Entries); + Regex CDT_EntRegex = new Regex(CDText_Entry); + + Match CCD_IdMatch; + Match Disc_IdMatch; + Match Sess_IdMatch; + Match Entry_IdMatch; + Match Track_IdMatch; + Match CDT_IdMatch; + Match CCD_VerMatch; + Match Disc_EntMatch; + Match Disc_SessMatch; + Match Disc_ScrMatch; + Match CDT_LenMatch; + Match Disc_CatMatch; + Match Sess_PregMatch; + Match Sess_SubcMatch; + Match Ent_SessMatch; + Match Ent_PointMatch; + Match Ent_ADRMatch; + Match Ent_CtrlMatch; + Match Ent_TNOMatch; + Match Ent_AMinMatch; + Match Ent_ASecMatch; + Match Ent_AFrameMatch; + Match Ent_ALBAMatch; + Match Ent_ZeroMatch; + Match Ent_PMinMatch; + Match Ent_PSecMatch; + Match Ent_PFrameMatch; + Match Ent_PLBAMatch; + Match CDT_EntsMatch; + Match CDT_EntMatch; + + bool inCcd = false; + bool inDisk = false; + bool inSession = false; + bool inEntry = false; + bool inTrack = false; + bool inCDText = false; + MemoryStream cdtMs = new MemoryStream(); + int minSession = int.MaxValue; + int maxSession = int.MinValue; + FullTOC.TrackDataDescriptor currentEntry = new FullTOC.TrackDataDescriptor(); + List<FullTOC.TrackDataDescriptor> entries = new List<FullTOC.TrackDataDescriptor>(); + scrambled = false; + catalog = null; + + while(cueStream.Peek() >= 0) + { + line++; + string _line = cueStream.ReadLine(); + + CCD_IdMatch = CCD_IdRegex.Match(_line); + Disc_IdMatch = Disc_IdRegex.Match(_line); + Sess_IdMatch = Sess_IdRegex.Match(_line); + Entry_IdMatch = Entry_IdRegex.Match(_line); + Track_IdMatch = Track_IdRegex.Match(_line); + CDT_IdMatch = CDT_IdRegex.Match(_line); + + // [CloneCD] + if(CCD_IdMatch.Success) + { + if(inDisk || inSession || inEntry || inTrack || inCDText) + throw new + FeatureUnsupportedImageException(string + .Format("Found [CloneCD] out of order in line {0}", + line)); + + inCcd = true; + inDisk = false; + inSession = false; + inEntry = false; + inTrack = false; + inCDText = false; + } + else if(Disc_IdMatch.Success || Sess_IdMatch.Success || Entry_IdMatch.Success || + Track_IdMatch.Success || CDT_IdMatch.Success) + { + if(inEntry) + { + entries.Add(currentEntry); + currentEntry = new FullTOC.TrackDataDescriptor(); + } + + inCcd = false; + inDisk = Disc_IdMatch.Success; + inSession = Sess_IdMatch.Success; + inEntry = Entry_IdMatch.Success; + inTrack = Track_IdMatch.Success; + inCDText = CDT_IdMatch.Success; + } + else + { + if(inCcd) + { + CCD_VerMatch = CCD_VerRegex.Match(_line); + + if(CCD_VerMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found Version at line {0}", line); + + ImageInfo.imageVersion = CCD_VerMatch.Groups["value"].Value; + if(ImageInfo.imageVersion != "2" && ImageInfo.imageVersion != "3") + DicConsole + .ErrorWriteLine("(CloneCD plugin): Warning! Unknown CCD image version {0}, may not work!", + ImageInfo.imageVersion); + } + } + else if(inDisk) + { + Disc_EntMatch = Disc_EntRegex.Match(_line); + Disc_SessMatch = Disc_SessRegex.Match(_line); + Disc_ScrMatch = Disc_ScrRegex.Match(_line); + CDT_LenMatch = CDT_LenRegex.Match(_line); + Disc_CatMatch = Disc_CatRegex.Match(_line); + + if(Disc_EntMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found TocEntries at line {0}", line); + } + else if(Disc_SessMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found Sessions at line {0}", line); + } + else if(Disc_ScrMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found DataTracksScrambled at line {0}", + line); + scrambled |= Disc_ScrMatch.Groups["value"].Value == "1"; + } + else if(CDT_LenMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found CDTextLength at line {0}", line); + } + else if(Disc_CatMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found Catalog at line {0}", line); + catalog = Disc_CatMatch.Groups["value"].Value; + } + } + // TODO: Do not suppose here entries come sorted + else if(inCDText) + { + CDT_EntsMatch = CDT_EntsRegex.Match(_line); + CDT_EntMatch = CDT_EntRegex.Match(_line); + + if(CDT_EntsMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found CD-Text Entries at line {0}", line); + } + else if(CDT_EntMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found CD-Text Entry at line {0}", line); + string[] bytes = CDT_EntMatch.Groups["value"].Value.Split(new char[] {' '}, + StringSplitOptions + .RemoveEmptyEntries); + foreach(string byt in bytes) cdtMs.WriteByte(Convert.ToByte(byt, 16)); + } + } + // Is this useful? + else if(inSession) + { + Sess_PregMatch = Sess_PregRegex.Match(_line); + Sess_SubcMatch = Sess_SubcRegex.Match(_line); + + if(Sess_PregMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found PreGapMode at line {0}", line); + } + else if(Sess_SubcMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found PreGapSubC at line {0}", line); + } + } + else if(inEntry) + { + Ent_SessMatch = Ent_SessRegex.Match(_line); + Ent_PointMatch = Ent_PointRegex.Match(_line); + Ent_ADRMatch = Ent_ADRRegex.Match(_line); + Ent_CtrlMatch = Ent_CtrlRegex.Match(_line); + Ent_TNOMatch = Ent_TNORegex.Match(_line); + Ent_AMinMatch = Ent_AMinRegex.Match(_line); + Ent_ASecMatch = Ent_ASecRegex.Match(_line); + Ent_AFrameMatch = Ent_AFrameRegex.Match(_line); + Ent_ALBAMatch = Ent_ALBARegex.Match(_line); + Ent_ZeroMatch = Ent_ZeroRegex.Match(_line); + Ent_PMinMatch = Ent_PMinRegex.Match(_line); + Ent_PSecMatch = Ent_PSecRegex.Match(_line); + Ent_PFrameMatch = Ent_PFrameRegex.Match(_line); + Ent_PLBAMatch = Ent_PLBARegex.Match(_line); + + if(Ent_SessMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found Session at line {0}", line); + currentEntry.SessionNumber = Convert.ToByte(Ent_SessMatch.Groups["value"].Value, 10); + if(currentEntry.SessionNumber < minSession) minSession = currentEntry.SessionNumber; + if(currentEntry.SessionNumber > maxSession) maxSession = currentEntry.SessionNumber; + } + else if(Ent_PointMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found Point at line {0}", line); + currentEntry.POINT = Convert.ToByte(Ent_PointMatch.Groups["value"].Value, 16); + } + else if(Ent_ADRMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found ADR at line {0}", line); + currentEntry.ADR = Convert.ToByte(Ent_ADRMatch.Groups["value"].Value, 16); + } + else if(Ent_CtrlMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found Control at line {0}", line); + currentEntry.CONTROL = Convert.ToByte(Ent_CtrlMatch.Groups["value"].Value, 16); + } + else if(Ent_TNOMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found TrackNo at line {0}", line); + currentEntry.TNO = Convert.ToByte(Ent_TNOMatch.Groups["value"].Value, 10); + } + else if(Ent_AMinMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found AMin at line {0}", line); + currentEntry.Min = Convert.ToByte(Ent_AMinMatch.Groups["value"].Value, 10); + } + else if(Ent_ASecMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found ASec at line {0}", line); + currentEntry.Sec = Convert.ToByte(Ent_ASecMatch.Groups["value"].Value, 10); + } + else if(Ent_AFrameMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found AFrame at line {0}", line); + currentEntry.Frame = Convert.ToByte(Ent_AFrameMatch.Groups["value"].Value, 10); + } + else if(Ent_ALBAMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found ALBA at line {0}", line); + } + else if(Ent_ZeroMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found Zero at line {0}", line); + currentEntry.Zero = Convert.ToByte(Ent_ZeroMatch.Groups["value"].Value, 10); + currentEntry.HOUR = (byte)((currentEntry.Zero & 0xF0) >> 4); + currentEntry.PHOUR = (byte)(currentEntry.Zero & 0x0F); + } + else if(Ent_PMinMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found PMin at line {0}", line); + currentEntry.PMIN = Convert.ToByte(Ent_PMinMatch.Groups["value"].Value, 10); + } + else if(Ent_PSecMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found PSec at line {0}", line); + currentEntry.PSEC = Convert.ToByte(Ent_PSecMatch.Groups["value"].Value, 10); + } + else if(Ent_PFrameMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found PFrame at line {0}", line); + currentEntry.PFRAME = Convert.ToByte(Ent_PFrameMatch.Groups["value"].Value, 10); + } + else if(Ent_PLBAMatch.Success) + { + DicConsole.DebugWriteLine("CloneCD plugin", "Found PLBA at line {0}", line); + } + } + } + } + + if(inEntry) entries.Add(currentEntry); + + if(entries.Count == 0) throw new FeatureUnsupportedImageException("Did not find any track."); + + FullTOC.CDFullTOC toc; + toc.TrackDescriptors = entries.ToArray(); + toc.LastCompleteSession = (byte)maxSession; + toc.FirstCompleteSession = (byte)minSession; + toc.DataLength = (ushort)(entries.Count * 11 + 2); + MemoryStream tocMs = new MemoryStream(); + tocMs.Write(BigEndianBitConverter.GetBytes(toc.DataLength), 0, 2); + tocMs.WriteByte(toc.FirstCompleteSession); + tocMs.WriteByte(toc.LastCompleteSession); + foreach(FullTOC.TrackDataDescriptor descriptor in toc.TrackDescriptors) + { + tocMs.WriteByte(descriptor.SessionNumber); + tocMs.WriteByte((byte)((descriptor.ADR << 4) + descriptor.CONTROL)); + tocMs.WriteByte(descriptor.TNO); + tocMs.WriteByte(descriptor.POINT); + tocMs.WriteByte(descriptor.Min); + tocMs.WriteByte(descriptor.Sec); + tocMs.WriteByte(descriptor.Frame); + tocMs.WriteByte(descriptor.Zero); + tocMs.WriteByte(descriptor.PMIN); + tocMs.WriteByte(descriptor.PSEC); + tocMs.WriteByte(descriptor.PFRAME); + } + + fulltoc = tocMs.ToArray(); + ImageInfo.readableMediaTags.Add(MediaTagType.CD_FullTOC); + + DicConsole.DebugWriteLine("CloneCD plugin", "{0}", FullTOC.Prettify(toc)); + + string dataFile = Path.GetFileNameWithoutExtension(imageFilter.GetBasePath()) + ".img"; + string subFile = Path.GetFileNameWithoutExtension(imageFilter.GetBasePath()) + ".sub"; + + FiltersList filtersList = new FiltersList(); + dataFilter = filtersList.GetFilter(dataFile); + + if(dataFilter == null) throw new Exception("Cannot open data file"); + + filtersList = new FiltersList(); + subFilter = filtersList.GetFilter(subFile); + + int curSessionNo = 0; + Track currentTrack = new Track(); + bool firstTrackInSession = true; + tracks = new List<Track>(); + byte discType; + ulong LeadOutStart = 0; + + dataStream = dataFilter.GetDataForkStream(); + if(subFilter != null) subStream = subFilter.GetDataForkStream(); + + foreach(FullTOC.TrackDataDescriptor descriptor in entries) + { + if(descriptor.SessionNumber > curSessionNo) + { + curSessionNo = descriptor.SessionNumber; + if(!firstTrackInSession) + { + currentTrack.TrackEndSector = LeadOutStart - 1; + tracks.Add(currentTrack); + } + firstTrackInSession = true; + } + + switch(descriptor.ADR) + { + case 1: + case 4: + switch(descriptor.POINT) + { + case 0xA0: + discType = descriptor.PSEC; + DicConsole.DebugWriteLine("CloneCD plugin", "Disc Type: {0}", discType); + break; + case 0xA2: + LeadOutStart = GetLBA(descriptor.PHOUR, descriptor.PMIN, descriptor.PSEC, + descriptor.PFRAME); + break; + default: + if(descriptor.POINT >= 0x01 && descriptor.POINT <= 0x63) + { + if(!firstTrackInSession) + { + currentTrack.TrackEndSector = + GetLBA(descriptor.PHOUR, descriptor.PMIN, descriptor.PSEC, + descriptor.PFRAME) - 1; + tracks.Add(currentTrack); + } + else firstTrackInSession = false; + + currentTrack = new Track(); + currentTrack.TrackBytesPerSector = 2352; + currentTrack.TrackFile = dataFilter.GetFilename(); + currentTrack.TrackFileType = scrambled ? "SCRAMBLED" : "BINARY"; + currentTrack.TrackFilter = dataFilter; + currentTrack.TrackRawBytesPerSector = 2352; + currentTrack.TrackSequence = descriptor.POINT; + currentTrack.TrackStartSector = + GetLBA(descriptor.PHOUR, descriptor.PMIN, descriptor.PSEC, + descriptor.PFRAME); + currentTrack.TrackFileOffset = currentTrack.TrackStartSector * 2352; + currentTrack.TrackSession = descriptor.SessionNumber; + + // Need to check exact data type later + if((TOC_CONTROL)(descriptor.CONTROL & 0x0D) == TOC_CONTROL.DataTrack || + (TOC_CONTROL)(descriptor.CONTROL & 0x0D) == TOC_CONTROL.DataTrackIncremental) + currentTrack.TrackType = TrackType.Data; + else currentTrack.TrackType = TrackType.Audio; + + if(subFilter != null) + { + currentTrack.TrackSubchannelFile = subFilter.GetFilename(); + currentTrack.TrackSubchannelFilter = subFilter; + currentTrack.TrackSubchannelOffset = currentTrack.TrackStartSector * 96; + currentTrack.TrackSubchannelType = TrackSubchannelType.Raw; + } + else currentTrack.TrackSubchannelType = TrackSubchannelType.None; + + if(currentTrack.TrackType == TrackType.Data) + { + byte[] syncTest = new byte[12]; + byte[] sectTest = new byte[2352]; + dataStream.Seek((long)currentTrack.TrackFileOffset, SeekOrigin.Begin); + dataStream.Read(sectTest, 0, 2352); + Array.Copy(sectTest, 0, syncTest, 0, 12); + + if(Sector.SyncMark.SequenceEqual(syncTest)) + { + if(scrambled) sectTest = Sector.Scramble(sectTest); + + if(sectTest[15] == 1) + { + currentTrack.TrackBytesPerSector = 2048; + currentTrack.TrackType = TrackType.CDMode1; + if(!ImageInfo.readableSectorTags + .Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC) + ) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorECC_P)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorECC_Q)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC) + ) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); + if(ImageInfo.sectorSize < 2048) ImageInfo.sectorSize = 2048; + } + else if(sectTest[15] == 2) + { + byte[] subHdr1 = new byte[4]; + byte[] subHdr2 = new byte[4]; + byte[] empHdr = new byte[4]; + + Array.Copy(sectTest, 16, subHdr1, 0, 4); + Array.Copy(sectTest, 20, subHdr2, 0, 4); + + if(subHdr1.SequenceEqual(subHdr2) && !empHdr.SequenceEqual(subHdr1)) + { + if((subHdr1[2] & 0x20) == 0x20) + { + currentTrack.TrackBytesPerSector = 2324; + currentTrack.TrackType = TrackType.CDMode2Form2; + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorSync) + ) + ImageInfo.readableSectorTags.Add(SectorTagType + .CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorHeader) + ) + ImageInfo.readableSectorTags.Add(SectorTagType + .CDSectorHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorSubHeader) + ) + ImageInfo.readableSectorTags.Add(SectorTagType + .CDSectorSubHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorEDC)) + ImageInfo.readableSectorTags.Add(SectorTagType + .CDSectorEDC); + if(ImageInfo.sectorSize < 2324) ImageInfo.sectorSize = 2324; + } + else + { + currentTrack.TrackBytesPerSector = 2048; + currentTrack.TrackType = TrackType.CDMode2Form1; + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorSync) + ) + ImageInfo.readableSectorTags.Add(SectorTagType + .CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorHeader) + ) + ImageInfo.readableSectorTags.Add(SectorTagType + .CDSectorHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorSubHeader) + ) + ImageInfo.readableSectorTags.Add(SectorTagType + .CDSectorSubHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorECC)) + ImageInfo.readableSectorTags.Add(SectorTagType + .CDSectorECC); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorECC_P) + ) + ImageInfo.readableSectorTags.Add(SectorTagType + .CDSectorECC_P); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorECC_Q) + ) + ImageInfo.readableSectorTags.Add(SectorTagType + .CDSectorECC_Q); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorEDC)) + ImageInfo.readableSectorTags.Add(SectorTagType + .CDSectorEDC); + if(ImageInfo.sectorSize < 2048) ImageInfo.sectorSize = 2048; + } + } + else + { + currentTrack.TrackBytesPerSector = 2336; + currentTrack.TrackType = TrackType.CDMode2Formless; + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorSync)) + ImageInfo.readableSectorTags + .Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType + .CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType + .CDSectorHeader); + if(ImageInfo.sectorSize < 2336) ImageInfo.sectorSize = 2336; + } + } + } + } + else { if(ImageInfo.sectorSize < 2352) ImageInfo.sectorSize = 2352; } + } + break; + } + + break; + case 5: + switch(descriptor.POINT) + { + case 0xC0: + if(descriptor.PMIN == 97) + { + int type = descriptor.PFRAME % 10; + int frm = descriptor.PFRAME - type; + + ImageInfo.mediaManufacturer = ATIP.ManufacturerFromATIP(descriptor.PSEC, frm); + + if(ImageInfo.mediaManufacturer != "") + DicConsole.DebugWriteLine("CloneCD plugin", "Disc manufactured by: {0}", + ImageInfo.mediaManufacturer); + } + break; + } + + break; + case 6: + { + uint id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame); + DicConsole.DebugWriteLine("CloneCD plugin", "Disc ID: {0:X6}", id & 0x00FFFFFF); + ImageInfo.mediaSerialNumber = string.Format("{0:X6}", id & 0x00FFFFFF); + break; + } + } + } + + if(!firstTrackInSession) + { + currentTrack.TrackEndSector = LeadOutStart - 1; + tracks.Add(currentTrack); + } + + if(subFilter != null && !ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubchannel); + + sessions = new List<ImagePlugins.Session>(); + ImagePlugins.Session currentSession = new ImagePlugins.Session(); + currentSession.EndTrack = uint.MinValue; + currentSession.StartTrack = uint.MaxValue; + currentSession.SessionSequence = 1; + partitions = new List<Partition>(); + offsetmap = new Dictionary<uint, ulong>(); + + foreach(Track track in tracks) + { + if(track.TrackSession == currentSession.SessionSequence) + { + if(track.TrackSequence > currentSession.EndTrack) + { + currentSession.EndSector = track.TrackEndSector; + currentSession.EndTrack = track.TrackSequence; + } + + if(track.TrackSequence < currentSession.StartTrack) + { + currentSession.StartSector = track.TrackStartSector; + currentSession.StartTrack = track.TrackSequence; + } + } + else + { + sessions.Add(currentSession); + currentSession = new ImagePlugins.Session(); + currentSession.EndTrack = uint.MinValue; + currentSession.StartTrack = uint.MaxValue; + currentSession.SessionSequence = track.TrackSession; + } + + Partition partition = new Partition(); + partition.Description = track.TrackDescription; + partition.Size = ((track.TrackEndSector - track.TrackStartSector) + 1) * + (ulong)track.TrackRawBytesPerSector; + partition.Length = (track.TrackEndSector - track.TrackStartSector) + 1; + ImageInfo.sectors += partition.Length; + partition.Sequence = track.TrackSequence; + partition.Offset = track.TrackFileOffset; + partition.Start = track.TrackStartSector; + partition.Type = track.TrackType.ToString(); + partitions.Add(partition); + offsetmap.Add(track.TrackSequence, track.TrackStartSector); + } + + bool data = false; + bool mode2 = false; + bool firstaudio = false; + bool firstdata = false; + bool audio = false; + + for(int i = 0; i < tracks.Count; i++) + { + // First track is audio + firstaudio |= i == 0 && tracks[i].TrackType == TrackType.Audio; + + // First track is data + firstdata |= i == 0 && tracks[i].TrackType != TrackType.Audio; + + // Any non first track is data + data |= i != 0 && tracks[i].TrackType != TrackType.Audio; + + // Any non first track is audio + audio |= i != 0 && tracks[i].TrackType == TrackType.Audio; + + switch(tracks[i].TrackType) + { + case TrackType.CDMode2Form1: + case TrackType.CDMode2Form2: + case TrackType.CDMode2Formless: + mode2 = true; + break; + } + } + + // TODO: Check format + cdtext = cdtMs.ToArray(); + + if(!data && !firstdata) ImageInfo.mediaType = MediaType.CDDA; + else if(firstaudio && data && sessions.Count > 1 && mode2) ImageInfo.mediaType = MediaType.CDPLUS; + else if((firstdata && audio) || mode2) ImageInfo.mediaType = MediaType.CDROMXA; + else if(!audio) ImageInfo.mediaType = MediaType.CDROM; + else ImageInfo.mediaType = MediaType.CD; + + ImageInfo.imageApplication = "CloneCD"; + ImageInfo.imageSize = (ulong)imageFilter.GetDataForkLength(); + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.xmlMediaType = XmlMediaType.OpticalDisc; + + return true; + } + catch(Exception ex) + { + DicConsole.ErrorWriteLine("Exception trying to identify image file {0}", imageFilter.GetFilename()); + DicConsole.ErrorWriteLine("Exception: {0}", ex.Message); + DicConsole.ErrorWriteLine("Stack trace: {0}", ex.StackTrace); + return false; + } + } + + static ulong GetLBA(int hour, int minute, int second, int frame) + { + return (ulong)((hour * 60 * 60 * 75) + (minute * 60 * 75) + (second * 75) + frame - 150); + } + + public override bool ImageHasPartitions() + { + return ImageInfo.imageHasPartitions; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override byte[] ReadDiskTag(MediaTagType tag) + { + switch(tag) + { + case MediaTagType.CD_FullTOC: + { + return fulltoc; + } + case MediaTagType.CD_TEXT: + { + if(cdtext != null && cdtext.Length > 0) return cdtext; + + throw new FeatureNotPresentImageException("Image does not contain CD-TEXT information."); + } + default: + throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format"); + } + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + return ReadSectorsTag(sectorAddress, 1, tag); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + return ReadSectors(sectorAddress, 1, track); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + return ReadSectorsTag(sectorAddress, 1, track, tag); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + foreach(KeyValuePair<uint, ulong> kvp in offsetmap) + { + if(sectorAddress >= kvp.Value) + { + foreach(Track _track in tracks) + { + if(_track.TrackSequence == kvp.Key) + { + if(sectorAddress <= _track.TrackEndSector) + return ReadSectors((sectorAddress - kvp.Value), length, kvp.Key); + } + } + } + } + + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + foreach(KeyValuePair<uint, ulong> kvp in offsetmap) + { + if(sectorAddress >= kvp.Value) + { + foreach(Track _track in tracks) + { + if(_track.TrackSequence == kvp.Key) + { + if(sectorAddress <= _track.TrackEndSector) + return ReadSectorsTag((sectorAddress - kvp.Value), length, kvp.Key, tag); + } + } + } + } + + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + Track _track = new Track(); + + _track.TrackSequence = 0; + + foreach(Track __track in tracks) + { + if(__track.TrackSequence == track) + { + _track = __track; + break; + } + } + + if(_track.TrackSequence == 0) + throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); + + if((length + sectorAddress) - 1 > _track.TrackEndSector) + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0} {2}) than present in track ({1}), won't cross tracks", + length + sectorAddress, _track.TrackEndSector, + sectorAddress)); + + uint sector_offset; + uint sector_size; + uint sector_skip; + + switch(_track.TrackType) + { + case TrackType.Audio: + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } + case TrackType.CDMode1: + { + sector_offset = 16; + sector_size = 2048; + sector_skip = 288; + break; + } + case TrackType.CDMode2Formless: + { + sector_offset = 16; + sector_size = 2336; + sector_skip = 0; + break; + } + case TrackType.CDMode2Form1: + { + sector_offset = 24; + sector_size = 2048; + sector_skip = 280; + break; + } + case TrackType.CDMode2Form2: + { + sector_offset = 24; + sector_size = 2324; + sector_skip = 4; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + } + + byte[] buffer = new byte[sector_size * length]; + + dataStream.Seek((long)(_track.TrackFileOffset + sectorAddress * 2352), SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) dataStream.Read(buffer, 0, buffer.Length); + else + { + for(int i = 0; i < length; i++) + { + byte[] sector = new byte[sector_size]; + dataStream.Seek(sector_offset, SeekOrigin.Current); + dataStream.Read(sector, 0, sector.Length); + dataStream.Seek(sector_skip, SeekOrigin.Current); + Array.Copy(sector, 0, buffer, i * sector_size, sector_size); + } + } + + return buffer; + } + + // TODO: Flags + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + Track _track = new Track(); + + _track.TrackSequence = 0; + + foreach(Track __track in tracks) + { + if(__track.TrackSequence == track) + { + _track = __track; + break; + } + } + + if(_track.TrackSequence == 0) + throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); + + if((length + sectorAddress) - 1 > (_track.TrackEndSector)) + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length + sectorAddress, _track.TrackEndSector)); + + if(_track.TrackType == TrackType.Data) + throw new ArgumentException("Unsupported tag requested", nameof(tag)); + + byte[] buffer; + + switch(tag) + { + case SectorTagType.CDSectorECC: + case SectorTagType.CDSectorECC_P: + case SectorTagType.CDSectorECC_Q: + case SectorTagType.CDSectorEDC: + case SectorTagType.CDSectorHeader: + case SectorTagType.CDSectorSubHeader: + case SectorTagType.CDSectorSync: break; + case SectorTagType.CDSectorSubchannel: + buffer = new byte[96 * length]; + subStream.Seek((long)(_track.TrackSubchannelOffset + sectorAddress * 96), SeekOrigin.Begin); + subStream.Read(buffer, 0, buffer.Length); + return buffer; + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + + uint sector_offset; + uint sector_size; + uint sector_skip; + + switch(_track.TrackType) + { + case TrackType.CDMode1: + switch(tag) + { + case SectorTagType.CDSectorSync: + { + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; + } + case SectorTagType.CDSectorHeader: + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } + case SectorTagType.CDSectorSubHeader: + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + case SectorTagType.CDSectorECC: + { + sector_offset = 2076; + sector_size = 276; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorECC_P: + { + sector_offset = 2076; + sector_size = 172; + sector_skip = 104; + break; + } + case SectorTagType.CDSectorECC_Q: + { + sector_offset = 2248; + sector_size = 104; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2064; + sector_size = 4; + sector_skip = 284; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + + break; + case TrackType.CDMode2Formless: + { + switch(tag) + { + case SectorTagType.CDSectorSync: + case SectorTagType.CDSectorHeader: + case SectorTagType.CDSectorECC: + case SectorTagType.CDSectorECC_P: + case SectorTagType.CDSectorECC_Q: + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + case SectorTagType.CDSectorSubHeader: + { + sector_offset = 0; + sector_size = 8; + sector_skip = 2328; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2332; + sector_size = 4; + sector_skip = 0; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + + break; + } + case TrackType.CDMode2Form1: + switch(tag) + { + case SectorTagType.CDSectorSync: + { + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; + } + case SectorTagType.CDSectorHeader: + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } + case SectorTagType.CDSectorSubHeader: + { + sector_offset = 16; + sector_size = 8; + sector_skip = 2328; + break; + } + case SectorTagType.CDSectorECC: + { + sector_offset = 2076; + sector_size = 276; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorECC_P: + { + sector_offset = 2076; + sector_size = 172; + sector_skip = 104; + break; + } + case SectorTagType.CDSectorECC_Q: + { + sector_offset = 2248; + sector_size = 104; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2072; + sector_size = 4; + sector_skip = 276; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + + break; + case TrackType.CDMode2Form2: + switch(tag) + { + case SectorTagType.CDSectorSync: + { + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; + } + case SectorTagType.CDSectorHeader: + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } + case SectorTagType.CDSectorSubHeader: + { + sector_offset = 16; + sector_size = 8; + sector_skip = 2328; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2348; + sector_size = 4; + sector_skip = 0; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + + break; + case TrackType.Audio: + { + throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + } + + buffer = new byte[sector_size * length]; + + dataStream.Seek((long)(_track.TrackFileOffset + sectorAddress * 2352), SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) dataStream.Read(buffer, 0, buffer.Length); + else + { + for(int i = 0; i < length; i++) + { + byte[] sector = new byte[sector_size]; + dataStream.Seek(sector_offset, SeekOrigin.Current); + dataStream.Read(sector, 0, sector.Length); + dataStream.Seek(sector_skip, SeekOrigin.Current); + Array.Copy(sector, 0, buffer, i * sector_size, sector_size); + } + } + + return buffer; + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + return ReadSectorsLong(sectorAddress, 1); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + return ReadSectorsLong(sectorAddress, 1, track); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + foreach(KeyValuePair<uint, ulong> kvp in offsetmap) + { + if(sectorAddress >= kvp.Value) + { + foreach(Track track in tracks) + { + if(track.TrackSequence == kvp.Key) + { + if((sectorAddress - kvp.Value) < ((track.TrackEndSector - track.TrackStartSector) + 1)) + return ReadSectorsLong((sectorAddress - kvp.Value), length, kvp.Key); + } + } + } + } + + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + Track _track = new Track(); + + _track.TrackSequence = 0; + + foreach(Track __track in tracks) + { + if(__track.TrackSequence == track) + { + _track = __track; + break; + } + } + + if(_track.TrackSequence == 0) + throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); + + if((length + sectorAddress) - 1 > (_track.TrackEndSector)) + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length + sectorAddress, _track.TrackEndSector)); + + byte[] buffer = new byte[2352 * length]; + + dataStream.Seek((long)(_track.TrackFileOffset + sectorAddress * 2352), SeekOrigin.Begin); + dataStream.Read(buffer, 0, buffer.Length); + + return buffer; + } + + public override string GetImageFormat() + { + return "CloneCD"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override string GetMediaManufacturer() + { + return ImageInfo.mediaManufacturer; + } + + public override string GetMediaModel() + { + return ImageInfo.mediaModel; + } + + public override string GetMediaSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + + public override string GetMediaBarcode() + { + return ImageInfo.mediaBarcode; + } + + public override string GetMediaPartNumber() + { + return ImageInfo.mediaPartNumber; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override int GetMediaSequence() + { + return ImageInfo.mediaSequence; + } + + public override int GetLastDiskSequence() + { + return ImageInfo.lastMediaSequence; + } + + public override string GetDriveManufacturer() + { + return ImageInfo.driveManufacturer; + } + + public override string GetDriveModel() + { + return ImageInfo.driveModel; + } + + public override string GetDriveSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + + public override List<Partition> GetPartitions() + { + return partitions; + } + + public override List<Track> GetTracks() + { + return tracks; + } + + public override List<Track> GetSessionTracks(ImagePlugins.Session session) + { + if(sessions.Contains(session)) { return GetSessionTracks(session.SessionSequence); } + + throw new ImageNotSupportedException("Session does not exist in disc image"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + List<Track> _tracks = new List<Track>(); + foreach(Track _track in tracks) { if(_track.TrackSession == session) _tracks.Add(_track); } + + return _tracks; + } + + public override List<ImagePlugins.Session> GetSessions() + { + return sessions; + } + + public override bool? VerifySector(ulong sectorAddress) + { + byte[] buffer = ReadSectorLong(sectorAddress); + return Checksums.CDChecksums.CheckCDSector(buffer); + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + byte[] buffer = ReadSectorLong(sectorAddress, track); + return Checksums.CDChecksums.CheckCDSector(buffer); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + byte[] buffer = ReadSectorsLong(sectorAddress, length); + int bps = (int)(buffer.Length / length); + byte[] sector = new byte[bps]; + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(int i = 0; i < length; i++) + { + Array.Copy(buffer, i * bps, sector, 0, bps); + bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); + + switch(sectorStatus) + { + case null: + UnknownLBAs.Add((ulong)i + sectorAddress); + break; + case false: + FailingLBAs.Add((ulong)i + sectorAddress); + break; + } + } + + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + + return true; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + byte[] buffer = ReadSectorsLong(sectorAddress, length, track); + int bps = (int)(buffer.Length / length); + byte[] sector = new byte[bps]; + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(int i = 0; i < length; i++) + { + Array.Copy(buffer, i * bps, sector, 0, bps); + bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); + + switch(sectorStatus) + { + case null: + UnknownLBAs.Add((ulong)i + sectorAddress); + break; + case false: + FailingLBAs.Add((ulong)i + sectorAddress); + break; + } + } + + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + + return true; + } + + public override bool? VerifyMediaImage() + { + return null; + } + } +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/CopyQM.cs b/DiscImageChef.DiscImages/CopyQM.cs index 775e08b6..62983950 100644 --- a/DiscImageChef.DiscImages/CopyQM.cs +++ b/DiscImageChef.DiscImages/CopyQM.cs @@ -40,7 +40,7 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class CopyQM : ImagePlugin + public class CopyQM : ImagePlugin { #region Internal Structures [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -75,8 +75,7 @@ namespace DiscImageChef.ImagePlugins /// <summary>0x18 Sectors on disk (part of FAT's BPB)</summary> public uint sectorsBig; /// <summary>0x1C Description</summary> - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 60)] - public string description; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 60)] public string description; /// <summary>0x58 Blind mode. 0 = DOS, 1 = blind, 2 = HFS</summary> public byte blind; /// <summary>0x59 Density. 0 = Double, 1 = High, 2 = Quad/Extra</summary> @@ -88,8 +87,7 @@ namespace DiscImageChef.ImagePlugins /// <summary>0x5C CRC32 of data</summary> public uint crc; /// <summary>0x60 DOS volume label</summary> - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 11)] - public string volumeLabel; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 11)] public string volumeLabel; /// <summary>0x6B Modification time</summary> public ushort time; /// <summary>0x6D Modification date</summary> @@ -107,8 +105,7 @@ namespace DiscImageChef.ImagePlugins /// <summary>0x76 Source drive type. 1 = 5.25" DD, 2 = 5.25" HD, 3 = 3.5" DD, 4 = 3.5" HD, 6 = 3.5" ED</summary> public byte drive; /// <summary>0x77 Filling bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] - public byte[] fill; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] public byte[] fill; /// <summary>0x84 Header checksum</summary> public byte headerChecksum; } @@ -128,28 +125,36 @@ namespace DiscImageChef.ImagePlugins const byte COPYQM_35HD = 4; const byte COPYQM_35ED = 6; - readonly uint[] copyQmCrcTable = { - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + readonly uint[] copyQmCrcTable = + { + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, + 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, + 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, + 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, + 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, + 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, + 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, + 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, + 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, + 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, + 0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, + 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, + 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, + 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, + 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, + 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, + 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, + 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, + 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, + 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, + 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, + 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D }; #endregion Internal Constants @@ -195,16 +200,14 @@ namespace DiscImageChef.ImagePlugins { Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 133) - return false; + if(stream.Length < 133) return false; byte[] hdr = new byte[133]; stream.Read(hdr, 0, 133); ushort magic = BitConverter.ToUInt16(hdr, 0); - if(magic != COPYQM_MAGIC || hdr[0x02] != COPYQM_MARK || (133 + hdr[0x6F]) >= stream.Length) - return false; + if(magic != COPYQM_MAGIC || hdr[0x02] != COPYQM_MARK || (133 + hdr[0x6F]) >= stream.Length) return false; return true; } @@ -264,8 +267,7 @@ namespace DiscImageChef.ImagePlugins while(stream.Position + 2 < stream.Length) { byte[] runLengthBytes = new byte[2]; - if(stream.Read(runLengthBytes, 0, 2) != 2) - break; + if(stream.Read(runLengthBytes, 0, 2) != 2) break; short runLength = BitConverter.ToInt16(runLengthBytes, 0); @@ -278,7 +280,8 @@ namespace DiscImageChef.ImagePlugins for(int i = 0; i < (runLength * -1); i++) { decodedImage.WriteByte(repeatedByte); - calculatedDataCrc = copyQmCrcTable[(repeatedByte ^ calculatedDataCrc) & 0x3F] ^ (calculatedDataCrc >> 8); + calculatedDataCrc = copyQmCrcTable[(repeatedByte ^ calculatedDataCrc) & 0x3F] ^ + (calculatedDataCrc >> 8); } } else if(runLength > 0) @@ -288,18 +291,19 @@ namespace DiscImageChef.ImagePlugins decodedImage.Write(nonRepeated, 0, runLength); for(int i = 0; i < nonRepeated.Length; i++) - calculatedDataCrc = copyQmCrcTable[(nonRepeated[i] ^ calculatedDataCrc) & 0x3F] ^ (calculatedDataCrc >> 8); + calculatedDataCrc = copyQmCrcTable[(nonRepeated[i] ^ calculatedDataCrc) & 0x3F] ^ + (calculatedDataCrc >> 8); } } // In case there is omitted data - long sectors = (header.sectorsPerTrack) * header.heads * header.totalCylinders; + long sectors = (header.sectorsPerTrack) * header.heads * header.totalCylinders; + + long fillingLen = (sectors * header.sectorSize) - decodedImage.Length; - long fillingLen = (sectors * header.sectorSize) - decodedImage.Length; - if(fillingLen > 0) { - byte[] filling = new byte[fillingLen]; + byte[] filling = new byte[fillingLen]; ArrayHelpers.ArrayFill(filling, (byte)0xF6); decodedImage.Write(filling, 0, filling.Length); } @@ -311,12 +315,14 @@ namespace DiscImageChef.ImagePlugins */ int sum = 0; - for(int i = 0; i < hdr.Length - 1; i++) - sum += hdr[i]; + for(int i = 0; i < hdr.Length - 1; i++) sum += hdr[i]; + headerChecksumOk = ((-1 * sum) & 0xFF) == header.headerChecksum; - DicConsole.DebugWriteLine("CopyQM plugin", "Calculated header checksum = 0x{0:X2}, {1}", ((-1 * sum) & 0xFF), headerChecksumOk); - DicConsole.DebugWriteLine("CopyQM plugin", "Calculated data CRC = 0x{0:X8}, {1}", calculatedDataCrc, calculatedDataCrc == header.crc); + DicConsole.DebugWriteLine("CopyQM plugin", "Calculated header checksum = 0x{0:X2}, {1}", + ((-1 * sum) & 0xFF), headerChecksumOk); + DicConsole.DebugWriteLine("CopyQM plugin", "Calculated data CRC = 0x{0:X8}, {1}", calculatedDataCrc, + calculatedDataCrc == header.crc); ImageInfo.imageApplication = "CopyQM"; ImageInfo.imageCreationTime = DateHandlers.DOSToDateTime(header.date, header.time); @@ -329,76 +335,71 @@ namespace DiscImageChef.ImagePlugins switch(header.drive) { case COPYQM_525HD: - if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 15 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_HD; - else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 16 && header.sectorSize == 256) - ImageInfo.mediaType = MediaType.ACORN_525_DS_DD; - else if(header.heads == 1 && header.totalCylinders == 80 && header.sectorsPerTrack == 16 && header.sectorSize == 256) - ImageInfo.mediaType = MediaType.ACORN_525_SS_DD_80; - else if(header.heads == 1 && header.totalCylinders == 80 && header.sectorsPerTrack == 10 && header.sectorSize == 256) - ImageInfo.mediaType = MediaType.ACORN_525_SS_SD_80; - else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 8 && header.sectorSize == 1024) - ImageInfo.mediaType = MediaType.NEC_525_HD; - else if(header.heads == 2 && header.totalCylinders == 77 && header.sectorsPerTrack == 8 && header.sectorSize == 1024) - ImageInfo.mediaType = MediaType.SHARP_525; - else - goto case COPYQM_525DD; + if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 15 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_HD; + else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 16 && + header.sectorSize == 256) ImageInfo.mediaType = MediaType.ACORN_525_DS_DD; + else if(header.heads == 1 && header.totalCylinders == 80 && header.sectorsPerTrack == 16 && + header.sectorSize == 256) ImageInfo.mediaType = MediaType.ACORN_525_SS_DD_80; + else if(header.heads == 1 && header.totalCylinders == 80 && header.sectorsPerTrack == 10 && + header.sectorSize == 256) ImageInfo.mediaType = MediaType.ACORN_525_SS_SD_80; + else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 8 && + header.sectorSize == 1024) ImageInfo.mediaType = MediaType.NEC_525_HD; + else if(header.heads == 2 && header.totalCylinders == 77 && header.sectorsPerTrack == 8 && + header.sectorSize == 1024) ImageInfo.mediaType = MediaType.SHARP_525; + else goto case COPYQM_525DD; break; case COPYQM_525DD: - if(header.heads == 1 && header.totalCylinders == 40 && header.sectorsPerTrack == 8 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; - else if(header.heads == 1 && header.totalCylinders == 40 && header.sectorsPerTrack == 9 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; - else if(header.heads == 2 && header.totalCylinders == 40 && header.sectorsPerTrack == 8 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; - else if(header.heads == 2 && header.totalCylinders == 40 && header.sectorsPerTrack == 9 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; - else if(header.heads == 1 && header.totalCylinders == 40 && header.sectorsPerTrack == 18 && header.sectorSize == 128) - ImageInfo.mediaType = MediaType.ATARI_525_SD; - else if(header.heads == 1 && header.totalCylinders == 40 && header.sectorsPerTrack == 26 && header.sectorSize == 128) - ImageInfo.mediaType = MediaType.ATARI_525_ED; - else if(header.heads == 1 && header.totalCylinders == 40 && header.sectorsPerTrack == 18 && header.sectorSize == 256) - ImageInfo.mediaType = MediaType.ATARI_525_DD; - else - ImageInfo.mediaType = MediaType.Unknown; + if(header.heads == 1 && header.totalCylinders == 40 && header.sectorsPerTrack == 8 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; + else if(header.heads == 1 && header.totalCylinders == 40 && header.sectorsPerTrack == 9 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; + else if(header.heads == 2 && header.totalCylinders == 40 && header.sectorsPerTrack == 8 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; + else if(header.heads == 2 && header.totalCylinders == 40 && header.sectorsPerTrack == 9 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; + else if(header.heads == 1 && header.totalCylinders == 40 && header.sectorsPerTrack == 18 && + header.sectorSize == 128) ImageInfo.mediaType = MediaType.ATARI_525_SD; + else if(header.heads == 1 && header.totalCylinders == 40 && header.sectorsPerTrack == 26 && + header.sectorSize == 128) ImageInfo.mediaType = MediaType.ATARI_525_ED; + else if(header.heads == 1 && header.totalCylinders == 40 && header.sectorsPerTrack == 18 && + header.sectorSize == 256) ImageInfo.mediaType = MediaType.ATARI_525_DD; + else ImageInfo.mediaType = MediaType.Unknown; break; case COPYQM_35ED: - if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 36 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_ED; - else - goto case COPYQM_35HD; + if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 36 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_ED; + else goto case COPYQM_35HD; break; case COPYQM_35HD: - if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 18 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_HD; - else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 21 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.DMF; - else if(header.heads == 2 && header.totalCylinders == 82 && header.sectorsPerTrack == 21 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.DMF_82; - else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 8 && header.sectorSize == 1024) - ImageInfo.mediaType = MediaType.NEC_35_HD_8; - else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 15 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.NEC_35_HD_15; - else - goto case COPYQM_35DD; + if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 18 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_HD; + else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 21 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.DMF; + else if(header.heads == 2 && header.totalCylinders == 82 && header.sectorsPerTrack == 21 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.DMF_82; + else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 8 && + header.sectorSize == 1024) ImageInfo.mediaType = MediaType.NEC_35_HD_8; + else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 15 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.NEC_35_HD_15; + else goto case COPYQM_35DD; break; case COPYQM_35DD: - if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 9 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; - else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 8 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; - else if(header.heads == 1 && header.totalCylinders == 80 && header.sectorsPerTrack == 9 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; - else if(header.heads == 1 && header.totalCylinders == 80 && header.sectorsPerTrack == 8 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; - else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 5 && header.sectorSize == 1024) - ImageInfo.mediaType = MediaType.ACORN_35_DS_DD; - else if(header.heads == 2 && header.totalCylinders == 77 && header.sectorsPerTrack == 8 && header.sectorSize == 1024) - ImageInfo.mediaType = MediaType.SHARP_35; - else if(header.heads == 1 && header.totalCylinders == 70 && header.sectorsPerTrack == 9 && header.sectorSize == 512) - ImageInfo.mediaType = MediaType.Apricot_35; - else - ImageInfo.mediaType = MediaType.Unknown; + if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 9 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; + else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 8 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; + else if(header.heads == 1 && header.totalCylinders == 80 && header.sectorsPerTrack == 9 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; + else if(header.heads == 1 && header.totalCylinders == 80 && header.sectorsPerTrack == 8 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; + else if(header.heads == 2 && header.totalCylinders == 80 && header.sectorsPerTrack == 5 && + header.sectorSize == 1024) ImageInfo.mediaType = MediaType.ACORN_35_DS_DD; + else if(header.heads == 2 && header.totalCylinders == 77 && header.sectorsPerTrack == 8 && + header.sectorSize == 1024) ImageInfo.mediaType = MediaType.SHARP_35; + else if(header.heads == 1 && header.totalCylinders == 70 && header.sectorsPerTrack == 9 && + header.sectorSize == 512) ImageInfo.mediaType = MediaType.Apricot_35; + else ImageInfo.mediaType = MediaType.Unknown; break; default: ImageInfo.mediaType = MediaType.Unknown; @@ -414,9 +415,9 @@ namespace DiscImageChef.ImagePlugins if(!string.IsNullOrEmpty(ImageInfo.imageComments)) DicConsole.VerboseWriteLine("CopyQM comments: {0}", ImageInfo.imageComments); - ImageInfo.heads = header.heads; - ImageInfo.cylinders = header.imageCylinders; - ImageInfo.sectorsPerTrack = header.sectorsPerTrack; + ImageInfo.heads = header.heads; + ImageInfo.cylinders = header.imageCylinders; + ImageInfo.sectorsPerTrack = header.sectorsPerTrack; return true; } @@ -431,24 +432,24 @@ namespace DiscImageChef.ImagePlugins return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); return null; } @@ -493,7 +494,8 @@ namespace DiscImageChef.ImagePlugins byte[] buffer = new byte[length * ImageInfo.sectorSize]; - Array.Copy(decodedDisk, (int)sectorAddress * ImageInfo.sectorSize, buffer, 0, length * ImageInfo.sectorSize); + Array.Copy(decodedDisk, (int)sectorAddress * ImageInfo.sectorSize, buffer, 0, + length * ImageInfo.sectorSize); return buffer; } @@ -537,6 +539,7 @@ namespace DiscImageChef.ImagePlugins { return ImageInfo.mediaType; } + public override string GetImageCreator() { return ImageInfo.imageCreator; @@ -599,7 +602,6 @@ namespace DiscImageChef.ImagePlugins #endregion Public methods #region Unsupported features - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -680,7 +682,5 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } #endregion Unsupported features - } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/D88.cs b/DiscImageChef.DiscImages/D88.cs index 159b5c8b..a3e84a06 100644 --- a/DiscImageChef.DiscImages/D88.cs +++ b/DiscImageChef.DiscImages/D88.cs @@ -43,778 +43,771 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - // Information from Quasi88's FORMAT.TXT file - // Japanese comments copied from there - public class D88 : ImagePlugin - { - #region Internal enumerations - enum DiskType : byte - { - D2 = 0x00, - DD2 = 0x10, - HD2 = 0x20, - } - - enum DensityType : byte - { - MFM = 0x00, - FM = 0x40, - } - - /// <summary> - /// Status as returned by PC-98 BIOS - /// ステータスは、PC-98x1 のBIOS が返してくるステータスで、 - /// </summary> - enum StatusType : byte - { - /// <summary> - /// Normal - /// 正常 - /// </summary> - Normal = 0x00, - /// <summary> - /// Deleted - /// 正常(DELETED DATA) - /// </summary> - Deleted = 0x10, - /// <summary> - /// CRC error in address fields - /// ID CRC エラー - /// </summary> - IDError = 0xA0, - /// <summary> - /// CRC error in data block - /// データ CRC エラー - /// </summary> - DataError = 0xB0, - /// <summary> - /// Address mark not found - /// アドレスマークなし - /// </summary> - AddressMarkNotFound = 0xE0, - /// <summary> - /// Data mark not found - /// データマークなし - /// </summary> - DataMarkNotFound = 0xF0, - } - #endregion - - #region Internal constants - readonly byte[] ReservedEmpty = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - const byte ReadOnly = 0x10; - #endregion - - #region Internal structures - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct D88Header - { - /// <summary> - /// Disk name, nul-terminated ASCII - /// ディスクの名前(ASCII + '\0') - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] name; - /// <summary> - /// Reserved - /// ディスクの名前(ASCII + '\0') - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] - public byte[] reserved; - /// <summary> - /// Write protect status - /// ライトプロテクト: 0x00 なし、0x10 あり - /// </summary> - public byte write_protect; - /// <summary> - /// Disk type - /// ディスクの種類: 0x00 2D、 0x10 2DD、 0x20 2HD - /// </summary> - public DiskType disk_type; - /// <summary> - /// Disk image size - /// ディスクのサイズ - /// </summary> - public int disk_size; - /// <summary> - /// Track pointers - /// トラック部のオフセットテーブル 0 Track ~ 163 Track - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 164)] - public int[] track_table; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct SectorHeader - { - /// <summary> - /// Cylinder - /// ID の C - /// </summary> - public byte c; - /// <summary> - /// Head - /// ID の H - /// </summary> - public byte h; - /// <summary> - /// Sector number - /// ID の R - /// </summary> - public byte r; - /// <summary> - /// Sector size - /// ID の N - /// </summary> - public IBMSectorSizeCode n; - /// <summary> - /// Number of sectors in this track - /// このトラック内に存在するセクタの数 - /// </summary> - public short spt; - /// <summary> - /// Density: 0x00 MFM, 0x40 FM - /// 記録密度: 0x00 倍密度、0x40 単密度 - /// </summary> - public DensityType density; - /// <summary> - /// Deleted sector, 0x00 not deleted, 0x10 deleted - /// DELETED MARK: 0x00 ノーマル、 0x10 DELETED - /// </summary> - public byte deleted_mark; - /// <summary> - /// Sector status - /// ステータス - /// </summary> - public byte status; - /// <summary> - /// Reserved - /// リザーブ - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] reserved; - /// <summary> - /// Size of data following this field - /// このセクタ部のデータサイズ - /// </summary> - public short size_of_data; - } - #endregion - - List<byte[]> sectorsData; - - public D88() - { - Name = "D88 Disk Image"; - PluginUUID = new Guid("669EDC77-EC41-4720-A88C-49C38CFFBAA0"); - ImageInfo = new ImageInfo() - { - readableSectorTags = new List<SectorTagType>(), - readableMediaTags = new List<MediaTagType>(), - imageHasPartitions = false, - imageHasSessions = false, - imageVersion = null, - imageApplication = null, - imageApplicationVersion = null, - imageCreator = null, - imageComments = null, - mediaManufacturer = null, - mediaModel = null, - mediaSerialNumber = null, - mediaBarcode = null, - mediaPartNumber = null, - mediaSequence = 0, - lastMediaSequence = 0, - driveManufacturer = null, - driveModel = null, - driveSerialNumber = null, - driveFirmwareRevision = null - }; - } - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - // Even if disk name is supposedly ASCII, I'm pretty sure most emulators allow Shift-JIS to be used :p - Encoding shiftjis = Encoding.GetEncoding("shift_jis"); - - D88Header d88hdr = new D88Header(); - - if(stream.Length < Marshal.SizeOf(d88hdr)) - return false; - - byte[] hdr_b = new byte[Marshal.SizeOf(d88hdr)]; - stream.Read(hdr_b, 0, hdr_b.Length); - - GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); - d88hdr = (D88Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(D88Header)); - handle.Free(); - - DicConsole.DebugWriteLine("D88 plugin", "d88hdr.name = \"{0}\"", StringHandlers.CToString(d88hdr.name, shiftjis)); - DicConsole.DebugWriteLine("D88 plugin", "d88hdr.reserved is empty? = {0}", d88hdr.reserved.SequenceEqual(ReservedEmpty)); - DicConsole.DebugWriteLine("D88 plugin", "d88hdr.write_protect = 0x{0:X2}", d88hdr.write_protect); - DicConsole.DebugWriteLine("D88 plugin", "d88hdr.disk_type = {0} ({1})", d88hdr.disk_type, (byte)d88hdr.disk_type); - DicConsole.DebugWriteLine("D88 plugin", "d88hdr.disk_size = {0}", d88hdr.disk_size); - - if(d88hdr.disk_size != stream.Length) - return false; - - if(d88hdr.disk_type != DiskType.D2 && d88hdr.disk_type != DiskType.DD2 && d88hdr.disk_type != DiskType.HD2) - return false; - - if(!d88hdr.reserved.SequenceEqual(ReservedEmpty)) - return false; - - int counter = 0; - for(int i = 0; i < d88hdr.track_table.Length; i++) - { - if(d88hdr.track_table[i] > 0) - counter++; - - if(d88hdr.track_table[i] < 0 || d88hdr.track_table[i] > stream.Length) - return false; - } - - DicConsole.DebugWriteLine("D88 plugin", "{0} tracks", counter); - - return counter > 0; - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - // Even if disk name is supposedly ASCII, I'm pretty sure most emulators allow Shift-JIS to be used :p - Encoding shiftjis = Encoding.GetEncoding("shift_jis"); - - D88Header d88hdr = new D88Header(); - - if(stream.Length < Marshal.SizeOf(d88hdr)) - return false; - - byte[] hdr_b = new byte[Marshal.SizeOf(d88hdr)]; - stream.Read(hdr_b, 0, hdr_b.Length); - - GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); - d88hdr = (D88Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(D88Header)); - handle.Free(); - - DicConsole.DebugWriteLine("D88 plugin", "d88hdr.name = \"{0}\"", StringHandlers.CToString(d88hdr.name, shiftjis)); - DicConsole.DebugWriteLine("D88 plugin", "d88hdr.reserved is empty? = {0}", d88hdr.reserved.SequenceEqual(ReservedEmpty)); - DicConsole.DebugWriteLine("D88 plugin", "d88hdr.write_protect = 0x{0:X2}", d88hdr.write_protect); - DicConsole.DebugWriteLine("D88 plugin", "d88hdr.disk_type = {0} ({1})", d88hdr.disk_type, (byte)d88hdr.disk_type); - DicConsole.DebugWriteLine("D88 plugin", "d88hdr.disk_size = {0}", d88hdr.disk_size); - - if(d88hdr.disk_size != stream.Length) - return false; - - if(d88hdr.disk_type != DiskType.D2 && d88hdr.disk_type != DiskType.DD2 && d88hdr.disk_type != DiskType.HD2) - return false; - - if(!d88hdr.reserved.SequenceEqual(ReservedEmpty)) - return false; - - int trkCounter = 0; - for(int i = 0; i < d88hdr.track_table.Length; i++) - { - if(d88hdr.track_table[i] > 0) - trkCounter++; - - if(d88hdr.track_table[i] < 0 || d88hdr.track_table[i] > stream.Length) - return false; - } - - DicConsole.DebugWriteLine("D88 plugin", "{0} tracks", trkCounter); - - if(trkCounter == 0) - return false; - - SectorHeader sechdr = new SectorHeader(); - hdr_b = new byte[Marshal.SizeOf(sechdr)]; - stream.Seek(d88hdr.track_table[0], SeekOrigin.Begin); - stream.Read(hdr_b, 0, hdr_b.Length); - - handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); - sechdr = (SectorHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SectorHeader)); - handle.Free(); - - DicConsole.DebugWriteLine("D88 plugin", "sechdr.c = {0}", sechdr.c); - DicConsole.DebugWriteLine("D88 plugin", "sechdr.h = {0}", sechdr.h); - DicConsole.DebugWriteLine("D88 plugin", "sechdr.r = {0}", sechdr.r); - DicConsole.DebugWriteLine("D88 plugin", "sechdr.n = {0}", sechdr.n); - DicConsole.DebugWriteLine("D88 plugin", "sechdr.spt = {0}", sechdr.spt); - DicConsole.DebugWriteLine("D88 plugin", "sechdr.density = {0}", sechdr.density); - DicConsole.DebugWriteLine("D88 plugin", "sechdr.deleted_mark = {0}", sechdr.deleted_mark); - DicConsole.DebugWriteLine("D88 plugin", "sechdr.status = {0}", sechdr.status); - DicConsole.DebugWriteLine("D88 plugin", "sechdr.size_of_data = {0}", sechdr.size_of_data); - - short spt = sechdr.spt; - IBMSectorSizeCode bps = sechdr.n; - bool allEqual = true; - sectorsData = new List<byte[]>(); - - for(int i = 0; i < trkCounter; i++) - { - stream.Seek(d88hdr.track_table[i], SeekOrigin.Begin); - stream.Read(hdr_b, 0, hdr_b.Length); - SortedDictionary<byte, byte[]> sectors = new SortedDictionary<byte, byte[]>(); - - handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); - sechdr = (SectorHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SectorHeader)); - handle.Free(); - - if(sechdr.spt != spt || sechdr.n != bps) - { - DicConsole.DebugWriteLine("D88 plugin", "Disk tracks are not same size. spt = {0} (expected {1}), bps = {2} (expected {3}) at track {4} sector {5}", sechdr.spt, spt, sechdr.n, bps, i, 0); - allEqual = false; - } - - short maxJ = sechdr.spt; - byte[] sec_b; - for(short j = 1; j < maxJ; j++) - { - sec_b = new byte[sechdr.size_of_data]; - stream.Read(sec_b, 0, sec_b.Length); - sectors.Add(sechdr.r, sec_b); - stream.Read(hdr_b, 0, hdr_b.Length); - - handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); - sechdr = (SectorHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SectorHeader)); - handle.Free(); - - if(sechdr.spt != spt || sechdr.n != bps) - { - DicConsole.DebugWriteLine("D88 plugin", "Disk tracks are not same size. spt = {0} (expected {1}), bps = {2} (expected {3}) at track {4} sector {5}", sechdr.spt, spt, sechdr.n, bps, i, j, sechdr.deleted_mark); - allEqual = false; - } - } - - sec_b = new byte[sechdr.size_of_data]; - stream.Read(sec_b, 0, sec_b.Length); - sectors.Add(sechdr.r, sec_b); - - foreach(KeyValuePair<byte, byte[]> kvp in sectors) - sectorsData.Add(kvp.Value); - } - - DicConsole.DebugWriteLine("D88 plugin", "{0} sectors", sectorsData.Count()); - - /* - FileStream debugStream = new FileStream("debug.img", FileMode.CreateNew, FileAccess.ReadWrite); - for(int i = 0; i < sectorsData.Count; i++) - debugStream.Write(sectorsData[i], 0, sectorsData[i].Length); - debugStream.Close(); - */ - - ImageInfo.mediaType = MediaType.Unknown; - if(allEqual) - { - if(trkCounter == 154 && spt == 26 && bps == IBMSectorSizeCode.EighthKilo) - ImageInfo.mediaType = MediaType.NEC_8_SD; - else if(bps == IBMSectorSizeCode.QuarterKilo) - { - if(trkCounter == 80 && spt == 16) - ImageInfo.mediaType = MediaType.NEC_525_SS; - else if(trkCounter == 154 && spt == 26) - ImageInfo.mediaType = MediaType.NEC_8_DD; - else if(trkCounter == 160 && spt == 16) - ImageInfo.mediaType = MediaType.NEC_525_DS; - } - else if(trkCounter == 154 && spt == 8 && bps == IBMSectorSizeCode.Kilo) - ImageInfo.mediaType = MediaType.NEC_525_HD; - else if(bps == IBMSectorSizeCode.HalfKilo) - { - switch(d88hdr.track_table.Length) - { - case 40: - { - switch(spt) - { - case 8: - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; - break; - case 9: - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; - break; - } - } - break; - case 80: - { - switch(spt) - { - case 8: - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; - break; - case 9: - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; - break; - } - } - break; - case 160: - { - switch(spt) - { - case 15: - ImageInfo.mediaType = MediaType.NEC_35_HD_15; - break; - case 9: - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; - break; - case 18: - ImageInfo.mediaType = MediaType.DOS_35_HD; - break; - case 36: - ImageInfo.mediaType = MediaType.DOS_35_ED; - break; - } - } - break; - case 480: - if(spt == 38) - ImageInfo.mediaType = MediaType.NEC_35_TD; - break; - } - } - } - - DicConsole.DebugWriteLine("D88 plugin", "MediaType: {0}", ImageInfo.mediaType); - - ImageInfo.imageSize = (ulong)d88hdr.disk_size; - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.sectors = (ulong)sectorsData.Count; - ImageInfo.imageComments = StringHandlers.CToString(d88hdr.name, shiftjis); - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.sectorSize = (uint)(128 << (int)bps); - - switch(ImageInfo.mediaType) - { - case MediaType.NEC_525_SS: - ImageInfo.cylinders = 80; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 16; - break; - case MediaType.NEC_8_SD: - case MediaType.NEC_8_DD: - ImageInfo.cylinders = 77; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 26; - break; - case MediaType.NEC_525_DS: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 16; - break; - case MediaType.NEC_525_HD: - ImageInfo.cylinders = 77; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 8; - break; - case MediaType.DOS_525_SS_DD_8: - ImageInfo.cylinders = 40; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 8; - break; - case MediaType.DOS_525_SS_DD_9: - ImageInfo.cylinders = 40; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 9; - break; - case MediaType.DOS_525_DS_DD_8: - ImageInfo.cylinders = 40; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 8; - break; - case MediaType.DOS_525_DS_DD_9: - ImageInfo.cylinders = 40; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 9; - break; - case MediaType.NEC_35_HD_15: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 15; - break; - case MediaType.DOS_35_DS_DD_9: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 9; - break; - case MediaType.DOS_35_HD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 18; - break; - case MediaType.DOS_35_ED: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 36; - break; - case MediaType.NEC_35_TD: - ImageInfo.cylinders = 240; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 38; - break; - } - - return true; - } - - public override bool ImageHasPartitions() - { - return false; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override string GetImageFormat() - { - return "D88 disk image"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - MemoryStream buffer = new MemoryStream(); - for(int i = 0; i < length; i++) - buffer.Write(sectorsData[(int)sectorAddress + i], 0, sectorsData[(int)sectorAddress + i].Length); - - return buffer.ToArray(); - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetMediaManufacturer() - { - return null; - } - - public override string GetMediaModel() - { - return null; - } - - public override string GetMediaSerialNumber() - { - return null; - } - - public override string GetMediaBarcode() - { - return null; - } - - public override string GetMediaPartNumber() - { - return null; - } - - public override int GetMediaSequence() - { - return 0; - } - - public override int GetLastDiskSequence() - { - return 0; - } - - public override string GetDriveManufacturer() - { - return null; - } - - public override string GetDriveModel() - { - return null; - } - - public override string GetDriveSerialNumber() - { - return null; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifyMediaImage() - { - return null; - } - - #endregion - } + // Information from Quasi88's FORMAT.TXT file + // Japanese comments copied from there + public class D88 : ImagePlugin + { + #region Internal enumerations + enum DiskType : byte + { + D2 = 0x00, + DD2 = 0x10, + HD2 = 0x20, + } + + enum DensityType : byte + { + MFM = 0x00, + FM = 0x40, + } + + /// <summary> + /// Status as returned by PC-98 BIOS + /// ステータスは、PC-98x1 のBIOS が返してくるステータスで、 + /// </summary> + enum StatusType : byte + { + /// <summary> + /// Normal + /// 正常 + /// </summary> + Normal = 0x00, + /// <summary> + /// Deleted + /// 正常(DELETED DATA) + /// </summary> + Deleted = 0x10, + /// <summary> + /// CRC error in address fields + /// ID CRC エラー + /// </summary> + IDError = 0xA0, + /// <summary> + /// CRC error in data block + /// データ CRC エラー + /// </summary> + DataError = 0xB0, + /// <summary> + /// Address mark not found + /// アドレスマークなし + /// </summary> + AddressMarkNotFound = 0xE0, + /// <summary> + /// Data mark not found + /// データマークなし + /// </summary> + DataMarkNotFound = 0xF0, + } + #endregion + + #region Internal constants + readonly byte[] ReservedEmpty = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + const byte ReadOnly = 0x10; + #endregion + + #region Internal structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct D88Header + { + /// <summary> + /// Disk name, nul-terminated ASCII + /// ディスクの名前(ASCII + '\0') + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] public byte[] name; + /// <summary> + /// Reserved + /// ディスクの名前(ASCII + '\0') + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] public byte[] reserved; + /// <summary> + /// Write protect status + /// ライトプロテクト: 0x00 なし、0x10 あり + /// </summary> + public byte write_protect; + /// <summary> + /// Disk type + /// ディスクの種類: 0x00 2D、 0x10 2DD、 0x20 2HD + /// </summary> + public DiskType disk_type; + /// <summary> + /// Disk image size + /// ディスクのサイズ + /// </summary> + public int disk_size; + /// <summary> + /// Track pointers + /// トラック部のオフセットテーブル 0 Track ~ 163 Track + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 164)] public int[] track_table; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct SectorHeader + { + /// <summary> + /// Cylinder + /// ID の C + /// </summary> + public byte c; + /// <summary> + /// Head + /// ID の H + /// </summary> + public byte h; + /// <summary> + /// Sector number + /// ID の R + /// </summary> + public byte r; + /// <summary> + /// Sector size + /// ID の N + /// </summary> + public IBMSectorSizeCode n; + /// <summary> + /// Number of sectors in this track + /// このトラック内に存在するセクタの数 + /// </summary> + public short spt; + /// <summary> + /// Density: 0x00 MFM, 0x40 FM + /// 記録密度: 0x00 倍密度、0x40 単密度 + /// </summary> + public DensityType density; + /// <summary> + /// Deleted sector, 0x00 not deleted, 0x10 deleted + /// DELETED MARK: 0x00 ノーマル、 0x10 DELETED + /// </summary> + public byte deleted_mark; + /// <summary> + /// Sector status + /// ステータス + /// </summary> + public byte status; + /// <summary> + /// Reserved + /// リザーブ + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] reserved; + /// <summary> + /// Size of data following this field + /// このセクタ部のデータサイズ + /// </summary> + public short size_of_data; + } + #endregion + + List<byte[]> sectorsData; + + public D88() + { + Name = "D88 Disk Image"; + PluginUUID = new Guid("669EDC77-EC41-4720-A88C-49C38CFFBAA0"); + ImageInfo = new ImageInfo() + { + readableSectorTags = new List<SectorTagType>(), + readableMediaTags = new List<MediaTagType>(), + imageHasPartitions = false, + imageHasSessions = false, + imageVersion = null, + imageApplication = null, + imageApplicationVersion = null, + imageCreator = null, + imageComments = null, + mediaManufacturer = null, + mediaModel = null, + mediaSerialNumber = null, + mediaBarcode = null, + mediaPartNumber = null, + mediaSequence = 0, + lastMediaSequence = 0, + driveManufacturer = null, + driveModel = null, + driveSerialNumber = null, + driveFirmwareRevision = null + }; + } + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + // Even if disk name is supposedly ASCII, I'm pretty sure most emulators allow Shift-JIS to be used :p + Encoding shiftjis = Encoding.GetEncoding("shift_jis"); + + D88Header d88hdr = new D88Header(); + + if(stream.Length < Marshal.SizeOf(d88hdr)) return false; + + byte[] hdr_b = new byte[Marshal.SizeOf(d88hdr)]; + stream.Read(hdr_b, 0, hdr_b.Length); + + GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); + d88hdr = (D88Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(D88Header)); + handle.Free(); + + DicConsole.DebugWriteLine("D88 plugin", "d88hdr.name = \"{0}\"", + StringHandlers.CToString(d88hdr.name, shiftjis)); + DicConsole.DebugWriteLine("D88 plugin", "d88hdr.reserved is empty? = {0}", + d88hdr.reserved.SequenceEqual(ReservedEmpty)); + DicConsole.DebugWriteLine("D88 plugin", "d88hdr.write_protect = 0x{0:X2}", d88hdr.write_protect); + DicConsole.DebugWriteLine("D88 plugin", "d88hdr.disk_type = {0} ({1})", d88hdr.disk_type, + (byte)d88hdr.disk_type); + DicConsole.DebugWriteLine("D88 plugin", "d88hdr.disk_size = {0}", d88hdr.disk_size); + + if(d88hdr.disk_size != stream.Length) return false; + + if(d88hdr.disk_type != DiskType.D2 && d88hdr.disk_type != DiskType.DD2 && + d88hdr.disk_type != DiskType.HD2) return false; + + if(!d88hdr.reserved.SequenceEqual(ReservedEmpty)) return false; + + int counter = 0; + for(int i = 0; i < d88hdr.track_table.Length; i++) + { + if(d88hdr.track_table[i] > 0) counter++; + + if(d88hdr.track_table[i] < 0 || d88hdr.track_table[i] > stream.Length) return false; + } + + DicConsole.DebugWriteLine("D88 plugin", "{0} tracks", counter); + + return counter > 0; + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + // Even if disk name is supposedly ASCII, I'm pretty sure most emulators allow Shift-JIS to be used :p + Encoding shiftjis = Encoding.GetEncoding("shift_jis"); + + D88Header d88hdr = new D88Header(); + + if(stream.Length < Marshal.SizeOf(d88hdr)) return false; + + byte[] hdr_b = new byte[Marshal.SizeOf(d88hdr)]; + stream.Read(hdr_b, 0, hdr_b.Length); + + GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); + d88hdr = (D88Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(D88Header)); + handle.Free(); + + DicConsole.DebugWriteLine("D88 plugin", "d88hdr.name = \"{0}\"", + StringHandlers.CToString(d88hdr.name, shiftjis)); + DicConsole.DebugWriteLine("D88 plugin", "d88hdr.reserved is empty? = {0}", + d88hdr.reserved.SequenceEqual(ReservedEmpty)); + DicConsole.DebugWriteLine("D88 plugin", "d88hdr.write_protect = 0x{0:X2}", d88hdr.write_protect); + DicConsole.DebugWriteLine("D88 plugin", "d88hdr.disk_type = {0} ({1})", d88hdr.disk_type, + (byte)d88hdr.disk_type); + DicConsole.DebugWriteLine("D88 plugin", "d88hdr.disk_size = {0}", d88hdr.disk_size); + + if(d88hdr.disk_size != stream.Length) return false; + + if(d88hdr.disk_type != DiskType.D2 && d88hdr.disk_type != DiskType.DD2 && + d88hdr.disk_type != DiskType.HD2) return false; + + if(!d88hdr.reserved.SequenceEqual(ReservedEmpty)) return false; + + int trkCounter = 0; + for(int i = 0; i < d88hdr.track_table.Length; i++) + { + if(d88hdr.track_table[i] > 0) trkCounter++; + + if(d88hdr.track_table[i] < 0 || d88hdr.track_table[i] > stream.Length) return false; + } + + DicConsole.DebugWriteLine("D88 plugin", "{0} tracks", trkCounter); + + if(trkCounter == 0) return false; + + SectorHeader sechdr = new SectorHeader(); + hdr_b = new byte[Marshal.SizeOf(sechdr)]; + stream.Seek(d88hdr.track_table[0], SeekOrigin.Begin); + stream.Read(hdr_b, 0, hdr_b.Length); + + handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); + sechdr = (SectorHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SectorHeader)); + handle.Free(); + + DicConsole.DebugWriteLine("D88 plugin", "sechdr.c = {0}", sechdr.c); + DicConsole.DebugWriteLine("D88 plugin", "sechdr.h = {0}", sechdr.h); + DicConsole.DebugWriteLine("D88 plugin", "sechdr.r = {0}", sechdr.r); + DicConsole.DebugWriteLine("D88 plugin", "sechdr.n = {0}", sechdr.n); + DicConsole.DebugWriteLine("D88 plugin", "sechdr.spt = {0}", sechdr.spt); + DicConsole.DebugWriteLine("D88 plugin", "sechdr.density = {0}", sechdr.density); + DicConsole.DebugWriteLine("D88 plugin", "sechdr.deleted_mark = {0}", sechdr.deleted_mark); + DicConsole.DebugWriteLine("D88 plugin", "sechdr.status = {0}", sechdr.status); + DicConsole.DebugWriteLine("D88 plugin", "sechdr.size_of_data = {0}", sechdr.size_of_data); + + short spt = sechdr.spt; + IBMSectorSizeCode bps = sechdr.n; + bool allEqual = true; + sectorsData = new List<byte[]>(); + + for(int i = 0; i < trkCounter; i++) + { + stream.Seek(d88hdr.track_table[i], SeekOrigin.Begin); + stream.Read(hdr_b, 0, hdr_b.Length); + SortedDictionary<byte, byte[]> sectors = new SortedDictionary<byte, byte[]>(); + + handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); + sechdr = (SectorHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SectorHeader)); + handle.Free(); + + if(sechdr.spt != spt || sechdr.n != bps) + { + DicConsole.DebugWriteLine("D88 plugin", + "Disk tracks are not same size. spt = {0} (expected {1}), bps = {2} (expected {3}) at track {4} sector {5}", + sechdr.spt, spt, sechdr.n, bps, i, 0); + allEqual = false; + } + + short maxJ = sechdr.spt; + byte[] sec_b; + for(short j = 1; j < maxJ; j++) + { + sec_b = new byte[sechdr.size_of_data]; + stream.Read(sec_b, 0, sec_b.Length); + sectors.Add(sechdr.r, sec_b); + stream.Read(hdr_b, 0, hdr_b.Length); + + handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); + sechdr = (SectorHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SectorHeader)); + handle.Free(); + + if(sechdr.spt != spt || sechdr.n != bps) + { + DicConsole.DebugWriteLine("D88 plugin", + "Disk tracks are not same size. spt = {0} (expected {1}), bps = {2} (expected {3}) at track {4} sector {5}", + sechdr.spt, spt, sechdr.n, bps, i, j, sechdr.deleted_mark); + allEqual = false; + } + } + + sec_b = new byte[sechdr.size_of_data]; + stream.Read(sec_b, 0, sec_b.Length); + sectors.Add(sechdr.r, sec_b); + + foreach(KeyValuePair<byte, byte[]> kvp in sectors) sectorsData.Add(kvp.Value); + } + + DicConsole.DebugWriteLine("D88 plugin", "{0} sectors", sectorsData.Count()); + + /* + FileStream debugStream = new FileStream("debug.img", FileMode.CreateNew, FileAccess.ReadWrite); + for(int i = 0; i < sectorsData.Count; i++) + debugStream.Write(sectorsData[i], 0, sectorsData[i].Length); + debugStream.Close(); + */ + + ImageInfo.mediaType = MediaType.Unknown; + if(allEqual) + { + if(trkCounter == 154 && spt == 26 && bps == IBMSectorSizeCode.EighthKilo) + ImageInfo.mediaType = MediaType.NEC_8_SD; + else if(bps == IBMSectorSizeCode.QuarterKilo) + { + if(trkCounter == 80 && spt == 16) ImageInfo.mediaType = MediaType.NEC_525_SS; + else if(trkCounter == 154 && spt == 26) ImageInfo.mediaType = MediaType.NEC_8_DD; + else if(trkCounter == 160 && spt == 16) ImageInfo.mediaType = MediaType.NEC_525_DS; + } + else if(trkCounter == 154 && spt == 8 && bps == IBMSectorSizeCode.Kilo) + ImageInfo.mediaType = MediaType.NEC_525_HD; + else if(bps == IBMSectorSizeCode.HalfKilo) + { + switch(d88hdr.track_table.Length) + { + case 40: + { + switch(spt) + { + case 8: + ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; + break; + case 9: + ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; + break; + } + } + + break; + case 80: + { + switch(spt) + { + case 8: + ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; + break; + case 9: + ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; + break; + } + } + + break; + case 160: + { + switch(spt) + { + case 15: + ImageInfo.mediaType = MediaType.NEC_35_HD_15; + break; + case 9: + ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; + break; + case 18: + ImageInfo.mediaType = MediaType.DOS_35_HD; + break; + case 36: + ImageInfo.mediaType = MediaType.DOS_35_ED; + break; + } + } + + break; + case 480: + if(spt == 38) ImageInfo.mediaType = MediaType.NEC_35_TD; + break; + } + } + } + + DicConsole.DebugWriteLine("D88 plugin", "MediaType: {0}", ImageInfo.mediaType); + + ImageInfo.imageSize = (ulong)d88hdr.disk_size; + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.sectors = (ulong)sectorsData.Count; + ImageInfo.imageComments = StringHandlers.CToString(d88hdr.name, shiftjis); + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.sectorSize = (uint)(128 << (int)bps); + + switch(ImageInfo.mediaType) + { + case MediaType.NEC_525_SS: + ImageInfo.cylinders = 80; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 16; + break; + case MediaType.NEC_8_SD: + case MediaType.NEC_8_DD: + ImageInfo.cylinders = 77; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 26; + break; + case MediaType.NEC_525_DS: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 16; + break; + case MediaType.NEC_525_HD: + ImageInfo.cylinders = 77; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 8; + break; + case MediaType.DOS_525_SS_DD_8: + ImageInfo.cylinders = 40; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 8; + break; + case MediaType.DOS_525_SS_DD_9: + ImageInfo.cylinders = 40; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 9; + break; + case MediaType.DOS_525_DS_DD_8: + ImageInfo.cylinders = 40; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 8; + break; + case MediaType.DOS_525_DS_DD_9: + ImageInfo.cylinders = 40; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 9; + break; + case MediaType.NEC_35_HD_15: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 15; + break; + case MediaType.DOS_35_DS_DD_9: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 9; + break; + case MediaType.DOS_35_HD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 18; + break; + case MediaType.DOS_35_ED: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 36; + break; + case MediaType.NEC_35_TD: + ImageInfo.cylinders = 240; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 38; + break; + } + + return true; + } + + public override bool ImageHasPartitions() + { + return false; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override string GetImageFormat() + { + return "D88 disk image"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + MemoryStream buffer = new MemoryStream(); + for(int i = 0; i < length; i++) + buffer.Write(sectorsData[(int)sectorAddress + i], 0, sectorsData[(int)sectorAddress + i].Length); + + return buffer.ToArray(); + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetMediaManufacturer() + { + return null; + } + + public override string GetMediaModel() + { + return null; + } + + public override string GetMediaSerialNumber() + { + return null; + } + + public override string GetMediaBarcode() + { + return null; + } + + public override string GetMediaPartNumber() + { + return null; + } + + public override int GetMediaSequence() + { + return 0; + } + + public override int GetLastDiskSequence() + { + return 0; + } + + public override string GetDriveManufacturer() + { + return null; + } + + public override string GetDriveModel() + { + return null; + } + + public override string GetDriveSerialNumber() + { + return null; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifyMediaImage() + { + return null; + } + #endregion + } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/DART.cs b/DiscImageChef.DiscImages/DART.cs index d9871f65..dc4506ae 100644 --- a/DiscImageChef.DiscImages/DART.cs +++ b/DiscImageChef.DiscImages/DART.cs @@ -44,678 +44,670 @@ using DiscImageChef.ImagePlugins; namespace DiscImageChef.DiscImages { - public class DART : ImagePlugin - { - #region Internal constants - // Disk types - const byte kMacDisk = 1; - const byte kLisaDisk = 2; - const byte kAppleIIDisk = 3; - const byte kMacHiDDisk = 16; - const byte kMSDOSLowDDisk = 17; - const byte kMSDOSHiDDisk = 18; - - // Compression types - // "fast" - const byte kRLECompress = 0; - // "best" - const byte kLZHCompress = 1; - // DART <= 1.4 - const byte kNoCompress = 2; - - // Valid sizes - const short kLisa400KSize = 400; - const short kMac400KSize = 400; - const short kMac800KSize = 800; - const short kMac1440KSize = 1440; - const short kApple800KSize = 800; - const short kMSDOS720KSize = 720; - const short kMSDOS1440KSize = 1440; - - // bLength array sizes - const int blockArrayLenLow = 40; - const int blockArrayLenHigh = 72; - - const int sectorsPerBlock = 40; - const int sectorSize = 512; - const int tagSectorSize = 12; - const int dataSize = sectorsPerBlock * sectorSize; - const int tagSize = sectorsPerBlock * tagSectorSize; - const int bufferSize = (sectorsPerBlock * sectorSize) + (sectorsPerBlock * tagSectorSize); - #endregion - - #region Internal Structures - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct DART_Header - { - public byte srcCmp; - public byte srcType; - public short srcSize; - } - #endregion - - // DART images are at most 1474560 bytes, so let's cache the whole - byte[] dataCache; - byte[] tagCache; - uint dataChecksum; - uint tagChecksum; - - public DART() - { - Name = "Apple Disk Archival/Retrieval Tool"; - PluginUUID = new Guid("B3E06BF8-F98D-4F9B-BBE2-342C373BAF3E"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = false; - ImageInfo.imageHasSessions = false; - ImageInfo.imageVersion = null; - ImageInfo.imageApplication = null; - ImageInfo.imageApplicationVersion = null; - ImageInfo.imageCreator = null; - ImageInfo.imageComments = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaSerialNumber = null; - ImageInfo.mediaBarcode = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - - if(stream.Length < 84) - return false; - - DART_Header header = new DART_Header(); - stream.Seek(0, SeekOrigin.Begin); - byte[] header_b = new byte[Marshal.SizeOf(header)]; - - stream.Read(header_b, 0, Marshal.SizeOf(header)); - header = BigEndianMarshal.ByteArrayToStructureBigEndian<DART_Header>(header_b); - - if(header.srcCmp > kNoCompress) - return false; - - int expectedMaxSize = 84 + (header.srcSize * 2 * 524); - - switch(header.srcType) - { - case kMacDisk: - if(header.srcSize != kMac400KSize && header.srcSize != kMac800KSize) - return false; - break; - case kLisaDisk: - if(header.srcSize != kLisa400KSize) - return false; - break; - case kAppleIIDisk: - if(header.srcSize != kApple800KSize) - return false; - break; - case kMacHiDDisk: - if(header.srcSize != kMac1440KSize) - return false; - expectedMaxSize += 64; - break; - case kMSDOSLowDDisk: - if(header.srcSize != kMSDOS720KSize) - return false; - break; - case kMSDOSHiDDisk: - if(header.srcSize != kMSDOS1440KSize) - return false; - expectedMaxSize += 64; - break; - default: - return false; - } - - if(stream.Length > expectedMaxSize) - return false; - - return true; - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - - if(stream.Length < 84) - return false; - - DART_Header header = new DART_Header(); - stream.Seek(0, SeekOrigin.Begin); - byte[] header_b = new byte[Marshal.SizeOf(header)]; - - stream.Read(header_b, 0, Marshal.SizeOf(header)); - header = BigEndianMarshal.ByteArrayToStructureBigEndian<DART_Header>(header_b); - - if(header.srcCmp > kNoCompress) - return false; - - int expectedMaxSize = 84 + (header.srcSize * 2 * 524); - - switch(header.srcType) - { - case kMacDisk: - if(header.srcSize != kMac400KSize && header.srcSize != kMac800KSize) - return false; - break; - case kLisaDisk: - if(header.srcSize != kLisa400KSize) - return false; - break; - case kAppleIIDisk: - if(header.srcSize != kAppleIIDisk) - return false; - break; - case kMacHiDDisk: - if(header.srcSize != kMac1440KSize) - return false; - expectedMaxSize += 64; - break; - case kMSDOSLowDDisk: - if(header.srcSize != kMSDOS720KSize) - return false; - break; - case kMSDOSHiDDisk: - if(header.srcSize != kMSDOS1440KSize) - return false; - expectedMaxSize += 64; - break; - default: - return false; - } - - if(stream.Length > expectedMaxSize) - return false; - - short[] bLength; - - if(header.srcType == kMacHiDDisk || header.srcType == kMSDOSHiDDisk) - bLength = new short[blockArrayLenHigh]; - else - bLength = new short[blockArrayLenLow]; - - byte[] tmpShort; - for(int i = 0; i < bLength.Length; i++) - { - tmpShort = new byte[2]; - stream.Read(tmpShort, 0, 2); - bLength[i] = BigEndianBitConverter.ToInt16(tmpShort, 0); - } - - byte[] temp; - byte[] buffer; - - MemoryStream dataMs = new MemoryStream(); - MemoryStream tagMs = new MemoryStream(); - - for(int i = 0; i < bLength.Length; i++) - { - if(bLength[i] != 0) - { - buffer = new byte[bufferSize]; - if(bLength[i] == -1) - { - stream.Read(buffer, 0, bufferSize); - dataMs.Write(buffer, 0, dataSize); - tagMs.Write(buffer, dataSize, tagSize); - } - else if(header.srcCmp == kRLECompress) - { - temp = new byte[bLength[i] * 2]; - stream.Read(temp, 0, temp.Length); - throw new ImageNotSupportedException("Compressed images not yet supported"); - } - else - { - temp = new byte[bLength[i]]; - stream.Read(temp, 0, temp.Length); - throw new ImageNotSupportedException("Compressed images not yet supported"); - } - } - } - - dataCache = dataMs.ToArray(); - if(header.srcType == kLisaDisk || header.srcType == kMacDisk || header.srcType == kAppleIIDisk) - { - ImageInfo.readableSectorTags.Add(SectorTagType.AppleSectorTag); - tagCache = tagMs.ToArray(); - } - - try - { - if(imageFilter.HasResourceFork()) - { - ResourceFork rsrcFork = new ResourceFork(imageFilter.GetResourceForkStream()); - // "vers" - if(rsrcFork.ContainsKey(0x76657273)) - { - Resource versRsrc = rsrcFork.GetResource(0x76657273); - if(versRsrc != null) - { - byte[] vers = versRsrc.GetResource(versRsrc.GetIds()[0]); - - if(vers != null) - { - Resources.Version version = new Resources.Version(vers); - - string major; - string minor; - string release = null; - string dev = null; - string pre = null; - - major = string.Format("{0}", version.MajorVersion); - minor = string.Format(".{0}", version.MinorVersion / 10); - if(version.MinorVersion % 10 > 0) - release = string.Format(".{0}", version.MinorVersion % 10); - switch(version.DevStage) - { - case Resources.Version.DevelopmentStage.Alpha: - dev = "a"; - break; - case Resources.Version.DevelopmentStage.Beta: - dev = "b"; - break; - case Resources.Version.DevelopmentStage.PreAlpha: - dev = "d"; - break; - } - - if(dev == null && version.PreReleaseVersion > 0) - dev = "f"; - - if(dev != null) - pre = string.Format("{0}", version.PreReleaseVersion); - - ImageInfo.imageApplicationVersion = string.Format("{0}{1}{2}{3}{4}", major, minor, release, dev, pre); - ImageInfo.imageApplication = version.VersionString; - ImageInfo.imageComments = version.VersionMessage; - } - } - } - - // "dart" - if(rsrcFork.ContainsKey(0x44415254)) - { - Resource dartRsrc = rsrcFork.GetResource(0x44415254); - if(dartRsrc != null) - { - string dArt = StringHandlers.PascalToString(dartRsrc.GetResource(dartRsrc.GetIds()[0]), Encoding.GetEncoding("macintosh")); - string dArtRegEx = "(?<version>\\S+), tag checksum=\\$(?<tagchk>[0123456789ABCDEF]{8}), data checksum=\\$(?<datachk>[0123456789ABCDEF]{8})$"; - Regex dArtEx = new Regex(dArtRegEx); - Match dArtMatch = dArtEx.Match(dArt); - - if(dArtMatch.Success) - { - ImageInfo.imageApplication = "DART"; - ImageInfo.imageApplicationVersion = dArtMatch.Groups["version"].Value; - dataChecksum = Convert.ToUInt32(dArtMatch.Groups["datachk"].Value, 16); - tagChecksum = Convert.ToUInt32(dArtMatch.Groups["tagchk"].Value, 16); - } - } - } - - // "cksm" - if(rsrcFork.ContainsKey(0x434B534D)) - { - Resource cksmRsrc = rsrcFork.GetResource(0x434B534D); - if(cksmRsrc != null) - { - if(cksmRsrc.ContainsId(1)) - { - byte[] tagChk = cksmRsrc.GetResource(1); - tagChecksum = BigEndianBitConverter.ToUInt32(tagChk, 0); - } - if(cksmRsrc.ContainsId(2)) - { - byte[] dataChk = cksmRsrc.GetResource(1); - dataChecksum = BigEndianBitConverter.ToUInt32(dataChk, 0); - } - } - } - } - } - catch(InvalidCastException) { } - DicConsole.DebugWriteLine("DART plugin", "Image application = {0} version {1}", ImageInfo.imageApplication, ImageInfo.imageApplicationVersion); - - ImageInfo.sectors = (ulong)(header.srcSize * 2); - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.sectorSize = sectorSize; - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.imageSize = ImageInfo.sectors * sectorSize; - if(header.srcCmp == kNoCompress) - ImageInfo.imageVersion = "1.4"; - else - ImageInfo.imageVersion = "1.5"; - - switch(header.srcSize) - { - case kMac400KSize: - ImageInfo.cylinders = 80; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 10; - ImageInfo.mediaType = MediaType.AppleSonySS; - break; - case kMac800KSize: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 10; - ImageInfo.mediaType = MediaType.AppleSonyDS; - break; - case kMSDOS720KSize: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 9; - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; - break; - case kMac1440KSize: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 18; - ImageInfo.mediaType = MediaType.DOS_35_HD; - break; - } - - - return true; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - return ReadSectorsTag(sectorAddress, 1, tag); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] buffer = new byte[length * ImageInfo.sectorSize]; - - Array.Copy(dataCache, (int)sectorAddress * ImageInfo.sectorSize, buffer, 0, length * ImageInfo.sectorSize); - - return buffer; - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - if(tag != SectorTagType.AppleSectorTag) - throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); - - if(tagCache == null || tagCache.Length == 0) - throw new FeatureNotPresentImageException("Disk image does not have tags"); - - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] buffer = new byte[length * tagSectorSize]; - - Array.Copy(tagCache, (int)sectorAddress * tagSectorSize, buffer, 0, length * tagSectorSize); - - return buffer; - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - return ReadSectorsLong(sectorAddress, 1); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] data = ReadSectors(sectorAddress, length); - byte[] tags = ReadSectorsTag(sectorAddress, length, SectorTagType.AppleSectorTag); - byte[] buffer = new byte[data.Length + tags.Length]; - - for(uint i = 0; i < length; i++) - { - Array.Copy(data, i * (ImageInfo.sectorSize), buffer, i * (ImageInfo.sectorSize + tagSectorSize), ImageInfo.sectorSize); - Array.Copy(tags, i * (tagSectorSize), buffer, i * (ImageInfo.sectorSize + tagSectorSize) + ImageInfo.sectorSize, tagSectorSize); - } - - return buffer; - } - - public override bool ImageHasPartitions() - { - return false; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override string GetImageFormat() - { - return "Apple Disk Archival/Retrieval Tool"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetMediaManufacturer() - { - return null; - } - - public override string GetMediaModel() - { - return null; - } - - public override string GetMediaSerialNumber() - { - return null; - } - - public override string GetMediaBarcode() - { - return null; - } - - public override string GetMediaPartNumber() - { - return null; - } - - public override int GetMediaSequence() - { - return 0; - } - - public override int GetLastDiskSequence() - { - return 0; - } - - public override string GetDriveManufacturer() - { - return null; - } - - public override string GetDriveModel() - { - return null; - } - - public override string GetDriveSerialNumber() - { - return null; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifyMediaImage() - { - return null; - } - - #endregion - } + public class DART : ImagePlugin + { + #region Internal constants + // Disk types + const byte kMacDisk = 1; + const byte kLisaDisk = 2; + const byte kAppleIIDisk = 3; + const byte kMacHiDDisk = 16; + const byte kMSDOSLowDDisk = 17; + const byte kMSDOSHiDDisk = 18; + + // Compression types + // "fast" + const byte kRLECompress = 0; + // "best" + const byte kLZHCompress = 1; + // DART <= 1.4 + const byte kNoCompress = 2; + + // Valid sizes + const short kLisa400KSize = 400; + const short kMac400KSize = 400; + const short kMac800KSize = 800; + const short kMac1440KSize = 1440; + const short kApple800KSize = 800; + const short kMSDOS720KSize = 720; + const short kMSDOS1440KSize = 1440; + + // bLength array sizes + const int blockArrayLenLow = 40; + const int blockArrayLenHigh = 72; + + const int sectorsPerBlock = 40; + const int sectorSize = 512; + const int tagSectorSize = 12; + const int dataSize = sectorsPerBlock * sectorSize; + const int tagSize = sectorsPerBlock * tagSectorSize; + const int bufferSize = (sectorsPerBlock * sectorSize) + (sectorsPerBlock * tagSectorSize); + #endregion + + #region Internal Structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct DART_Header + { + public byte srcCmp; + public byte srcType; + public short srcSize; + } + #endregion + + // DART images are at most 1474560 bytes, so let's cache the whole + byte[] dataCache; + byte[] tagCache; + uint dataChecksum; + uint tagChecksum; + + public DART() + { + Name = "Apple Disk Archival/Retrieval Tool"; + PluginUUID = new Guid("B3E06BF8-F98D-4F9B-BBE2-342C373BAF3E"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = false; + ImageInfo.imageHasSessions = false; + ImageInfo.imageVersion = null; + ImageInfo.imageApplication = null; + ImageInfo.imageApplicationVersion = null; + ImageInfo.imageCreator = null; + ImageInfo.imageComments = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaSerialNumber = null; + ImageInfo.mediaBarcode = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + + if(stream.Length < 84) return false; + + DART_Header header = new DART_Header(); + stream.Seek(0, SeekOrigin.Begin); + byte[] header_b = new byte[Marshal.SizeOf(header)]; + + stream.Read(header_b, 0, Marshal.SizeOf(header)); + header = BigEndianMarshal.ByteArrayToStructureBigEndian<DART_Header>(header_b); + + if(header.srcCmp > kNoCompress) return false; + + int expectedMaxSize = 84 + (header.srcSize * 2 * 524); + + switch(header.srcType) + { + case kMacDisk: + if(header.srcSize != kMac400KSize && header.srcSize != kMac800KSize) return false; + + break; + case kLisaDisk: + if(header.srcSize != kLisa400KSize) return false; + + break; + case kAppleIIDisk: + if(header.srcSize != kApple800KSize) return false; + + break; + case kMacHiDDisk: + if(header.srcSize != kMac1440KSize) return false; + + expectedMaxSize += 64; + break; + case kMSDOSLowDDisk: + if(header.srcSize != kMSDOS720KSize) return false; + + break; + case kMSDOSHiDDisk: + if(header.srcSize != kMSDOS1440KSize) return false; + + expectedMaxSize += 64; + break; + default: return false; + } + + if(stream.Length > expectedMaxSize) return false; + + return true; + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + + if(stream.Length < 84) return false; + + DART_Header header = new DART_Header(); + stream.Seek(0, SeekOrigin.Begin); + byte[] header_b = new byte[Marshal.SizeOf(header)]; + + stream.Read(header_b, 0, Marshal.SizeOf(header)); + header = BigEndianMarshal.ByteArrayToStructureBigEndian<DART_Header>(header_b); + + if(header.srcCmp > kNoCompress) return false; + + int expectedMaxSize = 84 + (header.srcSize * 2 * 524); + + switch(header.srcType) + { + case kMacDisk: + if(header.srcSize != kMac400KSize && header.srcSize != kMac800KSize) return false; + + break; + case kLisaDisk: + if(header.srcSize != kLisa400KSize) return false; + + break; + case kAppleIIDisk: + if(header.srcSize != kAppleIIDisk) return false; + + break; + case kMacHiDDisk: + if(header.srcSize != kMac1440KSize) return false; + + expectedMaxSize += 64; + break; + case kMSDOSLowDDisk: + if(header.srcSize != kMSDOS720KSize) return false; + + break; + case kMSDOSHiDDisk: + if(header.srcSize != kMSDOS1440KSize) return false; + + expectedMaxSize += 64; + break; + default: return false; + } + + if(stream.Length > expectedMaxSize) return false; + + short[] bLength; + + if(header.srcType == kMacHiDDisk || header.srcType == kMSDOSHiDDisk) bLength = new short[blockArrayLenHigh]; + else bLength = new short[blockArrayLenLow]; + + byte[] tmpShort; + for(int i = 0; i < bLength.Length; i++) + { + tmpShort = new byte[2]; + stream.Read(tmpShort, 0, 2); + bLength[i] = BigEndianBitConverter.ToInt16(tmpShort, 0); + } + + byte[] temp; + byte[] buffer; + + MemoryStream dataMs = new MemoryStream(); + MemoryStream tagMs = new MemoryStream(); + + for(int i = 0; i < bLength.Length; i++) + { + if(bLength[i] != 0) + { + buffer = new byte[bufferSize]; + if(bLength[i] == -1) + { + stream.Read(buffer, 0, bufferSize); + dataMs.Write(buffer, 0, dataSize); + tagMs.Write(buffer, dataSize, tagSize); + } + else if(header.srcCmp == kRLECompress) + { + temp = new byte[bLength[i] * 2]; + stream.Read(temp, 0, temp.Length); + throw new ImageNotSupportedException("Compressed images not yet supported"); + } + else + { + temp = new byte[bLength[i]]; + stream.Read(temp, 0, temp.Length); + throw new ImageNotSupportedException("Compressed images not yet supported"); + } + } + } + + dataCache = dataMs.ToArray(); + if(header.srcType == kLisaDisk || header.srcType == kMacDisk || header.srcType == kAppleIIDisk) + { + ImageInfo.readableSectorTags.Add(SectorTagType.AppleSectorTag); + tagCache = tagMs.ToArray(); + } + + try + { + if(imageFilter.HasResourceFork()) + { + ResourceFork rsrcFork = new ResourceFork(imageFilter.GetResourceForkStream()); + // "vers" + if(rsrcFork.ContainsKey(0x76657273)) + { + Resource versRsrc = rsrcFork.GetResource(0x76657273); + if(versRsrc != null) + { + byte[] vers = versRsrc.GetResource(versRsrc.GetIds()[0]); + + if(vers != null) + { + Resources.Version version = new Resources.Version(vers); + + string major; + string minor; + string release = null; + string dev = null; + string pre = null; + + major = string.Format("{0}", version.MajorVersion); + minor = string.Format(".{0}", version.MinorVersion / 10); + if(version.MinorVersion % 10 > 0) + release = string.Format(".{0}", version.MinorVersion % 10); + switch(version.DevStage) + { + case Resources.Version.DevelopmentStage.Alpha: + dev = "a"; + break; + case Resources.Version.DevelopmentStage.Beta: + dev = "b"; + break; + case Resources.Version.DevelopmentStage.PreAlpha: + dev = "d"; + break; + } + + if(dev == null && version.PreReleaseVersion > 0) dev = "f"; + + if(dev != null) pre = string.Format("{0}", version.PreReleaseVersion); + + ImageInfo.imageApplicationVersion = + string.Format("{0}{1}{2}{3}{4}", major, minor, release, dev, pre); + ImageInfo.imageApplication = version.VersionString; + ImageInfo.imageComments = version.VersionMessage; + } + } + } + + // "dart" + if(rsrcFork.ContainsKey(0x44415254)) + { + Resource dartRsrc = rsrcFork.GetResource(0x44415254); + if(dartRsrc != null) + { + string dArt = StringHandlers.PascalToString(dartRsrc.GetResource(dartRsrc.GetIds()[0]), + Encoding.GetEncoding("macintosh")); + string dArtRegEx = + "(?<version>\\S+), tag checksum=\\$(?<tagchk>[0123456789ABCDEF]{8}), data checksum=\\$(?<datachk>[0123456789ABCDEF]{8})$"; + Regex dArtEx = new Regex(dArtRegEx); + Match dArtMatch = dArtEx.Match(dArt); + + if(dArtMatch.Success) + { + ImageInfo.imageApplication = "DART"; + ImageInfo.imageApplicationVersion = dArtMatch.Groups["version"].Value; + dataChecksum = Convert.ToUInt32(dArtMatch.Groups["datachk"].Value, 16); + tagChecksum = Convert.ToUInt32(dArtMatch.Groups["tagchk"].Value, 16); + } + } + } + + // "cksm" + if(rsrcFork.ContainsKey(0x434B534D)) + { + Resource cksmRsrc = rsrcFork.GetResource(0x434B534D); + if(cksmRsrc != null) + { + if(cksmRsrc.ContainsId(1)) + { + byte[] tagChk = cksmRsrc.GetResource(1); + tagChecksum = BigEndianBitConverter.ToUInt32(tagChk, 0); + } + if(cksmRsrc.ContainsId(2)) + { + byte[] dataChk = cksmRsrc.GetResource(1); + dataChecksum = BigEndianBitConverter.ToUInt32(dataChk, 0); + } + } + } + } + } + catch(InvalidCastException) { } + + DicConsole.DebugWriteLine("DART plugin", "Image application = {0} version {1}", ImageInfo.imageApplication, + ImageInfo.imageApplicationVersion); + + ImageInfo.sectors = (ulong)(header.srcSize * 2); + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.sectorSize = sectorSize; + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.imageSize = ImageInfo.sectors * sectorSize; + if(header.srcCmp == kNoCompress) ImageInfo.imageVersion = "1.4"; + else ImageInfo.imageVersion = "1.5"; + + switch(header.srcSize) + { + case kMac400KSize: + ImageInfo.cylinders = 80; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 10; + ImageInfo.mediaType = MediaType.AppleSonySS; + break; + case kMac800KSize: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 10; + ImageInfo.mediaType = MediaType.AppleSonyDS; + break; + case kMSDOS720KSize: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 9; + ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; + break; + case kMac1440KSize: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 18; + ImageInfo.mediaType = MediaType.DOS_35_HD; + break; + } + + return true; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + return ReadSectorsTag(sectorAddress, 1, tag); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] buffer = new byte[length * ImageInfo.sectorSize]; + + Array.Copy(dataCache, (int)sectorAddress * ImageInfo.sectorSize, buffer, 0, length * ImageInfo.sectorSize); + + return buffer; + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + if(tag != SectorTagType.AppleSectorTag) + throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); + + if(tagCache == null || tagCache.Length == 0) + throw new FeatureNotPresentImageException("Disk image does not have tags"); + + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] buffer = new byte[length * tagSectorSize]; + + Array.Copy(tagCache, (int)sectorAddress * tagSectorSize, buffer, 0, length * tagSectorSize); + + return buffer; + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + return ReadSectorsLong(sectorAddress, 1); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] data = ReadSectors(sectorAddress, length); + byte[] tags = ReadSectorsTag(sectorAddress, length, SectorTagType.AppleSectorTag); + byte[] buffer = new byte[data.Length + tags.Length]; + + for(uint i = 0; i < length; i++) + { + Array.Copy(data, i * (ImageInfo.sectorSize), buffer, i * (ImageInfo.sectorSize + tagSectorSize), + ImageInfo.sectorSize); + Array.Copy(tags, i * (tagSectorSize), buffer, + i * (ImageInfo.sectorSize + tagSectorSize) + ImageInfo.sectorSize, tagSectorSize); + } + + return buffer; + } + + public override bool ImageHasPartitions() + { + return false; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override string GetImageFormat() + { + return "Apple Disk Archival/Retrieval Tool"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetMediaManufacturer() + { + return null; + } + + public override string GetMediaModel() + { + return null; + } + + public override string GetMediaSerialNumber() + { + return null; + } + + public override string GetMediaBarcode() + { + return null; + } + + public override string GetMediaPartNumber() + { + return null; + } + + public override int GetMediaSequence() + { + return 0; + } + + public override int GetLastDiskSequence() + { + return 0; + } + + public override string GetDriveManufacturer() + { + return null; + } + + public override string GetDriveModel() + { + return null; + } + + public override string GetDriveSerialNumber() + { + return null; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifyMediaImage() + { + return null; + } + #endregion + } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/DIM.cs b/DiscImageChef.DiscImages/DIM.cs index 0ecd87f2..ef0a3838 100644 --- a/DiscImageChef.DiscImages/DIM.cs +++ b/DiscImageChef.DiscImages/DIM.cs @@ -41,7 +41,7 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class DIM : ImagePlugin + public class DIM : ImagePlugin { #region Internal enumerations enum DiskType : byte @@ -56,12 +56,10 @@ namespace DiscImageChef.ImagePlugins #endregion #region Internal constants - readonly byte[] HeaderID = { 0x44, 0x49, 0x46, 0x43, 0x20, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x20, 0x20 }; + readonly byte[] HeaderID = {0x44, 0x49, 0x46, 0x43, 0x20, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x20, 0x20}; #endregion - #region Internal variables - /// <summary>Start of data sectors in disk image, should be 0x100</summary> const uint dataOffset = 0x100; /// <summary>Disk image file</summary> @@ -103,8 +101,7 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < dataOffset) - return false; + if(stream.Length < dataOffset) return false; comment = new byte[60]; hdrId = new byte[13]; @@ -123,8 +120,7 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < dataOffset) - return false; + if(stream.Length < dataOffset) return false; long diskSize = stream.Length - dataOffset; @@ -137,8 +133,7 @@ namespace DiscImageChef.ImagePlugins stream.Seek(0xC2, SeekOrigin.Begin); stream.Read(comment, 0, 60); - if(!HeaderID.SequenceEqual(hdrId)) - return false; + if(!HeaderID.SequenceEqual(hdrId)) return false; ImageInfo.mediaType = MediaType.Unknown; @@ -151,8 +146,8 @@ namespace DiscImageChef.ImagePlugins DicConsole.ErrorWriteLine("DIM shows unknown image with {0} tracks", diskSize / (2 * 8 * 1024)); return false; } - if(diskSize / (2 * 8 * 1024) == 77) - ImageInfo.mediaType = MediaType.SHARP_525; + + if(diskSize / (2 * 8 * 1024) == 77) ImageInfo.mediaType = MediaType.SHARP_525; ImageInfo.sectorSize = 1024; break; // 9 spt, 1024 bps @@ -162,8 +157,8 @@ namespace DiscImageChef.ImagePlugins DicConsole.ErrorWriteLine("DIM shows unknown image with {0} tracks", diskSize / (2 * 9 * 512)); return false; } - if(diskSize / (2 * 9 * 512) == 80) - ImageInfo.mediaType = MediaType.SHARP_525_9; + + if(diskSize / (2 * 9 * 512) == 80) ImageInfo.mediaType = MediaType.SHARP_525_9; ImageInfo.sectorSize = 512; break; // 15 spt, 512 bps @@ -173,8 +168,8 @@ namespace DiscImageChef.ImagePlugins DicConsole.ErrorWriteLine("DIM shows unknown image with {0} tracks", diskSize / (2 * 15 * 512)); return false; } - if(diskSize / (2 * 15 * 512) == 80) - ImageInfo.mediaType = MediaType.DOS_525_HD; + + if(diskSize / (2 * 15 * 512) == 80) ImageInfo.mediaType = MediaType.DOS_525_HD; ImageInfo.sectorSize = 512; break; // 9 spt, 1024 bps @@ -184,8 +179,8 @@ namespace DiscImageChef.ImagePlugins DicConsole.ErrorWriteLine("DIM shows unknown image with {0} tracks", diskSize / (2 * 9 * 512)); return false; } - if(diskSize / (2 * 9 * 512) == 80) - ImageInfo.mediaType = MediaType.SHARP_35_9; + + if(diskSize / (2 * 9 * 512) == 80) ImageInfo.mediaType = MediaType.SHARP_35_9; ImageInfo.sectorSize = 512; break; // 18 spt, 512 bps @@ -195,22 +190,20 @@ namespace DiscImageChef.ImagePlugins DicConsole.ErrorWriteLine("DIM shows unknown image with {0} tracks", diskSize / (2 * 18 * 512)); return false; } - if(diskSize / (2 * 18 * 512) == 80) - ImageInfo.mediaType = MediaType.DOS_35_HD; + + if(diskSize / (2 * 18 * 512) == 80) ImageInfo.mediaType = MediaType.DOS_35_HD; ImageInfo.sectorSize = 512; break; // 26 spt, 256 bps case DiskType.N88: if(diskSize % (2 * 26 * 256) == 0) { - if(diskSize % (2 * 26 * 256) == 77) - ImageInfo.mediaType = MediaType.NEC_8_DD; + if(diskSize % (2 * 26 * 256) == 77) ImageInfo.mediaType = MediaType.NEC_8_DD; ImageInfo.sectorSize = 256; } else if(diskSize % (2 * 26 * 128) == 0) { - if(diskSize % (2 * 26 * 128) == 77) - ImageInfo.mediaType = MediaType.NEC_8_SD; + if(diskSize % (2 * 26 * 128) == 77) ImageInfo.mediaType = MediaType.NEC_8_SD; ImageInfo.sectorSize = 256; } else @@ -218,15 +211,15 @@ namespace DiscImageChef.ImagePlugins DicConsole.ErrorWriteLine("DIM shows unknown image with {0} tracks", diskSize / (2 * 26 * 256)); return false; } + break; - default: - return false; + default: return false; } DicConsole.VerboseWriteLine("DIM image contains a disk of type {0}", ImageInfo.mediaType); if(!string.IsNullOrEmpty(ImageInfo.imageComments)) DicConsole.VerboseWriteLine("DIM comments: {0}", ImageInfo.imageComments); - + dimImageFilter = imageFilter; ImageInfo.imageSize = (ulong)diskSize; @@ -237,42 +230,42 @@ namespace DiscImageChef.ImagePlugins ImageInfo.imageComments = StringHandlers.CToString(comment, Encoding.GetEncoding(932)); ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - switch(ImageInfo.mediaType) - { - case MediaType.SHARP_525: - ImageInfo.cylinders = 77; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 8; - break; - case MediaType.SHARP_525_9: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 9; - break; - case MediaType.DOS_525_HD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 15; - break; - case MediaType.SHARP_35_9: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 9; - break; - case MediaType.DOS_35_HD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 18; - break; - case MediaType.NEC_8_DD: - case MediaType.NEC_8_SD: - ImageInfo.cylinders = 77; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 26; - break; - } + switch(ImageInfo.mediaType) + { + case MediaType.SHARP_525: + ImageInfo.cylinders = 77; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 8; + break; + case MediaType.SHARP_525_9: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 9; + break; + case MediaType.DOS_525_HD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 15; + break; + case MediaType.SHARP_35_9: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 9; + break; + case MediaType.DOS_35_HD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 18; + break; + case MediaType.NEC_8_DD: + case MediaType.NEC_8_SD: + ImageInfo.cylinders = 77; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 26; + break; + } - return true; + return true; } public override bool ImageHasPartitions() @@ -370,7 +363,6 @@ namespace DiscImageChef.ImagePlugins } #region Unsupported features - public override byte[] ReadDiskTag(MediaTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -511,16 +503,18 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -529,7 +523,6 @@ namespace DiscImageChef.ImagePlugins { return null; } - #endregion } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/DiscFerret.cs b/DiscImageChef.DiscImages/DiscFerret.cs index 6f869380..0cde8b64 100644 --- a/DiscImageChef.DiscImages/DiscFerret.cs +++ b/DiscImageChef.DiscImages/DiscFerret.cs @@ -40,7 +40,7 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class DiscFerret : ImagePlugin + public class DiscFerret : ImagePlugin { #region Internal Structures [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -125,7 +125,7 @@ namespace DiscImageChef.ImagePlugins ushort lastCylinder = 0, lastHead = 0; bool endOfTrack = false; long offset = 0; - + while(stream.Position < stream.Length) { long thisOffset = stream.Position; @@ -136,13 +136,13 @@ namespace DiscImageChef.ImagePlugins blockHeader = BigEndianMarshal.ByteArrayToStructureBigEndian<DfiBlockHeader>(blk); DicConsole.DebugWriteLine("DiscFerret plugin", "block@{0}.cylinder = {1}", thisOffset, - blockHeader.cylinder); + blockHeader.cylinder); DicConsole.DebugWriteLine("DiscFerret plugin", "block@{0}.head = {1}", thisOffset, blockHeader.head); DicConsole.DebugWriteLine("DiscFerret plugin", "block@{0}.sector = {1}", thisOffset, - blockHeader.sector); + blockHeader.sector); DicConsole.DebugWriteLine("DiscFerret plugin", "block@{0}.length = {1}", thisOffset, - blockHeader.length); - + blockHeader.length); + if(stream.Position + blockHeader.length > stream.Length) { DicConsole.DebugWriteLine("DiscFerret plugin", "Invalid track block found at {0}", thisOffset); @@ -150,7 +150,7 @@ namespace DiscImageChef.ImagePlugins } stream.Position += blockHeader.length; - + if(blockHeader.cylinder > 0 && blockHeader.cylinder > lastCylinder) { lastCylinder = blockHeader.cylinder; @@ -169,20 +169,16 @@ namespace DiscImageChef.ImagePlugins t++; } - if(blockHeader.cylinder > ImageInfo.cylinders) - ImageInfo.cylinders = blockHeader.cylinder; - if(blockHeader.head> ImageInfo.heads) - ImageInfo.heads= blockHeader.head; + if(blockHeader.cylinder > ImageInfo.cylinders) ImageInfo.cylinders = blockHeader.cylinder; + if(blockHeader.head > ImageInfo.heads) ImageInfo.heads = blockHeader.head; } ImageInfo.heads++; ImageInfo.cylinders++; ImageInfo.imageApplication = "DiscFerret"; - if(magic == DfiMagic2) - ImageInfo.imageApplicationVersion = "2.0"; - else - ImageInfo.imageApplicationVersion = "1.0"; + if(magic == DfiMagic2) ImageInfo.imageApplicationVersion = "2.0"; + else ImageInfo.imageApplicationVersion = "1.0"; throw new NotImplementedException("Flux decoding is not yet implemented."); } @@ -352,7 +348,8 @@ namespace DiscImageChef.ImagePlugins throw new NotImplementedException("Flux decoding is not yet implemented."); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new NotImplementedException("Flux decoding is not yet implemented."); } @@ -368,6 +365,7 @@ namespace DiscImageChef.ImagePlugins { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -413,7 +411,8 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } diff --git a/DiscImageChef.DiscImages/DiscJuggler.cs b/DiscImageChef.DiscImages/DiscJuggler.cs index fd786b3e..86f61cc7 100644 --- a/DiscImageChef.DiscImages/DiscJuggler.cs +++ b/DiscImageChef.DiscImages/DiscJuggler.cs @@ -41,1336 +41,1325 @@ using DiscImageChef.ImagePlugins; namespace DiscImageChef.DiscImages { - // Support separate data files? Never seen a DiscJuggler image using them anyways... - public class DiscJuggler : ImagePlugin - { - Stream imageStream; - List<Session> sessions; - List<Track> tracks; - byte[] cdtext; - Dictionary<uint, ulong> offsetmap; - List<Partition> partitions; - Dictionary<uint, byte> trackFlags; - - public DiscJuggler() - { - Name = "DiscJuggler"; - PluginUUID = new Guid("2444DBC6-CD35-424C-A227-39B0C4DB01B2"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = true; - ImageInfo.imageHasSessions = true; - ImageInfo.imageVersion = null; - ImageInfo.imageApplicationVersion = null; - ImageInfo.imageName = null; - ImageInfo.imageCreator = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - public override bool IdentifyImage(Filter imageFilter) - { - imageStream = imageFilter.GetDataForkStream(); - - imageStream.Seek(-4, SeekOrigin.End); - byte[] dscLen_b = new byte[4]; - imageStream.Read(dscLen_b, 0, 4); - int dscLen = BitConverter.ToInt32(dscLen_b, 0); - - DicConsole.DebugWriteLine("DiscJuggler plugin", "dscLen = {0}", dscLen); - - if(dscLen >= imageStream.Length) - return false; - - byte[] descriptor = new byte[dscLen]; - imageStream.Seek(-dscLen, SeekOrigin.End); - imageStream.Read(descriptor, 0, dscLen); - - // Sessions - if(descriptor[0] > 99 || descriptor[0] == 0) - return false; - - // Seems all sessions start with this data - if(descriptor[1] != 0x00 || descriptor[3] != 0x00 || descriptor[4] != 0x00 || - descriptor[5] != 0x00 || descriptor[6] != 0x00 || descriptor[7] != 0x00 || - descriptor[8] != 0x00 || descriptor[9] != 0x00 || descriptor[10] != 0x01 || - descriptor[11] != 0x00 || descriptor[12] != 0x00 || descriptor[13] != 0x00 || - descriptor[14] != 0xFF || descriptor[15] != 0xFF) - return false; - - // Too many tracks - if(descriptor[2] > 99) - return false; - - return true; - } - - public override bool OpenImage(Filter imageFilter) - { - imageStream = imageFilter.GetDataForkStream(); - - imageStream.Seek(-4, SeekOrigin.End); - byte[] dscLen_b = new byte[4]; - imageStream.Read(dscLen_b, 0, 4); - int dscLen = BitConverter.ToInt32(dscLen_b, 0); - - if(dscLen >= imageStream.Length) - return false; - - byte[] descriptor = new byte[dscLen]; - imageStream.Seek(-dscLen, SeekOrigin.End); - imageStream.Read(descriptor, 0, dscLen); - - // Sessions - if(descriptor[0] > 99 || descriptor[0] == 0) - return false; - - int position = 1; - - ushort sessionSequence = 0; - sessions = new List<Session>(); - tracks = new List<Track>(); - partitions = new List<Partition>(); - offsetmap = new Dictionary<uint, ulong>(); - trackFlags = new Dictionary<uint, byte>(); - ushort mediumType; - byte maxS = descriptor[0]; - - DicConsole.DebugWriteLine("DiscJuggler plugin", "maxS = {0}", maxS); - uint lastSessionTrack = 0; - ulong currentOffset = 0; - - // Read sessions - for(byte s = 0; s <= maxS; s++) - { - DicConsole.DebugWriteLine("DiscJuggler plugin", "s = {0}", s); - - // Seems all sessions start with this data - if(descriptor[position + 0] != 0x00 || descriptor[position + 2] != 0x00 || descriptor[position + 3] != 0x00 || - descriptor[position + 4] != 0x00 || descriptor[position + 5] != 0x00 || descriptor[position + 6] != 0x00 || - descriptor[position + 7] != 0x00 || descriptor[position + 8] != 0x00 || descriptor[position + 9] != 0x01 || - descriptor[position + 10] != 0x00 || descriptor[position + 11] != 0x00 || descriptor[position + 12] != 0x00 || - descriptor[position + 13] != 0xFF || descriptor[position + 14] != 0xFF) - return false; - - // Too many tracks - if(descriptor[position + 1] > 99) - return false; - - byte maxT = descriptor[position + 1]; - DicConsole.DebugWriteLine("DiscJuggler plugin", "maxT = {0}", maxT); - - sessionSequence++; - Session session = new Session(); - session.SessionSequence = sessionSequence; - session.EndTrack = uint.MinValue; - session.StartTrack = uint.MaxValue; - - position += 15; - bool addedATrack = false; - - // Read track - for(byte t = 0; t < maxT; t++) - { - addedATrack = false; - DicConsole.DebugWriteLine("DiscJuggler plugin", "t = {0}", t); - Track track = new Track(); - - // Skip unknown - position += 16; - - byte[] trackFilename_b = new byte[descriptor[position]]; - position++; - Array.Copy(descriptor, position, trackFilename_b, 0, trackFilename_b.Length); - position += trackFilename_b.Length; - track.TrackFile = Path.GetFileName(Encoding.Default.GetString(trackFilename_b)); - DicConsole.DebugWriteLine("DiscJuggler plugin", "\tfilename = {0}", track.TrackFile); - - // Skip unknown - position += 29; - - mediumType = BitConverter.ToUInt16(descriptor, position); - position += 2; - DicConsole.DebugWriteLine("DiscJuggler plugin", "\tmediumType = {0}", mediumType); - - // Read indices - track.Indexes = new Dictionary<int, ulong>(); - ushort maxI = BitConverter.ToUInt16(descriptor, position); - position += 2; - DicConsole.DebugWriteLine("DiscJuggler plugin", "\tmaxI = {0}", maxI); - for(ushort i = 0; i < maxI; i++) - { - uint index = BitConverter.ToUInt32(descriptor, position); - track.Indexes.Add(i, index); - position += 4; - DicConsole.DebugWriteLine("DiscJuggler plugin", "\tindex[{1}] = {0}", index, i); - } - - // Read CD-Text - uint maxC = BitConverter.ToUInt32(descriptor, position); - position += 4; - DicConsole.DebugWriteLine("DiscJuggler plugin", "\tmaxC = {0}", maxC); - for(uint c = 0; c < maxC; c++) - { - for(int cb = 0; cb < 18; cb++) - { - int bLen = descriptor[position]; - position++; - DicConsole.DebugWriteLine("DiscJuggler plugin", "\tc[{1}][{2}].Length = {0}", bLen, c, cb); - if(bLen > 0) - { - byte[] textBlk = new byte[bLen]; - Array.Copy(descriptor, position, textBlk, 0, bLen); - position += bLen; - // Track title - if(cb == 10) - { - track.TrackDescription = Encoding.Default.GetString(textBlk, 0, bLen); - DicConsole.DebugWriteLine("DiscJuggler plugin", "\tTrack title = {0}", track.TrackDescription); - } - } - } - } - - position += 2; - uint trackMode = BitConverter.ToUInt32(descriptor, position); - DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackMode = {0}", trackMode); - position += 4; - - // Skip unknown - position += 4; - - session.SessionSequence = (ushort)(BitConverter.ToUInt32(descriptor, position) + 1); - track.TrackSession = (ushort)(session.SessionSequence + 1); - DicConsole.DebugWriteLine("DiscJuggler plugin", "\tsession = {0}", session.SessionSequence); - position += 4; - track.TrackSequence = BitConverter.ToUInt32(descriptor, position) + lastSessionTrack + 1; - DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrack = {1} + {2} + 1 = {0}", track.TrackSequence, BitConverter.ToUInt32(descriptor, position), lastSessionTrack); - position += 4; - track.TrackStartSector = BitConverter.ToUInt32(descriptor, position); - DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackStart = {0}", track.TrackStartSector); - position += 4; - uint trackLen = BitConverter.ToUInt32(descriptor, position); - track.TrackEndSector = track.TrackStartSector + trackLen - 1; - DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackEnd = {0}", track.TrackEndSector); - position += 4; - - if(track.TrackSequence > session.EndTrack) - { - session.EndTrack = track.TrackSequence; - session.EndSector = track.TrackEndSector; - } - if(track.TrackSequence < session.StartTrack) - { - session.StartTrack = track.TrackSequence; - session.StartSector = track.TrackStartSector; - } - - // Skip unknown - position += 16; - - uint readMode = BitConverter.ToUInt32(descriptor, position); - DicConsole.DebugWriteLine("DiscJuggler plugin", "\treadMode = {0}", readMode); - position += 4; - uint trackCtl = BitConverter.ToUInt32(descriptor, position); - DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackCtl = {0}", trackCtl); - position += 4; - - // Skip unknown - position += 9; - - byte[] isrc = new byte[12]; - Array.Copy(descriptor, position, isrc, 0, 12); - DicConsole.DebugWriteLine("DiscJuggler plugin", "\tisrc = {0}", StringHandlers.CToString(isrc)); - position += 12; - uint isrc_valid = BitConverter.ToUInt32(descriptor, position); - DicConsole.DebugWriteLine("DiscJuggler plugin", "\tisrc_valid = {0}", isrc_valid); - position += 4; - - // Skip unknown - position += 87; - - byte sessionType = descriptor[position]; - DicConsole.DebugWriteLine("DiscJuggler plugin", "\tsessionType = {0}", sessionType); - position++; - - // Skip unknown - position += 5; - - byte trackFollows = descriptor[position]; - DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackFollows = {0}", trackFollows); - position += 2; - - uint endAddress = BitConverter.ToUInt32(descriptor, position); - DicConsole.DebugWriteLine("DiscJuggler plugin", "\tendAddress = {0}", endAddress); - position += 4; - - // As to skip the lead-in - bool firstTrack = currentOffset == 0; - - track.TrackSubchannelType = TrackSubchannelType.None; - - switch(trackMode) - { - // Audio - case 0: - if(ImageInfo.sectorSize < 2352) - ImageInfo.sectorSize = 2352; - track.TrackType = TrackType.Audio; - track.TrackBytesPerSector = 2352; - track.TrackRawBytesPerSector = 2352; - switch(readMode) - { - case 2: - if(firstTrack) - currentOffset += 150 * (ulong)track.TrackRawBytesPerSector; - track.TrackFileOffset = currentOffset; - currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; - break; - case 3: - if(firstTrack) - currentOffset += 150 * (ulong)(track.TrackRawBytesPerSector + 16); - track.TrackFileOffset = currentOffset; - track.TrackSubchannelFile = track.TrackFile; - track.TrackSubchannelOffset = currentOffset; - track.TrackSubchannelType = TrackSubchannelType.Q16Interleaved; - currentOffset += trackLen * (ulong)(track.TrackRawBytesPerSector + 16); - break; - case 4: - if(firstTrack) - currentOffset += 150 * (ulong)(track.TrackRawBytesPerSector + 96); - track.TrackFileOffset = currentOffset; - track.TrackSubchannelFile = track.TrackFile; - track.TrackSubchannelOffset = currentOffset; - track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; - currentOffset += trackLen * (ulong)(track.TrackRawBytesPerSector + 96); - break; - default: - throw new ImageNotSupportedException(string.Format("Unknown read mode {0}", readMode)); - } - break; - // Mode 1 or DVD - case 1: - if(ImageInfo.sectorSize < 2048) - ImageInfo.sectorSize = 2048; - track.TrackType = TrackType.CDMode1; - track.TrackBytesPerSector = 2048; - switch(readMode) - { - case 0: - track.TrackRawBytesPerSector = 2048; - if(firstTrack) - currentOffset += 150 * (ulong)track.TrackRawBytesPerSector; - track.TrackFileOffset = currentOffset; - currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; - break; - case 1: - throw new ImageNotSupportedException(string.Format("Invalid read mode {0} for this track", readMode)); - case 2: - track.TrackRawBytesPerSector = 2352; - currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - break; - case 3: - track.TrackRawBytesPerSector = 2352; - if(firstTrack) - currentOffset += 150 * (ulong)(track.TrackRawBytesPerSector + 16); - track.TrackFileOffset = currentOffset; - track.TrackSubchannelFile = track.TrackFile; - track.TrackSubchannelOffset = currentOffset; - track.TrackSubchannelType = TrackSubchannelType.Q16Interleaved; - currentOffset += trackLen * (ulong)(track.TrackRawBytesPerSector + 16); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - break; - case 4: - track.TrackRawBytesPerSector = 2352; - if(firstTrack) - currentOffset += 150 * (ulong)(track.TrackRawBytesPerSector + 96); - track.TrackFileOffset = currentOffset; - track.TrackSubchannelFile = track.TrackFile; - track.TrackSubchannelOffset = currentOffset; - track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; - currentOffset += trackLen * (ulong)(track.TrackRawBytesPerSector + 96); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); - break; - default: - throw new ImageNotSupportedException(string.Format("Unknown read mode {0}", readMode)); - } - break; - // Mode 2 - case 2: - if(ImageInfo.sectorSize < 2336) - ImageInfo.sectorSize = 2336; - track.TrackType = TrackType.CDMode2Formless; - track.TrackBytesPerSector = 2336; - switch(readMode) - { - case 0: - throw new ImageNotSupportedException(string.Format("Invalid read mode {0} for this track", readMode)); - case 1: - track.TrackRawBytesPerSector = 2336; - if(firstTrack) - currentOffset += 150 * (ulong)track.TrackRawBytesPerSector; - track.TrackFileOffset = currentOffset; - currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; - break; - case 2: - track.TrackRawBytesPerSector = 2352; - currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - break; - case 3: - track.TrackRawBytesPerSector = 2352; - if(firstTrack) - currentOffset += 150 * (ulong)(track.TrackRawBytesPerSector + 16); - track.TrackFileOffset = currentOffset; - track.TrackSubchannelFile = track.TrackFile; - track.TrackSubchannelOffset = currentOffset; - track.TrackSubchannelType = TrackSubchannelType.Q16Interleaved; - currentOffset += trackLen * (ulong)(track.TrackRawBytesPerSector + 16); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - break; - case 4: - track.TrackRawBytesPerSector = 2352; - if(firstTrack) - currentOffset += 150 * (ulong)(track.TrackRawBytesPerSector + 96); - track.TrackFileOffset = currentOffset; - track.TrackSubchannelFile = track.TrackFile; - track.TrackSubchannelOffset = currentOffset; - track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; - currentOffset += trackLen * (ulong)(track.TrackRawBytesPerSector + 96); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - break; - default: - throw new ImageNotSupportedException(string.Format("Unknown read mode {0}", readMode)); - } - break; - default: - throw new ImageNotSupportedException(string.Format("Unknown track mode {0}", trackMode)); - } - - track.TrackFile = imageFilter.GetFilename(); - track.TrackFilter = imageFilter; - if(track.TrackSubchannelType != TrackSubchannelType.None) - { - track.TrackSubchannelFile = imageFilter.GetFilename(); - track.TrackSubchannelFilter = imageFilter; - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubchannel); - } - - Partition partition = new Partition(); - partition.Description = track.TrackDescription; - partition.Size = (ulong)(trackLen * track.TrackBytesPerSector); - partition.Length = trackLen; - ImageInfo.sectors += partition.Length; - partition.Sequence = track.TrackSequence; - partition.Offset = track.TrackFileOffset; - partition.Start = track.TrackStartSector; - partition.Type = track.TrackType.ToString(); - partitions.Add(partition); - offsetmap.Add(track.TrackSequence, track.TrackStartSector); - tracks.Add(track); - trackFlags.Add(track.TrackSequence, (byte)(trackCtl & 0xFF)); - addedATrack = true; - } - - if(addedATrack) - { - lastSessionTrack = session.EndTrack; - sessions.Add(session); - DicConsole.DebugWriteLine("DiscJuggler plugin", "session.StartTrack = {0}", session.StartTrack); - DicConsole.DebugWriteLine("DiscJuggler plugin", "session.StartSector = {0}", session.StartSector); - DicConsole.DebugWriteLine("DiscJuggler plugin", "session.EndTrack = {0}", session.EndTrack); - DicConsole.DebugWriteLine("DiscJuggler plugin", "session.EndSector = {0}", session.EndSector); - DicConsole.DebugWriteLine("DiscJuggler plugin", "session.SessionSequence = {0}", session.SessionSequence); - } - } - - // Skip unknown - position += 16; - - DicConsole.DebugWriteLine("DiscJuggler plugin", "Current position = {0}", position); - byte[] filename_b = new byte[descriptor[position]]; - position++; - Array.Copy(descriptor, position, filename_b, 0, filename_b.Length); - position += filename_b.Length; - string filename = Path.GetFileName(Encoding.Default.GetString(filename_b)); - DicConsole.DebugWriteLine("DiscJuggler plugin", "filename = {0}", filename); - - // Skip unknown - position += 29; - - mediumType = BitConverter.ToUInt16(descriptor, position); - position += 2; - DicConsole.DebugWriteLine("DiscJuggler plugin", "mediumType = {0}", mediumType); - - uint discSize = BitConverter.ToUInt32(descriptor, position); - position += 4; - DicConsole.DebugWriteLine("DiscJuggler plugin", "discSize = {0}", discSize); - - byte[] volid_b = new byte[descriptor[position]]; - position++; - Array.Copy(descriptor, position, volid_b, 0, volid_b.Length); - position += volid_b.Length; - string volid = Path.GetFileName(Encoding.Default.GetString(volid_b)); - DicConsole.DebugWriteLine("DiscJuggler plugin", "volid = {0}", volid); - - // Skip unknown - position += 9; - - byte[] mcn = new byte[13]; - Array.Copy(descriptor, position, mcn, 0, 13); - DicConsole.DebugWriteLine("DiscJuggler plugin", "mcn = {0}", StringHandlers.CToString(mcn)); - position += 13; - uint mcn_valid = BitConverter.ToUInt32(descriptor, position); - DicConsole.DebugWriteLine("DiscJuggler plugin", "mcn_valid = {0}", mcn_valid); - position += 4; - - uint cdtextLen = BitConverter.ToUInt32(descriptor, position); - DicConsole.DebugWriteLine("DiscJuggler plugin", "cdtextLen = {0}", cdtextLen); - position += 4; - if(cdtextLen > 0) - { - cdtext = new byte[cdtextLen]; - Array.Copy(descriptor, position, cdtext, 0, cdtextLen); - position += (int)cdtextLen; - ImageInfo.readableMediaTags.Add(MediaTagType.CD_TEXT); - } - - // Skip unknown - position += 12; - - DicConsole.DebugWriteLine("DiscJuggler plugin", "End position = {0}", position); - - if(ImageInfo.mediaType == MediaType.CDROM) - { - bool data = false; - bool mode2 = false; - bool firstaudio = false; - bool firstdata = false; - bool audio = false; - - for(int i = 0; i < tracks.Count; i++) - { - // First track is audio - firstaudio |= i == 0 && tracks[i].TrackType == TrackType.Audio; - - // First track is data - firstdata |= i == 0 && tracks[i].TrackType != TrackType.Audio; - - // Any non first track is data - data |= i != 0 && tracks[i].TrackType != TrackType.Audio; - - // Any non first track is audio - audio |= i != 0 && tracks[i].TrackType == TrackType.Audio; - - switch(tracks[i].TrackType) - { - case TrackType.CDMode2Form1: - case TrackType.CDMode2Form2: - case TrackType.CDMode2Formless: - mode2 = true; - break; - } - } - - if(!data && !firstdata) - ImageInfo.mediaType = MediaType.CDDA; - else if(firstaudio && data && sessions.Count > 1 && mode2) - ImageInfo.mediaType = MediaType.CDPLUS; - else if((firstdata && audio) || mode2) - ImageInfo.mediaType = MediaType.CDROMXA; - else if(!audio) - ImageInfo.mediaType = MediaType.CDROM; - else - ImageInfo.mediaType = MediaType.CD; - } - - ImageInfo.imageApplication = "DiscJuggler"; - ImageInfo.imageSize = (ulong)imageFilter.GetDataForkLength(); - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.xmlMediaType = XmlMediaType.OpticalDisc; - - return true; - } - - static MediaType DecodeCDIMediumType(ushort type) - { - switch(type) - { - case 56: - return MediaType.DVDROM; - case 152: - return MediaType.CDROM; - default: - return MediaType.Unknown; - } - } - - public override bool ImageHasPartitions() - { - return ImageInfo.imageHasPartitions; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override byte[] ReadDiskTag(MediaTagType tag) - { - switch(tag) - { - case MediaTagType.CD_TEXT: - { - if(cdtext != null && cdtext.Length > 0) - return cdtext; - throw new FeatureNotPresentImageException("Image does not contain CD-TEXT information."); - } - default: - throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format"); - } - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - return ReadSectorsTag(sectorAddress, 1, tag); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - return ReadSectors(sectorAddress, 1, track); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - return ReadSectorsTag(sectorAddress, 1, track, tag); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - foreach(KeyValuePair<uint, ulong> kvp in offsetmap) - { - if(sectorAddress >= kvp.Value) - { - foreach(Track _track in tracks) - { - if(_track.TrackSequence == kvp.Key) - { - if(sectorAddress < _track.TrackEndSector) - return ReadSectors((sectorAddress - kvp.Value), length, kvp.Key); - } - } - } - } - - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - foreach(KeyValuePair<uint, ulong> kvp in offsetmap) - { - if(sectorAddress >= kvp.Value) - { - foreach(Track _track in tracks) - { - if(_track.TrackSequence == kvp.Key) - { - if(sectorAddress < _track.TrackEndSector) - return ReadSectorsTag((sectorAddress - kvp.Value), length, kvp.Key, tag); - } - } - } - } - - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - Track _track = new Track(); - - _track.TrackSequence = 0; - - foreach(Track __track in tracks) - { - if(__track.TrackSequence == track) - { - _track = __track; - break; - } - } - - if(_track.TrackSequence == 0) - throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); - - if(length + sectorAddress > (_track.TrackEndSector)) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length + sectorAddress, _track.TrackEndSector)); - - uint sector_offset; - uint sector_size; - uint sector_skip; - - switch(_track.TrackType) - { - case TrackType.Audio: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 0; - break; - } - case TrackType.CDMode1: - if(_track.TrackRawBytesPerSector == 2352) - { - sector_offset = 16; - sector_size = 2048; - sector_skip = 288; - } - else - { - sector_offset = 0; - sector_size = 2048; - sector_skip = 0; - } - break; - case TrackType.CDMode2Formless: - if(_track.TrackRawBytesPerSector == 2352) - { - sector_offset = 16; - sector_size = 2336; - sector_skip = 0; - } - else - { - sector_offset = 0; - sector_size = 2336; - sector_skip = 0; - } - break; - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); - } - - switch(_track.TrackSubchannelType) - { - case TrackSubchannelType.None: - sector_skip += 0; - break; - case TrackSubchannelType.Q16Interleaved: - sector_skip += 16; - break; - case TrackSubchannelType.PackedInterleaved: - sector_skip += 96; - break; - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); - } - - byte[] buffer = new byte[sector_size * length]; - - imageStream.Seek((long)(_track.TrackFileOffset + sectorAddress * (ulong)_track.TrackRawBytesPerSector), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - imageStream.Read(buffer, 0, buffer.Length); - else - { - for(int i = 0; i < length; i++) - { - byte[] sector = new byte[sector_size]; - imageStream.Seek(sector_offset, SeekOrigin.Current); - imageStream.Read(sector, 0, sector.Length); - imageStream.Seek(sector_skip, SeekOrigin.Current); - Array.Copy(sector, 0, buffer, i * sector_size, sector_size); - } - } - - return buffer; - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - Track _track = new Track(); - - _track.TrackSequence = 0; - - foreach(Track __track in tracks) - { - if(__track.TrackSequence == track) - { - _track = __track; - break; - } - } - - if(_track.TrackSequence == 0) - throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); - - if(length + sectorAddress > (_track.TrackEndSector)) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length + sectorAddress, _track.TrackEndSector)); - - if(_track.TrackType == TrackType.Data) - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - - byte[] buffer; - - switch(tag) - { - case SectorTagType.CDSectorECC: - case SectorTagType.CDSectorECC_P: - case SectorTagType.CDSectorECC_Q: - case SectorTagType.CDSectorEDC: - case SectorTagType.CDSectorHeader: - case SectorTagType.CDSectorSubchannel: - case SectorTagType.CDSectorSubHeader: - case SectorTagType.CDSectorSync: - break; - case SectorTagType.CDTrackFlags: - byte flag; - if(trackFlags.TryGetValue(track, out flag)) - return new byte[] { flag }; - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - - uint sector_offset; - uint sector_size; - uint sector_skip; - - switch(_track.TrackType) - { - case TrackType.CDMode1: - if(_track.TrackRawBytesPerSector != 2352) - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - switch(tag) - { - case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } - case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } - case SectorTagType.CDSectorSubHeader: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - sector_skip = 104; - break; - } - case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2064; - sector_size = 4; - sector_skip = 284; - break; - } - case SectorTagType.CDSectorSubchannel: - if(_track.TrackSubchannelType == TrackSubchannelType.None) - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - if(_track.TrackSubchannelType == TrackSubchannelType.Q16Interleaved) - throw new ArgumentException("Q16 subchannel not yet supported"); - - sector_offset = 2352; - sector_size = 96; - sector_skip = 0; - break; - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - break; - case TrackType.CDMode2Formless: - if(_track.TrackRawBytesPerSector != 2352) - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - { - switch(tag) - { - case SectorTagType.CDSectorSync: - case SectorTagType.CDSectorHeader: - case SectorTagType.CDSectorECC: - case SectorTagType.CDSectorECC_P: - case SectorTagType.CDSectorECC_Q: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorSubHeader: - { - sector_offset = 0; - sector_size = 8; - sector_skip = 2328; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2332; - sector_size = 4; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorSubchannel: - if(_track.TrackSubchannelType == TrackSubchannelType.None) - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - if(_track.TrackSubchannelType == TrackSubchannelType.Q16Interleaved) - throw new ArgumentException("Q16 subchannel not yet supported"); - - sector_offset = 2352; - sector_size = 96; - sector_skip = 0; - break; - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - break; - } - case TrackType.Audio: - { - switch(tag) - { - case SectorTagType.CDSectorSubchannel: - if(_track.TrackSubchannelType == TrackSubchannelType.None) - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - if(_track.TrackSubchannelType == TrackSubchannelType.Q16Interleaved) - throw new ArgumentException("Q16 subchannel not yet supported"); - - sector_offset = 2352; - sector_size = 96; - sector_skip = 0; - break; - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); - } - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); - } - - switch(_track.TrackSubchannelType) - { - case TrackSubchannelType.None: - sector_skip += 0; - break; - case TrackSubchannelType.Q16Interleaved: - sector_skip += 16; - break; - case TrackSubchannelType.PackedInterleaved: - sector_skip += 96; - break; - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); - } - - buffer = new byte[sector_size * length]; - - imageStream.Seek((long)(_track.TrackFileOffset + sectorAddress * (ulong)_track.TrackRawBytesPerSector), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - imageStream.Read(buffer, 0, buffer.Length); - else - { - for(int i = 0; i < length; i++) - { - byte[] sector = new byte[sector_size]; - imageStream.Seek(sector_offset, SeekOrigin.Current); - imageStream.Read(sector, 0, sector.Length); - imageStream.Seek(sector_skip, SeekOrigin.Current); - Array.Copy(sector, 0, buffer, i * sector_size, sector_size); - } - } - - return buffer; - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - return ReadSectorsLong(sectorAddress, 1); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - return ReadSectorsLong(sectorAddress, 1, track); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - foreach(KeyValuePair<uint, ulong> kvp in offsetmap) - { - if(sectorAddress >= kvp.Value) - { - foreach(Track track in tracks) - { - if(track.TrackSequence == kvp.Key) - { - if((sectorAddress - kvp.Value) < (track.TrackEndSector - track.TrackStartSector)) - return ReadSectorsLong((sectorAddress - kvp.Value), length, kvp.Key); - } - } - } - } - - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - Track _track = new Track(); - - _track.TrackSequence = 0; - - foreach(Track __track in tracks) - { - if(__track.TrackSequence == track) - { - _track = __track; - break; - } - } - - if(_track.TrackSequence == 0) - throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); - - if(length + sectorAddress > (_track.TrackEndSector)) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length + sectorAddress, _track.TrackEndSector)); - - uint sector_offset = 0; - uint sector_size = (uint)_track.TrackRawBytesPerSector; - uint sector_skip = 0; - - switch(_track.TrackSubchannelType) - { - case TrackSubchannelType.None: - sector_skip += 0; - break; - case TrackSubchannelType.Q16Interleaved: - sector_skip += 16; - break; - case TrackSubchannelType.PackedInterleaved: - sector_skip += 96; - break; - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); - } - - byte[] buffer = new byte[sector_size * length]; - - imageStream.Seek((long)(_track.TrackFileOffset + sectorAddress * (ulong)_track.TrackRawBytesPerSector), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - imageStream.Read(buffer, 0, buffer.Length); - else - { - for(int i = 0; i < length; i++) - { - byte[] sector = new byte[sector_size]; - imageStream.Seek(sector_offset, SeekOrigin.Current); - imageStream.Read(sector, 0, sector.Length); - imageStream.Seek(sector_skip, SeekOrigin.Current); - Array.Copy(sector, 0, buffer, i * sector_size, sector_size); - } - } - - return buffer; - } - - public override string GetImageFormat() - { - return "DiscJuggler"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override string GetMediaManufacturer() - { - return ImageInfo.mediaManufacturer; - } - - public override string GetMediaModel() - { - return ImageInfo.mediaModel; - } - - public override string GetMediaSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - - public override string GetMediaBarcode() - { - return ImageInfo.mediaBarcode; - } - - public override string GetMediaPartNumber() - { - return ImageInfo.mediaPartNumber; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - public override int GetMediaSequence() - { - return ImageInfo.mediaSequence; - } - - public override int GetLastDiskSequence() - { - return ImageInfo.lastMediaSequence; - } - - public override string GetDriveManufacturer() - { - return ImageInfo.driveManufacturer; - } - - public override string GetDriveModel() - { - return ImageInfo.driveModel; - } - - public override string GetDriveSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - - public override List<Partition> GetPartitions() - { - return partitions; - } - - public override List<Track> GetTracks() - { - return tracks; - } - - public override List<Track> GetSessionTracks(Session session) - { - if(sessions.Contains(session)) - { - return GetSessionTracks(session.SessionSequence); - } - throw new ImageNotSupportedException("Session does not exist in disc image"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - List<Track> _tracks = new List<Track>(); - foreach(Track _track in tracks) - { - if(_track.TrackSession == session) - _tracks.Add(_track); - } - - return _tracks; - } - - public override List<Session> GetSessions() - { - return sessions; - } - - public override bool? VerifySector(ulong sectorAddress) - { - byte[] buffer = ReadSectorLong(sectorAddress); - return Checksums.CDChecksums.CheckCDSector(buffer); - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - byte[] buffer = ReadSectorLong(sectorAddress, track); - return Checksums.CDChecksums.CheckCDSector(buffer); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - byte[] buffer = ReadSectorsLong(sectorAddress, length); - int bps = (int)(buffer.Length / length); - byte[] sector = new byte[bps]; - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(int i = 0; i < length; i++) - { - Array.Copy(buffer, i * bps, sector, 0, bps); - bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); - - switch(sectorStatus) - { - case null: - UnknownLBAs.Add((ulong)i + sectorAddress); - break; - case false: - FailingLBAs.Add((ulong)i + sectorAddress); - break; - } - } - - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; - return true; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - byte[] buffer = ReadSectorsLong(sectorAddress, length, track); - int bps = (int)(buffer.Length / length); - byte[] sector = new byte[bps]; - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(int i = 0; i < length; i++) - { - Array.Copy(buffer, i * bps, sector, 0, bps); - bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); - - switch(sectorStatus) - { - case null: - UnknownLBAs.Add((ulong)i + sectorAddress); - break; - case false: - FailingLBAs.Add((ulong)i + sectorAddress); - break; - } - } - - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; - return true; - } - - public override bool? VerifyMediaImage() - { - return null; - } } -} + // Support separate data files? Never seen a DiscJuggler image using them anyways... + public class DiscJuggler : ImagePlugin + { + Stream imageStream; + List<Session> sessions; + List<Track> tracks; + byte[] cdtext; + Dictionary<uint, ulong> offsetmap; + List<Partition> partitions; + Dictionary<uint, byte> trackFlags; + + public DiscJuggler() + { + Name = "DiscJuggler"; + PluginUUID = new Guid("2444DBC6-CD35-424C-A227-39B0C4DB01B2"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = true; + ImageInfo.imageHasSessions = true; + ImageInfo.imageVersion = null; + ImageInfo.imageApplicationVersion = null; + ImageInfo.imageName = null; + ImageInfo.imageCreator = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + public override bool IdentifyImage(Filter imageFilter) + { + imageStream = imageFilter.GetDataForkStream(); + + imageStream.Seek(-4, SeekOrigin.End); + byte[] dscLen_b = new byte[4]; + imageStream.Read(dscLen_b, 0, 4); + int dscLen = BitConverter.ToInt32(dscLen_b, 0); + + DicConsole.DebugWriteLine("DiscJuggler plugin", "dscLen = {0}", dscLen); + + if(dscLen >= imageStream.Length) return false; + + byte[] descriptor = new byte[dscLen]; + imageStream.Seek(-dscLen, SeekOrigin.End); + imageStream.Read(descriptor, 0, dscLen); + + // Sessions + if(descriptor[0] > 99 || descriptor[0] == 0) return false; + + // Seems all sessions start with this data + if(descriptor[1] != 0x00 || descriptor[3] != 0x00 || descriptor[4] != 0x00 || descriptor[5] != 0x00 || + descriptor[6] != 0x00 || descriptor[7] != 0x00 || descriptor[8] != 0x00 || descriptor[9] != 0x00 || + descriptor[10] != 0x01 || descriptor[11] != 0x00 || descriptor[12] != 0x00 || descriptor[13] != 0x00 || + descriptor[14] != 0xFF || descriptor[15] != 0xFF) return false; + + // Too many tracks + if(descriptor[2] > 99) return false; + + return true; + } + + public override bool OpenImage(Filter imageFilter) + { + imageStream = imageFilter.GetDataForkStream(); + + imageStream.Seek(-4, SeekOrigin.End); + byte[] dscLen_b = new byte[4]; + imageStream.Read(dscLen_b, 0, 4); + int dscLen = BitConverter.ToInt32(dscLen_b, 0); + + if(dscLen >= imageStream.Length) return false; + + byte[] descriptor = new byte[dscLen]; + imageStream.Seek(-dscLen, SeekOrigin.End); + imageStream.Read(descriptor, 0, dscLen); + + // Sessions + if(descriptor[0] > 99 || descriptor[0] == 0) return false; + + int position = 1; + + ushort sessionSequence = 0; + sessions = new List<Session>(); + tracks = new List<Track>(); + partitions = new List<Partition>(); + offsetmap = new Dictionary<uint, ulong>(); + trackFlags = new Dictionary<uint, byte>(); + ushort mediumType; + byte maxS = descriptor[0]; + + DicConsole.DebugWriteLine("DiscJuggler plugin", "maxS = {0}", maxS); + uint lastSessionTrack = 0; + ulong currentOffset = 0; + + // Read sessions + for(byte s = 0; s <= maxS; s++) + { + DicConsole.DebugWriteLine("DiscJuggler plugin", "s = {0}", s); + + // Seems all sessions start with this data + if(descriptor[position + 0] != 0x00 || descriptor[position + 2] != 0x00 || + descriptor[position + 3] != 0x00 || descriptor[position + 4] != 0x00 || + descriptor[position + 5] != 0x00 || descriptor[position + 6] != 0x00 || + descriptor[position + 7] != 0x00 || descriptor[position + 8] != 0x00 || + descriptor[position + 9] != 0x01 || descriptor[position + 10] != 0x00 || + descriptor[position + 11] != 0x00 || descriptor[position + 12] != 0x00 || + descriptor[position + 13] != 0xFF || descriptor[position + 14] != 0xFF) return false; + + // Too many tracks + if(descriptor[position + 1] > 99) return false; + + byte maxT = descriptor[position + 1]; + DicConsole.DebugWriteLine("DiscJuggler plugin", "maxT = {0}", maxT); + + sessionSequence++; + Session session = new Session(); + session.SessionSequence = sessionSequence; + session.EndTrack = uint.MinValue; + session.StartTrack = uint.MaxValue; + + position += 15; + bool addedATrack = false; + + // Read track + for(byte t = 0; t < maxT; t++) + { + addedATrack = false; + DicConsole.DebugWriteLine("DiscJuggler plugin", "t = {0}", t); + Track track = new Track(); + + // Skip unknown + position += 16; + + byte[] trackFilename_b = new byte[descriptor[position]]; + position++; + Array.Copy(descriptor, position, trackFilename_b, 0, trackFilename_b.Length); + position += trackFilename_b.Length; + track.TrackFile = Path.GetFileName(Encoding.Default.GetString(trackFilename_b)); + DicConsole.DebugWriteLine("DiscJuggler plugin", "\tfilename = {0}", track.TrackFile); + + // Skip unknown + position += 29; + + mediumType = BitConverter.ToUInt16(descriptor, position); + position += 2; + DicConsole.DebugWriteLine("DiscJuggler plugin", "\tmediumType = {0}", mediumType); + + // Read indices + track.Indexes = new Dictionary<int, ulong>(); + ushort maxI = BitConverter.ToUInt16(descriptor, position); + position += 2; + DicConsole.DebugWriteLine("DiscJuggler plugin", "\tmaxI = {0}", maxI); + for(ushort i = 0; i < maxI; i++) + { + uint index = BitConverter.ToUInt32(descriptor, position); + track.Indexes.Add(i, index); + position += 4; + DicConsole.DebugWriteLine("DiscJuggler plugin", "\tindex[{1}] = {0}", index, i); + } + + // Read CD-Text + uint maxC = BitConverter.ToUInt32(descriptor, position); + position += 4; + DicConsole.DebugWriteLine("DiscJuggler plugin", "\tmaxC = {0}", maxC); + for(uint c = 0; c < maxC; c++) + { + for(int cb = 0; cb < 18; cb++) + { + int bLen = descriptor[position]; + position++; + DicConsole.DebugWriteLine("DiscJuggler plugin", "\tc[{1}][{2}].Length = {0}", bLen, c, cb); + if(bLen > 0) + { + byte[] textBlk = new byte[bLen]; + Array.Copy(descriptor, position, textBlk, 0, bLen); + position += bLen; + // Track title + if(cb == 10) + { + track.TrackDescription = Encoding.Default.GetString(textBlk, 0, bLen); + DicConsole.DebugWriteLine("DiscJuggler plugin", "\tTrack title = {0}", + track.TrackDescription); + } + } + } + } + + position += 2; + uint trackMode = BitConverter.ToUInt32(descriptor, position); + DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackMode = {0}", trackMode); + position += 4; + + // Skip unknown + position += 4; + + session.SessionSequence = (ushort)(BitConverter.ToUInt32(descriptor, position) + 1); + track.TrackSession = (ushort)(session.SessionSequence + 1); + DicConsole.DebugWriteLine("DiscJuggler plugin", "\tsession = {0}", session.SessionSequence); + position += 4; + track.TrackSequence = BitConverter.ToUInt32(descriptor, position) + lastSessionTrack + 1; + DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrack = {1} + {2} + 1 = {0}", + track.TrackSequence, BitConverter.ToUInt32(descriptor, position), + lastSessionTrack); + position += 4; + track.TrackStartSector = BitConverter.ToUInt32(descriptor, position); + DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackStart = {0}", track.TrackStartSector); + position += 4; + uint trackLen = BitConverter.ToUInt32(descriptor, position); + track.TrackEndSector = track.TrackStartSector + trackLen - 1; + DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackEnd = {0}", track.TrackEndSector); + position += 4; + + if(track.TrackSequence > session.EndTrack) + { + session.EndTrack = track.TrackSequence; + session.EndSector = track.TrackEndSector; + } + if(track.TrackSequence < session.StartTrack) + { + session.StartTrack = track.TrackSequence; + session.StartSector = track.TrackStartSector; + } + + // Skip unknown + position += 16; + + uint readMode = BitConverter.ToUInt32(descriptor, position); + DicConsole.DebugWriteLine("DiscJuggler plugin", "\treadMode = {0}", readMode); + position += 4; + uint trackCtl = BitConverter.ToUInt32(descriptor, position); + DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackCtl = {0}", trackCtl); + position += 4; + + // Skip unknown + position += 9; + + byte[] isrc = new byte[12]; + Array.Copy(descriptor, position, isrc, 0, 12); + DicConsole.DebugWriteLine("DiscJuggler plugin", "\tisrc = {0}", StringHandlers.CToString(isrc)); + position += 12; + uint isrc_valid = BitConverter.ToUInt32(descriptor, position); + DicConsole.DebugWriteLine("DiscJuggler plugin", "\tisrc_valid = {0}", isrc_valid); + position += 4; + + // Skip unknown + position += 87; + + byte sessionType = descriptor[position]; + DicConsole.DebugWriteLine("DiscJuggler plugin", "\tsessionType = {0}", sessionType); + position++; + + // Skip unknown + position += 5; + + byte trackFollows = descriptor[position]; + DicConsole.DebugWriteLine("DiscJuggler plugin", "\ttrackFollows = {0}", trackFollows); + position += 2; + + uint endAddress = BitConverter.ToUInt32(descriptor, position); + DicConsole.DebugWriteLine("DiscJuggler plugin", "\tendAddress = {0}", endAddress); + position += 4; + + // As to skip the lead-in + bool firstTrack = currentOffset == 0; + + track.TrackSubchannelType = TrackSubchannelType.None; + + switch(trackMode) + { + // Audio + case 0: + if(ImageInfo.sectorSize < 2352) ImageInfo.sectorSize = 2352; + track.TrackType = TrackType.Audio; + track.TrackBytesPerSector = 2352; + track.TrackRawBytesPerSector = 2352; + switch(readMode) + { + case 2: + if(firstTrack) currentOffset += 150 * (ulong)track.TrackRawBytesPerSector; + track.TrackFileOffset = currentOffset; + currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; + break; + case 3: + if(firstTrack) currentOffset += 150 * (ulong)(track.TrackRawBytesPerSector + 16); + track.TrackFileOffset = currentOffset; + track.TrackSubchannelFile = track.TrackFile; + track.TrackSubchannelOffset = currentOffset; + track.TrackSubchannelType = TrackSubchannelType.Q16Interleaved; + currentOffset += trackLen * (ulong)(track.TrackRawBytesPerSector + 16); + break; + case 4: + if(firstTrack) currentOffset += 150 * (ulong)(track.TrackRawBytesPerSector + 96); + track.TrackFileOffset = currentOffset; + track.TrackSubchannelFile = track.TrackFile; + track.TrackSubchannelOffset = currentOffset; + track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; + currentOffset += trackLen * (ulong)(track.TrackRawBytesPerSector + 96); + break; + default: + throw new ImageNotSupportedException(string.Format("Unknown read mode {0}", + readMode)); + } + + break; + // Mode 1 or DVD + case 1: + if(ImageInfo.sectorSize < 2048) ImageInfo.sectorSize = 2048; + track.TrackType = TrackType.CDMode1; + track.TrackBytesPerSector = 2048; + switch(readMode) + { + case 0: + track.TrackRawBytesPerSector = 2048; + if(firstTrack) currentOffset += 150 * (ulong)track.TrackRawBytesPerSector; + track.TrackFileOffset = currentOffset; + currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; + break; + case 1: + throw new + ImageNotSupportedException(string.Format("Invalid read mode {0} for this track", + readMode)); + case 2: + track.TrackRawBytesPerSector = 2352; + currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); + break; + case 3: + track.TrackRawBytesPerSector = 2352; + if(firstTrack) currentOffset += 150 * (ulong)(track.TrackRawBytesPerSector + 16); + track.TrackFileOffset = currentOffset; + track.TrackSubchannelFile = track.TrackFile; + track.TrackSubchannelOffset = currentOffset; + track.TrackSubchannelType = TrackSubchannelType.Q16Interleaved; + currentOffset += trackLen * (ulong)(track.TrackRawBytesPerSector + 16); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); + break; + case 4: + track.TrackRawBytesPerSector = 2352; + if(firstTrack) currentOffset += 150 * (ulong)(track.TrackRawBytesPerSector + 96); + track.TrackFileOffset = currentOffset; + track.TrackSubchannelFile = track.TrackFile; + track.TrackSubchannelOffset = currentOffset; + track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; + currentOffset += trackLen * (ulong)(track.TrackRawBytesPerSector + 96); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); + break; + default: + throw new ImageNotSupportedException(string.Format("Unknown read mode {0}", + readMode)); + } + + break; + // Mode 2 + case 2: + if(ImageInfo.sectorSize < 2336) ImageInfo.sectorSize = 2336; + track.TrackType = TrackType.CDMode2Formless; + track.TrackBytesPerSector = 2336; + switch(readMode) + { + case 0: + throw new + ImageNotSupportedException(string.Format("Invalid read mode {0} for this track", + readMode)); + case 1: + track.TrackRawBytesPerSector = 2336; + if(firstTrack) currentOffset += 150 * (ulong)track.TrackRawBytesPerSector; + track.TrackFileOffset = currentOffset; + currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; + break; + case 2: + track.TrackRawBytesPerSector = 2352; + currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + break; + case 3: + track.TrackRawBytesPerSector = 2352; + if(firstTrack) currentOffset += 150 * (ulong)(track.TrackRawBytesPerSector + 16); + track.TrackFileOffset = currentOffset; + track.TrackSubchannelFile = track.TrackFile; + track.TrackSubchannelOffset = currentOffset; + track.TrackSubchannelType = TrackSubchannelType.Q16Interleaved; + currentOffset += trackLen * (ulong)(track.TrackRawBytesPerSector + 16); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + break; + case 4: + track.TrackRawBytesPerSector = 2352; + if(firstTrack) currentOffset += 150 * (ulong)(track.TrackRawBytesPerSector + 96); + track.TrackFileOffset = currentOffset; + track.TrackSubchannelFile = track.TrackFile; + track.TrackSubchannelOffset = currentOffset; + track.TrackSubchannelType = TrackSubchannelType.RawInterleaved; + currentOffset += trackLen * (ulong)(track.TrackRawBytesPerSector + 96); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); + break; + default: + throw new ImageNotSupportedException(string.Format("Unknown read mode {0}", + readMode)); + } + + break; + default: + throw new ImageNotSupportedException(string.Format("Unknown track mode {0}", trackMode)); + } + + track.TrackFile = imageFilter.GetFilename(); + track.TrackFilter = imageFilter; + if(track.TrackSubchannelType != TrackSubchannelType.None) + { + track.TrackSubchannelFile = imageFilter.GetFilename(); + track.TrackSubchannelFilter = imageFilter; + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubchannel); + } + + Partition partition = new Partition(); + partition.Description = track.TrackDescription; + partition.Size = (ulong)(trackLen * track.TrackBytesPerSector); + partition.Length = trackLen; + ImageInfo.sectors += partition.Length; + partition.Sequence = track.TrackSequence; + partition.Offset = track.TrackFileOffset; + partition.Start = track.TrackStartSector; + partition.Type = track.TrackType.ToString(); + partitions.Add(partition); + offsetmap.Add(track.TrackSequence, track.TrackStartSector); + tracks.Add(track); + trackFlags.Add(track.TrackSequence, (byte)(trackCtl & 0xFF)); + addedATrack = true; + } + + if(addedATrack) + { + lastSessionTrack = session.EndTrack; + sessions.Add(session); + DicConsole.DebugWriteLine("DiscJuggler plugin", "session.StartTrack = {0}", session.StartTrack); + DicConsole.DebugWriteLine("DiscJuggler plugin", "session.StartSector = {0}", session.StartSector); + DicConsole.DebugWriteLine("DiscJuggler plugin", "session.EndTrack = {0}", session.EndTrack); + DicConsole.DebugWriteLine("DiscJuggler plugin", "session.EndSector = {0}", session.EndSector); + DicConsole.DebugWriteLine("DiscJuggler plugin", "session.SessionSequence = {0}", + session.SessionSequence); + } + } + + // Skip unknown + position += 16; + + DicConsole.DebugWriteLine("DiscJuggler plugin", "Current position = {0}", position); + byte[] filename_b = new byte[descriptor[position]]; + position++; + Array.Copy(descriptor, position, filename_b, 0, filename_b.Length); + position += filename_b.Length; + string filename = Path.GetFileName(Encoding.Default.GetString(filename_b)); + DicConsole.DebugWriteLine("DiscJuggler plugin", "filename = {0}", filename); + + // Skip unknown + position += 29; + + mediumType = BitConverter.ToUInt16(descriptor, position); + position += 2; + DicConsole.DebugWriteLine("DiscJuggler plugin", "mediumType = {0}", mediumType); + + uint discSize = BitConverter.ToUInt32(descriptor, position); + position += 4; + DicConsole.DebugWriteLine("DiscJuggler plugin", "discSize = {0}", discSize); + + byte[] volid_b = new byte[descriptor[position]]; + position++; + Array.Copy(descriptor, position, volid_b, 0, volid_b.Length); + position += volid_b.Length; + string volid = Path.GetFileName(Encoding.Default.GetString(volid_b)); + DicConsole.DebugWriteLine("DiscJuggler plugin", "volid = {0}", volid); + + // Skip unknown + position += 9; + + byte[] mcn = new byte[13]; + Array.Copy(descriptor, position, mcn, 0, 13); + DicConsole.DebugWriteLine("DiscJuggler plugin", "mcn = {0}", StringHandlers.CToString(mcn)); + position += 13; + uint mcn_valid = BitConverter.ToUInt32(descriptor, position); + DicConsole.DebugWriteLine("DiscJuggler plugin", "mcn_valid = {0}", mcn_valid); + position += 4; + + uint cdtextLen = BitConverter.ToUInt32(descriptor, position); + DicConsole.DebugWriteLine("DiscJuggler plugin", "cdtextLen = {0}", cdtextLen); + position += 4; + if(cdtextLen > 0) + { + cdtext = new byte[cdtextLen]; + Array.Copy(descriptor, position, cdtext, 0, cdtextLen); + position += (int)cdtextLen; + ImageInfo.readableMediaTags.Add(MediaTagType.CD_TEXT); + } + + // Skip unknown + position += 12; + + DicConsole.DebugWriteLine("DiscJuggler plugin", "End position = {0}", position); + + if(ImageInfo.mediaType == MediaType.CDROM) + { + bool data = false; + bool mode2 = false; + bool firstaudio = false; + bool firstdata = false; + bool audio = false; + + for(int i = 0; i < tracks.Count; i++) + { + // First track is audio + firstaudio |= i == 0 && tracks[i].TrackType == TrackType.Audio; + + // First track is data + firstdata |= i == 0 && tracks[i].TrackType != TrackType.Audio; + + // Any non first track is data + data |= i != 0 && tracks[i].TrackType != TrackType.Audio; + + // Any non first track is audio + audio |= i != 0 && tracks[i].TrackType == TrackType.Audio; + + switch(tracks[i].TrackType) + { + case TrackType.CDMode2Form1: + case TrackType.CDMode2Form2: + case TrackType.CDMode2Formless: + mode2 = true; + break; + } + } + + if(!data && !firstdata) ImageInfo.mediaType = MediaType.CDDA; + else if(firstaudio && data && sessions.Count > 1 && mode2) ImageInfo.mediaType = MediaType.CDPLUS; + else if((firstdata && audio) || mode2) ImageInfo.mediaType = MediaType.CDROMXA; + else if(!audio) ImageInfo.mediaType = MediaType.CDROM; + else ImageInfo.mediaType = MediaType.CD; + } + + ImageInfo.imageApplication = "DiscJuggler"; + ImageInfo.imageSize = (ulong)imageFilter.GetDataForkLength(); + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.xmlMediaType = XmlMediaType.OpticalDisc; + + return true; + } + + static MediaType DecodeCDIMediumType(ushort type) + { + switch(type) + { + case 56: return MediaType.DVDROM; + case 152: return MediaType.CDROM; + default: return MediaType.Unknown; + } + } + + public override bool ImageHasPartitions() + { + return ImageInfo.imageHasPartitions; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override byte[] ReadDiskTag(MediaTagType tag) + { + switch(tag) + { + case MediaTagType.CD_TEXT: + { + if(cdtext != null && cdtext.Length > 0) return cdtext; + + throw new FeatureNotPresentImageException("Image does not contain CD-TEXT information."); + } + default: + throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format"); + } + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + return ReadSectorsTag(sectorAddress, 1, tag); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + return ReadSectors(sectorAddress, 1, track); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + return ReadSectorsTag(sectorAddress, 1, track, tag); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + foreach(KeyValuePair<uint, ulong> kvp in offsetmap) + { + if(sectorAddress >= kvp.Value) + { + foreach(Track _track in tracks) + { + if(_track.TrackSequence == kvp.Key) + { + if(sectorAddress < _track.TrackEndSector) + return ReadSectors((sectorAddress - kvp.Value), length, kvp.Key); + } + } + } + } + + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + foreach(KeyValuePair<uint, ulong> kvp in offsetmap) + { + if(sectorAddress >= kvp.Value) + { + foreach(Track _track in tracks) + { + if(_track.TrackSequence == kvp.Key) + { + if(sectorAddress < _track.TrackEndSector) + return ReadSectorsTag((sectorAddress - kvp.Value), length, kvp.Key, tag); + } + } + } + } + + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + Track _track = new Track(); + + _track.TrackSequence = 0; + + foreach(Track __track in tracks) + { + if(__track.TrackSequence == track) + { + _track = __track; + break; + } + } + + if(_track.TrackSequence == 0) + throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); + + if(length + sectorAddress > (_track.TrackEndSector)) + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length + sectorAddress, _track.TrackEndSector)); + + uint sector_offset; + uint sector_size; + uint sector_skip; + + switch(_track.TrackType) + { + case TrackType.Audio: + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } + case TrackType.CDMode1: + if(_track.TrackRawBytesPerSector == 2352) + { + sector_offset = 16; + sector_size = 2048; + sector_skip = 288; + } + else + { + sector_offset = 0; + sector_size = 2048; + sector_skip = 0; + } + break; + case TrackType.CDMode2Formless: + if(_track.TrackRawBytesPerSector == 2352) + { + sector_offset = 16; + sector_size = 2336; + sector_skip = 0; + } + else + { + sector_offset = 0; + sector_size = 2336; + sector_skip = 0; + } + break; + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + } + + switch(_track.TrackSubchannelType) + { + case TrackSubchannelType.None: + sector_skip += 0; + break; + case TrackSubchannelType.Q16Interleaved: + sector_skip += 16; + break; + case TrackSubchannelType.PackedInterleaved: + sector_skip += 96; + break; + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); + } + + byte[] buffer = new byte[sector_size * length]; + + imageStream.Seek((long)(_track.TrackFileOffset + sectorAddress * (ulong)_track.TrackRawBytesPerSector), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) imageStream.Read(buffer, 0, buffer.Length); + else + { + for(int i = 0; i < length; i++) + { + byte[] sector = new byte[sector_size]; + imageStream.Seek(sector_offset, SeekOrigin.Current); + imageStream.Read(sector, 0, sector.Length); + imageStream.Seek(sector_skip, SeekOrigin.Current); + Array.Copy(sector, 0, buffer, i * sector_size, sector_size); + } + } + + return buffer; + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + Track _track = new Track(); + + _track.TrackSequence = 0; + + foreach(Track __track in tracks) + { + if(__track.TrackSequence == track) + { + _track = __track; + break; + } + } + + if(_track.TrackSequence == 0) + throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); + + if(length + sectorAddress > (_track.TrackEndSector)) + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length + sectorAddress, _track.TrackEndSector)); + + if(_track.TrackType == TrackType.Data) + throw new ArgumentException("Unsupported tag requested", nameof(tag)); + + byte[] buffer; + + switch(tag) + { + case SectorTagType.CDSectorECC: + case SectorTagType.CDSectorECC_P: + case SectorTagType.CDSectorECC_Q: + case SectorTagType.CDSectorEDC: + case SectorTagType.CDSectorHeader: + case SectorTagType.CDSectorSubchannel: + case SectorTagType.CDSectorSubHeader: + case SectorTagType.CDSectorSync: break; + case SectorTagType.CDTrackFlags: + byte flag; + if(trackFlags.TryGetValue(track, out flag)) return new byte[] {flag}; + + throw new ArgumentException("Unsupported tag requested", nameof(tag)); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + + uint sector_offset; + uint sector_size; + uint sector_skip; + + switch(_track.TrackType) + { + case TrackType.CDMode1: + if(_track.TrackRawBytesPerSector != 2352) + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + + switch(tag) + { + case SectorTagType.CDSectorSync: + { + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; + } + case SectorTagType.CDSectorHeader: + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } + case SectorTagType.CDSectorSubHeader: + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + case SectorTagType.CDSectorECC: + { + sector_offset = 2076; + sector_size = 276; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorECC_P: + { + sector_offset = 2076; + sector_size = 172; + sector_skip = 104; + break; + } + case SectorTagType.CDSectorECC_Q: + { + sector_offset = 2248; + sector_size = 104; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2064; + sector_size = 4; + sector_skip = 284; + break; + } + case SectorTagType.CDSectorSubchannel: + if(_track.TrackSubchannelType == TrackSubchannelType.None) + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + if(_track.TrackSubchannelType == TrackSubchannelType.Q16Interleaved) + throw new ArgumentException("Q16 subchannel not yet supported"); + + sector_offset = 2352; + sector_size = 96; + sector_skip = 0; + break; + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + + break; + case TrackType.CDMode2Formless: + if(_track.TrackRawBytesPerSector != 2352) + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + + { + switch(tag) + { + case SectorTagType.CDSectorSync: + case SectorTagType.CDSectorHeader: + case SectorTagType.CDSectorECC: + case SectorTagType.CDSectorECC_P: + case SectorTagType.CDSectorECC_Q: + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + case SectorTagType.CDSectorSubHeader: + { + sector_offset = 0; + sector_size = 8; + sector_skip = 2328; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2332; + sector_size = 4; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorSubchannel: + if(_track.TrackSubchannelType == TrackSubchannelType.None) + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + if(_track.TrackSubchannelType == TrackSubchannelType.Q16Interleaved) + throw new ArgumentException("Q16 subchannel not yet supported"); + + sector_offset = 2352; + sector_size = 96; + sector_skip = 0; + break; + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + + break; + } + case TrackType.Audio: + { + switch(tag) + { + case SectorTagType.CDSectorSubchannel: + if(_track.TrackSubchannelType == TrackSubchannelType.None) + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + if(_track.TrackSubchannelType == TrackSubchannelType.Q16Interleaved) + throw new ArgumentException("Q16 subchannel not yet supported"); + + sector_offset = 2352; + sector_size = 96; + sector_skip = 0; + break; + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); + } + + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + } + + switch(_track.TrackSubchannelType) + { + case TrackSubchannelType.None: + sector_skip += 0; + break; + case TrackSubchannelType.Q16Interleaved: + sector_skip += 16; + break; + case TrackSubchannelType.PackedInterleaved: + sector_skip += 96; + break; + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); + } + + buffer = new byte[sector_size * length]; + + imageStream.Seek((long)(_track.TrackFileOffset + sectorAddress * (ulong)_track.TrackRawBytesPerSector), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) imageStream.Read(buffer, 0, buffer.Length); + else + { + for(int i = 0; i < length; i++) + { + byte[] sector = new byte[sector_size]; + imageStream.Seek(sector_offset, SeekOrigin.Current); + imageStream.Read(sector, 0, sector.Length); + imageStream.Seek(sector_skip, SeekOrigin.Current); + Array.Copy(sector, 0, buffer, i * sector_size, sector_size); + } + } + + return buffer; + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + return ReadSectorsLong(sectorAddress, 1); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + return ReadSectorsLong(sectorAddress, 1, track); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + foreach(KeyValuePair<uint, ulong> kvp in offsetmap) + { + if(sectorAddress >= kvp.Value) + { + foreach(Track track in tracks) + { + if(track.TrackSequence == kvp.Key) + { + if((sectorAddress - kvp.Value) < (track.TrackEndSector - track.TrackStartSector)) + return ReadSectorsLong((sectorAddress - kvp.Value), length, kvp.Key); + } + } + } + } + + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + Track _track = new Track(); + + _track.TrackSequence = 0; + + foreach(Track __track in tracks) + { + if(__track.TrackSequence == track) + { + _track = __track; + break; + } + } + + if(_track.TrackSequence == 0) + throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); + + if(length + sectorAddress > (_track.TrackEndSector)) + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length + sectorAddress, _track.TrackEndSector)); + + uint sector_offset = 0; + uint sector_size = (uint)_track.TrackRawBytesPerSector; + uint sector_skip = 0; + + switch(_track.TrackSubchannelType) + { + case TrackSubchannelType.None: + sector_skip += 0; + break; + case TrackSubchannelType.Q16Interleaved: + sector_skip += 16; + break; + case TrackSubchannelType.PackedInterleaved: + sector_skip += 96; + break; + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type"); + } + + byte[] buffer = new byte[sector_size * length]; + + imageStream.Seek((long)(_track.TrackFileOffset + sectorAddress * (ulong)_track.TrackRawBytesPerSector), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) imageStream.Read(buffer, 0, buffer.Length); + else + { + for(int i = 0; i < length; i++) + { + byte[] sector = new byte[sector_size]; + imageStream.Seek(sector_offset, SeekOrigin.Current); + imageStream.Read(sector, 0, sector.Length); + imageStream.Seek(sector_skip, SeekOrigin.Current); + Array.Copy(sector, 0, buffer, i * sector_size, sector_size); + } + } + + return buffer; + } + + public override string GetImageFormat() + { + return "DiscJuggler"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override string GetMediaManufacturer() + { + return ImageInfo.mediaManufacturer; + } + + public override string GetMediaModel() + { + return ImageInfo.mediaModel; + } + + public override string GetMediaSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + + public override string GetMediaBarcode() + { + return ImageInfo.mediaBarcode; + } + + public override string GetMediaPartNumber() + { + return ImageInfo.mediaPartNumber; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override int GetMediaSequence() + { + return ImageInfo.mediaSequence; + } + + public override int GetLastDiskSequence() + { + return ImageInfo.lastMediaSequence; + } + + public override string GetDriveManufacturer() + { + return ImageInfo.driveManufacturer; + } + + public override string GetDriveModel() + { + return ImageInfo.driveModel; + } + + public override string GetDriveSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + + public override List<Partition> GetPartitions() + { + return partitions; + } + + public override List<Track> GetTracks() + { + return tracks; + } + + public override List<Track> GetSessionTracks(Session session) + { + if(sessions.Contains(session)) { return GetSessionTracks(session.SessionSequence); } + + throw new ImageNotSupportedException("Session does not exist in disc image"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + List<Track> _tracks = new List<Track>(); + foreach(Track _track in tracks) { if(_track.TrackSession == session) _tracks.Add(_track); } + + return _tracks; + } + + public override List<Session> GetSessions() + { + return sessions; + } + + public override bool? VerifySector(ulong sectorAddress) + { + byte[] buffer = ReadSectorLong(sectorAddress); + return Checksums.CDChecksums.CheckCDSector(buffer); + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + byte[] buffer = ReadSectorLong(sectorAddress, track); + return Checksums.CDChecksums.CheckCDSector(buffer); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + byte[] buffer = ReadSectorsLong(sectorAddress, length); + int bps = (int)(buffer.Length / length); + byte[] sector = new byte[bps]; + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(int i = 0; i < length; i++) + { + Array.Copy(buffer, i * bps, sector, 0, bps); + bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); + + switch(sectorStatus) + { + case null: + UnknownLBAs.Add((ulong)i + sectorAddress); + break; + case false: + FailingLBAs.Add((ulong)i + sectorAddress); + break; + } + } + + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + + return true; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + byte[] buffer = ReadSectorsLong(sectorAddress, length, track); + int bps = (int)(buffer.Length / length); + byte[] sector = new byte[bps]; + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(int i = 0; i < length; i++) + { + Array.Copy(buffer, i * bps, sector, 0, bps); + bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); + + switch(sectorStatus) + { + case null: + UnknownLBAs.Add((ulong)i + sectorAddress); + break; + case false: + FailingLBAs.Add((ulong)i + sectorAddress); + break; + } + } + + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + + return true; + } + + public override bool? VerifyMediaImage() + { + return null; + } + } +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/DiskCopy42.cs b/DiscImageChef.DiscImages/DiskCopy42.cs index 20ae29c1..0b3389cf 100644 --- a/DiscImageChef.DiscImages/DiskCopy42.cs +++ b/DiscImageChef.DiscImages/DiskCopy42.cs @@ -42,11 +42,10 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - // Checked using several images and strings inside Apple's DiskImages.framework - public class DiskCopy42 : ImagePlugin + // Checked using several images and strings inside Apple's DiskImages.framework + public class DiskCopy42 : ImagePlugin { #region Internal Structures - // DiskCopy 4.2 header, big-endian, data-fork, start of file, 84 bytes struct DC42Header { @@ -69,11 +68,9 @@ namespace DiscImageChef.ImagePlugins /// <summary>0x53, reserved, always 0x00</summary> public byte reserved; } - #endregion #region Internal Constants - // format byte /// <summary>3.5", single side, double density, GCR</summary> const byte kSonyFormat400K = 0x00; @@ -112,15 +109,13 @@ namespace DiscImageChef.ImagePlugins const byte kInvalidFmtByte = 0x96; /// <summary>Defined by LisaEm</summary> const byte kFmtNotStandard = 0x93; - /// <summary>Used incorrectly by Mac OS X with certaing disk images</summary> - const byte kMacOSXFmtByte = 0x00; + /// <summary>Used incorrectly by Mac OS X with certaing disk images</summary> + const byte kMacOSXFmtByte = 0x00; + #endregion - #endregion - - #region Internal variables - - /// <summary>Start of data sectors in disk image, should be 0x58</summary> - uint dataOffset; + #region Internal variables + /// <summary>Start of data sectors in disk image, should be 0x58</summary> + uint dataOffset; /// <summary>Start of tags in disk image, after data sectors</summary> uint tagOffset; /// <summary>Bytes per tag, should be 12</summary> @@ -133,7 +128,6 @@ namespace DiscImageChef.ImagePlugins byte[] twiggyCache; byte[] twiggyCacheTags; bool twiggy; - #endregion public DiskCopy42() @@ -172,8 +166,7 @@ namespace DiscImageChef.ImagePlugins stream.Read(buffer, 0, 0x58); // Incorrect pascal string length, not DC42 - if(buffer[0] > 63) - return false; + if(buffer[0] > 63) return false; DC42Header tmp_header = new DC42Header(); @@ -201,35 +194,39 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("DC42 plugin", "tmp_header.valid = {0}", tmp_header.valid); DicConsole.DebugWriteLine("DC42 plugin", "tmp_header.reserved = {0}", tmp_header.reserved); - if(tmp_header.valid != 1 || tmp_header.reserved != 0) - return false; + if(tmp_header.valid != 1 || tmp_header.reserved != 0) return false; - // Some versions seem to incorrectly create little endian fields - if(tmp_header.dataSize + tmp_header.tagSize + 0x54 != imageFilter.GetDataForkLength() && tmp_header.format != kSigmaFormatTwiggy) - { - tmp_header.dataSize = BitConverter.ToUInt32(buffer, 0x40); - tmp_header.tagSize = BitConverter.ToUInt32(buffer, 0x44); - tmp_header.dataChecksum = BitConverter.ToUInt32(buffer, 0x48); - tmp_header.tagChecksum = BitConverter.ToUInt32(buffer, 0x4C); + // Some versions seem to incorrectly create little endian fields + if(tmp_header.dataSize + tmp_header.tagSize + 0x54 != imageFilter.GetDataForkLength() && + tmp_header.format != kSigmaFormatTwiggy) + { + tmp_header.dataSize = BitConverter.ToUInt32(buffer, 0x40); + tmp_header.tagSize = BitConverter.ToUInt32(buffer, 0x44); + tmp_header.dataChecksum = BitConverter.ToUInt32(buffer, 0x48); + tmp_header.tagChecksum = BitConverter.ToUInt32(buffer, 0x4C); - if(tmp_header.dataSize + tmp_header.tagSize + 0x54 != imageFilter.GetDataForkLength() && tmp_header.format != kSigmaFormatTwiggy) - return false; - } + if(tmp_header.dataSize + tmp_header.tagSize + 0x54 != imageFilter.GetDataForkLength() && + tmp_header.format != kSigmaFormatTwiggy) return false; + } - if(tmp_header.format != kSonyFormat400K && tmp_header.format != kSonyFormat800K && tmp_header.format != kSonyFormat720K && - tmp_header.format != kSonyFormat1440K && tmp_header.format != kSonyFormat1680K && tmp_header.format != kSigmaFormatTwiggy && + if(tmp_header.format != kSonyFormat400K && tmp_header.format != kSonyFormat800K && + tmp_header.format != kSonyFormat720K && tmp_header.format != kSonyFormat1440K && + tmp_header.format != kSonyFormat1680K && tmp_header.format != kSigmaFormatTwiggy && tmp_header.format != kNotStandardFormat) { - DicConsole.DebugWriteLine("DC42 plugin", "Unknown tmp_header.format = 0x{0:X2} value", tmp_header.format); + DicConsole.DebugWriteLine("DC42 plugin", "Unknown tmp_header.format = 0x{0:X2} value", + tmp_header.format); return false; } - if(tmp_header.fmtByte != kSonyFmtByte400K && tmp_header.fmtByte != kSonyFmtByte800K && tmp_header.fmtByte != kSonyFmtByte800KIncorrect && - tmp_header.fmtByte != kSonyFmtByteProDos && tmp_header.fmtByte != kInvalidFmtByte && tmp_header.fmtByte != kSigmaFmtByteTwiggy && - tmp_header.fmtByte != kFmtNotStandard && tmp_header.fmtByte != kMacOSXFmtByte) + if(tmp_header.fmtByte != kSonyFmtByte400K && tmp_header.fmtByte != kSonyFmtByte800K && + tmp_header.fmtByte != kSonyFmtByte800KIncorrect && tmp_header.fmtByte != kSonyFmtByteProDos && + tmp_header.fmtByte != kInvalidFmtByte && tmp_header.fmtByte != kSigmaFmtByteTwiggy && + tmp_header.fmtByte != kFmtNotStandard && tmp_header.fmtByte != kMacOSXFmtByte) { - DicConsole.DebugWriteLine("DC42 plugin", "Unknown tmp_header.fmtByte = 0x{0:X2} value", tmp_header.fmtByte); + DicConsole.DebugWriteLine("DC42 plugin", "Unknown tmp_header.fmtByte = 0x{0:X2} value", + tmp_header.fmtByte); return false; } @@ -253,8 +250,7 @@ namespace DiscImageChef.ImagePlugins stream.Read(buffer, 0, 0x58); // Incorrect pascal string length, not DC42 - if(buffer[0] > 63) - return false; + if(buffer[0] > 63) return false; header = new DC42Header(); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -280,31 +276,35 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("DC42 plugin", "header.valid = {0}", header.valid); DicConsole.DebugWriteLine("DC42 plugin", "header.reserved = {0}", header.reserved); - if(header.valid != 1 || header.reserved != 0) - return false; + if(header.valid != 1 || header.reserved != 0) return false; - // Some versions seem to incorrectly create little endian fields - if(header.dataSize + header.tagSize + 0x54 != imageFilter.GetDataForkLength() && header.format != kSigmaFormatTwiggy) - { - header.dataSize = BitConverter.ToUInt32(buffer, 0x40); - header.tagSize = BitConverter.ToUInt32(buffer, 0x44); - header.dataChecksum = BitConverter.ToUInt32(buffer, 0x48); - header.tagChecksum = BitConverter.ToUInt32(buffer, 0x4C); + // Some versions seem to incorrectly create little endian fields + if(header.dataSize + header.tagSize + 0x54 != imageFilter.GetDataForkLength() && + header.format != kSigmaFormatTwiggy) + { + header.dataSize = BitConverter.ToUInt32(buffer, 0x40); + header.tagSize = BitConverter.ToUInt32(buffer, 0x44); + header.dataChecksum = BitConverter.ToUInt32(buffer, 0x48); + header.tagChecksum = BitConverter.ToUInt32(buffer, 0x4C); - if(header.dataSize + header.tagSize + 0x54 != imageFilter.GetDataForkLength() && header.format != kSigmaFormatTwiggy) - return false; - } + if(header.dataSize + header.tagSize + 0x54 != imageFilter.GetDataForkLength() && + header.format != kSigmaFormatTwiggy) return false; + } - if(header.format != kSonyFormat400K && header.format != kSonyFormat800K && header.format != kSonyFormat720K && - header.format != kSonyFormat1440K && header.format != kSonyFormat1680K && header.format != kSigmaFormatTwiggy && header.format != kNotStandardFormat) + if(header.format != kSonyFormat400K && header.format != kSonyFormat800K && + header.format != kSonyFormat720K && header.format != kSonyFormat1440K && + header.format != kSonyFormat1680K && header.format != kSigmaFormatTwiggy && + header.format != kNotStandardFormat) { DicConsole.DebugWriteLine("DC42 plugin", "Unknown header.format = 0x{0:X2} value", header.format); return false; } - if(header.fmtByte != kSonyFmtByte400K && header.fmtByte != kSonyFmtByte800K && header.fmtByte != kSonyFmtByte800KIncorrect && - header.fmtByte != kSonyFmtByteProDos && header.fmtByte != kInvalidFmtByte && header.fmtByte != kSigmaFmtByteTwiggy && header.fmtByte != kFmtNotStandard && header.fmtByte != kMacOSXFmtByte) + if(header.fmtByte != kSonyFmtByte400K && header.fmtByte != kSonyFmtByte800K && + header.fmtByte != kSonyFmtByte800KIncorrect && header.fmtByte != kSonyFmtByteProDos && + header.fmtByte != kInvalidFmtByte && header.fmtByte != kSigmaFmtByteTwiggy && + header.fmtByte != kFmtNotStandard && header.fmtByte != kMacOSXFmtByte) { DicConsole.DebugWriteLine("DC42 plugin", "Unknown tmp_header.fmtByte = 0x{0:X2} value", header.fmtByte); @@ -348,10 +348,8 @@ namespace DiscImageChef.ImagePlugins switch(header.format) { case kSonyFormat400K: - if(ImageInfo.sectors == 1600) - ImageInfo.mediaType = MediaType.AppleSonyDS; - else - ImageInfo.mediaType = MediaType.AppleSonySS; + if(ImageInfo.sectors == 1600) ImageInfo.mediaType = MediaType.AppleSonyDS; + else ImageInfo.mediaType = MediaType.AppleSonySS; break; case kSonyFormat800K: ImageInfo.mediaType = MediaType.AppleSonyDS; @@ -387,6 +385,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.mediaType = MediaType.Unknown; break; } + break; default: ImageInfo.mediaType = MediaType.Unknown; @@ -433,25 +432,20 @@ namespace DiscImageChef.ImagePlugins for(int i = 0; i < 46; i++) { - if(i >= 0 && i <= 3) - sectorsToCopy = 22; - if(i >= 4 && i <= 10) - sectorsToCopy = 21; - if(i >= 11 && i <= 16) - sectorsToCopy = 20; - if(i >= 17 && i <= 22) - sectorsToCopy = 19; - if(i >= 23 && i <= 28) - sectorsToCopy = 18; - if(i >= 29 && i <= 34) - sectorsToCopy = 17; - if(i >= 35 && i <= 41) - sectorsToCopy = 16; - if(i >= 42 && i <= 45) - sectorsToCopy = 15; + if(i >= 0 && i <= 3) sectorsToCopy = 22; + if(i >= 4 && i <= 10) sectorsToCopy = 21; + if(i >= 11 && i <= 16) sectorsToCopy = 20; + if(i >= 17 && i <= 22) sectorsToCopy = 19; + if(i >= 23 && i <= 28) sectorsToCopy = 18; + if(i >= 29 && i <= 34) sectorsToCopy = 17; + if(i >= 35 && i <= 41) sectorsToCopy = 16; + if(i >= 42 && i <= 45) sectorsToCopy = 15; - Array.Copy(data, header.dataSize / 2 + copiedSectors * 512, twiggyCache, twiggyCache.Length - copiedSectors * 512 - sectorsToCopy * 512, sectorsToCopy * 512); - Array.Copy(tags, header.tagSize / 2 + copiedSectors * bptag, twiggyCacheTags, twiggyCacheTags.Length - copiedSectors * bptag - sectorsToCopy * bptag, sectorsToCopy * bptag); + Array.Copy(data, header.dataSize / 2 + copiedSectors * 512, twiggyCache, + twiggyCache.Length - copiedSectors * 512 - sectorsToCopy * 512, sectorsToCopy * 512); + Array.Copy(tags, header.tagSize / 2 + copiedSectors * bptag, twiggyCacheTags, + twiggyCacheTags.Length - copiedSectors * bptag - sectorsToCopy * bptag, + sectorsToCopy * bptag); copiedSectors += sectorsToCopy; } @@ -497,13 +491,12 @@ namespace DiscImageChef.ImagePlugins break; } - if(dev == null && version.PreReleaseVersion > 0) - dev = "f"; + if(dev == null && version.PreReleaseVersion > 0) dev = "f"; - if(dev != null) - pre = string.Format("{0}", version.PreReleaseVersion); + if(dev != null) pre = string.Format("{0}", version.PreReleaseVersion); - ImageInfo.imageApplicationVersion = string.Format("{0}{1}{2}{3}{4}", major, minor, release, dev, pre); + ImageInfo.imageApplicationVersion = + string.Format("{0}{1}{2}{3}{4}", major, minor, release, dev, pre); ImageInfo.imageApplication = version.VersionString; ImageInfo.imageComments = version.VersionMessage; } @@ -515,8 +508,10 @@ namespace DiscImageChef.ImagePlugins Resource dCpyRsrc = rsrcFork.GetResource(0x64437079); if(dCpyRsrc != null) { - string dCpy = StringHandlers.PascalToString(dCpyRsrc.GetResource(dCpyRsrc.GetIds()[0]), Encoding.GetEncoding("macintosh")); - string dCpyRegEx = "(?<application>\\S+)\\s(?<version>\\S+)\\rData checksum=\\$(?<checksum>\\S+)$"; + string dCpy = StringHandlers.PascalToString(dCpyRsrc.GetResource(dCpyRsrc.GetIds()[0]), + Encoding.GetEncoding("macintosh")); + string dCpyRegEx = + "(?<application>\\S+)\\s(?<version>\\S+)\\rData checksum=\\$(?<checksum>\\S+)$"; Regex dCpyEx = new Regex(dCpyRegEx); Match dCpyMatch = dCpyEx.Match(dCpy); @@ -534,70 +529,72 @@ namespace DiscImageChef.ImagePlugins } } catch(InvalidCastException) { } - DicConsole.DebugWriteLine("DC42 plugin", "Image application = {0} version {1}", ImageInfo.imageApplication, ImageInfo.imageApplicationVersion); + + DicConsole.DebugWriteLine("DC42 plugin", "Image application = {0} version {1}", ImageInfo.imageApplication, + ImageInfo.imageApplicationVersion); ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; DicConsole.VerboseWriteLine("DiskCopy 4.2 image contains a disk of type {0}", ImageInfo.mediaType); - switch(ImageInfo.mediaType) - { - case MediaType.AppleSonySS: - ImageInfo.cylinders = 80; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 10; - break; - case MediaType.AppleSonyDS: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 10; - break; - case MediaType.DOS_35_DS_DD_9: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 9; - break; - case MediaType.DOS_35_HD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 18; - break; - case MediaType.DMF: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 21; - break; - case MediaType.AppleProfile: - switch(ImageInfo.sectors) - { - case 9728: - ImageInfo.cylinders = 152; - break; - case 19456: - ImageInfo.cylinders = 304; - break; - } - ImageInfo.heads = 4; - ImageInfo.sectorsPerTrack = 16; - break; - case MediaType.AppleWidget: - ImageInfo.cylinders = 608; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 16; - break; - case MediaType.AppleHD20: - ImageInfo.cylinders = 610; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 16; - break; - default: - ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); - ImageInfo.heads = 16; - ImageInfo.sectorsPerTrack = 63; - break; - } + switch(ImageInfo.mediaType) + { + case MediaType.AppleSonySS: + ImageInfo.cylinders = 80; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 10; + break; + case MediaType.AppleSonyDS: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 10; + break; + case MediaType.DOS_35_DS_DD_9: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 9; + break; + case MediaType.DOS_35_HD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 18; + break; + case MediaType.DMF: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 21; + break; + case MediaType.AppleProfile: + switch(ImageInfo.sectors) + { + case 9728: + ImageInfo.cylinders = 152; + break; + case 19456: + ImageInfo.cylinders = 304; + break; + } + ImageInfo.heads = 4; + ImageInfo.sectorsPerTrack = 16; + break; + case MediaType.AppleWidget: + ImageInfo.cylinders = 608; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 16; + break; + case MediaType.AppleHD20: + ImageInfo.cylinders = 610; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 16; + break; + default: + ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); + ImageInfo.heads = 16; + ImageInfo.sectorsPerTrack = 63; + break; + } - return true; + return true; } public override bool? VerifySector(ulong sectorAddress) @@ -610,24 +607,24 @@ namespace DiscImageChef.ImagePlugins return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); return null; } @@ -652,7 +649,7 @@ namespace DiscImageChef.ImagePlugins if(header.tagSize > 0) { DicConsole.DebugWriteLine("DC42 plugin", "Reading tags"); - Stream tagstream = dc42ImageFilter.GetDataForkStream(); + Stream tagstream = dc42ImageFilter.GetDataForkStream(); tagstream.Seek((tagOffset), SeekOrigin.Begin); tagstream.Read(tags, 0, (int)header.tagSize); @@ -707,7 +704,8 @@ namespace DiscImageChef.ImagePlugins if(twiggy) { - Array.Copy(twiggyCache, (int)sectorAddress * ImageInfo.sectorSize, buffer, 0, length * ImageInfo.sectorSize); + Array.Copy(twiggyCache, (int)sectorAddress * ImageInfo.sectorSize, buffer, 0, + length * ImageInfo.sectorSize); } else { @@ -724,8 +722,7 @@ namespace DiscImageChef.ImagePlugins if(tag != SectorTagType.AppleSectorTag) throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); - if(header.tagSize == 0) - throw new FeatureNotPresentImageException("Disk image does not have tags"); + if(header.tagSize == 0) throw new FeatureNotPresentImageException("Disk image does not have tags"); if(sectorAddress > ImageInfo.sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); @@ -735,10 +732,7 @@ namespace DiscImageChef.ImagePlugins byte[] buffer = new byte[length * bptag]; - if(twiggy) - { - Array.Copy(twiggyCacheTags, (int)sectorAddress * bptag, buffer, 0, length * bptag); - } + if(twiggy) { Array.Copy(twiggyCacheTags, (int)sectorAddress * bptag, buffer, 0, length * bptag); } else { Stream stream = dc42ImageFilter.GetDataForkStream(); @@ -768,7 +762,8 @@ namespace DiscImageChef.ImagePlugins for(uint i = 0; i < length; i++) { - Array.Copy(data, i * (ImageInfo.sectorSize), buffer, i * (ImageInfo.sectorSize + bptag), ImageInfo.sectorSize); + Array.Copy(data, i * (ImageInfo.sectorSize), buffer, i * (ImageInfo.sectorSize + bptag), + ImageInfo.sectorSize); Array.Copy(tags, i * (bptag), buffer, i * (ImageInfo.sectorSize + bptag) + ImageInfo.sectorSize, bptag); } @@ -816,7 +811,6 @@ namespace DiscImageChef.ImagePlugins } #region Unsupported features - public override byte[] ReadDiskTag(MediaTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -936,16 +930,13 @@ namespace DiscImageChef.ImagePlugins { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - #endregion Unsupported features #region Private methods - private static uint DC42CheckSum(byte[] buffer) { uint dc42chk = 0; - if((buffer.Length & 0x01) == 0x01) - return 0xFFFFFFFF; + if((buffer.Length & 0x01) == 0x01) return 0xFFFFFFFF; for(uint i = 0; i < buffer.Length; i += 2) { @@ -953,10 +944,9 @@ namespace DiscImageChef.ImagePlugins dc42chk += buffer[i + 1]; dc42chk = (dc42chk >> 1) | (dc42chk << 31); } + return dc42chk; } - #endregion } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/DriDiskCopy.cs b/DiscImageChef.DiscImages/DriDiskCopy.cs index e8cb81e7..0d4d4b80 100644 --- a/DiscImageChef.DiscImages/DriDiskCopy.cs +++ b/DiscImageChef.DiscImages/DriDiskCopy.cs @@ -41,602 +41,587 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class DriDiskCopy : ImagePlugin - { - #region Internal Structures - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct DRIFooter - { - /// <summary>Signature: "DiskImage 2.01 (C) 1990,1991 Digital Research Inc\0"</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] - public byte[] signature; - /// <summary>Information about the disk image, mostly imitates FAT BPB</summary> - public DRIBPB bpb; - /// <summary>Information about the disk image, mostly imitates FAT BPB, copy</summary> - public DRIBPB bpbcopy; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct DRIBPB - { - /// <summary>Seems to be always 0x05</summary> - public byte five; - /// <summary>A drive code that corresponds (but it not equal to) CMOS drive types</summary> - public DRIDriveCodes driveCode; - /// <summary>Unknown seems to be always 2</summary> - public ushort unknown; - /// <summary>Cylinders</summary> - public ushort cylinders; - /// <summary>Seems to always be 0</summary> - public byte unknown2; - /// <summary>Bytes per sector</summary> - public ushort bps; - /// <summary>Sectors per cluster</summary> - public byte spc; - /// <summary>Sectors between BPB and FAT</summary> - public ushort rsectors; - /// <summary>How many FATs</summary> - public byte fats_no; - /// <summary>Entries in root directory</summary> - public ushort root_entries; - /// <summary>Total sectors</summary> - public ushort sectors; - /// <summary>Media descriptor</summary> - public byte media_descriptor; - /// <summary>Sectors per FAT</summary> - public ushort spfat; - /// <summary>Sectors per track</summary> - public ushort sptrack; - /// <summary>Heads</summary> - public ushort heads; - /// <summary>Hidden sectors before BPB</summary> - public uint hsectors; - /// <summary>Drive number</summary> - public byte drive_no; - /// <summary>Seems to be 0</summary> - public ulong unknown3; - /// <summary>Seems to be 0</summary> - public byte unknown4; - /// <summary>Sectors per track (again?)</summary> - public ushort sptrack2; - /// <summary>Seems to be 0</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 144)] - public byte[] unknown5; - } - - #endregion - - #region Internal Constants - - /// <summary> - /// Drive codes change according to CMOS stored valued - /// </summary> - enum DRIDriveCodes : byte - { - /// <summary>5.25" 360k</summary> - md2dd = 0, - /// <summary>5.25" 1.2M</summary> - md2hd = 1, - /// <summary>3.5" 720k</summary> - mf2dd = 2, - /// <summary>3.5" 1.44M</summary> - mf2hd = 7, - /// <summary>3.5" 2.88M</summary> - mf2ed = 9 - } - - const string DRIRegEx = "DiskImage\\s(?<version>\\d+.\\d+)\\s\\(C\\)\\s\\d+\\,*\\d*\\s+Digital Research Inc"; - - #endregion - - #region Internal variables - - /// <summary>Footer of opened image</summary> - DRIFooter footer; - /// <summary>Disk image file</summary> - Filter driImageFilter; - - #endregion - - public DriDiskCopy() - { - Name = "Digital Research DiskCopy"; - PluginUUID = new Guid("9F0BE551-8BAB-4038-8B5A-691F1BF5FFF3"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = false; - ImageInfo.imageHasSessions = false; - ImageInfo.imageApplication = "DiskCopy"; - ImageInfo.imageCreator = null; - ImageInfo.imageComments = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaSerialNumber = null; - ImageInfo.mediaBarcode = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - - if((stream.Length - Marshal.SizeOf(typeof(DRIFooter))) % 512 != 0) - return false; - - byte[] buffer = new byte[Marshal.SizeOf(typeof(DRIFooter))]; - stream.Seek(-buffer.Length, SeekOrigin.End); - stream.Read(buffer, 0, buffer.Length); - - DRIFooter tmp_footer = new DRIFooter(); - IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length); - Marshal.Copy(buffer, 0, ftrPtr, buffer.Length); - tmp_footer = (DRIFooter)Marshal.PtrToStructure(ftrPtr, typeof(DRIFooter)); - Marshal.FreeHGlobal(ftrPtr); - - string sig = StringHandlers.CToString(tmp_footer.signature); - - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.signature = \"{0}\"", sig); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.five = {0}", tmp_footer.bpb.five); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.driveCode = {0}", tmp_footer.bpb.driveCode); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.unknown = {0}", tmp_footer.bpb.unknown); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.cylinders = {0}", tmp_footer.bpb.cylinders); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.unknown2 = {0}", tmp_footer.bpb.unknown2); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.bps = {0}", tmp_footer.bpb.bps); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.spc = {0}", tmp_footer.bpb.spc); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.rsectors = {0}", tmp_footer.bpb.rsectors); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.fats_no = {0}", tmp_footer.bpb.fats_no); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.sectors = {0}", tmp_footer.bpb.sectors); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.media_descriptor = {0}", tmp_footer.bpb.media_descriptor); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.spfat = {0}", tmp_footer.bpb.spfat); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.sptrack = {0}", tmp_footer.bpb.sptrack); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.heads = {0}", tmp_footer.bpb.heads); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.hsectors = {0}", tmp_footer.bpb.hsectors); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.drive_no = {0}", tmp_footer.bpb.drive_no); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.unknown3 = {0}", tmp_footer.bpb.unknown3); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.unknown4 = {0}", tmp_footer.bpb.unknown4); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.sptrack2 = {0}", tmp_footer.bpb.sptrack2); - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "ArrayHelpers.ArrayIsNullOrEmpty(tmp_footer.bpb.unknown5) = {0}", ArrayHelpers.ArrayIsNullOrEmpty(tmp_footer.bpb.unknown5)); - - Regex RegexSignature = new Regex(DRIRegEx); - Match MatchSignature = RegexSignature.Match(sig); - - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "MatchSignature.Success? = {0}", MatchSignature.Success); - - if(!MatchSignature.Success) - return false; - - if(tmp_footer.bpb.sptrack * tmp_footer.bpb.cylinders * tmp_footer.bpb.heads != tmp_footer.bpb.sectors) - return false; - - if((tmp_footer.bpb.sectors * tmp_footer.bpb.bps) + Marshal.SizeOf(tmp_footer) != stream.Length) - return false; - - return true; - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - - if((stream.Length - Marshal.SizeOf(typeof(DRIFooter))) % 512 != 0) - return false; - - byte[] buffer = new byte[Marshal.SizeOf(typeof(DRIFooter))]; - stream.Seek(-buffer.Length, SeekOrigin.End); - stream.Read(buffer, 0, buffer.Length); - - footer = new DRIFooter(); - IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length); - Marshal.Copy(buffer, 0, ftrPtr, buffer.Length); - footer = (DRIFooter)Marshal.PtrToStructure(ftrPtr, typeof(DRIFooter)); - Marshal.FreeHGlobal(ftrPtr); - - string sig = StringHandlers.CToString(footer.signature); - - Regex RegexSignature = new Regex(DRIRegEx); - Match MatchSignature = RegexSignature.Match(sig); - - if(!MatchSignature.Success) - return false; - - if(footer.bpb.sptrack * footer.bpb.cylinders * footer.bpb.heads != footer.bpb.sectors) - return false; - - if((footer.bpb.sectors * footer.bpb.bps) + Marshal.SizeOf(footer) != stream.Length) - return false; - - ImageInfo.cylinders = footer.bpb.cylinders; - ImageInfo.heads = footer.bpb.heads; - ImageInfo.sectorsPerTrack = footer.bpb.sptrack; - ImageInfo.sectors = footer.bpb.sectors; - ImageInfo.sectorSize = footer.bpb.bps; - ImageInfo.imageApplicationVersion = MatchSignature.Groups["version"].Value; - - driImageFilter = imageFilter; - - ImageInfo.imageSize = (ulong)(stream.Length - Marshal.SizeOf(footer)); - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - - DicConsole.DebugWriteLine("DRI DiskCopy plugin", "Image application = {0} version {1}", ImageInfo.imageApplication, ImageInfo.imageApplicationVersion); - - // Correct some incorrect data in images of NEC 2HD disks - if(ImageInfo.cylinders == 77 && ImageInfo.heads == 2 && ImageInfo.sectorsPerTrack == 16 && ImageInfo.sectorSize == 512 && (footer.bpb.driveCode == DRIDriveCodes.md2hd || footer.bpb.driveCode == DRIDriveCodes.mf2hd)) - { - ImageInfo.sectorsPerTrack = 8; - ImageInfo.sectorSize = 1024; - } - - switch(footer.bpb.driveCode) - { - case DRIDriveCodes.md2hd: - if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_HD; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 16 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ACORN_525_DS_DD; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 16 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ACORN_525_SS_DD_80; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ACORN_525_SS_SD_80; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 77 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 1024) - ImageInfo.mediaType = MediaType.NEC_525_HD; - else - goto case DRIDriveCodes.md2dd; - break; - case DRIDriveCodes.md2dd: - if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && ImageInfo.sectorSize == 128) - ImageInfo.mediaType = MediaType.ATARI_525_SD; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 26 && ImageInfo.sectorSize == 128) - ImageInfo.mediaType = MediaType.ATARI_525_ED; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ATARI_525_DD; - else - ImageInfo.mediaType = MediaType.Unknown; - break; - case DRIDriveCodes.mf2ed: - if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 36 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_ED; - else - goto case DRIDriveCodes.mf2hd; - break; - case DRIDriveCodes.mf2hd: - if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 18 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_HD; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 21 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DMF; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 82 && ImageInfo.sectorsPerTrack == 21 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DMF_82; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 77 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 1024) - ImageInfo.mediaType = MediaType.NEC_35_HD_8; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.NEC_35_HD_15; - else - goto case DRIDriveCodes.mf2dd; - break; - case DRIDriveCodes.mf2dd: - if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 5 && ImageInfo.sectorSize == 1024) - ImageInfo.mediaType = MediaType.ACORN_35_DS_DD; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 70 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.Apricot_35; - else - ImageInfo.mediaType = MediaType.Unknown; - break; - default: - ImageInfo.mediaType = MediaType.Unknown; - break; - } - - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - DicConsole.VerboseWriteLine("Digital Research DiskCopy image contains a disk of type {0}", ImageInfo.mediaType); - - return true; - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifyMediaImage() - { - return null; - } - - public override bool ImageHasPartitions() - { - return ImageInfo.imageHasPartitions; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] buffer = new byte[length * ImageInfo.sectorSize]; - - Stream stream = driImageFilter.GetDataForkStream(); - stream.Seek((long)(sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); - stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); - - return buffer; - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetImageFormat() - { - return "Digital Research DiskCopy"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override string GetMediaManufacturer() - { - return ImageInfo.mediaManufacturer; - } - - public override string GetMediaModel() - { - return ImageInfo.mediaModel; - } - - public override string GetMediaSerialNumber() - { - return ImageInfo.mediaSerialNumber; - } - - public override string GetMediaBarcode() - { - return ImageInfo.mediaBarcode; - } - - public override string GetMediaPartNumber() - { - return ImageInfo.mediaPartNumber; - } - - public override int GetMediaSequence() - { - return ImageInfo.mediaSequence; - } - - public override int GetLastDiskSequence() - { - return ImageInfo.lastMediaSequence; - } - - public override string GetDriveManufacturer() - { - return ImageInfo.driveManufacturer; - } - - public override string GetDriveModel() - { - return ImageInfo.driveModel; - } - - public override string GetDriveSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - #endregion Unsupported features - - #region Private methods - - private static uint DC42CheckSum(byte[] buffer) - { - uint dc42chk = 0; - if((buffer.Length & 0x01) == 0x01) - return 0xFFFFFFFF; - - for(uint i = 0; i < buffer.Length; i += 2) - { - dc42chk += (uint)(buffer[i] << 8); - dc42chk += buffer[i + 1]; - dc42chk = (dc42chk >> 1) | (dc42chk << 31); - } - return dc42chk; - } - - #endregion - } -} - + public class DriDiskCopy : ImagePlugin + { + #region Internal Structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct DRIFooter + { + /// <summary>Signature: "DiskImage 2.01 (C) 1990,1991 Digital Research Inc\0"</summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] public byte[] signature; + /// <summary>Information about the disk image, mostly imitates FAT BPB</summary> + public DRIBPB bpb; + /// <summary>Information about the disk image, mostly imitates FAT BPB, copy</summary> + public DRIBPB bpbcopy; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct DRIBPB + { + /// <summary>Seems to be always 0x05</summary> + public byte five; + /// <summary>A drive code that corresponds (but it not equal to) CMOS drive types</summary> + public DRIDriveCodes driveCode; + /// <summary>Unknown seems to be always 2</summary> + public ushort unknown; + /// <summary>Cylinders</summary> + public ushort cylinders; + /// <summary>Seems to always be 0</summary> + public byte unknown2; + /// <summary>Bytes per sector</summary> + public ushort bps; + /// <summary>Sectors per cluster</summary> + public byte spc; + /// <summary>Sectors between BPB and FAT</summary> + public ushort rsectors; + /// <summary>How many FATs</summary> + public byte fats_no; + /// <summary>Entries in root directory</summary> + public ushort root_entries; + /// <summary>Total sectors</summary> + public ushort sectors; + /// <summary>Media descriptor</summary> + public byte media_descriptor; + /// <summary>Sectors per FAT</summary> + public ushort spfat; + /// <summary>Sectors per track</summary> + public ushort sptrack; + /// <summary>Heads</summary> + public ushort heads; + /// <summary>Hidden sectors before BPB</summary> + public uint hsectors; + /// <summary>Drive number</summary> + public byte drive_no; + /// <summary>Seems to be 0</summary> + public ulong unknown3; + /// <summary>Seems to be 0</summary> + public byte unknown4; + /// <summary>Sectors per track (again?)</summary> + public ushort sptrack2; + /// <summary>Seems to be 0</summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 144)] public byte[] unknown5; + } + #endregion + + #region Internal Constants + /// <summary> + /// Drive codes change according to CMOS stored valued + /// </summary> + enum DRIDriveCodes : byte + { + /// <summary>5.25" 360k</summary> + md2dd = 0, + /// <summary>5.25" 1.2M</summary> + md2hd = 1, + /// <summary>3.5" 720k</summary> + mf2dd = 2, + /// <summary>3.5" 1.44M</summary> + mf2hd = 7, + /// <summary>3.5" 2.88M</summary> + mf2ed = 9 + } + + const string DRIRegEx = "DiskImage\\s(?<version>\\d+.\\d+)\\s\\(C\\)\\s\\d+\\,*\\d*\\s+Digital Research Inc"; + #endregion + + #region Internal variables + /// <summary>Footer of opened image</summary> + DRIFooter footer; + /// <summary>Disk image file</summary> + Filter driImageFilter; + #endregion + + public DriDiskCopy() + { + Name = "Digital Research DiskCopy"; + PluginUUID = new Guid("9F0BE551-8BAB-4038-8B5A-691F1BF5FFF3"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = false; + ImageInfo.imageHasSessions = false; + ImageInfo.imageApplication = "DiskCopy"; + ImageInfo.imageCreator = null; + ImageInfo.imageComments = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaSerialNumber = null; + ImageInfo.mediaBarcode = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + + if((stream.Length - Marshal.SizeOf(typeof(DRIFooter))) % 512 != 0) return false; + + byte[] buffer = new byte[Marshal.SizeOf(typeof(DRIFooter))]; + stream.Seek(-buffer.Length, SeekOrigin.End); + stream.Read(buffer, 0, buffer.Length); + + DRIFooter tmp_footer = new DRIFooter(); + IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length); + Marshal.Copy(buffer, 0, ftrPtr, buffer.Length); + tmp_footer = (DRIFooter)Marshal.PtrToStructure(ftrPtr, typeof(DRIFooter)); + Marshal.FreeHGlobal(ftrPtr); + + string sig = StringHandlers.CToString(tmp_footer.signature); + + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.signature = \"{0}\"", sig); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.five = {0}", tmp_footer.bpb.five); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.driveCode = {0}", + tmp_footer.bpb.driveCode); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.unknown = {0}", tmp_footer.bpb.unknown); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.cylinders = {0}", + tmp_footer.bpb.cylinders); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.unknown2 = {0}", tmp_footer.bpb.unknown2); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.bps = {0}", tmp_footer.bpb.bps); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.spc = {0}", tmp_footer.bpb.spc); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.rsectors = {0}", tmp_footer.bpb.rsectors); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.fats_no = {0}", tmp_footer.bpb.fats_no); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.sectors = {0}", tmp_footer.bpb.sectors); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.media_descriptor = {0}", + tmp_footer.bpb.media_descriptor); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.spfat = {0}", tmp_footer.bpb.spfat); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.sptrack = {0}", tmp_footer.bpb.sptrack); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.heads = {0}", tmp_footer.bpb.heads); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.hsectors = {0}", tmp_footer.bpb.hsectors); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.drive_no = {0}", tmp_footer.bpb.drive_no); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.unknown3 = {0}", tmp_footer.bpb.unknown3); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.unknown4 = {0}", tmp_footer.bpb.unknown4); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "tmp_footer.bpb.sptrack2 = {0}", tmp_footer.bpb.sptrack2); + DicConsole.DebugWriteLine("DRI DiskCopy plugin", + "ArrayHelpers.ArrayIsNullOrEmpty(tmp_footer.bpb.unknown5) = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(tmp_footer.bpb.unknown5)); + + Regex RegexSignature = new Regex(DRIRegEx); + Match MatchSignature = RegexSignature.Match(sig); + + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "MatchSignature.Success? = {0}", MatchSignature.Success); + + if(!MatchSignature.Success) return false; + + if(tmp_footer.bpb.sptrack * tmp_footer.bpb.cylinders * tmp_footer.bpb.heads != + tmp_footer.bpb.sectors) return false; + + if((tmp_footer.bpb.sectors * tmp_footer.bpb.bps) + Marshal.SizeOf(tmp_footer) != stream.Length) + return false; + + return true; + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + + if((stream.Length - Marshal.SizeOf(typeof(DRIFooter))) % 512 != 0) return false; + + byte[] buffer = new byte[Marshal.SizeOf(typeof(DRIFooter))]; + stream.Seek(-buffer.Length, SeekOrigin.End); + stream.Read(buffer, 0, buffer.Length); + + footer = new DRIFooter(); + IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length); + Marshal.Copy(buffer, 0, ftrPtr, buffer.Length); + footer = (DRIFooter)Marshal.PtrToStructure(ftrPtr, typeof(DRIFooter)); + Marshal.FreeHGlobal(ftrPtr); + + string sig = StringHandlers.CToString(footer.signature); + + Regex RegexSignature = new Regex(DRIRegEx); + Match MatchSignature = RegexSignature.Match(sig); + + if(!MatchSignature.Success) return false; + + if(footer.bpb.sptrack * footer.bpb.cylinders * footer.bpb.heads != footer.bpb.sectors) return false; + + if((footer.bpb.sectors * footer.bpb.bps) + Marshal.SizeOf(footer) != stream.Length) return false; + + ImageInfo.cylinders = footer.bpb.cylinders; + ImageInfo.heads = footer.bpb.heads; + ImageInfo.sectorsPerTrack = footer.bpb.sptrack; + ImageInfo.sectors = footer.bpb.sectors; + ImageInfo.sectorSize = footer.bpb.bps; + ImageInfo.imageApplicationVersion = MatchSignature.Groups["version"].Value; + + driImageFilter = imageFilter; + + ImageInfo.imageSize = (ulong)(stream.Length - Marshal.SizeOf(footer)); + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + + DicConsole.DebugWriteLine("DRI DiskCopy plugin", "Image application = {0} version {1}", + ImageInfo.imageApplication, ImageInfo.imageApplicationVersion); + + // Correct some incorrect data in images of NEC 2HD disks + if(ImageInfo.cylinders == 77 && ImageInfo.heads == 2 && ImageInfo.sectorsPerTrack == 16 && + ImageInfo.sectorSize == 512 && + (footer.bpb.driveCode == DRIDriveCodes.md2hd || footer.bpb.driveCode == DRIDriveCodes.mf2hd)) + { + ImageInfo.sectorsPerTrack = 8; + ImageInfo.sectorSize = 1024; + } + + switch(footer.bpb.driveCode) + { + case DRIDriveCodes.md2hd: + if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_HD; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 16 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ACORN_525_DS_DD; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 16 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ACORN_525_SS_DD_80; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ACORN_525_SS_SD_80; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 77 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 1024) ImageInfo.mediaType = MediaType.NEC_525_HD; + else goto case DRIDriveCodes.md2dd; + break; + case DRIDriveCodes.md2dd: + if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && + ImageInfo.sectorSize == 128) ImageInfo.mediaType = MediaType.ATARI_525_SD; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 26 && + ImageInfo.sectorSize == 128) ImageInfo.mediaType = MediaType.ATARI_525_ED; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ATARI_525_DD; + else ImageInfo.mediaType = MediaType.Unknown; + break; + case DRIDriveCodes.mf2ed: + if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 36 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_ED; + else goto case DRIDriveCodes.mf2hd; + break; + case DRIDriveCodes.mf2hd: + if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 18 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_HD; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 21 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DMF; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 82 && ImageInfo.sectorsPerTrack == 21 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DMF_82; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 77 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 1024) ImageInfo.mediaType = MediaType.NEC_35_HD_8; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.NEC_35_HD_15; + else goto case DRIDriveCodes.mf2dd; + break; + case DRIDriveCodes.mf2dd: + if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 5 && + ImageInfo.sectorSize == 1024) ImageInfo.mediaType = MediaType.ACORN_35_DS_DD; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 70 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.Apricot_35; + else ImageInfo.mediaType = MediaType.Unknown; + break; + default: + ImageInfo.mediaType = MediaType.Unknown; + break; + } + + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + DicConsole.VerboseWriteLine("Digital Research DiskCopy image contains a disk of type {0}", + ImageInfo.mediaType); + + return true; + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifyMediaImage() + { + return null; + } + + public override bool ImageHasPartitions() + { + return ImageInfo.imageHasPartitions; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] buffer = new byte[length * ImageInfo.sectorSize]; + + Stream stream = driImageFilter.GetDataForkStream(); + stream.Seek((long)(sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); + stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); + + return buffer; + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetImageFormat() + { + return "Digital Research DiskCopy"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override string GetMediaManufacturer() + { + return ImageInfo.mediaManufacturer; + } + + public override string GetMediaModel() + { + return ImageInfo.mediaModel; + } + + public override string GetMediaSerialNumber() + { + return ImageInfo.mediaSerialNumber; + } + + public override string GetMediaBarcode() + { + return ImageInfo.mediaBarcode; + } + + public override string GetMediaPartNumber() + { + return ImageInfo.mediaPartNumber; + } + + public override int GetMediaSequence() + { + return ImageInfo.mediaSequence; + } + + public override int GetLastDiskSequence() + { + return ImageInfo.lastMediaSequence; + } + + public override string GetDriveManufacturer() + { + return ImageInfo.driveManufacturer; + } + + public override string GetDriveModel() + { + return ImageInfo.driveModel; + } + + public override string GetDriveSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + #endregion Unsupported features + + #region Private methods + private static uint DC42CheckSum(byte[] buffer) + { + uint dc42chk = 0; + if((buffer.Length & 0x01) == 0x01) return 0xFFFFFFFF; + + for(uint i = 0; i < buffer.Length; i += 2) + { + dc42chk += (uint)(buffer[i] << 8); + dc42chk += buffer[i + 1]; + dc42chk = (dc42chk >> 1) | (dc42chk << 31); + } + + return dc42chk; + } + #endregion + } +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/GDI.cs b/DiscImageChef.DiscImages/GDI.cs index 50edad14..26fc2494 100644 --- a/DiscImageChef.DiscImages/GDI.cs +++ b/DiscImageChef.DiscImages/GDI.cs @@ -40,12 +40,11 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - // TODO: There seems no be no clear definition on how to treat pregaps that are not included in the file, so this is just appending it to start of track - // TODO: This format doesn't support to specify pregaps that are included in the file (like Redump ones) - public class GDI : ImagePlugin + // TODO: There seems no be no clear definition on how to treat pregaps that are not included in the file, so this is just appending it to start of track + // TODO: This format doesn't support to specify pregaps that are included in the file (like Redump ones) + public class GDI : ImagePlugin { #region Internal structures - struct GDITrack { /// <summary>Track #</summary> @@ -81,11 +80,9 @@ namespace DiscImageChef.ImagePlugins /// <summary>Disk type</summary> public MediaType disktype; } - #endregion Internal structures #region Internal variables - StreamReader gdiStream; Stream imageStream; /// <summary>Dictionary, index is track #, value is track number, or 0 if a TOC</summary> @@ -93,17 +90,15 @@ namespace DiscImageChef.ImagePlugins GDIDisc discimage; List<Partition> partitions; ulong densitySeparationSectors; - #endregion Internal variables #region Parsing regexs - - const string TrackRegEx = "\\s?(?<track>\\d+)\\s+(?<start>\\d+)\\s(?<flags>\\d)\\s(?<type>2352|2048)\\s(?<filename>.+)\\s(?<offset>\\d+)$"; - + const string TrackRegEx = + "\\s?(?<track>\\d+)\\s+(?<start>\\d+)\\s(?<flags>\\d)\\s(?<type>2352|2048)\\s(?<filename>.+)\\s(?<offset>\\d+)$" + ; #endregion Parsing regexs #region Public methods - public GDI() { Name = "Dreamcast GDI image"; @@ -133,30 +128,29 @@ namespace DiscImageChef.ImagePlugins { try { - imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); - byte[] testArray = new byte[512]; - imageFilter.GetDataForkStream().Read(testArray, 0, 512); - imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); - // Check for unexpected control characters that shouldn't be present in a text file and can crash this plugin - bool twoConsecutiveNulls = false; - for(int i = 0; i < 512; i++) - { - if(i >= imageFilter.GetDataForkStream().Length) - break; + imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); + byte[] testArray = new byte[512]; + imageFilter.GetDataForkStream().Read(testArray, 0, 512); + imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); + // Check for unexpected control characters that shouldn't be present in a text file and can crash this plugin + bool twoConsecutiveNulls = false; + for(int i = 0; i < 512; i++) + { + if(i >= imageFilter.GetDataForkStream().Length) break; - if(testArray[i] == 0) - { - if(twoConsecutiveNulls) - return false; - twoConsecutiveNulls = true; - } - else - twoConsecutiveNulls = false; + if(testArray[i] == 0) + { + if(twoConsecutiveNulls) return false; - if(testArray[i] < 0x20 && testArray[i] != 0x0A && testArray[i] != 0x0D && testArray[i] != 0x00) - return false; - } - gdiStream = new StreamReader(imageFilter.GetDataForkStream()); + twoConsecutiveNulls = true; + } + else twoConsecutiveNulls = false; + + if(testArray[i] < 0x20 && testArray[i] != 0x0A && testArray[i] != 0x0D && testArray[i] != 0x00) + return false; + } + + gdiStream = new StreamReader(imageFilter.GetDataForkStream()); int line = 0; int tracksFound = 0; int tracks = 0; @@ -166,26 +160,20 @@ namespace DiscImageChef.ImagePlugins line++; string _line = gdiStream.ReadLine(); - if(line == 1) - { - if(!int.TryParse(_line, out tracks)) - return false; - } + if(line == 1) { if(!int.TryParse(_line, out tracks)) return false; } else { Regex RegexTrack = new Regex(TrackRegEx); Match TrackMatch = RegexTrack.Match(_line); - if(!TrackMatch.Success) - return false; + if(!TrackMatch.Success) return false; tracksFound++; } } - if(tracks == 0) - return false; + if(tracks == 0) return false; return tracks == tracksFound; } @@ -200,8 +188,7 @@ namespace DiscImageChef.ImagePlugins public override bool OpenImage(Filter imageFilter) { - if(imageFilter == null) - return false; + if(imageFilter == null) return false; try { @@ -228,7 +215,7 @@ namespace DiscImageChef.ImagePlugins GDITrack currentTrack; densitySeparationSectors = 0; - FiltersList filtersList; + FiltersList filtersList; while(gdiStream.Peek() >= 0) { @@ -245,22 +232,29 @@ namespace DiscImageChef.ImagePlugins TrackMatch = RegexTrack.Match(_line); if(!TrackMatch.Success) - throw new ImageNotSupportedException(string.Format("Unknown line \"{0}\" at line {1}", _line, line)); + throw new ImageNotSupportedException(string.Format("Unknown line \"{0}\" at line {1}", + _line, line)); tracksFound++; - DicConsole.DebugWriteLine("GDI plugin", "Found track {0} starts at {1} flags {2} type {3} file {4} offset {5} at line {6}", - TrackMatch.Groups["track"].Value, TrackMatch.Groups["start"].Value, TrackMatch.Groups["flags"].Value, - TrackMatch.Groups["type"].Value, TrackMatch.Groups["filename"].Value, TrackMatch.Groups["offset"].Value, line); + DicConsole.DebugWriteLine("GDI plugin", + "Found track {0} starts at {1} flags {2} type {3} file {4} offset {5} at line {6}", + TrackMatch.Groups["track"].Value, TrackMatch.Groups["start"].Value, + TrackMatch.Groups["flags"].Value, TrackMatch.Groups["type"].Value, + TrackMatch.Groups["filename"].Value, + TrackMatch.Groups["offset"].Value, line); - filtersList = new FiltersList(); + filtersList = new FiltersList(); currentTrack = new GDITrack(); currentTrack.bps = ushort.Parse(TrackMatch.Groups["type"].Value); currentTrack.flags = (byte)(byte.Parse(TrackMatch.Groups["flags"].Value) * 0x10); currentTrack.offset = long.Parse(TrackMatch.Groups["offset"].Value); currentTrack.sequence = uint.Parse(TrackMatch.Groups["track"].Value); currentTrack.startSector = ulong.Parse(TrackMatch.Groups["start"].Value); - currentTrack.trackfilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), TrackMatch.Groups["filename"].Value.Replace("\\\"", "\"").Trim(new[] { '"' }))); + currentTrack.trackfilter = + filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), + TrackMatch.Groups["filename"].Value.Replace("\\\"", "\"") + .Trim(new[] {'"'}))); currentTrack.trackfile = currentTrack.trackfilter.GetFilename(); if((currentTrack.startSector - currentStart) > 0) @@ -279,18 +273,18 @@ namespace DiscImageChef.ImagePlugins } } - if(((currentTrack.trackfilter.GetDataForkLength() - currentTrack.offset) % currentTrack.bps) != 0) - throw new ImageNotSupportedException("Track size not a multiple of sector size"); + if(((currentTrack.trackfilter.GetDataForkLength() - currentTrack.offset) % currentTrack.bps) != + 0) throw new ImageNotSupportedException("Track size not a multiple of sector size"); - currentTrack.sectors = (ulong)((currentTrack.trackfilter.GetDataForkLength() - currentTrack.offset) / currentTrack.bps); + currentTrack.sectors = + (ulong)((currentTrack.trackfilter.GetDataForkLength() - currentTrack.offset) / + currentTrack.bps); currentTrack.sectors += currentTrack.pregap; currentStart += currentTrack.sectors; currentTrack.highDensity = highDensity; - if((currentTrack.flags & 0x40) == 0x40) - currentTrack.tracktype = TrackType.CDMode1; - else - currentTrack.tracktype = TrackType.Audio; + if((currentTrack.flags & 0x40) == 0x40) currentTrack.tracktype = TrackType.CDMode1; + else currentTrack.tracktype = TrackType.Audio; discimage.tracks.Add(currentTrack); } @@ -307,13 +301,10 @@ namespace DiscImageChef.ImagePlugins { if(!trk.highDensity) { - if(_sessions[s].StartTrack == 0) - _sessions[s].StartTrack = trk.sequence; - else if(_sessions[s].StartTrack > trk.sequence) - _sessions[s].StartTrack = trk.sequence; + if(_sessions[s].StartTrack == 0) _sessions[s].StartTrack = trk.sequence; + else if(_sessions[s].StartTrack > trk.sequence) _sessions[s].StartTrack = trk.sequence; - if(_sessions[s].EndTrack < trk.sequence) - _sessions[s].EndTrack = trk.sequence; + if(_sessions[s].EndTrack < trk.sequence) _sessions[s].EndTrack = trk.sequence; if(_sessions[s].StartSector > trk.startSector) _sessions[s].StartSector = trk.startSector; @@ -331,13 +322,10 @@ namespace DiscImageChef.ImagePlugins { if(trk.highDensity) { - if(_sessions[s].StartTrack == 0) - _sessions[s].StartTrack = trk.sequence; - else if(_sessions[s].StartTrack > trk.sequence) - _sessions[s].StartTrack = trk.sequence; + if(_sessions[s].StartTrack == 0) _sessions[s].StartTrack = trk.sequence; + else if(_sessions[s].StartTrack > trk.sequence) _sessions[s].StartTrack = trk.sequence; - if(_sessions[s].EndTrack < trk.sequence) - _sessions[s].EndTrack = trk.sequence; + if(_sessions[s].EndTrack < trk.sequence) _sessions[s].EndTrack = trk.sequence; if(_sessions[s].StartSector > trk.startSector) _sessions[s].StartSector = trk.startSector; @@ -362,11 +350,14 @@ namespace DiscImageChef.ImagePlugins for(int i = 0; i < discimage.sessions.Count; i++) { DicConsole.DebugWriteLine("GDI plugin", "\tSession {0} information:", i + 1); - DicConsole.DebugWriteLine("GDI plugin", "\t\tStarting track: {0}", discimage.sessions[i].StartTrack); - DicConsole.DebugWriteLine("GDI plugin", "\t\tStarting sector: {0}", discimage.sessions[i].StartSector); + DicConsole.DebugWriteLine("GDI plugin", "\t\tStarting track: {0}", + discimage.sessions[i].StartTrack); + DicConsole.DebugWriteLine("GDI plugin", "\t\tStarting sector: {0}", + discimage.sessions[i].StartSector); DicConsole.DebugWriteLine("GDI plugin", "\t\tEnding track: {0}", discimage.sessions[i].EndTrack); DicConsole.DebugWriteLine("GDI plugin", "\t\tEnding sector: {0}", discimage.sessions[i].EndSector); } + DicConsole.DebugWriteLine("GDI plugin", "Track information:"); DicConsole.DebugWriteLine("GDI plugin", "\tDisc contains {0} tracks", discimage.tracks.Count); for(int i = 0; i < discimage.tracks.Count; i++) @@ -384,8 +375,10 @@ namespace DiscImageChef.ImagePlugins if((discimage.tracks[i].flags & 0x10) == 0x10) DicConsole.DebugWriteLine("GDI plugin", "\t\tTrack has pre-emphasis applied"); - DicConsole.DebugWriteLine("GDI plugin", "\t\tTrack resides in file {0}, type defined as {1}, starting at byte {2}", - discimage.tracks[i].trackfilter, discimage.tracks[i].tracktype, discimage.tracks[i].offset); + DicConsole.DebugWriteLine("GDI plugin", + "\t\tTrack resides in file {0}, type defined as {1}, starting at byte {2}", + discimage.tracks[i].trackfilter, discimage.tracks[i].tracktype, + discimage.tracks[i].offset); } DicConsole.DebugWriteLine("GDI plugin", "Building offset map"); @@ -415,10 +408,8 @@ namespace DiscImageChef.ImagePlugins partitions.Add(partition); } - foreach(GDITrack track in discimage.tracks) - ImageInfo.imageSize += track.bps * track.sectors; - foreach(GDITrack track in discimage.tracks) - ImageInfo.sectors += track.sectors; + foreach(GDITrack track in discimage.tracks) ImageInfo.imageSize += track.bps * track.sectors; + foreach(GDITrack track in discimage.tracks) ImageInfo.sectors += track.sectors; ImageInfo.sectors += densitySeparationSectors; @@ -560,7 +551,8 @@ namespace DiscImageChef.ImagePlugins if(track == 0) { if((sectorAddress + length) > densitySeparationSectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks"); + throw new ArgumentOutOfRangeException(nameof(length), + "Requested more sectors than present in track, won't cross tracks"); return new byte[length * 2352]; } @@ -582,7 +574,8 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if((sectorAddress + length) > _track.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks"); + throw new ArgumentOutOfRangeException(nameof(length), + "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; @@ -591,30 +584,29 @@ namespace DiscImageChef.ImagePlugins switch(_track.tracktype) { case TrackType.Audio: + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } + case TrackType.CDMode1: + { + if(_track.bps == 2352) + { + sector_offset = 16; + sector_size = 2048; + sector_skip = 288; + } + else { sector_offset = 0; - sector_size = 2352; + sector_size = 2048; sector_skip = 0; - break; } - case TrackType.CDMode1: - { - if(_track.bps == 2352) - { - sector_offset = 16; - sector_size = 2048; - sector_skip = 288; - } - else - { - sector_offset = 0; - sector_size = 2048; - sector_skip = 0; - } - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; @@ -639,14 +631,14 @@ namespace DiscImageChef.ImagePlugins Array.Copy(zero, 0, buffer, 0, zero.Length); } - if(remainingSectors == 0) - return buffer; + if(remainingSectors == 0) return buffer; imageStream = _track.trackfilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek(_track.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip) + _track.pregap * _track.bps), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * remainingSectors)); + br.BaseStream + .Seek(_track.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip) + _track.pregap * _track.bps), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * remainingSectors)); else { for(ulong i = 0; i < remainingSectors; i++) @@ -667,10 +659,10 @@ namespace DiscImageChef.ImagePlugins if(track == 0) { if((sectorAddress + length) > densitySeparationSectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks"); + throw new ArgumentOutOfRangeException(nameof(length), + "Requested more sectors than present in track, won't cross tracks"); - if(tag == SectorTagType.CDTrackFlags) - return new byte[] { 0x00 }; + if(tag == SectorTagType.CDTrackFlags) return new byte[] {0x00}; throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); } @@ -692,7 +684,8 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(length > _track.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks"); + throw new ArgumentOutOfRangeException(nameof(length), + "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; @@ -705,83 +698,79 @@ namespace DiscImageChef.ImagePlugins case SectorTagType.CDSectorECC_Q: case SectorTagType.CDSectorEDC: case SectorTagType.CDSectorHeader: - case SectorTagType.CDSectorSync: - break; + case SectorTagType.CDSectorSync: break; case SectorTagType.CDTrackFlags: - { - byte[] flags = new byte[1]; + { + byte[] flags = new byte[1]; - flags[0] += _track.flags; + flags[0] += _track.flags; - return flags; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + return flags; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } switch(_track.tracktype) { - case TrackType.Audio: - throw new ArgumentException("There are no tags on audio tracks", nameof(tag)); + case TrackType.Audio: throw new ArgumentException("There are no tags on audio tracks", nameof(tag)); case TrackType.CDMode1: - { - if(_track.bps != 2352) - throw new FeatureNotPresentImageException("Image does not include tags for mode 1 sectors"); + { + if(_track.bps != 2352) + throw new FeatureNotPresentImageException("Image does not include tags for mode 1 sectors"); - switch(tag) + switch(tag) + { + case SectorTagType.CDSectorSync: { - case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } - case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } - case SectorTagType.CDSectorSubchannel: - case SectorTagType.CDSectorSubHeader: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - sector_skip = 104; - break; - } - case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2064; - sector_size = 4; - sector_skip = 284; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; } - break; + case SectorTagType.CDSectorHeader: + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } + case SectorTagType.CDSectorSubchannel: + case SectorTagType.CDSectorSubHeader: + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + case SectorTagType.CDSectorECC: + { + sector_offset = 2076; + sector_size = 276; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorECC_P: + { + sector_offset = 2076; + sector_size = 172; + sector_skip = 104; + break; + } + case SectorTagType.CDSectorECC_Q: + { + sector_offset = 2248; + sector_size = 104; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2064; + sector_size = 4; + sector_skip = 284; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; @@ -806,14 +795,14 @@ namespace DiscImageChef.ImagePlugins Array.Copy(zero, 0, buffer, 0, zero.Length); } - if(remainingSectors == 0) - return buffer; + if(remainingSectors == 0) return buffer; imageStream = _track.trackfilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek(_track.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip) + _track.pregap * _track.bps), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * remainingSectors)); + br.BaseStream + .Seek(_track.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip) + _track.pregap * _track.bps), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * remainingSectors)); else { for(ulong i = 0; i < remainingSectors; i++) @@ -864,7 +853,8 @@ namespace DiscImageChef.ImagePlugins if(track == 0) { if((sectorAddress + length) > densitySeparationSectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks"); + throw new ArgumentOutOfRangeException(nameof(length), + "Requested more sectors than present in track, won't cross tracks"); return new byte[length * 2352]; } @@ -886,7 +876,8 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if((sectorAddress + length) > _track.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks"); + throw new ArgumentOutOfRangeException(nameof(length), + "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; @@ -895,30 +886,29 @@ namespace DiscImageChef.ImagePlugins switch(_track.tracktype) { case TrackType.Audio: + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } + case TrackType.CDMode1: + { + if(_track.bps == 2352) { sector_offset = 0; sector_size = 2352; sector_skip = 0; - break; } - case TrackType.CDMode1: + else { - if(_track.bps == 2352) - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 0; - } - else - { - sector_offset = 0; - sector_size = 2048; - sector_skip = 0; - } - break; + sector_offset = 0; + sector_size = 2048; + sector_skip = 0; } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; @@ -943,14 +933,14 @@ namespace DiscImageChef.ImagePlugins Array.Copy(zero, 0, buffer, 0, zero.Length); } - if(remainingSectors == 0) - return buffer; + if(remainingSectors == 0) return buffer; imageStream = _track.trackfilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek(_track.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip) + _track.pregap * _track.bps), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * remainingSectors)); + br.BaseStream + .Seek(_track.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip) + _track.pregap * _track.bps), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * remainingSectors)); else { for(ulong i = 0; i < remainingSectors; i++) @@ -1034,10 +1024,8 @@ namespace DiscImageChef.ImagePlugins _track.TrackStartSector = gdi_track.startSector; _track.TrackEndSector = _track.TrackStartSector + gdi_track.sectors - 1; _track.TrackPregap = gdi_track.pregap; - if(gdi_track.highDensity) - _track.TrackSession = 2; - else - _track.TrackSession = 1; + if(gdi_track.highDensity) _track.TrackSession = 2; + else _track.TrackSession = 1; _track.TrackSequence = gdi_track.sequence; _track.TrackType = gdi_track.tracktype; _track.TrackFilter = gdi_track.trackfilter; @@ -1045,10 +1033,8 @@ namespace DiscImageChef.ImagePlugins _track.TrackFileOffset = (ulong)gdi_track.offset; _track.TrackFileType = "BINARY"; _track.TrackRawBytesPerSector = gdi_track.bps; - if(gdi_track.tracktype == TrackType.Data) - _track.TrackBytesPerSector = 2048; - else - _track.TrackBytesPerSector = 2352; + if(gdi_track.tracktype == TrackType.Data) _track.TrackBytesPerSector = 2048; + else _track.TrackBytesPerSector = 2352; _track.TrackSubchannelType = TrackSubchannelType.None; tracks.Add(_track); @@ -1059,10 +1045,8 @@ namespace DiscImageChef.ImagePlugins public override List<Track> GetSessionTracks(Session session) { - if(discimage.sessions.Contains(session)) - { - return GetSessionTracks(session.SessionSequence); - } + if(discimage.sessions.Contains(session)) { return GetSessionTracks(session.SessionSequence); } + throw new ImageNotSupportedException("Session does not exist in disc image"); } @@ -1079,8 +1063,7 @@ namespace DiscImageChef.ImagePlugins case 2: expectedDensity = true; break; - default: - throw new ImageNotSupportedException("Session does not exist in disc image"); + default: throw new ImageNotSupportedException("Session does not exist in disc image"); } foreach(GDITrack gdi_track in discimage.tracks) @@ -1094,10 +1077,8 @@ namespace DiscImageChef.ImagePlugins _track.TrackStartSector = gdi_track.startSector; _track.TrackEndSector = _track.TrackStartSector + gdi_track.sectors - 1; _track.TrackPregap = gdi_track.pregap; - if(gdi_track.highDensity) - _track.TrackSession = 2; - else - _track.TrackSession = 1; + if(gdi_track.highDensity) _track.TrackSession = 2; + else _track.TrackSession = 1; _track.TrackSequence = gdi_track.sequence; _track.TrackType = gdi_track.tracktype; _track.TrackFilter = gdi_track.trackfilter; @@ -1105,10 +1086,8 @@ namespace DiscImageChef.ImagePlugins _track.TrackFileOffset = (ulong)gdi_track.offset; _track.TrackFileType = "BINARY"; _track.TrackRawBytesPerSector = gdi_track.bps; - if(gdi_track.tracktype == TrackType.Data) - _track.TrackBytesPerSector = 2048; - else - _track.TrackBytesPerSector = 2352; + if(gdi_track.tracktype == TrackType.Data) _track.TrackBytesPerSector = 2048; + else _track.TrackBytesPerSector = 2352; _track.TrackSubchannelType = TrackSubchannelType.None; tracks.Add(_track); @@ -1135,7 +1114,8 @@ namespace DiscImageChef.ImagePlugins return Checksums.CDChecksums.CheckCDSector(buffer); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); @@ -1159,14 +1139,14 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length, track); int bps = (int)(buffer.Length / length); @@ -1190,10 +1170,9 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } @@ -1201,11 +1180,9 @@ namespace DiscImageChef.ImagePlugins { return null; } - #endregion Public methods #region Unsupported features - public override int GetMediaSequence() { return ImageInfo.mediaSequence; @@ -1255,8 +1232,6 @@ namespace DiscImageChef.ImagePlugins { return ImageInfo.imageCreator; } - #endregion Unsupported features } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/HDCopy.cs b/DiscImageChef.DiscImages/HDCopy.cs index 51e7947e..e36c61e2 100644 --- a/DiscImageChef.DiscImages/HDCopy.cs +++ b/DiscImageChef.DiscImages/HDCopy.cs @@ -73,7 +73,7 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class HDCopy : ImagePlugin + public class HDCopy : ImagePlugin { #region Internal structures /// <summary> @@ -98,8 +98,7 @@ namespace DiscImageChef.ImagePlugins /// 0 means track is not present, 1 means it is present. /// The first 2 tracks are always present. /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2 * 82)] - public byte[] trackMap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2 * 82)] public byte[] trackMap; } /// <summary> @@ -132,7 +131,6 @@ namespace DiscImageChef.ImagePlugins mediaType = _mediaType; } } - #endregion #region Internal variables @@ -162,8 +160,7 @@ namespace DiscImageChef.ImagePlugins { new MediaTypeTableEntry(80, 8, MediaType.DOS_35_DS_DD_8), new MediaTypeTableEntry(80, 9, MediaType.DOS_35_DS_DD_9), - new MediaTypeTableEntry(80, 18, MediaType.DOS_35_HD), - new MediaTypeTableEntry(80, 36, MediaType.DOS_35_ED), + new MediaTypeTableEntry(80, 18, MediaType.DOS_35_HD), new MediaTypeTableEntry(80, 36, MediaType.DOS_35_ED), new MediaTypeTableEntry(40, 8, MediaType.DOS_525_DS_DD_8), new MediaTypeTableEntry(40, 9, MediaType.DOS_525_DS_DD_9), new MediaTypeTableEntry(80, 15, MediaType.DOS_525_HD), @@ -204,8 +201,7 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if (stream.Length < 2 + 2 * 82) - return false; + if(stream.Length < 2 + 2 * 82) return false; byte[] header = new byte[2 + 2 * 82]; stream.Read(header, 0, 2 + 2 * 82); @@ -219,22 +215,15 @@ namespace DiscImageChef.ImagePlugins * We know the image is from a DOS floppy disk, so assume * some sane cylinder and sectors-per-track count. */ - if ((fheader.sectorsPerTrack < 8) || (fheader.sectorsPerTrack > 40)) - return false; + if((fheader.sectorsPerTrack < 8) || (fheader.sectorsPerTrack > 40)) return false; - if ((fheader.lastCylinder < 37) || (fheader.lastCylinder >= 82)) - return false; + if((fheader.lastCylinder < 37) || (fheader.lastCylinder >= 82)) return false; // Validate the trackmap. First two tracks need to be present - if ((fheader.trackMap[0] != 1) || (fheader.trackMap[1] != 1)) - return false; + if((fheader.trackMap[0] != 1) || (fheader.trackMap[1] != 1)) return false; // all other tracks must be either present (=1) or absent (=0) - for (int i = 0; i < 2 * 82; i++) - { - if (fheader.trackMap[i] > 1) - return false; - } + for(int i = 0; i < 2 * 82; i++) { if(fheader.trackMap[i] > 1) return false; } // TODO: validate the tracks // For now, having a valid header should be sufficient. @@ -256,7 +245,9 @@ namespace DiscImageChef.ImagePlugins Marshal.Copy(header, 0, hdrPtr, 2 + 2 * 82); fheader = (HDCPFileHeader)Marshal.PtrToStructure(hdrPtr, typeof(HDCPFileHeader)); Marshal.FreeHGlobal(hdrPtr); - DicConsole.DebugWriteLine("HDCP plugin", "Detected HD-Copy image with {0} tracks and {1} sectors per track.", fheader.lastCylinder + 1, fheader.sectorsPerTrack); + DicConsole.DebugWriteLine("HDCP plugin", + "Detected HD-Copy image with {0} tracks and {1} sectors per track.", + fheader.lastCylinder + 1, fheader.sectorsPerTrack); ImageInfo.cylinders = (uint)fheader.lastCylinder + 1; ImageInfo.sectorsPerTrack = fheader.sectorsPerTrack; @@ -276,9 +267,9 @@ namespace DiscImageChef.ImagePlugins currentOffset = 2 + 2 * 82; // build table of track offsets - for (int i = 0; i < ImageInfo.cylinders * 2; i++) + for(int i = 0; i < ImageInfo.cylinders * 2; i++) { - if (fheader.trackMap[i] == 0) + if(fheader.trackMap[i] == 0) { // track is not present in image trackOffset[i] = -1; @@ -286,8 +277,7 @@ namespace DiscImageChef.ImagePlugins else { // track is present, read the block header - if (currentOffset + 3 >= stream.Length) - return false; + if(currentOffset + 3 >= stream.Length) return false; byte[] blkHeader = new byte[2]; short blkLength; @@ -295,10 +285,10 @@ namespace DiscImageChef.ImagePlugins blkLength = BitConverter.ToInt16(blkHeader, 0); // assume block sizes are positive - if (blkLength < 0) - return false; + if(blkLength < 0) return false; - DicConsole.DebugWriteLine("HDCP plugin", "Track {0} offset 0x{1:x8}, size={2:x4}", i, currentOffset, blkLength); + DicConsole.DebugWriteLine("HDCP plugin", "Track {0} offset 0x{1:x8}, size={2:x4}", i, currentOffset, + blkLength); trackOffset[i] = currentOffset; currentOffset += 2 + blkLength; @@ -308,8 +298,7 @@ namespace DiscImageChef.ImagePlugins } // ensure that the last track is present completely - if (currentOffset > stream.Length) - return false; + if(currentOffset > stream.Length) return false; // save some variables for later use fileHeader = fheader; @@ -384,9 +373,9 @@ namespace DiscImageChef.ImagePlugins public override MediaType GetMediaType() { - foreach (MediaTypeTableEntry ent in mediaTypes) + foreach(MediaTypeTableEntry ent in mediaTypes) { - if ((ent.tracks == ImageInfo.cylinders) && (ent.sectorsPerTrack == ImageInfo.sectorsPerTrack)) + if((ent.tracks == ImageInfo.cylinders) && (ent.sectorsPerTrack == ImageInfo.sectorsPerTrack)) return ent.mediaType; } @@ -404,7 +393,7 @@ namespace DiscImageChef.ImagePlugins short compressedLength; // check that track is present - if (trackOffset[tracknum] == -1) + if(trackOffset[tracknum] == -1) throw new InvalidDataException("Tried reading a track that is not present in image"); stream.Seek(trackOffset[tracknum], SeekOrigin.Begin); @@ -420,27 +409,21 @@ namespace DiscImageChef.ImagePlugins // decompress the data int sIndex = 0; // source buffer position int dIndex = 0; // destination buffer position - while (sIndex < compressedLength) + while(sIndex < compressedLength) { - if (cBuffer[sIndex] == escapeByte) + if(cBuffer[sIndex] == escapeByte) { sIndex++; // skip over escape byte fillByte = cBuffer[sIndex++]; // read fill byte fillCount = cBuffer[sIndex++]; // read fill count // fill destination buffer - for (int i = 0; i < fillCount; i++) - { - trackData[dIndex++] = fillByte; - } - } - else - { - trackData[dIndex++] = cBuffer[sIndex++]; + for(int i = 0; i < fillCount; i++) { trackData[dIndex++] = fillByte; } } + else { trackData[dIndex++] = cBuffer[sIndex++]; } } // check that the number of bytes decompressed matches a whole track - if (dIndex != ImageInfo.sectorSize * ImageInfo.sectorsPerTrack) + if(dIndex != ImageInfo.sectorSize * ImageInfo.sectorsPerTrack) throw new InvalidDataException("Track decompression yielded incomplete data"); // store track in cache @@ -453,14 +436,14 @@ namespace DiscImageChef.ImagePlugins int sectorOffset = (int)(sectorAddress % (ImageInfo.sectorsPerTrack * ImageInfo.sectorSize)); byte[] result; - if (sectorAddress > ImageInfo.sectors - 1) + if(sectorAddress > ImageInfo.sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - if (trackNum > 2 * ImageInfo.cylinders) + if(trackNum > 2 * ImageInfo.cylinders) throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); result = new byte[ImageInfo.sectorSize]; - if (trackOffset[trackNum] == -1) + if(trackOffset[trackNum] == -1) { // track is not present. Fill with zeroes. Array.Clear(result, 0, (int)ImageInfo.sectorSize); @@ -468,8 +451,7 @@ namespace DiscImageChef.ImagePlugins else { // track is present in file, make sure it has been loaded - if (!trackCache.ContainsKey(trackNum)) - ReadTrackIntoCache(hdcpImageFilter.GetDataForkStream(), trackNum); + if(!trackCache.ContainsKey(trackNum)) ReadTrackIntoCache(hdcpImageFilter.GetDataForkStream(), trackNum); Array.Copy(trackCache[trackNum], sectorOffset, result, 0, ImageInfo.sectorSize); } @@ -481,10 +463,10 @@ namespace DiscImageChef.ImagePlugins { byte[] result = new byte[length * ImageInfo.sectorSize]; - if (sectorAddress + length > ImageInfo.sectors) + if(sectorAddress + length > ImageInfo.sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - for (int i = 0; i < length; i++) + for(int i = 0; i < length; i++) { ReadSector(sectorAddress + (ulong)i).CopyTo(result, i * ImageInfo.sectorSize); } @@ -493,7 +475,6 @@ namespace DiscImageChef.ImagePlugins } #region Unsupported features - public override byte[] ReadDiskTag(MediaTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -634,16 +615,18 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for (ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -652,7 +635,6 @@ namespace DiscImageChef.ImagePlugins { return null; } - #endregion } -} +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/IMD.cs b/DiscImageChef.DiscImages/IMD.cs index 80728d26..49872a48 100644 --- a/DiscImageChef.DiscImages/IMD.cs +++ b/DiscImageChef.DiscImages/IMD.cs @@ -41,581 +41,568 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class IMD : ImagePlugin - { - #region Internal enumerations - enum TransferRate : byte - { - /// <summary>500 kbps in FM mode</summary> - FiveHundred = 0, - /// <summary>300 kbps in FM mode</summary> - ThreeHundred = 1, - /// <summary>250 kbps in FM mode</summary> - TwoHundred = 2, - /// <summary>500 kbps in MFM mode</summary> - FiveHundredMFM = 3, - /// <summary>300 kbps in MFM mode</summary> - ThreeHundredMFM = 4, - /// <summary>250 kbps in MFM mode</summary> - TwoHundredMFM = 5 - } - - enum SectorType : byte - { - Unavailable = 0, - Normal = 1, - Compressed = 2, - Deleted = 3, - CompressedDeleted = 4, - Error = 5, - CompressedError = 6, - DeletedError = 7, - CompressedDeletedError = 8 - } - #endregion Internal enumerations - - #region Internal Constants - const byte SectorCylinderMapMask = 0x80; - const byte SectorHeadMapMask = 0x40; - const byte CommentEnd = 0x1A; - const string HeaderRegEx = "IMD (?<version>\\d.\\d+):\\s+(?<day>\\d+)\\/\\s*(?<month>\\d+)\\/(?<year>\\d+)\\s+(?<hour>\\d+):(?<minute>\\d+):(?<second>\\d+)\\r\\n"; - #endregion Internal Constants - - #region Internal variables - List<byte[]> sectorsData; - #endregion Internal variables - - public IMD() - { - Name = "Dunfield's IMD"; - PluginUUID = new Guid("0D67162E-38A3-407D-9B1A-CF40080A48CB"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = false; - ImageInfo.imageHasSessions = false; - ImageInfo.imageVersion = null; - ImageInfo.imageApplication = null; - ImageInfo.imageApplicationVersion = null; - ImageInfo.imageCreator = null; - ImageInfo.imageComments = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaSerialNumber = null; - ImageInfo.mediaBarcode = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - #region Public methods - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 31) - return false; - - byte[] hdr = new byte[31]; - stream.Read(hdr, 0, 31); - - Regex Hr = new Regex(HeaderRegEx); - Match Hm = Hr.Match(Encoding.ASCII.GetString(hdr)); - - return Hm.Success; - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - MemoryStream cmt = new MemoryStream(); - stream.Seek(0x1F, SeekOrigin.Begin); - for(uint i = 0; i < stream.Length; i++) - { - byte b = (byte)stream.ReadByte(); - if(b == 0x1A) - break; - cmt.WriteByte(b); - } - ImageInfo.imageComments = StringHandlers.CToString(cmt.ToArray()); - sectorsData = new List<byte[]>(); - - byte currentCylinder = 0; - ImageInfo.cylinders = 1; - ImageInfo.heads = 1; - ulong currentLba = 0; - - TransferRate mode = TransferRate.TwoHundred; - - while(stream.Position + 5 < stream.Length) - { - mode = (TransferRate)stream.ReadByte(); - byte cylinder = (byte)stream.ReadByte(); - byte head = (byte)stream.ReadByte(); - byte spt = (byte)stream.ReadByte(); - byte n = (byte)stream.ReadByte(); - byte[] idmap = new byte[spt]; - byte[] cylmap = new byte[spt]; - byte[] headmap = new byte[spt]; - ushort[] bps = new ushort[spt]; - - if(cylinder != currentCylinder) - { - currentCylinder = cylinder; - ImageInfo.cylinders++; - } - - if((head & 1) == 1) - ImageInfo.heads = 2; - - stream.Read(idmap, 0, idmap.Length); - if((head & SectorCylinderMapMask) == SectorCylinderMapMask) - stream.Read(cylmap, 0, cylmap.Length); - if((head & SectorHeadMapMask) == SectorHeadMapMask) - stream.Read(headmap, 0, headmap.Length); - if(n == 0xFF) - { - byte[] bpsbytes = new byte[spt * 2]; - stream.Read(bpsbytes, 0, bpsbytes.Length); - for(int i = 0; i < spt; i++) - bps[i] = BitConverter.ToUInt16(bpsbytes, i * 2); - } - else - { - for(int i = 0; i < spt; i++) - bps[i] = (ushort)(128 << n); - } - - if(spt > ImageInfo.sectorsPerTrack) - ImageInfo.sectorsPerTrack = spt; - - SortedDictionary<byte, byte[]> track = new SortedDictionary<byte, byte[]>(); - - for(int i = 0; i < spt; i++) - { - SectorType type = (SectorType)stream.ReadByte(); - byte[] data = new byte[bps[i]]; - - // TODO; Handle disks with different bps in track 0 - if(bps[i] > ImageInfo.sectorSize) - ImageInfo.sectorSize = bps[i]; - - switch(type) - { - case SectorType.Unavailable: - if(!track.ContainsKey(idmap[i])) - track.Add(idmap[i], data); - break; - case SectorType.Normal: - case SectorType.Deleted: - case SectorType.Error: - case SectorType.DeletedError: - stream.Read(data, 0, data.Length); - if(!track.ContainsKey(idmap[i])) - track.Add(idmap[i], data); - ImageInfo.imageSize += (ulong)data.Length; - break; - case SectorType.Compressed: - case SectorType.CompressedDeleted: - case SectorType.CompressedError: - case SectorType.CompressedDeletedError: - byte filling = (byte)stream.ReadByte(); - ArrayHelpers.ArrayFill(data, filling); - if(!track.ContainsKey(idmap[i])) - track.Add(idmap[i], data); - break; - default: - throw new ImageNotSupportedException(string.Format("Invalid sector type {0}", (byte)type)); - } - } - - foreach(KeyValuePair<byte, byte[]> kvp in track) - { - sectorsData.Add(kvp.Value); - currentLba++; - } - } - - ImageInfo.imageApplication = "IMD"; - // TODO: The header is the date of dump or the date of the application compilation? - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.imageComments = StringHandlers.CToString(cmt.ToArray()); - ImageInfo.sectors = currentLba; - ImageInfo.mediaType = MediaType.Unknown; - - switch(mode) - { - case TransferRate.TwoHundred: - case TransferRate.ThreeHundred: - if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 10 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ACORN_525_SS_SD_40; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ACORN_525_SS_SD_80; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && ImageInfo.sectorSize == 128) - ImageInfo.mediaType = MediaType.ATARI_525_SD; - break; - case TransferRate.FiveHundred: - if(ImageInfo.heads == 1 && ImageInfo.cylinders == 32 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 319) - ImageInfo.mediaType = MediaType.IBM23FD; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 73 && ImageInfo.sectorsPerTrack == 26 && ImageInfo.sectorSize == 128) - ImageInfo.mediaType = MediaType.IBM23FD; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 77 && ImageInfo.sectorsPerTrack == 26 && ImageInfo.sectorSize == 128) - ImageInfo.mediaType = MediaType.NEC_8_SD; - break; - case TransferRate.TwoHundredMFM: - case TransferRate.ThreeHundredMFM: - if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && ImageInfo.sectorSize == 128) - ImageInfo.mediaType = MediaType.ATARI_525_SD; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 26 && ImageInfo.sectorSize == 128) - ImageInfo.mediaType = MediaType.ATARI_525_ED; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ATARI_525_DD; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 16 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ACORN_525_SS_DD_40; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 16 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ACORN_525_SS_DD_80; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ATARI_525_DD; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.RX50; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; - if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 5 && ImageInfo.sectorSize == 1024) - ImageInfo.mediaType = MediaType.ACORN_35_DS_DD; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 82 && ImageInfo.sectorsPerTrack == 10 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.FDFORMAT_35_DD; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 70 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.Apricot_35; - break; - case TransferRate.FiveHundredMFM: - if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 18 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_HD; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 21 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DMF; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 82 && ImageInfo.sectorsPerTrack == 21 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DMF_82; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 23 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.XDF_35; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_HD; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && ImageInfo.sectorSize == 1024) - ImageInfo.mediaType = MediaType.ACORN_35_DS_HD; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 77 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 1024) - ImageInfo.mediaType = MediaType.NEC_525_HD; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 1024) - ImageInfo.mediaType = MediaType.SHARP_525_9; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.ATARI_35_SS_DD; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.ATARI_35_DS_DD; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 11 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.ATARI_35_SS_DD_11; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 11 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.ATARI_35_DS_DD_11; - break; - default: - ImageInfo.mediaType = MediaType.Unknown; - break; - } - - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - - DicConsole.VerboseWriteLine("IMD image contains a disk of type {0}", ImageInfo.mediaType); - if(!string.IsNullOrEmpty(ImageInfo.imageComments)) - DicConsole.VerboseWriteLine("IMD comments: {0}", ImageInfo.imageComments); - - /* - FileStream debugFs = new FileStream("debug.img", FileMode.CreateNew, FileAccess.Write); - for(ulong i = 0; i < ImageInfo.sectors; i++) - debugFs.Write(ReadSector(i), 0, (int)ImageInfo.sectorSize); - debugFs.Dispose(); - */ - - return true; - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifyMediaImage() - { - return null; - } - - public override bool ImageHasPartitions() - { - return ImageInfo.imageHasPartitions; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - MemoryStream buffer = new MemoryStream(); - for(int i = 0; i < length; i++) - buffer.Write(sectorsData[(int)sectorAddress + i], 0, sectorsData[(int)sectorAddress + i].Length); - - return buffer.ToArray(); - } - - public override string GetImageFormat() - { - return "IMageDisk"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override string GetMediaManufacturer() - { - return ImageInfo.mediaManufacturer; - } - - public override string GetMediaModel() - { - return ImageInfo.mediaModel; - } - - public override string GetMediaSerialNumber() - { - return ImageInfo.mediaSerialNumber; - } - - public override string GetMediaBarcode() - { - return ImageInfo.mediaBarcode; - } - - public override string GetMediaPartNumber() - { - return ImageInfo.mediaPartNumber; - } - - public override int GetMediaSequence() - { - return ImageInfo.mediaSequence; - } - - public override int GetLastDiskSequence() - { - return ImageInfo.lastMediaSequence; - } - - public override string GetDriveManufacturer() - { - return ImageInfo.driveManufacturer; - } - - public override string GetDriveModel() - { - return ImageInfo.driveModel; - } - - public override string GetDriveSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - #endregion Public methods - - #region Unsupported features - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - #endregion Unsupported features - - } -} - + public class IMD : ImagePlugin + { + #region Internal enumerations + enum TransferRate : byte + { + /// <summary>500 kbps in FM mode</summary> + FiveHundred = 0, + /// <summary>300 kbps in FM mode</summary> + ThreeHundred = 1, + /// <summary>250 kbps in FM mode</summary> + TwoHundred = 2, + /// <summary>500 kbps in MFM mode</summary> + FiveHundredMFM = 3, + /// <summary>300 kbps in MFM mode</summary> + ThreeHundredMFM = 4, + /// <summary>250 kbps in MFM mode</summary> + TwoHundredMFM = 5 + } + + enum SectorType : byte + { + Unavailable = 0, + Normal = 1, + Compressed = 2, + Deleted = 3, + CompressedDeleted = 4, + Error = 5, + CompressedError = 6, + DeletedError = 7, + CompressedDeletedError = 8 + } + #endregion Internal enumerations + + #region Internal Constants + const byte SectorCylinderMapMask = 0x80; + const byte SectorHeadMapMask = 0x40; + const byte CommentEnd = 0x1A; + const string HeaderRegEx = + "IMD (?<version>\\d.\\d+):\\s+(?<day>\\d+)\\/\\s*(?<month>\\d+)\\/(?<year>\\d+)\\s+(?<hour>\\d+):(?<minute>\\d+):(?<second>\\d+)\\r\\n" + ; + #endregion Internal Constants + + #region Internal variables + List<byte[]> sectorsData; + #endregion Internal variables + + public IMD() + { + Name = "Dunfield's IMD"; + PluginUUID = new Guid("0D67162E-38A3-407D-9B1A-CF40080A48CB"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = false; + ImageInfo.imageHasSessions = false; + ImageInfo.imageVersion = null; + ImageInfo.imageApplication = null; + ImageInfo.imageApplicationVersion = null; + ImageInfo.imageCreator = null; + ImageInfo.imageComments = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaSerialNumber = null; + ImageInfo.mediaBarcode = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + #region Public methods + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + if(stream.Length < 31) return false; + + byte[] hdr = new byte[31]; + stream.Read(hdr, 0, 31); + + Regex Hr = new Regex(HeaderRegEx); + Match Hm = Hr.Match(Encoding.ASCII.GetString(hdr)); + + return Hm.Success; + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + MemoryStream cmt = new MemoryStream(); + stream.Seek(0x1F, SeekOrigin.Begin); + for(uint i = 0; i < stream.Length; i++) + { + byte b = (byte)stream.ReadByte(); + if(b == 0x1A) break; + + cmt.WriteByte(b); + } + + ImageInfo.imageComments = StringHandlers.CToString(cmt.ToArray()); + sectorsData = new List<byte[]>(); + + byte currentCylinder = 0; + ImageInfo.cylinders = 1; + ImageInfo.heads = 1; + ulong currentLba = 0; + + TransferRate mode = TransferRate.TwoHundred; + + while(stream.Position + 5 < stream.Length) + { + mode = (TransferRate)stream.ReadByte(); + byte cylinder = (byte)stream.ReadByte(); + byte head = (byte)stream.ReadByte(); + byte spt = (byte)stream.ReadByte(); + byte n = (byte)stream.ReadByte(); + byte[] idmap = new byte[spt]; + byte[] cylmap = new byte[spt]; + byte[] headmap = new byte[spt]; + ushort[] bps = new ushort[spt]; + + if(cylinder != currentCylinder) + { + currentCylinder = cylinder; + ImageInfo.cylinders++; + } + + if((head & 1) == 1) ImageInfo.heads = 2; + + stream.Read(idmap, 0, idmap.Length); + if((head & SectorCylinderMapMask) == SectorCylinderMapMask) stream.Read(cylmap, 0, cylmap.Length); + if((head & SectorHeadMapMask) == SectorHeadMapMask) stream.Read(headmap, 0, headmap.Length); + if(n == 0xFF) + { + byte[] bpsbytes = new byte[spt * 2]; + stream.Read(bpsbytes, 0, bpsbytes.Length); + for(int i = 0; i < spt; i++) bps[i] = BitConverter.ToUInt16(bpsbytes, i * 2); + } + else { for(int i = 0; i < spt; i++) bps[i] = (ushort)(128 << n); } + + if(spt > ImageInfo.sectorsPerTrack) ImageInfo.sectorsPerTrack = spt; + + SortedDictionary<byte, byte[]> track = new SortedDictionary<byte, byte[]>(); + + for(int i = 0; i < spt; i++) + { + SectorType type = (SectorType)stream.ReadByte(); + byte[] data = new byte[bps[i]]; + + // TODO; Handle disks with different bps in track 0 + if(bps[i] > ImageInfo.sectorSize) ImageInfo.sectorSize = bps[i]; + + switch(type) + { + case SectorType.Unavailable: + if(!track.ContainsKey(idmap[i])) track.Add(idmap[i], data); + break; + case SectorType.Normal: + case SectorType.Deleted: + case SectorType.Error: + case SectorType.DeletedError: + stream.Read(data, 0, data.Length); + if(!track.ContainsKey(idmap[i])) track.Add(idmap[i], data); + ImageInfo.imageSize += (ulong)data.Length; + break; + case SectorType.Compressed: + case SectorType.CompressedDeleted: + case SectorType.CompressedError: + case SectorType.CompressedDeletedError: + byte filling = (byte)stream.ReadByte(); + ArrayHelpers.ArrayFill(data, filling); + if(!track.ContainsKey(idmap[i])) track.Add(idmap[i], data); + break; + default: + throw new ImageNotSupportedException(string.Format("Invalid sector type {0}", (byte)type)); + } + } + + foreach(KeyValuePair<byte, byte[]> kvp in track) + { + sectorsData.Add(kvp.Value); + currentLba++; + } + } + + ImageInfo.imageApplication = "IMD"; + // TODO: The header is the date of dump or the date of the application compilation? + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.imageComments = StringHandlers.CToString(cmt.ToArray()); + ImageInfo.sectors = currentLba; + ImageInfo.mediaType = MediaType.Unknown; + + switch(mode) + { + case TransferRate.TwoHundred: + case TransferRate.ThreeHundred: + if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 10 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ACORN_525_SS_SD_40; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ACORN_525_SS_SD_80; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && + ImageInfo.sectorSize == 128) ImageInfo.mediaType = MediaType.ATARI_525_SD; + break; + case TransferRate.FiveHundred: + if(ImageInfo.heads == 1 && ImageInfo.cylinders == 32 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 319) ImageInfo.mediaType = MediaType.IBM23FD; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 73 && ImageInfo.sectorsPerTrack == 26 && + ImageInfo.sectorSize == 128) ImageInfo.mediaType = MediaType.IBM23FD; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 77 && ImageInfo.sectorsPerTrack == 26 && + ImageInfo.sectorSize == 128) ImageInfo.mediaType = MediaType.NEC_8_SD; + break; + case TransferRate.TwoHundredMFM: + case TransferRate.ThreeHundredMFM: + if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && + ImageInfo.sectorSize == 128) ImageInfo.mediaType = MediaType.ATARI_525_SD; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 26 && + ImageInfo.sectorSize == 128) ImageInfo.mediaType = MediaType.ATARI_525_ED; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ATARI_525_DD; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 16 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ACORN_525_SS_DD_40; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 16 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ACORN_525_SS_DD_80; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ATARI_525_DD; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.RX50; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; + if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 5 && + ImageInfo.sectorSize == 1024) ImageInfo.mediaType = MediaType.ACORN_35_DS_DD; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 82 && ImageInfo.sectorsPerTrack == 10 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.FDFORMAT_35_DD; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 70 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.Apricot_35; + break; + case TransferRate.FiveHundredMFM: + if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 18 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_HD; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 21 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DMF; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 82 && ImageInfo.sectorsPerTrack == 21 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DMF_82; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 23 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.XDF_35; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_HD; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && + ImageInfo.sectorSize == 1024) ImageInfo.mediaType = MediaType.ACORN_35_DS_HD; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 77 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 1024) ImageInfo.mediaType = MediaType.NEC_525_HD; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 1024) ImageInfo.mediaType = MediaType.SHARP_525_9; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.ATARI_35_SS_DD; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.ATARI_35_DS_DD; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 11 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.ATARI_35_SS_DD_11; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 11 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.ATARI_35_DS_DD_11; + break; + default: + ImageInfo.mediaType = MediaType.Unknown; + break; + } + + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + + DicConsole.VerboseWriteLine("IMD image contains a disk of type {0}", ImageInfo.mediaType); + if(!string.IsNullOrEmpty(ImageInfo.imageComments)) + DicConsole.VerboseWriteLine("IMD comments: {0}", ImageInfo.imageComments); + + /* + FileStream debugFs = new FileStream("debug.img", FileMode.CreateNew, FileAccess.Write); + for(ulong i = 0; i < ImageInfo.sectors; i++) + debugFs.Write(ReadSector(i), 0, (int)ImageInfo.sectorSize); + debugFs.Dispose(); + */ + + return true; + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifyMediaImage() + { + return null; + } + + public override bool ImageHasPartitions() + { + return ImageInfo.imageHasPartitions; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + MemoryStream buffer = new MemoryStream(); + for(int i = 0; i < length; i++) + buffer.Write(sectorsData[(int)sectorAddress + i], 0, sectorsData[(int)sectorAddress + i].Length); + + return buffer.ToArray(); + } + + public override string GetImageFormat() + { + return "IMageDisk"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override string GetMediaManufacturer() + { + return ImageInfo.mediaManufacturer; + } + + public override string GetMediaModel() + { + return ImageInfo.mediaModel; + } + + public override string GetMediaSerialNumber() + { + return ImageInfo.mediaSerialNumber; + } + + public override string GetMediaBarcode() + { + return ImageInfo.mediaBarcode; + } + + public override string GetMediaPartNumber() + { + return ImageInfo.mediaPartNumber; + } + + public override int GetMediaSequence() + { + return ImageInfo.mediaSequence; + } + + public override int GetLastDiskSequence() + { + return ImageInfo.lastMediaSequence; + } + + public override string GetDriveManufacturer() + { + return ImageInfo.driveManufacturer; + } + + public override string GetDriveModel() + { + return ImageInfo.driveModel; + } + + public override string GetDriveSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + #endregion Public methods + + #region Unsupported features + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + #endregion Unsupported features + } +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/ImageInfo.cs b/DiscImageChef.DiscImages/ImageInfo.cs index 5cdcc21b..7a863ddd 100644 --- a/DiscImageChef.DiscImages/ImageInfo.cs +++ b/DiscImageChef.DiscImages/ImageInfo.cs @@ -36,7 +36,7 @@ using DiscImageChef.CommonTypes; namespace DiscImageChef.ImagePlugins { - public struct ImageInfo + public struct ImageInfo { public bool imageHasPartitions; public bool imageHasSessions; @@ -66,10 +66,9 @@ namespace DiscImageChef.ImagePlugins public string driveSerialNumber; public string driveFirmwareRevision; public XmlMediaType xmlMediaType; - // CHS geometry... - public uint cylinders; - public uint heads; - public uint sectorsPerTrack; + // CHS geometry... + public uint cylinders; + public uint heads; + public uint sectorsPerTrack; } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/ImagePlugin.cs b/DiscImageChef.DiscImages/ImagePlugin.cs index cd331f91..6a0b1c0d 100644 --- a/DiscImageChef.DiscImages/ImagePlugin.cs +++ b/DiscImageChef.DiscImages/ImagePlugin.cs @@ -37,10 +37,10 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - /// <summary> - /// Abstract class to implement disk image reading plugins. - /// </summary> - public abstract class ImagePlugin + /// <summary> + /// Abstract class to implement disk image reading plugins. + /// </summary> + public abstract class ImagePlugin { /// <summary>Plugin name.</summary> public string Name; @@ -49,9 +49,7 @@ namespace DiscImageChef.ImagePlugins /// <summary>Image information</summary> public ImageInfo ImageInfo; - protected ImagePlugin() - { - } + protected ImagePlugin() { } // Basic image handling functions @@ -366,7 +364,6 @@ namespace DiscImageChef.ImagePlugins /// <returns>The sessions.</returns> public abstract List<Session> GetSessions(); - /// <summary> /// Verifies a sector. /// </summary> @@ -390,7 +387,8 @@ namespace DiscImageChef.ImagePlugins /// <param name="length">How many sectors to read.</param> /// <param name="FailingLBAs">List of incorrect sectors</param> /// <param name="UnknownLBAs">List of uncheckable sectors</param> - public abstract bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs); + public abstract bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs); /// <summary> /// Verifies several sectors, relative to track. @@ -401,7 +399,8 @@ namespace DiscImageChef.ImagePlugins /// <param name="track">Track.</param> /// <param name="FailingLBAs">List of incorrect sectors</param> /// <param name="UnknownLBAs">List of uncheckable sectors</param> - public abstract bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs); + public abstract bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs); /// <summary> /// Verifies media image internal checksum. @@ -409,7 +408,6 @@ namespace DiscImageChef.ImagePlugins /// <returns>True if correct, false if incorrect, null if there is no internal checksum available</returns> public abstract bool? VerifyMediaImage(); - // CD flags bitmask /// <summary>Track is quadraphonic.</summary> @@ -682,20 +680,20 @@ namespace DiscImageChef.ImagePlugins SD_CSD, /// <summary>SecureDigital SCR</summary> SD_SCR, - /// <summary>SecureDigital OCR</summary> - SD_OCR, - /// <summary>MultiMediaCard CID</summary> - MMC_CID, - /// <summary>MultiMediaCard CSD</summary> - MMC_CSD, - /// <summary>MultiMediaCard OCR</summary> - MMC_OCR, - /// <summary>MultiMediaCard Extended CSD</summary> - MMC_ExtendedCSD, - /// <summary>Xbox Security Sector</summary> - Xbox_SecuritySector, - /// <summary>On floppy disks, data in last cylinder usually in a different format that contains duplication or manufacturing information</summary> - Floppy_LeadOut, + /// <summary>SecureDigital OCR</summary> + SD_OCR, + /// <summary>MultiMediaCard CID</summary> + MMC_CID, + /// <summary>MultiMediaCard CSD</summary> + MMC_CSD, + /// <summary>MultiMediaCard OCR</summary> + MMC_OCR, + /// <summary>MultiMediaCard Extended CSD</summary> + MMC_ExtendedCSD, + /// <summary>Xbox Security Sector</summary> + Xbox_SecuritySector, + /// <summary>On floppy disks, data in last cylinder usually in a different format that contains duplication or manufacturing information</summary> + Floppy_LeadOut, }; /// <summary> @@ -732,17 +730,14 @@ namespace DiscImageChef.ImagePlugins /// </summary> /// <param name="message">Message.</param> /// <param name="inner">Inner.</param> - public FeatureSupportedButNotImplementedImageException(string message, Exception inner) : base(message, inner) - { - } + public FeatureSupportedButNotImplementedImageException(string message, Exception inner) : + base(message, inner) { } /// <summary> /// Feature is supported by image but not implemented yet. /// </summary> /// <param name="message">Message.</param> - public FeatureSupportedButNotImplementedImageException(string message) : base(message) - { - } + public FeatureSupportedButNotImplementedImageException(string message) : base(message) { } /// <summary> /// Feature is supported by image but not implemented yet. @@ -752,8 +747,7 @@ namespace DiscImageChef.ImagePlugins protected FeatureSupportedButNotImplementedImageException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { - if(info == null) - throw new ArgumentNullException(nameof(info)); + if(info == null) throw new ArgumentNullException(nameof(info)); } } @@ -768,17 +762,13 @@ namespace DiscImageChef.ImagePlugins /// </summary> /// <param name="message">Message.</param> /// <param name="inner">Inner.</param> - public FeatureUnsupportedImageException(string message, Exception inner) : base(message, inner) - { - } + public FeatureUnsupportedImageException(string message, Exception inner) : base(message, inner) { } /// <summary> /// Feature is not supported by image. /// </summary> /// <param name="message">Message.</param> - public FeatureUnsupportedImageException(string message) : base(message) - { - } + public FeatureUnsupportedImageException(string message) : base(message) { } /// <summary> /// Feature is not supported by image. @@ -788,8 +778,7 @@ namespace DiscImageChef.ImagePlugins protected FeatureUnsupportedImageException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { - if(info == null) - throw new ArgumentNullException(nameof(info)); + if(info == null) throw new ArgumentNullException(nameof(info)); } } @@ -804,17 +793,13 @@ namespace DiscImageChef.ImagePlugins /// </summary> /// <param name="message">Message.</param> /// <param name="inner">Inner.</param> - public FeatureNotPresentImageException(string message, Exception inner) : base(message, inner) - { - } + public FeatureNotPresentImageException(string message, Exception inner) : base(message, inner) { } /// <summary> /// Feature is supported by image but not present on it. /// </summary> /// <param name="message">Message.</param> - public FeatureNotPresentImageException(string message) : base(message) - { - } + public FeatureNotPresentImageException(string message) : base(message) { } /// <summary> /// Feature is supported by image but not present on it. @@ -824,8 +809,7 @@ namespace DiscImageChef.ImagePlugins protected FeatureNotPresentImageException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { - if(info == null) - throw new ArgumentNullException(nameof(info)); + if(info == null) throw new ArgumentNullException(nameof(info)); } } @@ -840,17 +824,13 @@ namespace DiscImageChef.ImagePlugins /// </summary> /// <param name="message">Message.</param> /// <param name="inner">Inner.</param> - public FeaturedNotSupportedByDiscImageException(string message, Exception inner) : base(message, inner) - { - } + public FeaturedNotSupportedByDiscImageException(string message, Exception inner) : base(message, inner) { } /// <summary> /// Feature is supported by image but not by the disc it represents. /// </summary> /// <param name="message">Message.</param> - public FeaturedNotSupportedByDiscImageException(string message) : base(message) - { - } + public FeaturedNotSupportedByDiscImageException(string message) : base(message) { } /// <summary> /// Feature is supported by image but not by the disc it represents. @@ -860,8 +840,7 @@ namespace DiscImageChef.ImagePlugins protected FeaturedNotSupportedByDiscImageException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { - if(info == null) - throw new ArgumentNullException(nameof(info)); + if(info == null) throw new ArgumentNullException(nameof(info)); } } @@ -876,17 +855,13 @@ namespace DiscImageChef.ImagePlugins /// </summary> /// <param name="message">Message.</param> /// <param name="inner">Inner.</param> - public ImageNotSupportedException(string message, Exception inner) : base(message, inner) - { - } + public ImageNotSupportedException(string message, Exception inner) : base(message, inner) { } /// <summary> /// Corrupt, incorrect or unhandled feature found on image /// </summary> /// <param name="message">Message.</param> - public ImageNotSupportedException(string message) : base(message) - { - } + public ImageNotSupportedException(string message) : base(message) { } /// <summary> /// Corrupt, incorrect or unhandled feature found on image @@ -896,8 +871,7 @@ namespace DiscImageChef.ImagePlugins protected ImageNotSupportedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.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/DiscImageChef.DiscImages/KryoFlux.cs b/DiscImageChef.DiscImages/KryoFlux.cs index 4699e26a..fdf23909 100644 --- a/DiscImageChef.DiscImages/KryoFlux.cs +++ b/DiscImageChef.DiscImages/KryoFlux.cs @@ -41,7 +41,7 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class KryoFlux : ImagePlugin + public class KryoFlux : ImagePlugin { #region Internal Structures [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -85,7 +85,7 @@ namespace DiscImageChef.ImagePlugins const string hostDate = "host_date"; const string hostTime = "host_time"; const string kfName = "name"; - const string kfVersion= "version"; + const string kfVersion = "version"; const string kfDate = "date"; const string kfTime = "time"; const string kfHwId = "hwid"; @@ -134,8 +134,7 @@ namespace DiscImageChef.ImagePlugins OobBlock header = new OobBlock(); Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < Marshal.SizeOf(header)) - return false; + if(stream.Length < Marshal.SizeOf(header)) return false; byte[] hdr = new byte[Marshal.SizeOf(header)]; stream.Read(hdr, 0, Marshal.SizeOf(header)); @@ -165,8 +164,7 @@ namespace DiscImageChef.ImagePlugins OobBlock header = new OobBlock(); Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < Marshal.SizeOf(header)) - return false; + if(stream.Length < Marshal.SizeOf(header)) return false; byte[] hdr = new byte[Marshal.SizeOf(header)]; stream.Read(hdr, 0, Marshal.SizeOf(header)); @@ -197,15 +195,16 @@ namespace DiscImageChef.ImagePlugins byte heads = 2; bool topHead = false; string basename = Path.Combine(imageFilter.GetParentFolder(), - imageFilter.GetFilename().Substring(0, imageFilter.GetFilename().Length - 8)); + imageFilter.GetFilename() + .Substring(0, imageFilter.GetFilename().Length - 8)); for(byte t = 0; t < 166; t += step) { int cylinder = t / heads; int head = topHead ? 1 : t % heads; string trackfile = Directory.Exists(basename) - ? Path.Combine(basename, string.Format("{0:D2}.{1:D1}.raw", cylinder, head)) - : string.Format("{0}{1:D2}.{2:D1}.raw", basename, cylinder, head); + ? Path.Combine(basename, string.Format("{0:D2}.{1:D1}.raw", cylinder, head)) + : string.Format("{0}{1:D2}.{2:D1}.raw", basename, cylinder, head); if(!File.Exists(trackfile)) { @@ -213,13 +212,15 @@ namespace DiscImageChef.ImagePlugins { if(head == 0) { - DicConsole.DebugWriteLine("KryoFlux plugin", "Cannot find cyl 0 hd 0, supposing only top head was dumped"); + DicConsole.DebugWriteLine("KryoFlux plugin", + "Cannot find cyl 0 hd 0, supposing only top head was dumped"); topHead = true; heads = 1; continue; } - DicConsole.DebugWriteLine("KryoFlux plugin", "Cannot find cyl 0 hd 1, supposing only bottom head was dumped"); + DicConsole.DebugWriteLine("KryoFlux plugin", + "Cannot find cyl 0 hd 1, supposing only bottom head was dumped"); heads = 1; continue; } @@ -239,8 +240,7 @@ namespace DiscImageChef.ImagePlugins ZZZNoFilter trackFilter = new ZZZNoFilter(); trackFilter.Open(trackfile); - if(!trackFilter.IsOpened()) - throw new IOException("Could not open KryoFlux track file."); + if(!trackFilter.IsOpened()) throw new IOException("Could not open KryoFlux track file."); ImageInfo.imageCreationTime = DateTime.MaxValue; ImageInfo.imageLastModificationTime = DateTime.MinValue; @@ -288,8 +288,7 @@ namespace DiscImageChef.ImagePlugins foreach(string line in lines) { string[] kvp = line.Split('='); - if(kvp.Length != 2) - continue; + if(kvp.Length != 2) continue; kvp[0] = kvp[0].Trim(); kvp[1] = kvp[1].Trim(); @@ -297,30 +296,29 @@ namespace DiscImageChef.ImagePlugins if(kvp[0] == hostDate) { - if(DateTime.TryParseExact(kvp[1], "yyyy.MM.dd", CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, - out blockDate)) + if(DateTime.TryParseExact(kvp[1], "yyyy.MM.dd", CultureInfo.InvariantCulture, + DateTimeStyles.AssumeLocal, out blockDate)) foundDate = true; } else if(kvp[0] == hostTime) { - DateTime.TryParseExact(kvp[1], "HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, - out blockTime); + DateTime.TryParseExact(kvp[1], "HH:mm:ss", CultureInfo.InvariantCulture, + DateTimeStyles.AssumeLocal, out blockTime); } - else if(kvp[0] == kfName) - ImageInfo.imageApplication = kvp[1]; - else if(kvp[0] == kfVersion) - ImageInfo.imageApplicationVersion = kvp[1]; + else if(kvp[0] == kfName) ImageInfo.imageApplication = kvp[1]; + else if(kvp[0] == kfVersion) ImageInfo.imageApplicationVersion = kvp[1]; } if(foundDate) { DateTime blockTimestamp = new DateTime(blockDate.Year, blockDate.Month, blockDate.Day, - blockTime.Hour, blockTime.Minute, blockTime.Second); + blockTime.Hour, blockTime.Minute, + blockTime.Second); DicConsole.DebugWriteLine("KryoFlux plugin", "Found timestamp: {0}", blockTimestamp); if(blockTimestamp < ImageInfo.imageCreationTime) ImageInfo.imageCreationTime = blockTimestamp; if(blockTimestamp > ImageInfo.imageLastModificationTime) - ImageInfo.imageLastModificationTime= blockTimestamp; + ImageInfo.imageLastModificationTime = blockTimestamp; } break; @@ -340,17 +338,15 @@ namespace DiscImageChef.ImagePlugins case (byte)BlockIds.Flux3: trackStream.Position += 2; continue; - default: - continue; + default: continue; } } - + tracks.Add(t, trackFilter); } ImageInfo.heads = heads; ImageInfo.cylinders = (uint)(tracks.Count / heads); - #endregion TODO: This is supposing NoFilter, shouldn't throw new NotImplementedException("Flux decoding is not yet implemented."); @@ -521,7 +517,8 @@ namespace DiscImageChef.ImagePlugins throw new NotImplementedException("Flux decoding is not yet implemented."); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new NotImplementedException("Flux decoding is not yet implemented."); } @@ -537,6 +534,7 @@ namespace DiscImageChef.ImagePlugins { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -582,7 +580,8 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } diff --git a/DiscImageChef.DiscImages/MaxiDisk.cs b/DiscImageChef.DiscImages/MaxiDisk.cs index 1780f46f..4ad4fa05 100644 --- a/DiscImageChef.DiscImages/MaxiDisk.cs +++ b/DiscImageChef.DiscImages/MaxiDisk.cs @@ -40,508 +40,493 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class MaxiDisk : ImagePlugin - { - #region Internal Structures - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct HdkHeader - { - public byte unknown; - public byte diskType; - public byte heads; - public byte cylinders; - public byte bytesPerSector; - public byte sectorsPerTrack; - public byte unknown2; - public byte unknown3; - } - - enum HdkDiskTypes : byte - { - Dos360 = 0, - Maxi420 = 1, - Dos720 = 2, - Maxi800 = 3, - Dos1200 = 4, - Maxi1400 = 5, - Dos1440 = 6, - Mac1440 = 7, - Maxi1600 = 8, - Dmf = 9, - Dos2880 = 10, - Maxi3200 = 11 - } - #endregion - - #region Internal variables - - /// <summary>Disk image file</summary> - Filter hdkImageFilter; - - #endregion - - public MaxiDisk() - { - Name = "MAXI Disk image"; - PluginUUID = new Guid("D27D924A-7034-466E-ADE1-B81EF37E469E"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = false; - ImageInfo.imageHasSessions = false; - ImageInfo.imageApplication = "MAXI Disk"; - ImageInfo.imageCreator = null; - ImageInfo.imageComments = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaSerialNumber = null; - ImageInfo.mediaBarcode = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - - if(stream.Length < 8) - return false; - - byte[] buffer = new byte[8]; - stream.Seek(0, SeekOrigin.Begin); - stream.Read(buffer, 0, buffer.Length); - - HdkHeader tmp_header = new HdkHeader(); - IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length); - Marshal.Copy(buffer, 0, ftrPtr, buffer.Length); - tmp_header = (HdkHeader)Marshal.PtrToStructure(ftrPtr, typeof(HdkHeader)); - Marshal.FreeHGlobal(ftrPtr); - - DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.unknown = {0}", tmp_header.unknown); - DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.diskType = {0}", tmp_header.diskType); - DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.heads = {0}", tmp_header.heads); - DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.cylinders = {0}", tmp_header.cylinders); - DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.bytesPerSector = {0}", tmp_header.bytesPerSector); - DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.sectorsPerTrack = {0}", tmp_header.sectorsPerTrack); - DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.unknown2 = {0}", tmp_header.unknown2); - DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.unknown3 = {0}", tmp_header.unknown3); - - // This is hardcoded - // But its possible values are unknown... - //if(tmp_header.diskType > 11) - // return false; - - // Only floppies supported - if(tmp_header.heads == 0 || tmp_header.heads > 2) - return false; - - // No floppies with more than this? - if(tmp_header.cylinders > 90) - return false; - - // Maximum supported bps is 16384 - if(tmp_header.bytesPerSector > 7) - return false; - - int expectedFileSize = tmp_header.heads * tmp_header.cylinders * tmp_header.sectorsPerTrack * (128 << tmp_header.bytesPerSector) + 8; - - return expectedFileSize == stream.Length; - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - - if(stream.Length < 8) - return false; - - byte[] buffer = new byte[8]; - stream.Seek(0, SeekOrigin.Begin); - stream.Read(buffer, 0, buffer.Length); - - HdkHeader tmp_header = new HdkHeader(); - IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length); - Marshal.Copy(buffer, 0, ftrPtr, buffer.Length); - tmp_header = (HdkHeader)Marshal.PtrToStructure(ftrPtr, typeof(HdkHeader)); - Marshal.FreeHGlobal(ftrPtr); - - // This is hardcoded - // But its possible values are unknown... - //if(tmp_header.diskType > 11) - // return false; - - // Only floppies supported - if(tmp_header.heads == 0 || tmp_header.heads > 2) - return false; - - // No floppies with more than this? - if(tmp_header.cylinders > 90) - return false; - - // Maximum supported bps is 16384 - if(tmp_header.bytesPerSector > 7) - return false; - - int expectedFileSize = tmp_header.heads * tmp_header.cylinders * tmp_header.sectorsPerTrack * (128 << tmp_header.bytesPerSector) + 8; - - if(expectedFileSize != stream.Length) - return false; - - ImageInfo.cylinders = tmp_header.cylinders; - ImageInfo.heads = tmp_header.heads; - ImageInfo.sectorsPerTrack = tmp_header.sectorsPerTrack; - ImageInfo.sectors = (ulong)(tmp_header.heads * tmp_header.cylinders * tmp_header.sectorsPerTrack); - ImageInfo.sectorSize = (uint)(128 << tmp_header.bytesPerSector); - - hdkImageFilter = imageFilter; - - ImageInfo.imageSize = (ulong)(stream.Length - 8); - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - - if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_HD; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 16 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ACORN_525_DS_DD; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 16 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ACORN_525_SS_DD_80; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ACORN_525_SS_SD_80; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 77 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 1024) - ImageInfo.mediaType = MediaType.NEC_525_HD; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && ImageInfo.sectorSize == 128) - ImageInfo.mediaType = MediaType.ATARI_525_SD; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 26 && ImageInfo.sectorSize == 128) - ImageInfo.mediaType = MediaType.ATARI_525_ED; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && ImageInfo.sectorSize == 256) - ImageInfo.mediaType = MediaType.ATARI_525_DD; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 36 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_ED; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 18 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_HD; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 21 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DMF; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 82 && ImageInfo.sectorsPerTrack == 21 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DMF_82; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 77 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 1024) - ImageInfo.mediaType = MediaType.NEC_35_HD_8; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.NEC_35_HD_15; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 5 && ImageInfo.sectorSize == 1024) - ImageInfo.mediaType = MediaType.ACORN_35_DS_DD; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 70 && ImageInfo.sectorsPerTrack == 9 && ImageInfo.sectorSize == 512) - ImageInfo.mediaType = MediaType.Apricot_35; - else - ImageInfo.mediaType = MediaType.Unknown; - - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - - return true; - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifyMediaImage() - { - return null; - } - - public override bool ImageHasPartitions() - { - return ImageInfo.imageHasPartitions; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] buffer = new byte[length * ImageInfo.sectorSize]; - - Stream stream = hdkImageFilter.GetDataForkStream(); - stream.Seek((long)(8 + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); - stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); - - return buffer; - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetImageFormat() - { - return "MAXI Disk"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override string GetMediaManufacturer() - { - return ImageInfo.mediaManufacturer; - } - - public override string GetMediaModel() - { - return ImageInfo.mediaModel; - } - - public override string GetMediaSerialNumber() - { - return ImageInfo.mediaSerialNumber; - } - - public override string GetMediaBarcode() - { - return ImageInfo.mediaBarcode; - } - - public override string GetMediaPartNumber() - { - return ImageInfo.mediaPartNumber; - } - - public override int GetMediaSequence() - { - return ImageInfo.mediaSequence; - } - - public override int GetLastDiskSequence() - { - return ImageInfo.lastMediaSequence; - } - - public override string GetDriveManufacturer() - { - return ImageInfo.driveManufacturer; - } - - public override string GetDriveModel() - { - return ImageInfo.driveModel; - } - - public override string GetDriveSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - #endregion Unsupported features - - #region Private methods - - private static uint DC42CheckSum(byte[] buffer) - { - uint dc42chk = 0; - if((buffer.Length & 0x01) == 0x01) - return 0xFFFFFFFF; - - for(uint i = 0; i < buffer.Length; i += 2) - { - dc42chk += (uint)(buffer[i] << 8); - dc42chk += buffer[i + 1]; - dc42chk = (dc42chk >> 1) | (dc42chk << 31); - } - return dc42chk; - } - - #endregion - } -} - + public class MaxiDisk : ImagePlugin + { + #region Internal Structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct HdkHeader + { + public byte unknown; + public byte diskType; + public byte heads; + public byte cylinders; + public byte bytesPerSector; + public byte sectorsPerTrack; + public byte unknown2; + public byte unknown3; + } + + enum HdkDiskTypes : byte + { + Dos360 = 0, + Maxi420 = 1, + Dos720 = 2, + Maxi800 = 3, + Dos1200 = 4, + Maxi1400 = 5, + Dos1440 = 6, + Mac1440 = 7, + Maxi1600 = 8, + Dmf = 9, + Dos2880 = 10, + Maxi3200 = 11 + } + #endregion + + #region Internal variables + /// <summary>Disk image file</summary> + Filter hdkImageFilter; + #endregion + + public MaxiDisk() + { + Name = "MAXI Disk image"; + PluginUUID = new Guid("D27D924A-7034-466E-ADE1-B81EF37E469E"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = false; + ImageInfo.imageHasSessions = false; + ImageInfo.imageApplication = "MAXI Disk"; + ImageInfo.imageCreator = null; + ImageInfo.imageComments = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaSerialNumber = null; + ImageInfo.mediaBarcode = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + + if(stream.Length < 8) return false; + + byte[] buffer = new byte[8]; + stream.Seek(0, SeekOrigin.Begin); + stream.Read(buffer, 0, buffer.Length); + + HdkHeader tmp_header = new HdkHeader(); + IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length); + Marshal.Copy(buffer, 0, ftrPtr, buffer.Length); + tmp_header = (HdkHeader)Marshal.PtrToStructure(ftrPtr, typeof(HdkHeader)); + Marshal.FreeHGlobal(ftrPtr); + + DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.unknown = {0}", tmp_header.unknown); + DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.diskType = {0}", tmp_header.diskType); + DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.heads = {0}", tmp_header.heads); + DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.cylinders = {0}", tmp_header.cylinders); + DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.bytesPerSector = {0}", tmp_header.bytesPerSector); + DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.sectorsPerTrack = {0}", + tmp_header.sectorsPerTrack); + DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.unknown2 = {0}", tmp_header.unknown2); + DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.unknown3 = {0}", tmp_header.unknown3); + + // This is hardcoded + // But its possible values are unknown... + //if(tmp_header.diskType > 11) + // return false; + + // Only floppies supported + if(tmp_header.heads == 0 || tmp_header.heads > 2) return false; + + // No floppies with more than this? + if(tmp_header.cylinders > 90) return false; + + // Maximum supported bps is 16384 + if(tmp_header.bytesPerSector > 7) return false; + + int expectedFileSize = tmp_header.heads * tmp_header.cylinders * tmp_header.sectorsPerTrack * + (128 << tmp_header.bytesPerSector) + 8; + + return expectedFileSize == stream.Length; + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + + if(stream.Length < 8) return false; + + byte[] buffer = new byte[8]; + stream.Seek(0, SeekOrigin.Begin); + stream.Read(buffer, 0, buffer.Length); + + HdkHeader tmp_header = new HdkHeader(); + IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length); + Marshal.Copy(buffer, 0, ftrPtr, buffer.Length); + tmp_header = (HdkHeader)Marshal.PtrToStructure(ftrPtr, typeof(HdkHeader)); + Marshal.FreeHGlobal(ftrPtr); + + // This is hardcoded + // But its possible values are unknown... + //if(tmp_header.diskType > 11) + // return false; + + // Only floppies supported + if(tmp_header.heads == 0 || tmp_header.heads > 2) return false; + + // No floppies with more than this? + if(tmp_header.cylinders > 90) return false; + + // Maximum supported bps is 16384 + if(tmp_header.bytesPerSector > 7) return false; + + int expectedFileSize = tmp_header.heads * tmp_header.cylinders * tmp_header.sectorsPerTrack * + (128 << tmp_header.bytesPerSector) + 8; + + if(expectedFileSize != stream.Length) return false; + + ImageInfo.cylinders = tmp_header.cylinders; + ImageInfo.heads = tmp_header.heads; + ImageInfo.sectorsPerTrack = tmp_header.sectorsPerTrack; + ImageInfo.sectors = (ulong)(tmp_header.heads * tmp_header.cylinders * tmp_header.sectorsPerTrack); + ImageInfo.sectorSize = (uint)(128 << tmp_header.bytesPerSector); + + hdkImageFilter = imageFilter; + + ImageInfo.imageSize = (ulong)(stream.Length - 8); + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + + if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_HD; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 16 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ACORN_525_DS_DD; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 16 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ACORN_525_SS_DD_80; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 10 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ACORN_525_SS_SD_80; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 77 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 1024) ImageInfo.mediaType = MediaType.NEC_525_HD; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && + ImageInfo.sectorSize == 128) ImageInfo.mediaType = MediaType.ATARI_525_SD; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 26 && + ImageInfo.sectorSize == 128) ImageInfo.mediaType = MediaType.ATARI_525_ED; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 18 && + ImageInfo.sectorSize == 256) ImageInfo.mediaType = MediaType.ATARI_525_DD; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 36 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_ED; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 18 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_HD; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 21 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DMF; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 82 && ImageInfo.sectorsPerTrack == 21 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DMF_82; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 77 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 1024) ImageInfo.mediaType = MediaType.NEC_35_HD_8; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.NEC_35_HD_15; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 5 && + ImageInfo.sectorSize == 1024) ImageInfo.mediaType = MediaType.ACORN_35_DS_DD; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 70 && ImageInfo.sectorsPerTrack == 9 && + ImageInfo.sectorSize == 512) ImageInfo.mediaType = MediaType.Apricot_35; + else ImageInfo.mediaType = MediaType.Unknown; + + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + + return true; + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifyMediaImage() + { + return null; + } + + public override bool ImageHasPartitions() + { + return ImageInfo.imageHasPartitions; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] buffer = new byte[length * ImageInfo.sectorSize]; + + Stream stream = hdkImageFilter.GetDataForkStream(); + stream.Seek((long)(8 + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); + stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); + + return buffer; + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetImageFormat() + { + return "MAXI Disk"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override string GetMediaManufacturer() + { + return ImageInfo.mediaManufacturer; + } + + public override string GetMediaModel() + { + return ImageInfo.mediaModel; + } + + public override string GetMediaSerialNumber() + { + return ImageInfo.mediaSerialNumber; + } + + public override string GetMediaBarcode() + { + return ImageInfo.mediaBarcode; + } + + public override string GetMediaPartNumber() + { + return ImageInfo.mediaPartNumber; + } + + public override int GetMediaSequence() + { + return ImageInfo.mediaSequence; + } + + public override int GetLastDiskSequence() + { + return ImageInfo.lastMediaSequence; + } + + public override string GetDriveManufacturer() + { + return ImageInfo.driveManufacturer; + } + + public override string GetDriveModel() + { + return ImageInfo.driveModel; + } + + public override string GetDriveSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + #endregion Unsupported features + + #region Private methods + private static uint DC42CheckSum(byte[] buffer) + { + uint dc42chk = 0; + if((buffer.Length & 0x01) == 0x01) return 0xFFFFFFFF; + + for(uint i = 0; i < buffer.Length; i += 2) + { + dc42chk += (uint)(buffer[i] << 8); + dc42chk += buffer[i + 1]; + dc42chk = (dc42chk >> 1) | (dc42chk << 31); + } + + return dc42chk; + } + #endregion + } +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/NDIF.cs b/DiscImageChef.DiscImages/NDIF.cs index a165f0a8..cf25fd3f 100644 --- a/DiscImageChef.DiscImages/NDIF.cs +++ b/DiscImageChef.DiscImages/NDIF.cs @@ -45,798 +45,783 @@ using SharpCompress.Compressors.ADC; namespace DiscImageChef.DiscImages { - // TODO: Detect OS X encrypted images - // TODO: Check checksum - // TODO: Implement segments - // TODO: Implement compression - public class NDIF : ImagePlugin - { - #region Internal constants - /// <summary> - /// Resource OSType for NDIF is "bcem" - /// </summary> - const uint NDIF_Resource = 0x6263656D; - /// <summary> - /// Resource ID is always 128? Never found another - /// </summary> - const short NDIF_ResourceID = 128; - #endregion - - #region Internal Structures - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ChunkHeader - { - /// <summary> - /// Version - /// </summary> - public short version; - /// <summary> - /// Filesystem ID - /// </summary> - public short driver; - /// <summary> - /// Disk image name, Str63 (Pascal string) - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] name; - /// <summary> - /// Sectors in image - /// </summary> - public uint sectors; - /// <summary> - /// Maximum number of sectors per chunk - /// </summary> - public uint maxSectorsPerChunk; - /// <summary> - /// Offset to add to every chunk offset - /// </summary> - public uint dataOffset; - /// <summary> - /// CRC28 of whole image - /// </summary> - public uint crc; - /// <summary> - /// Set to 1 if segmented - /// </summary> - public uint segmented; - /// <summary> - /// Unknown - /// </summary> - public uint p1; - /// <summary> - /// Unknown - /// </summary> - public uint p2; - /// <summary> - /// Unknown, spare? - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public uint[] unknown; - /// <summary> - /// Set to 1 by ShrinkWrap if image is encrypted - /// </summary> - public uint encrypted; - /// <summary> - /// Set by ShrinkWrap if image is encrypted, value is the same for same password - /// </summary> - public uint hash; - /// <summary> - /// How many chunks follow the header - /// </summary> - public uint chunks; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct BlockChunk - { - /// <summary> - /// Starting sector, 3 bytes - /// </summary> - public uint sector; - /// <summary> - /// Chunk type - /// </summary> - public byte type; - /// <summary> - /// Offset in start of chunk - /// </summary> - public uint offset; - /// <summary> - /// Length in bytes of chunk - /// </summary> - public uint length; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct SegmentHeader - { - /// <summary> - /// Segment # - /// </summary> - public ushort segment; - /// <summary> - /// How many segments - /// </summary> - public ushort segments; - /// <summary> - /// Seems to be a Guid, changes with different images, same for all segments of same image - /// </summary> - public Guid segmentId; - /// <summary> - /// Seems to be a CRC28 of this segment, unchecked - /// </summary> - public uint crc; - } - #endregion - - ChunkHeader header; - Dictionary<ulong, BlockChunk> chunks; - - const byte ChunkType_NoCopy = 0; - const byte ChunkType_Copy = 2; - const byte ChunkType_KenCode = 0x80; - const byte ChunkType_RLE = 0x81; - const byte ChunkType_LZH = 0x82; - const byte ChunkType_ADC = 0x83; - /// <summary> - /// Created by ShrinkWrap 3.5, dunno which version of the StuffIt algorithm it is using - /// </summary> - const byte ChunkType_StuffIt = 0xF0; - const byte ChunkType_End = 0xFF; - - const byte ChunkType_CompressedMask = 0x80; - - const short Driver_OSX = -1; - const short Driver_HFS = 0; - const short Driver_ProDOS = 256; - const short Driver_DOS = 18771; - - Dictionary<ulong, byte[]> sectorCache; - Dictionary<ulong, byte[]> chunkCache; - const uint MaxCacheSize = 16777216; - const uint sectorSize = 512; - uint maxCachedSectors = MaxCacheSize / sectorSize; - uint currentChunkCacheSize; - uint buffersize; - - Stream imageStream; - - public NDIF() - { - Name = "Apple New Disk Image Format"; - PluginUUID = new Guid("5A7FF7D8-491E-458D-8674-5B5EADBECC24"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = false; - ImageInfo.imageHasSessions = false; - ImageInfo.imageVersion = null; - ImageInfo.imageApplication = null; - ImageInfo.imageApplicationVersion = null; - ImageInfo.imageCreator = null; - ImageInfo.imageComments = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaSerialNumber = null; - ImageInfo.mediaBarcode = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - public override bool IdentifyImage(Filter imageFilter) - { - if(!imageFilter.HasResourceFork() || imageFilter.GetResourceForkLength() == 0) - return false; - - ResourceFork rsrcFork; - - try - { - rsrcFork = new ResourceFork(imageFilter.GetResourceForkStream()); - if(!rsrcFork.ContainsKey(NDIF_Resource)) - return false; - - Resource rsrc = rsrcFork.GetResource(NDIF_Resource); - - if(rsrc.ContainsId(NDIF_ResourceID)) - return true; - } - catch(InvalidCastException) - { - return false; - } - - return false; - } - - public override bool OpenImage(Filter imageFilter) - { - if(!imageFilter.HasResourceFork() || imageFilter.GetResourceForkLength() == 0) - return false; - - ResourceFork rsrcFork; - Resource rsrc; - short[] bcems; - - try - { - rsrcFork = new ResourceFork(imageFilter.GetResourceForkStream()); - if(!rsrcFork.ContainsKey(NDIF_Resource)) - return false; - - rsrc = rsrcFork.GetResource(NDIF_Resource); - - bcems = rsrc.GetIds(); - - if(bcems == null || bcems.Length == 0) - return false; - } - catch(InvalidCastException) - { - return false; - } - - ImageInfo.sectors = 0; - foreach(short id in bcems) - { - byte[] bcem = rsrc.GetResource(NDIF_ResourceID); - - if(bcem.Length < 128) - return false; - - header = BigEndianMarshal.ByteArrayToStructureBigEndian<ChunkHeader>(bcem); - - DicConsole.DebugWriteLine("NDIF plugin", "footer.type = {0}", header.version); - DicConsole.DebugWriteLine("NDIF plugin", "footer.driver = {0}", header.driver); - DicConsole.DebugWriteLine("NDIF plugin", "footer.name = {0}", StringHandlers.PascalToString(header.name, Encoding.GetEncoding("macintosh"))); - DicConsole.DebugWriteLine("NDIF plugin", "footer.sectors = {0}", header.sectors); - DicConsole.DebugWriteLine("NDIF plugin", "footer.maxSectorsPerChunk = {0}", header.maxSectorsPerChunk); - DicConsole.DebugWriteLine("NDIF plugin", "footer.dataOffset = {0}", header.dataOffset); - DicConsole.DebugWriteLine("NDIF plugin", "footer.crc = 0x{0:X7}", header.crc); - DicConsole.DebugWriteLine("NDIF plugin", "footer.segmented = {0}", header.segmented); - DicConsole.DebugWriteLine("NDIF plugin", "footer.p1 = 0x{0:X8}", header.p1); - DicConsole.DebugWriteLine("NDIF plugin", "footer.p2 = 0x{0:X8}", header.p2); - DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[0] = 0x{0:X8}", header.unknown[0]); - DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[1] = 0x{0:X8}", header.unknown[1]); - DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[2] = 0x{0:X8}", header.unknown[2]); - DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[3] = 0x{0:X8}", header.unknown[3]); - DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[4] = 0x{0:X8}", header.unknown[4]); - DicConsole.DebugWriteLine("NDIF plugin", "footer.encrypted = {0}", header.encrypted); - DicConsole.DebugWriteLine("NDIF plugin", "footer.hash = 0x{0:X8}", header.hash); - DicConsole.DebugWriteLine("NDIF plugin", "footer.chunks = {0}", header.chunks); - - // Block chunks and headers - chunks = new Dictionary<ulong, BlockChunk>(); - - BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - - for(int i = 0; i < header.chunks; i++) - { - // Obsolete read-only NDIF only prepended the header and then put the image without any kind of block references. - // So let's falsify a block chunk - BlockChunk bChnk = new BlockChunk(); - byte[] sector = new byte[4]; - Array.Copy(bcem, 128 + 0 + i * 12, sector, 1, 3); - bChnk.sector = BigEndianBitConverter.ToUInt32(sector, 0); - bChnk.type = bcem[128 + 3 + i * 12]; - bChnk.offset = BigEndianBitConverter.ToUInt32(bcem, 128 + 4 + i * 12); - bChnk.length = BigEndianBitConverter.ToUInt32(bcem, 128 + 8 + i * 12); - - DicConsole.DebugWriteLine("NDIF plugin", "bHdr.chunk[{0}].type = 0x{1:X2}", i, bChnk.type); - DicConsole.DebugWriteLine("NDIF plugin", "bHdr.chunk[{0}].sector = {1}", i, bChnk.sector); - DicConsole.DebugWriteLine("NDIF plugin", "bHdr.chunk[{0}].offset = {1}", i, bChnk.offset); - DicConsole.DebugWriteLine("NDIF plugin", "bHdr.chunk[{0}].length = {1}", i, bChnk.length); - - if(bChnk.type == ChunkType_End) - break; - - bChnk.offset += header.dataOffset; - bChnk.sector += (uint)ImageInfo.sectors; - - // TODO: Handle compressed chunks - if((bChnk.type == ChunkType_KenCode)) - throw new ImageNotSupportedException("Chunks compressed with KenCode are not yet supported."); - if((bChnk.type == ChunkType_RLE)) - throw new ImageNotSupportedException("Chunks compressed with RLE are not yet supported."); - if((bChnk.type == ChunkType_LZH)) - throw new ImageNotSupportedException("Chunks compressed with LZH are not yet supported."); - if((bChnk.type == ChunkType_StuffIt)) - throw new ImageNotSupportedException("Chunks compressed with StuffIt! are not yet supported."); - - // TODO: Handle compressed chunks - if((bChnk.type > ChunkType_Copy && bChnk.type < ChunkType_KenCode) || - (bChnk.type > ChunkType_ADC && bChnk.type < ChunkType_StuffIt) || - (bChnk.type > ChunkType_StuffIt && bChnk.type < ChunkType_End) || - bChnk.type == 1) - throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", bChnk.type)); - - chunks.Add(bChnk.sector, bChnk); - } - - ImageInfo.sectors += header.sectors; - } - - if(header.segmented > 0) - throw new ImageNotSupportedException("Segmented images are not yet supported."); - - if(header.encrypted > 0) - throw new ImageNotSupportedException("Encrypted images are not yet supported."); - - switch(ImageInfo.sectors) - { - case 1440: - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; - break; - case 1600: - ImageInfo.mediaType = MediaType.AppleSonyDS; - break; - case 2880: - ImageInfo.mediaType = MediaType.DOS_35_HD; - break; - case 3360: - ImageInfo.mediaType = MediaType.DMF; - break; - default: - ImageInfo.mediaType = MediaType.GENERIC_HDD; - break; - } - - if(rsrcFork.ContainsKey(0x76657273)) - { - Resource versRsrc = rsrcFork.GetResource(0x76657273); - if(versRsrc != null) - { - byte[] vers = versRsrc.GetResource(versRsrc.GetIds()[0]); - - Resources.Version version = new Resources.Version(vers); - - string major; - string minor; - string release = null; - string dev = null; - string pre = null; - - major = string.Format("{0}", version.MajorVersion); - minor = string.Format(".{0}", version.MinorVersion / 10); - if(version.MinorVersion % 10 > 0) - release = string.Format(".{0}", version.MinorVersion % 10); - switch(version.DevStage) - { - case Resources.Version.DevelopmentStage.Alpha: - dev = "a"; - break; - case Resources.Version.DevelopmentStage.Beta: - dev = "b"; - break; - case Resources.Version.DevelopmentStage.PreAlpha: - dev = "d"; - break; - } - - if(dev == null && version.PreReleaseVersion > 0) - dev = "f"; - - if(dev != null) - pre = string.Format("{0}", version.PreReleaseVersion); - - ImageInfo.imageApplicationVersion = string.Format("{0}{1}{2}{3}{4}", major, minor, release, dev, pre); - ImageInfo.imageApplication = version.VersionString; - ImageInfo.imageComments = version.VersionMessage; - - if(version.MajorVersion == 3) - ImageInfo.imageApplication = "ShrinkWrap™"; - else if(version.MajorVersion == 6) - ImageInfo.imageApplication = "DiskCopy"; - } - } - DicConsole.DebugWriteLine("NDIF plugin", "Image application = {0} version {1}", ImageInfo.imageApplication, ImageInfo.imageApplicationVersion); - - sectorCache = new Dictionary<ulong, byte[]>(); - chunkCache = new Dictionary<ulong, byte[]>(); - currentChunkCacheSize = 0; - imageStream = imageFilter.GetDataForkStream(); - buffersize = header.maxSectorsPerChunk * sectorSize; - - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = StringHandlers.PascalToString(header.name, Encoding.GetEncoding("macintosh")); - ImageInfo.sectorSize = sectorSize; - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.imageSize = ImageInfo.sectors * sectorSize; - ImageInfo.imageApplicationVersion = "6"; - ImageInfo.imageApplication = "Apple DiskCopy"; - - switch(ImageInfo.mediaType) - { - case MediaType.AppleSonyDS: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 10; - break; - case MediaType.DOS_35_DS_DD_9: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 9; - break; - case MediaType.DOS_35_HD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 18; - break; - case MediaType.DMF: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 21; - break; - default: - ImageInfo.mediaType = MediaType.GENERIC_HDD; - ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); - ImageInfo.heads = 16; - ImageInfo.sectorsPerTrack = 63; - break; - } - - return true; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - byte[] sector; - - if(sectorCache.TryGetValue(sectorAddress, out sector)) - return sector; - - BlockChunk currentChunk = new BlockChunk(); - bool chunkFound = false; - ulong chunkStartSector = 0; - - foreach(KeyValuePair<ulong, BlockChunk> kvp in chunks) - { - if(sectorAddress >= kvp.Key) - { - currentChunk = kvp.Value; - chunkFound = true; - chunkStartSector = kvp.Key; - } - } - - long relOff = ((long)sectorAddress - (long)chunkStartSector) * sectorSize; - - if(relOff < 0) - throw new ArgumentOutOfRangeException(nameof(relOff), string.Format("Got a negative offset for sector {0}. This should not happen.", sectorAddress)); - - if(!chunkFound) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if((currentChunk.type & ChunkType_CompressedMask) == ChunkType_CompressedMask) - { - byte[] buffer; - if(!chunkCache.TryGetValue(chunkStartSector, out buffer)) - { - byte[] cmpBuffer = new byte[currentChunk.length]; - imageStream.Seek(currentChunk.offset, SeekOrigin.Begin); - imageStream.Read(cmpBuffer, 0, cmpBuffer.Length); - MemoryStream cmpMs = new MemoryStream(cmpBuffer); - Stream decStream; - - if(currentChunk.type == ChunkType_ADC) - decStream = new ADCStream(cmpMs, CompressionMode.Decompress); - else - throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", currentChunk.type)); - - byte[] tmpBuffer = new byte[buffersize]; - int realSize = decStream.Read(tmpBuffer, 0, (int)buffersize); - buffer = new byte[realSize]; - Array.Copy(tmpBuffer, 0, buffer, 0, realSize); - tmpBuffer = null; - - if(currentChunkCacheSize + realSize > MaxCacheSize) - { - chunkCache.Clear(); - currentChunkCacheSize = 0; - } - - chunkCache.Add(chunkStartSector, buffer); - currentChunkCacheSize += (uint)realSize; - } - - sector = new byte[sectorSize]; - Array.Copy(buffer, relOff, sector, 0, sectorSize); - - if(sectorCache.Count >= maxCachedSectors) - sectorCache.Clear(); - - sectorCache.Add(sectorAddress, sector); - - return sector; - } - - if(currentChunk.type == ChunkType_NoCopy) - { - sector = new byte[sectorSize]; - - if(sectorCache.Count >= maxCachedSectors) - sectorCache.Clear(); - - sectorCache.Add(sectorAddress, sector); - return sector; - } - - if(currentChunk.type == ChunkType_Copy) - { - imageStream.Seek(currentChunk.offset + relOff, SeekOrigin.Begin); - sector = new byte[sectorSize]; - imageStream.Read(sector, 0, sector.Length); - - if(sectorCache.Count >= maxCachedSectors) - sectorCache.Clear(); - - sectorCache.Add(sectorAddress, sector); - return sector; - } - - throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", currentChunk.type)); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - MemoryStream ms = new MemoryStream(); - - for(uint i = 0; i < length; i++) - { - byte[] sector = ReadSector(sectorAddress + i); - ms.Write(sector, 0, sector.Length); - } - - return ms.ToArray(); - } - - public override bool ImageHasPartitions() - { - return false; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override string GetImageFormat() - { - return "Apple New Disk Image Format"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - #region Unsupported features - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetMediaManufacturer() - { - return null; - } - - public override string GetMediaModel() - { - return null; - } - - public override string GetMediaSerialNumber() - { - return null; - } - - public override string GetMediaBarcode() - { - return null; - } - - public override string GetMediaPartNumber() - { - return null; - } - - public override int GetMediaSequence() - { - return 0; - } - - public override int GetLastDiskSequence() - { - return 0; - } - - public override string GetDriveManufacturer() - { - return null; - } - - public override string GetDriveModel() - { - return null; - } - - public override string GetDriveSerialNumber() - { - return null; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifyMediaImage() - { - return null; - } - - #endregion - } -} - + // TODO: Detect OS X encrypted images + // TODO: Check checksum + // TODO: Implement segments + // TODO: Implement compression + public class NDIF : ImagePlugin + { + #region Internal constants + /// <summary> + /// Resource OSType for NDIF is "bcem" + /// </summary> + const uint NDIF_Resource = 0x6263656D; + /// <summary> + /// Resource ID is always 128? Never found another + /// </summary> + const short NDIF_ResourceID = 128; + #endregion + + #region Internal Structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ChunkHeader + { + /// <summary> + /// Version + /// </summary> + public short version; + /// <summary> + /// Filesystem ID + /// </summary> + public short driver; + /// <summary> + /// Disk image name, Str63 (Pascal string) + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] name; + /// <summary> + /// Sectors in image + /// </summary> + public uint sectors; + /// <summary> + /// Maximum number of sectors per chunk + /// </summary> + public uint maxSectorsPerChunk; + /// <summary> + /// Offset to add to every chunk offset + /// </summary> + public uint dataOffset; + /// <summary> + /// CRC28 of whole image + /// </summary> + public uint crc; + /// <summary> + /// Set to 1 if segmented + /// </summary> + public uint segmented; + /// <summary> + /// Unknown + /// </summary> + public uint p1; + /// <summary> + /// Unknown + /// </summary> + public uint p2; + /// <summary> + /// Unknown, spare? + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public uint[] unknown; + /// <summary> + /// Set to 1 by ShrinkWrap if image is encrypted + /// </summary> + public uint encrypted; + /// <summary> + /// Set by ShrinkWrap if image is encrypted, value is the same for same password + /// </summary> + public uint hash; + /// <summary> + /// How many chunks follow the header + /// </summary> + public uint chunks; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct BlockChunk + { + /// <summary> + /// Starting sector, 3 bytes + /// </summary> + public uint sector; + /// <summary> + /// Chunk type + /// </summary> + public byte type; + /// <summary> + /// Offset in start of chunk + /// </summary> + public uint offset; + /// <summary> + /// Length in bytes of chunk + /// </summary> + public uint length; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct SegmentHeader + { + /// <summary> + /// Segment # + /// </summary> + public ushort segment; + /// <summary> + /// How many segments + /// </summary> + public ushort segments; + /// <summary> + /// Seems to be a Guid, changes with different images, same for all segments of same image + /// </summary> + public Guid segmentId; + /// <summary> + /// Seems to be a CRC28 of this segment, unchecked + /// </summary> + public uint crc; + } + #endregion + + ChunkHeader header; + Dictionary<ulong, BlockChunk> chunks; + + const byte ChunkType_NoCopy = 0; + const byte ChunkType_Copy = 2; + const byte ChunkType_KenCode = 0x80; + const byte ChunkType_RLE = 0x81; + const byte ChunkType_LZH = 0x82; + const byte ChunkType_ADC = 0x83; + /// <summary> + /// Created by ShrinkWrap 3.5, dunno which version of the StuffIt algorithm it is using + /// </summary> + const byte ChunkType_StuffIt = 0xF0; + const byte ChunkType_End = 0xFF; + + const byte ChunkType_CompressedMask = 0x80; + + const short Driver_OSX = -1; + const short Driver_HFS = 0; + const short Driver_ProDOS = 256; + const short Driver_DOS = 18771; + + Dictionary<ulong, byte[]> sectorCache; + Dictionary<ulong, byte[]> chunkCache; + const uint MaxCacheSize = 16777216; + const uint sectorSize = 512; + uint maxCachedSectors = MaxCacheSize / sectorSize; + uint currentChunkCacheSize; + uint buffersize; + + Stream imageStream; + + public NDIF() + { + Name = "Apple New Disk Image Format"; + PluginUUID = new Guid("5A7FF7D8-491E-458D-8674-5B5EADBECC24"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = false; + ImageInfo.imageHasSessions = false; + ImageInfo.imageVersion = null; + ImageInfo.imageApplication = null; + ImageInfo.imageApplicationVersion = null; + ImageInfo.imageCreator = null; + ImageInfo.imageComments = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaSerialNumber = null; + ImageInfo.mediaBarcode = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + public override bool IdentifyImage(Filter imageFilter) + { + if(!imageFilter.HasResourceFork() || imageFilter.GetResourceForkLength() == 0) return false; + + ResourceFork rsrcFork; + + try + { + rsrcFork = new ResourceFork(imageFilter.GetResourceForkStream()); + if(!rsrcFork.ContainsKey(NDIF_Resource)) return false; + + Resource rsrc = rsrcFork.GetResource(NDIF_Resource); + + if(rsrc.ContainsId(NDIF_ResourceID)) return true; + } + catch(InvalidCastException) { return false; } + + return false; + } + + public override bool OpenImage(Filter imageFilter) + { + if(!imageFilter.HasResourceFork() || imageFilter.GetResourceForkLength() == 0) return false; + + ResourceFork rsrcFork; + Resource rsrc; + short[] bcems; + + try + { + rsrcFork = new ResourceFork(imageFilter.GetResourceForkStream()); + if(!rsrcFork.ContainsKey(NDIF_Resource)) return false; + + rsrc = rsrcFork.GetResource(NDIF_Resource); + + bcems = rsrc.GetIds(); + + if(bcems == null || bcems.Length == 0) return false; + } + catch(InvalidCastException) { return false; } + + ImageInfo.sectors = 0; + foreach(short id in bcems) + { + byte[] bcem = rsrc.GetResource(NDIF_ResourceID); + + if(bcem.Length < 128) return false; + + header = BigEndianMarshal.ByteArrayToStructureBigEndian<ChunkHeader>(bcem); + + DicConsole.DebugWriteLine("NDIF plugin", "footer.type = {0}", header.version); + DicConsole.DebugWriteLine("NDIF plugin", "footer.driver = {0}", header.driver); + DicConsole.DebugWriteLine("NDIF plugin", "footer.name = {0}", + StringHandlers.PascalToString(header.name, + Encoding.GetEncoding("macintosh"))); + DicConsole.DebugWriteLine("NDIF plugin", "footer.sectors = {0}", header.sectors); + DicConsole.DebugWriteLine("NDIF plugin", "footer.maxSectorsPerChunk = {0}", header.maxSectorsPerChunk); + DicConsole.DebugWriteLine("NDIF plugin", "footer.dataOffset = {0}", header.dataOffset); + DicConsole.DebugWriteLine("NDIF plugin", "footer.crc = 0x{0:X7}", header.crc); + DicConsole.DebugWriteLine("NDIF plugin", "footer.segmented = {0}", header.segmented); + DicConsole.DebugWriteLine("NDIF plugin", "footer.p1 = 0x{0:X8}", header.p1); + DicConsole.DebugWriteLine("NDIF plugin", "footer.p2 = 0x{0:X8}", header.p2); + DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[0] = 0x{0:X8}", header.unknown[0]); + DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[1] = 0x{0:X8}", header.unknown[1]); + DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[2] = 0x{0:X8}", header.unknown[2]); + DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[3] = 0x{0:X8}", header.unknown[3]); + DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[4] = 0x{0:X8}", header.unknown[4]); + DicConsole.DebugWriteLine("NDIF plugin", "footer.encrypted = {0}", header.encrypted); + DicConsole.DebugWriteLine("NDIF plugin", "footer.hash = 0x{0:X8}", header.hash); + DicConsole.DebugWriteLine("NDIF plugin", "footer.chunks = {0}", header.chunks); + + // Block chunks and headers + chunks = new Dictionary<ulong, BlockChunk>(); + + BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; + + for(int i = 0; i < header.chunks; i++) + { + // Obsolete read-only NDIF only prepended the header and then put the image without any kind of block references. + // So let's falsify a block chunk + BlockChunk bChnk = new BlockChunk(); + byte[] sector = new byte[4]; + Array.Copy(bcem, 128 + 0 + i * 12, sector, 1, 3); + bChnk.sector = BigEndianBitConverter.ToUInt32(sector, 0); + bChnk.type = bcem[128 + 3 + i * 12]; + bChnk.offset = BigEndianBitConverter.ToUInt32(bcem, 128 + 4 + i * 12); + bChnk.length = BigEndianBitConverter.ToUInt32(bcem, 128 + 8 + i * 12); + + DicConsole.DebugWriteLine("NDIF plugin", "bHdr.chunk[{0}].type = 0x{1:X2}", i, bChnk.type); + DicConsole.DebugWriteLine("NDIF plugin", "bHdr.chunk[{0}].sector = {1}", i, bChnk.sector); + DicConsole.DebugWriteLine("NDIF plugin", "bHdr.chunk[{0}].offset = {1}", i, bChnk.offset); + DicConsole.DebugWriteLine("NDIF plugin", "bHdr.chunk[{0}].length = {1}", i, bChnk.length); + + if(bChnk.type == ChunkType_End) break; + + bChnk.offset += header.dataOffset; + bChnk.sector += (uint)ImageInfo.sectors; + + // TODO: Handle compressed chunks + if((bChnk.type == ChunkType_KenCode)) + throw new ImageNotSupportedException("Chunks compressed with KenCode are not yet supported."); + if((bChnk.type == ChunkType_RLE)) + throw new ImageNotSupportedException("Chunks compressed with RLE are not yet supported."); + if((bChnk.type == ChunkType_LZH)) + throw new ImageNotSupportedException("Chunks compressed with LZH are not yet supported."); + if((bChnk.type == ChunkType_StuffIt)) + throw new ImageNotSupportedException("Chunks compressed with StuffIt! are not yet supported."); + + // TODO: Handle compressed chunks + if((bChnk.type > ChunkType_Copy && bChnk.type < ChunkType_KenCode) || + (bChnk.type > ChunkType_ADC && bChnk.type < ChunkType_StuffIt) || + (bChnk.type > ChunkType_StuffIt && bChnk.type < ChunkType_End) || + bChnk.type == 1) + throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", + bChnk.type)); + + chunks.Add(bChnk.sector, bChnk); + } + + ImageInfo.sectors += header.sectors; + } + + if(header.segmented > 0) throw new ImageNotSupportedException("Segmented images are not yet supported."); + + if(header.encrypted > 0) throw new ImageNotSupportedException("Encrypted images are not yet supported."); + + switch(ImageInfo.sectors) + { + case 1440: + ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; + break; + case 1600: + ImageInfo.mediaType = MediaType.AppleSonyDS; + break; + case 2880: + ImageInfo.mediaType = MediaType.DOS_35_HD; + break; + case 3360: + ImageInfo.mediaType = MediaType.DMF; + break; + default: + ImageInfo.mediaType = MediaType.GENERIC_HDD; + break; + } + + if(rsrcFork.ContainsKey(0x76657273)) + { + Resource versRsrc = rsrcFork.GetResource(0x76657273); + if(versRsrc != null) + { + byte[] vers = versRsrc.GetResource(versRsrc.GetIds()[0]); + + Resources.Version version = new Resources.Version(vers); + + string major; + string minor; + string release = null; + string dev = null; + string pre = null; + + major = string.Format("{0}", version.MajorVersion); + minor = string.Format(".{0}", version.MinorVersion / 10); + if(version.MinorVersion % 10 > 0) release = string.Format(".{0}", version.MinorVersion % 10); + switch(version.DevStage) + { + case Resources.Version.DevelopmentStage.Alpha: + dev = "a"; + break; + case Resources.Version.DevelopmentStage.Beta: + dev = "b"; + break; + case Resources.Version.DevelopmentStage.PreAlpha: + dev = "d"; + break; + } + + if(dev == null && version.PreReleaseVersion > 0) dev = "f"; + + if(dev != null) pre = string.Format("{0}", version.PreReleaseVersion); + + ImageInfo.imageApplicationVersion = + string.Format("{0}{1}{2}{3}{4}", major, minor, release, dev, pre); + ImageInfo.imageApplication = version.VersionString; + ImageInfo.imageComments = version.VersionMessage; + + if(version.MajorVersion == 3) ImageInfo.imageApplication = "ShrinkWrap™"; + else if(version.MajorVersion == 6) ImageInfo.imageApplication = "DiskCopy"; + } + } + + DicConsole.DebugWriteLine("NDIF plugin", "Image application = {0} version {1}", ImageInfo.imageApplication, + ImageInfo.imageApplicationVersion); + + sectorCache = new Dictionary<ulong, byte[]>(); + chunkCache = new Dictionary<ulong, byte[]>(); + currentChunkCacheSize = 0; + imageStream = imageFilter.GetDataForkStream(); + buffersize = header.maxSectorsPerChunk * sectorSize; + + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = StringHandlers.PascalToString(header.name, Encoding.GetEncoding("macintosh")); + ImageInfo.sectorSize = sectorSize; + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.imageSize = ImageInfo.sectors * sectorSize; + ImageInfo.imageApplicationVersion = "6"; + ImageInfo.imageApplication = "Apple DiskCopy"; + + switch(ImageInfo.mediaType) + { + case MediaType.AppleSonyDS: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 10; + break; + case MediaType.DOS_35_DS_DD_9: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 9; + break; + case MediaType.DOS_35_HD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 18; + break; + case MediaType.DMF: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 21; + break; + default: + ImageInfo.mediaType = MediaType.GENERIC_HDD; + ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); + ImageInfo.heads = 16; + ImageInfo.sectorsPerTrack = 63; + break; + } + + return true; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + byte[] sector; + + if(sectorCache.TryGetValue(sectorAddress, out sector)) return sector; + + BlockChunk currentChunk = new BlockChunk(); + bool chunkFound = false; + ulong chunkStartSector = 0; + + foreach(KeyValuePair<ulong, BlockChunk> kvp in chunks) + { + if(sectorAddress >= kvp.Key) + { + currentChunk = kvp.Value; + chunkFound = true; + chunkStartSector = kvp.Key; + } + } + + long relOff = ((long)sectorAddress - (long)chunkStartSector) * sectorSize; + + if(relOff < 0) + throw new ArgumentOutOfRangeException(nameof(relOff), + string + .Format("Got a negative offset for sector {0}. This should not happen.", + sectorAddress)); + + if(!chunkFound) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if((currentChunk.type & ChunkType_CompressedMask) == ChunkType_CompressedMask) + { + byte[] buffer; + if(!chunkCache.TryGetValue(chunkStartSector, out buffer)) + { + byte[] cmpBuffer = new byte[currentChunk.length]; + imageStream.Seek(currentChunk.offset, SeekOrigin.Begin); + imageStream.Read(cmpBuffer, 0, cmpBuffer.Length); + MemoryStream cmpMs = new MemoryStream(cmpBuffer); + Stream decStream; + + if(currentChunk.type == ChunkType_ADC) decStream = new ADCStream(cmpMs, CompressionMode.Decompress); + else + throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", + currentChunk.type)); + + byte[] tmpBuffer = new byte[buffersize]; + int realSize = decStream.Read(tmpBuffer, 0, (int)buffersize); + buffer = new byte[realSize]; + Array.Copy(tmpBuffer, 0, buffer, 0, realSize); + tmpBuffer = null; + + if(currentChunkCacheSize + realSize > MaxCacheSize) + { + chunkCache.Clear(); + currentChunkCacheSize = 0; + } + + chunkCache.Add(chunkStartSector, buffer); + currentChunkCacheSize += (uint)realSize; + } + + sector = new byte[sectorSize]; + Array.Copy(buffer, relOff, sector, 0, sectorSize); + + if(sectorCache.Count >= maxCachedSectors) sectorCache.Clear(); + + sectorCache.Add(sectorAddress, sector); + + return sector; + } + + if(currentChunk.type == ChunkType_NoCopy) + { + sector = new byte[sectorSize]; + + if(sectorCache.Count >= maxCachedSectors) sectorCache.Clear(); + + sectorCache.Add(sectorAddress, sector); + return sector; + } + + if(currentChunk.type == ChunkType_Copy) + { + imageStream.Seek(currentChunk.offset + relOff, SeekOrigin.Begin); + sector = new byte[sectorSize]; + imageStream.Read(sector, 0, sector.Length); + + if(sectorCache.Count >= maxCachedSectors) sectorCache.Clear(); + + sectorCache.Add(sectorAddress, sector); + return sector; + } + + throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", + currentChunk.type)); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + MemoryStream ms = new MemoryStream(); + + for(uint i = 0; i < length; i++) + { + byte[] sector = ReadSector(sectorAddress + i); + ms.Write(sector, 0, sector.Length); + } + + return ms.ToArray(); + } + + public override bool ImageHasPartitions() + { + return false; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override string GetImageFormat() + { + return "Apple New Disk Image Format"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + #region Unsupported features + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetMediaManufacturer() + { + return null; + } + + public override string GetMediaModel() + { + return null; + } + + public override string GetMediaSerialNumber() + { + return null; + } + + public override string GetMediaBarcode() + { + return null; + } + + public override string GetMediaPartNumber() + { + return null; + } + + public override int GetMediaSequence() + { + return 0; + } + + public override int GetLastDiskSequence() + { + return 0; + } + + public override string GetDriveManufacturer() + { + return null; + } + + public override string GetDriveModel() + { + return null; + } + + public override string GetDriveSerialNumber() + { + return null; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifyMediaImage() + { + return null; + } + #endregion + } +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/NHDr0.cs b/DiscImageChef.DiscImages/NHDr0.cs index 03d9a05a..4d6fa5e6 100644 --- a/DiscImageChef.DiscImages/NHDr0.cs +++ b/DiscImageChef.DiscImages/NHDr0.cs @@ -42,392 +42,387 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - // Info from http://www.geocities.jp/t98next/nhdr0.txt - public class NHDr0 : ImagePlugin - { - #region Internal structures - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct NHDr0Header - { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] - public byte[] szFileID; - public byte reserved1; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x100)] - public byte[] szComment; - public int dwHeadSize; - public int dwCylinder; - public short wHead; - public short wSect; - public short wSectLen; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] reserved2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0xE0)] - public byte[] reserved3; - } - #endregion - - readonly byte[] signature = { 0x54, 0x39, 0x38, 0x48, 0x44, 0x44, 0x49, 0x4D, 0x41, 0x47, 0x45, 0x2E, 0x52, 0x30, 0x00 }; - - public NHDr0() - { - Name = "T98-Next NHD r0 Disk Image"; - PluginUUID = new Guid("6ECACD0A-8F4D-4465-8815-AEA000D370E3"); - ImageInfo = new ImageInfo() - { - readableSectorTags = new List<SectorTagType>(), - readableMediaTags = new List<MediaTagType>(), - imageHasPartitions = false, - imageHasSessions = false, - imageVersion = null, - imageApplication = null, - imageApplicationVersion = null, - imageCreator = null, - imageComments = null, - mediaManufacturer = null, - mediaModel = null, - mediaSerialNumber = null, - mediaBarcode = null, - mediaPartNumber = null, - mediaSequence = 0, - lastMediaSequence = 0, - driveManufacturer = null, - driveModel = null, - driveSerialNumber = null, - driveFirmwareRevision = null - }; - } - - NHDr0Header nhdhdr; - Filter nhdImageFilter; - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - // Even if comment is supposedly ASCII, I'm pretty sure most emulators allow Shift-JIS to be used :p - Encoding shiftjis = Encoding.GetEncoding("shift_jis"); - - nhdhdr = new NHDr0Header(); - - if(stream.Length < Marshal.SizeOf(nhdhdr)) - return false; - - byte[] hdr_b = new byte[Marshal.SizeOf(nhdhdr)]; - stream.Read(hdr_b, 0, hdr_b.Length); - - GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); - nhdhdr = (NHDr0Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(NHDr0Header)); - handle.Free(); - - if(!nhdhdr.szFileID.SequenceEqual(signature)) - return false; - - DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.szFileID = \"{0}\"", StringHandlers.CToString(nhdhdr.szFileID, shiftjis)); - DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.reserved1 = {0}", nhdhdr.reserved1); - DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.szComment = \"{0}\"", StringHandlers.CToString(nhdhdr.szComment, shiftjis)); - DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.dwHeadSize = {0}", nhdhdr.dwHeadSize); - DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.dwCylinder = {0}", nhdhdr.dwCylinder); - DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.wHead = {0}", nhdhdr.wHead); - DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.wSect = {0}", nhdhdr.wSect); - DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.wSectLen = {0}", nhdhdr.wSectLen); - - return true; - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - // Even if comment is supposedly ASCII, I'm pretty sure most emulators allow Shift-JIS to be used :p - Encoding shiftjis = Encoding.GetEncoding("shift_jis"); - - nhdhdr = new NHDr0Header(); - - if(stream.Length < Marshal.SizeOf(nhdhdr)) - return false; - - byte[] hdr_b = new byte[Marshal.SizeOf(nhdhdr)]; - stream.Read(hdr_b, 0, hdr_b.Length); - - GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); - nhdhdr = (NHDr0Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(NHDr0Header)); - handle.Free(); - - ImageInfo.mediaType = MediaType.GENERIC_HDD; - - - ImageInfo.imageSize = (ulong)(stream.Length - nhdhdr.dwHeadSize); - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.sectors = (ulong)(nhdhdr.dwCylinder * nhdhdr.wHead * nhdhdr.wSect); - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.sectorSize = (uint)nhdhdr.wSectLen; - ImageInfo.cylinders = (uint)nhdhdr.dwCylinder; - ImageInfo.heads = (uint)nhdhdr.wHead; - ImageInfo.sectorsPerTrack = (uint)nhdhdr.wSect; - ImageInfo.imageComments = StringHandlers.CToString(nhdhdr.szComment, shiftjis); - - nhdImageFilter = imageFilter; - - return true; - } - - public override bool ImageHasPartitions() - { - return false; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override string GetImageFormat() - { - return "NHDr0 disk image"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] buffer = new byte[length * ImageInfo.sectorSize]; - - Stream stream = nhdImageFilter.GetDataForkStream(); - - stream.Seek((long)((ulong)nhdhdr.dwHeadSize + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); - - stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); - - return buffer; - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetMediaManufacturer() - { - return null; - } - - public override string GetMediaModel() - { - return null; - } - - public override string GetMediaSerialNumber() - { - return null; - } - - public override string GetMediaBarcode() - { - return null; - } - - public override string GetMediaPartNumber() - { - return null; - } - - public override int GetMediaSequence() - { - return 0; - } - - public override int GetLastDiskSequence() - { - return 0; - } - - public override string GetDriveManufacturer() - { - return null; - } - - public override string GetDriveModel() - { - return null; - } - - public override string GetDriveSerialNumber() - { - return null; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifyMediaImage() - { - return null; - } - - #endregion - } + // Info from http://www.geocities.jp/t98next/nhdr0.txt + public class NHDr0 : ImagePlugin + { + #region Internal structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct NHDr0Header + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public byte[] szFileID; + public byte reserved1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x100)] public byte[] szComment; + public int dwHeadSize; + public int dwCylinder; + public short wHead; + public short wSect; + public short wSectLen; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] reserved2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0xE0)] public byte[] reserved3; + } + #endregion + + readonly byte[] signature = + {0x54, 0x39, 0x38, 0x48, 0x44, 0x44, 0x49, 0x4D, 0x41, 0x47, 0x45, 0x2E, 0x52, 0x30, 0x00}; + + public NHDr0() + { + Name = "T98-Next NHD r0 Disk Image"; + PluginUUID = new Guid("6ECACD0A-8F4D-4465-8815-AEA000D370E3"); + ImageInfo = new ImageInfo() + { + readableSectorTags = new List<SectorTagType>(), + readableMediaTags = new List<MediaTagType>(), + imageHasPartitions = false, + imageHasSessions = false, + imageVersion = null, + imageApplication = null, + imageApplicationVersion = null, + imageCreator = null, + imageComments = null, + mediaManufacturer = null, + mediaModel = null, + mediaSerialNumber = null, + mediaBarcode = null, + mediaPartNumber = null, + mediaSequence = 0, + lastMediaSequence = 0, + driveManufacturer = null, + driveModel = null, + driveSerialNumber = null, + driveFirmwareRevision = null + }; + } + + NHDr0Header nhdhdr; + Filter nhdImageFilter; + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + // Even if comment is supposedly ASCII, I'm pretty sure most emulators allow Shift-JIS to be used :p + Encoding shiftjis = Encoding.GetEncoding("shift_jis"); + + nhdhdr = new NHDr0Header(); + + if(stream.Length < Marshal.SizeOf(nhdhdr)) return false; + + byte[] hdr_b = new byte[Marshal.SizeOf(nhdhdr)]; + stream.Read(hdr_b, 0, hdr_b.Length); + + GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); + nhdhdr = (NHDr0Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(NHDr0Header)); + handle.Free(); + + if(!nhdhdr.szFileID.SequenceEqual(signature)) return false; + + DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.szFileID = \"{0}\"", + StringHandlers.CToString(nhdhdr.szFileID, shiftjis)); + DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.reserved1 = {0}", nhdhdr.reserved1); + DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.szComment = \"{0}\"", + StringHandlers.CToString(nhdhdr.szComment, shiftjis)); + DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.dwHeadSize = {0}", nhdhdr.dwHeadSize); + DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.dwCylinder = {0}", nhdhdr.dwCylinder); + DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.wHead = {0}", nhdhdr.wHead); + DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.wSect = {0}", nhdhdr.wSect); + DicConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.wSectLen = {0}", nhdhdr.wSectLen); + + return true; + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + // Even if comment is supposedly ASCII, I'm pretty sure most emulators allow Shift-JIS to be used :p + Encoding shiftjis = Encoding.GetEncoding("shift_jis"); + + nhdhdr = new NHDr0Header(); + + if(stream.Length < Marshal.SizeOf(nhdhdr)) return false; + + byte[] hdr_b = new byte[Marshal.SizeOf(nhdhdr)]; + stream.Read(hdr_b, 0, hdr_b.Length); + + GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); + nhdhdr = (NHDr0Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(NHDr0Header)); + handle.Free(); + + ImageInfo.mediaType = MediaType.GENERIC_HDD; + + ImageInfo.imageSize = (ulong)(stream.Length - nhdhdr.dwHeadSize); + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.sectors = (ulong)(nhdhdr.dwCylinder * nhdhdr.wHead * nhdhdr.wSect); + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.sectorSize = (uint)nhdhdr.wSectLen; + ImageInfo.cylinders = (uint)nhdhdr.dwCylinder; + ImageInfo.heads = (uint)nhdhdr.wHead; + ImageInfo.sectorsPerTrack = (uint)nhdhdr.wSect; + ImageInfo.imageComments = StringHandlers.CToString(nhdhdr.szComment, shiftjis); + + nhdImageFilter = imageFilter; + + return true; + } + + public override bool ImageHasPartitions() + { + return false; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override string GetImageFormat() + { + return "NHDr0 disk image"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] buffer = new byte[length * ImageInfo.sectorSize]; + + Stream stream = nhdImageFilter.GetDataForkStream(); + + stream.Seek((long)((ulong)nhdhdr.dwHeadSize + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); + + stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); + + return buffer; + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetMediaManufacturer() + { + return null; + } + + public override string GetMediaModel() + { + return null; + } + + public override string GetMediaSerialNumber() + { + return null; + } + + public override string GetMediaBarcode() + { + return null; + } + + public override string GetMediaPartNumber() + { + return null; + } + + public override int GetMediaSequence() + { + return 0; + } + + public override int GetLastDiskSequence() + { + return 0; + } + + public override string GetDriveManufacturer() + { + return null; + } + + public override string GetDriveModel() + { + return null; + } + + public override string GetDriveSerialNumber() + { + return null; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifyMediaImage() + { + return null; + } + #endregion + } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/Nero.cs b/DiscImageChef.DiscImages/Nero.cs index 9cd3bd58..f4d8da3b 100644 --- a/DiscImageChef.DiscImages/Nero.cs +++ b/DiscImageChef.DiscImages/Nero.cs @@ -40,10 +40,9 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class Nero : ImagePlugin + public class Nero : ImagePlugin { #region Internal structures - struct NeroV1Footer { /// <summary> @@ -600,11 +599,9 @@ namespace DiscImageChef.ImagePlugins public ulong Index1; public uint Sequence; } - #endregion #region Internal consts - // "NERO" public const uint NeroV1FooterID = 0x4E45524F; @@ -831,11 +828,9 @@ namespace DiscImageChef.ImagePlugins /// </summary> NERO_MTYP_DVD_ANY_OLD = NERO_MTYP_DVD_M | NERO_MTYP_DVD_P | NERO_MTYP_DVD_RAM, } - #endregion #region Internal variables - Filter _imageFilter; Stream imageStream; bool imageNewFormat; @@ -859,11 +854,9 @@ namespace DiscImageChef.ImagePlugins Dictionary<uint, ulong> offsetmap; List<Session> imageSessions; List<Partition> ImagePartitions; - #endregion #region Methods - public Nero() { Name = "Nero Burning ROM image"; @@ -943,25 +936,27 @@ namespace DiscImageChef.ImagePlugins footerV2.FirstChunkOffset = BigEndianBitConverter.ToUInt64(buffer, 4); DicConsole.DebugWriteLine("Nero plugin", "imageStream.Length = {0}", imageStream.Length); - DicConsole.DebugWriteLine("Nero plugin", "footerV1.ChunkID = 0x{0:X8} (\"{1}\")", footerV1.ChunkID, System.Text.Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(footerV1.ChunkID))); + DicConsole.DebugWriteLine("Nero plugin", "footerV1.ChunkID = 0x{0:X8} (\"{1}\")", footerV1.ChunkID, + System.Text.Encoding.ASCII + .GetString(BigEndianBitConverter.GetBytes(footerV1.ChunkID))); DicConsole.DebugWriteLine("Nero plugin", "footerV1.FirstChunkOffset = {0}", footerV1.FirstChunkOffset); - DicConsole.DebugWriteLine("Nero plugin", "footerV2.ChunkID = 0x{0:X8} (\"{1}\")", footerV2.ChunkID, System.Text.Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(footerV2.ChunkID))); + DicConsole.DebugWriteLine("Nero plugin", "footerV2.ChunkID = 0x{0:X8} (\"{1}\")", footerV2.ChunkID, + System.Text.Encoding.ASCII + .GetString(BigEndianBitConverter.GetBytes(footerV2.ChunkID))); DicConsole.DebugWriteLine("Nero plugin", "footerV2.FirstChunkOffset = {0}", footerV2.FirstChunkOffset); - if(footerV1.ChunkID == NeroV1FooterID && footerV1.FirstChunkOffset < (ulong)imageStream.Length) - imageNewFormat = false; - else if(footerV2.ChunkID == NeroV2FooterID && footerV2.FirstChunkOffset < (ulong)imageStream.Length) - imageNewFormat = true; - else - { - DicConsole.DebugWrite("Nero plugin", "Nero version not recognized."); - return false; - } - - if(imageNewFormat) - imageStream.Seek((long)footerV2.FirstChunkOffset, SeekOrigin.Begin); + if(footerV1.ChunkID == NeroV1FooterID && footerV1.FirstChunkOffset < (ulong)imageStream.Length) + imageNewFormat = false; + else if(footerV2.ChunkID == NeroV2FooterID && footerV2.FirstChunkOffset < (ulong)imageStream.Length) + imageNewFormat = true; else - imageStream.Seek(footerV1.FirstChunkOffset, SeekOrigin.Begin); + { + DicConsole.DebugWrite("Nero plugin", "Nero version not recognized."); + return false; + } + + if(imageNewFormat) imageStream.Seek((long)footerV2.FirstChunkOffset, SeekOrigin.Begin); + else imageStream.Seek(footerV1.FirstChunkOffset, SeekOrigin.Begin); bool parsing = true; ushort currentsession = 1; @@ -984,487 +979,555 @@ namespace DiscImageChef.ImagePlugins ChunkID = BigEndianBitConverter.ToUInt32(ChunkHeaderBuffer, 0); ChunkLength = BigEndianBitConverter.ToUInt32(ChunkHeaderBuffer, 4); - DicConsole.DebugWriteLine("Nero plugin", "ChunkID = 0x{0:X8} (\"{1}\")", ChunkID, System.Text.Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(ChunkID))); + DicConsole.DebugWriteLine("Nero plugin", "ChunkID = 0x{0:X8} (\"{1}\")", ChunkID, + System.Text.Encoding.ASCII + .GetString(BigEndianBitConverter.GetBytes(ChunkID))); DicConsole.DebugWriteLine("Nero plugin", "ChunkLength = {0}", ChunkLength); switch(ChunkID) { case NeroV1CUEID: + { + DicConsole.DebugWriteLine("Nero plugin", "Found \"CUES\" chunk, parsing {0} bytes", + ChunkLength); + + neroCuesheetV1 = new NeroV1Cuesheet(); + neroCuesheetV1.ChunkID = ChunkID; + neroCuesheetV1.ChunkSize = ChunkLength; + neroCuesheetV1.Entries = new List<NeroV1CueEntry>(); + + byte[] tmpbuffer = new byte[8]; + for(int i = 0; i < neroCuesheetV1.ChunkSize; i += 8) { - DicConsole.DebugWriteLine("Nero plugin", "Found \"CUES\" chunk, parsing {0} bytes", ChunkLength); + NeroV1CueEntry _entry = new NeroV1CueEntry(); + imageStream.Read(tmpbuffer, 0, 8); + _entry.Mode = tmpbuffer[0]; + _entry.TrackNumber = tmpbuffer[1]; + _entry.IndexNumber = tmpbuffer[2]; + _entry.Dummy = BigEndianBitConverter.ToUInt16(tmpbuffer, 3); + _entry.Minute = tmpbuffer[5]; + _entry.Second = tmpbuffer[6]; + _entry.Frame = tmpbuffer[7]; - neroCuesheetV1 = new NeroV1Cuesheet(); - neroCuesheetV1.ChunkID = ChunkID; - neroCuesheetV1.ChunkSize = ChunkLength; - neroCuesheetV1.Entries = new List<NeroV1CueEntry>(); + DicConsole.DebugWriteLine("Nero plugin", "Cuesheet entry {0}", (i / 8) + 1); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Mode = {1:X2}", (i / 8) + 1, + _entry.Mode); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].TrackNumber = {1:X2}", + (i / 8) + 1, _entry.TrackNumber); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].IndexNumber = {1:X2}", + (i / 8) + 1, _entry.IndexNumber); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Dummy = {1:X4}", (i / 8) + 1, + _entry.Dummy); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Minute = {1:X2}", (i / 8) + 1, + _entry.Minute); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Second = {1:X2}", (i / 8) + 1, + _entry.Second); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Frame = {1:X2}", (i / 8) + 1, + _entry.Frame); - byte[] tmpbuffer = new byte[8]; - for(int i = 0; i < neroCuesheetV1.ChunkSize; i += 8) - { - NeroV1CueEntry _entry = new NeroV1CueEntry(); - imageStream.Read(tmpbuffer, 0, 8); - _entry.Mode = tmpbuffer[0]; - _entry.TrackNumber = tmpbuffer[1]; - _entry.IndexNumber = tmpbuffer[2]; - _entry.Dummy = BigEndianBitConverter.ToUInt16(tmpbuffer, 3); - _entry.Minute = tmpbuffer[5]; - _entry.Second = tmpbuffer[6]; - _entry.Frame = tmpbuffer[7]; - - DicConsole.DebugWriteLine("Nero plugin", "Cuesheet entry {0}", (i / 8) + 1); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Mode = {1:X2}", (i / 8) + 1, _entry.Mode); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].TrackNumber = {1:X2}", (i / 8) + 1, _entry.TrackNumber); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].IndexNumber = {1:X2}", (i / 8) + 1, _entry.IndexNumber); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Dummy = {1:X4}", (i / 8) + 1, _entry.Dummy); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Minute = {1:X2}", (i / 8) + 1, _entry.Minute); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Second = {1:X2}", (i / 8) + 1, _entry.Second); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Frame = {1:X2}", (i / 8) + 1, _entry.Frame); - - neroCuesheetV1.Entries.Add(_entry); - } - - break; + neroCuesheetV1.Entries.Add(_entry); } + + break; + } case NeroV2CUEID: + { + DicConsole.DebugWriteLine("Nero plugin", "Found \"CUEX\" chunk, parsing {0} bytes", + ChunkLength); + + neroCuesheetV2 = new NeroV2Cuesheet(); + neroCuesheetV2.ChunkID = ChunkID; + neroCuesheetV2.ChunkSize = ChunkLength; + neroCuesheetV2.Entries = new List<NeroV2CueEntry>(); + + byte[] tmpbuffer = new byte[8]; + for(int i = 0; i < neroCuesheetV2.ChunkSize; i += 8) { - DicConsole.DebugWriteLine("Nero plugin", "Found \"CUEX\" chunk, parsing {0} bytes", ChunkLength); + NeroV2CueEntry _entry = new NeroV2CueEntry(); + imageStream.Read(tmpbuffer, 0, 8); + _entry.Mode = tmpbuffer[0]; + _entry.TrackNumber = tmpbuffer[1]; + _entry.IndexNumber = tmpbuffer[2]; + _entry.Dummy = tmpbuffer[3]; + _entry.LBAStart = BigEndianBitConverter.ToInt32(tmpbuffer, 4); - neroCuesheetV2 = new NeroV2Cuesheet(); - neroCuesheetV2.ChunkID = ChunkID; - neroCuesheetV2.ChunkSize = ChunkLength; - neroCuesheetV2.Entries = new List<NeroV2CueEntry>(); + DicConsole.DebugWriteLine("Nero plugin", "Cuesheet entry {0}", (i / 8) + 1); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Mode = 0x{1:X2}", (i / 8) + 1, + _entry.Mode); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].TrackNumber = {1:X2}", + (i / 8) + 1, _entry.TrackNumber); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].IndexNumber = {1:X2}", + (i / 8) + 1, _entry.IndexNumber); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Dummy = {1:X2}", (i / 8) + 1, + _entry.Dummy); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].LBAStart = {1}", (i / 8) + 1, + _entry.LBAStart); - byte[] tmpbuffer = new byte[8]; - for(int i = 0; i < neroCuesheetV2.ChunkSize; i += 8) - { - NeroV2CueEntry _entry = new NeroV2CueEntry(); - imageStream.Read(tmpbuffer, 0, 8); - _entry.Mode = tmpbuffer[0]; - _entry.TrackNumber = tmpbuffer[1]; - _entry.IndexNumber = tmpbuffer[2]; - _entry.Dummy = tmpbuffer[3]; - _entry.LBAStart = BigEndianBitConverter.ToInt32(tmpbuffer, 4); - - DicConsole.DebugWriteLine("Nero plugin", "Cuesheet entry {0}", (i / 8) + 1); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Mode = 0x{1:X2}", (i / 8) + 1, _entry.Mode); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].TrackNumber = {1:X2}", (i / 8) + 1, _entry.TrackNumber); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].IndexNumber = {1:X2}", (i / 8) + 1, _entry.IndexNumber); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Dummy = {1:X2}", (i / 8) + 1, _entry.Dummy); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].LBAStart = {1}", (i / 8) + 1, _entry.LBAStart); - - neroCuesheetV2.Entries.Add(_entry); - } - - break; + neroCuesheetV2.Entries.Add(_entry); } + + break; + } case NeroV1DAOID: + { + DicConsole.DebugWriteLine("Nero plugin", "Found \"DAOI\" chunk, parsing {0} bytes", + ChunkLength); + + neroDAOV1 = new NeroV1DAO(); + neroDAOV1.ChunkID = ChunkID; + neroDAOV1.ChunkSizeBe = ChunkLength; + + byte[] tmpbuffer = new byte[22]; + imageStream.Read(tmpbuffer, 0, 22); + neroDAOV1.ChunkSizeLe = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); + neroDAOV1.UPC = new byte[14]; + Array.Copy(tmpbuffer, 4, neroDAOV1.UPC, 0, 14); + neroDAOV1.TocType = BigEndianBitConverter.ToUInt16(tmpbuffer, 18); + neroDAOV1.FirstTrack = tmpbuffer[20]; + neroDAOV1.LastTrack = tmpbuffer[21]; + neroDAOV1.Tracks = new List<NeroV1DAOEntry>(); + + if(!ImageInfo.readableMediaTags.Contains(MediaTagType.CD_MCN)) + ImageInfo.readableMediaTags.Add(MediaTagType.CD_MCN); + + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC); + + DicConsole.DebugWriteLine("Nero plugin", "neroDAOV1.ChunkSizeLe = {0} bytes", + neroDAOV1.ChunkSizeLe); + DicConsole.DebugWriteLine("Nero plugin", "neroDAOV1.UPC = \"{0}\"", + StringHandlers.CToString(neroDAOV1.UPC)); + DicConsole.DebugWriteLine("Nero plugin", "neroDAOV1.TocType = 0x{0:X4}", neroDAOV1.TocType); + DicConsole.DebugWriteLine("Nero plugin", "neroDAOV1.FirstTrack = {0}", + neroDAOV1.FirstTrack); + DicConsole.DebugWriteLine("Nero plugin", "neroDAOV1.LastTrack = {0}", neroDAOV1.LastTrack); + + UPC = neroDAOV1.UPC; + + tmpbuffer = new byte[30]; + for(int i = 0; i < (neroDAOV1.ChunkSizeBe - 22); i += 30) { - DicConsole.DebugWriteLine("Nero plugin", "Found \"DAOI\" chunk, parsing {0} bytes", ChunkLength); + NeroV1DAOEntry _entry = new NeroV1DAOEntry(); + imageStream.Read(tmpbuffer, 0, 30); + _entry.ISRC = new byte[12]; + Array.Copy(tmpbuffer, 4, _entry.ISRC, 0, 12); + _entry.SectorSize = BigEndianBitConverter.ToUInt16(tmpbuffer, 12); + _entry.Mode = BitConverter.ToUInt16(tmpbuffer, 14); + _entry.Unknown = BigEndianBitConverter.ToUInt16(tmpbuffer, 16); + _entry.Index0 = BigEndianBitConverter.ToUInt32(tmpbuffer, 18); + _entry.Index1 = BigEndianBitConverter.ToUInt32(tmpbuffer, 22); + _entry.EndOfTrack = BigEndianBitConverter.ToUInt32(tmpbuffer, 26); - neroDAOV1 = new NeroV1DAO(); - neroDAOV1.ChunkID = ChunkID; - neroDAOV1.ChunkSizeBe = ChunkLength; + DicConsole.DebugWriteLine("Nero plugin", "Disc-At-Once entry {0}", (i / 32) + 1); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].ISRC = \"{1}\"", (i / 32) + 1, + StringHandlers.CToString(_entry.ISRC)); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].SectorSize = {1}", + (i / 32) + 1, _entry.SectorSize); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Mode = {1} (0x{2:X4})", + (i / 32) + 1, (DAOMode)_entry.Mode, _entry.Mode); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Unknown = 0x{1:X4}", + (i / 32) + 1, _entry.Unknown); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Index0 = {1}", (i / 32) + 1, + _entry.Index0); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Index1 = {1}", (i / 32) + 1, + _entry.Index1); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].EndOfTrack = {1}", + (i / 32) + 1, _entry.EndOfTrack); - byte[] tmpbuffer = new byte[22]; - imageStream.Read(tmpbuffer, 0, 22); - neroDAOV1.ChunkSizeLe = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); - neroDAOV1.UPC = new byte[14]; - Array.Copy(tmpbuffer, 4, neroDAOV1.UPC, 0, 14); - neroDAOV1.TocType = BigEndianBitConverter.ToUInt16(tmpbuffer, 18); - neroDAOV1.FirstTrack = tmpbuffer[20]; - neroDAOV1.LastTrack = tmpbuffer[21]; - neroDAOV1.Tracks = new List<NeroV1DAOEntry>(); + neroDAOV1.Tracks.Add(_entry); - if(!ImageInfo.readableMediaTags.Contains(MediaTagType.CD_MCN)) - ImageInfo.readableMediaTags.Add(MediaTagType.CD_MCN); + if(_entry.SectorSize > ImageInfo.sectorSize) ImageInfo.sectorSize = _entry.SectorSize; - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC); + TrackISRCs.Add(currenttrack, _entry.ISRC); + if(currenttrack == 1) _entry.Index0 = _entry.Index1; - DicConsole.DebugWriteLine("Nero plugin", "neroDAOV1.ChunkSizeLe = {0} bytes", neroDAOV1.ChunkSizeLe); - DicConsole.DebugWriteLine("Nero plugin", "neroDAOV1.UPC = \"{0}\"", StringHandlers.CToString(neroDAOV1.UPC)); - DicConsole.DebugWriteLine("Nero plugin", "neroDAOV1.TocType = 0x{0:X4}", neroDAOV1.TocType); - DicConsole.DebugWriteLine("Nero plugin", "neroDAOV1.FirstTrack = {0}", neroDAOV1.FirstTrack); - DicConsole.DebugWriteLine("Nero plugin", "neroDAOV1.LastTrack = {0}", neroDAOV1.LastTrack); + NeroTrack _neroTrack = new NeroTrack(); + _neroTrack.EndOfTrack = _entry.EndOfTrack; + _neroTrack.ISRC = _entry.ISRC; + _neroTrack.Length = _entry.EndOfTrack - _entry.Index0; + _neroTrack.Mode = _entry.Mode; + _neroTrack.Offset = _entry.Index0; + _neroTrack.Sectors = _neroTrack.Length / _entry.SectorSize; + _neroTrack.SectorSize = _entry.SectorSize; + _neroTrack.StartLBA = ImageInfo.sectors; + _neroTrack.Index0 = _entry.Index0; + _neroTrack.Index1 = _entry.Index1; + _neroTrack.Sequence = currenttrack; + neroTracks.Add(currenttrack, _neroTrack); - UPC = neroDAOV1.UPC; + ImageInfo.sectors += _neroTrack.Sectors; - tmpbuffer = new byte[30]; - for(int i = 0; i < (neroDAOV1.ChunkSizeBe - 22); i += 30) - { - NeroV1DAOEntry _entry = new NeroV1DAOEntry(); - imageStream.Read(tmpbuffer, 0, 30); - _entry.ISRC = new byte[12]; - Array.Copy(tmpbuffer, 4, _entry.ISRC, 0, 12); - _entry.SectorSize = BigEndianBitConverter.ToUInt16(tmpbuffer, 12); - _entry.Mode = BitConverter.ToUInt16(tmpbuffer, 14); - _entry.Unknown = BigEndianBitConverter.ToUInt16(tmpbuffer, 16); - _entry.Index0 = BigEndianBitConverter.ToUInt32(tmpbuffer, 18); - _entry.Index1 = BigEndianBitConverter.ToUInt32(tmpbuffer, 22); - _entry.EndOfTrack = BigEndianBitConverter.ToUInt32(tmpbuffer, 26); - - DicConsole.DebugWriteLine("Nero plugin", "Disc-At-Once entry {0}", (i / 32) + 1); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].ISRC = \"{1}\"", (i / 32) + 1, StringHandlers.CToString(_entry.ISRC)); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].SectorSize = {1}", (i / 32) + 1, _entry.SectorSize); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Mode = {1} (0x{2:X4})", (i / 32) + 1, (DAOMode)_entry.Mode, _entry.Mode); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Unknown = 0x{1:X4}", (i / 32) + 1, _entry.Unknown); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Index0 = {1}", (i / 32) + 1, _entry.Index0); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Index1 = {1}", (i / 32) + 1, _entry.Index1); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].EndOfTrack = {1}", (i / 32) + 1, _entry.EndOfTrack); - - neroDAOV1.Tracks.Add(_entry); - - if(_entry.SectorSize > ImageInfo.sectorSize) - ImageInfo.sectorSize = _entry.SectorSize; - - TrackISRCs.Add(currenttrack, _entry.ISRC); - if(currenttrack == 1) - _entry.Index0 = _entry.Index1; - - NeroTrack _neroTrack = new NeroTrack(); - _neroTrack.EndOfTrack = _entry.EndOfTrack; - _neroTrack.ISRC = _entry.ISRC; - _neroTrack.Length = _entry.EndOfTrack - _entry.Index0; - _neroTrack.Mode = _entry.Mode; - _neroTrack.Offset = _entry.Index0; - _neroTrack.Sectors = _neroTrack.Length / _entry.SectorSize; - _neroTrack.SectorSize = _entry.SectorSize; - _neroTrack.StartLBA = ImageInfo.sectors; - _neroTrack.Index0 = _entry.Index0; - _neroTrack.Index1 = _entry.Index1; - _neroTrack.Sequence = currenttrack; - neroTracks.Add(currenttrack, _neroTrack); - - ImageInfo.sectors += _neroTrack.Sectors; - - currenttrack++; - } - - break; + currenttrack++; } + + break; + } case NeroV2DAOID: + { + DicConsole.DebugWriteLine("Nero plugin", "Found \"DAOX\" chunk, parsing {0} bytes", + ChunkLength); + + neroDAOV2 = new NeroV2DAO(); + neroDAOV2.ChunkID = ChunkID; + neroDAOV2.ChunkSizeBe = ChunkLength; + + byte[] tmpbuffer = new byte[22]; + imageStream.Read(tmpbuffer, 0, 22); + neroDAOV2.ChunkSizeLe = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); + neroDAOV2.UPC = new byte[14]; + Array.Copy(tmpbuffer, 4, neroDAOV2.UPC, 0, 14); + neroDAOV2.TocType = BigEndianBitConverter.ToUInt16(tmpbuffer, 18); + neroDAOV1.FirstTrack = tmpbuffer[20]; + neroDAOV2.LastTrack = tmpbuffer[21]; + neroDAOV2.Tracks = new List<NeroV2DAOEntry>(); + + if(!ImageInfo.readableMediaTags.Contains(MediaTagType.CD_MCN)) + ImageInfo.readableMediaTags.Add(MediaTagType.CD_MCN); + + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) + ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC); + + UPC = neroDAOV2.UPC; + + DicConsole.DebugWriteLine("Nero plugin", "neroDAOV2.ChunkSizeLe = {0} bytes", + neroDAOV2.ChunkSizeLe); + DicConsole.DebugWriteLine("Nero plugin", "neroDAOV2.UPC = \"{0}\"", + StringHandlers.CToString(neroDAOV2.UPC)); + DicConsole.DebugWriteLine("Nero plugin", "neroDAOV2.TocType = 0x{0:X4}", neroDAOV2.TocType); + DicConsole.DebugWriteLine("Nero plugin", "neroDAOV2.FirstTrack = {0}", + neroDAOV2.FirstTrack); + DicConsole.DebugWriteLine("Nero plugin", "neroDAOV2.LastTrack = {0}", neroDAOV2.LastTrack); + + tmpbuffer = new byte[42]; + for(int i = 0; i < (neroDAOV2.ChunkSizeBe - 22); i += 42) { - DicConsole.DebugWriteLine("Nero plugin", "Found \"DAOX\" chunk, parsing {0} bytes", ChunkLength); + NeroV2DAOEntry _entry = new NeroV2DAOEntry(); + imageStream.Read(tmpbuffer, 0, 42); + _entry.ISRC = new byte[12]; + Array.Copy(tmpbuffer, 4, _entry.ISRC, 0, 12); + _entry.SectorSize = BigEndianBitConverter.ToUInt16(tmpbuffer, 12); + _entry.Mode = BitConverter.ToUInt16(tmpbuffer, 14); + _entry.Unknown = BigEndianBitConverter.ToUInt16(tmpbuffer, 16); + _entry.Index0 = BigEndianBitConverter.ToUInt64(tmpbuffer, 18); + _entry.Index1 = BigEndianBitConverter.ToUInt64(tmpbuffer, 26); + _entry.EndOfTrack = BigEndianBitConverter.ToUInt64(tmpbuffer, 34); - neroDAOV2 = new NeroV2DAO(); - neroDAOV2.ChunkID = ChunkID; - neroDAOV2.ChunkSizeBe = ChunkLength; + DicConsole.DebugWriteLine("Nero plugin", "Disc-At-Once entry {0}", (i / 32) + 1); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].ISRC = \"{1}\"", (i / 32) + 1, + StringHandlers.CToString(_entry.ISRC)); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].SectorSize = {1}", + (i / 32) + 1, _entry.SectorSize); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Mode = {1} (0x{2:X4})", + (i / 32) + 1, (DAOMode)_entry.Mode, _entry.Mode); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Unknown = {1:X2}", + (i / 32) + 1, _entry.Unknown); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Index0 = {1}", (i / 32) + 1, + _entry.Index0); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Index1 = {1}", (i / 32) + 1, + _entry.Index1); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].EndOfTrack = {1}", + (i / 32) + 1, _entry.EndOfTrack); - byte[] tmpbuffer = new byte[22]; - imageStream.Read(tmpbuffer, 0, 22); - neroDAOV2.ChunkSizeLe = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); - neroDAOV2.UPC = new byte[14]; - Array.Copy(tmpbuffer, 4, neroDAOV2.UPC, 0, 14); - neroDAOV2.TocType = BigEndianBitConverter.ToUInt16(tmpbuffer, 18); - neroDAOV1.FirstTrack = tmpbuffer[20]; - neroDAOV2.LastTrack = tmpbuffer[21]; - neroDAOV2.Tracks = new List<NeroV2DAOEntry>(); + neroDAOV2.Tracks.Add(_entry); - if(!ImageInfo.readableMediaTags.Contains(MediaTagType.CD_MCN)) - ImageInfo.readableMediaTags.Add(MediaTagType.CD_MCN); + if(_entry.SectorSize > ImageInfo.sectorSize) ImageInfo.sectorSize = _entry.SectorSize; - if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) - ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC); + TrackISRCs.Add(currenttrack, _entry.ISRC); - UPC = neroDAOV2.UPC; + if(currenttrack == 1) _entry.Index0 = _entry.Index1; - DicConsole.DebugWriteLine("Nero plugin", "neroDAOV2.ChunkSizeLe = {0} bytes", neroDAOV2.ChunkSizeLe); - DicConsole.DebugWriteLine("Nero plugin", "neroDAOV2.UPC = \"{0}\"", StringHandlers.CToString(neroDAOV2.UPC)); - DicConsole.DebugWriteLine("Nero plugin", "neroDAOV2.TocType = 0x{0:X4}", neroDAOV2.TocType); - DicConsole.DebugWriteLine("Nero plugin", "neroDAOV2.FirstTrack = {0}", neroDAOV2.FirstTrack); - DicConsole.DebugWriteLine("Nero plugin", "neroDAOV2.LastTrack = {0}", neroDAOV2.LastTrack); + NeroTrack _neroTrack = new NeroTrack(); + _neroTrack.EndOfTrack = _entry.EndOfTrack; + _neroTrack.ISRC = _entry.ISRC; + _neroTrack.Length = _entry.EndOfTrack - _entry.Index0; + _neroTrack.Mode = _entry.Mode; + _neroTrack.Offset = _entry.Index0; + _neroTrack.Sectors = _neroTrack.Length / _entry.SectorSize; + _neroTrack.SectorSize = _entry.SectorSize; + _neroTrack.StartLBA = ImageInfo.sectors; + _neroTrack.Index0 = _entry.Index0; + _neroTrack.Index1 = _entry.Index1; + _neroTrack.Sequence = currenttrack; + neroTracks.Add(currenttrack, _neroTrack); - tmpbuffer = new byte[42]; - for(int i = 0; i < (neroDAOV2.ChunkSizeBe - 22); i += 42) - { - NeroV2DAOEntry _entry = new NeroV2DAOEntry(); - imageStream.Read(tmpbuffer, 0, 42); - _entry.ISRC = new byte[12]; - Array.Copy(tmpbuffer, 4, _entry.ISRC, 0, 12); - _entry.SectorSize = BigEndianBitConverter.ToUInt16(tmpbuffer, 12); - _entry.Mode = BitConverter.ToUInt16(tmpbuffer, 14); - _entry.Unknown = BigEndianBitConverter.ToUInt16(tmpbuffer, 16); - _entry.Index0 = BigEndianBitConverter.ToUInt64(tmpbuffer, 18); - _entry.Index1 = BigEndianBitConverter.ToUInt64(tmpbuffer, 26); - _entry.EndOfTrack = BigEndianBitConverter.ToUInt64(tmpbuffer, 34); + ImageInfo.sectors += _neroTrack.Sectors; - DicConsole.DebugWriteLine("Nero plugin", "Disc-At-Once entry {0}", (i / 32) + 1); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].ISRC = \"{1}\"", (i / 32) + 1, StringHandlers.CToString(_entry.ISRC)); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].SectorSize = {1}", (i / 32) + 1, _entry.SectorSize); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Mode = {1} (0x{2:X4})", (i / 32) + 1, (DAOMode)_entry.Mode, _entry.Mode); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Unknown = {1:X2}", (i / 32) + 1, _entry.Unknown); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Index0 = {1}", (i / 32) + 1, _entry.Index0); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Index1 = {1}", (i / 32) + 1, _entry.Index1); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].EndOfTrack = {1}", (i / 32) + 1, _entry.EndOfTrack); - - neroDAOV2.Tracks.Add(_entry); - - if(_entry.SectorSize > ImageInfo.sectorSize) - ImageInfo.sectorSize = _entry.SectorSize; - - TrackISRCs.Add(currenttrack, _entry.ISRC); - - if(currenttrack == 1) - _entry.Index0 = _entry.Index1; - - NeroTrack _neroTrack = new NeroTrack(); - _neroTrack.EndOfTrack = _entry.EndOfTrack; - _neroTrack.ISRC = _entry.ISRC; - _neroTrack.Length = _entry.EndOfTrack - _entry.Index0; - _neroTrack.Mode = _entry.Mode; - _neroTrack.Offset = _entry.Index0; - _neroTrack.Sectors = _neroTrack.Length / _entry.SectorSize; - _neroTrack.SectorSize = _entry.SectorSize; - _neroTrack.StartLBA = ImageInfo.sectors; - _neroTrack.Index0 = _entry.Index0; - _neroTrack.Index1 = _entry.Index1; - _neroTrack.Sequence = currenttrack; - neroTracks.Add(currenttrack, _neroTrack); - - ImageInfo.sectors += _neroTrack.Sectors; - - currenttrack++; - } - - break; + currenttrack++; } + + break; + } case NeroCDTextID: + { + DicConsole.DebugWriteLine("Nero plugin", "Found \"CDTX\" chunk, parsing {0} bytes", + ChunkLength); + + neroCDTXT = new NeroCDText(); + neroCDTXT.ChunkID = ChunkID; + neroCDTXT.ChunkSize = ChunkLength; + neroCDTXT.Packs = new List<NeroCDTextPack>(); + + byte[] tmpbuffer = new byte[18]; + for(int i = 0; i < (neroCDTXT.ChunkSize); i += 18) { - DicConsole.DebugWriteLine("Nero plugin", "Found \"CDTX\" chunk, parsing {0} bytes", ChunkLength); + NeroCDTextPack _entry = new NeroCDTextPack(); + imageStream.Read(tmpbuffer, 0, 18); - neroCDTXT = new NeroCDText(); - neroCDTXT.ChunkID = ChunkID; - neroCDTXT.ChunkSize = ChunkLength; - neroCDTXT.Packs = new List<NeroCDTextPack>(); + _entry.PackType = tmpbuffer[0]; + _entry.TrackNumber = tmpbuffer[1]; + _entry.PackNumber = tmpbuffer[2]; + _entry.BlockNumber = tmpbuffer[3]; + _entry.Text = new byte[12]; + Array.Copy(tmpbuffer, 4, _entry.Text, 0, 12); + _entry.CRC = BigEndianBitConverter.ToUInt16(tmpbuffer, 16); - byte[] tmpbuffer = new byte[18]; - for(int i = 0; i < (neroCDTXT.ChunkSize); i += 18) - { - NeroCDTextPack _entry = new NeroCDTextPack(); - imageStream.Read(tmpbuffer, 0, 18); + DicConsole.DebugWriteLine("Nero plugin", "CD-TEXT entry {0}", (i / 18) + 1); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].PackType = 0x{1:X2}", + (i / 18) + 1, _entry.PackType); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].TrackNumber = 0x{1:X2}", + (i / 18) + 1, _entry.TrackNumber); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].PackNumber = 0x{1:X2}", + (i / 18) + 1, _entry.PackNumber); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].BlockNumber = 0x{1:X2}", + (i / 18) + 1, _entry.BlockNumber); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Text = \"{1}\"", (i / 18) + 1, + StringHandlers.CToString(_entry.Text)); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].CRC = 0x{1:X4}", (i / 18) + 1, + _entry.CRC); - _entry.PackType = tmpbuffer[0]; - _entry.TrackNumber = tmpbuffer[1]; - _entry.PackNumber = tmpbuffer[2]; - _entry.BlockNumber = tmpbuffer[3]; - _entry.Text = new byte[12]; - Array.Copy(tmpbuffer, 4, _entry.Text, 0, 12); - _entry.CRC = BigEndianBitConverter.ToUInt16(tmpbuffer, 16); - - DicConsole.DebugWriteLine("Nero plugin", "CD-TEXT entry {0}", (i / 18) + 1); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].PackType = 0x{1:X2}", (i / 18) + 1, _entry.PackType); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].TrackNumber = 0x{1:X2}", (i / 18) + 1, _entry.TrackNumber); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].PackNumber = 0x{1:X2}", (i / 18) + 1, _entry.PackNumber); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].BlockNumber = 0x{1:X2}", (i / 18) + 1, _entry.BlockNumber); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Text = \"{1}\"", (i / 18) + 1, StringHandlers.CToString(_entry.Text)); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].CRC = 0x{1:X4}", (i / 18) + 1, _entry.CRC); - - neroCDTXT.Packs.Add(_entry); - } - - break; + neroCDTXT.Packs.Add(_entry); } + + break; + } case NeroV1TAOID: + { + DicConsole.DebugWriteLine("Nero plugin", "Found \"ETNF\" chunk, parsing {0} bytes", + ChunkLength); + + neroTAOV1 = new NeroV1TAO(); + neroTAOV1.ChunkID = ChunkID; + neroTAOV1.ChunkSize = ChunkLength; + neroTAOV1.Tracks = new List<NeroV1TAOEntry>(); + + byte[] tmpbuffer = new byte[20]; + for(int i = 0; i < (neroTAOV1.ChunkSize); i += 20) { - DicConsole.DebugWriteLine("Nero plugin", "Found \"ETNF\" chunk, parsing {0} bytes", ChunkLength); + NeroV1TAOEntry _entry = new NeroV1TAOEntry(); + imageStream.Read(tmpbuffer, 0, 20); - neroTAOV1 = new NeroV1TAO(); - neroTAOV1.ChunkID = ChunkID; - neroTAOV1.ChunkSize = ChunkLength; - neroTAOV1.Tracks = new List<NeroV1TAOEntry>(); + _entry.Offset = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); + _entry.Length = BigEndianBitConverter.ToUInt32(tmpbuffer, 4); + _entry.Mode = BigEndianBitConverter.ToUInt32(tmpbuffer, 8); + _entry.StartLBA = BigEndianBitConverter.ToUInt32(tmpbuffer, 12); + _entry.Unknown = BigEndianBitConverter.ToUInt32(tmpbuffer, 16); - byte[] tmpbuffer = new byte[20]; - for(int i = 0; i < (neroTAOV1.ChunkSize); i += 20) - { - NeroV1TAOEntry _entry = new NeroV1TAOEntry(); - imageStream.Read(tmpbuffer, 0, 20); + DicConsole.DebugWriteLine("Nero plugin", "Track-at-Once entry {0}", (i / 20) + 1); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Offset = {1}", (i / 20) + 1, + _entry.Offset); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Length = {1} bytes", + (i / 20) + 1, _entry.Length); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Mode = {1} (0x{2:X4})", + (i / 20) + 1, (DAOMode)_entry.Mode, _entry.Mode); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].StartLBA = {1}", (i / 20) + 1, + _entry.StartLBA); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Unknown = 0x{1:X4}", + (i / 20) + 1, _entry.Unknown); - _entry.Offset = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); - _entry.Length = BigEndianBitConverter.ToUInt32(tmpbuffer, 4); - _entry.Mode = BigEndianBitConverter.ToUInt32(tmpbuffer, 8); - _entry.StartLBA = BigEndianBitConverter.ToUInt32(tmpbuffer, 12); - _entry.Unknown = BigEndianBitConverter.ToUInt32(tmpbuffer, 16); + neroTAOV1.Tracks.Add(_entry); - DicConsole.DebugWriteLine("Nero plugin", "Track-at-Once entry {0}", (i / 20) + 1); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Offset = {1}", (i / 20) + 1, _entry.Offset); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Length = {1} bytes", (i / 20) + 1, _entry.Length); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Mode = {1} (0x{2:X4})", (i / 20) + 1, (DAOMode)_entry.Mode, _entry.Mode); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].StartLBA = {1}", (i / 20) + 1, _entry.StartLBA); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Unknown = 0x{1:X4}", (i / 20) + 1, _entry.Unknown); + if(NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode) > ImageInfo.sectorSize) + ImageInfo.sectorSize = NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); - neroTAOV1.Tracks.Add(_entry); + NeroTrack _neroTrack = new NeroTrack(); + _neroTrack.EndOfTrack = _entry.Offset + _entry.Length; + _neroTrack.ISRC = new byte[12]; + _neroTrack.Length = _entry.Length; + _neroTrack.Mode = _entry.Mode; + _neroTrack.Offset = _entry.Offset; + _neroTrack.Sectors = + _neroTrack.Length / NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); + _neroTrack.SectorSize = NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); + _neroTrack.StartLBA = ImageInfo.sectors; + _neroTrack.Index0 = _entry.Offset; + _neroTrack.Index1 = _entry.Offset; + _neroTrack.Sequence = currenttrack; + neroTracks.Add(currenttrack, _neroTrack); - if(NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode) > ImageInfo.sectorSize) - ImageInfo.sectorSize = NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); + ImageInfo.sectors += _neroTrack.Sectors; - NeroTrack _neroTrack = new NeroTrack(); - _neroTrack.EndOfTrack = _entry.Offset + _entry.Length; - _neroTrack.ISRC = new byte[12]; - _neroTrack.Length = _entry.Length; - _neroTrack.Mode = _entry.Mode; - _neroTrack.Offset = _entry.Offset; - _neroTrack.Sectors = _neroTrack.Length / NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); - _neroTrack.SectorSize = NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); - _neroTrack.StartLBA = ImageInfo.sectors; - _neroTrack.Index0 = _entry.Offset; - _neroTrack.Index1 = _entry.Offset; - _neroTrack.Sequence = currenttrack; - neroTracks.Add(currenttrack, _neroTrack); - - ImageInfo.sectors += _neroTrack.Sectors; - - currenttrack++; - } - - break; + currenttrack++; } + + break; + } case NeroV2TAOID: + { + DicConsole.DebugWriteLine("Nero plugin", "Found \"ETN2\" chunk, parsing {0} bytes", + ChunkLength); + + neroTAOV2 = new NeroV2TAO(); + neroTAOV2.ChunkID = ChunkID; + neroTAOV2.ChunkSize = ChunkLength; + neroTAOV2.Tracks = new List<NeroV2TAOEntry>(); + + byte[] tmpbuffer = new byte[32]; + for(int i = 0; i < (neroTAOV2.ChunkSize); i += 32) { - DicConsole.DebugWriteLine("Nero plugin", "Found \"ETN2\" chunk, parsing {0} bytes", ChunkLength); + NeroV2TAOEntry _entry = new NeroV2TAOEntry(); + imageStream.Read(tmpbuffer, 0, 32); - neroTAOV2 = new NeroV2TAO(); - neroTAOV2.ChunkID = ChunkID; - neroTAOV2.ChunkSize = ChunkLength; - neroTAOV2.Tracks = new List<NeroV2TAOEntry>(); + _entry.Offset = BigEndianBitConverter.ToUInt64(tmpbuffer, 0); + _entry.Length = BigEndianBitConverter.ToUInt64(tmpbuffer, 8); + _entry.Mode = BigEndianBitConverter.ToUInt32(tmpbuffer, 16); + _entry.StartLBA = BigEndianBitConverter.ToUInt32(tmpbuffer, 20); + _entry.Unknown = BigEndianBitConverter.ToUInt32(tmpbuffer, 24); + _entry.Sectors = BigEndianBitConverter.ToUInt32(tmpbuffer, 28); - byte[] tmpbuffer = new byte[32]; - for(int i = 0; i < (neroTAOV2.ChunkSize); i += 32) - { - NeroV2TAOEntry _entry = new NeroV2TAOEntry(); - imageStream.Read(tmpbuffer, 0, 32); + DicConsole.DebugWriteLine("Nero plugin", "Track-at-Once entry {0}", (i / 32) + 1); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Offset = {1}", (i / 32) + 1, + _entry.Offset); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Length = {1} bytes", + (i / 32) + 1, _entry.Length); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Mode = {1} (0x{2:X4})", + (i / 32) + 1, (DAOMode)_entry.Mode, _entry.Mode); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].StartLBA = {1}", (i / 32) + 1, + _entry.StartLBA); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Unknown = 0x{1:X4}", + (i / 32) + 1, _entry.Unknown); + DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Sectors = {1}", (i / 32) + 1, + _entry.Sectors); - _entry.Offset = BigEndianBitConverter.ToUInt64(tmpbuffer, 0); - _entry.Length = BigEndianBitConverter.ToUInt64(tmpbuffer, 8); - _entry.Mode = BigEndianBitConverter.ToUInt32(tmpbuffer, 16); - _entry.StartLBA = BigEndianBitConverter.ToUInt32(tmpbuffer, 20); - _entry.Unknown = BigEndianBitConverter.ToUInt32(tmpbuffer, 24); - _entry.Sectors = BigEndianBitConverter.ToUInt32(tmpbuffer, 28); + neroTAOV2.Tracks.Add(_entry); - DicConsole.DebugWriteLine("Nero plugin", "Track-at-Once entry {0}", (i / 32) + 1); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Offset = {1}", (i / 32) + 1, _entry.Offset); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Length = {1} bytes", (i / 32) + 1, _entry.Length); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Mode = {1} (0x{2:X4})", (i / 32) + 1, (DAOMode)_entry.Mode, _entry.Mode); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].StartLBA = {1}", (i / 32) + 1, _entry.StartLBA); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Unknown = 0x{1:X4}", (i / 32) + 1, _entry.Unknown); - DicConsole.DebugWriteLine("Nero plugin", "\t _entry[{0}].Sectors = {1}", (i / 32) + 1, _entry.Sectors); + if(NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode) > ImageInfo.sectorSize) + ImageInfo.sectorSize = NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); - neroTAOV2.Tracks.Add(_entry); + NeroTrack _neroTrack = new NeroTrack(); + _neroTrack.EndOfTrack = _entry.Offset + _entry.Length; + _neroTrack.ISRC = new byte[12]; + _neroTrack.Length = _entry.Length; + _neroTrack.Mode = _entry.Mode; + _neroTrack.Offset = _entry.Offset; + _neroTrack.Sectors = + _neroTrack.Length / NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); + _neroTrack.SectorSize = NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); + _neroTrack.StartLBA = ImageInfo.sectors; + _neroTrack.Index0 = _entry.Offset; + _neroTrack.Index1 = _entry.Offset; + _neroTrack.Sequence = currenttrack; + neroTracks.Add(currenttrack, _neroTrack); - if(NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode) > ImageInfo.sectorSize) - ImageInfo.sectorSize = NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); + ImageInfo.sectors += _neroTrack.Sectors; - NeroTrack _neroTrack = new NeroTrack(); - _neroTrack.EndOfTrack = _entry.Offset + _entry.Length; - _neroTrack.ISRC = new byte[12]; - _neroTrack.Length = _entry.Length; - _neroTrack.Mode = _entry.Mode; - _neroTrack.Offset = _entry.Offset; - _neroTrack.Sectors = _neroTrack.Length / NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); - _neroTrack.SectorSize = NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); - _neroTrack.StartLBA = ImageInfo.sectors; - _neroTrack.Index0 = _entry.Offset; - _neroTrack.Index1 = _entry.Offset; - _neroTrack.Sequence = currenttrack; - neroTracks.Add(currenttrack, _neroTrack); - - ImageInfo.sectors += _neroTrack.Sectors; - - currenttrack++; - } - - break; + currenttrack++; } + + break; + } case NeroSessionID: - { - DicConsole.DebugWriteLine("Nero plugin", "Found \"SINF\" chunk, parsing {0} bytes", ChunkLength); + { + DicConsole.DebugWriteLine("Nero plugin", "Found \"SINF\" chunk, parsing {0} bytes", + ChunkLength); - uint sessionTracks; - byte[] tmpbuffer = new byte[4]; - imageStream.Read(tmpbuffer, 0, 4); - sessionTracks = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); - neroSessions.Add(currentsession, sessionTracks); + uint sessionTracks; + byte[] tmpbuffer = new byte[4]; + imageStream.Read(tmpbuffer, 0, 4); + sessionTracks = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); + neroSessions.Add(currentsession, sessionTracks); - DicConsole.DebugWriteLine("Nero plugin", "\tSession {0} has {1} tracks", currentsession, sessionTracks); + DicConsole.DebugWriteLine("Nero plugin", "\tSession {0} has {1} tracks", currentsession, + sessionTracks); - currentsession++; - break; - } + currentsession++; + break; + } case NeroDiskTypeID: - { - DicConsole.DebugWriteLine("Nero plugin", "Found \"MTYP\" chunk, parsing {0} bytes", ChunkLength); + { + DicConsole.DebugWriteLine("Nero plugin", "Found \"MTYP\" chunk, parsing {0} bytes", + ChunkLength); - neroMediaTyp = new NeroMediaType(); + neroMediaTyp = new NeroMediaType(); - neroMediaTyp.ChunkID = ChunkID; - neroMediaTyp.ChunkSize = ChunkLength; + neroMediaTyp.ChunkID = ChunkID; + neroMediaTyp.ChunkSize = ChunkLength; - byte[] tmpbuffer = new byte[4]; - imageStream.Read(tmpbuffer, 0, 4); - neroMediaTyp.Type = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); + byte[] tmpbuffer = new byte[4]; + imageStream.Read(tmpbuffer, 0, 4); + neroMediaTyp.Type = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); - DicConsole.DebugWriteLine("Nero plugin", "\tMedia type is {0} ({1})", (NeroMediaTypes)neroMediaTyp.Type, neroMediaTyp.Type); + DicConsole.DebugWriteLine("Nero plugin", "\tMedia type is {0} ({1})", + (NeroMediaTypes)neroMediaTyp.Type, neroMediaTyp.Type); - ImageInfo.mediaType = NeroMediaTypeToMediaType((NeroMediaTypes)neroMediaTyp.Type); + ImageInfo.mediaType = NeroMediaTypeToMediaType((NeroMediaTypes)neroMediaTyp.Type); - break; - } + break; + } case NeroDiscInfoID: - { - DicConsole.DebugWriteLine("Nero plugin", "Found \"DINF\" chunk, parsing {0} bytes", ChunkLength); + { + DicConsole.DebugWriteLine("Nero plugin", "Found \"DINF\" chunk, parsing {0} bytes", + ChunkLength); - neroDiscInfo = new NeroDiscInformation(); - neroDiscInfo.ChunkID = ChunkID; - neroDiscInfo.ChunkSize = ChunkLength; - byte[] tmpbuffer = new byte[4]; - imageStream.Read(tmpbuffer, 0, 4); - neroDiscInfo.Unknown = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); + neroDiscInfo = new NeroDiscInformation(); + neroDiscInfo.ChunkID = ChunkID; + neroDiscInfo.ChunkSize = ChunkLength; + byte[] tmpbuffer = new byte[4]; + imageStream.Read(tmpbuffer, 0, 4); + neroDiscInfo.Unknown = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); - DicConsole.DebugWriteLine("Nero plugin", "\tneroDiscInfo.Unknown = 0x{0:X4} ({0})", neroDiscInfo.Unknown); + DicConsole.DebugWriteLine("Nero plugin", "\tneroDiscInfo.Unknown = 0x{0:X4} ({0})", + neroDiscInfo.Unknown); - break; - } + break; + } case NeroReloID: - { - DicConsole.DebugWriteLine("Nero plugin", "Found \"RELO\" chunk, parsing {0} bytes", ChunkLength); + { + DicConsole.DebugWriteLine("Nero plugin", "Found \"RELO\" chunk, parsing {0} bytes", + ChunkLength); - neroRELO = new NeroRELOChunk(); - neroRELO.ChunkID = ChunkID; - neroRELO.ChunkSize = ChunkLength; - byte[] tmpbuffer = new byte[4]; - imageStream.Read(tmpbuffer, 0, 4); - neroRELO.Unknown = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); + neroRELO = new NeroRELOChunk(); + neroRELO.ChunkID = ChunkID; + neroRELO.ChunkSize = ChunkLength; + byte[] tmpbuffer = new byte[4]; + imageStream.Read(tmpbuffer, 0, 4); + neroRELO.Unknown = BigEndianBitConverter.ToUInt32(tmpbuffer, 0); - DicConsole.DebugWriteLine("Nero plugin", "\tneroRELO.Unknown = 0x{0:X4} ({0})", neroRELO.Unknown); + DicConsole.DebugWriteLine("Nero plugin", "\tneroRELO.Unknown = 0x{0:X4} ({0})", + neroRELO.Unknown); - break; - } + break; + } case NeroTOCID: - { - DicConsole.DebugWriteLine("Nero plugin", "Found \"TOCT\" chunk, parsing {0} bytes", ChunkLength); + { + DicConsole.DebugWriteLine("Nero plugin", "Found \"TOCT\" chunk, parsing {0} bytes", + ChunkLength); - neroTOC = new NeroTOCChunk(); - neroTOC.ChunkID = ChunkID; - neroTOC.ChunkSize = ChunkLength; - byte[] tmpbuffer = new byte[2]; - imageStream.Read(tmpbuffer, 0, 2); - neroTOC.Unknown = BigEndianBitConverter.ToUInt16(tmpbuffer, 0); + neroTOC = new NeroTOCChunk(); + neroTOC.ChunkID = ChunkID; + neroTOC.ChunkSize = ChunkLength; + byte[] tmpbuffer = new byte[2]; + imageStream.Read(tmpbuffer, 0, 2); + neroTOC.Unknown = BigEndianBitConverter.ToUInt16(tmpbuffer, 0); - DicConsole.DebugWriteLine("Nero plugin", "\tneroTOC.Unknown = 0x{0:X4} ({0})", neroTOC.Unknown); + DicConsole.DebugWriteLine("Nero plugin", "\tneroTOC.Unknown = 0x{0:X4} ({0})", + neroTOC.Unknown); - break; - } + break; + } case NeroEndID: - { - DicConsole.DebugWriteLine("Nero plugin", "Found \"END!\" chunk, finishing parse"); - parsing = false; - break; - } + { + DicConsole.DebugWriteLine("Nero plugin", "Found \"END!\" chunk, finishing parse"); + parsing = false; + break; + } default: - { - DicConsole.DebugWriteLine("Nero plugin", "Unknown chunk ID \"{0}\", skipping...", System.Text.Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(ChunkID))); - imageStream.Seek(ChunkLength, SeekOrigin.Current); - break; - } + { + DicConsole.DebugWriteLine("Nero plugin", "Unknown chunk ID \"{0}\", skipping...", + System.Text.Encoding.ASCII.GetString(BigEndianBitConverter + .GetBytes(ChunkID))); + imageStream.Seek(ChunkLength, SeekOrigin.Current); + break; + } } } @@ -1501,8 +1564,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.imageApplicationVersion = "<= 5.0"; } - if(neroSessions.Count == 0) - neroSessions.Add(1, currenttrack); + if(neroSessions.Count == 0) neroSessions.Add(1, currenttrack); DicConsole.DebugWriteLine("Nero plugin", "Building offset, track and session maps"); @@ -1519,12 +1581,13 @@ namespace DiscImageChef.ImagePlugins if(neroTracks.TryGetValue(i, out _neroTrack)) { DicConsole.DebugWriteLine("Nero plugin", "\tcurrentsession = {0}", currentsession); - DicConsole.DebugWriteLine("Nero plugin", "\tcurrentsessionmaxtrack = {0}", currentsessionmaxtrack); - DicConsole.DebugWriteLine("Nero plugin", "\tcurrentsessioncurrenttrack = {0}", currentsessioncurrenttrack); + DicConsole.DebugWriteLine("Nero plugin", "\tcurrentsessionmaxtrack = {0}", + currentsessionmaxtrack); + DicConsole.DebugWriteLine("Nero plugin", "\tcurrentsessioncurrenttrack = {0}", + currentsessioncurrenttrack); Track _track = new Track(); - if(_neroTrack.Sequence == 1) - _neroTrack.Index0 = _neroTrack.Index1; + if(_neroTrack.Sequence == 1) _neroTrack.Index0 = _neroTrack.Index1; _track.Indexes = new Dictionary<int, ulong>(); if(_neroTrack.Index0 < _neroTrack.Index1) @@ -1591,12 +1654,16 @@ namespace DiscImageChef.ImagePlugins imageTracks.Add(_track); - DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackDescription = {0}", _track.TrackDescription); - DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackEndSector = {0}", _track.TrackEndSector); + DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackDescription = {0}", + _track.TrackDescription); + DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackEndSector = {0}", + _track.TrackEndSector); DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackPregap = {0}", _track.TrackPregap); - DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackSequence = {0}", _track.TrackSequence); + DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackSequence = {0}", + _track.TrackSequence); DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackSession = {0}", _track.TrackSession); - DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackStartSector = {0}", _track.TrackStartSector); + DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackStartSector = {0}", + _track.TrackStartSector); DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackType = {0}", _track.TrackType); if(currentsessioncurrenttrack == 1) @@ -1627,7 +1694,8 @@ namespace DiscImageChef.ImagePlugins } offsetmap.Add(_track.TrackSequence, _track.TrackStartSector); - DicConsole.DebugWriteLine("Nero plugin", "\t\t Offset[{0}]: {1}", _track.TrackSequence, _track.TrackStartSector); + DicConsole.DebugWriteLine("Nero plugin", "\t\t Offset[{0}]: {1}", _track.TrackSequence, + _track.TrackStartSector); Partition partition; @@ -1653,7 +1721,8 @@ namespace DiscImageChef.ImagePlugins partition.Length = partition.Size / _neroTrack.SectorSize; partition.Sequence = PartitionSequence; partition.Offset = partitionStartByte; - partition.Start = _neroTrack.StartLBA + ((_neroTrack.Index1 - _neroTrack.Index0) / _neroTrack.SectorSize); + partition.Start = _neroTrack.StartLBA + + ((_neroTrack.Index1 - _neroTrack.Index0) / _neroTrack.SectorSize); partition.Type = NeroTrackModeToTrackType((DAOMode)_neroTrack.Mode).ToString(); ImagePartitions.Add(partition); PartitionSequence++; @@ -1674,16 +1743,20 @@ namespace DiscImageChef.ImagePlugins for(int i = 0; i < neroTracks.Count; i++) { // First track is audio - firstaudio |= i == 0 && ((DAOMode)neroTracks.ElementAt(i).Value.Mode == DAOMode.Audio || (DAOMode)neroTracks.ElementAt(i).Value.Mode == DAOMode.AudioSub); + firstaudio |= i == 0 && ((DAOMode)neroTracks.ElementAt(i).Value.Mode == DAOMode.Audio || + (DAOMode)neroTracks.ElementAt(i).Value.Mode == DAOMode.AudioSub); // First track is data - firstdata |= i == 0 && ((DAOMode)neroTracks.ElementAt(i).Value.Mode != DAOMode.Audio && (DAOMode)neroTracks.ElementAt(i).Value.Mode != DAOMode.AudioSub); + firstdata |= i == 0 && ((DAOMode)neroTracks.ElementAt(i).Value.Mode != DAOMode.Audio && + (DAOMode)neroTracks.ElementAt(i).Value.Mode != DAOMode.AudioSub); // Any non first track is data - data |= i != 0 && ((DAOMode)neroTracks.ElementAt(i).Value.Mode != DAOMode.Audio && (DAOMode)neroTracks.ElementAt(i).Value.Mode != DAOMode.AudioSub); + data |= i != 0 && ((DAOMode)neroTracks.ElementAt(i).Value.Mode != DAOMode.Audio && + (DAOMode)neroTracks.ElementAt(i).Value.Mode != DAOMode.AudioSub); // Any non first track is audio - audio |= i != 0 && ((DAOMode)neroTracks.ElementAt(i).Value.Mode == DAOMode.Audio || (DAOMode)neroTracks.ElementAt(i).Value.Mode == DAOMode.AudioSub); + audio |= i != 0 && ((DAOMode)neroTracks.ElementAt(i).Value.Mode == DAOMode.Audio || + (DAOMode)neroTracks.ElementAt(i).Value.Mode == DAOMode.AudioSub); switch((DAOMode)neroTracks.ElementAt(i).Value.Mode) { @@ -1696,19 +1769,14 @@ namespace DiscImageChef.ImagePlugins } } - if(!data && !firstdata) - ImageInfo.mediaType = MediaType.CDDA; + if(!data && !firstdata) ImageInfo.mediaType = MediaType.CDDA; else if(firstaudio && data && imageSessions.Count > 1 && mode2) ImageInfo.mediaType = MediaType.CDPLUS; - else if((firstdata && audio) || mode2) - ImageInfo.mediaType = MediaType.CDROMXA; - else if(!audio) - ImageInfo.mediaType = MediaType.CDROM; - else - ImageInfo.mediaType = MediaType.CD; + else if((firstdata && audio) || mode2) ImageInfo.mediaType = MediaType.CDROMXA; + else if(!audio) ImageInfo.mediaType = MediaType.CDROM; + else ImageInfo.mediaType = MediaType.CD; } - ImageInfo.xmlMediaType = XmlMediaType.OpticalDisc; DicConsole.VerboseWriteLine("Nero image contains a disc of type {0}", ImageInfo.mediaType); @@ -1716,8 +1784,8 @@ namespace DiscImageChef.ImagePlugins } catch { - DicConsole.DebugWrite("Nero plugin", "Exception ocurred opening file."); - return false; + DicConsole.DebugWrite("Nero plugin", "Exception ocurred opening file."); + return false; } } @@ -1746,10 +1814,8 @@ namespace DiscImageChef.ImagePlugins { switch(tag) { - case MediaTagType.CD_MCN: - return UPC; - case MediaTagType.CD_TEXT: - throw new NotImplementedException("Not yet implemented"); + case MediaTagType.CD_MCN: return UPC; + case MediaTagType.CD_TEXT: throw new NotImplementedException("Not yet implemented"); default: throw new FeaturedNotSupportedByDiscImageException("Requested disk tag not supported by image"); } @@ -1792,7 +1858,8 @@ namespace DiscImageChef.ImagePlugins } } - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); } public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) @@ -1812,7 +1879,8 @@ namespace DiscImageChef.ImagePlugins } } - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); } public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) @@ -1823,7 +1891,10 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track not found"); if(length > _track.Sectors) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length, _track.Sectors)); + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length, _track.Sectors)); uint sector_offset; uint sector_size; @@ -1833,73 +1904,73 @@ namespace DiscImageChef.ImagePlugins { case DAOMode.Data: case DAOMode.DataM2F1: - { - sector_offset = 0; - sector_size = 2048; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2048; + sector_skip = 0; + break; + } case DAOMode.DataM2F2: - { - sector_offset = 8; - sector_size = 2324; - sector_skip = 4; - break; - } + { + sector_offset = 8; + sector_size = 2324; + sector_skip = 4; + break; + } case DAOMode.Audio: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } case DAOMode.DataRaw: - { - sector_offset = 16; - sector_size = 2048; - sector_skip = 288; - break; - } + { + sector_offset = 16; + sector_size = 2048; + sector_skip = 288; + break; + } case DAOMode.DataM2Raw: - { - sector_offset = 16; - sector_size = 2336; - sector_skip = 0; - break; - } + { + sector_offset = 16; + sector_size = 2336; + sector_skip = 0; + break; + } // TODO: Supposing Nero suffixes the subchannel to the channel case DAOMode.DataRawSub: - { - sector_offset = 16; - sector_size = 2048; - sector_skip = 288 + 96; - break; - } + { + sector_offset = 16; + sector_size = 2048; + sector_skip = 288 + 96; + break; + } case DAOMode.DataM2RawSub: - { - sector_offset = 16; - sector_size = 2336; - sector_skip = 96; - break; - } + { + sector_offset = 16; + sector_size = 2336; + sector_skip = 96; + break; + } case DAOMode.AudioSub: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 96; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 96; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; imageStream = _imageFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.Offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + br.BaseStream + .Seek((long)_track.Offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -1923,7 +1994,10 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track not found"); if(length > _track.Sectors) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length, _track.Sectors)); + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length, _track.Sectors)); uint sector_offset; uint sector_size; @@ -1938,201 +2012,196 @@ namespace DiscImageChef.ImagePlugins case SectorTagType.CDSectorHeader: case SectorTagType.CDSectorSubchannel: case SectorTagType.CDSectorSubHeader: - case SectorTagType.CDSectorSync: - break; + case SectorTagType.CDSectorSync: break; case SectorTagType.CDTrackFlags: - { - byte[] flags = new byte[1]; - flags[0] = 0x00; + { + byte[] flags = new byte[1]; + flags[0] = 0x00; - if((DAOMode)_track.Mode != DAOMode.Audio && (DAOMode)_track.Mode != DAOMode.AudioSub) - flags[0] += 0x40; + if((DAOMode)_track.Mode != DAOMode.Audio && (DAOMode)_track.Mode != DAOMode.AudioSub) + flags[0] += 0x40; - return flags; - } - case SectorTagType.CDTrackISRC: - return _track.ISRC; + return flags; + } + case SectorTagType.CDTrackISRC: return _track.ISRC; case SectorTagType.CDTrackText: throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented"); - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } switch((DAOMode)_track.Mode) { case DAOMode.Data: - case DAOMode.DataM2F1: - throw new ArgumentException("No tags in image for requested track", nameof(tag)); + case DAOMode.DataM2F1: throw new ArgumentException("No tags in image for requested track", nameof(tag)); case DAOMode.DataM2F2: + { + switch(tag) { - switch(tag) + case SectorTagType.CDSectorSync: + case SectorTagType.CDSectorHeader: + case SectorTagType.CDSectorSubchannel: + case SectorTagType.CDSectorECC: + case SectorTagType.CDSectorECC_P: + case SectorTagType.CDSectorECC_Q: + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + case SectorTagType.CDSectorSubHeader: { - case SectorTagType.CDSectorSync: - case SectorTagType.CDSectorHeader: - case SectorTagType.CDSectorSubchannel: - case SectorTagType.CDSectorECC: - case SectorTagType.CDSectorECC_P: - case SectorTagType.CDSectorECC_Q: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorSubHeader: - { - sector_offset = 0; - sector_size = 8; - sector_skip = 2328; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2332; - sector_size = 4; - sector_skip = 0; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + sector_offset = 0; + sector_size = 8; + sector_skip = 2328; + break; } - break; + case SectorTagType.CDSectorEDC: + { + sector_offset = 2332; + sector_size = 4; + sector_skip = 0; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } - case DAOMode.Audio: - throw new ArgumentException("There are no tags on audio tracks", nameof(tag)); + + break; + } + case DAOMode.Audio: throw new ArgumentException("There are no tags on audio tracks", nameof(tag)); case DAOMode.DataRaw: + { + switch(tag) { - switch(tag) + case SectorTagType.CDSectorSync: { - case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340; - break; - } - case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336; - break; - } - case SectorTagType.CDSectorSubchannel: - case SectorTagType.CDSectorSubHeader: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - sector_skip = 104; - break; - } - case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2064; - sector_size = 4; - sector_skip = 284; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + sector_offset = 0; + sector_size = 12; + sector_skip = 2340; + break; } - break; + case SectorTagType.CDSectorHeader: + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336; + break; + } + case SectorTagType.CDSectorSubchannel: + case SectorTagType.CDSectorSubHeader: + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + case SectorTagType.CDSectorECC: + { + sector_offset = 2076; + sector_size = 276; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorECC_P: + { + sector_offset = 2076; + sector_size = 172; + sector_skip = 104; + break; + } + case SectorTagType.CDSectorECC_Q: + { + sector_offset = 2248; + sector_size = 104; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2064; + sector_size = 4; + sector_skip = 284; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } + + break; + } // TODO case DAOMode.DataM2RawSub: throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented"); case DAOMode.DataRawSub: + { + switch(tag) { - switch(tag) + case SectorTagType.CDSectorSync: { - case SectorTagType.CDSectorSync: - { - sector_offset = 0; - sector_size = 12; - sector_skip = 2340 + 96; - break; - } - case SectorTagType.CDSectorHeader: - { - sector_offset = 12; - sector_size = 4; - sector_skip = 2336 + 96; - break; - } - case SectorTagType.CDSectorSubchannel: - { - sector_offset = 2352; - sector_size = 96; - sector_skip = 0; - break; - } - case SectorTagType.CDSectorSubHeader: - throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - case SectorTagType.CDSectorECC: - { - sector_offset = 2076; - sector_size = 276; - sector_skip = 0 + 96; - break; - } - case SectorTagType.CDSectorECC_P: - { - sector_offset = 2076; - sector_size = 172; - sector_skip = 104 + 96; - break; - } - case SectorTagType.CDSectorECC_Q: - { - sector_offset = 2248; - sector_size = 104; - sector_skip = 0 + 96; - break; - } - case SectorTagType.CDSectorEDC: - { - sector_offset = 2064; - sector_size = 4; - sector_skip = 284 + 96; - break; - } - default: - throw new ArgumentException("Unsupported tag requested", nameof(tag)); + sector_offset = 0; + sector_size = 12; + sector_skip = 2340 + 96; + break; } - break; - } - case DAOMode.AudioSub: - { - if(tag != SectorTagType.CDSectorSubchannel) + case SectorTagType.CDSectorHeader: + { + sector_offset = 12; + sector_size = 4; + sector_skip = 2336 + 96; + break; + } + case SectorTagType.CDSectorSubchannel: + { + sector_offset = 2352; + sector_size = 96; + sector_skip = 0; + break; + } + case SectorTagType.CDSectorSubHeader: throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); - - sector_offset = 2352; - sector_size = 96; - sector_skip = 0; - break; + case SectorTagType.CDSectorECC: + { + sector_offset = 2076; + sector_size = 276; + sector_skip = 0 + 96; + break; + } + case SectorTagType.CDSectorECC_P: + { + sector_offset = 2076; + sector_size = 172; + sector_skip = 104 + 96; + break; + } + case SectorTagType.CDSectorECC_Q: + { + sector_offset = 2248; + sector_size = 104; + sector_skip = 0 + 96; + break; + } + case SectorTagType.CDSectorEDC: + { + sector_offset = 2064; + sector_size = 4; + sector_skip = 284 + 96; + break; + } + default: throw new ArgumentException("Unsupported tag requested", nameof(tag)); } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + + break; + } + case DAOMode.AudioSub: + { + if(tag != SectorTagType.CDSectorSubchannel) + throw new ArgumentException("Unsupported tag requested for this track", nameof(tag)); + + sector_offset = 2352; + sector_size = 96; + sector_skip = 0; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; imageStream = _imageFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.Offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + br.BaseStream + .Seek((long)_track.Offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -2175,7 +2244,8 @@ namespace DiscImageChef.ImagePlugins } } - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); } public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) @@ -2186,7 +2256,10 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(track), "Track not found"); if(length > _track.Sectors) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length, _track.Sectors)); + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", + length, _track.Sectors)); uint sector_offset; uint sector_size; @@ -2196,39 +2269,38 @@ namespace DiscImageChef.ImagePlugins { case DAOMode.Data: case DAOMode.DataM2F1: - { - sector_offset = 0; - sector_size = 2048; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2048; + sector_skip = 0; + break; + } case DAOMode.DataM2F2: - { - sector_offset = 0; - sector_size = 2336; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2336; + sector_skip = 0; + break; + } case DAOMode.DataRaw: case DAOMode.DataM2Raw: case DAOMode.Audio: - { - sector_offset = 0; - sector_size = 2352; - sector_skip = 0; - break; - } + { + sector_offset = 0; + sector_size = 2352; + sector_skip = 0; + break; + } case DAOMode.DataRawSub: case DAOMode.DataM2RawSub: case DAOMode.AudioSub: - { - sector_offset = 0; - sector_size = 2448; - sector_skip = 0; - break; - } - default: - throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); + { + sector_offset = 0; + sector_size = 2448; + sector_skip = 0; + break; + } + default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } byte[] buffer = new byte[sector_size * length]; @@ -2236,10 +2308,11 @@ namespace DiscImageChef.ImagePlugins imageStream = _imageFilter.GetDataForkStream(); BinaryReader br = new BinaryReader(imageStream); - br.BaseStream.Seek((long)_track.Offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); + br.BaseStream + .Seek((long)_track.Offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), + SeekOrigin.Begin); - if(sector_offset == 0 && sector_skip == 0) - buffer = br.ReadBytes((int)(sector_size * length)); + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { for(int i = 0; i < length; i++) @@ -2314,9 +2387,7 @@ namespace DiscImageChef.ImagePlugins public override List<Track> GetSessionTracks(ushort session) { List<Track> sessionTracks = new List<Track>(); - foreach(Track _track in imageTracks) - if(_track.TrackSession == session) - sessionTracks.Add(_track); + foreach(Track _track in imageTracks) if(_track.TrackSession == session) sessionTracks.Add(_track); return sessionTracks; } @@ -2338,7 +2409,8 @@ namespace DiscImageChef.ImagePlugins return Checksums.CDChecksums.CheckCDSector(buffer); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length); int bps = (int)(buffer.Length / length); @@ -2362,14 +2434,14 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { byte[] buffer = ReadSectorsLong(sectorAddress, length, track); int bps = (int)(buffer.Length / length); @@ -2393,10 +2465,9 @@ namespace DiscImageChef.ImagePlugins } } - if(UnknownLBAs.Count > 0) - return null; - if(FailingLBAs.Count > 0) - return false; + if(UnknownLBAs.Count > 0) return null; + if(FailingLBAs.Count > 0) return false; + return true; } @@ -2404,64 +2475,43 @@ namespace DiscImageChef.ImagePlugins { return null; } - #endregion #region Private methods - static MediaType NeroMediaTypeToMediaType(NeroMediaTypes type) { switch(type) { - case NeroMediaTypes.NERO_MTYP_DDCD: - return MediaType.DDCD; + case NeroMediaTypes.NERO_MTYP_DDCD: return MediaType.DDCD; case NeroMediaTypes.NERO_MTYP_DVD_M: - case NeroMediaTypes.NERO_MTYP_DVD_M_R: - return MediaType.DVDR; + case NeroMediaTypes.NERO_MTYP_DVD_M_R: return MediaType.DVDR; case NeroMediaTypes.NERO_MTYP_DVD_P: - case NeroMediaTypes.NERO_MTYP_DVD_P_R: - return MediaType.DVDPR; - case NeroMediaTypes.NERO_MTYP_DVD_RAM: - return MediaType.DVDRAM; + case NeroMediaTypes.NERO_MTYP_DVD_P_R: return MediaType.DVDPR; + case NeroMediaTypes.NERO_MTYP_DVD_RAM: return MediaType.DVDRAM; case NeroMediaTypes.NERO_MTYP_ML: case NeroMediaTypes.NERO_MTYP_MRW: - case NeroMediaTypes.NERO_MTYP_CDRW: - return MediaType.CDRW; - case NeroMediaTypes.NERO_MTYP_CDR: - return MediaType.CDR; + case NeroMediaTypes.NERO_MTYP_CDRW: return MediaType.CDRW; + case NeroMediaTypes.NERO_MTYP_CDR: return MediaType.CDR; case NeroMediaTypes.NERO_MTYP_DVD_ROM: case NeroMediaTypes.NERO_MTYP_DVD_ANY: case NeroMediaTypes.NERO_MTYP_DVD_ANY_R9: - case NeroMediaTypes.NERO_MTYP_DVD_ANY_OLD: - return MediaType.DVDROM; - case NeroMediaTypes.NERO_MTYP_CDROM: - return MediaType.CDROM; - case NeroMediaTypes.NERO_MTYP_DVD_M_RW: - return MediaType.DVDRW; - case NeroMediaTypes.NERO_MTYP_DVD_P_RW: - return MediaType.DVDPRW; - case NeroMediaTypes.NERO_MTYP_DVD_P_R9: - return MediaType.DVDPRDL; - case NeroMediaTypes.NERO_MTYP_DVD_M_R9: - return MediaType.DVDRDL; + case NeroMediaTypes.NERO_MTYP_DVD_ANY_OLD: return MediaType.DVDROM; + case NeroMediaTypes.NERO_MTYP_CDROM: return MediaType.CDROM; + case NeroMediaTypes.NERO_MTYP_DVD_M_RW: return MediaType.DVDRW; + case NeroMediaTypes.NERO_MTYP_DVD_P_RW: return MediaType.DVDPRW; + case NeroMediaTypes.NERO_MTYP_DVD_P_R9: return MediaType.DVDPRDL; + case NeroMediaTypes.NERO_MTYP_DVD_M_R9: return MediaType.DVDRDL; case NeroMediaTypes.NERO_MTYP_BD: case NeroMediaTypes.NERO_MTYP_BD_ANY: - case NeroMediaTypes.NERO_MTYP_BD_ROM: - return MediaType.BDROM; - case NeroMediaTypes.NERO_MTYP_BD_R: - return MediaType.BDR; - case NeroMediaTypes.NERO_MTYP_BD_RE: - return MediaType.BDRE; + case NeroMediaTypes.NERO_MTYP_BD_ROM: return MediaType.BDROM; + case NeroMediaTypes.NERO_MTYP_BD_R: return MediaType.BDR; + case NeroMediaTypes.NERO_MTYP_BD_RE: return MediaType.BDRE; case NeroMediaTypes.NERO_MTYP_HD_DVD: case NeroMediaTypes.NERO_MTYP_HD_DVD_ANY: - case NeroMediaTypes.NERO_MTYP_HD_DVD_ROM: - return MediaType.HDDVDROM; - case NeroMediaTypes.NERO_MTYP_HD_DVD_R: - return MediaType.HDDVDR; - case NeroMediaTypes.NERO_MTYP_HD_DVD_RW: - return MediaType.HDDVDRW; - default: - return MediaType.CD; + case NeroMediaTypes.NERO_MTYP_HD_DVD_ROM: return MediaType.HDDVDROM; + case NeroMediaTypes.NERO_MTYP_HD_DVD_R: return MediaType.HDDVDR; + case NeroMediaTypes.NERO_MTYP_HD_DVD_RW: return MediaType.HDDVDRW; + default: return MediaType.CD; } } @@ -2471,20 +2521,14 @@ namespace DiscImageChef.ImagePlugins { case DAOMode.Data: case DAOMode.DataRaw: - case DAOMode.DataRawSub: - return TrackType.CDMode1; - case DAOMode.DataM2F1: - return TrackType.CDMode2Form1; - case DAOMode.DataM2F2: - return TrackType.CDMode2Form2; + case DAOMode.DataRawSub: return TrackType.CDMode1; + case DAOMode.DataM2F1: return TrackType.CDMode2Form1; + case DAOMode.DataM2F2: return TrackType.CDMode2Form2; case DAOMode.DataM2RawSub: - case DAOMode.DataM2Raw: - return TrackType.CDMode2Formless; + case DAOMode.DataM2Raw: return TrackType.CDMode2Formless; case DAOMode.Audio: - case DAOMode.AudioSub: - return TrackType.Audio; - default: - return TrackType.Data; + case DAOMode.AudioSub: return TrackType.Audio; + default: return TrackType.Data; } } @@ -2493,27 +2537,20 @@ namespace DiscImageChef.ImagePlugins switch(mode) { case DAOMode.Data: - case DAOMode.DataM2F1: - return 2048; - case DAOMode.DataM2F2: - return 2336; + case DAOMode.DataM2F1: return 2048; + case DAOMode.DataM2F2: return 2336; case DAOMode.DataRaw: case DAOMode.DataM2Raw: - case DAOMode.Audio: - return 2352; + case DAOMode.Audio: return 2352; case DAOMode.DataM2RawSub: case DAOMode.DataRawSub: - case DAOMode.AudioSub: - return 2448; - default: - return 2352; + case DAOMode.AudioSub: return 2448; + default: return 2352; } } - #endregion #region Unsupported features - public override int GetMediaSequence() { return ImageInfo.mediaSequence; @@ -2573,7 +2610,6 @@ namespace DiscImageChef.ImagePlugins { return ImageInfo.mediaSerialNumber; } - #endregion } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/Parallels.cs b/DiscImageChef.DiscImages/Parallels.cs index 1838f61a..2a46a0c6 100644 --- a/DiscImageChef.DiscImages/Parallels.cs +++ b/DiscImageChef.DiscImages/Parallels.cs @@ -42,11 +42,13 @@ using DiscImageChef.ImagePlugins; namespace DiscImageChef.DiscImages { - public class Parallels : ImagePlugin + public class Parallels : ImagePlugin { #region Internal constants - readonly byte[] ParallelsMagic = { 0x57, 0x69, 0x74, 0x68, 0x6F, 0x75, 0x74, 0x46, 0x72, 0x65, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65 }; - readonly byte[] ParallelsExtMagic = { 0x57, 0x69, 0x74, 0x68, 0x6F, 0x75, 0x46, 0x72, 0x65, 0x53, 0x70, 0x61, 0x63, 0x45, 0x78, 0x74 }; + readonly byte[] ParallelsMagic = + {0x57, 0x69, 0x74, 0x68, 0x6F, 0x75, 0x74, 0x46, 0x72, 0x65, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65}; + readonly byte[] ParallelsExtMagic = + {0x57, 0x69, 0x74, 0x68, 0x6F, 0x75, 0x46, 0x72, 0x65, 0x53, 0x70, 0x61, 0x63, 0x45, 0x78, 0x74}; const uint ParallelsVersion = 2; @@ -66,8 +68,7 @@ namespace DiscImageChef.DiscImages /// <summary> /// Magic, <see cref="ParallelsMagic"/> or <see cref="ParallelsExtMagic"/> /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] magic; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] magic; /// <summary> /// Version /// </summary> @@ -156,8 +157,7 @@ namespace DiscImageChef.DiscImages Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] pHdr_b = new byte[Marshal.SizeOf(pHdr)]; stream.Read(pHdr_b, 0, Marshal.SizeOf(pHdr)); @@ -175,8 +175,7 @@ namespace DiscImageChef.DiscImages Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] pHdr_b = new byte[Marshal.SizeOf(pHdr)]; stream.Read(pHdr_b, 0, Marshal.SizeOf(pHdr)); @@ -205,14 +204,11 @@ namespace DiscImageChef.DiscImages BAT = new uint[pHdr.bat_entries]; byte[] BAT_b = new byte[pHdr.bat_entries * 4]; stream.Read(BAT_b, 0, BAT_b.Length); - for(int i = 0; i < BAT.Length; i++) - BAT[i] = BitConverter.ToUInt32(BAT_b, i * 4); + for(int i = 0; i < BAT.Length; i++) BAT[i] = BitConverter.ToUInt32(BAT_b, i * 4); clusterBytes = pHdr.cluster_size * 512; - if(pHdr.data_off > 0) - dataOffset = pHdr.data_off * 512; - else - dataOffset = ((stream.Position / clusterBytes) + (stream.Position % clusterBytes)) * clusterBytes; + if(pHdr.data_off > 0) dataOffset = pHdr.data_off * 512; + else dataOffset = ((stream.Position / clusterBytes) + (stream.Position % clusterBytes)) * clusterBytes; sectorCache = new Dictionary<ulong, byte[]>(); @@ -226,9 +222,9 @@ namespace DiscImageChef.DiscImages ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; ImageInfo.mediaType = MediaType.GENERIC_HDD; ImageInfo.imageSize = pHdr.sectors * 512; - ImageInfo.cylinders = pHdr.cylinders; - ImageInfo.heads = pHdr.heads; - ImageInfo.sectorsPerTrack = (uint)((ImageInfo.sectors / ImageInfo.cylinders) / ImageInfo.heads); + ImageInfo.cylinders = pHdr.cylinders; + ImageInfo.heads = pHdr.heads; + ImageInfo.sectorsPerTrack = (uint)((ImageInfo.sectors / ImageInfo.cylinders) / ImageInfo.heads); imageStream = stream; return true; @@ -237,15 +233,14 @@ namespace DiscImageChef.DiscImages public override byte[] ReadSector(ulong sectorAddress) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); - if(empty) - return new byte[512]; + if(empty) return new byte[512]; byte[] sector; - if(sectorCache.TryGetValue(sectorAddress, out sector)) - return sector; + if(sectorCache.TryGetValue(sectorAddress, out sector)) return sector; ulong index = sectorAddress / pHdr.cluster_size; ulong secOff = sectorAddress % pHdr.cluster_size; @@ -253,13 +248,10 @@ namespace DiscImageChef.DiscImages uint batOff = BAT[index]; ulong imageOff; - if(batOff == 0) - return new byte[512]; + if(batOff == 0) return new byte[512]; - if(extended) - imageOff = batOff * clusterBytes; - else - imageOff = batOff * 512; + if(extended) imageOff = batOff * clusterBytes; + else imageOff = batOff * 512; byte[] cluster = new byte[clusterBytes]; imageStream.Seek((long)imageOff, SeekOrigin.Begin); @@ -267,24 +259,23 @@ namespace DiscImageChef.DiscImages sector = new byte[512]; Array.Copy(cluster, (int)(secOff * 512), sector, 0, 512); - if(sectorCache.Count > maxCachedSectors) - sectorCache.Clear(); + if(sectorCache.Count > maxCachedSectors) sectorCache.Clear(); sectorCache.Add(sectorAddress, sector); - return sector; + return sector; } public override byte[] ReadSectors(ulong sectorAddress, uint length) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); if(sectorAddress + length > ImageInfo.sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - if(empty) - return new byte[512 * length]; + if(empty) return new byte[512 * length]; MemoryStream ms = new MemoryStream(); @@ -368,7 +359,6 @@ namespace DiscImageChef.DiscImages } #region Unsupported features - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -509,16 +499,18 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -527,8 +519,6 @@ namespace DiscImageChef.DiscImages { return null; } - #endregion } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/PartClone.cs b/DiscImageChef.DiscImages/PartClone.cs index 5497489a..557f29cb 100644 --- a/DiscImageChef.DiscImages/PartClone.cs +++ b/DiscImageChef.DiscImages/PartClone.cs @@ -43,521 +43,514 @@ using Extents; namespace DiscImageChef.DiscImages { - public class PartClone : ImagePlugin - { - #region Internal constants - readonly byte[] PartCloneMagic = { 0x70, 0x61, 0x72, 0x74, 0x63, 0x6C, 0x6F, 0x6E, 0x65, 0x2D, 0x69, 0x6D, 0x61, 0x67, 0x65 }; - readonly byte[] BiTmAgIc = { 0x42, 0x69, 0x54, 0x6D, 0x41, 0x67, 0x49, 0x63 }; - const int CRC_SIZE = 4; - #endregion - - #region Internal Structures - [StructLayout(LayoutKind.Sequential, Pack = 1)] - /// <summary> - /// PartClone disk image header, little-endian - /// </summary> - struct PartCloneHeader - { - /// <summary> - /// Magic, <see cref="PartCloneMagic"/> - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] - public byte[] magic; - /// <summary> - /// Source filesystem - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] - public byte[] filesystem; - /// <summary> - /// Version - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] version; - /// <summary> - /// Padding - /// </summary> - public ushort padding; - /// <summary> - /// Block (sector) size - /// </summary> - public uint blockSize; - /// <summary> - /// Size of device containing the cloned partition - /// </summary> - public ulong deviceSize; - /// <summary> - /// Total blocks in cloned partition - /// </summary> - public ulong totalBlocks; - /// <summary> - /// Used blocks in cloned partition - /// </summary> - public ulong usedBlocks; - /// <summary> - /// Empty space - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4096)] - public byte[] buffer; - } - #endregion - - PartCloneHeader pHdr; - // The used block "bitmap" uses one byte per block - // TODO: Convert on-image bytemap to on-memory bitmap - byte[] byteMap; - Stream imageStream; - long dataOff; - - Dictionary<ulong, byte[]> sectorCache; - - const uint MaxCacheSize = 16777216; - uint maxCachedSectors = MaxCacheSize / 512; - - ExtentsULong extents; - Dictionary<ulong, ulong> extentsOff; - - public PartClone() - { - Name = "PartClone disk image"; - PluginUUID = new Guid("AB1D7518-B548-4099-A4E2-C29C53DDE0C3"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = false; - ImageInfo.imageHasSessions = false; - ImageInfo.imageApplication = "PartClone"; - ImageInfo.imageApplicationVersion = null; - ImageInfo.imageCreator = null; - ImageInfo.imageComments = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaSerialNumber = null; - ImageInfo.mediaBarcode = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - if(stream.Length < 512) - return false; - - byte[] pHdr_b = new byte[Marshal.SizeOf(pHdr)]; - stream.Read(pHdr_b, 0, Marshal.SizeOf(pHdr)); - pHdr = new PartCloneHeader(); - IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(pHdr)); - Marshal.Copy(pHdr_b, 0, headerPtr, Marshal.SizeOf(pHdr)); - pHdr = (PartCloneHeader)Marshal.PtrToStructure(headerPtr, typeof(PartCloneHeader)); - Marshal.FreeHGlobal(headerPtr); - - if(stream.Position + (long)pHdr.totalBlocks > stream.Length) - return false; - - stream.Seek((long)pHdr.totalBlocks, SeekOrigin.Current); - - byte[] bitmagic = new byte[8]; - stream.Read(bitmagic, 0, 8); - - return PartCloneMagic.SequenceEqual(pHdr.magic) && BiTmAgIc.SequenceEqual(bitmagic); - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - if(stream.Length < 512) - return false; - - byte[] pHdr_b = new byte[Marshal.SizeOf(pHdr)]; - stream.Read(pHdr_b, 0, Marshal.SizeOf(pHdr)); - pHdr = new PartCloneHeader(); - IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(pHdr)); - Marshal.Copy(pHdr_b, 0, headerPtr, Marshal.SizeOf(pHdr)); - pHdr = (PartCloneHeader)Marshal.PtrToStructure(headerPtr, typeof(PartCloneHeader)); - Marshal.FreeHGlobal(headerPtr); - - DicConsole.DebugWriteLine("PartClone plugin", "pHdr.magic = {0}", StringHandlers.CToString(pHdr.magic)); - DicConsole.DebugWriteLine("PartClone plugin", "pHdr.filesystem = {0}", StringHandlers.CToString(pHdr.filesystem)); - DicConsole.DebugWriteLine("PartClone plugin", "pHdr.version = {0}", StringHandlers.CToString(pHdr.version)); - DicConsole.DebugWriteLine("PartClone plugin", "pHdr.blockSize = {0}", pHdr.blockSize); - DicConsole.DebugWriteLine("PartClone plugin", "pHdr.deviceSize = {0}", pHdr.deviceSize); - DicConsole.DebugWriteLine("PartClone plugin", "pHdr.totalBlocks = {0}", pHdr.totalBlocks); - DicConsole.DebugWriteLine("PartClone plugin", "pHdr.usedBlocks = {0}", pHdr.usedBlocks); - - byteMap = new byte[pHdr.totalBlocks]; - DicConsole.DebugWriteLine("PartClone plugin", "Reading bytemap {0} bytes", byteMap.Length); - stream.Read(byteMap, 0, byteMap.Length); - - byte[] bitmagic = new byte[8]; - stream.Read(bitmagic, 0, 8); - - DicConsole.DebugWriteLine("PartClone plugin", "pHdr.bitmagic = {0}", StringHandlers.CToString(bitmagic)); - - if(!BiTmAgIc.SequenceEqual(bitmagic)) - throw new ImageNotSupportedException("Could not find partclone BiTmAgIc, not continuing..."); - - dataOff = stream.Position; - DicConsole.DebugWriteLine("PartClone plugin", "pHdr.dataOff = {0}", dataOff); - - DicConsole.DebugWriteLine("PartClone plugin", "Filling extents"); - DateTime start = DateTime.Now; - extents = new ExtentsULong(); - extentsOff = new Dictionary<ulong, ulong>(); - bool current = byteMap[0] > 0; - ulong blockOff = 0; - ulong extentStart = 0; - - for(ulong i = 1; i < pHdr.totalBlocks; i++) - { - bool next = byteMap[i] > 0; - - // Flux - if(next != current) - { - // Next is used - if(next) - { - extentStart = i; - extentsOff.Add(i, ++blockOff); - } - else - { - extents.Add(extentStart, i); - extentsOff.TryGetValue(extentStart, out ulong foo); - } - } - - if(next && current) - blockOff++; - - current = next; - } - DateTime end = DateTime.Now; - DicConsole.DebugWriteLine("PartClone plugin", "Took {0} seconds to fill extents", (end - start).TotalSeconds); - - sectorCache = new Dictionary<ulong, byte[]>(); - - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.sectors = pHdr.totalBlocks; - ImageInfo.sectorSize = pHdr.blockSize; - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.mediaType = MediaType.GENERIC_HDD; - ImageInfo.imageSize = (ulong)(stream.Length - (4096 + 0x40 + (long)pHdr.totalBlocks)); - imageStream = stream; - - return true; - } - - ulong BlockOffset(ulong sectorAddress) - { - extents.GetStart(sectorAddress, out ulong extentStart); - extentsOff.TryGetValue(extentStart, out ulong extentStartingOffset); - return extentStartingOffset + (sectorAddress - extentStart); - } - - public override byte[] ReadSector(ulong sectorAddress) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if(byteMap[sectorAddress] == 0) - return new byte[pHdr.blockSize]; - - byte[] sector; - - if(sectorCache.TryGetValue(sectorAddress, out sector)) - return sector; - - long imageOff = dataOff + (long)(BlockOffset(sectorAddress) * (pHdr.blockSize + CRC_SIZE)); - - sector = new byte[pHdr.blockSize]; - imageStream.Seek(imageOff, SeekOrigin.Begin); - imageStream.Read(sector, 0, (int)pHdr.blockSize); - - if(sectorCache.Count > maxCachedSectors) - sectorCache.Clear(); - - sectorCache.Add(sectorAddress, sector); - - return sector; - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - MemoryStream ms = new MemoryStream(); - - bool allEmpty = true; - for(uint i = 0; i < length; i++) - { - if(byteMap[sectorAddress + i] != 0) - { - allEmpty = false; - break; - } - } - - if(allEmpty) - return new byte[pHdr.blockSize * length]; - - for(uint i = 0; i < length; i++) - { - byte[] sector = ReadSector(sectorAddress + i); - ms.Write(sector, 0, sector.Length); - } - - return ms.ToArray(); - } - - public override bool ImageHasPartitions() - { - return false; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override string GetImageFormat() - { - return "PartClone"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - #region Unsupported features - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetMediaManufacturer() - { - return null; - } - - public override string GetMediaModel() - { - return null; - } - - public override string GetMediaSerialNumber() - { - return null; - } - - public override string GetMediaBarcode() - { - return null; - } - - public override string GetMediaPartNumber() - { - return null; - } - - public override int GetMediaSequence() - { - return 0; - } - - public override int GetLastDiskSequence() - { - return 0; - } - - public override string GetDriveManufacturer() - { - return null; - } - - public override string GetDriveModel() - { - return null; - } - - public override string GetDriveSerialNumber() - { - return null; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - // TODO: All blocks contain a CRC32 that's incompatible with current implementation. Need to check for compatibility. - public override bool? VerifyMediaImage() - { - return null; - } - - #endregion - } -} - + public class PartClone : ImagePlugin + { + #region Internal constants + readonly byte[] PartCloneMagic = + {0x70, 0x61, 0x72, 0x74, 0x63, 0x6C, 0x6F, 0x6E, 0x65, 0x2D, 0x69, 0x6D, 0x61, 0x67, 0x65}; + readonly byte[] BiTmAgIc = {0x42, 0x69, 0x54, 0x6D, 0x41, 0x67, 0x49, 0x63}; + const int CRC_SIZE = 4; + #endregion + + #region Internal Structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + /// <summary> + /// PartClone disk image header, little-endian + /// </summary> + struct PartCloneHeader + { + /// <summary> + /// Magic, <see cref="PartCloneMagic"/> + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public byte[] magic; + /// <summary> + /// Source filesystem + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public byte[] filesystem; + /// <summary> + /// Version + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] version; + /// <summary> + /// Padding + /// </summary> + public ushort padding; + /// <summary> + /// Block (sector) size + /// </summary> + public uint blockSize; + /// <summary> + /// Size of device containing the cloned partition + /// </summary> + public ulong deviceSize; + /// <summary> + /// Total blocks in cloned partition + /// </summary> + public ulong totalBlocks; + /// <summary> + /// Used blocks in cloned partition + /// </summary> + public ulong usedBlocks; + /// <summary> + /// Empty space + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4096)] public byte[] buffer; + } + #endregion + + PartCloneHeader pHdr; + // The used block "bitmap" uses one byte per block + // TODO: Convert on-image bytemap to on-memory bitmap + byte[] byteMap; + Stream imageStream; + long dataOff; + + Dictionary<ulong, byte[]> sectorCache; + + const uint MaxCacheSize = 16777216; + uint maxCachedSectors = MaxCacheSize / 512; + + ExtentsULong extents; + Dictionary<ulong, ulong> extentsOff; + + public PartClone() + { + Name = "PartClone disk image"; + PluginUUID = new Guid("AB1D7518-B548-4099-A4E2-C29C53DDE0C3"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = false; + ImageInfo.imageHasSessions = false; + ImageInfo.imageApplication = "PartClone"; + ImageInfo.imageApplicationVersion = null; + ImageInfo.imageCreator = null; + ImageInfo.imageComments = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaSerialNumber = null; + ImageInfo.mediaBarcode = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + if(stream.Length < 512) return false; + + byte[] pHdr_b = new byte[Marshal.SizeOf(pHdr)]; + stream.Read(pHdr_b, 0, Marshal.SizeOf(pHdr)); + pHdr = new PartCloneHeader(); + IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(pHdr)); + Marshal.Copy(pHdr_b, 0, headerPtr, Marshal.SizeOf(pHdr)); + pHdr = (PartCloneHeader)Marshal.PtrToStructure(headerPtr, typeof(PartCloneHeader)); + Marshal.FreeHGlobal(headerPtr); + + if(stream.Position + (long)pHdr.totalBlocks > stream.Length) return false; + + stream.Seek((long)pHdr.totalBlocks, SeekOrigin.Current); + + byte[] bitmagic = new byte[8]; + stream.Read(bitmagic, 0, 8); + + return PartCloneMagic.SequenceEqual(pHdr.magic) && BiTmAgIc.SequenceEqual(bitmagic); + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + if(stream.Length < 512) return false; + + byte[] pHdr_b = new byte[Marshal.SizeOf(pHdr)]; + stream.Read(pHdr_b, 0, Marshal.SizeOf(pHdr)); + pHdr = new PartCloneHeader(); + IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(pHdr)); + Marshal.Copy(pHdr_b, 0, headerPtr, Marshal.SizeOf(pHdr)); + pHdr = (PartCloneHeader)Marshal.PtrToStructure(headerPtr, typeof(PartCloneHeader)); + Marshal.FreeHGlobal(headerPtr); + + DicConsole.DebugWriteLine("PartClone plugin", "pHdr.magic = {0}", StringHandlers.CToString(pHdr.magic)); + DicConsole.DebugWriteLine("PartClone plugin", "pHdr.filesystem = {0}", + StringHandlers.CToString(pHdr.filesystem)); + DicConsole.DebugWriteLine("PartClone plugin", "pHdr.version = {0}", StringHandlers.CToString(pHdr.version)); + DicConsole.DebugWriteLine("PartClone plugin", "pHdr.blockSize = {0}", pHdr.blockSize); + DicConsole.DebugWriteLine("PartClone plugin", "pHdr.deviceSize = {0}", pHdr.deviceSize); + DicConsole.DebugWriteLine("PartClone plugin", "pHdr.totalBlocks = {0}", pHdr.totalBlocks); + DicConsole.DebugWriteLine("PartClone plugin", "pHdr.usedBlocks = {0}", pHdr.usedBlocks); + + byteMap = new byte[pHdr.totalBlocks]; + DicConsole.DebugWriteLine("PartClone plugin", "Reading bytemap {0} bytes", byteMap.Length); + stream.Read(byteMap, 0, byteMap.Length); + + byte[] bitmagic = new byte[8]; + stream.Read(bitmagic, 0, 8); + + DicConsole.DebugWriteLine("PartClone plugin", "pHdr.bitmagic = {0}", StringHandlers.CToString(bitmagic)); + + if(!BiTmAgIc.SequenceEqual(bitmagic)) + throw new ImageNotSupportedException("Could not find partclone BiTmAgIc, not continuing..."); + + dataOff = stream.Position; + DicConsole.DebugWriteLine("PartClone plugin", "pHdr.dataOff = {0}", dataOff); + + DicConsole.DebugWriteLine("PartClone plugin", "Filling extents"); + DateTime start = DateTime.Now; + extents = new ExtentsULong(); + extentsOff = new Dictionary<ulong, ulong>(); + bool current = byteMap[0] > 0; + ulong blockOff = 0; + ulong extentStart = 0; + + for(ulong i = 1; i < pHdr.totalBlocks; i++) + { + bool next = byteMap[i] > 0; + + // Flux + if(next != current) + { + // Next is used + if(next) + { + extentStart = i; + extentsOff.Add(i, ++blockOff); + } + else + { + extents.Add(extentStart, i); + extentsOff.TryGetValue(extentStart, out ulong foo); + } + } + + if(next && current) blockOff++; + + current = next; + } + + DateTime end = DateTime.Now; + DicConsole.DebugWriteLine("PartClone plugin", "Took {0} seconds to fill extents", + (end - start).TotalSeconds); + + sectorCache = new Dictionary<ulong, byte[]>(); + + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.sectors = pHdr.totalBlocks; + ImageInfo.sectorSize = pHdr.blockSize; + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.mediaType = MediaType.GENERIC_HDD; + ImageInfo.imageSize = (ulong)(stream.Length - (4096 + 0x40 + (long)pHdr.totalBlocks)); + imageStream = stream; + + return true; + } + + ulong BlockOffset(ulong sectorAddress) + { + extents.GetStart(sectorAddress, out ulong extentStart); + extentsOff.TryGetValue(extentStart, out ulong extentStartingOffset); + return extentStartingOffset + (sectorAddress - extentStart); + } + + public override byte[] ReadSector(ulong sectorAddress) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if(byteMap[sectorAddress] == 0) return new byte[pHdr.blockSize]; + + byte[] sector; + + if(sectorCache.TryGetValue(sectorAddress, out sector)) return sector; + + long imageOff = dataOff + (long)(BlockOffset(sectorAddress) * (pHdr.blockSize + CRC_SIZE)); + + sector = new byte[pHdr.blockSize]; + imageStream.Seek(imageOff, SeekOrigin.Begin); + imageStream.Read(sector, 0, (int)pHdr.blockSize); + + if(sectorCache.Count > maxCachedSectors) sectorCache.Clear(); + + sectorCache.Add(sectorAddress, sector); + + return sector; + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + MemoryStream ms = new MemoryStream(); + + bool allEmpty = true; + for(uint i = 0; i < length; i++) + { + if(byteMap[sectorAddress + i] != 0) + { + allEmpty = false; + break; + } + } + + if(allEmpty) return new byte[pHdr.blockSize * length]; + + for(uint i = 0; i < length; i++) + { + byte[] sector = ReadSector(sectorAddress + i); + ms.Write(sector, 0, sector.Length); + } + + return ms.ToArray(); + } + + public override bool ImageHasPartitions() + { + return false; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override string GetImageFormat() + { + return "PartClone"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + #region Unsupported features + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetMediaManufacturer() + { + return null; + } + + public override string GetMediaModel() + { + return null; + } + + public override string GetMediaSerialNumber() + { + return null; + } + + public override string GetMediaBarcode() + { + return null; + } + + public override string GetMediaPartNumber() + { + return null; + } + + public override int GetMediaSequence() + { + return 0; + } + + public override int GetLastDiskSequence() + { + return 0; + } + + public override string GetDriveManufacturer() + { + return null; + } + + public override string GetDriveModel() + { + return null; + } + + public override string GetDriveSerialNumber() + { + return null; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + // TODO: All blocks contain a CRC32 that's incompatible with current implementation. Need to check for compatibility. + public override bool? VerifyMediaImage() + { + return null; + } + #endregion + } +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/Partimage.cs b/DiscImageChef.DiscImages/Partimage.cs index 7d647786..0e3c296c 100644 --- a/DiscImageChef.DiscImages/Partimage.cs +++ b/DiscImageChef.DiscImages/Partimage.cs @@ -43,804 +43,831 @@ using Extents; namespace DiscImageChef.DiscImages { - public class Partimage : ImagePlugin - { - #region Internal constants - readonly byte[] PartimageMagic = { 0x50, 0x61, 0x52, 0x74, 0x49, 0x6D, 0x41, 0x67, 0x45, 0x2D, 0x56, 0x6F, 0x4C, 0x75, 0x4D, 0x65, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - const int MAX_DESCRIPTION = 4096; - const int MAX_HOSTNAMESIZE = 128; - const int MAX_DEVICENAMELEN = 512; - const int MAX_UNAMEINFOLEN = 65; //SYS_NMLN - const int MBR_SIZE_WHOLE = 512; - const int MAX_DESC_MODEL = 128; - const int MAX_DESC_GEOMETRY = 1024; - const int MAX_DESC_IDENTIFY = 4096; - const int CHECK_FREQUENCY = 65536; - readonly string MAGIC_BEGIN_LOCALHEADER = "MAGIC-BEGIN-LOCALHEADER"; - readonly string MAGIC_BEGIN_DATABLOCKS = "MAGIC-BEGIN-DATABLOCKS"; - readonly string MAGIC_BEGIN_BITMAP = "MAGIC-BEGIN-BITMAP"; - readonly string MAGIC_BEGIN_MBRBACKUP = "MAGIC-BEGIN-MBRBACKUP"; - readonly string MAGIC_BEGIN_TAIL = "MAGIC-BEGIN-TAIL"; - readonly string MAGIC_BEGIN_INFO = "MAGIC-BEGIN-INFO"; - readonly string MAGIC_BEGIN_EXT000 = "MAGIC-BEGIN-EXT000"; // reserved for future use - readonly string MAGIC_BEGIN_EXT001 = "MAGIC-BEGIN-EXT001"; // reserved for future use - readonly string MAGIC_BEGIN_EXT002 = "MAGIC-BEGIN-EXT002"; // reserved for future use - readonly string MAGIC_BEGIN_EXT003 = "MAGIC-BEGIN-EXT003"; // reserved for future use - readonly string MAGIC_BEGIN_EXT004 = "MAGIC-BEGIN-EXT004"; // reserved for future use - readonly string MAGIC_BEGIN_EXT005 = "MAGIC-BEGIN-EXT005"; // reserved for future use - readonly string MAGIC_BEGIN_EXT006 = "MAGIC-BEGIN-EXT006"; // reserved for future use - readonly string MAGIC_BEGIN_EXT007 = "MAGIC-BEGIN-EXT007"; // reserved for future use - readonly string MAGIC_BEGIN_EXT008 = "MAGIC-BEGIN-EXT008"; // reserved for future use - readonly string MAGIC_BEGIN_EXT009 = "MAGIC-BEGIN-EXT009"; // reserved for future use - readonly string MAGIC_BEGIN_VOLUME = "PaRtImAgE-VoLuMe"; - #endregion - - #region Internal Structures - [StructLayout(LayoutKind.Sequential, Pack = 1)] - /// <summary> - /// Partimage disk image header, little-endian - /// </summary> - struct PartimageHeader - { - /// <summary> - /// Magic, <see cref="PartimageMagic"/> - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] magic; - /// <summary> - /// Source filesystem - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] version; - /// <summary> - /// Volume number - /// </summary> - public uint volumeNumber; - /// <summary> - /// Image identifier - /// </summary> - public ulong identificator; - /// <summary> - /// Empty space - /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 404)] - public byte[] reserved; - } - - struct portable_tm - { - public uint tm_sec; - public uint tm_min; - public uint tm_hour; - public uint tm_mday; - public uint tm_mon; - public uint tm_year; - public uint tm_wday; - public uint tm_yday; - public uint tm_isdst; - - public uint tm_gmtoff; - public uint tm_zone; - }; - - enum pCompression : uint - { - None = 0, - Gzip = 1, - Bzip2 = 2, - Lzo = 3 - } - - enum pEncryption : uint - { - None = 0, - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - /// <summary> - /// Partimage CMainHeader - /// </summary> - struct PartimageMainHeader - { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] - public byte[] szFileSystem; // ext2fs, ntfs, reiserfs, ... - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DESCRIPTION)] - public byte[] szPartDescription; // user description of the partition - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DEVICENAMELEN)] - public byte[] szOriginalDevice; // original partition name - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4095)] - public byte[] szFirstImageFilepath; //MAXPATHLEN]; // for splitted image files - - // system and hardware infos - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_UNAMEINFOLEN)] - public byte[] szUnameSysname; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_UNAMEINFOLEN)] - public byte[] szUnameNodename; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_UNAMEINFOLEN)] - public byte[] szUnameRelease; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_UNAMEINFOLEN)] - public byte[] szUnameVersion; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_UNAMEINFOLEN)] - public byte[] szUnameMachine; - - public pCompression dwCompression; // COMPRESS_XXXXXX - public uint dwMainFlags; - public portable_tm dateCreate; // date of image creation - public ulong qwPartSize; // size of the partition in bytes - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_HOSTNAMESIZE)] - public byte[] szHostname; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] szVersion; // version of the image file - - // MBR backup - public uint dwMbrCount; // how many MBR are saved in the image file - public uint dwMbrSize; // size of a MBR record (allow to change the size in the next versions) - - // future encryption support - public pEncryption dwEncryptAlgo; // algo used to encrypt data - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] cHashTestKey; // used to test the password without giving it - - // reserved for future use (save DiskLabel, Extended partitions, ...) - public uint dwReservedFuture000; - public uint dwReservedFuture001; - public uint dwReservedFuture002; - public uint dwReservedFuture003; - public uint dwReservedFuture004; - public uint dwReservedFuture005; - public uint dwReservedFuture006; - public uint dwReservedFuture007; - public uint dwReservedFuture008; - public uint dwReservedFuture009; - - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6524)] - public byte[] cReserved; // Adjust to fit with total header size - - public uint crc; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CMbr // must be 1024 - { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MBR_SIZE_WHOLE)] - public byte[] cData; - public uint dwDataCRC; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DEVICENAMELEN)] - public byte[] szDevice; // ex: "hda" - - // disk identificators - ulong qwBlocksCount; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DESC_MODEL)] - public byte[] szDescModel; - - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 884)] - public byte[] cReserved; // for future use - - //public byte[] szDescGeometry[MAX_DESC_GEOMETRY]; - //public byte[] szDescIdentify[MAX_DESC_IDENTIFY]; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CCheck - { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - byte[] cMagic; // must be 'C','H','K' - public uint dwCRC; // CRC of the CHECK_FREQUENCY blocks - public ulong qwPos; // number of the last block written - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CLocalHeader // size must be 16384 (adjust the reserved data) - { - public ulong qwBlockSize; - public ulong qwUsedBlocks; - public ulong qwBlocksCount; - public ulong qwBitmapSize; // bytes in the bitmap - public ulong qwBadBlocksCount; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] szLabel; - - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16280)] - public byte[] cReserved; // Adjust to fit with total header size - - public uint crc; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CMainTail // size must be 16384 (adjust the reserved data) - { - public ulong qwCRC; - public uint dwVolumeNumber; - - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16372)] - public byte[] cReserved; // Adjust to fit with total header size - } - #endregion - - PartimageHeader CVolumeHeader; - PartimageMainHeader CMainHeader; - byte[] bitmap; - Stream imageStream; - long dataOff; - - Dictionary<ulong, byte[]> sectorCache; - - const uint MaxCacheSize = 16777216; - uint maxCachedSectors = MaxCacheSize / 512; - - ExtentsULong extents; - Dictionary<ulong, ulong> extentsOff; - - public Partimage() - { - Name = "Partimage disk image"; - PluginUUID = new Guid("AAFDB99D-2B77-49EA-831C-C9BB58C68C95"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = false; - ImageInfo.imageHasSessions = false; - ImageInfo.imageApplication = "Partimage"; - ImageInfo.imageApplicationVersion = null; - ImageInfo.imageCreator = null; - ImageInfo.imageComments = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaSerialNumber = null; - ImageInfo.mediaBarcode = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - if(stream.Length < 512) - return false; - - byte[] pHdr_b = new byte[Marshal.SizeOf(CVolumeHeader)]; - stream.Read(pHdr_b, 0, Marshal.SizeOf(CVolumeHeader)); - CVolumeHeader = new PartimageHeader(); - IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(CVolumeHeader)); - Marshal.Copy(pHdr_b, 0, headerPtr, Marshal.SizeOf(CVolumeHeader)); - CVolumeHeader = (PartimageHeader)Marshal.PtrToStructure(headerPtr, typeof(PartimageHeader)); - Marshal.FreeHGlobal(headerPtr); - - return PartimageMagic.SequenceEqual(CVolumeHeader.magic); - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - if(stream.Length < 512) - return false; - - byte[] hdr_b = new byte[Marshal.SizeOf(CVolumeHeader)]; - stream.Read(hdr_b, 0, Marshal.SizeOf(CVolumeHeader)); - CVolumeHeader = new PartimageHeader(); - IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(CVolumeHeader)); - Marshal.Copy(hdr_b, 0, headerPtr, Marshal.SizeOf(CVolumeHeader)); - CVolumeHeader = (PartimageHeader)Marshal.PtrToStructure(headerPtr, typeof(PartimageHeader)); - Marshal.FreeHGlobal(headerPtr); - - DicConsole.DebugWriteLine("Partimage plugin", "CVolumeHeader.magic = {0}", StringHandlers.CToString(CVolumeHeader.magic)); - DicConsole.DebugWriteLine("Partimage plugin", "CVolumeHeader.version = {0}", StringHandlers.CToString(CVolumeHeader.version)); - DicConsole.DebugWriteLine("Partimage plugin", "CVolumeHeader.volumeNumber = {0}", CVolumeHeader.volumeNumber); - DicConsole.DebugWriteLine("Partimage plugin", "CVolumeHeader.identificator = {0:X16}", CVolumeHeader.identificator); - - // TODO: Support multifile volumes - if(CVolumeHeader.volumeNumber > 0) - throw new FeatureSupportedButNotImplementedImageException("Support for multiple volumes not supported"); - - hdr_b = new byte[Marshal.SizeOf(CMainHeader)]; - stream.Read(hdr_b, 0, Marshal.SizeOf(CMainHeader)); - CMainHeader = new PartimageMainHeader(); - headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(CMainHeader)); - Marshal.Copy(hdr_b, 0, headerPtr, Marshal.SizeOf(CMainHeader)); - CMainHeader = (PartimageMainHeader)Marshal.PtrToStructure(headerPtr, typeof(PartimageMainHeader)); - Marshal.FreeHGlobal(headerPtr); - - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szFileSystem = {0}", StringHandlers.CToString(CMainHeader.szFileSystem)); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szPartDescription = {0}", StringHandlers.CToString(CMainHeader.szPartDescription)); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szOriginalDevice = {0}", StringHandlers.CToString(CMainHeader.szOriginalDevice)); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szFirstImageFilepath = {0}", StringHandlers.CToString(CMainHeader.szFirstImageFilepath)); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szUnameSysname = {0}", StringHandlers.CToString(CMainHeader.szUnameSysname)); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szUnameNodename = {0}", StringHandlers.CToString(CMainHeader.szUnameNodename)); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szUnameRelease = {0}", StringHandlers.CToString(CMainHeader.szUnameRelease)); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szUnameVersion = {0}", StringHandlers.CToString(CMainHeader.szUnameVersion)); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szUnameMachine = {0}", StringHandlers.CToString(CMainHeader.szUnameMachine)); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwCompression = {0} ({1})", CMainHeader.dwCompression, (uint)CMainHeader.dwCompression); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwMainFlags = {0}", CMainHeader.dwMainFlags); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_sec = {0}", CMainHeader.dateCreate.tm_sec); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_min = {0}", CMainHeader.dateCreate.tm_min); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_hour = {0}", CMainHeader.dateCreate.tm_hour); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_mday = {0}", CMainHeader.dateCreate.tm_mday); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_mon = {0}", CMainHeader.dateCreate.tm_mon); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_year = {0}", CMainHeader.dateCreate.tm_year); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_wday = {0}", CMainHeader.dateCreate.tm_wday); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_yday = {0}", CMainHeader.dateCreate.tm_yday); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_isdst = {0}", CMainHeader.dateCreate.tm_isdst); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_gmtoffsec = {0}", CMainHeader.dateCreate.tm_gmtoff); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_zone = {0}", CMainHeader.dateCreate.tm_zone); - - DateTime dateCreate = new DateTime(1900 + (int)CMainHeader.dateCreate.tm_year, (int)CMainHeader.dateCreate.tm_mon + 1, - (int)CMainHeader.dateCreate.tm_mday, (int)CMainHeader.dateCreate.tm_hour, - (int)CMainHeader.dateCreate.tm_min, (int)CMainHeader.dateCreate.tm_sec); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate = {0}", dateCreate); - - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.qwPartSize = {0}", CMainHeader.qwPartSize); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szHostname = {0}", StringHandlers.CToString(CMainHeader.szHostname)); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szVersion = {0}", StringHandlers.CToString(CMainHeader.szVersion)); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwMbrCount = {0}", CMainHeader.dwMbrCount); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwMbrSize = {0}", CMainHeader.dwMbrSize); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwEncryptAlgo = {0} ({1})", CMainHeader.dwEncryptAlgo, (uint)CMainHeader.dwEncryptAlgo); - DicConsole.DebugWriteLine("Partimage plugin", "ArrayIsNullOrEmpty(CMainHeader.cHashTestKey) = {0}", ArrayHelpers.ArrayIsNullOrEmpty(CMainHeader.cHashTestKey)); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture000 = {0}", CMainHeader.dwReservedFuture000); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture001 = {0}", CMainHeader.dwReservedFuture001); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture002 = {0}", CMainHeader.dwReservedFuture002); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture003 = {0}", CMainHeader.dwReservedFuture003); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture004 = {0}", CMainHeader.dwReservedFuture004); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture005 = {0}", CMainHeader.dwReservedFuture005); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture006 = {0}", CMainHeader.dwReservedFuture006); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture007 = {0}", CMainHeader.dwReservedFuture007); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture008 = {0}", CMainHeader.dwReservedFuture008); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture009 = {0}", CMainHeader.dwReservedFuture009); - DicConsole.DebugWriteLine("Partimage plugin", "ArrayIsNullOrEmpty(CMainHeader.cReserved) = {0}", ArrayHelpers.ArrayIsNullOrEmpty(CMainHeader.cReserved)); - DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.crc = 0x{0:X8}", CMainHeader.crc); - - // partimage 0.6.1 does not support them either - if(CMainHeader.dwEncryptAlgo != pEncryption.None) - throw new ImageNotSupportedException("Encrypted images are currently not supported."); - - string magic; - - // Skip MBRs - if(CMainHeader.dwMbrCount > 0) - { - hdr_b = new byte[MAGIC_BEGIN_MBRBACKUP.Length]; - stream.Read(hdr_b, 0, MAGIC_BEGIN_MBRBACKUP.Length); - magic = StringHandlers.CToString(hdr_b); - if(!magic.Equals(MAGIC_BEGIN_MBRBACKUP)) - throw new ImageNotSupportedException("Cannot find MBRs"); - - stream.Seek(CMainHeader.dwMbrSize * CMainHeader.dwMbrCount, SeekOrigin.Current); - } - - // Skip extended headers and their CRC fields - stream.Seek((MAGIC_BEGIN_EXT000.Length + 4) * 10, SeekOrigin.Current); - - hdr_b = new byte[MAGIC_BEGIN_LOCALHEADER.Length]; - stream.Read(hdr_b, 0, MAGIC_BEGIN_LOCALHEADER.Length); - magic = StringHandlers.CToString(hdr_b); - if(!magic.Equals(MAGIC_BEGIN_LOCALHEADER)) - throw new ImageNotSupportedException("Cannot find local header"); - - hdr_b = new byte[Marshal.SizeOf(typeof(CLocalHeader))]; - stream.Read(hdr_b, 0, Marshal.SizeOf(typeof(CLocalHeader))); - headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CLocalHeader))); - Marshal.Copy(hdr_b, 0, headerPtr, Marshal.SizeOf(typeof(CLocalHeader))); - CLocalHeader localHeader = (CLocalHeader)Marshal.PtrToStructure(headerPtr, typeof(CLocalHeader)); - Marshal.FreeHGlobal(headerPtr); - - DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.qwBlockSize = {0}", localHeader.qwBlockSize); - DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.qwUsedBlocks = {0}", localHeader.qwUsedBlocks); - DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.qwBlocksCount = {0}", localHeader.qwBlocksCount); - DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.qwBitmapSize = {0}", localHeader.qwBitmapSize); - DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.qwBadBlocksCount = {0}", localHeader.qwBadBlocksCount); - DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.szLabel = {0}", StringHandlers.CToString(localHeader.szLabel)); - DicConsole.DebugWriteLine("Partimage plugin", "ArrayIsNullOrEmpty(CLocalHeader.cReserved) = {0}", ArrayHelpers.ArrayIsNullOrEmpty(localHeader.cReserved)); - DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.crc = 0x{0:X8}", localHeader.crc); - - hdr_b = new byte[MAGIC_BEGIN_BITMAP.Length]; - stream.Read(hdr_b, 0, MAGIC_BEGIN_BITMAP.Length); - magic = StringHandlers.CToString(hdr_b); - if(!magic.Equals(MAGIC_BEGIN_BITMAP)) - throw new ImageNotSupportedException("Cannot find bitmap"); - - bitmap = new byte[localHeader.qwBitmapSize]; - stream.Read(bitmap, 0, (int)localHeader.qwBitmapSize); - - hdr_b = new byte[MAGIC_BEGIN_INFO.Length]; - stream.Read(hdr_b, 0, MAGIC_BEGIN_INFO.Length); - magic = StringHandlers.CToString(hdr_b); - if(!magic.Equals(MAGIC_BEGIN_INFO)) - throw new ImageNotSupportedException("Cannot find info block"); - - // Skip info block and its checksum - stream.Seek(16384 + 4, SeekOrigin.Current); - - hdr_b = new byte[MAGIC_BEGIN_DATABLOCKS.Length]; - stream.Read(hdr_b, 0, MAGIC_BEGIN_DATABLOCKS.Length); - magic = StringHandlers.CToString(hdr_b); - if(!magic.Equals(MAGIC_BEGIN_DATABLOCKS)) - throw new ImageNotSupportedException("Cannot find data blocks"); - - dataOff = stream.Position; - - DicConsole.DebugWriteLine("Partimage plugin", "dataOff = {0}", dataOff); - - // Seek to tail - stream.Seek(-(Marshal.SizeOf(typeof(CMainTail)) + MAGIC_BEGIN_TAIL.Length), SeekOrigin.End); - - hdr_b = new byte[MAGIC_BEGIN_TAIL.Length]; - stream.Read(hdr_b, 0, MAGIC_BEGIN_TAIL.Length); - magic = StringHandlers.CToString(hdr_b); - if(!magic.Equals(MAGIC_BEGIN_TAIL)) - throw new ImageNotSupportedException("Cannot find tail. Multiple volumes are not supported or image is corrupt."); - - DicConsole.DebugWriteLine("Partimage plugin", "Filling extents"); - DateTime start = DateTime.Now; - extents = new ExtentsULong(); - extentsOff = new Dictionary<ulong, ulong>(); - bool current = (bitmap[0] & 1 << (int)(0 % 8)) != 0; - ulong blockOff = 0; - ulong extentStart = 0; - - for(ulong i = 1; i <= localHeader.qwBlocksCount; i++) - { - bool next = (bitmap[i / 8] & 1 << (int)(i % 8)) != 0; - - // Flux - if(next != current) - { - // Next is used - if(next) - { - extentStart = i; - extentsOff.Add(i, ++blockOff); - } - else - { - extents.Add(extentStart, i); - extentsOff.TryGetValue(extentStart, out ulong foo); - } - } - - if(next && current) - blockOff++; - - current = next; - } - DateTime end = DateTime.Now; - DicConsole.DebugWriteLine("Partimage plugin", "Took {0} seconds to fill extents", (end - start).TotalSeconds); - - sectorCache = new Dictionary<ulong, byte[]>(); - - ImageInfo.imageCreationTime = dateCreate; - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.sectors = localHeader.qwBlocksCount + 1; - ImageInfo.sectorSize = (uint)localHeader.qwBlockSize; - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.mediaType = MediaType.GENERIC_HDD; - ImageInfo.imageVersion = StringHandlers.CToString(CMainHeader.szVersion); - ImageInfo.imageComments = StringHandlers.CToString(CMainHeader.szPartDescription); - ImageInfo.imageSize = (ulong)(stream.Length - (dataOff + Marshal.SizeOf(typeof(CMainTail)) + MAGIC_BEGIN_TAIL.Length)); - imageStream = stream; - - return true; - } - - ulong BlockOffset(ulong sectorAddress) - { - extents.GetStart(sectorAddress, out ulong extentStart); - extentsOff.TryGetValue(extentStart, out ulong extentStartingOffset); - return extentStartingOffset + (sectorAddress - extentStart); - } - - public override byte[] ReadSector(ulong sectorAddress) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if((bitmap[sectorAddress / 8] & 1 << (int)(sectorAddress % 8)) == 0) - return new byte[ImageInfo.sectorSize]; - - byte[] sector; - - if(sectorCache.TryGetValue(sectorAddress, out sector)) - return sector; - - ulong blockOff = BlockOffset(sectorAddress); - - // Offset of requested sector is: - // Start of data + - long imageOff = dataOff + - // How many stored bytes to skip - (long)(blockOff * ImageInfo.sectorSize) + - // How many bytes of CRC blocks to skip - (long)(blockOff / (CHECK_FREQUENCY / ImageInfo.sectorSize)) * Marshal.SizeOf(typeof(CCheck)); - - sector = new byte[ImageInfo.sectorSize]; - imageStream.Seek(imageOff, SeekOrigin.Begin); - imageStream.Read(sector, 0, (int)ImageInfo.sectorSize); - - if(sectorCache.Count > maxCachedSectors) - { - System.Console.WriteLine("Cache cleared"); - sectorCache.Clear(); - } - - sectorCache.Add(sectorAddress, sector); - - return sector; - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - MemoryStream ms = new MemoryStream(); - - bool allEmpty = true; - for(uint i = 0; i < length; i++) - { - if((bitmap[sectorAddress / 8] & 1 << (int)(sectorAddress % 8)) != 0) - { - allEmpty = false; - break; - } - } - - if(allEmpty) - return new byte[ImageInfo.sectorSize * length]; - - for(uint i = 0; i < length; i++) - { - byte[] sector = ReadSector(sectorAddress + i); - ms.Write(sector, 0, sector.Length); - } - - return ms.ToArray(); - } - - public override bool ImageHasPartitions() - { - return false; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override string GetImageFormat() - { - return "Partimage"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - #region Unsupported features - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetMediaManufacturer() - { - return null; - } - - public override string GetMediaModel() - { - return null; - } - - public override string GetMediaSerialNumber() - { - return null; - } - - public override string GetMediaBarcode() - { - return null; - } - - public override string GetMediaPartNumber() - { - return null; - } - - public override int GetMediaSequence() - { - return 0; - } - - public override int GetLastDiskSequence() - { - return 0; - } - - public override string GetDriveManufacturer() - { - return null; - } - - public override string GetDriveModel() - { - return null; - } - - public override string GetDriveSerialNumber() - { - return null; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - // TODO: All blocks contain a CRC32 that's incompatible with current implementation. Need to check for compatibility. - public override bool? VerifyMediaImage() - { - return null; - } - - #endregion - } -} - + public class Partimage : ImagePlugin + { + #region Internal constants + readonly byte[] PartimageMagic = + { + 0x50, 0x61, 0x52, 0x74, 0x49, 0x6D, 0x41, 0x67, 0x45, 0x2D, 0x56, 0x6F, 0x4C, 0x75, 0x4D, 0x65, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + const int MAX_DESCRIPTION = 4096; + const int MAX_HOSTNAMESIZE = 128; + const int MAX_DEVICENAMELEN = 512; + const int MAX_UNAMEINFOLEN = 65; //SYS_NMLN + const int MBR_SIZE_WHOLE = 512; + const int MAX_DESC_MODEL = 128; + const int MAX_DESC_GEOMETRY = 1024; + const int MAX_DESC_IDENTIFY = 4096; + const int CHECK_FREQUENCY = 65536; + readonly string MAGIC_BEGIN_LOCALHEADER = "MAGIC-BEGIN-LOCALHEADER"; + readonly string MAGIC_BEGIN_DATABLOCKS = "MAGIC-BEGIN-DATABLOCKS"; + readonly string MAGIC_BEGIN_BITMAP = "MAGIC-BEGIN-BITMAP"; + readonly string MAGIC_BEGIN_MBRBACKUP = "MAGIC-BEGIN-MBRBACKUP"; + readonly string MAGIC_BEGIN_TAIL = "MAGIC-BEGIN-TAIL"; + readonly string MAGIC_BEGIN_INFO = "MAGIC-BEGIN-INFO"; + readonly string MAGIC_BEGIN_EXT000 = "MAGIC-BEGIN-EXT000"; // reserved for future use + readonly string MAGIC_BEGIN_EXT001 = "MAGIC-BEGIN-EXT001"; // reserved for future use + readonly string MAGIC_BEGIN_EXT002 = "MAGIC-BEGIN-EXT002"; // reserved for future use + readonly string MAGIC_BEGIN_EXT003 = "MAGIC-BEGIN-EXT003"; // reserved for future use + readonly string MAGIC_BEGIN_EXT004 = "MAGIC-BEGIN-EXT004"; // reserved for future use + readonly string MAGIC_BEGIN_EXT005 = "MAGIC-BEGIN-EXT005"; // reserved for future use + readonly string MAGIC_BEGIN_EXT006 = "MAGIC-BEGIN-EXT006"; // reserved for future use + readonly string MAGIC_BEGIN_EXT007 = "MAGIC-BEGIN-EXT007"; // reserved for future use + readonly string MAGIC_BEGIN_EXT008 = "MAGIC-BEGIN-EXT008"; // reserved for future use + readonly string MAGIC_BEGIN_EXT009 = "MAGIC-BEGIN-EXT009"; // reserved for future use + readonly string MAGIC_BEGIN_VOLUME = "PaRtImAgE-VoLuMe"; + #endregion + + #region Internal Structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + /// <summary> + /// Partimage disk image header, little-endian + /// </summary> + struct PartimageHeader + { + /// <summary> + /// Magic, <see cref="PartimageMagic"/> + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] magic; + /// <summary> + /// Source filesystem + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] version; + /// <summary> + /// Volume number + /// </summary> + public uint volumeNumber; + /// <summary> + /// Image identifier + /// </summary> + public ulong identificator; + /// <summary> + /// Empty space + /// </summary> + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 404)] public byte[] reserved; + } + + struct portable_tm + { + public uint tm_sec; + public uint tm_min; + public uint tm_hour; + public uint tm_mday; + public uint tm_mon; + public uint tm_year; + public uint tm_wday; + public uint tm_yday; + public uint tm_isdst; + + public uint tm_gmtoff; + public uint tm_zone; + }; + + enum pCompression : uint + { + None = 0, + Gzip = 1, + Bzip2 = 2, + Lzo = 3 + } + + enum pEncryption : uint + { + None = 0, + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + /// <summary> + /// Partimage CMainHeader + /// </summary> + struct PartimageMainHeader + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] + public byte[] szFileSystem; // ext2fs, ntfs, reiserfs, ... + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DESCRIPTION)] + public byte[] szPartDescription; // user description of the partition + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DEVICENAMELEN)] + public byte[] szOriginalDevice; // original partition name + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4095)] + public byte[] szFirstImageFilepath; //MAXPATHLEN]; // for splitted image files + + // system and hardware infos + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_UNAMEINFOLEN)] public byte[] szUnameSysname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_UNAMEINFOLEN)] public byte[] szUnameNodename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_UNAMEINFOLEN)] public byte[] szUnameRelease; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_UNAMEINFOLEN)] public byte[] szUnameVersion; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_UNAMEINFOLEN)] public byte[] szUnameMachine; + + public pCompression dwCompression; // COMPRESS_XXXXXX + public uint dwMainFlags; + public portable_tm dateCreate; // date of image creation + public ulong qwPartSize; // size of the partition in bytes + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_HOSTNAMESIZE)] public byte[] szHostname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] szVersion; // version of the image file + + // MBR backup + public uint dwMbrCount; // how many MBR are saved in the image file + public uint dwMbrSize; // size of a MBR record (allow to change the size in the next versions) + + // future encryption support + public pEncryption dwEncryptAlgo; // algo used to encrypt data + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] cHashTestKey; // used to test the password without giving it + + // reserved for future use (save DiskLabel, Extended partitions, ...) + public uint dwReservedFuture000; + public uint dwReservedFuture001; + public uint dwReservedFuture002; + public uint dwReservedFuture003; + public uint dwReservedFuture004; + public uint dwReservedFuture005; + public uint dwReservedFuture006; + public uint dwReservedFuture007; + public uint dwReservedFuture008; + public uint dwReservedFuture009; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6524)] + public byte[] cReserved; // Adjust to fit with total header size + + public uint crc; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CMbr // must be 1024 + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MBR_SIZE_WHOLE)] public byte[] cData; + public uint dwDataCRC; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DEVICENAMELEN)] public byte[] szDevice; // ex: "hda" + + // disk identificators + ulong qwBlocksCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DESC_MODEL)] public byte[] szDescModel; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 884)] public byte[] cReserved; // for future use + + //public byte[] szDescGeometry[MAX_DESC_GEOMETRY]; + //public byte[] szDescIdentify[MAX_DESC_IDENTIFY]; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CCheck + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] byte[] cMagic; // must be 'C','H','K' + public uint dwCRC; // CRC of the CHECK_FREQUENCY blocks + public ulong qwPos; // number of the last block written + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CLocalHeader // size must be 16384 (adjust the reserved data) + { + public ulong qwBlockSize; + public ulong qwUsedBlocks; + public ulong qwBlocksCount; + public ulong qwBitmapSize; // bytes in the bitmap + public ulong qwBadBlocksCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] szLabel; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16280)] + public byte[] cReserved; // Adjust to fit with total header size + + public uint crc; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CMainTail // size must be 16384 (adjust the reserved data) + { + public ulong qwCRC; + public uint dwVolumeNumber; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16372)] + public byte[] cReserved; // Adjust to fit with total header size + } + #endregion + + PartimageHeader CVolumeHeader; + PartimageMainHeader CMainHeader; + byte[] bitmap; + Stream imageStream; + long dataOff; + + Dictionary<ulong, byte[]> sectorCache; + + const uint MaxCacheSize = 16777216; + uint maxCachedSectors = MaxCacheSize / 512; + + ExtentsULong extents; + Dictionary<ulong, ulong> extentsOff; + + public Partimage() + { + Name = "Partimage disk image"; + PluginUUID = new Guid("AAFDB99D-2B77-49EA-831C-C9BB58C68C95"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = false; + ImageInfo.imageHasSessions = false; + ImageInfo.imageApplication = "Partimage"; + ImageInfo.imageApplicationVersion = null; + ImageInfo.imageCreator = null; + ImageInfo.imageComments = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaSerialNumber = null; + ImageInfo.mediaBarcode = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + if(stream.Length < 512) return false; + + byte[] pHdr_b = new byte[Marshal.SizeOf(CVolumeHeader)]; + stream.Read(pHdr_b, 0, Marshal.SizeOf(CVolumeHeader)); + CVolumeHeader = new PartimageHeader(); + IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(CVolumeHeader)); + Marshal.Copy(pHdr_b, 0, headerPtr, Marshal.SizeOf(CVolumeHeader)); + CVolumeHeader = (PartimageHeader)Marshal.PtrToStructure(headerPtr, typeof(PartimageHeader)); + Marshal.FreeHGlobal(headerPtr); + + return PartimageMagic.SequenceEqual(CVolumeHeader.magic); + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + if(stream.Length < 512) return false; + + byte[] hdr_b = new byte[Marshal.SizeOf(CVolumeHeader)]; + stream.Read(hdr_b, 0, Marshal.SizeOf(CVolumeHeader)); + CVolumeHeader = new PartimageHeader(); + IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(CVolumeHeader)); + Marshal.Copy(hdr_b, 0, headerPtr, Marshal.SizeOf(CVolumeHeader)); + CVolumeHeader = (PartimageHeader)Marshal.PtrToStructure(headerPtr, typeof(PartimageHeader)); + Marshal.FreeHGlobal(headerPtr); + + DicConsole.DebugWriteLine("Partimage plugin", "CVolumeHeader.magic = {0}", + StringHandlers.CToString(CVolumeHeader.magic)); + DicConsole.DebugWriteLine("Partimage plugin", "CVolumeHeader.version = {0}", + StringHandlers.CToString(CVolumeHeader.version)); + DicConsole.DebugWriteLine("Partimage plugin", "CVolumeHeader.volumeNumber = {0}", + CVolumeHeader.volumeNumber); + DicConsole.DebugWriteLine("Partimage plugin", "CVolumeHeader.identificator = {0:X16}", + CVolumeHeader.identificator); + + // TODO: Support multifile volumes + if(CVolumeHeader.volumeNumber > 0) + throw new FeatureSupportedButNotImplementedImageException("Support for multiple volumes not supported"); + + hdr_b = new byte[Marshal.SizeOf(CMainHeader)]; + stream.Read(hdr_b, 0, Marshal.SizeOf(CMainHeader)); + CMainHeader = new PartimageMainHeader(); + headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(CMainHeader)); + Marshal.Copy(hdr_b, 0, headerPtr, Marshal.SizeOf(CMainHeader)); + CMainHeader = (PartimageMainHeader)Marshal.PtrToStructure(headerPtr, typeof(PartimageMainHeader)); + Marshal.FreeHGlobal(headerPtr); + + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szFileSystem = {0}", + StringHandlers.CToString(CMainHeader.szFileSystem)); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szPartDescription = {0}", + StringHandlers.CToString(CMainHeader.szPartDescription)); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szOriginalDevice = {0}", + StringHandlers.CToString(CMainHeader.szOriginalDevice)); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szFirstImageFilepath = {0}", + StringHandlers.CToString(CMainHeader.szFirstImageFilepath)); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szUnameSysname = {0}", + StringHandlers.CToString(CMainHeader.szUnameSysname)); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szUnameNodename = {0}", + StringHandlers.CToString(CMainHeader.szUnameNodename)); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szUnameRelease = {0}", + StringHandlers.CToString(CMainHeader.szUnameRelease)); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szUnameVersion = {0}", + StringHandlers.CToString(CMainHeader.szUnameVersion)); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szUnameMachine = {0}", + StringHandlers.CToString(CMainHeader.szUnameMachine)); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwCompression = {0} ({1})", + CMainHeader.dwCompression, (uint)CMainHeader.dwCompression); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwMainFlags = {0}", CMainHeader.dwMainFlags); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_sec = {0}", + CMainHeader.dateCreate.tm_sec); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_min = {0}", + CMainHeader.dateCreate.tm_min); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_hour = {0}", + CMainHeader.dateCreate.tm_hour); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_mday = {0}", + CMainHeader.dateCreate.tm_mday); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_mon = {0}", + CMainHeader.dateCreate.tm_mon); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_year = {0}", + CMainHeader.dateCreate.tm_year); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_wday = {0}", + CMainHeader.dateCreate.tm_wday); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_yday = {0}", + CMainHeader.dateCreate.tm_yday); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_isdst = {0}", + CMainHeader.dateCreate.tm_isdst); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_gmtoffsec = {0}", + CMainHeader.dateCreate.tm_gmtoff); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate.tm_zone = {0}", + CMainHeader.dateCreate.tm_zone); + + DateTime dateCreate = new DateTime(1900 + (int)CMainHeader.dateCreate.tm_year, + (int)CMainHeader.dateCreate.tm_mon + 1, + (int)CMainHeader.dateCreate.tm_mday, (int)CMainHeader.dateCreate.tm_hour, + (int)CMainHeader.dateCreate.tm_min, (int)CMainHeader.dateCreate.tm_sec); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dateCreate = {0}", dateCreate); + + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.qwPartSize = {0}", CMainHeader.qwPartSize); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szHostname = {0}", + StringHandlers.CToString(CMainHeader.szHostname)); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.szVersion = {0}", + StringHandlers.CToString(CMainHeader.szVersion)); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwMbrCount = {0}", CMainHeader.dwMbrCount); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwMbrSize = {0}", CMainHeader.dwMbrSize); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwEncryptAlgo = {0} ({1})", + CMainHeader.dwEncryptAlgo, (uint)CMainHeader.dwEncryptAlgo); + DicConsole.DebugWriteLine("Partimage plugin", "ArrayIsNullOrEmpty(CMainHeader.cHashTestKey) = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(CMainHeader.cHashTestKey)); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture000 = {0}", + CMainHeader.dwReservedFuture000); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture001 = {0}", + CMainHeader.dwReservedFuture001); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture002 = {0}", + CMainHeader.dwReservedFuture002); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture003 = {0}", + CMainHeader.dwReservedFuture003); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture004 = {0}", + CMainHeader.dwReservedFuture004); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture005 = {0}", + CMainHeader.dwReservedFuture005); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture006 = {0}", + CMainHeader.dwReservedFuture006); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture007 = {0}", + CMainHeader.dwReservedFuture007); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture008 = {0}", + CMainHeader.dwReservedFuture008); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.dwReservedFuture009 = {0}", + CMainHeader.dwReservedFuture009); + DicConsole.DebugWriteLine("Partimage plugin", "ArrayIsNullOrEmpty(CMainHeader.cReserved) = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(CMainHeader.cReserved)); + DicConsole.DebugWriteLine("Partimage plugin", "CMainHeader.crc = 0x{0:X8}", CMainHeader.crc); + + // partimage 0.6.1 does not support them either + if(CMainHeader.dwEncryptAlgo != pEncryption.None) + throw new ImageNotSupportedException("Encrypted images are currently not supported."); + + string magic; + + // Skip MBRs + if(CMainHeader.dwMbrCount > 0) + { + hdr_b = new byte[MAGIC_BEGIN_MBRBACKUP.Length]; + stream.Read(hdr_b, 0, MAGIC_BEGIN_MBRBACKUP.Length); + magic = StringHandlers.CToString(hdr_b); + if(!magic.Equals(MAGIC_BEGIN_MBRBACKUP)) throw new ImageNotSupportedException("Cannot find MBRs"); + + stream.Seek(CMainHeader.dwMbrSize * CMainHeader.dwMbrCount, SeekOrigin.Current); + } + + // Skip extended headers and their CRC fields + stream.Seek((MAGIC_BEGIN_EXT000.Length + 4) * 10, SeekOrigin.Current); + + hdr_b = new byte[MAGIC_BEGIN_LOCALHEADER.Length]; + stream.Read(hdr_b, 0, MAGIC_BEGIN_LOCALHEADER.Length); + magic = StringHandlers.CToString(hdr_b); + if(!magic.Equals(MAGIC_BEGIN_LOCALHEADER)) throw new ImageNotSupportedException("Cannot find local header"); + + hdr_b = new byte[Marshal.SizeOf(typeof(CLocalHeader))]; + stream.Read(hdr_b, 0, Marshal.SizeOf(typeof(CLocalHeader))); + headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CLocalHeader))); + Marshal.Copy(hdr_b, 0, headerPtr, Marshal.SizeOf(typeof(CLocalHeader))); + CLocalHeader localHeader = (CLocalHeader)Marshal.PtrToStructure(headerPtr, typeof(CLocalHeader)); + Marshal.FreeHGlobal(headerPtr); + + DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.qwBlockSize = {0}", localHeader.qwBlockSize); + DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.qwUsedBlocks = {0}", localHeader.qwUsedBlocks); + DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.qwBlocksCount = {0}", + localHeader.qwBlocksCount); + DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.qwBitmapSize = {0}", localHeader.qwBitmapSize); + DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.qwBadBlocksCount = {0}", + localHeader.qwBadBlocksCount); + DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.szLabel = {0}", + StringHandlers.CToString(localHeader.szLabel)); + DicConsole.DebugWriteLine("Partimage plugin", "ArrayIsNullOrEmpty(CLocalHeader.cReserved) = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(localHeader.cReserved)); + DicConsole.DebugWriteLine("Partimage plugin", "CLocalHeader.crc = 0x{0:X8}", localHeader.crc); + + hdr_b = new byte[MAGIC_BEGIN_BITMAP.Length]; + stream.Read(hdr_b, 0, MAGIC_BEGIN_BITMAP.Length); + magic = StringHandlers.CToString(hdr_b); + if(!magic.Equals(MAGIC_BEGIN_BITMAP)) throw new ImageNotSupportedException("Cannot find bitmap"); + + bitmap = new byte[localHeader.qwBitmapSize]; + stream.Read(bitmap, 0, (int)localHeader.qwBitmapSize); + + hdr_b = new byte[MAGIC_BEGIN_INFO.Length]; + stream.Read(hdr_b, 0, MAGIC_BEGIN_INFO.Length); + magic = StringHandlers.CToString(hdr_b); + if(!magic.Equals(MAGIC_BEGIN_INFO)) throw new ImageNotSupportedException("Cannot find info block"); + + // Skip info block and its checksum + stream.Seek(16384 + 4, SeekOrigin.Current); + + hdr_b = new byte[MAGIC_BEGIN_DATABLOCKS.Length]; + stream.Read(hdr_b, 0, MAGIC_BEGIN_DATABLOCKS.Length); + magic = StringHandlers.CToString(hdr_b); + if(!magic.Equals(MAGIC_BEGIN_DATABLOCKS)) throw new ImageNotSupportedException("Cannot find data blocks"); + + dataOff = stream.Position; + + DicConsole.DebugWriteLine("Partimage plugin", "dataOff = {0}", dataOff); + + // Seek to tail + stream.Seek(-(Marshal.SizeOf(typeof(CMainTail)) + MAGIC_BEGIN_TAIL.Length), SeekOrigin.End); + + hdr_b = new byte[MAGIC_BEGIN_TAIL.Length]; + stream.Read(hdr_b, 0, MAGIC_BEGIN_TAIL.Length); + magic = StringHandlers.CToString(hdr_b); + if(!magic.Equals(MAGIC_BEGIN_TAIL)) + throw new + ImageNotSupportedException("Cannot find tail. Multiple volumes are not supported or image is corrupt."); + + DicConsole.DebugWriteLine("Partimage plugin", "Filling extents"); + DateTime start = DateTime.Now; + extents = new ExtentsULong(); + extentsOff = new Dictionary<ulong, ulong>(); + bool current = (bitmap[0] & 1 << (int)(0 % 8)) != 0; + ulong blockOff = 0; + ulong extentStart = 0; + + for(ulong i = 1; i <= localHeader.qwBlocksCount; i++) + { + bool next = (bitmap[i / 8] & 1 << (int)(i % 8)) != 0; + + // Flux + if(next != current) + { + // Next is used + if(next) + { + extentStart = i; + extentsOff.Add(i, ++blockOff); + } + else + { + extents.Add(extentStart, i); + extentsOff.TryGetValue(extentStart, out ulong foo); + } + } + + if(next && current) blockOff++; + + current = next; + } + + DateTime end = DateTime.Now; + DicConsole.DebugWriteLine("Partimage plugin", "Took {0} seconds to fill extents", + (end - start).TotalSeconds); + + sectorCache = new Dictionary<ulong, byte[]>(); + + ImageInfo.imageCreationTime = dateCreate; + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.sectors = localHeader.qwBlocksCount + 1; + ImageInfo.sectorSize = (uint)localHeader.qwBlockSize; + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.mediaType = MediaType.GENERIC_HDD; + ImageInfo.imageVersion = StringHandlers.CToString(CMainHeader.szVersion); + ImageInfo.imageComments = StringHandlers.CToString(CMainHeader.szPartDescription); + ImageInfo.imageSize = + (ulong)(stream.Length - (dataOff + Marshal.SizeOf(typeof(CMainTail)) + MAGIC_BEGIN_TAIL.Length)); + imageStream = stream; + + return true; + } + + ulong BlockOffset(ulong sectorAddress) + { + extents.GetStart(sectorAddress, out ulong extentStart); + extentsOff.TryGetValue(extentStart, out ulong extentStartingOffset); + return extentStartingOffset + (sectorAddress - extentStart); + } + + public override byte[] ReadSector(ulong sectorAddress) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if((bitmap[sectorAddress / 8] & 1 << (int)(sectorAddress % 8)) == 0) return new byte[ImageInfo.sectorSize]; + + byte[] sector; + + if(sectorCache.TryGetValue(sectorAddress, out sector)) return sector; + + ulong blockOff = BlockOffset(sectorAddress); + + // Offset of requested sector is: + // Start of data + + long imageOff = dataOff + + // How many stored bytes to skip + (long)(blockOff * ImageInfo.sectorSize) + + // How many bytes of CRC blocks to skip + (long)(blockOff / (CHECK_FREQUENCY / ImageInfo.sectorSize)) * + Marshal.SizeOf(typeof(CCheck)); + + sector = new byte[ImageInfo.sectorSize]; + imageStream.Seek(imageOff, SeekOrigin.Begin); + imageStream.Read(sector, 0, (int)ImageInfo.sectorSize); + + if(sectorCache.Count > maxCachedSectors) + { + System.Console.WriteLine("Cache cleared"); + sectorCache.Clear(); + } + + sectorCache.Add(sectorAddress, sector); + + return sector; + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + MemoryStream ms = new MemoryStream(); + + bool allEmpty = true; + for(uint i = 0; i < length; i++) + { + if((bitmap[sectorAddress / 8] & 1 << (int)(sectorAddress % 8)) != 0) + { + allEmpty = false; + break; + } + } + + if(allEmpty) return new byte[ImageInfo.sectorSize * length]; + + for(uint i = 0; i < length; i++) + { + byte[] sector = ReadSector(sectorAddress + i); + ms.Write(sector, 0, sector.Length); + } + + return ms.ToArray(); + } + + public override bool ImageHasPartitions() + { + return false; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override string GetImageFormat() + { + return "Partimage"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + #region Unsupported features + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetMediaManufacturer() + { + return null; + } + + public override string GetMediaModel() + { + return null; + } + + public override string GetMediaSerialNumber() + { + return null; + } + + public override string GetMediaBarcode() + { + return null; + } + + public override string GetMediaPartNumber() + { + return null; + } + + public override int GetMediaSequence() + { + return 0; + } + + public override int GetLastDiskSequence() + { + return 0; + } + + public override string GetDriveManufacturer() + { + return null; + } + + public override string GetDriveModel() + { + return null; + } + + public override string GetDriveSerialNumber() + { + return null; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + // TODO: All blocks contain a CRC32 that's incompatible with current implementation. Need to check for compatibility. + public override bool? VerifyMediaImage() + { + return null; + } + #endregion + } +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/Properties/AssemblyInfo.cs b/DiscImageChef.DiscImages/Properties/AssemblyInfo.cs index a7b1be4f..0421f81f 100644 --- a/DiscImageChef.DiscImages/Properties/AssemblyInfo.cs +++ b/DiscImageChef.DiscImages/Properties/AssemblyInfo.cs @@ -54,5 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.DiscImages/QCOW.cs b/DiscImageChef.DiscImages/QCOW.cs index 451922a1..bce42026 100644 --- a/DiscImageChef.DiscImages/QCOW.cs +++ b/DiscImageChef.DiscImages/QCOW.cs @@ -42,7 +42,7 @@ using SharpCompress.Compressors.Deflate; namespace DiscImageChef.ImagePlugins { - public class QCOW : ImagePlugin + public class QCOW : ImagePlugin { #region Internal constants /// <summary> @@ -165,8 +165,7 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] qHdr_b = new byte[48]; stream.Read(qHdr_b, 0, 48); @@ -180,8 +179,7 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] qHdr_b = new byte[48]; stream.Read(qHdr_b, 0, 48); @@ -199,14 +197,15 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("QCOW plugin", "qHdr.crypt_method = {0}", qHdr.crypt_method); DicConsole.DebugWriteLine("QCOW plugin", "qHdr.l1_table_offset = {0}", qHdr.l1_table_offset); - if(qHdr.size <= 1) - throw new ArgumentOutOfRangeException(nameof(qHdr.size), "Image size is too small"); + if(qHdr.size <= 1) throw new ArgumentOutOfRangeException(nameof(qHdr.size), "Image size is too small"); if(qHdr.cluster_bits < 9 || qHdr.cluster_bits > 16) - throw new ArgumentOutOfRangeException(nameof(qHdr.cluster_bits), "Cluster size must be between 512 bytes and 64 Kbytes"); + throw new ArgumentOutOfRangeException(nameof(qHdr.cluster_bits), + "Cluster size must be between 512 bytes and 64 Kbytes"); if(qHdr.l2_bits < 9 - 3 || qHdr.l2_bits > 16 - 3) - throw new ArgumentOutOfRangeException(nameof(qHdr.l2_bits), "L2 size must be between 512 bytes and 64 Kbytes"); + throw new ArgumentOutOfRangeException(nameof(qHdr.l2_bits), + "L2 size must be between 512 bytes and 64 Kbytes"); if(qHdr.crypt_method > QCowEncryptionAES) throw new ArgumentOutOfRangeException(nameof(qHdr.crypt_method), "Invalid encryption method"); @@ -259,13 +258,12 @@ namespace DiscImageChef.ImagePlugins } l2Mask = 0; - for(int i = 0; i < qHdr.l2_bits; i++) - l2Mask = (l2Mask << 1) + 1; + for(int i = 0; i < qHdr.l2_bits; i++) l2Mask = (l2Mask << 1) + 1; + l2Mask <<= qHdr.cluster_bits; sectorMask = 0; - for(int i = 0; i < qHdr.cluster_bits; i++) - sectorMask = (sectorMask << 1) + 1; + for(int i = 0; i < qHdr.cluster_bits; i++) sectorMask = (sectorMask << 1) + 1; DicConsole.DebugWriteLine("QCOW plugin", "qHdr.l1Mask = {0:X}", l1Mask); DicConsole.DebugWriteLine("QCOW plugin", "qHdr.l1Shift = {0}", l1Shift); @@ -282,10 +280,8 @@ namespace DiscImageChef.ImagePlugins clusterCache = new Dictionary<ulong, byte[]>(); ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - if(qHdr.mtime > 0) - ImageInfo.imageLastModificationTime = DateHandlers.UNIXUnsignedToDateTime(qHdr.mtime); - else - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + if(qHdr.mtime > 0) ImageInfo.imageLastModificationTime = DateHandlers.UNIXUnsignedToDateTime(qHdr.mtime); + else ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); ImageInfo.sectors = qHdr.size / 512; ImageInfo.sectorSize = 512; @@ -293,34 +289,36 @@ namespace DiscImageChef.ImagePlugins ImageInfo.mediaType = MediaType.GENERIC_HDD; ImageInfo.imageSize = qHdr.size; - ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); - ImageInfo.heads = 16; - ImageInfo.sectorsPerTrack = 63; + ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); + ImageInfo.heads = 16; + ImageInfo.sectorsPerTrack = 63; - return true; + return true; } public override byte[] ReadSector(ulong sectorAddress) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); byte[] sector; // Check cache - if(sectorCache.TryGetValue(sectorAddress, out sector)) - return sector; + if(sectorCache.TryGetValue(sectorAddress, out sector)) return sector; ulong byteAddress = sectorAddress * 512; ulong l1Off = (byteAddress & l1Mask) >> l1Shift; if((long)l1Off >= l1Table.LongLength) - throw new ArgumentOutOfRangeException(nameof(l1Off), string.Format("Trying to read past L1 table, position {0} of a max {1}", l1Off, l1Table.LongLength)); + throw new ArgumentOutOfRangeException(nameof(l1Off), + string + .Format("Trying to read past L1 table, position {0} of a max {1}", + l1Off, l1Table.LongLength)); // TODO: Implement differential images - if(l1Table[l1Off] == 0) - return new byte[512]; + if(l1Table[l1Off] == 0) return new byte[512]; ulong[] l2Table; @@ -334,8 +332,7 @@ namespace DiscImageChef.ImagePlugins for(long i = 0; i < l2Table.LongLength; i++) l2Table[i] = BigEndianBitConverter.ToUInt64(l2Table_b, (int)(i * 8)); - if(l2TableCache.Count >= maxL2TableCache) - l2TableCache.Clear(); + if(l2TableCache.Count >= maxL2TableCache) l2TableCache.Clear(); l2TableCache.Add(l1Off, l2Table); } @@ -351,47 +348,48 @@ namespace DiscImageChef.ImagePlugins byte[] cluster; if(!clusterCache.TryGetValue(offset, out cluster)) { - if((offset & QCowCompressed) == QCowCompressed) - { - ulong compSizeMask = 0; - ulong offMask = 0; + if((offset & QCowCompressed) == QCowCompressed) + { + ulong compSizeMask = 0; + ulong offMask = 0; - compSizeMask = (ulong)(1 << qHdr.cluster_bits) - 1; - compSizeMask <<= 63 - qHdr.cluster_bits; - offMask = (~compSizeMask) ^ QCowCompressed; + compSizeMask = (ulong)(1 << qHdr.cluster_bits) - 1; + compSizeMask <<= 63 - qHdr.cluster_bits; + offMask = (~compSizeMask) ^ QCowCompressed; - ulong realOff = offset & offMask; - ulong compSize = (offset & compSizeMask) >> (63 - qHdr.cluster_bits); + ulong realOff = offset & offMask; + ulong compSize = (offset & compSizeMask) >> (63 - qHdr.cluster_bits); - byte[] zCluster = new byte[compSize]; - imageStream.Seek((long)realOff, SeekOrigin.Begin); - imageStream.Read(zCluster, 0, (int)compSize); + byte[] zCluster = new byte[compSize]; + imageStream.Seek((long)realOff, SeekOrigin.Begin); + imageStream.Read(zCluster, 0, (int)compSize); - DeflateStream zStream = new DeflateStream(new MemoryStream(zCluster), CompressionMode.Decompress); - cluster = new byte[clusterSize]; - int read = zStream.Read(cluster, 0, clusterSize); + DeflateStream zStream = + new DeflateStream(new MemoryStream(zCluster), CompressionMode.Decompress); + cluster = new byte[clusterSize]; + int read = zStream.Read(cluster, 0, clusterSize); - if(read != clusterSize) - throw new IOException(string.Format("Unable to decompress cluster, expected {0} bytes got {1}", clusterSize, read)); - } - else - { - cluster = new byte[clusterSize]; - imageStream.Seek((long)offset, SeekOrigin.Begin); - imageStream.Read(cluster, 0, clusterSize); - } + if(read != clusterSize) + throw new + IOException(string.Format("Unable to decompress cluster, expected {0} bytes got {1}", + clusterSize, read)); + } + else + { + cluster = new byte[clusterSize]; + imageStream.Seek((long)offset, SeekOrigin.Begin); + imageStream.Read(cluster, 0, clusterSize); + } - if(clusterCache.Count >= maxClusterCache) - clusterCache.Clear(); + if(clusterCache.Count >= maxClusterCache) clusterCache.Clear(); - clusterCache.Add(offset, cluster); - } + clusterCache.Add(offset, cluster); + } Array.Copy(cluster, (int)(byteAddress & sectorMask), sector, 0, 512); } - if(sectorCache.Count >= maxCachedSectors) - sectorCache.Clear(); + if(sectorCache.Count >= maxCachedSectors) sectorCache.Clear(); sectorCache.Add(sectorAddress, sector); @@ -401,7 +399,8 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectors(ulong sectorAddress, uint length) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); if(sectorAddress + length > ImageInfo.sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); @@ -488,7 +487,6 @@ namespace DiscImageChef.ImagePlugins } #region Unsupported features - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -629,16 +627,18 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -647,8 +647,6 @@ namespace DiscImageChef.ImagePlugins { return null; } - #endregion } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/QCOW2.cs b/DiscImageChef.DiscImages/QCOW2.cs index 01dba433..d16a5dc4 100644 --- a/DiscImageChef.DiscImages/QCOW2.cs +++ b/DiscImageChef.DiscImages/QCOW2.cs @@ -42,7 +42,7 @@ using SharpCompress.Compressors.Deflate; namespace DiscImageChef.ImagePlugins { - public class QCOW2 : ImagePlugin + public class QCOW2 : ImagePlugin { #region Internal constants /// <summary> @@ -195,8 +195,7 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] qHdr_b = new byte[Marshal.SizeOf(qHdr)]; stream.Read(qHdr_b, 0, Marshal.SizeOf(qHdr)); @@ -213,8 +212,7 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] qHdr_b = new byte[Marshal.SizeOf(qHdr)]; stream.Read(qHdr_b, 0, Marshal.SizeOf(qHdr)); @@ -230,7 +228,8 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("QCOW plugin", "qHdr.l1_size = {0}", qHdr.l1_size); DicConsole.DebugWriteLine("QCOW plugin", "qHdr.l1_table_offset = {0}", qHdr.l1_table_offset); DicConsole.DebugWriteLine("QCOW plugin", "qHdr.refcount_table_offset = {0}", qHdr.refcount_table_offset); - DicConsole.DebugWriteLine("QCOW plugin", "qHdr.refcount_table_clusters = {0}", qHdr.refcount_table_clusters); + DicConsole.DebugWriteLine("QCOW plugin", "qHdr.refcount_table_clusters = {0}", + qHdr.refcount_table_clusters); DicConsole.DebugWriteLine("QCOW plugin", "qHdr.nb_snapshots = {0}", qHdr.nb_snapshots); DicConsole.DebugWriteLine("QCOW plugin", "qHdr.snapshots_offset = {0}", qHdr.snapshots_offset); @@ -243,14 +242,16 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("QCOW plugin", "qHdr.header_length = {0}", qHdr.header_length); if((qHdr.features & QcowFeatureMask) != 0) - throw new ImageNotSupportedException(string.Format("Unknown incompatible features {0:X} enabled, not proceeding.", qHdr.features & QcowFeatureMask)); + throw new + ImageNotSupportedException(string.Format("Unknown incompatible features {0:X} enabled, not proceeding.", + qHdr.features & QcowFeatureMask)); } - if(qHdr.size <= 1) - throw new ArgumentOutOfRangeException(nameof(qHdr.size), "Image size is too small"); + if(qHdr.size <= 1) throw new ArgumentOutOfRangeException(nameof(qHdr.size), "Image size is too small"); if(qHdr.cluster_bits < 9 || qHdr.cluster_bits > 16) - throw new ArgumentOutOfRangeException(nameof(qHdr.cluster_bits), "Cluster size must be between 512 bytes and 64 Kbytes"); + throw new ArgumentOutOfRangeException(nameof(qHdr.cluster_bits), + "Cluster size must be between 512 bytes and 64 Kbytes"); if(qHdr.crypt_method > QCowEncryptionAES) throw new ArgumentOutOfRangeException(nameof(qHdr.crypt_method), "Invalid encryption method"); @@ -283,7 +284,7 @@ namespace DiscImageChef.ImagePlugins stream.Seek((long)qHdr.l1_table_offset, SeekOrigin.Begin); stream.Read(l1Table_b, 0, (int)qHdr.l1_size * 8); l1Table = new ulong[qHdr.l1_size]; - // TODO: Optimize this + // TODO: Optimize this DicConsole.DebugWriteLine("QCOW plugin", "Reading L1 table"); for(long i = 0; i < l1Table.LongLength; i++) l1Table[i] = BigEndianBitConverter.ToUInt64(l1Table_b, (int)(i * 8)); @@ -304,13 +305,12 @@ namespace DiscImageChef.ImagePlugins } l2Mask = 0; - for(int i = 0; i < l2Bits; i++) - l2Mask = (l2Mask << 1) + 1; + for(int i = 0; i < l2Bits; i++) l2Mask = (l2Mask << 1) + 1; + l2Mask <<= (int)qHdr.cluster_bits; sectorMask = 0; - for(int i = 0; i < qHdr.cluster_bits; i++) - sectorMask = (sectorMask << 1) + 1; + for(int i = 0; i < qHdr.cluster_bits; i++) sectorMask = (sectorMask << 1) + 1; DicConsole.DebugWriteLine("QCOW plugin", "qHdr.l1Mask = {0:X}", l1Mask); DicConsole.DebugWriteLine("QCOW plugin", "qHdr.l1Shift = {0}", l1Shift); @@ -336,34 +336,36 @@ namespace DiscImageChef.ImagePlugins ImageInfo.imageSize = qHdr.size; ImageInfo.imageVersion = string.Format("{0}", qHdr.version); - ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); - ImageInfo.heads = 16; - ImageInfo.sectorsPerTrack = 63; + ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); + ImageInfo.heads = 16; + ImageInfo.sectorsPerTrack = 63; - return true; + return true; } public override byte[] ReadSector(ulong sectorAddress) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); byte[] sector; // Check cache - if(sectorCache.TryGetValue(sectorAddress, out sector)) - return sector; + if(sectorCache.TryGetValue(sectorAddress, out sector)) return sector; ulong byteAddress = sectorAddress * 512; ulong l1Off = (byteAddress & l1Mask) >> l1Shift; if((long)l1Off >= l1Table.LongLength) - throw new ArgumentOutOfRangeException(nameof(l1Off), string.Format("Trying to read past L1 table, position {0} of a max {1}", l1Off, l1Table.LongLength)); + throw new ArgumentOutOfRangeException(nameof(l1Off), + string + .Format("Trying to read past L1 table, position {0} of a max {1}", + l1Off, l1Table.LongLength)); // TODO: Implement differential images - if(l1Table[l1Off] == 0) - return new byte[512]; + if(l1Table[l1Off] == 0) return new byte[512]; ulong[] l2Table; @@ -377,8 +379,7 @@ namespace DiscImageChef.ImagePlugins for(long i = 0; i < l2Table.LongLength; i++) l2Table[i] = BigEndianBitConverter.ToUInt64(l2Table_b, (int)(i * 8)); - if(l2TableCache.Count >= maxL2TableCache) - l2TableCache.Clear(); + if(l2TableCache.Count >= maxL2TableCache) l2TableCache.Clear(); l2TableCache.Add(l1Off, l2Table); } @@ -391,52 +392,52 @@ namespace DiscImageChef.ImagePlugins if((offset & QCowFlagsMask) != 0) { - byte[] cluster; - if(!clusterCache.TryGetValue(offset, out cluster)) - { + byte[] cluster; + if(!clusterCache.TryGetValue(offset, out cluster)) + { + if((offset & QCowCompressed) == QCowCompressed) + { + ulong compSizeMask = 0; + ulong offMask = 0; - if((offset & QCowCompressed) == QCowCompressed) - { - ulong compSizeMask = 0; - ulong offMask = 0; + compSizeMask = (ulong)(1 << (int)(qHdr.cluster_bits - 8)) - 1; + byte countbits = (byte)(qHdr.cluster_bits - 8); + compSizeMask <<= (62 - countbits); + offMask = (~compSizeMask) & QCowFlagsMask; - compSizeMask = (ulong)(1 << (int)(qHdr.cluster_bits - 8)) - 1; - byte countbits = (byte)(qHdr.cluster_bits - 8); - compSizeMask <<= (62 - countbits); - offMask = (~compSizeMask) & QCowFlagsMask; + ulong realOff = offset & offMask; + ulong compSize = (((offset & compSizeMask) >> (62 - countbits)) + 1) * 512; - ulong realOff = offset & offMask; - ulong compSize = (((offset & compSizeMask) >> (62 - countbits)) + 1) * 512; + byte[] zCluster = new byte[compSize]; + imageStream.Seek((long)realOff, SeekOrigin.Begin); + imageStream.Read(zCluster, 0, (int)compSize); - byte[] zCluster = new byte[compSize]; - imageStream.Seek((long)realOff, SeekOrigin.Begin); - imageStream.Read(zCluster, 0, (int)compSize); + DeflateStream zStream = + new DeflateStream(new MemoryStream(zCluster), CompressionMode.Decompress); + cluster = new byte[clusterSize]; + int read = zStream.Read(cluster, 0, clusterSize); - DeflateStream zStream = new DeflateStream(new MemoryStream(zCluster), CompressionMode.Decompress); - cluster = new byte[clusterSize]; - int read = zStream.Read(cluster, 0, clusterSize); + if(read != clusterSize) + throw new + IOException(string.Format("Unable to decompress cluster, expected {0} bytes got {1}", + clusterSize, read)); + } + else + { + cluster = new byte[clusterSize]; + imageStream.Seek((long)(offset & QCowFlagsMask), SeekOrigin.Begin); + imageStream.Read(cluster, 0, clusterSize); + } - if(read != clusterSize) - throw new IOException(string.Format("Unable to decompress cluster, expected {0} bytes got {1}", clusterSize, read)); - } - else - { - cluster = new byte[clusterSize]; - imageStream.Seek((long)(offset & QCowFlagsMask), SeekOrigin.Begin); - imageStream.Read(cluster, 0, clusterSize); - } + if(clusterCache.Count >= maxClusterCache) clusterCache.Clear(); - if(clusterCache.Count >= maxClusterCache) - clusterCache.Clear(); - - clusterCache.Add(offset, cluster); - } + clusterCache.Add(offset, cluster); + } Array.Copy(cluster, (int)(byteAddress & sectorMask), sector, 0, 512); } - if(sectorCache.Count >= maxCachedSectors) - sectorCache.Clear(); + if(sectorCache.Count >= maxCachedSectors) sectorCache.Clear(); sectorCache.Add(sectorAddress, sector); @@ -446,7 +447,8 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectors(ulong sectorAddress, uint length) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); if(sectorAddress + length > ImageInfo.sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); @@ -533,7 +535,6 @@ namespace DiscImageChef.ImagePlugins } #region Unsupported features - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -674,16 +675,18 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -692,8 +695,6 @@ namespace DiscImageChef.ImagePlugins { return null; } - #endregion } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/QED.cs b/DiscImageChef.DiscImages/QED.cs index 5dbf3706..105f957b 100644 --- a/DiscImageChef.DiscImages/QED.cs +++ b/DiscImageChef.DiscImages/QED.cs @@ -40,7 +40,7 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class QED : ImagePlugin + public class QED : ImagePlugin { #region Internal constants /// <summary> @@ -176,8 +176,7 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] qHdr_b = new byte[64]; stream.Read(qHdr_b, 0, 64); @@ -195,8 +194,7 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] qHdr_b = new byte[64]; stream.Read(qHdr_b, 0, 64); @@ -225,16 +223,20 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentOutOfRangeException(nameof(qHdr.cluster_size), "Cluster size must be a power of 2"); if(qHdr.cluster_size < 4096 || qHdr.cluster_size > 67108864) - throw new ArgumentOutOfRangeException(nameof(qHdr.cluster_size), "Cluster size must be between 4 Kbytes and 64 Mbytes"); + throw new ArgumentOutOfRangeException(nameof(qHdr.cluster_size), + "Cluster size must be between 4 Kbytes and 64 Mbytes"); if(!IsPowerOfTwo(qHdr.table_size)) throw new ArgumentOutOfRangeException(nameof(qHdr.table_size), "Table size must be a power of 2"); if(qHdr.table_size < 1 || qHdr.table_size > 16) - throw new ArgumentOutOfRangeException(nameof(qHdr.table_size), "Table size must be between 1 and 16 clusters"); + throw new ArgumentOutOfRangeException(nameof(qHdr.table_size), + "Table size must be between 1 and 16 clusters"); if((qHdr.features & QedFeatureMask) > 0) - throw new ArgumentOutOfRangeException(nameof(qHdr.features), string.Format("Image uses unknown incompatible features {0:X}", qHdr.features & QedFeatureMask)); + throw new ArgumentOutOfRangeException(nameof(qHdr.features), + string.Format("Image uses unknown incompatible features {0:X}", + qHdr.features & QedFeatureMask)); if((qHdr.features & QedFeature_BackingFile) == QedFeature_BackingFile) throw new NotImplementedException("Differencing images not yet supported"); @@ -250,14 +252,13 @@ namespace DiscImageChef.ImagePlugins stream.Read(l1Table_b, 0, (int)tableSize * 8); l1Table = new ulong[tableSize]; DicConsole.DebugWriteLine("QED plugin", "Reading L1 table"); - for(long i = 0; i < l1Table.LongLength; i++) - l1Table[i] = BitConverter.ToUInt64(l1Table_b, (int)(i * 8)); + for(long i = 0; i < l1Table.LongLength; i++) l1Table[i] = BitConverter.ToUInt64(l1Table_b, (int)(i * 8)); l1Mask = 0; int c = 0; clusterBits = ctz32(qHdr.cluster_size); - l2Mask = (tableSize - 1) << clusterBits; - l1Shift = clusterBits + ctz32(tableSize); + l2Mask = (tableSize - 1) << clusterBits; + l1Shift = clusterBits + ctz32(tableSize); for(int i = 0; i < 64; i++) { @@ -270,10 +271,8 @@ namespace DiscImageChef.ImagePlugins } } - sectorMask = 0; - for(int i = 0; i < clusterBits; i++) - sectorMask = (sectorMask << 1) + 1; + for(int i = 0; i < clusterBits; i++) sectorMask = (sectorMask << 1) + 1; DicConsole.DebugWriteLine("QED plugin", "qHdr.clusterBits = {0}", clusterBits); DicConsole.DebugWriteLine("QED plugin", "qHdr.l1Mask = {0:X}", l1Mask); @@ -299,34 +298,36 @@ namespace DiscImageChef.ImagePlugins ImageInfo.mediaType = MediaType.GENERIC_HDD; ImageInfo.imageSize = qHdr.image_size; - ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); - ImageInfo.heads = 16; - ImageInfo.sectorsPerTrack = 63; + ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); + ImageInfo.heads = 16; + ImageInfo.sectorsPerTrack = 63; - return true; + return true; } public override byte[] ReadSector(ulong sectorAddress) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); byte[] sector; // Check cache - if(sectorCache.TryGetValue(sectorAddress, out sector)) - return sector; + if(sectorCache.TryGetValue(sectorAddress, out sector)) return sector; ulong byteAddress = sectorAddress * 512; ulong l1Off = (byteAddress & l1Mask) >> l1Shift; if((long)l1Off >= l1Table.LongLength) - throw new ArgumentOutOfRangeException(nameof(l1Off), string.Format("Trying to read past L1 table, position {0} of a max {1}", l1Off, l1Table.LongLength)); + throw new ArgumentOutOfRangeException(nameof(l1Off), + string + .Format("Trying to read past L1 table, position {0} of a max {1}", + l1Off, l1Table.LongLength)); // TODO: Implement differential images - if(l1Table[l1Off] == 0) - return new byte[512]; + if(l1Table[l1Off] == 0) return new byte[512]; ulong[] l2Table; @@ -337,18 +338,17 @@ namespace DiscImageChef.ImagePlugins byte[] l2Table_b = new byte[tableSize * 8]; imageStream.Read(l2Table_b, 0, (int)tableSize * 8); DicConsole.DebugWriteLine("QED plugin", "Reading L2 table #{0}", l1Off); - for(long i = 0; i < l2Table.LongLength; i++) - l2Table[i] = BitConverter.ToUInt64(l2Table_b, (int)(i * 8)); + for(long i = 0; i < l2Table.LongLength; i++) + l2Table[i] = BitConverter.ToUInt64(l2Table_b, (int)(i * 8)); - if(l2TableCache.Count >= maxL2TableCache) - l2TableCache.Clear(); + if(l2TableCache.Count >= maxL2TableCache) l2TableCache.Clear(); l2TableCache.Add(l1Off, l2Table); } ulong l2Off = (byteAddress & l2Mask) >> clusterBits; - ulong offset = l2Table[l2Off]; + ulong offset = l2Table[l2Off]; sector = new byte[512]; @@ -361,8 +361,7 @@ namespace DiscImageChef.ImagePlugins imageStream.Seek((long)offset, SeekOrigin.Begin); imageStream.Read(cluster, 0, (int)qHdr.cluster_size); - if(clusterCache.Count >= maxClusterCache) - clusterCache.Clear(); + if(clusterCache.Count >= maxClusterCache) clusterCache.Clear(); clusterCache.Add(offset, cluster); } @@ -370,8 +369,7 @@ namespace DiscImageChef.ImagePlugins Array.Copy(cluster, (int)(byteAddress & sectorMask), sector, 0, 512); } - if(sectorCache.Count >= maxCachedSectors) - sectorCache.Clear(); + if(sectorCache.Count >= maxCachedSectors) sectorCache.Clear(); sectorCache.Add(sectorAddress, sector); @@ -381,7 +379,8 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectors(ulong sectorAddress, uint length) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); if(sectorAddress + length > ImageInfo.sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); @@ -469,8 +468,8 @@ namespace DiscImageChef.ImagePlugins bool IsPowerOfTwo(uint x) { - while(((x & 1) == 0) && x > 1) - x >>= 1; + while(((x & 1) == 0) && x > 1) x >>= 1; + return (x == 1); } @@ -502,16 +501,12 @@ namespace DiscImageChef.ImagePlugins cnt++; val >>= 1; } - if((val & 0x1) == 0) - { - cnt++; - } + if((val & 0x1) == 0) { cnt++; } return cnt; } #region Unsupported features - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -652,16 +647,18 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -670,8 +667,6 @@ namespace DiscImageChef.ImagePlugins { return null; } - #endregion } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/RayDIM.cs b/DiscImageChef.DiscImages/RayDIM.cs index 9d31df82..1f5954b8 100644 --- a/DiscImageChef.DiscImages/RayDIM.cs +++ b/DiscImageChef.DiscImages/RayDIM.cs @@ -41,463 +41,453 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class RayDIM : ImagePlugin - { - #region Internal Structures - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct RayHdr - { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] - public byte[] signature; - public RayDiskTypes diskType; - public byte cylinders; - public byte sectorsPerTrack; - public byte heads; - } - - enum RayDiskTypes : byte - { - Md2dd = 1, - Md2hd = 2, - Mf2dd = 3, - Mf2hd = 4, - Mf2ed = 5 - } - #endregion - - readonly string DimSignatureRegEx = "Disk IMage VER (?<major>\\d).(?<minor>\\d) Copyright \\(C\\) (?<year>\\d{4}) Ray Arachelian, All Rights Reserved\\."; - - #region Internal variables - - MemoryStream disk; - - #endregion - - public RayDIM() - { - Name = "Ray Arachelian's Disk IMage"; - PluginUUID = new Guid("F541F4E7-C1E3-4A2D-B07F-D863E87AB961"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = false; - ImageInfo.imageHasSessions = false; - ImageInfo.imageApplication = "Ray Arachelian's Disk IMage"; - ImageInfo.imageCreator = null; - ImageInfo.imageComments = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaSerialNumber = null; - ImageInfo.mediaBarcode = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - - if(stream.Length < Marshal.SizeOf(typeof(RayHdr))) - return false; - - byte[] buffer = new byte[Marshal.SizeOf(typeof(RayHdr))]; - stream.Seek(0, SeekOrigin.Begin); - stream.Read(buffer, 0, buffer.Length); - - RayHdr header = new RayHdr(); - IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length); - Marshal.Copy(buffer, 0, ftrPtr, buffer.Length); - header = (RayHdr)Marshal.PtrToStructure(ftrPtr, typeof(RayHdr)); - Marshal.FreeHGlobal(ftrPtr); - - string signature = StringHandlers.CToString(header.signature); - - DicConsole.DebugWriteLine("Ray Arachelian's Disk IMage plugin", "header.signature = {0}", signature); - DicConsole.DebugWriteLine("Ray Arachelian's Disk IMage plugin", "header.diskType = {0}", header.diskType); - DicConsole.DebugWriteLine("Ray Arachelian's Disk IMage plugin", "header.heads = {0}", header.heads); - DicConsole.DebugWriteLine("Ray Arachelian's Disk IMage plugin", "header.cylinders = {0}", header.cylinders); - DicConsole.DebugWriteLine("Ray Arachelian's Disk IMage plugin", "header.sectorsPerTrack = {0}", header.sectorsPerTrack); - - Regex sx = new Regex(DimSignatureRegEx); - Match sm = sx.Match(signature); - - DicConsole.DebugWriteLine("Ray Arachelian's Disk IMage plugin", "header.signature matches? = {0}", sm.Success); - - return sm.Success; - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - - if(stream.Length < Marshal.SizeOf(typeof(RayHdr))) - return false; - - byte[] buffer = new byte[Marshal.SizeOf(typeof(RayHdr))]; - stream.Seek(0, SeekOrigin.Begin); - stream.Read(buffer, 0, buffer.Length); - - RayHdr header = new RayHdr(); - IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length); - Marshal.Copy(buffer, 0, ftrPtr, buffer.Length); - header = (RayHdr)Marshal.PtrToStructure(ftrPtr, typeof(RayHdr)); - Marshal.FreeHGlobal(ftrPtr); - - string signature = StringHandlers.CToString(header.signature); - - Regex sx = new Regex(DimSignatureRegEx); - Match sm = sx.Match(signature); - - if(!sm.Success) - return false; - - ImageInfo.imageApplicationVersion = string.Format("{0}.{1}", sm.Groups["major"].Value, sm.Groups["minor"].Value); - - ImageInfo.cylinders = (uint)(header.cylinders + 1); - ImageInfo.heads = (uint)(header.heads + 1); - ImageInfo.sectorsPerTrack = header.sectorsPerTrack; - ImageInfo.sectors = ImageInfo.cylinders * ImageInfo.heads * ImageInfo.sectorsPerTrack; - ImageInfo.sectorSize = 512; - - byte[] sectors = new byte[ImageInfo.sectorsPerTrack * ImageInfo.sectorSize]; - disk = new MemoryStream(); - - for(int i = 0; i < ImageInfo.sectorsPerTrack * ImageInfo.sectorSize; i++) - { - stream.Read(sectors, 0, sectors.Length); - stream.Seek(ImageInfo.sectorsPerTrack, SeekOrigin.Current); - disk.Write(sectors, 0, sectors.Length); - } - - switch(header.diskType) - { - case RayDiskTypes.Md2hd: - if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15) - ImageInfo.mediaType = MediaType.DOS_525_HD; - else - goto case RayDiskTypes.Md2dd; - break; - case RayDiskTypes.Md2dd: - if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8) - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9) - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8) - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9) - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; - else - ImageInfo.mediaType = MediaType.Unknown; - break; - case RayDiskTypes.Mf2ed: - if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 36) - ImageInfo.mediaType = MediaType.DOS_35_ED; - else - goto case RayDiskTypes.Mf2hd; - break; - case RayDiskTypes.Mf2hd: - if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 18) - ImageInfo.mediaType = MediaType.DOS_35_HD; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 21) - ImageInfo.mediaType = MediaType.DMF; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 82 && ImageInfo.sectorsPerTrack == 21) - ImageInfo.mediaType = MediaType.DMF_82; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15) - ImageInfo.mediaType = MediaType.NEC_35_HD_15; - else - goto case RayDiskTypes.Mf2dd; - break; - case RayDiskTypes.Mf2dd: - if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9) - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; - else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8) - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9) - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8) - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; - else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 70 && ImageInfo.sectorsPerTrack == 9) - ImageInfo.mediaType = MediaType.Apricot_35; - else - ImageInfo.mediaType = MediaType.Unknown; - break; - default: - ImageInfo.mediaType = MediaType.Unknown; - break; - } - - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - - return true; - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifyMediaImage() - { - return null; - } - - public override bool ImageHasPartitions() - { - return ImageInfo.imageHasPartitions; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] buffer = new byte[length * ImageInfo.sectorSize]; - - disk.Seek((long)(sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); - disk.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); - - return buffer; - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetImageFormat() - { - return "Ray Arachelian's Disk IMage"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override string GetMediaManufacturer() - { - return ImageInfo.mediaManufacturer; - } - - public override string GetMediaModel() - { - return ImageInfo.mediaModel; - } - - public override string GetMediaSerialNumber() - { - return ImageInfo.mediaSerialNumber; - } - - public override string GetMediaBarcode() - { - return ImageInfo.mediaBarcode; - } - - public override string GetMediaPartNumber() - { - return ImageInfo.mediaPartNumber; - } - - public override int GetMediaSequence() - { - return ImageInfo.mediaSequence; - } - - public override int GetLastDiskSequence() - { - return ImageInfo.lastMediaSequence; - } - - public override string GetDriveManufacturer() - { - return ImageInfo.driveManufacturer; - } - - public override string GetDriveModel() - { - return ImageInfo.driveModel; - } - - public override string GetDriveSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - #endregion Unsupported features - } -} - + public class RayDIM : ImagePlugin + { + #region Internal Structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct RayHdr + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] public byte[] signature; + public RayDiskTypes diskType; + public byte cylinders; + public byte sectorsPerTrack; + public byte heads; + } + + enum RayDiskTypes : byte + { + Md2dd = 1, + Md2hd = 2, + Mf2dd = 3, + Mf2hd = 4, + Mf2ed = 5 + } + #endregion + + readonly string DimSignatureRegEx = + "Disk IMage VER (?<major>\\d).(?<minor>\\d) Copyright \\(C\\) (?<year>\\d{4}) Ray Arachelian, All Rights Reserved\\." + ; + + #region Internal variables + MemoryStream disk; + #endregion + + public RayDIM() + { + Name = "Ray Arachelian's Disk IMage"; + PluginUUID = new Guid("F541F4E7-C1E3-4A2D-B07F-D863E87AB961"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = false; + ImageInfo.imageHasSessions = false; + ImageInfo.imageApplication = "Ray Arachelian's Disk IMage"; + ImageInfo.imageCreator = null; + ImageInfo.imageComments = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaSerialNumber = null; + ImageInfo.mediaBarcode = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + + if(stream.Length < Marshal.SizeOf(typeof(RayHdr))) return false; + + byte[] buffer = new byte[Marshal.SizeOf(typeof(RayHdr))]; + stream.Seek(0, SeekOrigin.Begin); + stream.Read(buffer, 0, buffer.Length); + + RayHdr header = new RayHdr(); + IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length); + Marshal.Copy(buffer, 0, ftrPtr, buffer.Length); + header = (RayHdr)Marshal.PtrToStructure(ftrPtr, typeof(RayHdr)); + Marshal.FreeHGlobal(ftrPtr); + + string signature = StringHandlers.CToString(header.signature); + + DicConsole.DebugWriteLine("Ray Arachelian's Disk IMage plugin", "header.signature = {0}", signature); + DicConsole.DebugWriteLine("Ray Arachelian's Disk IMage plugin", "header.diskType = {0}", header.diskType); + DicConsole.DebugWriteLine("Ray Arachelian's Disk IMage plugin", "header.heads = {0}", header.heads); + DicConsole.DebugWriteLine("Ray Arachelian's Disk IMage plugin", "header.cylinders = {0}", header.cylinders); + DicConsole.DebugWriteLine("Ray Arachelian's Disk IMage plugin", "header.sectorsPerTrack = {0}", + header.sectorsPerTrack); + + Regex sx = new Regex(DimSignatureRegEx); + Match sm = sx.Match(signature); + + DicConsole.DebugWriteLine("Ray Arachelian's Disk IMage plugin", "header.signature matches? = {0}", + sm.Success); + + return sm.Success; + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + + if(stream.Length < Marshal.SizeOf(typeof(RayHdr))) return false; + + byte[] buffer = new byte[Marshal.SizeOf(typeof(RayHdr))]; + stream.Seek(0, SeekOrigin.Begin); + stream.Read(buffer, 0, buffer.Length); + + RayHdr header = new RayHdr(); + IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length); + Marshal.Copy(buffer, 0, ftrPtr, buffer.Length); + header = (RayHdr)Marshal.PtrToStructure(ftrPtr, typeof(RayHdr)); + Marshal.FreeHGlobal(ftrPtr); + + string signature = StringHandlers.CToString(header.signature); + + Regex sx = new Regex(DimSignatureRegEx); + Match sm = sx.Match(signature); + + if(!sm.Success) return false; + + ImageInfo.imageApplicationVersion = + string.Format("{0}.{1}", sm.Groups["major"].Value, sm.Groups["minor"].Value); + + ImageInfo.cylinders = (uint)(header.cylinders + 1); + ImageInfo.heads = (uint)(header.heads + 1); + ImageInfo.sectorsPerTrack = header.sectorsPerTrack; + ImageInfo.sectors = ImageInfo.cylinders * ImageInfo.heads * ImageInfo.sectorsPerTrack; + ImageInfo.sectorSize = 512; + + byte[] sectors = new byte[ImageInfo.sectorsPerTrack * ImageInfo.sectorSize]; + disk = new MemoryStream(); + + for(int i = 0; i < ImageInfo.sectorsPerTrack * ImageInfo.sectorSize; i++) + { + stream.Read(sectors, 0, sectors.Length); + stream.Seek(ImageInfo.sectorsPerTrack, SeekOrigin.Current); + disk.Write(sectors, 0, sectors.Length); + } + + switch(header.diskType) + { + case RayDiskTypes.Md2hd: + if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15) + ImageInfo.mediaType = MediaType.DOS_525_HD; + else goto case RayDiskTypes.Md2dd; + break; + case RayDiskTypes.Md2dd: + if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8) + ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9) + ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 8) + ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 40 && ImageInfo.sectorsPerTrack == 9) + ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; + else ImageInfo.mediaType = MediaType.Unknown; + break; + case RayDiskTypes.Mf2ed: + if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 36) + ImageInfo.mediaType = MediaType.DOS_35_ED; + else goto case RayDiskTypes.Mf2hd; + break; + case RayDiskTypes.Mf2hd: + if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 18) + ImageInfo.mediaType = MediaType.DOS_35_HD; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 21) + ImageInfo.mediaType = MediaType.DMF; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 82 && ImageInfo.sectorsPerTrack == 21) + ImageInfo.mediaType = MediaType.DMF_82; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 15) + ImageInfo.mediaType = MediaType.NEC_35_HD_15; + else goto case RayDiskTypes.Mf2dd; + break; + case RayDiskTypes.Mf2dd: + if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9) + ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; + else if(ImageInfo.heads == 2 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8) + ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 9) + ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 80 && ImageInfo.sectorsPerTrack == 8) + ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; + else if(ImageInfo.heads == 1 && ImageInfo.cylinders == 70 && ImageInfo.sectorsPerTrack == 9) + ImageInfo.mediaType = MediaType.Apricot_35; + else ImageInfo.mediaType = MediaType.Unknown; + break; + default: + ImageInfo.mediaType = MediaType.Unknown; + break; + } + + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + + return true; + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifyMediaImage() + { + return null; + } + + public override bool ImageHasPartitions() + { + return ImageInfo.imageHasPartitions; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] buffer = new byte[length * ImageInfo.sectorSize]; + + disk.Seek((long)(sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); + disk.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); + + return buffer; + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetImageFormat() + { + return "Ray Arachelian's Disk IMage"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override string GetMediaManufacturer() + { + return ImageInfo.mediaManufacturer; + } + + public override string GetMediaModel() + { + return ImageInfo.mediaModel; + } + + public override string GetMediaSerialNumber() + { + return ImageInfo.mediaSerialNumber; + } + + public override string GetMediaBarcode() + { + return ImageInfo.mediaBarcode; + } + + public override string GetMediaPartNumber() + { + return ImageInfo.mediaPartNumber; + } + + public override int GetMediaSequence() + { + return ImageInfo.mediaSequence; + } + + public override int GetLastDiskSequence() + { + return ImageInfo.lastMediaSequence; + } + + public override string GetDriveManufacturer() + { + return ImageInfo.driveManufacturer; + } + + public override string GetDriveModel() + { + return ImageInfo.driveModel; + } + + public override string GetDriveSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + #endregion Unsupported features + } +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/RsIde.cs b/DiscImageChef.DiscImages/RsIde.cs index 5e03a1b2..6fb8b449 100644 --- a/DiscImageChef.DiscImages/RsIde.cs +++ b/DiscImageChef.DiscImages/RsIde.cs @@ -41,395 +41,391 @@ using static DiscImageChef.Decoders.ATA.Identify; namespace DiscImageChef.ImagePlugins { - public class RsIde : ImagePlugin - { - public RsIde() - { - Name = "RS-IDE Hard Disk Image"; - PluginUUID = new Guid("47C3E78D-2BE2-4BA5-AA6B-FEE27C86FC65"); - ImageInfo = new ImageInfo() - { - readableSectorTags = new List<SectorTagType>(), - readableMediaTags = new List<MediaTagType>(), - imageHasPartitions = false, - imageHasSessions = false, - imageVersion = null, - imageApplication = null, - imageApplicationVersion = null, - imageCreator = null, - imageComments = null, - mediaManufacturer = null, - mediaModel = null, - mediaSerialNumber = null, - mediaBarcode = null, - mediaPartNumber = null, - mediaSequence = 0, - lastMediaSequence = 0, - driveManufacturer = null, - driveModel = null, - driveSerialNumber = null, - driveFirmwareRevision = null - }; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct RsIdeHeader - { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] - public byte[] magic; - public byte revision; - public RsIdeFlags flags; - public ushort dataOff; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] reserved; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 106)] - public byte[] identify; - } - - [Flags] - enum RsIdeFlags : byte - { - HalfSectors = 1 - } - - Filter RsIdeImageFilter; - ushort dataOff; - readonly byte[] signature = { 0x52, 0x53, 0x2D, 0x49, 0x44, 0x45, 0x1A }; - byte[] identify; - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - byte[] magic = new byte[7]; - stream.Read(magic, 0, magic.Length); - - return magic.SequenceEqual(signature); - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - byte[] hdr_b = new byte[Marshal.SizeOf(typeof(RsIdeHeader))]; - stream.Read(hdr_b, 0, hdr_b.Length); - - IntPtr hdrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(RsIdeHeader))); - Marshal.Copy(hdr_b, 0, hdrPtr, Marshal.SizeOf(typeof(RsIdeHeader))); - RsIdeHeader hdr = (RsIdeHeader)Marshal.PtrToStructure(hdrPtr, typeof(RsIdeHeader)); - Marshal.FreeHGlobal(hdrPtr); - - if(!hdr.magic.SequenceEqual(signature)) - return false; - - dataOff = hdr.dataOff; - - ImageInfo.mediaType = MediaType.GENERIC_HDD; - ImageInfo.sectorSize = (uint)(hdr.flags.HasFlag(RsIdeFlags.HalfSectors) ? 256 : 512); - ImageInfo.imageSize = (ulong)(stream.Length - dataOff); - ImageInfo.sectors = ImageInfo.imageSize / ImageInfo.sectorSize; - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.imageVersion = string.Format("{0}.{1}", hdr.revision >> 8, hdr.revision & 0x0F); - - if(!ArrayHelpers.ArrayIsNullOrEmpty(hdr.identify)) - { - identify = new byte[512]; - Array.Copy(hdr.identify, 0, identify, 0, hdr.identify.Length); - IdentifyDevice? ataId = Decode(identify); - - if(ataId.HasValue) - { - ImageInfo.readableMediaTags.Add(MediaTagType.ATA_IDENTIFY); - ImageInfo.cylinders = ataId.Value.Cylinders; - ImageInfo.heads = ataId.Value.Heads; - ImageInfo.sectorsPerTrack = ataId.Value.SectorsPerCard; - ImageInfo.driveFirmwareRevision = ataId.Value.FirmwareRevision; - ImageInfo.driveModel = ataId.Value.Model; - ImageInfo.driveSerialNumber = ataId.Value.SerialNumber; - ImageInfo.mediaSerialNumber = ataId.Value.MediaSerial; - ImageInfo.mediaManufacturer = ataId.Value.MediaManufacturer; - } - } - - if(ImageInfo.cylinders == 0 || ImageInfo.heads == 0 || ImageInfo.sectorsPerTrack == 0) - { - ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); - ImageInfo.heads = 16; - ImageInfo.sectorsPerTrack = 63; - } - - RsIdeImageFilter = imageFilter; - - return true; - } - - public override bool ImageHasPartitions() - { - return false; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override string GetImageFormat() - { - return "RS-IDE disk image"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] buffer = new byte[length * ImageInfo.sectorSize]; - - Stream stream = RsIdeImageFilter.GetDataForkStream(); - - stream.Seek((long)(dataOff + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); - - stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); - - return buffer; - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - if(ImageInfo.readableMediaTags.Contains(tag) && tag == MediaTagType.ATA_IDENTIFY) - { - byte[] buffer = new byte[512]; - Array.Copy(identify, 0, buffer, 0, 512); - return buffer; - } - - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetMediaManufacturer() - { - return ImageInfo.mediaManufacturer; - } - - public override string GetMediaModel() - { - return null; - } - - public override string GetMediaSerialNumber() - { - return ImageInfo.mediaSerialNumber; - } - - public override string GetMediaBarcode() - { - return null; - } - - public override string GetMediaPartNumber() - { - return null; - } - - public override int GetMediaSequence() - { - return 0; - } - - public override int GetLastDiskSequence() - { - return 0; - } - - public override string GetDriveManufacturer() - { - return ImageInfo.driveManufacturer; - } - - public override string GetDriveModel() - { - return ImageInfo.driveModel; - } - - public override string GetDriveSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifyMediaImage() - { - return null; - } - - #endregion - } + public class RsIde : ImagePlugin + { + public RsIde() + { + Name = "RS-IDE Hard Disk Image"; + PluginUUID = new Guid("47C3E78D-2BE2-4BA5-AA6B-FEE27C86FC65"); + ImageInfo = new ImageInfo() + { + readableSectorTags = new List<SectorTagType>(), + readableMediaTags = new List<MediaTagType>(), + imageHasPartitions = false, + imageHasSessions = false, + imageVersion = null, + imageApplication = null, + imageApplicationVersion = null, + imageCreator = null, + imageComments = null, + mediaManufacturer = null, + mediaModel = null, + mediaSerialNumber = null, + mediaBarcode = null, + mediaPartNumber = null, + mediaSequence = 0, + lastMediaSequence = 0, + driveManufacturer = null, + driveModel = null, + driveSerialNumber = null, + driveFirmwareRevision = null + }; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct RsIdeHeader + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public byte[] magic; + public byte revision; + public RsIdeFlags flags; + public ushort dataOff; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 106)] public byte[] identify; + } + + [Flags] + enum RsIdeFlags : byte + { + HalfSectors = 1 + } + + Filter RsIdeImageFilter; + ushort dataOff; + readonly byte[] signature = {0x52, 0x53, 0x2D, 0x49, 0x44, 0x45, 0x1A}; + byte[] identify; + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + byte[] magic = new byte[7]; + stream.Read(magic, 0, magic.Length); + + return magic.SequenceEqual(signature); + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + byte[] hdr_b = new byte[Marshal.SizeOf(typeof(RsIdeHeader))]; + stream.Read(hdr_b, 0, hdr_b.Length); + + IntPtr hdrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(RsIdeHeader))); + Marshal.Copy(hdr_b, 0, hdrPtr, Marshal.SizeOf(typeof(RsIdeHeader))); + RsIdeHeader hdr = (RsIdeHeader)Marshal.PtrToStructure(hdrPtr, typeof(RsIdeHeader)); + Marshal.FreeHGlobal(hdrPtr); + + if(!hdr.magic.SequenceEqual(signature)) return false; + + dataOff = hdr.dataOff; + + ImageInfo.mediaType = MediaType.GENERIC_HDD; + ImageInfo.sectorSize = (uint)(hdr.flags.HasFlag(RsIdeFlags.HalfSectors) ? 256 : 512); + ImageInfo.imageSize = (ulong)(stream.Length - dataOff); + ImageInfo.sectors = ImageInfo.imageSize / ImageInfo.sectorSize; + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.imageVersion = string.Format("{0}.{1}", hdr.revision >> 8, hdr.revision & 0x0F); + + if(!ArrayHelpers.ArrayIsNullOrEmpty(hdr.identify)) + { + identify = new byte[512]; + Array.Copy(hdr.identify, 0, identify, 0, hdr.identify.Length); + IdentifyDevice? ataId = Decode(identify); + + if(ataId.HasValue) + { + ImageInfo.readableMediaTags.Add(MediaTagType.ATA_IDENTIFY); + ImageInfo.cylinders = ataId.Value.Cylinders; + ImageInfo.heads = ataId.Value.Heads; + ImageInfo.sectorsPerTrack = ataId.Value.SectorsPerCard; + ImageInfo.driveFirmwareRevision = ataId.Value.FirmwareRevision; + ImageInfo.driveModel = ataId.Value.Model; + ImageInfo.driveSerialNumber = ataId.Value.SerialNumber; + ImageInfo.mediaSerialNumber = ataId.Value.MediaSerial; + ImageInfo.mediaManufacturer = ataId.Value.MediaManufacturer; + } + } + + if(ImageInfo.cylinders == 0 || ImageInfo.heads == 0 || ImageInfo.sectorsPerTrack == 0) + { + ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); + ImageInfo.heads = 16; + ImageInfo.sectorsPerTrack = 63; + } + + RsIdeImageFilter = imageFilter; + + return true; + } + + public override bool ImageHasPartitions() + { + return false; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override string GetImageFormat() + { + return "RS-IDE disk image"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] buffer = new byte[length * ImageInfo.sectorSize]; + + Stream stream = RsIdeImageFilter.GetDataForkStream(); + + stream.Seek((long)(dataOff + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); + + stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); + + return buffer; + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + if(ImageInfo.readableMediaTags.Contains(tag) && tag == MediaTagType.ATA_IDENTIFY) + { + byte[] buffer = new byte[512]; + Array.Copy(identify, 0, buffer, 0, 512); + return buffer; + } + + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetMediaManufacturer() + { + return ImageInfo.mediaManufacturer; + } + + public override string GetMediaModel() + { + return null; + } + + public override string GetMediaSerialNumber() + { + return ImageInfo.mediaSerialNumber; + } + + public override string GetMediaBarcode() + { + return null; + } + + public override string GetMediaPartNumber() + { + return null; + } + + public override int GetMediaSequence() + { + return 0; + } + + public override int GetLastDiskSequence() + { + return 0; + } + + public override string GetDriveManufacturer() + { + return ImageInfo.driveManufacturer; + } + + public override string GetDriveModel() + { + return ImageInfo.driveModel; + } + + public override string GetDriveSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifyMediaImage() + { + return null; + } + #endregion + } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/SaveDskF.cs b/DiscImageChef.DiscImages/SaveDskF.cs index 47a04a1d..a8205a3b 100644 --- a/DiscImageChef.DiscImages/SaveDskF.cs +++ b/DiscImageChef.DiscImages/SaveDskF.cs @@ -41,555 +41,562 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class SaveDskF : ImagePlugin - { - #region Internal Structures - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct SaveDskFHeader - { - /// <summary>0x00 magic number</summary> - public ushort magic; - /// <summary>0x02 media type from FAT</summary> - public ushort mediaType; - /// <summary>0x04 bytes per sector</summary> - public ushort sectorSize; - /// <summary>0x06 sectors per cluster - 1</summary> - public byte clusterMask; - /// <summary>0x07 log2(cluster / sector)</summary> - public byte clusterShift; - /// <summary>0x08 reserved sectors</summary> - public ushort reservedSectors; - /// <summary>0x0A copies of FAT</summary> - public byte fatCopies; - /// <summary>0x0B entries in root directory</summary> - public ushort rootEntries; - /// <summary>0x0D first cluster</summary> - public ushort firstCluster; - /// <summary>0x0F clusters present in image</summary> - public ushort clustersCopied; - /// <summary>0x11 sectors per FAT</summary> - public byte sectorsPerFat; - /// <summary>0x12 sector number of root directory</summary> - public ushort rootDirectorySector; - /// <summary>0x14 sum of all image bytes</summary> - public uint checksum; - /// <summary>0x18 cylinders</summary> - public ushort cylinders; - /// <summary>0x1A heads</summary> - public ushort heads; - /// <summary>0x1C sectors per track</summary> - public ushort sectorsPerTrack; - /// <summary>0x1E always zero</summary> - public uint padding; - /// <summary>0x22 sectors present in image</summary> - public ushort sectorsCopied; - /// <summary>0x24 offset to comment</summary> - public ushort commentOffset; - /// <summary>0x26 offset to data</summary> - public ushort dataOffset; - } - #endregion Internal Structures - - #region Internal Constants - const ushort SDF_MAGIC_OLD = 0x58AA; - const ushort SDF_MAGIC = 0x59AA; - const ushort SDF_MAGIC_COMPRESSED = 0x5AAA; - #endregion Internal Constants - - #region Internal variables - SaveDskFHeader header; - long sectors; - uint calculatedChk; - byte[] decodedDisk; - #endregion Internal variables - - public SaveDskF() - { - Name = "IBM SaveDskF"; - PluginUUID = new Guid("288CE058-1A51-4034-8C45-5A256CAE1461"); - ImageInfo = new ImageInfo() - { - readableSectorTags = new List<SectorTagType>(), - readableMediaTags = new List<MediaTagType>(), - imageHasPartitions = false, - imageHasSessions = false, - imageVersion = null, - imageApplication = null, - imageApplicationVersion = null, - imageCreator = null, - imageComments = null, - mediaManufacturer = null, - mediaModel = null, - mediaSerialNumber = null, - mediaBarcode = null, - mediaPartNumber = null, - mediaSequence = 0, - lastMediaSequence = 0, - driveManufacturer = null, - driveModel = null, - driveSerialNumber = null, - driveFirmwareRevision = null - }; - } - - #region Public methods - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 41) - return false; - - byte[] hdr = new byte[40]; - stream.Read(hdr, 0, 40); - - header = new SaveDskFHeader(); - IntPtr hdrPtr = Marshal.AllocHGlobal(40); - Marshal.Copy(hdr, 0, hdrPtr, 40); - header = (SaveDskFHeader)Marshal.PtrToStructure(hdrPtr, typeof(SaveDskFHeader)); - Marshal.FreeHGlobal(hdrPtr); - - return (header.magic == SDF_MAGIC || header.magic == SDF_MAGIC_COMPRESSED || header.magic == SDF_MAGIC_OLD) && - header.fatCopies <= 2 && header.padding == 0 && header.commentOffset < stream.Length && header.dataOffset < stream.Length; - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - byte[] hdr = new byte[40]; - byte[] cmt; - - stream.Read(hdr, 0, 40); - header = new SaveDskFHeader(); - IntPtr hdrPtr = Marshal.AllocHGlobal(40); - Marshal.Copy(hdr, 0, hdrPtr, 40); - header = (SaveDskFHeader)Marshal.PtrToStructure(hdrPtr, typeof(SaveDskFHeader)); - Marshal.FreeHGlobal(hdrPtr); - - DicConsole.DebugWriteLine("SaveDskF plugin", "header.magic = 0x{0:X4}", header.magic); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.mediaType = 0x{0:X2}", header.mediaType); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.sectorSize = {0}", header.sectorSize); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.clusterMask = {0}", header.clusterMask); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.clusterShift = {0}", header.clusterShift); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.reservedSectors = {0}", header.reservedSectors); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.fatCopies = {0}", header.fatCopies); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.rootEntries = {0}", header.rootEntries); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.firstCluster = {0}", header.firstCluster); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.clustersCopied = {0}", header.clustersCopied); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.sectorsPerFat = {0}", header.sectorsPerFat); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.checksum = 0x{0:X8}", header.checksum); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.cylinders = {0}", header.cylinders); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.heads = {0}", header.heads); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.sectorsPerTrack = {0}", header.sectorsPerTrack); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.padding = {0}", header.padding); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.sectorsCopied = {0}", header.sectorsCopied); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.commentOffset = {0}", header.commentOffset); - DicConsole.DebugWriteLine("SaveDskF plugin", "header.dataOffset = {0}", header.dataOffset); - - if(header.dataOffset == 0 && header.magic == SDF_MAGIC_OLD) - header.dataOffset = 512; - - cmt = new byte[header.dataOffset - header.commentOffset]; - stream.Seek(header.commentOffset, SeekOrigin.Begin); - stream.Read(cmt, 0, cmt.Length); - if(cmt.Length > 1) - ImageInfo.imageComments = StringHandlers.CToString(cmt, Encoding.GetEncoding("ibm437")); - - calculatedChk = 0; - stream.Seek(0, SeekOrigin.Begin); - - int b = 0; - do - { - b = stream.ReadByte(); - if(b >= 0) - calculatedChk += (uint)b; - } - while(b >= 0); - - // In case there is omitted data - sectors = (header.sectorsPerTrack) * header.heads * header.cylinders; - - DicConsole.DebugWriteLine("SaveDskF plugin", "Calculated checksum = 0x{0:X8}, {1}", calculatedChk, calculatedChk == header.checksum); - - ImageInfo.imageApplication = "SaveDskF"; - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = imageFilter.GetFilename(); - ImageInfo.imageSize = (ulong)(stream.Length - header.dataOffset); - ImageInfo.sectors = (ulong)(header.sectorsPerTrack * header.heads * header.cylinders); - ImageInfo.sectorSize = header.sectorSize; - - ImageInfo.mediaType = MediaType.Unknown; - switch(header.cylinders) - { - case 40: - switch(header.heads) - { - case 1: - switch(header.sectorsPerTrack) - { - case 8: - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; - break; - case 9: - ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; - break; - } - break; - case 2: - switch(header.sectorsPerTrack) - { - case 8: - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; - break; - case 9: - ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; - break; - } - break; - } - break; - case 70: - switch(header.heads) - { - case 1: - switch(header.sectorsPerTrack) - { - case 9: - ImageInfo.mediaType = MediaType.Apricot_35; - break; - } - break; - } - break; - case 80: - switch(header.heads) - { - case 1: - switch(header.sectorsPerTrack) - { - case 8: - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; - break; - case 9: - ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; - break; - } - break; - case 2: - switch(header.sectorsPerTrack) - { - case 8: - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; - break; - case 9: - ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; - break; - case 15: - ImageInfo.mediaType = MediaType.DOS_525_HD; - break; - case 18: - ImageInfo.mediaType = MediaType.DOS_35_HD; - break; - case 23: - ImageInfo.mediaType = MediaType.XDF_35; - break; - case 36: - ImageInfo.mediaType = MediaType.DOS_35_ED; - break; - } - break; - } - break; - default: - ImageInfo.mediaType = MediaType.Unknown; - break; - } - - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - - DicConsole.VerboseWriteLine("SaveDskF image contains a disk of type {0}", ImageInfo.mediaType); - if(!string.IsNullOrEmpty(ImageInfo.imageComments)) - DicConsole.VerboseWriteLine("SaveDskF comments: {0}", ImageInfo.imageComments); - - // TODO: Support compressed images - if(header.magic == SDF_MAGIC_COMPRESSED) - throw new FeatureSupportedButNotImplementedImageException("Compressed SaveDskF images are not supported."); - - // SaveDskF only ommits ending clusters, leaving no gaps behind, so reading all data we have... - stream.Seek(header.dataOffset, SeekOrigin.Begin); - decodedDisk = new byte[ImageInfo.sectors * ImageInfo.sectorSize]; - stream.Read(decodedDisk, 0, (int)(stream.Length - header.dataOffset)); - - ImageInfo.cylinders = header.cylinders; - ImageInfo.heads = header.heads; - ImageInfo.sectorsPerTrack = header.sectorsPerTrack; - - return true; - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifyMediaImage() - { - return calculatedChk == header.checksum; - } - - public override bool ImageHasPartitions() - { - return ImageInfo.imageHasPartitions; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] buffer = new byte[length * ImageInfo.sectorSize]; - - Array.Copy(decodedDisk, (int)sectorAddress * ImageInfo.sectorSize, buffer, 0, length * ImageInfo.sectorSize); - - return buffer; - } - - public override string GetImageFormat() - { - return "IBM SaveDskF"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override string GetMediaManufacturer() - { - return ImageInfo.mediaManufacturer; - } - - public override string GetMediaModel() - { - return ImageInfo.mediaModel; - } - - public override string GetMediaSerialNumber() - { - return ImageInfo.mediaSerialNumber; - } - - public override string GetMediaBarcode() - { - return ImageInfo.mediaBarcode; - } - - public override string GetMediaPartNumber() - { - return ImageInfo.mediaPartNumber; - } - - public override int GetMediaSequence() - { - return ImageInfo.mediaSequence; - } - - public override int GetLastDiskSequence() - { - return ImageInfo.lastMediaSequence; - } - - public override string GetDriveManufacturer() - { - return ImageInfo.driveManufacturer; - } - - public override string GetDriveModel() - { - return ImageInfo.driveModel; - } - - public override string GetDriveSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - #endregion Public methods - - #region Unsupported features - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - #endregion Unsupported features - } -} - + public class SaveDskF : ImagePlugin + { + #region Internal Structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct SaveDskFHeader + { + /// <summary>0x00 magic number</summary> + public ushort magic; + /// <summary>0x02 media type from FAT</summary> + public ushort mediaType; + /// <summary>0x04 bytes per sector</summary> + public ushort sectorSize; + /// <summary>0x06 sectors per cluster - 1</summary> + public byte clusterMask; + /// <summary>0x07 log2(cluster / sector)</summary> + public byte clusterShift; + /// <summary>0x08 reserved sectors</summary> + public ushort reservedSectors; + /// <summary>0x0A copies of FAT</summary> + public byte fatCopies; + /// <summary>0x0B entries in root directory</summary> + public ushort rootEntries; + /// <summary>0x0D first cluster</summary> + public ushort firstCluster; + /// <summary>0x0F clusters present in image</summary> + public ushort clustersCopied; + /// <summary>0x11 sectors per FAT</summary> + public byte sectorsPerFat; + /// <summary>0x12 sector number of root directory</summary> + public ushort rootDirectorySector; + /// <summary>0x14 sum of all image bytes</summary> + public uint checksum; + /// <summary>0x18 cylinders</summary> + public ushort cylinders; + /// <summary>0x1A heads</summary> + public ushort heads; + /// <summary>0x1C sectors per track</summary> + public ushort sectorsPerTrack; + /// <summary>0x1E always zero</summary> + public uint padding; + /// <summary>0x22 sectors present in image</summary> + public ushort sectorsCopied; + /// <summary>0x24 offset to comment</summary> + public ushort commentOffset; + /// <summary>0x26 offset to data</summary> + public ushort dataOffset; + } + #endregion Internal Structures + + #region Internal Constants + const ushort SDF_MAGIC_OLD = 0x58AA; + const ushort SDF_MAGIC = 0x59AA; + const ushort SDF_MAGIC_COMPRESSED = 0x5AAA; + #endregion Internal Constants + + #region Internal variables + SaveDskFHeader header; + long sectors; + uint calculatedChk; + byte[] decodedDisk; + #endregion Internal variables + + public SaveDskF() + { + Name = "IBM SaveDskF"; + PluginUUID = new Guid("288CE058-1A51-4034-8C45-5A256CAE1461"); + ImageInfo = new ImageInfo() + { + readableSectorTags = new List<SectorTagType>(), + readableMediaTags = new List<MediaTagType>(), + imageHasPartitions = false, + imageHasSessions = false, + imageVersion = null, + imageApplication = null, + imageApplicationVersion = null, + imageCreator = null, + imageComments = null, + mediaManufacturer = null, + mediaModel = null, + mediaSerialNumber = null, + mediaBarcode = null, + mediaPartNumber = null, + mediaSequence = 0, + lastMediaSequence = 0, + driveManufacturer = null, + driveModel = null, + driveSerialNumber = null, + driveFirmwareRevision = null + }; + } + + #region Public methods + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + if(stream.Length < 41) return false; + + byte[] hdr = new byte[40]; + stream.Read(hdr, 0, 40); + + header = new SaveDskFHeader(); + IntPtr hdrPtr = Marshal.AllocHGlobal(40); + Marshal.Copy(hdr, 0, hdrPtr, 40); + header = (SaveDskFHeader)Marshal.PtrToStructure(hdrPtr, typeof(SaveDskFHeader)); + Marshal.FreeHGlobal(hdrPtr); + + return (header.magic == SDF_MAGIC || header.magic == SDF_MAGIC_COMPRESSED || + header.magic == SDF_MAGIC_OLD) && header.fatCopies <= 2 && header.padding == 0 && + header.commentOffset < stream.Length && header.dataOffset < stream.Length; + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + byte[] hdr = new byte[40]; + byte[] cmt; + + stream.Read(hdr, 0, 40); + header = new SaveDskFHeader(); + IntPtr hdrPtr = Marshal.AllocHGlobal(40); + Marshal.Copy(hdr, 0, hdrPtr, 40); + header = (SaveDskFHeader)Marshal.PtrToStructure(hdrPtr, typeof(SaveDskFHeader)); + Marshal.FreeHGlobal(hdrPtr); + + DicConsole.DebugWriteLine("SaveDskF plugin", "header.magic = 0x{0:X4}", header.magic); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.mediaType = 0x{0:X2}", header.mediaType); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.sectorSize = {0}", header.sectorSize); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.clusterMask = {0}", header.clusterMask); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.clusterShift = {0}", header.clusterShift); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.reservedSectors = {0}", header.reservedSectors); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.fatCopies = {0}", header.fatCopies); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.rootEntries = {0}", header.rootEntries); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.firstCluster = {0}", header.firstCluster); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.clustersCopied = {0}", header.clustersCopied); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.sectorsPerFat = {0}", header.sectorsPerFat); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.checksum = 0x{0:X8}", header.checksum); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.cylinders = {0}", header.cylinders); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.heads = {0}", header.heads); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.sectorsPerTrack = {0}", header.sectorsPerTrack); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.padding = {0}", header.padding); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.sectorsCopied = {0}", header.sectorsCopied); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.commentOffset = {0}", header.commentOffset); + DicConsole.DebugWriteLine("SaveDskF plugin", "header.dataOffset = {0}", header.dataOffset); + + if(header.dataOffset == 0 && header.magic == SDF_MAGIC_OLD) header.dataOffset = 512; + + cmt = new byte[header.dataOffset - header.commentOffset]; + stream.Seek(header.commentOffset, SeekOrigin.Begin); + stream.Read(cmt, 0, cmt.Length); + if(cmt.Length > 1) ImageInfo.imageComments = StringHandlers.CToString(cmt, Encoding.GetEncoding("ibm437")); + + calculatedChk = 0; + stream.Seek(0, SeekOrigin.Begin); + + int b = 0; + do + { + b = stream.ReadByte(); + if(b >= 0) calculatedChk += (uint)b; + } + while(b >= 0); + + // In case there is omitted data + sectors = (header.sectorsPerTrack) * header.heads * header.cylinders; + + DicConsole.DebugWriteLine("SaveDskF plugin", "Calculated checksum = 0x{0:X8}, {1}", calculatedChk, + calculatedChk == header.checksum); + + ImageInfo.imageApplication = "SaveDskF"; + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = imageFilter.GetFilename(); + ImageInfo.imageSize = (ulong)(stream.Length - header.dataOffset); + ImageInfo.sectors = (ulong)(header.sectorsPerTrack * header.heads * header.cylinders); + ImageInfo.sectorSize = header.sectorSize; + + ImageInfo.mediaType = MediaType.Unknown; + switch(header.cylinders) + { + case 40: + switch(header.heads) + { + case 1: + switch(header.sectorsPerTrack) + { + case 8: + ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8; + break; + case 9: + ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9; + break; + } + + break; + case 2: + switch(header.sectorsPerTrack) + { + case 8: + ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8; + break; + case 9: + ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9; + break; + } + + break; + } + + break; + case 70: + switch(header.heads) + { + case 1: + switch(header.sectorsPerTrack) + { + case 9: + ImageInfo.mediaType = MediaType.Apricot_35; + break; + } + + break; + } + + break; + case 80: + switch(header.heads) + { + case 1: + switch(header.sectorsPerTrack) + { + case 8: + ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8; + break; + case 9: + ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9; + break; + } + + break; + case 2: + switch(header.sectorsPerTrack) + { + case 8: + ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8; + break; + case 9: + ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9; + break; + case 15: + ImageInfo.mediaType = MediaType.DOS_525_HD; + break; + case 18: + ImageInfo.mediaType = MediaType.DOS_35_HD; + break; + case 23: + ImageInfo.mediaType = MediaType.XDF_35; + break; + case 36: + ImageInfo.mediaType = MediaType.DOS_35_ED; + break; + } + + break; + } + + break; + default: + ImageInfo.mediaType = MediaType.Unknown; + break; + } + + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + + DicConsole.VerboseWriteLine("SaveDskF image contains a disk of type {0}", ImageInfo.mediaType); + if(!string.IsNullOrEmpty(ImageInfo.imageComments)) + DicConsole.VerboseWriteLine("SaveDskF comments: {0}", ImageInfo.imageComments); + + // TODO: Support compressed images + if(header.magic == SDF_MAGIC_COMPRESSED) + throw new + FeatureSupportedButNotImplementedImageException("Compressed SaveDskF images are not supported."); + + // SaveDskF only ommits ending clusters, leaving no gaps behind, so reading all data we have... + stream.Seek(header.dataOffset, SeekOrigin.Begin); + decodedDisk = new byte[ImageInfo.sectors * ImageInfo.sectorSize]; + stream.Read(decodedDisk, 0, (int)(stream.Length - header.dataOffset)); + + ImageInfo.cylinders = header.cylinders; + ImageInfo.heads = header.heads; + ImageInfo.sectorsPerTrack = header.sectorsPerTrack; + + return true; + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifyMediaImage() + { + return calculatedChk == header.checksum; + } + + public override bool ImageHasPartitions() + { + return ImageInfo.imageHasPartitions; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] buffer = new byte[length * ImageInfo.sectorSize]; + + Array.Copy(decodedDisk, (int)sectorAddress * ImageInfo.sectorSize, buffer, 0, + length * ImageInfo.sectorSize); + + return buffer; + } + + public override string GetImageFormat() + { + return "IBM SaveDskF"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override string GetMediaManufacturer() + { + return ImageInfo.mediaManufacturer; + } + + public override string GetMediaModel() + { + return ImageInfo.mediaModel; + } + + public override string GetMediaSerialNumber() + { + return ImageInfo.mediaSerialNumber; + } + + public override string GetMediaBarcode() + { + return ImageInfo.mediaBarcode; + } + + public override string GetMediaPartNumber() + { + return ImageInfo.mediaPartNumber; + } + + public override int GetMediaSequence() + { + return ImageInfo.mediaSequence; + } + + public override int GetLastDiskSequence() + { + return ImageInfo.lastMediaSequence; + } + + public override string GetDriveManufacturer() + { + return ImageInfo.driveManufacturer; + } + + public override string GetDriveModel() + { + return ImageInfo.driveModel; + } + + public override string GetDriveSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + #endregion Public methods + + #region Unsupported features + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + #endregion Unsupported features + } +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/SuperCardPro.cs b/DiscImageChef.DiscImages/SuperCardPro.cs index 792d8216..44bc4d14 100644 --- a/DiscImageChef.DiscImages/SuperCardPro.cs +++ b/DiscImageChef.DiscImages/SuperCardPro.cs @@ -42,14 +42,13 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class SuperCardPro : ImagePlugin + public class SuperCardPro : ImagePlugin { #region Internal Structures [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ScpHeader { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] signature; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] signature; public byte version; public ScpDiskType type; public byte revolutions; @@ -60,14 +59,12 @@ namespace DiscImageChef.ImagePlugins public byte heads; public byte reserved; public uint checksum; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 168)] - public uint[] offsets; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 168)] public uint[] offsets; } public struct TrackHeader { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] signature; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] signature; public byte trackNumber; public TrackEntry[] entries; } @@ -103,11 +100,11 @@ namespace DiscImageChef.ImagePlugins /// <summary> /// SuperCardPro header signature: "SCP" /// </summary> - readonly byte[] ScpSignature = { 0x53, 0x43, 0x50 }; + readonly byte[] ScpSignature = {0x53, 0x43, 0x50}; /// <summary> /// SuperCardPro track header signature: "TRK" /// </summary> - readonly byte[] TrkSignature = { 0x54, 0x52, 0x4B }; + readonly byte[] TrkSignature = {0x54, 0x52, 0x4B}; /// <summary> /// SuperCardPro footer signature: "FPCS" /// </summary> @@ -211,8 +208,7 @@ namespace DiscImageChef.ImagePlugins header = new ScpHeader(); Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < Marshal.SizeOf(header)) - return false; + if(stream.Length < Marshal.SizeOf(header)) return false; byte[] hdr = new byte[Marshal.SizeOf(header)]; stream.Read(hdr, 0, Marshal.SizeOf(header)); @@ -230,8 +226,7 @@ namespace DiscImageChef.ImagePlugins header = new ScpHeader(); scpStream = imageFilter.GetDataForkStream(); scpStream.Seek(0, SeekOrigin.Begin); - if(scpStream.Length < Marshal.SizeOf(header)) - return false; + if(scpStream.Length < Marshal.SizeOf(header)) return false; byte[] hdr = new byte[Marshal.SizeOf(header)]; scpStream.Read(hdr, 0, Marshal.SizeOf(header)); @@ -241,8 +236,10 @@ namespace DiscImageChef.ImagePlugins header = (ScpHeader)Marshal.PtrToStructure(hdrPtr, typeof(ScpHeader)); Marshal.FreeHGlobal(hdrPtr); - DicConsole.DebugWriteLine("SuperCardPro plugin", "header.signature = \"{0}\"", StringHandlers.CToString(header.signature)); - DicConsole.DebugWriteLine("SuperCardPro plugin", "header.version = {0}.{1}", (header.version & 0xF0) >> 4, header.version & 0xF); + DicConsole.DebugWriteLine("SuperCardPro plugin", "header.signature = \"{0}\"", + StringHandlers.CToString(header.signature)); + DicConsole.DebugWriteLine("SuperCardPro plugin", "header.version = {0}.{1}", (header.version & 0xF0) >> 4, + header.version & 0xF); DicConsole.DebugWriteLine("SuperCardPro plugin", "header.type = {0}", header.type); DicConsole.DebugWriteLine("SuperCardPro plugin", "header.revolutions = {0}", header.revolutions); DicConsole.DebugWriteLine("SuperCardPro plugin", "header.start = {0}", header.start); @@ -253,15 +250,13 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("SuperCardPro plugin", "header.reserved = {0}", header.reserved); DicConsole.DebugWriteLine("SuperCardPro plugin", "header.checksum = 0x{0:X8}", header.checksum); - if(!ScpSignature.SequenceEqual(header.signature)) - return false; + if(!ScpSignature.SequenceEqual(header.signature)) return false; tracks = new Dictionary<byte, TrackHeader>(); for(byte t = header.start; t <= header.end; t++) { - if(t >= header.offsets.Length) - break; + if(t >= header.offsets.Length) break; scpStream.Position = header.offsets[t]; TrackHeader trk = new TrackHeader(); @@ -272,13 +267,15 @@ namespace DiscImageChef.ImagePlugins if(!trk.signature.SequenceEqual(TrkSignature)) { - DicConsole.DebugWriteLine("SuperCardPro plugin", "Track header at {0} contains incorrect signature.", header.offsets[t]); + DicConsole.DebugWriteLine("SuperCardPro plugin", + "Track header at {0} contains incorrect signature.", header.offsets[t]); continue; } if(trk.trackNumber != t) { - DicConsole.DebugWriteLine("SuperCardPro plugin", "Track number at {0} should be {1} but is {2}.", header.offsets[t], t, trk.trackNumber); + DicConsole.DebugWriteLine("SuperCardPro plugin", "Track number at {0} should be {1} but is {2}.", + header.offsets[t], t, trk.trackNumber); continue; } @@ -304,7 +301,7 @@ namespace DiscImageChef.ImagePlugins { long position = scpStream.Position; scpStream.Seek(-4, SeekOrigin.End); - + while(scpStream.Position >= position) { byte[] footerSig = new byte[4]; @@ -314,9 +311,9 @@ namespace DiscImageChef.ImagePlugins if(footerMagic == FooterSignature) { scpStream.Seek(-Marshal.SizeOf(typeof(ScpFooter)), SeekOrigin.Current); - + DicConsole.DebugWriteLine("SuperCardPro plugin", "Found footer at {0}", scpStream.Position); - + byte[] ftr = new byte[Marshal.SizeOf(typeof(ScpFooter))]; scpStream.Read(ftr, 0, Marshal.SizeOf(typeof(ScpFooter))); @@ -325,19 +322,33 @@ namespace DiscImageChef.ImagePlugins ScpFooter footer = (ScpFooter)Marshal.PtrToStructure(ftrPtr, typeof(ScpFooter)); Marshal.FreeHGlobal(ftrPtr); - DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.manufacturerOffset = 0x{0:X8}", footer.manufacturerOffset); - DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.modelOffset = 0x{0:X8}", footer.modelOffset); - DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.serialOffset = 0x{0:X8}", footer.serialOffset); - DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.creatorOffset = 0x{0:X8}", footer.creatorOffset); - DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.applicationOffset = 0x{0:X8}", footer.applicationOffset); - DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.commentsOffset = 0x{0:X8}", footer.commentsOffset); - DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.creationTime = {0}", footer.creationTime); - DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.modificationTime = {0}", footer.modificationTime); - DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.applicationVersion = {0}.{1}", (footer.applicationVersion & 0xF0) >> 4, footer.applicationVersion & 0xF); - DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.hardwareVersion = {0}.{1}", (footer.hardwareVersion & 0xF0) >> 4, footer.hardwareVersion & 0xF); - DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.firmwareVersion = {0}.{1}", (footer.firmwareVersion & 0xF0) >> 4, footer.firmwareVersion & 0xF); - DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.imageVersion = {0}.{1}", (footer.imageVersion & 0xF0) >> 4, footer.imageVersion & 0xF); - DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.signature = \"{0}\"", StringHandlers.CToString(BitConverter.GetBytes(footer.signature))); + DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.manufacturerOffset = 0x{0:X8}", + footer.manufacturerOffset); + DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.modelOffset = 0x{0:X8}", + footer.modelOffset); + DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.serialOffset = 0x{0:X8}", + footer.serialOffset); + DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.creatorOffset = 0x{0:X8}", + footer.creatorOffset); + DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.applicationOffset = 0x{0:X8}", + footer.applicationOffset); + DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.commentsOffset = 0x{0:X8}", + footer.commentsOffset); + DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.creationTime = {0}", + footer.creationTime); + DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.modificationTime = {0}", + footer.modificationTime); + DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.applicationVersion = {0}.{1}", + (footer.applicationVersion & 0xF0) >> 4, + footer.applicationVersion & 0xF); + DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.hardwareVersion = {0}.{1}", + (footer.hardwareVersion & 0xF0) >> 4, footer.hardwareVersion & 0xF); + DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.firmwareVersion = {0}.{1}", + (footer.firmwareVersion & 0xF0) >> 4, footer.firmwareVersion & 0xF); + DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.imageVersion = {0}.{1}", + (footer.imageVersion & 0xF0) >> 4, footer.imageVersion & 0xF); + DicConsole.DebugWriteLine("SuperCardPro plugin", "footer.signature = \"{0}\"", + StringHandlers.CToString(BitConverter.GetBytes(footer.signature))); ImageInfo.driveManufacturer = ReadPStringUTF8(scpStream, footer.manufacturerOffset); ImageInfo.driveModel = ReadPStringUTF8(scpStream, footer.modelOffset); @@ -346,36 +357,44 @@ namespace DiscImageChef.ImagePlugins ImageInfo.imageApplication = ReadPStringUTF8(scpStream, footer.applicationOffset); ImageInfo.imageComments = ReadPStringUTF8(scpStream, footer.commentsOffset); - DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.driveManufacturer = \"{0}\"", ImageInfo.driveManufacturer); - DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.driveModel = \"{0}\"", ImageInfo.driveModel); - DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.driveSerialNumber = \"{0}\"", ImageInfo.driveSerialNumber); - DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageCreator = \"{0}\"", ImageInfo.imageCreator); - DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageApplication = \"{0}\"", ImageInfo.imageApplication); - DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageComments = \"{0}\"", ImageInfo.imageComments); + DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.driveManufacturer = \"{0}\"", + ImageInfo.driveManufacturer); + DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.driveModel = \"{0}\"", + ImageInfo.driveModel); + DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.driveSerialNumber = \"{0}\"", + ImageInfo.driveSerialNumber); + DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageCreator = \"{0}\"", + ImageInfo.imageCreator); + DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageApplication = \"{0}\"", + ImageInfo.imageApplication); + DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageComments = \"{0}\"", + ImageInfo.imageComments); if(footer.creationTime != 0) ImageInfo.imageCreationTime = DateHandlers.UNIXToDateTime(footer.creationTime); - else - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + else ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); if(footer.modificationTime != 0) ImageInfo.imageLastModificationTime = DateHandlers.UNIXToDateTime(footer.modificationTime); - else - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + else ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageCreationTime = {0}", ImageInfo.imageCreationTime); - DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageLastModificationTime = {0}", ImageInfo.imageLastModificationTime); + DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageCreationTime = {0}", + ImageInfo.imageCreationTime); + DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageLastModificationTime = {0}", + ImageInfo.imageLastModificationTime); ImageInfo.imageApplicationVersion = - string.Format("{0}.{1}", (footer.applicationVersion & 0xF0) >> 4, footer.applicationVersion & 0xF); + string.Format("{0}.{1}", (footer.applicationVersion & 0xF0) >> 4, + footer.applicationVersion & 0xF); ImageInfo.driveFirmwareRevision = - string.Format("{0}.{1}", (footer.firmwareVersion & 0xF0) >> 4, footer.firmwareVersion & 0xF); + string.Format("{0}.{1}", (footer.firmwareVersion & 0xF0) >> 4, + footer.firmwareVersion & 0xF); ImageInfo.imageVersion = string.Format("{0}.{1}", (footer.imageVersion & 0xF0) >> 4, footer.imageVersion & 0xF); - + break; } - + scpStream.Seek(-8, SeekOrigin.Current); } } @@ -394,16 +413,14 @@ namespace DiscImageChef.ImagePlugins string ReadPStringUTF8(Stream stream, uint position) { - if(position == 0) - return null; + if(position == 0) return null; stream.Position = position; byte[] len_b = new byte[2]; stream.Read(len_b, 0, 2); ushort len = BitConverter.ToUInt16(len_b, 0); - if(len == 0 || len + stream.Position >= stream.Length) - return null; + if(len == 0 || len + stream.Position >= stream.Length) return null; byte[] str = new byte[len]; stream.Read(str, 0, len); @@ -577,15 +594,15 @@ namespace DiscImageChef.ImagePlugins throw new NotImplementedException("Flux decoding is not yet implemented."); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new NotImplementedException("Flux decoding is not yet implemented."); } public override bool? VerifyMediaImage() { - if(header.flags.HasFlag(ScpFlags.Writable)) - return null; + if(header.flags.HasFlag(ScpFlags.Writable)) return null; byte[] wholeFile = new byte[scpStream.Length]; uint sum = 0; @@ -593,8 +610,7 @@ namespace DiscImageChef.ImagePlugins scpStream.Position = 0; scpStream.Read(wholeFile, 0, wholeFile.Length); - for(int i = 0x10; i < wholeFile.Length; i++) - sum += wholeFile[i]; + for(int i = 0x10; i < wholeFile.Length; i++) sum += wholeFile[i]; return header.checksum == sum; } @@ -610,6 +626,7 @@ namespace DiscImageChef.ImagePlugins { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -655,7 +672,8 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } diff --git a/DiscImageChef.DiscImages/T98.cs b/DiscImageChef.DiscImages/T98.cs index a71a4775..bab94649 100644 --- a/DiscImageChef.DiscImages/T98.cs +++ b/DiscImageChef.DiscImages/T98.cs @@ -39,357 +39,347 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class T98 : ImagePlugin - { - public T98() - { - Name = "T98 Hard Disk Image"; - PluginUUID = new Guid("0410003E-6E7B-40E6-9328-BA5651ADF6B7"); - ImageInfo = new ImageInfo() - { - readableSectorTags = new List<SectorTagType>(), - readableMediaTags = new List<MediaTagType>(), - imageHasPartitions = false, - imageHasSessions = false, - imageVersion = null, - imageApplication = null, - imageApplicationVersion = null, - imageCreator = null, - imageComments = null, - mediaManufacturer = null, - mediaModel = null, - mediaSerialNumber = null, - mediaBarcode = null, - mediaPartNumber = null, - mediaSequence = 0, - lastMediaSequence = 0, - driveManufacturer = null, - driveModel = null, - driveSerialNumber = null, - driveFirmwareRevision = null - }; - } - - Filter t98ImageFilter; - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - if(stream.Length % 256 != 0) - return false; - - byte[] hdr_b = new byte[256]; - stream.Read(hdr_b, 0, hdr_b.Length); - - for(int i = 4; i < 256; i++) - { - if(hdr_b[i] != 0) - return false; - } - - int cylinders = BitConverter.ToInt32(hdr_b, 0); - - DicConsole.DebugWriteLine("T98 plugin", "cylinders = {0}", cylinders); - - // This format is expanding, so length can be smaller - // Just grow it, I won't risk false positives... - return stream.Length == (cylinders * 8 * 33 * 256) + 256; - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - if(stream.Length % 256 != 0) - return false; - - byte[] hdr_b = new byte[256]; - stream.Read(hdr_b, 0, hdr_b.Length); - - for(int i = 4; i < 256; i++) - { - if(hdr_b[i] != 0) - return false; - } - - int cylinders = BitConverter.ToInt32(hdr_b, 0); - - ImageInfo.mediaType = MediaType.GENERIC_HDD; - - ImageInfo.imageSize = (ulong)(stream.Length - 256); - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.sectors = (ulong)((stream.Length / 256) - 1); - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.sectorSize = 256; - ImageInfo.cylinders = (uint)cylinders; - ImageInfo.heads = 8; - ImageInfo.sectorsPerTrack = 33; - - t98ImageFilter = imageFilter; - - return true; - } - - public override bool ImageHasPartitions() - { - return false; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override string GetImageFormat() - { - return "T98 disk image"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] buffer = new byte[length * ImageInfo.sectorSize]; - - Stream stream = t98ImageFilter.GetDataForkStream(); - - stream.Seek((long)(256 + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); - - stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); - - return buffer; - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetMediaManufacturer() - { - return null; - } - - public override string GetMediaModel() - { - return null; - } - - public override string GetMediaSerialNumber() - { - return null; - } - - public override string GetMediaBarcode() - { - return null; - } - - public override string GetMediaPartNumber() - { - return null; - } - - public override int GetMediaSequence() - { - return 0; - } - - public override int GetLastDiskSequence() - { - return 0; - } - - public override string GetDriveManufacturer() - { - return null; - } - - public override string GetDriveModel() - { - return null; - } - - public override string GetDriveSerialNumber() - { - return null; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifyMediaImage() - { - return null; - } - - #endregion - } + public class T98 : ImagePlugin + { + public T98() + { + Name = "T98 Hard Disk Image"; + PluginUUID = new Guid("0410003E-6E7B-40E6-9328-BA5651ADF6B7"); + ImageInfo = new ImageInfo() + { + readableSectorTags = new List<SectorTagType>(), + readableMediaTags = new List<MediaTagType>(), + imageHasPartitions = false, + imageHasSessions = false, + imageVersion = null, + imageApplication = null, + imageApplicationVersion = null, + imageCreator = null, + imageComments = null, + mediaManufacturer = null, + mediaModel = null, + mediaSerialNumber = null, + mediaBarcode = null, + mediaPartNumber = null, + mediaSequence = 0, + lastMediaSequence = 0, + driveManufacturer = null, + driveModel = null, + driveSerialNumber = null, + driveFirmwareRevision = null + }; + } + + Filter t98ImageFilter; + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + if(stream.Length % 256 != 0) return false; + + byte[] hdr_b = new byte[256]; + stream.Read(hdr_b, 0, hdr_b.Length); + + for(int i = 4; i < 256; i++) { if(hdr_b[i] != 0) return false; } + + int cylinders = BitConverter.ToInt32(hdr_b, 0); + + DicConsole.DebugWriteLine("T98 plugin", "cylinders = {0}", cylinders); + + // This format is expanding, so length can be smaller + // Just grow it, I won't risk false positives... + return stream.Length == (cylinders * 8 * 33 * 256) + 256; + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + if(stream.Length % 256 != 0) return false; + + byte[] hdr_b = new byte[256]; + stream.Read(hdr_b, 0, hdr_b.Length); + + for(int i = 4; i < 256; i++) { if(hdr_b[i] != 0) return false; } + + int cylinders = BitConverter.ToInt32(hdr_b, 0); + + ImageInfo.mediaType = MediaType.GENERIC_HDD; + + ImageInfo.imageSize = (ulong)(stream.Length - 256); + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.sectors = (ulong)((stream.Length / 256) - 1); + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.sectorSize = 256; + ImageInfo.cylinders = (uint)cylinders; + ImageInfo.heads = 8; + ImageInfo.sectorsPerTrack = 33; + + t98ImageFilter = imageFilter; + + return true; + } + + public override bool ImageHasPartitions() + { + return false; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override string GetImageFormat() + { + return "T98 disk image"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] buffer = new byte[length * ImageInfo.sectorSize]; + + Stream stream = t98ImageFilter.GetDataForkStream(); + + stream.Seek((long)(256 + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); + + stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); + + return buffer; + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetMediaManufacturer() + { + return null; + } + + public override string GetMediaModel() + { + return null; + } + + public override string GetMediaSerialNumber() + { + return null; + } + + public override string GetMediaBarcode() + { + return null; + } + + public override string GetMediaPartNumber() + { + return null; + } + + public override int GetMediaSequence() + { + return 0; + } + + public override int GetLastDiskSequence() + { + return 0; + } + + public override string GetDriveManufacturer() + { + return null; + } + + public override string GetDriveModel() + { + return null; + } + + public override string GetDriveSerialNumber() + { + return null; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifyMediaImage() + { + return null; + } + #endregion + } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/TeleDisk.cs b/DiscImageChef.DiscImages/TeleDisk.cs index 0c2d70a3..2e0ed8b2 100644 --- a/DiscImageChef.DiscImages/TeleDisk.cs +++ b/DiscImageChef.DiscImages/TeleDisk.cs @@ -44,1740 +44,1665 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - // Created following notes from Dave Dunfield - // http://www.classiccmp.org/dunfield/img54306/td0notes.txt - public class TeleDisk : ImagePlugin - { - #region Internal Structures - - struct TD0Header - { - /// <summary>"TD" or "td" depending on compression</summary> - public ushort signature; - /// <summary>Sequence, but TeleDisk seems to complaing if != 0</summary> - public byte sequence; - /// <summary>Random, same byte for all disks in the same set</summary> - public byte diskSet; - /// <summary>TeleDisk version, major in high nibble, minor in low nibble</summary> - public byte version; - /// <summary>Data rate</summary> - public byte dataRate; - /// <summary>BIOS drive type</summary> - public byte driveType; - /// <summary>Stepping used</summary> - public byte stepping; - /// <summary>If set means image only allocates sectors marked in-use by FAT12</summary> - public byte dosAllocation; - /// <summary>Sides of disk</summary> - public byte sides; - /// <summary>CRC of all the previous</summary> - public ushort crc; - } - - struct TDCommentBlockHeader - { - /// <summary>CRC of comment block after crc field</summary> - public ushort crc; - /// <summary>Length of comment</summary> - public ushort length; - public byte year; - public byte month; - public byte day; - public byte hour; - public byte minute; - public byte second; - } - - struct TDTrackHeader - { - /// <summary>Sectors in the track, 0xFF if end of disk image (there is no spoon)</summary> - public byte sectors; - /// <summary>Cylinder the head was on</summary> - public byte cylinder; - /// <summary>Head/side used</summary> - public byte head; - /// <summary>Lower byte of CRC of previous fields</summary> - public byte crc; - } - - struct TDSectorHeader - { - /// <summary>Cylinder as stored on sector address mark</summary> - public byte cylinder; - /// <summary>Head as stored on sector address mark</summary> - public byte head; - /// <summary>Sector number as stored on sector address mark</summary> - public byte sectorNumber; - /// <summary>Sector size</summary> - public byte sectorSize; - /// <summary>Sector flags</summary> - public byte flags; - /// <summary>Lower byte of TeleDisk CRC of sector header, data header and data block</summary> - public byte crc; - } - - struct TDDataHeader - { - /// <summary>Size of all data (encoded) + next field (1)</summary> - public ushort dataSize; - /// <summary>Encoding used for data block</summary> - public byte dataEncoding; - } - - #endregion - - #region Internal Constants - - // "TD" as little endian uint. - const ushort tdMagic = 0x4454; - // "td" as little endian uint. Means whole file is compressed (aka Advanced Compression) - const ushort tdAdvCompMagic = 0x6474; - - // DataRates - const byte DataRate250kbps = 0x00; - const byte DataRate300kbps = 0x01; - const byte DataRate500kbps = 0x02; - - // TeleDisk drive types - const byte DriveType525HD_DDDisk = 0x00; - const byte DriveType525HD = 0x01; - const byte DriveType525DD = 0x02; - const byte DriveType35DD = 0x03; - const byte DriveType35HD = 0x04; - const byte DriveType8inch = 0x05; - const byte DriveType35ED = 0x06; - - // Stepping - const byte SteppingSingle = 0x00; - const byte SteppingDouble = 0x01; - const byte SteppingEvenOnly = 0x02; - // If this bit is set, there is a comment block - const byte CommentBlockPresent = 0x80; - - // CRC polynomial - const ushort TeleDiskCRCPoly = 0xA097; - - // Sector sizes table - const byte SectorSize128 = 0x00; - const byte SectorSize256 = 0x01; - const byte SectorSize512 = 0x02; - const byte SectorSize1K = 0x03; - const byte SectorSize2K = 0x04; - const byte SectorSize4K = 0x05; - const byte SectorSize8K = 0x06; - - // Flags - // Address mark repeats inside same track - const byte FlagsSectorDuplicate = 0x01; - // Sector gave CRC error on reading - const byte FlagsSectorCRCError = 0x02; - // Address mark indicates deleted sector - const byte FlagsSectorDeleted = 0x04; - // Sector skipped as FAT said it's unused - const byte FlagsSectorSkipped = 0x10; - // There was an address mark, but no data following - const byte FlagsSectorDataless = 0x20; - // There was data without address mark - const byte FlagsSectorNoID = 0x40; - - // Data block encodings - // Data is copied as is - const byte dataBlockCopy = 0x00; - // Data is encoded as a pair of len.value uint16s - const byte dataBlockPattern = 0x01; - // Data is encoded as RLE - const byte dataBlockRLE = 0x02; - - #endregion - - #region Internal variables - - TD0Header header; - TDCommentBlockHeader commentHeader; - byte[] commentBlock; - // LBA, data - uint totalDiskSize; - bool ADiskCRCHasFailed; - List<ulong> SectorsWhereCRCHasFailed; - // Cylinder by head, sector data matrix - byte[][][][] sectorsData; - Stream inStream; - byte[] leadOut; - - #endregion - - public TeleDisk() - { - Name = "Sydex TeleDisk"; - PluginUUID = new Guid("0240B7B1-E959-4CDC-B0BD-386D6E467B88"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = false; - ImageInfo.imageHasSessions = false; - ImageInfo.imageApplication = "Sydex TeleDisk"; - ImageInfo.imageComments = null; - ImageInfo.imageCreator = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaSerialNumber = null; - ImageInfo.mediaBarcode = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - ADiskCRCHasFailed = false; - SectorsWhereCRCHasFailed = new List<ulong>(); - } - - public override bool IdentifyImage(Filter imageFilter) - { - header = new TD0Header(); - byte[] headerBytes = new byte[12]; - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - stream.Read(headerBytes, 0, 12); - - header.signature = BitConverter.ToUInt16(headerBytes, 0); - - if(header.signature != tdMagic && header.signature != tdAdvCompMagic) - return false; - - header.sequence = headerBytes[2]; - header.diskSet = headerBytes[3]; - header.version = headerBytes[4]; - header.dataRate = headerBytes[5]; - header.driveType = headerBytes[6]; - header.stepping = headerBytes[7]; - header.dosAllocation = headerBytes[8]; - header.sides = headerBytes[9]; - header.crc = BitConverter.ToUInt16(headerBytes, 10); - - byte[] headerBytesForCRC = new byte[10]; - Array.Copy(headerBytes, headerBytesForCRC, 10); - ushort calculatedHeaderCRC = TeleDiskCRC(0x0000, headerBytesForCRC); - - DicConsole.DebugWriteLine("TeleDisk plugin", "header.signature = 0x{0:X4}", header.signature); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.sequence = 0x{0:X2}", header.sequence); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.diskSet = 0x{0:X2}", header.diskSet); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.version = 0x{0:X2}", header.version); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.dataRate = 0x{0:X2}", header.dataRate); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.driveType = 0x{0:X2}", header.driveType); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.stepping = 0x{0:X2}", header.stepping); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.dosAllocation = 0x{0:X2}", header.dosAllocation); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.sides = 0x{0:X2}", header.sides); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.crc = 0x{0:X4}", header.crc); - DicConsole.DebugWriteLine("TeleDisk plugin", "calculated header crc = 0x{0:X4}", calculatedHeaderCRC); - - // We need more checks as the magic is too simply. - // This may deny legal images - - // That would be much of a coincidence - if(header.crc == calculatedHeaderCRC) - return true; - - if(header.sequence != 0x00) - return false; - - if(header.dataRate != DataRate250kbps && header.dataRate != DataRate300kbps && header.dataRate != DataRate500kbps) - return false; - - if(header.driveType != DriveType35DD && header.driveType != DriveType35ED && header.driveType != DriveType35HD && header.driveType != DriveType525DD && - header.driveType != DriveType525HD && header.driveType != DriveType525HD_DDDisk && header.driveType != DriveType8inch) - return false; - - return true; - } - - public override bool OpenImage(Filter imageFilter) - { - header = new TD0Header(); - byte[] headerBytes = new byte[12]; - inStream = imageFilter.GetDataForkStream(); - MemoryStream stream = new MemoryStream(); - inStream.Seek(0, SeekOrigin.Begin); - - inStream.Read(headerBytes, 0, 12); - stream.Write(headerBytes, 0, 12); - - header.signature = BitConverter.ToUInt16(headerBytes, 0); - - if(header.signature != tdMagic && header.signature != tdAdvCompMagic) - return false; - - header.sequence = headerBytes[2]; - header.diskSet = headerBytes[3]; - header.version = headerBytes[4]; - header.dataRate = headerBytes[5]; - header.driveType = headerBytes[6]; - header.stepping = headerBytes[7]; - header.dosAllocation = headerBytes[8]; - header.sides = headerBytes[9]; - header.crc = BitConverter.ToUInt16(headerBytes, 10); - - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.imageVersion = string.Format("{0}.{1}", (header.version & 0xF0) >> 4, header.version & 0x0F); - ImageInfo.imageApplication = ImageInfo.imageVersion; - - byte[] headerBytesForCRC = new byte[10]; - Array.Copy(headerBytes, headerBytesForCRC, 10); - ushort calculatedHeaderCRC = TeleDiskCRC(0x0000, headerBytesForCRC); - - DicConsole.DebugWriteLine("TeleDisk plugin", "header.signature = 0x{0:X4}", header.signature); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.sequence = 0x{0:X2}", header.sequence); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.diskSet = 0x{0:X2}", header.diskSet); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.version = 0x{0:X2}", header.version); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.dataRate = 0x{0:X2}", header.dataRate); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.driveType = 0x{0:X2}", header.driveType); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.stepping = 0x{0:X2}", header.stepping); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.dosAllocation = 0x{0:X2}", header.dosAllocation); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.sides = 0x{0:X2}", header.sides); - DicConsole.DebugWriteLine("TeleDisk plugin", "header.crc = 0x{0:X4}", header.crc); - DicConsole.DebugWriteLine("TeleDisk plugin", "calculated header crc = 0x{0:X4}", calculatedHeaderCRC); - - // We need more checks as the magic is too simply. - // This may deny legal images - - // That would be much of a coincidence - if(header.crc != calculatedHeaderCRC) - { - ADiskCRCHasFailed = true; - DicConsole.DebugWriteLine("TeleDisk plugin", "Calculated CRC does not coincide with stored one."); - } - - if(header.sequence != 0x00) - return false; - - if(header.dataRate != DataRate250kbps && header.dataRate != DataRate300kbps && header.dataRate != DataRate500kbps) - return false; - - if(header.driveType != DriveType35DD && header.driveType != DriveType35ED && header.driveType != DriveType35HD && header.driveType != DriveType525DD && - header.driveType != DriveType525HD && header.driveType != DriveType525HD_DDDisk && header.driveType != DriveType8inch) - return false; - - if(header.signature == tdAdvCompMagic) - { - int rd; - byte[] obuf = new byte[BUFSZ]; - inStream.Seek(12, SeekOrigin.Begin); - stream.Seek(12, SeekOrigin.Begin); - init_Decode(); - do - { - if((rd = Decode(out obuf, BUFSZ)) > 0) - stream.Write(obuf, 0, rd); - } while(rd == BUFSZ); - } - else - { - // Not using Stream.CopyTo() because it's failing with LZIP - byte[] copybuf = new byte[inStream.Length]; - inStream.Seek(0, SeekOrigin.Begin); - inStream.Read(copybuf, 0, copybuf.Length); - stream.Seek(0, SeekOrigin.Begin); - stream.Write(copybuf, 0, copybuf.Length); - copybuf = null; - } - - stream.Seek(12, SeekOrigin.Begin); - - ImageInfo.imageCreationTime = DateTime.MinValue; - - if((header.stepping & CommentBlockPresent) == CommentBlockPresent) - { - commentHeader = new TDCommentBlockHeader(); - - byte[] commentHeaderBytes = new byte[10]; - byte[] commentBlockForCRC; - - stream.Read(commentHeaderBytes, 0, 10); - commentHeader.crc = BitConverter.ToUInt16(commentHeaderBytes, 0); - commentHeader.length = BitConverter.ToUInt16(commentHeaderBytes, 2); - commentHeader.year = commentHeaderBytes[4]; - commentHeader.month = commentHeaderBytes[5]; - commentHeader.day = commentHeaderBytes[6]; - commentHeader.hour = commentHeaderBytes[7]; - commentHeader.minute = commentHeaderBytes[8]; - commentHeader.second = commentHeaderBytes[9]; - - commentBlock = new byte[commentHeader.length]; - stream.Read(commentBlock, 0, commentHeader.length); - - commentBlockForCRC = new byte[commentHeader.length + 8]; - Array.Copy(commentHeaderBytes, 2, commentBlockForCRC, 0, 8); - Array.Copy(commentBlock, 0, commentBlockForCRC, 8, commentHeader.length); - - ushort cmtcrc = TeleDiskCRC(0, commentBlockForCRC); - - DicConsole.DebugWriteLine("TeleDisk plugin", "Comment header"); - DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.crc = 0x{0:X4}", commentHeader.crc); - DicConsole.DebugWriteLine("TeleDisk plugin", "\tCalculated CRC = 0x{0:X4}", cmtcrc); - DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.length = {0} bytes", commentHeader.length); - DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.year = {0}", commentHeader.year); - DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.month = {0}", commentHeader.month); - DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.day = {0}", commentHeader.day); - DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.hour = {0}", commentHeader.hour); - DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.minute = {0}", commentHeader.minute); - DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.second = {0}", commentHeader.second); - - ADiskCRCHasFailed |= cmtcrc != commentHeader.crc; - - for(int i = 0; i < commentBlock.Length; i++) - { - // Replace NULLs, used by TeleDisk as newline markers, with UNIX newline marker - if(commentBlock[i] == 0x00) - commentBlock[i] = 0x0A; - } - - ImageInfo.imageComments = System.Text.Encoding.ASCII.GetString(commentBlock); - - DicConsole.DebugWriteLine("TeleDisk plugin", "Comment"); - DicConsole.DebugWriteLine("TeleDisk plugin", "{0}", ImageInfo.imageComments); - - ImageInfo.imageCreationTime = new DateTime(commentHeader.year + 1900, commentHeader.month + 1, commentHeader.day, - commentHeader.hour, commentHeader.minute, commentHeader.second, DateTimeKind.Unspecified); - } - - if(ImageInfo.imageCreationTime == DateTime.MinValue) - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - - DicConsole.DebugWriteLine("TeleDisk plugin", "Image created on {0}", ImageInfo.imageCreationTime); - DicConsole.DebugWriteLine("TeleDisk plugin", "Image modified on {0}", ImageInfo.imageLastModificationTime); - - DicConsole.DebugWriteLine("TeleDisk plugin", "Parsing image"); - - totalDiskSize = 0; - ImageInfo.imageSize = 0; - - int totalCylinders = -1; - int totalHeads = -1; - int maxSector = -1; - int totalSectors = 0; - long currentPos = stream.Position; - ImageInfo.sectorSize = uint.MaxValue; - ImageInfo.sectorsPerTrack = uint.MaxValue; - - // Count cylinders - while(true) - { - TDTrackHeader TDTrack = new TDTrackHeader(); - - TDTrack.sectors = (byte)stream.ReadByte(); - TDTrack.cylinder = (byte)stream.ReadByte(); - TDTrack.head = (byte)stream.ReadByte(); - TDTrack.crc = (byte)stream.ReadByte(); - - if(TDTrack.cylinder > totalCylinders) - totalCylinders = TDTrack.cylinder; - if(TDTrack.head > totalHeads) - totalHeads = TDTrack.head; - - if(TDTrack.sectors == 0xFF) // End of disk image - break; - - for(byte processedSectors = 0; processedSectors < TDTrack.sectors; processedSectors++) - { - TDSectorHeader TDSector = new TDSectorHeader(); - TDDataHeader TDData = new TDDataHeader(); - byte[] dataSizeBytes = new byte[2]; - byte[] data; - - TDSector.cylinder = (byte)stream.ReadByte(); - TDSector.head = (byte)stream.ReadByte(); - TDSector.sectorNumber = (byte)stream.ReadByte(); - TDSector.sectorSize = (byte)stream.ReadByte(); - TDSector.flags = (byte)stream.ReadByte(); - TDSector.crc = (byte)stream.ReadByte(); - - if(TDSector.sectorNumber > maxSector) - maxSector = TDSector.sectorNumber; - - if((TDSector.flags & FlagsSectorDataless) != FlagsSectorDataless && (TDSector.flags & FlagsSectorSkipped) != FlagsSectorSkipped) - { - stream.Read(dataSizeBytes, 0, 2); - TDData.dataSize = BitConverter.ToUInt16(dataSizeBytes, 0); - TDData.dataSize--; // Sydex decided to including dataEncoding byte as part of it - TDData.dataEncoding = (byte)stream.ReadByte(); - data = new byte[TDData.dataSize]; - stream.Read(data, 0, TDData.dataSize); - } - - if(128 << TDSector.sectorSize < ImageInfo.sectorSize) - ImageInfo.sectorSize = (uint)(128 << TDSector.sectorSize); - - totalSectors++; - } - } - - totalCylinders++; - totalHeads++; - - if(totalCylinders <= 0 || totalHeads <= 0) - throw new ImageNotSupportedException("No cylinders or heads found"); - - bool hasLeadOutOnHead0 = false; - bool hasLeadOutOnHead1 = false; - ImageInfo.cylinders = (ushort)totalCylinders; - ImageInfo.heads = (byte)totalHeads; - - // Count sectors per track - stream.Seek(currentPos, SeekOrigin.Begin); - while(true) - { - TDTrackHeader TDTrack = new TDTrackHeader(); - - TDTrack.sectors = (byte)stream.ReadByte(); - TDTrack.cylinder = (byte)stream.ReadByte(); - TDTrack.head = (byte)stream.ReadByte(); - TDTrack.crc = (byte)stream.ReadByte(); - - if(TDTrack.sectors == 0xFF) // End of disk image - break; - - if(TDTrack.sectors < ImageInfo.sectorsPerTrack) - { - if(TDTrack.cylinder + 1 == totalCylinders) - { - hasLeadOutOnHead0 |= TDTrack.head == 0; - hasLeadOutOnHead1 |= TDTrack.head == 1; - if(ImageInfo.cylinders == totalCylinders) - ImageInfo.cylinders--; - } - else - ImageInfo.sectorsPerTrack = TDTrack.sectors; - } - for(byte processedSectors = 0; processedSectors < TDTrack.sectors; processedSectors++) - { - TDSectorHeader TDSector = new TDSectorHeader(); - TDDataHeader TDData = new TDDataHeader(); - byte[] dataSizeBytes = new byte[2]; - byte[] data; - - TDSector.cylinder = (byte)stream.ReadByte(); - TDSector.head = (byte)stream.ReadByte(); - TDSector.sectorNumber = (byte)stream.ReadByte(); - TDSector.sectorSize = (byte)stream.ReadByte(); - TDSector.flags = (byte)stream.ReadByte(); - TDSector.crc = (byte)stream.ReadByte(); - - if((TDSector.flags & FlagsSectorDataless) != FlagsSectorDataless && (TDSector.flags & FlagsSectorSkipped) != FlagsSectorSkipped) - { - stream.Read(dataSizeBytes, 0, 2); - TDData.dataSize = BitConverter.ToUInt16(dataSizeBytes, 0); - TDData.dataSize--; // Sydex decided to including dataEncoding byte as part of it - TDData.dataEncoding = (byte)stream.ReadByte(); - data = new byte[TDData.dataSize]; - stream.Read(data, 0, TDData.dataSize); - } - } - } - - sectorsData = new byte[totalCylinders][][][]; - // Total sectors per track - uint[][] spts = new uint[totalCylinders][]; - - DicConsole.DebugWriteLine("TeleDisk plugin", "Found {0} cylinders and {1} heads with a maximum sector number of {2}", totalCylinders, totalHeads, maxSector); - - // Create heads - for(int i = 0; i < totalCylinders; i++) - { - sectorsData[i] = new byte[totalHeads][][]; - spts[i] = new uint[totalHeads]; - - for(int j = 0; j < totalHeads; j++) - sectorsData[i][j] = new byte[maxSector + 1][]; - } - - // Decode the image - stream.Seek(currentPos, SeekOrigin.Begin); - while(true) - { - TDTrackHeader TDTrack = new TDTrackHeader(); - byte[] TDTrackForCRC = new byte[3]; - byte TDTrackCalculatedCRC; - - TDTrack.sectors = (byte)stream.ReadByte(); - TDTrack.cylinder = (byte)stream.ReadByte(); - TDTrack.head = (byte)stream.ReadByte(); - TDTrack.crc = (byte)stream.ReadByte(); - - TDTrackForCRC[0] = TDTrack.sectors; - TDTrackForCRC[1] = TDTrack.cylinder; - TDTrackForCRC[2] = TDTrack.head; - - TDTrackCalculatedCRC = (byte)(TeleDiskCRC(0, TDTrackForCRC) & 0xFF); - - DicConsole.DebugWriteLine("TeleDisk plugin", "Track follows"); - DicConsole.DebugWriteLine("TeleDisk plugin", "\tTrack cylinder: {0}\t", TDTrack.cylinder); - DicConsole.DebugWriteLine("TeleDisk plugin", "\tTrack head: {0}\t", TDTrack.head); - DicConsole.DebugWriteLine("TeleDisk plugin", "\tSectors in track: {0}\t", TDTrack.sectors); - DicConsole.DebugWriteLine("TeleDisk plugin", "\tTrack header CRC: 0x{0:X2} (calculated 0x{1:X2})\t", TDTrack.crc, TDTrackCalculatedCRC); - - ADiskCRCHasFailed |= TDTrackCalculatedCRC != TDTrack.crc; - - if(TDTrack.sectors == 0xFF) // End of disk image - { - DicConsole.DebugWriteLine("TeleDisk plugin", "End of disk image arrived"); - DicConsole.DebugWriteLine("TeleDisk plugin", "Total of {0} data sectors, for {1} bytes", totalSectors, totalDiskSize); - - break; - } - - for(byte processedSectors = 0; processedSectors < TDTrack.sectors; processedSectors++) - { - TDSectorHeader TDSector = new TDSectorHeader(); - TDDataHeader TDData = new TDDataHeader(); - byte[] dataSizeBytes = new byte[2]; - byte[] data; - byte[] decodedData; - - TDSector.cylinder = (byte)stream.ReadByte(); - TDSector.head = (byte)stream.ReadByte(); - TDSector.sectorNumber = (byte)stream.ReadByte(); - TDSector.sectorSize = (byte)stream.ReadByte(); - TDSector.flags = (byte)stream.ReadByte(); - TDSector.crc = (byte)stream.ReadByte(); - - DicConsole.DebugWriteLine("TeleDisk plugin", "\tSector follows"); - DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tAddressMark cylinder: {0}", TDSector.cylinder); - DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tAddressMark head: {0}", TDSector.head); - DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tAddressMark sector number: {0}", TDSector.sectorNumber); - DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tSector size: {0}", TDSector.sectorSize); - DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tSector flags: 0x{0:X2}", TDSector.flags); - DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tSector CRC (plus headers): 0x{0:X2}", TDSector.crc); - - uint LBA = (uint)((TDSector.cylinder * header.sides * ImageInfo.sectorsPerTrack) + (TDSector.head * ImageInfo.sectorsPerTrack) + (TDSector.sectorNumber - 1)); - if((TDSector.flags & FlagsSectorDataless) != FlagsSectorDataless && (TDSector.flags & FlagsSectorSkipped) != FlagsSectorSkipped) - { - stream.Read(dataSizeBytes, 0, 2); - TDData.dataSize = BitConverter.ToUInt16(dataSizeBytes, 0); - TDData.dataSize--; // Sydex decided to including dataEncoding byte as part of it - ImageInfo.imageSize += TDData.dataSize; - TDData.dataEncoding = (byte)stream.ReadByte(); - data = new byte[TDData.dataSize]; - stream.Read(data, 0, TDData.dataSize); - DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tData size (in-image): {0}", TDData.dataSize); - DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tData encoding: 0x{0:X2}", TDData.dataEncoding); - - decodedData = DecodeTeleDiskData(TDSector.sectorSize, TDData.dataEncoding, data); - - byte TDSectorCalculatedCRC = (byte)(TeleDiskCRC(0, decodedData) & 0xFF); - - if(TDSectorCalculatedCRC != TDSector.crc) - { - DicConsole.DebugWriteLine("TeleDisk plugin", "Sector {0}:{3}:{4} calculated CRC 0x{1:X2} differs from stored CRC 0x{2:X2}", TDTrack.cylinder, TDSectorCalculatedCRC, TDSector.crc, TDTrack.cylinder, TDSector.sectorNumber); - if((TDSector.flags & FlagsSectorNoID) != FlagsSectorNoID) - SectorsWhereCRCHasFailed.Add(LBA); - } - } - else - decodedData = new byte[128 << TDSector.sectorSize]; - - DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tLBA: {0}", LBA); - - if((TDSector.flags & FlagsSectorNoID) != FlagsSectorNoID) - { - if(sectorsData[TDTrack.cylinder][TDTrack.head][TDSector.sectorNumber] != null) - { - if((TDSector.flags & FlagsSectorDuplicate) == FlagsSectorDuplicate) - { - DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tSector {0} on cylinder {1} head {2} is duplicate, and marked so", - TDSector.sectorNumber, TDSector.cylinder, TDSector.head); - } - else - { - DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tSector {0} on cylinder {1} head {2} is duplicate, but is not marked so", - TDSector.sectorNumber, TDSector.cylinder, TDSector.head); - } - } - else - { - sectorsData[TDTrack.cylinder][TDTrack.head][TDSector.sectorNumber] = decodedData; - totalDiskSize += (uint)decodedData.Length; - } - } - } - } - - MemoryStream leadOutMs = new MemoryStream(); - if(hasLeadOutOnHead0) - { - for(int i = 0; i < sectorsData[totalCylinders - 1][0].Length; i++) - { - if(sectorsData[totalCylinders - 1][0][i] != null) - leadOutMs.Write(sectorsData[totalCylinders - 1][0][i], 0, sectorsData[totalCylinders - 1][0][i].Length); - } - } - if(hasLeadOutOnHead1) - { - for(int i = 0; i < sectorsData[totalCylinders - 1][1].Length; i++) - { - if(sectorsData[totalCylinders - 1][1][i] != null) - leadOutMs.Write(sectorsData[totalCylinders - 1][1][i], 0, sectorsData[totalCylinders - 1][1][i].Length); - } - } - if(leadOutMs.Length != 0) - { - leadOut = leadOutMs.ToArray(); - ImageInfo.readableMediaTags.Add(MediaTagType.Floppy_LeadOut); - } - - ImageInfo.sectors = ImageInfo.cylinders * ImageInfo.heads * ImageInfo.sectorsPerTrack; - ImageInfo.mediaType = DecodeTeleDiskDiskType(); - - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - - DicConsole.VerboseWriteLine("TeleDisk image contains a disk of type {0}", ImageInfo.mediaType); - if(!string.IsNullOrEmpty(ImageInfo.imageComments)) - DicConsole.VerboseWriteLine("TeleDisk comments: {0}", ImageInfo.imageComments); - - inStream.Dispose(); - stream.Dispose(); - - /* - FileStream debugFs = new FileStream("debug.img", FileMode.CreateNew, FileAccess.Write); - for(ulong i = 0; i < ImageInfo.sectors; i++) - debugFs.Write(ReadSector(i), 0, (int)ImageInfo.sectorSize); - debugFs.Dispose(); - */ - - return true; - } - - public override bool ImageHasPartitions() - { - return ImageInfo.imageHasPartitions; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - (ushort cylinder, byte head, byte sector) = LbaToChs(sectorAddress); - - if(cylinder >= sectorsData.Length) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(head >= sectorsData[cylinder].Length) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sector > sectorsData[cylinder][head].Length) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - return sectorsData[cylinder][head][sector]; - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - MemoryStream buffer = new MemoryStream(); - for(uint i = 0; i < length; i++) - { - byte[] sector = ReadSector(sectorAddress + i); - if(sector == null) - sector = new byte[ImageInfo.sectorSize]; - buffer.Write(sector, 0, sector.Length); - } - - return buffer.ToArray(); - } - - (ushort cylinder, byte head, byte sector) LbaToChs(ulong lba) - { - ushort cylinder = (ushort)(lba / (ImageInfo.heads * ImageInfo.sectorsPerTrack)); - byte head = (byte)((lba / ImageInfo.sectorsPerTrack) % ImageInfo.heads); - byte sector = (byte)((lba % ImageInfo.sectorsPerTrack) + 1); - - return (cylinder, head, sector); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - return ReadSectors(sectorAddress, length); - } - - public override string GetImageFormat() - { - return "Sydex TeleDisk"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - public override bool? VerifySector(ulong sectorAddress) - { - return !SectorsWhereCRCHasFailed.Contains(sectorAddress); - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - if(SectorsWhereCRCHasFailed.Contains(sectorAddress)) - FailingLBAs.Add(sectorAddress); - - return FailingLBAs.Count <= 0; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); - - return null; - } - - public override bool? VerifyMediaImage() - { - return ADiskCRCHasFailed; - } - - #region Private methods - - static ushort TeleDiskCRC(ushort crc, byte[] buffer) - { - int counter = 0; - - while(counter < buffer.Length) - { - crc ^= (ushort)((buffer[counter] & 0xFF) << 8); - - for(int i = 0; i < 8; i++) - { - if((crc & 0x8000) > 0) - crc = (ushort)((crc << 1) ^ TeleDiskCRCPoly); - else - crc = (ushort)(crc << 1); - } - - counter++; - } - - return crc; - } - - static byte[] DecodeTeleDiskData(byte sectorSize, byte encodingType, byte[] encodedData) - { - byte[] decodedData; - switch(sectorSize) - { - case SectorSize128: - decodedData = new byte[128]; - break; - case SectorSize256: - decodedData = new byte[256]; - break; - case SectorSize512: - decodedData = new byte[512]; - break; - case SectorSize1K: - decodedData = new byte[1024]; - break; - case SectorSize2K: - decodedData = new byte[2048]; - break; - case SectorSize4K: - decodedData = new byte[4096]; - break; - case SectorSize8K: - decodedData = new byte[8192]; - break; - default: - throw new ImageNotSupportedException(string.Format("Sector size {0} is incorrect.", sectorSize)); - } - - switch(encodingType) - { - case dataBlockCopy: - Array.Copy(encodedData, decodedData, decodedData.Length); - break; - case dataBlockPattern: - { - int ins = 0; - int outs = 0; - while(ins < encodedData.Length) - { - ushort repeatNumber; - byte[] repeatValue = new byte[2]; - - repeatNumber = BitConverter.ToUInt16(encodedData, ins); - Array.Copy(encodedData, ins + 2, repeatValue, 0, 2); - byte[] decodedPiece = new byte[repeatNumber * 2]; - ArrayHelpers.ArrayFill(decodedPiece, repeatValue); - Array.Copy(decodedPiece, 0, decodedData, outs, decodedPiece.Length); - ins += 4; - outs += decodedPiece.Length; - } - - DicConsole.DebugWriteLine("TeleDisk plugin", "(Block pattern decoder): Input data size: {0} bytes", encodedData.Length); - DicConsole.DebugWriteLine("TeleDisk plugin", "(Block pattern decoder): Processed input: {0} bytes", ins); - DicConsole.DebugWriteLine("TeleDisk plugin", "(Block pattern decoder): Output data size: {0} bytes", decodedData.Length); - DicConsole.DebugWriteLine("TeleDisk plugin", "(Block pattern decoder): Processed Output: {0} bytes", outs); - break; - } - case dataBlockRLE: - { - int ins = 0; - int outs = 0; - while(ins < encodedData.Length) - { - byte Run; - byte Length; - byte Encoding; - byte[] Piece; - - Encoding = encodedData[ins]; - if(Encoding == 0x00) - { - Length = encodedData[ins + 1]; - Array.Copy(encodedData, ins + 2, decodedData, outs, Length); - ins += (2 + Length); - outs += Length; - } - else - { - Length = (byte)(Encoding * 2); - Run = encodedData[ins + 1]; - byte[] Part = new byte[Length]; - Array.Copy(encodedData, ins + 2, Part, 0, Length); - Piece = new byte[Length * Run]; - ArrayHelpers.ArrayFill(Piece, Part); - Array.Copy(Piece, 0, decodedData, outs, Piece.Length); - ins += (2 + Length); - outs += Piece.Length; - } - } - - DicConsole.DebugWriteLine("TeleDisk plugin", "(RLE decoder): Input data size: {0} bytes", encodedData.Length); - DicConsole.DebugWriteLine("TeleDisk plugin", "(RLE decoder): Processed input: {0} bytes", ins); - DicConsole.DebugWriteLine("TeleDisk plugin", "(RLE decoder): Output data size: {0} bytes", decodedData.Length); - DicConsole.DebugWriteLine("TeleDisk plugin", "(RLE decoder): Processed Output: {0} bytes", outs); - - break; - } - default: - throw new ImageNotSupportedException(string.Format("Data encoding {0} is incorrect.", encodingType)); - } - - return decodedData; - } - - MediaType DecodeTeleDiskDiskType() - { - switch(header.driveType) - { - case DriveType525DD: - case DriveType525HD_DDDisk: - case DriveType525HD: - { - switch(totalDiskSize) - { - case 163840: - { - // Acorn disk uses 256 bytes/sector - if(ImageInfo.sectorSize == 256) - return MediaType.ACORN_525_SS_DD_40; - // DOS disks use 512 bytes/sector - return MediaType.DOS_525_SS_DD_8; - } - case 184320: - { - // Atari disk uses 256 bytes/sector - if(ImageInfo.sectorSize == 256) - return MediaType.ATARI_525_DD; - // DOS disks use 512 bytes/sector - return MediaType.DOS_525_SS_DD_9; - } - case 327680: - { - // Acorn disk uses 256 bytes/sector - if(ImageInfo.sectorSize == 256) - return MediaType.ACORN_525_SS_DD_80; - // DOS disks use 512 bytes/sector - return MediaType.DOS_525_DS_DD_8; - } - case 368640: - return MediaType.DOS_525_DS_DD_9; - case 1228800: - return MediaType.DOS_525_HD; - case 102400: - return MediaType.ACORN_525_SS_SD_40; - case 204800: - return MediaType.ACORN_525_SS_SD_80; - case 655360: - return MediaType.ACORN_525_DS_DD; - case 92160: - return MediaType.ATARI_525_SD; - case 133120: - return MediaType.ATARI_525_ED; - case 1310720: - return MediaType.NEC_525_HD; - case 1261568: - return MediaType.SHARP_525; - case 839680: - return MediaType.FDFORMAT_525_DD; - case 1304320: - return MediaType.ECMA_99_8; - case 1223424: - return MediaType.ECMA_99_15; - case 1061632: - return MediaType.ECMA_99_26; - case 80384: - return MediaType.ECMA_66; - case 325632: - return MediaType.ECMA_70; - case 653312: - return MediaType.ECMA_78; - case 737280: - return MediaType.ECMA_78_2; - default: - { - DicConsole.DebugWriteLine("TeleDisk plugin", "Unknown 5,25\" disk with {0} bytes", totalDiskSize); - return MediaType.Unknown; - } - } - } - case DriveType35DD: - case DriveType35ED: - case DriveType35HD: - { - switch(totalDiskSize) - { - case 322560: - return MediaType.Apricot_35; - case 327680: - return MediaType.DOS_35_SS_DD_8; - case 368640: - return MediaType.DOS_35_SS_DD_9; - case 655360: - return MediaType.DOS_35_DS_DD_8; - case 737280: - return MediaType.DOS_35_DS_DD_9; - case 1474560: - return MediaType.DOS_35_HD; - case 2949120: - return MediaType.DOS_35_ED; - case 1720320: - return MediaType.DMF; - case 1763328: - return MediaType.DMF_82; - case 1884160: // Irreal size, seen as BIOS with TSR, 23 sectors/track - case 1860608: // Real data size, sum of all sectors - return MediaType.XDF_35; - case 819200: - return MediaType.CBM_35_DD; - case 901120: - return MediaType.CBM_AMIGA_35_DD; - case 1802240: - return MediaType.CBM_AMIGA_35_HD; - case 1310720: - return MediaType.NEC_35_HD_8; - case 1228800: - return MediaType.NEC_35_HD_15; - case 1261568: - return MediaType.SHARP_35; - default: - { - DicConsole.DebugWriteLine("TeleDisk plugin", "Unknown 3,5\" disk with {0} bytes", totalDiskSize); - return MediaType.Unknown; - } - } - } - case DriveType8inch: - { - switch(totalDiskSize) - { - case 81664: - return MediaType.IBM23FD; - case 242944: - return MediaType.IBM33FD_128; - case 287488: - return MediaType.IBM33FD_256; - case 306432: - return MediaType.IBM33FD_512; - case 499200: - return MediaType.IBM43FD_128; - case 574976: - return MediaType.IBM43FD_256; - case 995072: - return MediaType.IBM53FD_256; - case 1146624: - return MediaType.IBM53FD_512; - case 1222400: - return MediaType.IBM53FD_1024; - case 256256: - // Same size, with same disk geometry, for DEC RX01, NEC and ECMA, return ECMA - return MediaType.ECMA_54; - case 512512: - { - // DEC disk uses 256 bytes/sector - if(ImageInfo.sectorSize == 256) - return MediaType.RX02; - // ECMA disks use 128 bytes/sector - return MediaType.ECMA_59; - } - case 1261568: - return MediaType.NEC_8_DD; - case 1255168: - return MediaType.ECMA_69_8; - case 1177344: - return MediaType.ECMA_69_15; - case 1021696: - return MediaType.ECMA_69_26; - default: - { - DicConsole.DebugWriteLine("TeleDisk plugin", "Unknown 8\" disk with {0} bytes", totalDiskSize); - return MediaType.Unknown; - } - } - } - default: - { - DicConsole.DebugWriteLine("TeleDisk plugin", "Unknown drive type {1} with {0} bytes", totalDiskSize, header.driveType); - return MediaType.Unknown; - } - - } - } - - public override byte[] ReadDiskTag(MediaTagType tag) - { - if(tag == MediaTagType.Floppy_LeadOut) - { - if(leadOut != null) - return leadOut; - throw new FeatureNotPresentImageException("Lead-out not present in disk image"); - } - else - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - #endregion - - #region Unsupported features - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override string GetMediaManufacturer() - { - return ImageInfo.mediaManufacturer; - } - - public override string GetMediaModel() - { - return ImageInfo.mediaModel; - } - - public override string GetMediaSerialNumber() - { - return ImageInfo.mediaSerialNumber; - } - - public override string GetMediaBarcode() - { - return ImageInfo.mediaBarcode; - } - - public override string GetMediaPartNumber() - { - return ImageInfo.mediaPartNumber; - } - - public override int GetMediaSequence() - { - return ImageInfo.mediaSequence; - } - - public override int GetLastDiskSequence() - { - return ImageInfo.lastMediaSequence; - } - - public override string GetDriveManufacturer() - { - return ImageInfo.driveManufacturer; - } - - public override string GetDriveModel() - { - return ImageInfo.driveModel; - } - - public override string GetDriveSerialNumber() - { - return ImageInfo.driveSerialNumber; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - #endregion Unsupported features - - #region LZH decompression from MAME - /* This region is under following license: - * Copyright © 2017 Miodrag Milanovic - * Adapted to C#, Copyright © 2017 Natalia Portillo - * - * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - /* - * Based on Japanese version 29-NOV-1988 - * LZSS coded by Haruhiko OKUMURA - * Adaptive Huffman Coding coded by Haruyasu YOSHIZAKI - * Edited and translated to English by Kenji RIKITAKE - */ - - const int BUFSZ = 512; - - /* LZSS Parameters */ - - const int N = 4096; /* Size of string buffer */ - const int F = 60; /* Size of look-ahead buffer */ - const int THRESHOLD = 2; - const int NIL = N; /* End of tree's node */ - - /* Huffman coding parameters */ - - const int N_CHAR = (256 - THRESHOLD + F); - /* character code (= 0..N_CHAR-1) */ - const int T = (N_CHAR * 2 - 1); /* Size of table */ - const int R = (T - 1); /* root position */ - const int MAX_FREQ = 0x8000; - /* update when cumulative frequency */ - /* reaches to this value */ - - struct tdlzhuf - { - public ushort r, - bufcnt, bufndx, bufpos, // string buffer - // the following to allow block reads from input in next_word() - ibufcnt, ibufndx; // input buffer counters - public byte[] inbuf; // input buffer - }; - - tdlzhuf tdctl; - byte[] text_buf = new byte[N + F - 1]; - ushort[] freq = new ushort[T + 1]; /* cumulative freq table */ - - /* - * pointing parent nodes. - * area [T..(T + N_CHAR - 1)] are pointers for leaves - */ - short[] prnt = new short[T + N_CHAR]; - - /* pointing children nodes (son[], son[] + 1)*/ - short[] son = new short[T]; - - ushort getbuf; - byte getlen; - - long data_read(out byte[] buf, long size) - { - if(size > inStream.Length - inStream.Position) - size = inStream.Length - inStream.Position; - - buf = new byte[size]; - inStream.Read(buf, 0, (int)size); - return size; - } - - /* - * Tables for encoding/decoding upper 6 bits of - * sliding dictionary pointer - */ - - /* decoder table */ - readonly byte[] d_code = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, - 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, - 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, - 0x0E, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F, - 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, - 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, - 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, - 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, - 0x18, 0x18, 0x19, 0x19, 0x1A, 0x1A, 0x1B, 0x1B, - 0x1C, 0x1C, 0x1D, 0x1D, 0x1E, 0x1E, 0x1F, 0x1F, - 0x20, 0x20, 0x21, 0x21, 0x22, 0x22, 0x23, 0x23, - 0x24, 0x24, 0x25, 0x25, 0x26, 0x26, 0x27, 0x27, - 0x28, 0x28, 0x29, 0x29, 0x2A, 0x2A, 0x2B, 0x2B, - 0x2C, 0x2C, 0x2D, 0x2D, 0x2E, 0x2E, 0x2F, 0x2F, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, - }; - - readonly byte[] d_len = { - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - }; - - int next_word() - { - if(tdctl.ibufndx >= tdctl.ibufcnt) - { - tdctl.ibufndx = 0; - tdctl.ibufcnt = (ushort)data_read(out tdctl.inbuf, BUFSZ); - if(tdctl.ibufcnt <= 0) - return (-1); - } - while(getlen <= 8) - { // typically reads a word at a time - getbuf |= (ushort)(tdctl.inbuf[tdctl.ibufndx++] << (8 - getlen)); - getlen += 8; - } - return (0); - } - - int GetBit() /* get one bit */ - { - short i; - if(next_word() < 0) - return (-1); - i = (short)getbuf; - getbuf <<= 1; - getlen--; - if(i < 0) - return (1); - else - return (0); - } - - int GetByte() /* get a byte */ - { - ushort i; - if(next_word() != 0) - return (-1); - i = getbuf; - getbuf <<= 8; - getlen -= 8; - i = (ushort)(i >> 8); - return ((int)i); - } - - /* initialize freq tree */ - - void StartHuff() - { - int i, j; - - for(i = 0; i < N_CHAR; i++) - { - freq[i] = 1; - son[i] = (short)(i + T); - prnt[i + T] = (short)i; - } - i = 0; j = N_CHAR; - while(j <= R) - { - freq[j] = (ushort)(freq[i] + freq[i + 1]); - son[j] = (short)i; - prnt[i] = prnt[i + 1] = (short)j; - i += 2; j++; - } - freq[T] = 0xffff; - prnt[R] = 0; - } - - /* reconstruct freq tree */ - - void reconst() - { - short i, j, k; - ushort f, l; - - /* halven cumulative freq for leaf nodes */ - j = 0; - for(i = 0; i < T; i++) - { - if(son[i] >= T) - { - freq[j] = (ushort)((freq[i] + 1) / 2); - son[j] = son[i]; - j++; - } - } - /* make a tree : first, connect children nodes */ - for(i = 0, j = N_CHAR; j < T; i += 2, j++) - { - k = (short)(i + 1); - f = freq[j] = (ushort)(freq[i] + freq[k]); - for(k = (short)(j - 1); f < freq[k]; k--) { }; - k++; - l = (ushort)((j - k) * 2); - - - Array.ConstrainedCopy(freq, k, freq, k + 1, l); - freq[k] = f; - Array.ConstrainedCopy(son, k, son, k + 1, l); - son[k] = i; - } - /* connect parent nodes */ - for(i = 0; i < T; i++) - { - if((k = son[i]) >= T) - { - prnt[k] = i; - } - else - { - prnt[k] = prnt[k + 1] = i; - } - } - } - - /* update freq tree */ - - void update(int c) - { - int i, j, k, l; - - if(freq[R] == MAX_FREQ) - { - reconst(); - } - c = prnt[c + T]; - do - { - k = ++freq[c]; - - /* swap nodes to keep the tree freq-ordered */ - if(k > freq[l = c + 1]) - { - while(k > freq[++l]) { }; - l--; - freq[c] = freq[l]; - freq[l] = (ushort)k; - - i = son[c]; - prnt[i] = (short)l; - if(i < T) prnt[i + 1] = (short)l; - - j = son[l]; - son[l] = (short)i; - - prnt[j] = (short)c; - if(j < T) prnt[j + 1] = (short)c; - son[c] = (short)j; - - c = l; - } - } while((c = prnt[c]) != 0); /* do it until reaching the root */ - } - - short DecodeChar() - { - int ret; - ushort c; - - c = (ushort)son[R]; - - /* - * start searching tree from the root to leaves. - * choose node #(son[]) if input bit == 0 - * else choose #(son[]+1) (input bit == 1) - */ - while(c < T) - { - if((ret = GetBit()) < 0) - return (-1); - c += (ushort)ret; - c = (ushort)son[c]; - } - c -= T; - update(c); - return (short)c; - } - - short DecodePosition() - { - short bit; - ushort i, j, c; - - /* decode upper 6 bits from given table */ - if((bit = (short)GetByte()) < 0) - return (-1); - i = (ushort)bit; - c = (ushort)(d_code[i] << 6); - j = d_len[i]; - - /* input lower 6 bits directly */ - j -= 2; - while(j-- > 0) - { - if((bit = (short)GetBit()) < 0) - return (-1); - i = (ushort)((i << 1) + bit); - } - return (short)(c | (i & 0x3f)); - } - - /* DeCompression - - split out initialization code to init_Decode() - - */ - - void init_Decode() - { - int i; - getbuf = 0; - getlen = 0; - tdctl = new tdlzhuf(); - tdctl.ibufcnt = tdctl.ibufndx = 0; // input buffer is empty - tdctl.bufcnt = 0; - StartHuff(); - for(i = 0; i < N - F; i++) - text_buf[i] = 0x20; - tdctl.r = N - F; - } - - int Decode(out byte[] buf, int len) /* Decoding/Uncompressing */ - { - short c, pos; - buf = new byte[len]; - int count; // was an unsigned long, seems unnecessary - for(count = 0; count < len;) - { - if(tdctl.bufcnt == 0) - { - if((c = DecodeChar()) < 0) - return (count); // fatal error - if(c < 256) - { - buf[count] = (byte)c; - text_buf[tdctl.r++] = (byte)c; - tdctl.r &= (N - 1); - count++; - } - else - { - if((pos = DecodePosition()) < 0) - return (count); // fatal error - tdctl.bufpos = (ushort)((tdctl.r - pos - 1) & (N - 1)); - tdctl.bufcnt = (ushort)(c - 255 + THRESHOLD); - tdctl.bufndx = 0; - } - } - else - { // still chars from last string - while(tdctl.bufndx < tdctl.bufcnt && count < len) - { - c = text_buf[(tdctl.bufpos + tdctl.bufndx) & (N - 1)]; - buf[count] = (byte)c; - tdctl.bufndx++; - text_buf[tdctl.r++] = (byte)c; - tdctl.r &= (N - 1); - count++; - } - // reset bufcnt after copy string from text_buf[] - if(tdctl.bufndx >= tdctl.bufcnt) - tdctl.bufndx = tdctl.bufcnt = 0; - } - } - return (count); // count == len, success - } - #endregion LZH decompression from MAME - } + // Created following notes from Dave Dunfield + // http://www.classiccmp.org/dunfield/img54306/td0notes.txt + public class TeleDisk : ImagePlugin + { + #region Internal Structures + struct TD0Header + { + /// <summary>"TD" or "td" depending on compression</summary> + public ushort signature; + /// <summary>Sequence, but TeleDisk seems to complaing if != 0</summary> + public byte sequence; + /// <summary>Random, same byte for all disks in the same set</summary> + public byte diskSet; + /// <summary>TeleDisk version, major in high nibble, minor in low nibble</summary> + public byte version; + /// <summary>Data rate</summary> + public byte dataRate; + /// <summary>BIOS drive type</summary> + public byte driveType; + /// <summary>Stepping used</summary> + public byte stepping; + /// <summary>If set means image only allocates sectors marked in-use by FAT12</summary> + public byte dosAllocation; + /// <summary>Sides of disk</summary> + public byte sides; + /// <summary>CRC of all the previous</summary> + public ushort crc; + } + + struct TDCommentBlockHeader + { + /// <summary>CRC of comment block after crc field</summary> + public ushort crc; + /// <summary>Length of comment</summary> + public ushort length; + public byte year; + public byte month; + public byte day; + public byte hour; + public byte minute; + public byte second; + } + + struct TDTrackHeader + { + /// <summary>Sectors in the track, 0xFF if end of disk image (there is no spoon)</summary> + public byte sectors; + /// <summary>Cylinder the head was on</summary> + public byte cylinder; + /// <summary>Head/side used</summary> + public byte head; + /// <summary>Lower byte of CRC of previous fields</summary> + public byte crc; + } + + struct TDSectorHeader + { + /// <summary>Cylinder as stored on sector address mark</summary> + public byte cylinder; + /// <summary>Head as stored on sector address mark</summary> + public byte head; + /// <summary>Sector number as stored on sector address mark</summary> + public byte sectorNumber; + /// <summary>Sector size</summary> + public byte sectorSize; + /// <summary>Sector flags</summary> + public byte flags; + /// <summary>Lower byte of TeleDisk CRC of sector header, data header and data block</summary> + public byte crc; + } + + struct TDDataHeader + { + /// <summary>Size of all data (encoded) + next field (1)</summary> + public ushort dataSize; + /// <summary>Encoding used for data block</summary> + public byte dataEncoding; + } + #endregion + + #region Internal Constants + // "TD" as little endian uint. + const ushort tdMagic = 0x4454; + // "td" as little endian uint. Means whole file is compressed (aka Advanced Compression) + const ushort tdAdvCompMagic = 0x6474; + + // DataRates + const byte DataRate250kbps = 0x00; + const byte DataRate300kbps = 0x01; + const byte DataRate500kbps = 0x02; + + // TeleDisk drive types + const byte DriveType525HD_DDDisk = 0x00; + const byte DriveType525HD = 0x01; + const byte DriveType525DD = 0x02; + const byte DriveType35DD = 0x03; + const byte DriveType35HD = 0x04; + const byte DriveType8inch = 0x05; + const byte DriveType35ED = 0x06; + + // Stepping + const byte SteppingSingle = 0x00; + const byte SteppingDouble = 0x01; + const byte SteppingEvenOnly = 0x02; + // If this bit is set, there is a comment block + const byte CommentBlockPresent = 0x80; + + // CRC polynomial + const ushort TeleDiskCRCPoly = 0xA097; + + // Sector sizes table + const byte SectorSize128 = 0x00; + const byte SectorSize256 = 0x01; + const byte SectorSize512 = 0x02; + const byte SectorSize1K = 0x03; + const byte SectorSize2K = 0x04; + const byte SectorSize4K = 0x05; + const byte SectorSize8K = 0x06; + + // Flags + // Address mark repeats inside same track + const byte FlagsSectorDuplicate = 0x01; + // Sector gave CRC error on reading + const byte FlagsSectorCRCError = 0x02; + // Address mark indicates deleted sector + const byte FlagsSectorDeleted = 0x04; + // Sector skipped as FAT said it's unused + const byte FlagsSectorSkipped = 0x10; + // There was an address mark, but no data following + const byte FlagsSectorDataless = 0x20; + // There was data without address mark + const byte FlagsSectorNoID = 0x40; + + // Data block encodings + // Data is copied as is + const byte dataBlockCopy = 0x00; + // Data is encoded as a pair of len.value uint16s + const byte dataBlockPattern = 0x01; + // Data is encoded as RLE + const byte dataBlockRLE = 0x02; + #endregion + + #region Internal variables + TD0Header header; + TDCommentBlockHeader commentHeader; + byte[] commentBlock; + // LBA, data + uint totalDiskSize; + bool ADiskCRCHasFailed; + List<ulong> SectorsWhereCRCHasFailed; + // Cylinder by head, sector data matrix + byte[][][][] sectorsData; + Stream inStream; + byte[] leadOut; + #endregion + + public TeleDisk() + { + Name = "Sydex TeleDisk"; + PluginUUID = new Guid("0240B7B1-E959-4CDC-B0BD-386D6E467B88"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = false; + ImageInfo.imageHasSessions = false; + ImageInfo.imageApplication = "Sydex TeleDisk"; + ImageInfo.imageComments = null; + ImageInfo.imageCreator = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaSerialNumber = null; + ImageInfo.mediaBarcode = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + ADiskCRCHasFailed = false; + SectorsWhereCRCHasFailed = new List<ulong>(); + } + + public override bool IdentifyImage(Filter imageFilter) + { + header = new TD0Header(); + byte[] headerBytes = new byte[12]; + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + stream.Read(headerBytes, 0, 12); + + header.signature = BitConverter.ToUInt16(headerBytes, 0); + + if(header.signature != tdMagic && header.signature != tdAdvCompMagic) return false; + + header.sequence = headerBytes[2]; + header.diskSet = headerBytes[3]; + header.version = headerBytes[4]; + header.dataRate = headerBytes[5]; + header.driveType = headerBytes[6]; + header.stepping = headerBytes[7]; + header.dosAllocation = headerBytes[8]; + header.sides = headerBytes[9]; + header.crc = BitConverter.ToUInt16(headerBytes, 10); + + byte[] headerBytesForCRC = new byte[10]; + Array.Copy(headerBytes, headerBytesForCRC, 10); + ushort calculatedHeaderCRC = TeleDiskCRC(0x0000, headerBytesForCRC); + + DicConsole.DebugWriteLine("TeleDisk plugin", "header.signature = 0x{0:X4}", header.signature); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.sequence = 0x{0:X2}", header.sequence); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.diskSet = 0x{0:X2}", header.diskSet); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.version = 0x{0:X2}", header.version); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.dataRate = 0x{0:X2}", header.dataRate); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.driveType = 0x{0:X2}", header.driveType); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.stepping = 0x{0:X2}", header.stepping); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.dosAllocation = 0x{0:X2}", header.dosAllocation); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.sides = 0x{0:X2}", header.sides); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.crc = 0x{0:X4}", header.crc); + DicConsole.DebugWriteLine("TeleDisk plugin", "calculated header crc = 0x{0:X4}", calculatedHeaderCRC); + + // We need more checks as the magic is too simply. + // This may deny legal images + + // That would be much of a coincidence + if(header.crc == calculatedHeaderCRC) return true; + + if(header.sequence != 0x00) return false; + + if(header.dataRate != DataRate250kbps && header.dataRate != DataRate300kbps && + header.dataRate != DataRate500kbps) return false; + + if(header.driveType != DriveType35DD && header.driveType != DriveType35ED && + header.driveType != DriveType35HD && header.driveType != DriveType525DD && + header.driveType != DriveType525HD && header.driveType != DriveType525HD_DDDisk && + header.driveType != DriveType8inch) return false; + + return true; + } + + public override bool OpenImage(Filter imageFilter) + { + header = new TD0Header(); + byte[] headerBytes = new byte[12]; + inStream = imageFilter.GetDataForkStream(); + MemoryStream stream = new MemoryStream(); + inStream.Seek(0, SeekOrigin.Begin); + + inStream.Read(headerBytes, 0, 12); + stream.Write(headerBytes, 0, 12); + + header.signature = BitConverter.ToUInt16(headerBytes, 0); + + if(header.signature != tdMagic && header.signature != tdAdvCompMagic) return false; + + header.sequence = headerBytes[2]; + header.diskSet = headerBytes[3]; + header.version = headerBytes[4]; + header.dataRate = headerBytes[5]; + header.driveType = headerBytes[6]; + header.stepping = headerBytes[7]; + header.dosAllocation = headerBytes[8]; + header.sides = headerBytes[9]; + header.crc = BitConverter.ToUInt16(headerBytes, 10); + + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.imageVersion = string.Format("{0}.{1}", (header.version & 0xF0) >> 4, header.version & 0x0F); + ImageInfo.imageApplication = ImageInfo.imageVersion; + + byte[] headerBytesForCRC = new byte[10]; + Array.Copy(headerBytes, headerBytesForCRC, 10); + ushort calculatedHeaderCRC = TeleDiskCRC(0x0000, headerBytesForCRC); + + DicConsole.DebugWriteLine("TeleDisk plugin", "header.signature = 0x{0:X4}", header.signature); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.sequence = 0x{0:X2}", header.sequence); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.diskSet = 0x{0:X2}", header.diskSet); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.version = 0x{0:X2}", header.version); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.dataRate = 0x{0:X2}", header.dataRate); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.driveType = 0x{0:X2}", header.driveType); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.stepping = 0x{0:X2}", header.stepping); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.dosAllocation = 0x{0:X2}", header.dosAllocation); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.sides = 0x{0:X2}", header.sides); + DicConsole.DebugWriteLine("TeleDisk plugin", "header.crc = 0x{0:X4}", header.crc); + DicConsole.DebugWriteLine("TeleDisk plugin", "calculated header crc = 0x{0:X4}", calculatedHeaderCRC); + + // We need more checks as the magic is too simply. + // This may deny legal images + + // That would be much of a coincidence + if(header.crc != calculatedHeaderCRC) + { + ADiskCRCHasFailed = true; + DicConsole.DebugWriteLine("TeleDisk plugin", "Calculated CRC does not coincide with stored one."); + } + + if(header.sequence != 0x00) return false; + + if(header.dataRate != DataRate250kbps && header.dataRate != DataRate300kbps && + header.dataRate != DataRate500kbps) return false; + + if(header.driveType != DriveType35DD && header.driveType != DriveType35ED && + header.driveType != DriveType35HD && header.driveType != DriveType525DD && + header.driveType != DriveType525HD && header.driveType != DriveType525HD_DDDisk && + header.driveType != DriveType8inch) return false; + + if(header.signature == tdAdvCompMagic) + { + int rd; + byte[] obuf = new byte[BUFSZ]; + inStream.Seek(12, SeekOrigin.Begin); + stream.Seek(12, SeekOrigin.Begin); + init_Decode(); + do { if((rd = Decode(out obuf, BUFSZ)) > 0) stream.Write(obuf, 0, rd); } + while(rd == BUFSZ); + } + else + { + // Not using Stream.CopyTo() because it's failing with LZIP + byte[] copybuf = new byte[inStream.Length]; + inStream.Seek(0, SeekOrigin.Begin); + inStream.Read(copybuf, 0, copybuf.Length); + stream.Seek(0, SeekOrigin.Begin); + stream.Write(copybuf, 0, copybuf.Length); + copybuf = null; + } + + stream.Seek(12, SeekOrigin.Begin); + + ImageInfo.imageCreationTime = DateTime.MinValue; + + if((header.stepping & CommentBlockPresent) == CommentBlockPresent) + { + commentHeader = new TDCommentBlockHeader(); + + byte[] commentHeaderBytes = new byte[10]; + byte[] commentBlockForCRC; + + stream.Read(commentHeaderBytes, 0, 10); + commentHeader.crc = BitConverter.ToUInt16(commentHeaderBytes, 0); + commentHeader.length = BitConverter.ToUInt16(commentHeaderBytes, 2); + commentHeader.year = commentHeaderBytes[4]; + commentHeader.month = commentHeaderBytes[5]; + commentHeader.day = commentHeaderBytes[6]; + commentHeader.hour = commentHeaderBytes[7]; + commentHeader.minute = commentHeaderBytes[8]; + commentHeader.second = commentHeaderBytes[9]; + + commentBlock = new byte[commentHeader.length]; + stream.Read(commentBlock, 0, commentHeader.length); + + commentBlockForCRC = new byte[commentHeader.length + 8]; + Array.Copy(commentHeaderBytes, 2, commentBlockForCRC, 0, 8); + Array.Copy(commentBlock, 0, commentBlockForCRC, 8, commentHeader.length); + + ushort cmtcrc = TeleDiskCRC(0, commentBlockForCRC); + + DicConsole.DebugWriteLine("TeleDisk plugin", "Comment header"); + DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.crc = 0x{0:X4}", commentHeader.crc); + DicConsole.DebugWriteLine("TeleDisk plugin", "\tCalculated CRC = 0x{0:X4}", cmtcrc); + DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.length = {0} bytes", + commentHeader.length); + DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.year = {0}", commentHeader.year); + DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.month = {0}", commentHeader.month); + DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.day = {0}", commentHeader.day); + DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.hour = {0}", commentHeader.hour); + DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.minute = {0}", commentHeader.minute); + DicConsole.DebugWriteLine("TeleDisk plugin", "\tcommentheader.second = {0}", commentHeader.second); + + ADiskCRCHasFailed |= cmtcrc != commentHeader.crc; + + for(int i = 0; i < commentBlock.Length; i++) + { + // Replace NULLs, used by TeleDisk as newline markers, with UNIX newline marker + if(commentBlock[i] == 0x00) commentBlock[i] = 0x0A; + } + + ImageInfo.imageComments = System.Text.Encoding.ASCII.GetString(commentBlock); + + DicConsole.DebugWriteLine("TeleDisk plugin", "Comment"); + DicConsole.DebugWriteLine("TeleDisk plugin", "{0}", ImageInfo.imageComments); + + ImageInfo.imageCreationTime = new DateTime(commentHeader.year + 1900, commentHeader.month + 1, + commentHeader.day, commentHeader.hour, commentHeader.minute, + commentHeader.second, DateTimeKind.Unspecified); + } + + if(ImageInfo.imageCreationTime == DateTime.MinValue) + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + + DicConsole.DebugWriteLine("TeleDisk plugin", "Image created on {0}", ImageInfo.imageCreationTime); + DicConsole.DebugWriteLine("TeleDisk plugin", "Image modified on {0}", ImageInfo.imageLastModificationTime); + + DicConsole.DebugWriteLine("TeleDisk plugin", "Parsing image"); + + totalDiskSize = 0; + ImageInfo.imageSize = 0; + + int totalCylinders = -1; + int totalHeads = -1; + int maxSector = -1; + int totalSectors = 0; + long currentPos = stream.Position; + ImageInfo.sectorSize = uint.MaxValue; + ImageInfo.sectorsPerTrack = uint.MaxValue; + + // Count cylinders + while(true) + { + TDTrackHeader TDTrack = new TDTrackHeader(); + + TDTrack.sectors = (byte)stream.ReadByte(); + TDTrack.cylinder = (byte)stream.ReadByte(); + TDTrack.head = (byte)stream.ReadByte(); + TDTrack.crc = (byte)stream.ReadByte(); + + if(TDTrack.cylinder > totalCylinders) totalCylinders = TDTrack.cylinder; + if(TDTrack.head > totalHeads) totalHeads = TDTrack.head; + + if(TDTrack.sectors == 0xFF) // End of disk image + break; + + for(byte processedSectors = 0; processedSectors < TDTrack.sectors; processedSectors++) + { + TDSectorHeader TDSector = new TDSectorHeader(); + TDDataHeader TDData = new TDDataHeader(); + byte[] dataSizeBytes = new byte[2]; + byte[] data; + + TDSector.cylinder = (byte)stream.ReadByte(); + TDSector.head = (byte)stream.ReadByte(); + TDSector.sectorNumber = (byte)stream.ReadByte(); + TDSector.sectorSize = (byte)stream.ReadByte(); + TDSector.flags = (byte)stream.ReadByte(); + TDSector.crc = (byte)stream.ReadByte(); + + if(TDSector.sectorNumber > maxSector) maxSector = TDSector.sectorNumber; + + if((TDSector.flags & FlagsSectorDataless) != FlagsSectorDataless && + (TDSector.flags & FlagsSectorSkipped) != FlagsSectorSkipped) + { + stream.Read(dataSizeBytes, 0, 2); + TDData.dataSize = BitConverter.ToUInt16(dataSizeBytes, 0); + TDData.dataSize--; // Sydex decided to including dataEncoding byte as part of it + TDData.dataEncoding = (byte)stream.ReadByte(); + data = new byte[TDData.dataSize]; + stream.Read(data, 0, TDData.dataSize); + } + + if(128 << TDSector.sectorSize < ImageInfo.sectorSize) + ImageInfo.sectorSize = (uint)(128 << TDSector.sectorSize); + + totalSectors++; + } + } + + totalCylinders++; + totalHeads++; + + if(totalCylinders <= 0 || totalHeads <= 0) + throw new ImageNotSupportedException("No cylinders or heads found"); + + bool hasLeadOutOnHead0 = false; + bool hasLeadOutOnHead1 = false; + ImageInfo.cylinders = (ushort)totalCylinders; + ImageInfo.heads = (byte)totalHeads; + + // Count sectors per track + stream.Seek(currentPos, SeekOrigin.Begin); + while(true) + { + TDTrackHeader TDTrack = new TDTrackHeader(); + + TDTrack.sectors = (byte)stream.ReadByte(); + TDTrack.cylinder = (byte)stream.ReadByte(); + TDTrack.head = (byte)stream.ReadByte(); + TDTrack.crc = (byte)stream.ReadByte(); + + if(TDTrack.sectors == 0xFF) // End of disk image + break; + + if(TDTrack.sectors < ImageInfo.sectorsPerTrack) + { + if(TDTrack.cylinder + 1 == totalCylinders) + { + hasLeadOutOnHead0 |= TDTrack.head == 0; + hasLeadOutOnHead1 |= TDTrack.head == 1; + if(ImageInfo.cylinders == totalCylinders) ImageInfo.cylinders--; + } + else ImageInfo.sectorsPerTrack = TDTrack.sectors; + } + for(byte processedSectors = 0; processedSectors < TDTrack.sectors; processedSectors++) + { + TDSectorHeader TDSector = new TDSectorHeader(); + TDDataHeader TDData = new TDDataHeader(); + byte[] dataSizeBytes = new byte[2]; + byte[] data; + + TDSector.cylinder = (byte)stream.ReadByte(); + TDSector.head = (byte)stream.ReadByte(); + TDSector.sectorNumber = (byte)stream.ReadByte(); + TDSector.sectorSize = (byte)stream.ReadByte(); + TDSector.flags = (byte)stream.ReadByte(); + TDSector.crc = (byte)stream.ReadByte(); + + if((TDSector.flags & FlagsSectorDataless) != FlagsSectorDataless && + (TDSector.flags & FlagsSectorSkipped) != FlagsSectorSkipped) + { + stream.Read(dataSizeBytes, 0, 2); + TDData.dataSize = BitConverter.ToUInt16(dataSizeBytes, 0); + TDData.dataSize--; // Sydex decided to including dataEncoding byte as part of it + TDData.dataEncoding = (byte)stream.ReadByte(); + data = new byte[TDData.dataSize]; + stream.Read(data, 0, TDData.dataSize); + } + } + } + + sectorsData = new byte[totalCylinders][][][]; + // Total sectors per track + uint[][] spts = new uint[totalCylinders][]; + + DicConsole.DebugWriteLine("TeleDisk plugin", + "Found {0} cylinders and {1} heads with a maximum sector number of {2}", + totalCylinders, totalHeads, maxSector); + + // Create heads + for(int i = 0; i < totalCylinders; i++) + { + sectorsData[i] = new byte[totalHeads][][]; + spts[i] = new uint[totalHeads]; + + for(int j = 0; j < totalHeads; j++) sectorsData[i][j] = new byte[maxSector + 1][]; + } + + // Decode the image + stream.Seek(currentPos, SeekOrigin.Begin); + while(true) + { + TDTrackHeader TDTrack = new TDTrackHeader(); + byte[] TDTrackForCRC = new byte[3]; + byte TDTrackCalculatedCRC; + + TDTrack.sectors = (byte)stream.ReadByte(); + TDTrack.cylinder = (byte)stream.ReadByte(); + TDTrack.head = (byte)stream.ReadByte(); + TDTrack.crc = (byte)stream.ReadByte(); + + TDTrackForCRC[0] = TDTrack.sectors; + TDTrackForCRC[1] = TDTrack.cylinder; + TDTrackForCRC[2] = TDTrack.head; + + TDTrackCalculatedCRC = (byte)(TeleDiskCRC(0, TDTrackForCRC) & 0xFF); + + DicConsole.DebugWriteLine("TeleDisk plugin", "Track follows"); + DicConsole.DebugWriteLine("TeleDisk plugin", "\tTrack cylinder: {0}\t", TDTrack.cylinder); + DicConsole.DebugWriteLine("TeleDisk plugin", "\tTrack head: {0}\t", TDTrack.head); + DicConsole.DebugWriteLine("TeleDisk plugin", "\tSectors in track: {0}\t", TDTrack.sectors); + DicConsole.DebugWriteLine("TeleDisk plugin", "\tTrack header CRC: 0x{0:X2} (calculated 0x{1:X2})\t", + TDTrack.crc, TDTrackCalculatedCRC); + + ADiskCRCHasFailed |= TDTrackCalculatedCRC != TDTrack.crc; + + if(TDTrack.sectors == 0xFF) // End of disk image + { + DicConsole.DebugWriteLine("TeleDisk plugin", "End of disk image arrived"); + DicConsole.DebugWriteLine("TeleDisk plugin", "Total of {0} data sectors, for {1} bytes", + totalSectors, totalDiskSize); + + break; + } + + for(byte processedSectors = 0; processedSectors < TDTrack.sectors; processedSectors++) + { + TDSectorHeader TDSector = new TDSectorHeader(); + TDDataHeader TDData = new TDDataHeader(); + byte[] dataSizeBytes = new byte[2]; + byte[] data; + byte[] decodedData; + + TDSector.cylinder = (byte)stream.ReadByte(); + TDSector.head = (byte)stream.ReadByte(); + TDSector.sectorNumber = (byte)stream.ReadByte(); + TDSector.sectorSize = (byte)stream.ReadByte(); + TDSector.flags = (byte)stream.ReadByte(); + TDSector.crc = (byte)stream.ReadByte(); + + DicConsole.DebugWriteLine("TeleDisk plugin", "\tSector follows"); + DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tAddressMark cylinder: {0}", TDSector.cylinder); + DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tAddressMark head: {0}", TDSector.head); + DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tAddressMark sector number: {0}", + TDSector.sectorNumber); + DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tSector size: {0}", TDSector.sectorSize); + DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tSector flags: 0x{0:X2}", TDSector.flags); + DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tSector CRC (plus headers): 0x{0:X2}", + TDSector.crc); + + uint LBA = (uint)((TDSector.cylinder * header.sides * ImageInfo.sectorsPerTrack) + + (TDSector.head * ImageInfo.sectorsPerTrack) + (TDSector.sectorNumber - 1)); + if((TDSector.flags & FlagsSectorDataless) != FlagsSectorDataless && + (TDSector.flags & FlagsSectorSkipped) != FlagsSectorSkipped) + { + stream.Read(dataSizeBytes, 0, 2); + TDData.dataSize = BitConverter.ToUInt16(dataSizeBytes, 0); + TDData.dataSize--; // Sydex decided to including dataEncoding byte as part of it + ImageInfo.imageSize += TDData.dataSize; + TDData.dataEncoding = (byte)stream.ReadByte(); + data = new byte[TDData.dataSize]; + stream.Read(data, 0, TDData.dataSize); + DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tData size (in-image): {0}", TDData.dataSize); + DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tData encoding: 0x{0:X2}", + TDData.dataEncoding); + + decodedData = DecodeTeleDiskData(TDSector.sectorSize, TDData.dataEncoding, data); + + byte TDSectorCalculatedCRC = (byte)(TeleDiskCRC(0, decodedData) & 0xFF); + + if(TDSectorCalculatedCRC != TDSector.crc) + { + DicConsole.DebugWriteLine("TeleDisk plugin", + "Sector {0}:{3}:{4} calculated CRC 0x{1:X2} differs from stored CRC 0x{2:X2}", + TDTrack.cylinder, TDSectorCalculatedCRC, TDSector.crc, + TDTrack.cylinder, TDSector.sectorNumber); + if((TDSector.flags & FlagsSectorNoID) != FlagsSectorNoID) SectorsWhereCRCHasFailed.Add(LBA); + } + } + else decodedData = new byte[128 << TDSector.sectorSize]; + + DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tLBA: {0}", LBA); + + if((TDSector.flags & FlagsSectorNoID) != FlagsSectorNoID) + { + if(sectorsData[TDTrack.cylinder][TDTrack.head][TDSector.sectorNumber] != null) + { + if((TDSector.flags & FlagsSectorDuplicate) == FlagsSectorDuplicate) + { + DicConsole.DebugWriteLine("TeleDisk plugin", + "\t\tSector {0} on cylinder {1} head {2} is duplicate, and marked so", + TDSector.sectorNumber, TDSector.cylinder, TDSector.head); + } + else + { + DicConsole.DebugWriteLine("TeleDisk plugin", + "\t\tSector {0} on cylinder {1} head {2} is duplicate, but is not marked so", + TDSector.sectorNumber, TDSector.cylinder, TDSector.head); + } + } + else + { + sectorsData[TDTrack.cylinder][TDTrack.head][TDSector.sectorNumber] = decodedData; + totalDiskSize += (uint)decodedData.Length; + } + } + } + } + + MemoryStream leadOutMs = new MemoryStream(); + if(hasLeadOutOnHead0) + { + for(int i = 0; i < sectorsData[totalCylinders - 1][0].Length; i++) + { + if(sectorsData[totalCylinders - 1][0][i] != null) + leadOutMs.Write(sectorsData[totalCylinders - 1][0][i], 0, + sectorsData[totalCylinders - 1][0][i].Length); + } + } + if(hasLeadOutOnHead1) + { + for(int i = 0; i < sectorsData[totalCylinders - 1][1].Length; i++) + { + if(sectorsData[totalCylinders - 1][1][i] != null) + leadOutMs.Write(sectorsData[totalCylinders - 1][1][i], 0, + sectorsData[totalCylinders - 1][1][i].Length); + } + } + + if(leadOutMs.Length != 0) + { + leadOut = leadOutMs.ToArray(); + ImageInfo.readableMediaTags.Add(MediaTagType.Floppy_LeadOut); + } + + ImageInfo.sectors = ImageInfo.cylinders * ImageInfo.heads * ImageInfo.sectorsPerTrack; + ImageInfo.mediaType = DecodeTeleDiskDiskType(); + + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + + DicConsole.VerboseWriteLine("TeleDisk image contains a disk of type {0}", ImageInfo.mediaType); + if(!string.IsNullOrEmpty(ImageInfo.imageComments)) + DicConsole.VerboseWriteLine("TeleDisk comments: {0}", ImageInfo.imageComments); + + inStream.Dispose(); + stream.Dispose(); + + /* + FileStream debugFs = new FileStream("debug.img", FileMode.CreateNew, FileAccess.Write); + for(ulong i = 0; i < ImageInfo.sectors; i++) + debugFs.Write(ReadSector(i), 0, (int)ImageInfo.sectorSize); + debugFs.Dispose(); + */ + + return true; + } + + public override bool ImageHasPartitions() + { + return ImageInfo.imageHasPartitions; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + (ushort cylinder, byte head, byte sector) = LbaToChs(sectorAddress); + + if(cylinder >= sectorsData.Length) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(head >= sectorsData[cylinder].Length) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sector > sectorsData[cylinder][head].Length) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + return sectorsData[cylinder][head][sector]; + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + MemoryStream buffer = new MemoryStream(); + for(uint i = 0; i < length; i++) + { + byte[] sector = ReadSector(sectorAddress + i); + if(sector == null) sector = new byte[ImageInfo.sectorSize]; + buffer.Write(sector, 0, sector.Length); + } + + return buffer.ToArray(); + } + + (ushort cylinder, byte head, byte sector) LbaToChs(ulong lba) + { + ushort cylinder = (ushort)(lba / (ImageInfo.heads * ImageInfo.sectorsPerTrack)); + byte head = (byte)((lba / ImageInfo.sectorsPerTrack) % ImageInfo.heads); + byte sector = (byte)((lba % ImageInfo.sectorsPerTrack) + 1); + + return (cylinder, head, sector); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + return ReadSectors(sectorAddress, length); + } + + public override string GetImageFormat() + { + return "Sydex TeleDisk"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override bool? VerifySector(ulong sectorAddress) + { + return !SectorsWhereCRCHasFailed.Contains(sectorAddress); + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) + if(SectorsWhereCRCHasFailed.Contains(sectorAddress)) FailingLBAs.Add(sectorAddress); + + return FailingLBAs.Count <= 0; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifyMediaImage() + { + return ADiskCRCHasFailed; + } + + #region Private methods + static ushort TeleDiskCRC(ushort crc, byte[] buffer) + { + int counter = 0; + + while(counter < buffer.Length) + { + crc ^= (ushort)((buffer[counter] & 0xFF) << 8); + + for(int i = 0; i < 8; i++) + { + if((crc & 0x8000) > 0) crc = (ushort)((crc << 1) ^ TeleDiskCRCPoly); + else crc = (ushort)(crc << 1); + } + + counter++; + } + + return crc; + } + + static byte[] DecodeTeleDiskData(byte sectorSize, byte encodingType, byte[] encodedData) + { + byte[] decodedData; + switch(sectorSize) + { + case SectorSize128: + decodedData = new byte[128]; + break; + case SectorSize256: + decodedData = new byte[256]; + break; + case SectorSize512: + decodedData = new byte[512]; + break; + case SectorSize1K: + decodedData = new byte[1024]; + break; + case SectorSize2K: + decodedData = new byte[2048]; + break; + case SectorSize4K: + decodedData = new byte[4096]; + break; + case SectorSize8K: + decodedData = new byte[8192]; + break; + default: + throw new ImageNotSupportedException(string.Format("Sector size {0} is incorrect.", sectorSize)); + } + + switch(encodingType) + { + case dataBlockCopy: + Array.Copy(encodedData, decodedData, decodedData.Length); + break; + case dataBlockPattern: + { + int ins = 0; + int outs = 0; + while(ins < encodedData.Length) + { + ushort repeatNumber; + byte[] repeatValue = new byte[2]; + + repeatNumber = BitConverter.ToUInt16(encodedData, ins); + Array.Copy(encodedData, ins + 2, repeatValue, 0, 2); + byte[] decodedPiece = new byte[repeatNumber * 2]; + ArrayHelpers.ArrayFill(decodedPiece, repeatValue); + Array.Copy(decodedPiece, 0, decodedData, outs, decodedPiece.Length); + ins += 4; + outs += decodedPiece.Length; + } + + DicConsole.DebugWriteLine("TeleDisk plugin", "(Block pattern decoder): Input data size: {0} bytes", + encodedData.Length); + DicConsole.DebugWriteLine("TeleDisk plugin", "(Block pattern decoder): Processed input: {0} bytes", + ins); + DicConsole.DebugWriteLine("TeleDisk plugin", "(Block pattern decoder): Output data size: {0} bytes", + decodedData.Length); + DicConsole.DebugWriteLine("TeleDisk plugin", "(Block pattern decoder): Processed Output: {0} bytes", + outs); + break; + } + case dataBlockRLE: + { + int ins = 0; + int outs = 0; + while(ins < encodedData.Length) + { + byte Run; + byte Length; + byte Encoding; + byte[] Piece; + + Encoding = encodedData[ins]; + if(Encoding == 0x00) + { + Length = encodedData[ins + 1]; + Array.Copy(encodedData, ins + 2, decodedData, outs, Length); + ins += (2 + Length); + outs += Length; + } + else + { + Length = (byte)(Encoding * 2); + Run = encodedData[ins + 1]; + byte[] Part = new byte[Length]; + Array.Copy(encodedData, ins + 2, Part, 0, Length); + Piece = new byte[Length * Run]; + ArrayHelpers.ArrayFill(Piece, Part); + Array.Copy(Piece, 0, decodedData, outs, Piece.Length); + ins += (2 + Length); + outs += Piece.Length; + } + } + + DicConsole.DebugWriteLine("TeleDisk plugin", "(RLE decoder): Input data size: {0} bytes", + encodedData.Length); + DicConsole.DebugWriteLine("TeleDisk plugin", "(RLE decoder): Processed input: {0} bytes", ins); + DicConsole.DebugWriteLine("TeleDisk plugin", "(RLE decoder): Output data size: {0} bytes", + decodedData.Length); + DicConsole.DebugWriteLine("TeleDisk plugin", "(RLE decoder): Processed Output: {0} bytes", outs); + + break; + } + default: + throw new ImageNotSupportedException(string.Format("Data encoding {0} is incorrect.", + encodingType)); + } + + return decodedData; + } + + MediaType DecodeTeleDiskDiskType() + { + switch(header.driveType) + { + case DriveType525DD: + case DriveType525HD_DDDisk: + case DriveType525HD: + { + switch(totalDiskSize) + { + case 163840: + { + // Acorn disk uses 256 bytes/sector + if(ImageInfo.sectorSize == 256) return MediaType.ACORN_525_SS_DD_40; + // DOS disks use 512 bytes/sector + return MediaType.DOS_525_SS_DD_8; + } + case 184320: + { + // Atari disk uses 256 bytes/sector + if(ImageInfo.sectorSize == 256) return MediaType.ATARI_525_DD; + // DOS disks use 512 bytes/sector + return MediaType.DOS_525_SS_DD_9; + } + case 327680: + { + // Acorn disk uses 256 bytes/sector + if(ImageInfo.sectorSize == 256) return MediaType.ACORN_525_SS_DD_80; + // DOS disks use 512 bytes/sector + return MediaType.DOS_525_DS_DD_8; + } + case 368640: return MediaType.DOS_525_DS_DD_9; + case 1228800: return MediaType.DOS_525_HD; + case 102400: return MediaType.ACORN_525_SS_SD_40; + case 204800: return MediaType.ACORN_525_SS_SD_80; + case 655360: return MediaType.ACORN_525_DS_DD; + case 92160: return MediaType.ATARI_525_SD; + case 133120: return MediaType.ATARI_525_ED; + case 1310720: return MediaType.NEC_525_HD; + case 1261568: return MediaType.SHARP_525; + case 839680: return MediaType.FDFORMAT_525_DD; + case 1304320: return MediaType.ECMA_99_8; + case 1223424: return MediaType.ECMA_99_15; + case 1061632: return MediaType.ECMA_99_26; + case 80384: return MediaType.ECMA_66; + case 325632: return MediaType.ECMA_70; + case 653312: return MediaType.ECMA_78; + case 737280: return MediaType.ECMA_78_2; + default: + { + DicConsole.DebugWriteLine("TeleDisk plugin", "Unknown 5,25\" disk with {0} bytes", + totalDiskSize); + return MediaType.Unknown; + } + } + } + case DriveType35DD: + case DriveType35ED: + case DriveType35HD: + { + switch(totalDiskSize) + { + case 322560: return MediaType.Apricot_35; + case 327680: return MediaType.DOS_35_SS_DD_8; + case 368640: return MediaType.DOS_35_SS_DD_9; + case 655360: return MediaType.DOS_35_DS_DD_8; + case 737280: return MediaType.DOS_35_DS_DD_9; + case 1474560: return MediaType.DOS_35_HD; + case 2949120: return MediaType.DOS_35_ED; + case 1720320: return MediaType.DMF; + case 1763328: return MediaType.DMF_82; + case 1884160: // Irreal size, seen as BIOS with TSR, 23 sectors/track + case 1860608: // Real data size, sum of all sectors + return MediaType.XDF_35; + case 819200: return MediaType.CBM_35_DD; + case 901120: return MediaType.CBM_AMIGA_35_DD; + case 1802240: return MediaType.CBM_AMIGA_35_HD; + case 1310720: return MediaType.NEC_35_HD_8; + case 1228800: return MediaType.NEC_35_HD_15; + case 1261568: return MediaType.SHARP_35; + default: + { + DicConsole.DebugWriteLine("TeleDisk plugin", "Unknown 3,5\" disk with {0} bytes", + totalDiskSize); + return MediaType.Unknown; + } + } + } + case DriveType8inch: + { + switch(totalDiskSize) + { + case 81664: return MediaType.IBM23FD; + case 242944: return MediaType.IBM33FD_128; + case 287488: return MediaType.IBM33FD_256; + case 306432: return MediaType.IBM33FD_512; + case 499200: return MediaType.IBM43FD_128; + case 574976: return MediaType.IBM43FD_256; + case 995072: return MediaType.IBM53FD_256; + case 1146624: return MediaType.IBM53FD_512; + case 1222400: return MediaType.IBM53FD_1024; + case 256256: + // Same size, with same disk geometry, for DEC RX01, NEC and ECMA, return ECMA + return MediaType.ECMA_54; + case 512512: + { + // DEC disk uses 256 bytes/sector + if(ImageInfo.sectorSize == 256) return MediaType.RX02; + // ECMA disks use 128 bytes/sector + return MediaType.ECMA_59; + } + case 1261568: return MediaType.NEC_8_DD; + case 1255168: return MediaType.ECMA_69_8; + case 1177344: return MediaType.ECMA_69_15; + case 1021696: return MediaType.ECMA_69_26; + default: + { + DicConsole.DebugWriteLine("TeleDisk plugin", "Unknown 8\" disk with {0} bytes", + totalDiskSize); + return MediaType.Unknown; + } + } + } + default: + { + DicConsole.DebugWriteLine("TeleDisk plugin", "Unknown drive type {1} with {0} bytes", totalDiskSize, + header.driveType); + return MediaType.Unknown; + } + } + } + + public override byte[] ReadDiskTag(MediaTagType tag) + { + if(tag == MediaTagType.Floppy_LeadOut) + { + if(leadOut != null) return leadOut; + + throw new FeatureNotPresentImageException("Lead-out not present in disk image"); + } + else throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + #endregion + + #region Unsupported features + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override string GetMediaManufacturer() + { + return ImageInfo.mediaManufacturer; + } + + public override string GetMediaModel() + { + return ImageInfo.mediaModel; + } + + public override string GetMediaSerialNumber() + { + return ImageInfo.mediaSerialNumber; + } + + public override string GetMediaBarcode() + { + return ImageInfo.mediaBarcode; + } + + public override string GetMediaPartNumber() + { + return ImageInfo.mediaPartNumber; + } + + public override int GetMediaSequence() + { + return ImageInfo.mediaSequence; + } + + public override int GetLastDiskSequence() + { + return ImageInfo.lastMediaSequence; + } + + public override string GetDriveManufacturer() + { + return ImageInfo.driveManufacturer; + } + + public override string GetDriveModel() + { + return ImageInfo.driveModel; + } + + public override string GetDriveSerialNumber() + { + return ImageInfo.driveSerialNumber; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + #endregion Unsupported features + + #region LZH decompression from MAME + /* This region is under following license: + * Copyright © 2017 Miodrag Milanovic + * Adapted to C#, Copyright © 2017 Natalia Portillo + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /* + * Based on Japanese version 29-NOV-1988 + * LZSS coded by Haruhiko OKUMURA + * Adaptive Huffman Coding coded by Haruyasu YOSHIZAKI + * Edited and translated to English by Kenji RIKITAKE + */ + + const int BUFSZ = 512; + + /* LZSS Parameters */ + + const int N = 4096; /* Size of string buffer */ + const int F = 60; /* Size of look-ahead buffer */ + const int THRESHOLD = 2; + const int NIL = N; /* End of tree's node */ + + /* Huffman coding parameters */ + + const int N_CHAR = (256 - THRESHOLD + F); + /* character code (= 0..N_CHAR-1) */ + const int T = (N_CHAR * 2 - 1); /* Size of table */ + const int R = (T - 1); /* root position */ + const int MAX_FREQ = 0x8000; + /* update when cumulative frequency */ + /* reaches to this value */ + + struct tdlzhuf + { + public ushort r, + bufcnt, + bufndx, + bufpos, // string buffer + // the following to allow block reads from input in next_word() + ibufcnt, + ibufndx; // input buffer counters + public byte[] inbuf; // input buffer + }; + + tdlzhuf tdctl; + byte[] text_buf = new byte[N + F - 1]; + ushort[] freq = new ushort[T + 1]; /* cumulative freq table */ + + /* + * pointing parent nodes. + * area [T..(T + N_CHAR - 1)] are pointers for leaves + */ + short[] prnt = new short[T + N_CHAR]; + + /* pointing children nodes (son[], son[] + 1)*/ + short[] son = new short[T]; + + ushort getbuf; + byte getlen; + + long data_read(out byte[] buf, long size) + { + if(size > inStream.Length - inStream.Position) size = inStream.Length - inStream.Position; + + buf = new byte[size]; + inStream.Read(buf, 0, (int)size); + return size; + } + + /* + * Tables for encoding/decoding upper 6 bits of + * sliding dictionary pointer + */ + + /* decoder table */ + readonly byte[] d_code = + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x09, 0x09, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0E, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F, 0x10, 0x10, + 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 0x14, 0x14, 0x14, 0x14, + 0x15, 0x15, 0x15, 0x15, 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, 0x18, 0x18, 0x19, 0x19, 0x1A, 0x1A, + 0x1B, 0x1B, 0x1C, 0x1C, 0x1D, 0x1D, 0x1E, 0x1E, 0x1F, 0x1F, 0x20, 0x20, 0x21, 0x21, 0x22, 0x22, 0x23, 0x23, + 0x24, 0x24, 0x25, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x29, 0x2A, 0x2A, 0x2B, 0x2B, 0x2C, 0x2C, + 0x2D, 0x2D, 0x2E, 0x2E, 0x2F, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, + 0x3C, 0x3D, 0x3E, 0x3F, + }; + + readonly byte[] d_len = + { + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, + }; + + int next_word() + { + if(tdctl.ibufndx >= tdctl.ibufcnt) + { + tdctl.ibufndx = 0; + tdctl.ibufcnt = (ushort)data_read(out tdctl.inbuf, BUFSZ); + if(tdctl.ibufcnt <= 0) return (-1); + } + + while(getlen <= 8) + { + // typically reads a word at a time + getbuf |= (ushort)(tdctl.inbuf[tdctl.ibufndx++] << (8 - getlen)); + getlen += 8; + } + + return (0); + } + + int GetBit() /* get one bit */ + { + short i; + if(next_word() < 0) return (-1); + + i = (short)getbuf; + getbuf <<= 1; + getlen--; + if(i < 0) return (1); + else return (0); + } + + int GetByte() /* get a byte */ + { + ushort i; + if(next_word() != 0) return (-1); + + i = getbuf; + getbuf <<= 8; + getlen -= 8; + i = (ushort)(i >> 8); + return ((int)i); + } + + /* initialize freq tree */ + + void StartHuff() + { + int i, j; + + for(i = 0; i < N_CHAR; i++) + { + freq[i] = 1; + son[i] = (short)(i + T); + prnt[i + T] = (short)i; + } + + i = 0; + j = N_CHAR; + while(j <= R) + { + freq[j] = (ushort)(freq[i] + freq[i + 1]); + son[j] = (short)i; + prnt[i] = prnt[i + 1] = (short)j; + i += 2; + j++; + } + + freq[T] = 0xffff; + prnt[R] = 0; + } + + /* reconstruct freq tree */ + + void reconst() + { + short i, j, k; + ushort f, l; + + /* halven cumulative freq for leaf nodes */ + j = 0; + for(i = 0; i < T; i++) + { + if(son[i] >= T) + { + freq[j] = (ushort)((freq[i] + 1) / 2); + son[j] = son[i]; + j++; + } + } + /* make a tree : first, connect children nodes */ + for(i = 0, j = N_CHAR; j < T; i += 2, j++) + { + k = (short)(i + 1); + f = freq[j] = (ushort)(freq[i] + freq[k]); + for(k = (short)(j - 1); f < freq[k]; k--) { } + + ; + k++; + l = (ushort)((j - k) * 2); + + Array.ConstrainedCopy(freq, k, freq, k + 1, l); + freq[k] = f; + Array.ConstrainedCopy(son, k, son, k + 1, l); + son[k] = i; + } + /* connect parent nodes */ + for(i = 0; i < T; i++) + { + if((k = son[i]) >= T) { prnt[k] = i; } + else { prnt[k] = prnt[k + 1] = i; } + } + } + + /* update freq tree */ + + void update(int c) + { + int i, j, k, l; + + if(freq[R] == MAX_FREQ) { reconst(); } + c = prnt[c + T]; + do + { + k = ++freq[c]; + + /* swap nodes to keep the tree freq-ordered */ + if(k > freq[l = c + 1]) + { + while(k > freq[++l]) { } + + ; + l--; + freq[c] = freq[l]; + freq[l] = (ushort)k; + + i = son[c]; + prnt[i] = (short)l; + if(i < T) prnt[i + 1] = (short)l; + + j = son[l]; + son[l] = (short)i; + + prnt[j] = (short)c; + if(j < T) prnt[j + 1] = (short)c; + son[c] = (short)j; + + c = l; + } + } + while((c = prnt[c]) != 0); /* do it until reaching the root */ + } + + short DecodeChar() + { + int ret; + ushort c; + + c = (ushort)son[R]; + + /* + * start searching tree from the root to leaves. + * choose node #(son[]) if input bit == 0 + * else choose #(son[]+1) (input bit == 1) + */ + while(c < T) + { + if((ret = GetBit()) < 0) return (-1); + + c += (ushort)ret; + c = (ushort)son[c]; + } + + c -= T; + update(c); + return (short)c; + } + + short DecodePosition() + { + short bit; + ushort i, j, c; + + /* decode upper 6 bits from given table */ + if((bit = (short)GetByte()) < 0) return (-1); + + i = (ushort)bit; + c = (ushort)(d_code[i] << 6); + j = d_len[i]; + + /* input lower 6 bits directly */ + j -= 2; + while(j-- > 0) + { + if((bit = (short)GetBit()) < 0) return (-1); + + i = (ushort)((i << 1) + bit); + } + + return (short)(c | (i & 0x3f)); + } + + /* DeCompression + + split out initialization code to init_Decode() + + */ + + void init_Decode() + { + int i; + getbuf = 0; + getlen = 0; + tdctl = new tdlzhuf(); + tdctl.ibufcnt = tdctl.ibufndx = 0; // input buffer is empty + tdctl.bufcnt = 0; + StartHuff(); + for(i = 0; i < N - F; i++) text_buf[i] = 0x20; + + tdctl.r = N - F; + } + + int Decode(out byte[] buf, int len) /* Decoding/Uncompressing */ + { + short c, pos; + buf = new byte[len]; + int count; // was an unsigned long, seems unnecessary + for(count = 0; count < len;) + { + if(tdctl.bufcnt == 0) + { + if((c = DecodeChar()) < 0) return (count); // fatal error + + if(c < 256) + { + buf[count] = (byte)c; + text_buf[tdctl.r++] = (byte)c; + tdctl.r &= (N - 1); + count++; + } + else + { + if((pos = DecodePosition()) < 0) return (count); // fatal error + + tdctl.bufpos = (ushort)((tdctl.r - pos - 1) & (N - 1)); + tdctl.bufcnt = (ushort)(c - 255 + THRESHOLD); + tdctl.bufndx = 0; + } + } + else + { + // still chars from last string + while(tdctl.bufndx < tdctl.bufcnt && count < len) + { + c = text_buf[(tdctl.bufpos + tdctl.bufndx) & (N - 1)]; + buf[count] = (byte)c; + tdctl.bufndx++; + text_buf[tdctl.r++] = (byte)c; + tdctl.r &= (N - 1); + count++; + } + // reset bufcnt after copy string from text_buf[] + if(tdctl.bufndx >= tdctl.bufcnt) tdctl.bufndx = tdctl.bufcnt = 0; + } + } + + return (count); // count == len, success + } + #endregion LZH decompression from MAME + } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/UDIF.cs b/DiscImageChef.DiscImages/UDIF.cs index 0913918d..b27063da 100644 --- a/DiscImageChef.DiscImages/UDIF.cs +++ b/DiscImageChef.DiscImages/UDIF.cs @@ -46,575 +46,565 @@ using SharpCompress.Compressors.BZip2; namespace DiscImageChef.DiscImages { - public class UDIF : ImagePlugin - { - #region Internal constants - const uint UDIF_Signature = 0x6B6F6C79; - const uint Chunk_Signature = 0x6D697368; - - // All chunk types with this mask are compressed - const uint ChunkType_CompressedMask = 0x80000000; - - const uint ChunkType_Zero = 0x00000000; - const uint ChunkType_Copy = 0x00000001; - const uint ChunkType_NoCopy = 0x00000002; - const uint ChunkType_KenCode = 0x80000001; - const uint ChunkType_RLE = 0x80000002; - const uint ChunkType_LZH = 0x80000003; - const uint ChunkType_ADC = 0x80000004; - const uint ChunkType_Zlib = 0x80000005; - const uint ChunkType_Bzip = 0x80000006; - const uint ChunkType_LZFSE = 0x80000007; - const uint ChunkType_Commnt = 0x7FFFFFFE; - const uint ChunkType_End = 0xFFFFFFFF; - - const string ResourceForkKey = "resource-fork"; - const string BlockKey = "blkx"; - const uint BlockOSType = 0x626C6B78; - #endregion - - #region Internal Structures - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct UDIF_Footer - { - public uint signature; - public uint version; - public uint headerSize; - public uint flags; - public ulong runningDataForkOff; - public ulong dataForkOff; - public ulong dataForkLen; - public ulong rsrcForkOff; - public ulong rsrcForkLen; - public uint segmentNumber; - public uint segmentCount; - public Guid segmentId; - public uint dataForkChkType; - public uint dataForkChkLen; - public uint dataForkChk; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 124)] - public byte[] reserved1; - public ulong plistOff; - public ulong plistLen; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 120)] - public byte[] reserved2; - public uint masterChkType; - public uint masterChkLen; - public uint masterChk; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 124)] - public byte[] reserved3; - public uint imageVariant; - public ulong sectorCount; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] reserved4; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct BlockHeader - { - public uint signature; - public uint version; - public ulong sectorStart; - public ulong sectorCount; - public ulong dataOffset; - public uint buffers; - public uint descriptor; - public uint reserved1; - public uint reserved2; - public uint reserved3; - public uint reserved4; - public uint reserved5; - public uint reserved6; - public uint checksumType; - public uint checksumLen; - public uint checksum; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 124)] - public byte[] reservedChk; - public uint chunks; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct BlockChunk - { - public uint type; - public uint comment; - public ulong sector; - public ulong sectors; - public ulong offset; - public ulong length; - } - #endregion - - UDIF_Footer footer; - Dictionary<ulong, BlockChunk> chunks; - - Dictionary<ulong, byte[]> sectorCache; - Dictionary<ulong, byte[]> chunkCache; - const uint MaxCacheSize = 16777216; - const uint sectorSize = 512; - uint maxCachedSectors = MaxCacheSize / sectorSize; - uint currentChunkCacheSize; - uint buffersize; - - Stream imageStream; - - public UDIF() - { - Name = "Apple Universal Disk Image Format"; - PluginUUID = new Guid("5BEB9002-CF3D-429C-8E06-9A96F49203FF"); - ImageInfo = new ImageInfo(); - ImageInfo.readableSectorTags = new List<SectorTagType>(); - ImageInfo.readableMediaTags = new List<MediaTagType>(); - ImageInfo.imageHasPartitions = false; - ImageInfo.imageHasSessions = false; - ImageInfo.imageVersion = null; - ImageInfo.imageApplication = null; - ImageInfo.imageApplicationVersion = null; - ImageInfo.imageCreator = null; - ImageInfo.imageComments = null; - ImageInfo.mediaManufacturer = null; - ImageInfo.mediaModel = null; - ImageInfo.mediaSerialNumber = null; - ImageInfo.mediaBarcode = null; - ImageInfo.mediaPartNumber = null; - ImageInfo.mediaSequence = 0; - ImageInfo.lastMediaSequence = 0; - ImageInfo.driveManufacturer = null; - ImageInfo.driveModel = null; - ImageInfo.driveSerialNumber = null; - ImageInfo.driveFirmwareRevision = null; - } - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - - if(stream.Length < 512) - return false; - - stream.Seek(-Marshal.SizeOf(footer), SeekOrigin.End); - byte[] footer_b = new byte[Marshal.SizeOf(footer)]; - - stream.Read(footer_b, 0, Marshal.SizeOf(footer)); - footer = BigEndianMarshal.ByteArrayToStructureBigEndian<UDIF_Footer>(footer_b); - - if(footer.signature == UDIF_Signature) - return true; - - // Old UDIF as created by DiskCopy 6.5 using "OBSOLETE" format. (DiskCopy 5 rumored format?) - stream.Seek(0, SeekOrigin.Begin); - byte[] header_b = new byte[Marshal.SizeOf(footer)]; - - stream.Read(header_b, 0, Marshal.SizeOf(footer)); - footer = BigEndianMarshal.ByteArrayToStructureBigEndian<UDIF_Footer>(header_b); - - return footer.signature == UDIF_Signature; - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - - if(stream.Length < 512) - return false; - - stream.Seek(-Marshal.SizeOf(footer), SeekOrigin.End); - byte[] footer_b = new byte[Marshal.SizeOf(footer)]; - - stream.Read(footer_b, 0, Marshal.SizeOf(footer)); - footer = BigEndianMarshal.ByteArrayToStructureBigEndian<UDIF_Footer>(footer_b); - - if(footer.signature != UDIF_Signature) - { - stream.Seek(0, SeekOrigin.Begin); - footer_b = new byte[Marshal.SizeOf(footer)]; - - stream.Read(footer_b, 0, Marshal.SizeOf(footer)); - footer = BigEndianMarshal.ByteArrayToStructureBigEndian<UDIF_Footer>(footer_b); - - if(footer.signature != UDIF_Signature) - throw new Exception("Unable to find UDIF signature."); - - DicConsole.VerboseWriteLine("Found obsolete UDIF format."); - } - - DicConsole.DebugWriteLine("UDIF plugin", "footer.signature = 0x{0:X8}", footer.signature); - DicConsole.DebugWriteLine("UDIF plugin", "footer.version = {0}", footer.version); - DicConsole.DebugWriteLine("UDIF plugin", "footer.headerSize = {0}", footer.headerSize); - DicConsole.DebugWriteLine("UDIF plugin", "footer.flags = {0}", footer.flags); - DicConsole.DebugWriteLine("UDIF plugin", "footer.runningDataForkOff = {0}", footer.runningDataForkOff); - DicConsole.DebugWriteLine("UDIF plugin", "footer.dataForkOff = {0}", footer.dataForkOff); - DicConsole.DebugWriteLine("UDIF plugin", "footer.dataForkLen = {0}", footer.dataForkLen); - DicConsole.DebugWriteLine("UDIF plugin", "footer.rsrcForkOff = {0}", footer.rsrcForkOff); - DicConsole.DebugWriteLine("UDIF plugin", "footer.rsrcForkLen = {0}", footer.rsrcForkLen); - DicConsole.DebugWriteLine("UDIF plugin", "footer.segmentNumber = {0}", footer.segmentNumber); - DicConsole.DebugWriteLine("UDIF plugin", "footer.segmentCount = {0}", footer.segmentCount); - DicConsole.DebugWriteLine("UDIF plugin", "footer.segmentId = {0}", footer.segmentId); - DicConsole.DebugWriteLine("UDIF plugin", "footer.dataForkChkType = {0}", footer.dataForkChkType); - DicConsole.DebugWriteLine("UDIF plugin", "footer.dataForkLen = {0}", footer.dataForkLen); - DicConsole.DebugWriteLine("UDIF plugin", "footer.dataForkChk = 0x{0:X8}", footer.dataForkChk); - DicConsole.DebugWriteLine("UDIF plugin", "footer.xmlOff = {0}", footer.plistOff); - DicConsole.DebugWriteLine("UDIF plugin", "footer.xmlLen = {0}", footer.plistLen); - DicConsole.DebugWriteLine("UDIF plugin", "footer.masterChkType = {0}", footer.masterChkType); - DicConsole.DebugWriteLine("UDIF plugin", "footer.masterChkLen = {0}", footer.masterChkLen); - DicConsole.DebugWriteLine("UDIF plugin", "footer.masterChk = 0x{0:X8}", footer.masterChk); - DicConsole.DebugWriteLine("UDIF plugin", "footer.imageVariant = {0}", footer.imageVariant); - DicConsole.DebugWriteLine("UDIF plugin", "footer.sectorCount = {0}", footer.sectorCount); - DicConsole.DebugWriteLine("UDIF plugin", "footer.reserved1 is empty? = {0}", ArrayHelpers.ArrayIsNullOrEmpty(footer.reserved1)); - DicConsole.DebugWriteLine("UDIF plugin", "footer.reserved2 is empty? = {0}", ArrayHelpers.ArrayIsNullOrEmpty(footer.reserved2)); - DicConsole.DebugWriteLine("UDIF plugin", "footer.reserved3 is empty? = {0}", ArrayHelpers.ArrayIsNullOrEmpty(footer.reserved3)); - DicConsole.DebugWriteLine("UDIF plugin", "footer.reserved4 is empty? = {0}", ArrayHelpers.ArrayIsNullOrEmpty(footer.reserved4)); - - // Block chunks and headers - List<byte[]> blkxList = new List<byte[]>(); - chunks = new Dictionary<ulong, BlockChunk>(); - - bool fakeBlockChunks = false; - - byte[] vers = null; - - if(footer.plistLen == 0 && footer.rsrcForkLen != 0) - { - DicConsole.DebugWriteLine("UDIF plugin", "Reading resource fork."); - byte[] rsrc_b = new byte[footer.rsrcForkLen]; - stream.Seek((long)footer.rsrcForkOff, SeekOrigin.Begin); - stream.Read(rsrc_b, 0, rsrc_b.Length); - - ResourceFork rsrc = new ResourceFork(rsrc_b); - - if(!rsrc.ContainsKey(BlockOSType)) - throw new ImageNotSupportedException("Image resource fork doesn't contain UDIF block chunks. Please fill an issue and send it to us."); - - Resource blkxRez = rsrc.GetResource(BlockOSType); - - if(blkxRez == null) - throw new ImageNotSupportedException("Image resource fork doesn't contain UDIF block chunks. Please fill an issue and send it to us."); - - if(blkxRez.GetIds().Length == 0) - throw new ImageNotSupportedException("Image resource fork doesn't contain UDIF block chunks. Please fill an issue and send it to us."); - - foreach(short blkxId in blkxRez.GetIds()) - blkxList.Add(blkxRez.GetResource(blkxId)); - - Resource versRez = rsrc.GetResource(0x76657273); - - if(versRez != null) - vers = versRez.GetResource(versRez.GetIds()[0]); - } - else if(footer.plistLen != 0) - { - DicConsole.DebugWriteLine("UDIF plugin", "Reading property list."); - byte[] plist_b = new byte[footer.plistLen]; - stream.Seek((long)footer.plistOff, SeekOrigin.Begin); - stream.Read(plist_b, 0, plist_b.Length); - - DicConsole.DebugWriteLine("UDIF plugin", "Parsing property list."); - NSDictionary plist = (NSDictionary)XmlPropertyListParser.Parse(plist_b); - if(plist == null) - throw new Exception("Could not parse property list."); - - NSObject rsrcObj; - - if(!plist.TryGetValue(ResourceForkKey, out rsrcObj)) - throw new Exception("Could not retrieve resource fork."); - - NSDictionary rsrc = (NSDictionary)rsrcObj; - - NSObject blkxObj; - - if(!rsrc.TryGetValue(BlockKey, out blkxObj)) - throw new Exception("Could not retrieve block chunks array."); - - NSObject[] blkx = ((NSArray)blkxObj).GetArray(); - - foreach(NSObject partObj in blkx) - { - NSDictionary part = (NSDictionary)partObj; - NSObject nameObj, dataObj; - - if(!part.TryGetValue("Name", out nameObj)) - throw new Exception("Could not retrieve Name"); - - if(!part.TryGetValue("Data", out dataObj)) - throw new Exception("Could not retrieve Data"); - - blkxList.Add(((NSData)dataObj).Bytes); - } - - NSObject versObj; - - if(rsrc.TryGetValue("vers", out versObj)) - { - NSObject[] versArray = ((NSArray)versObj).GetArray(); - if(versArray.Length >= 1) - vers = ((NSData)versArray[0]).Bytes; - } - } - else - { - // Obsolete read-only UDIF only prepended the header and then put the image without any kind of block references. - // So let's falsify a block chunk - BlockChunk bChnk = new BlockChunk(); - bChnk.length = footer.dataForkLen; - bChnk.offset = footer.dataForkOff; - bChnk.sector = 0; - bChnk.sectors = footer.sectorCount; - bChnk.type = ChunkType_Copy; - ImageInfo.sectors = footer.sectorCount; - chunks.Add(bChnk.sector, bChnk); - buffersize = 2048 * sectorSize; - fakeBlockChunks = true; - } - - if(vers != null) - { - Resources.Version version = new Resources.Version(vers); - - string major; - string minor; - string release = null; - string dev = null; - string pre = null; - - major = string.Format("{0}", version.MajorVersion); - minor = string.Format(".{0}", version.MinorVersion / 10); - if(version.MinorVersion % 10 > 0) - release = string.Format(".{0}", version.MinorVersion % 10); - switch(version.DevStage) - { - case Resources.Version.DevelopmentStage.Alpha: - dev = "a"; - break; - case Resources.Version.DevelopmentStage.Beta: - dev = "b"; - break; - case Resources.Version.DevelopmentStage.PreAlpha: - dev = "d"; - break; - } - - if(dev == null && version.PreReleaseVersion > 0) - dev = "f"; - - if(dev != null) - pre = string.Format("{0}", version.PreReleaseVersion); - - ImageInfo.imageApplicationVersion = string.Format("{0}{1}{2}{3}{4}", major, minor, release, dev, pre); - ImageInfo.imageApplication = version.VersionString; - ImageInfo.imageComments = version.VersionMessage; - - if(version.MajorVersion == 3) - ImageInfo.imageApplication = "ShrinkWrap™"; - else if(version.MajorVersion == 6) - ImageInfo.imageApplication = "DiskCopy"; - } - else - ImageInfo.imageApplication = "DiskCopy"; - DicConsole.DebugWriteLine("UDIF plugin", "Image application = {0} version {1}", ImageInfo.imageApplication, ImageInfo.imageApplicationVersion); - - ImageInfo.sectors = 0; - if(!fakeBlockChunks) - { - if(blkxList.Count == 0) - throw new ImageNotSupportedException("Could not retrieve block chunks. Please fill an issue and send it to us."); - - buffersize = 0; - - foreach(byte[] blkxBytes in blkxList) - { - BlockHeader bHdr = new BlockHeader(); - byte[] bHdr_b = new byte[Marshal.SizeOf(bHdr)]; - Array.Copy(blkxBytes, 0, bHdr_b, 0, Marshal.SizeOf(bHdr)); - bHdr = BigEndianMarshal.ByteArrayToStructureBigEndian<BlockHeader>(bHdr_b); - - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.signature = 0x{0:X8}", bHdr.signature); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.version = {0}", bHdr.version); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.sectorStart = {0}", bHdr.sectorStart); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.sectorCount = {0}", bHdr.sectorCount); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.dataOffset = {0}", bHdr.dataOffset); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.buffers = {0}", bHdr.buffers); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.descriptor = 0x{0:X8}", bHdr.descriptor); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reserved1 = {0}", bHdr.reserved1); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reserved2 = {0}", bHdr.reserved2); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reserved3 = {0}", bHdr.reserved3); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reserved4 = {0}", bHdr.reserved4); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reserved5 = {0}", bHdr.reserved5); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reserved6 = {0}", bHdr.reserved6); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.checksumType = {0}", bHdr.checksumType); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.checksumLen = {0}", bHdr.checksumLen); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.checksum = 0x{0:X8}", bHdr.checksum); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunks = {0}", bHdr.chunks); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reservedChk is empty? = {0}", ArrayHelpers.ArrayIsNullOrEmpty(bHdr.reservedChk)); - - if(bHdr.buffers > buffersize) - buffersize = bHdr.buffers * sectorSize; - - for(int i = 0; i < bHdr.chunks; i++) - { - BlockChunk bChnk = new BlockChunk(); - byte[] bChnk_b = new byte[Marshal.SizeOf(bChnk)]; - Array.Copy(blkxBytes, Marshal.SizeOf(bHdr) + Marshal.SizeOf(bChnk) * i, bChnk_b, 0, Marshal.SizeOf(bChnk)); - bChnk = BigEndianMarshal.ByteArrayToStructureBigEndian<BlockChunk>(bChnk_b); - - - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].type = 0x{1:X8}", i, bChnk.type); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].comment = {1}", i, bChnk.comment); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].sector = {1}", i, bChnk.sector); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].sectors = {1}", i, bChnk.sectors); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].offset = {1}", i, bChnk.offset); - DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].length = {1}", i, bChnk.length); - - if(bChnk.type == ChunkType_End) - break; - - ImageInfo.sectors += bChnk.sectors; - - // Chunk offset is relative - bChnk.sector += bHdr.sectorStart; - bChnk.offset += bHdr.dataOffset; - - // TODO: Handle comments - if(bChnk.type == ChunkType_Commnt) - continue; - - // TODO: Handle compressed chunks - if((bChnk.type == ChunkType_KenCode)) - throw new ImageNotSupportedException("Chunks compressed with KenCode are not yet supported."); - if((bChnk.type == ChunkType_RLE)) - throw new ImageNotSupportedException("Chunks compressed with RLE are not yet supported."); - if((bChnk.type == ChunkType_LZH)) - throw new ImageNotSupportedException("Chunks compressed with LZH are not yet supported."); - if((bChnk.type == ChunkType_LZFSE)) - throw new ImageNotSupportedException("Chunks compressed with lzfse are not yet supported."); - - if((bChnk.type > ChunkType_NoCopy && bChnk.type < ChunkType_Commnt) || - (bChnk.type > ChunkType_LZFSE && bChnk.type < ChunkType_End)) - throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", bChnk.type)); - - if(bChnk.sectors > 0) - chunks.Add(bChnk.sector, bChnk); - } - } - } - - sectorCache = new Dictionary<ulong, byte[]>(); - chunkCache = new Dictionary<ulong, byte[]>(); - currentChunkCacheSize = 0; - imageStream = stream; - - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.sectorSize = sectorSize; - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.mediaType = MediaType.GENERIC_HDD; - ImageInfo.imageSize = ImageInfo.sectors * sectorSize; - ImageInfo.imageVersion = string.Format("{0}", footer.version); - - ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); - ImageInfo.heads = 16; - ImageInfo.sectorsPerTrack = 63; - - return true; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - byte[] sector; - - if(sectorCache.TryGetValue(sectorAddress, out sector)) - return sector; - - BlockChunk currentChunk = new BlockChunk(); - bool chunkFound = false; - ulong chunkStartSector = 0; - - foreach(KeyValuePair<ulong, BlockChunk> kvp in chunks) - { - if(sectorAddress >= kvp.Key) - { - currentChunk = kvp.Value; - chunkFound = true; - chunkStartSector = kvp.Key; - } - } - - long relOff = ((long)sectorAddress - (long)chunkStartSector) * sectorSize; - - if(relOff < 0) - throw new ArgumentOutOfRangeException(nameof(relOff), string.Format("Got a negative offset for sector {0}. This should not happen.", sectorAddress)); - - if(!chunkFound) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - - if((currentChunk.type & ChunkType_CompressedMask) == ChunkType_CompressedMask) - { - byte[] buffer; - if(!chunkCache.TryGetValue(chunkStartSector, out buffer)) - { - byte[] cmpBuffer = new byte[currentChunk.length]; - imageStream.Seek((long)currentChunk.offset, SeekOrigin.Begin); - imageStream.Read(cmpBuffer, 0, cmpBuffer.Length); - MemoryStream cmpMs = new MemoryStream(cmpBuffer); - Stream decStream; - - if(currentChunk.type == ChunkType_ADC) - decStream = new ADCStream(cmpMs, CompressionMode.Decompress); - else if(currentChunk.type == ChunkType_Zlib) - decStream = new Ionic.Zlib.ZlibStream(cmpMs, Ionic.Zlib.CompressionMode.Decompress); - else if(currentChunk.type == ChunkType_Bzip) - decStream = new BZip2Stream(cmpMs, CompressionMode.Decompress); - else - throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", currentChunk.type)); + public class UDIF : ImagePlugin + { + #region Internal constants + const uint UDIF_Signature = 0x6B6F6C79; + const uint Chunk_Signature = 0x6D697368; + + // All chunk types with this mask are compressed + const uint ChunkType_CompressedMask = 0x80000000; + + const uint ChunkType_Zero = 0x00000000; + const uint ChunkType_Copy = 0x00000001; + const uint ChunkType_NoCopy = 0x00000002; + const uint ChunkType_KenCode = 0x80000001; + const uint ChunkType_RLE = 0x80000002; + const uint ChunkType_LZH = 0x80000003; + const uint ChunkType_ADC = 0x80000004; + const uint ChunkType_Zlib = 0x80000005; + const uint ChunkType_Bzip = 0x80000006; + const uint ChunkType_LZFSE = 0x80000007; + const uint ChunkType_Commnt = 0x7FFFFFFE; + const uint ChunkType_End = 0xFFFFFFFF; + + const string ResourceForkKey = "resource-fork"; + const string BlockKey = "blkx"; + const uint BlockOSType = 0x626C6B78; + #endregion + + #region Internal Structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct UDIF_Footer + { + public uint signature; + public uint version; + public uint headerSize; + public uint flags; + public ulong runningDataForkOff; + public ulong dataForkOff; + public ulong dataForkLen; + public ulong rsrcForkOff; + public ulong rsrcForkLen; + public uint segmentNumber; + public uint segmentCount; + public Guid segmentId; + public uint dataForkChkType; + public uint dataForkChkLen; + public uint dataForkChk; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 124)] public byte[] reserved1; + public ulong plistOff; + public ulong plistLen; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 120)] public byte[] reserved2; + public uint masterChkType; + public uint masterChkLen; + public uint masterChk; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 124)] public byte[] reserved3; + public uint imageVariant; + public ulong sectorCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] reserved4; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct BlockHeader + { + public uint signature; + public uint version; + public ulong sectorStart; + public ulong sectorCount; + public ulong dataOffset; + public uint buffers; + public uint descriptor; + public uint reserved1; + public uint reserved2; + public uint reserved3; + public uint reserved4; + public uint reserved5; + public uint reserved6; + public uint checksumType; + public uint checksumLen; + public uint checksum; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 124)] public byte[] reservedChk; + public uint chunks; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct BlockChunk + { + public uint type; + public uint comment; + public ulong sector; + public ulong sectors; + public ulong offset; + public ulong length; + } + #endregion + + UDIF_Footer footer; + Dictionary<ulong, BlockChunk> chunks; + + Dictionary<ulong, byte[]> sectorCache; + Dictionary<ulong, byte[]> chunkCache; + const uint MaxCacheSize = 16777216; + const uint sectorSize = 512; + uint maxCachedSectors = MaxCacheSize / sectorSize; + uint currentChunkCacheSize; + uint buffersize; + + Stream imageStream; + + public UDIF() + { + Name = "Apple Universal Disk Image Format"; + PluginUUID = new Guid("5BEB9002-CF3D-429C-8E06-9A96F49203FF"); + ImageInfo = new ImageInfo(); + ImageInfo.readableSectorTags = new List<SectorTagType>(); + ImageInfo.readableMediaTags = new List<MediaTagType>(); + ImageInfo.imageHasPartitions = false; + ImageInfo.imageHasSessions = false; + ImageInfo.imageVersion = null; + ImageInfo.imageApplication = null; + ImageInfo.imageApplicationVersion = null; + ImageInfo.imageCreator = null; + ImageInfo.imageComments = null; + ImageInfo.mediaManufacturer = null; + ImageInfo.mediaModel = null; + ImageInfo.mediaSerialNumber = null; + ImageInfo.mediaBarcode = null; + ImageInfo.mediaPartNumber = null; + ImageInfo.mediaSequence = 0; + ImageInfo.lastMediaSequence = 0; + ImageInfo.driveManufacturer = null; + ImageInfo.driveModel = null; + ImageInfo.driveSerialNumber = null; + ImageInfo.driveFirmwareRevision = null; + } + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + + if(stream.Length < 512) return false; + + stream.Seek(-Marshal.SizeOf(footer), SeekOrigin.End); + byte[] footer_b = new byte[Marshal.SizeOf(footer)]; + + stream.Read(footer_b, 0, Marshal.SizeOf(footer)); + footer = BigEndianMarshal.ByteArrayToStructureBigEndian<UDIF_Footer>(footer_b); + + if(footer.signature == UDIF_Signature) return true; + + // Old UDIF as created by DiskCopy 6.5 using "OBSOLETE" format. (DiskCopy 5 rumored format?) + stream.Seek(0, SeekOrigin.Begin); + byte[] header_b = new byte[Marshal.SizeOf(footer)]; + + stream.Read(header_b, 0, Marshal.SizeOf(footer)); + footer = BigEndianMarshal.ByteArrayToStructureBigEndian<UDIF_Footer>(header_b); + + return footer.signature == UDIF_Signature; + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + + if(stream.Length < 512) return false; + + stream.Seek(-Marshal.SizeOf(footer), SeekOrigin.End); + byte[] footer_b = new byte[Marshal.SizeOf(footer)]; + + stream.Read(footer_b, 0, Marshal.SizeOf(footer)); + footer = BigEndianMarshal.ByteArrayToStructureBigEndian<UDIF_Footer>(footer_b); + + if(footer.signature != UDIF_Signature) + { + stream.Seek(0, SeekOrigin.Begin); + footer_b = new byte[Marshal.SizeOf(footer)]; + + stream.Read(footer_b, 0, Marshal.SizeOf(footer)); + footer = BigEndianMarshal.ByteArrayToStructureBigEndian<UDIF_Footer>(footer_b); + + if(footer.signature != UDIF_Signature) throw new Exception("Unable to find UDIF signature."); + + DicConsole.VerboseWriteLine("Found obsolete UDIF format."); + } + + DicConsole.DebugWriteLine("UDIF plugin", "footer.signature = 0x{0:X8}", footer.signature); + DicConsole.DebugWriteLine("UDIF plugin", "footer.version = {0}", footer.version); + DicConsole.DebugWriteLine("UDIF plugin", "footer.headerSize = {0}", footer.headerSize); + DicConsole.DebugWriteLine("UDIF plugin", "footer.flags = {0}", footer.flags); + DicConsole.DebugWriteLine("UDIF plugin", "footer.runningDataForkOff = {0}", footer.runningDataForkOff); + DicConsole.DebugWriteLine("UDIF plugin", "footer.dataForkOff = {0}", footer.dataForkOff); + DicConsole.DebugWriteLine("UDIF plugin", "footer.dataForkLen = {0}", footer.dataForkLen); + DicConsole.DebugWriteLine("UDIF plugin", "footer.rsrcForkOff = {0}", footer.rsrcForkOff); + DicConsole.DebugWriteLine("UDIF plugin", "footer.rsrcForkLen = {0}", footer.rsrcForkLen); + DicConsole.DebugWriteLine("UDIF plugin", "footer.segmentNumber = {0}", footer.segmentNumber); + DicConsole.DebugWriteLine("UDIF plugin", "footer.segmentCount = {0}", footer.segmentCount); + DicConsole.DebugWriteLine("UDIF plugin", "footer.segmentId = {0}", footer.segmentId); + DicConsole.DebugWriteLine("UDIF plugin", "footer.dataForkChkType = {0}", footer.dataForkChkType); + DicConsole.DebugWriteLine("UDIF plugin", "footer.dataForkLen = {0}", footer.dataForkLen); + DicConsole.DebugWriteLine("UDIF plugin", "footer.dataForkChk = 0x{0:X8}", footer.dataForkChk); + DicConsole.DebugWriteLine("UDIF plugin", "footer.xmlOff = {0}", footer.plistOff); + DicConsole.DebugWriteLine("UDIF plugin", "footer.xmlLen = {0}", footer.plistLen); + DicConsole.DebugWriteLine("UDIF plugin", "footer.masterChkType = {0}", footer.masterChkType); + DicConsole.DebugWriteLine("UDIF plugin", "footer.masterChkLen = {0}", footer.masterChkLen); + DicConsole.DebugWriteLine("UDIF plugin", "footer.masterChk = 0x{0:X8}", footer.masterChk); + DicConsole.DebugWriteLine("UDIF plugin", "footer.imageVariant = {0}", footer.imageVariant); + DicConsole.DebugWriteLine("UDIF plugin", "footer.sectorCount = {0}", footer.sectorCount); + DicConsole.DebugWriteLine("UDIF plugin", "footer.reserved1 is empty? = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(footer.reserved1)); + DicConsole.DebugWriteLine("UDIF plugin", "footer.reserved2 is empty? = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(footer.reserved2)); + DicConsole.DebugWriteLine("UDIF plugin", "footer.reserved3 is empty? = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(footer.reserved3)); + DicConsole.DebugWriteLine("UDIF plugin", "footer.reserved4 is empty? = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(footer.reserved4)); + + // Block chunks and headers + List<byte[]> blkxList = new List<byte[]>(); + chunks = new Dictionary<ulong, BlockChunk>(); + + bool fakeBlockChunks = false; + + byte[] vers = null; + + if(footer.plistLen == 0 && footer.rsrcForkLen != 0) + { + DicConsole.DebugWriteLine("UDIF plugin", "Reading resource fork."); + byte[] rsrc_b = new byte[footer.rsrcForkLen]; + stream.Seek((long)footer.rsrcForkOff, SeekOrigin.Begin); + stream.Read(rsrc_b, 0, rsrc_b.Length); + + ResourceFork rsrc = new ResourceFork(rsrc_b); + + if(!rsrc.ContainsKey(BlockOSType)) + throw new + ImageNotSupportedException("Image resource fork doesn't contain UDIF block chunks. Please fill an issue and send it to us."); + + Resource blkxRez = rsrc.GetResource(BlockOSType); + + if(blkxRez == null) + throw new + ImageNotSupportedException("Image resource fork doesn't contain UDIF block chunks. Please fill an issue and send it to us."); + + if(blkxRez.GetIds().Length == 0) + throw new + ImageNotSupportedException("Image resource fork doesn't contain UDIF block chunks. Please fill an issue and send it to us."); + + foreach(short blkxId in blkxRez.GetIds()) blkxList.Add(blkxRez.GetResource(blkxId)); + + Resource versRez = rsrc.GetResource(0x76657273); + + if(versRez != null) vers = versRez.GetResource(versRez.GetIds()[0]); + } + else if(footer.plistLen != 0) + { + DicConsole.DebugWriteLine("UDIF plugin", "Reading property list."); + byte[] plist_b = new byte[footer.plistLen]; + stream.Seek((long)footer.plistOff, SeekOrigin.Begin); + stream.Read(plist_b, 0, plist_b.Length); + + DicConsole.DebugWriteLine("UDIF plugin", "Parsing property list."); + NSDictionary plist = (NSDictionary)XmlPropertyListParser.Parse(plist_b); + if(plist == null) throw new Exception("Could not parse property list."); + + NSObject rsrcObj; + + if(!plist.TryGetValue(ResourceForkKey, out rsrcObj)) + throw new Exception("Could not retrieve resource fork."); + + NSDictionary rsrc = (NSDictionary)rsrcObj; + + NSObject blkxObj; + + if(!rsrc.TryGetValue(BlockKey, out blkxObj)) + throw new Exception("Could not retrieve block chunks array."); + + NSObject[] blkx = ((NSArray)blkxObj).GetArray(); + + foreach(NSObject partObj in blkx) + { + NSDictionary part = (NSDictionary)partObj; + NSObject nameObj, dataObj; + + if(!part.TryGetValue("Name", out nameObj)) throw new Exception("Could not retrieve Name"); + + if(!part.TryGetValue("Data", out dataObj)) throw new Exception("Could not retrieve Data"); + + blkxList.Add(((NSData)dataObj).Bytes); + } + + NSObject versObj; + + if(rsrc.TryGetValue("vers", out versObj)) + { + NSObject[] versArray = ((NSArray)versObj).GetArray(); + if(versArray.Length >= 1) vers = ((NSData)versArray[0]).Bytes; + } + } + else + { + // Obsolete read-only UDIF only prepended the header and then put the image without any kind of block references. + // So let's falsify a block chunk + BlockChunk bChnk = new BlockChunk(); + bChnk.length = footer.dataForkLen; + bChnk.offset = footer.dataForkOff; + bChnk.sector = 0; + bChnk.sectors = footer.sectorCount; + bChnk.type = ChunkType_Copy; + ImageInfo.sectors = footer.sectorCount; + chunks.Add(bChnk.sector, bChnk); + buffersize = 2048 * sectorSize; + fakeBlockChunks = true; + } + + if(vers != null) + { + Resources.Version version = new Resources.Version(vers); + + string major; + string minor; + string release = null; + string dev = null; + string pre = null; + + major = string.Format("{0}", version.MajorVersion); + minor = string.Format(".{0}", version.MinorVersion / 10); + if(version.MinorVersion % 10 > 0) release = string.Format(".{0}", version.MinorVersion % 10); + switch(version.DevStage) + { + case Resources.Version.DevelopmentStage.Alpha: + dev = "a"; + break; + case Resources.Version.DevelopmentStage.Beta: + dev = "b"; + break; + case Resources.Version.DevelopmentStage.PreAlpha: + dev = "d"; + break; + } + + if(dev == null && version.PreReleaseVersion > 0) dev = "f"; + + if(dev != null) pre = string.Format("{0}", version.PreReleaseVersion); + + ImageInfo.imageApplicationVersion = string.Format("{0}{1}{2}{3}{4}", major, minor, release, dev, pre); + ImageInfo.imageApplication = version.VersionString; + ImageInfo.imageComments = version.VersionMessage; + + if(version.MajorVersion == 3) ImageInfo.imageApplication = "ShrinkWrap™"; + else if(version.MajorVersion == 6) ImageInfo.imageApplication = "DiskCopy"; + } + else ImageInfo.imageApplication = "DiskCopy"; + + DicConsole.DebugWriteLine("UDIF plugin", "Image application = {0} version {1}", ImageInfo.imageApplication, + ImageInfo.imageApplicationVersion); + + ImageInfo.sectors = 0; + if(!fakeBlockChunks) + { + if(blkxList.Count == 0) + throw new + ImageNotSupportedException("Could not retrieve block chunks. Please fill an issue and send it to us."); + + buffersize = 0; + + foreach(byte[] blkxBytes in blkxList) + { + BlockHeader bHdr = new BlockHeader(); + byte[] bHdr_b = new byte[Marshal.SizeOf(bHdr)]; + Array.Copy(blkxBytes, 0, bHdr_b, 0, Marshal.SizeOf(bHdr)); + bHdr = BigEndianMarshal.ByteArrayToStructureBigEndian<BlockHeader>(bHdr_b); + + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.signature = 0x{0:X8}", bHdr.signature); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.version = {0}", bHdr.version); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.sectorStart = {0}", bHdr.sectorStart); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.sectorCount = {0}", bHdr.sectorCount); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.dataOffset = {0}", bHdr.dataOffset); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.buffers = {0}", bHdr.buffers); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.descriptor = 0x{0:X8}", bHdr.descriptor); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reserved1 = {0}", bHdr.reserved1); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reserved2 = {0}", bHdr.reserved2); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reserved3 = {0}", bHdr.reserved3); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reserved4 = {0}", bHdr.reserved4); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reserved5 = {0}", bHdr.reserved5); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reserved6 = {0}", bHdr.reserved6); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.checksumType = {0}", bHdr.checksumType); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.checksumLen = {0}", bHdr.checksumLen); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.checksum = 0x{0:X8}", bHdr.checksum); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunks = {0}", bHdr.chunks); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.reservedChk is empty? = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(bHdr.reservedChk)); + + if(bHdr.buffers > buffersize) buffersize = bHdr.buffers * sectorSize; + + for(int i = 0; i < bHdr.chunks; i++) + { + BlockChunk bChnk = new BlockChunk(); + byte[] bChnk_b = new byte[Marshal.SizeOf(bChnk)]; + Array.Copy(blkxBytes, Marshal.SizeOf(bHdr) + Marshal.SizeOf(bChnk) * i, bChnk_b, 0, + Marshal.SizeOf(bChnk)); + bChnk = BigEndianMarshal.ByteArrayToStructureBigEndian<BlockChunk>(bChnk_b); + + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].type = 0x{1:X8}", i, bChnk.type); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].comment = {1}", i, bChnk.comment); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].sector = {1}", i, bChnk.sector); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].sectors = {1}", i, bChnk.sectors); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].offset = {1}", i, bChnk.offset); + DicConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].length = {1}", i, bChnk.length); + + if(bChnk.type == ChunkType_End) break; + + ImageInfo.sectors += bChnk.sectors; + + // Chunk offset is relative + bChnk.sector += bHdr.sectorStart; + bChnk.offset += bHdr.dataOffset; + + // TODO: Handle comments + if(bChnk.type == ChunkType_Commnt) continue; + + // TODO: Handle compressed chunks + if((bChnk.type == ChunkType_KenCode)) + throw new + ImageNotSupportedException("Chunks compressed with KenCode are not yet supported."); + if((bChnk.type == ChunkType_RLE)) + throw new ImageNotSupportedException("Chunks compressed with RLE are not yet supported."); + if((bChnk.type == ChunkType_LZH)) + throw new ImageNotSupportedException("Chunks compressed with LZH are not yet supported."); + if((bChnk.type == ChunkType_LZFSE)) + throw new ImageNotSupportedException("Chunks compressed with lzfse are not yet supported."); + + if((bChnk.type > ChunkType_NoCopy && bChnk.type < ChunkType_Commnt) || + (bChnk.type > ChunkType_LZFSE && bChnk.type < ChunkType_End)) + throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", + bChnk.type)); + + if(bChnk.sectors > 0) chunks.Add(bChnk.sector, bChnk); + } + } + } + + sectorCache = new Dictionary<ulong, byte[]>(); + chunkCache = new Dictionary<ulong, byte[]>(); + currentChunkCacheSize = 0; + imageStream = stream; + + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.sectorSize = sectorSize; + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.mediaType = MediaType.GENERIC_HDD; + ImageInfo.imageSize = ImageInfo.sectors * sectorSize; + ImageInfo.imageVersion = string.Format("{0}", footer.version); + + ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); + ImageInfo.heads = 16; + ImageInfo.sectorsPerTrack = 63; + + return true; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + byte[] sector; + + if(sectorCache.TryGetValue(sectorAddress, out sector)) return sector; + + BlockChunk currentChunk = new BlockChunk(); + bool chunkFound = false; + ulong chunkStartSector = 0; + + foreach(KeyValuePair<ulong, BlockChunk> kvp in chunks) + { + if(sectorAddress >= kvp.Key) + { + currentChunk = kvp.Value; + chunkFound = true; + chunkStartSector = kvp.Key; + } + } + + long relOff = ((long)sectorAddress - (long)chunkStartSector) * sectorSize; + + if(relOff < 0) + throw new ArgumentOutOfRangeException(nameof(relOff), + string + .Format("Got a negative offset for sector {0}. This should not happen.", + sectorAddress)); + + if(!chunkFound) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); + + if((currentChunk.type & ChunkType_CompressedMask) == ChunkType_CompressedMask) + { + byte[] buffer; + if(!chunkCache.TryGetValue(chunkStartSector, out buffer)) + { + byte[] cmpBuffer = new byte[currentChunk.length]; + imageStream.Seek((long)currentChunk.offset, SeekOrigin.Begin); + imageStream.Read(cmpBuffer, 0, cmpBuffer.Length); + MemoryStream cmpMs = new MemoryStream(cmpBuffer); + Stream decStream; + + if(currentChunk.type == ChunkType_ADC) decStream = new ADCStream(cmpMs, CompressionMode.Decompress); + else if(currentChunk.type == ChunkType_Zlib) + decStream = new Ionic.Zlib.ZlibStream(cmpMs, Ionic.Zlib.CompressionMode.Decompress); + else if(currentChunk.type == ChunkType_Bzip) + decStream = new BZip2Stream(cmpMs, CompressionMode.Decompress); + else + throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", + currentChunk.type)); #if DEBUG - try - { + try + { #endif - byte[] tmpBuffer = new byte[buffersize]; - int realSize = decStream.Read(tmpBuffer, 0, (int)buffersize); - buffer = new byte[realSize]; - Array.Copy(tmpBuffer, 0, buffer, 0, realSize); - tmpBuffer = null; + byte[] tmpBuffer = new byte[buffersize]; + int realSize = decStream.Read(tmpBuffer, 0, (int)buffersize); + buffer = new byte[realSize]; + Array.Copy(tmpBuffer, 0, buffer, 0, realSize); + tmpBuffer = null; - if(currentChunkCacheSize + realSize > MaxCacheSize) - { - chunkCache.Clear(); - currentChunkCacheSize = 0; - } + if(currentChunkCacheSize + realSize > MaxCacheSize) + { + chunkCache.Clear(); + currentChunkCacheSize = 0; + } - chunkCache.Add(chunkStartSector, buffer); - currentChunkCacheSize += (uint)realSize; + chunkCache.Add(chunkStartSector, buffer); + currentChunkCacheSize += (uint)realSize; #if DEBUG - } - catch(Ionic.Zlib.ZlibException) - { - DicConsole.WriteLine("zlib exception on chunk starting at sector {0}", currentChunk.sector); - throw; - } + } + catch(Ionic.Zlib.ZlibException) + { + DicConsole.WriteLine("zlib exception on chunk starting at sector {0}", currentChunk.sector); + throw; + } #endif - } + } - sector = new byte[sectorSize]; - Array.Copy(buffer, relOff, sector, 0, sectorSize); + sector = new byte[sectorSize]; + Array.Copy(buffer, relOff, sector, 0, sectorSize); - if(sectorCache.Count >= maxCachedSectors) - sectorCache.Clear(); + if(sectorCache.Count >= maxCachedSectors) sectorCache.Clear(); - sectorCache.Add(sectorAddress, sector); + sectorCache.Add(sectorAddress, sector); - return sector; - } + return sector; + } if(currentChunk.type == ChunkType_NoCopy || currentChunk.type == ChunkType_Zero) { sector = new byte[sectorSize]; - if(sectorCache.Count >= maxCachedSectors) - sectorCache.Clear(); + if(sectorCache.Count >= maxCachedSectors) sectorCache.Clear(); sectorCache.Add(sectorAddress, sector); return sector; @@ -626,20 +616,21 @@ namespace DiscImageChef.DiscImages sector = new byte[sectorSize]; imageStream.Read(sector, 0, sector.Length); - if(sectorCache.Count >= maxCachedSectors) - sectorCache.Clear(); + if(sectorCache.Count >= maxCachedSectors) sectorCache.Clear(); sectorCache.Add(sectorAddress, sector); return sector; } - throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", currentChunk.type)); + throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", + currentChunk.type)); } public override byte[] ReadSectors(ulong sectorAddress, uint length) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); if(sectorAddress + length > ImageInfo.sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); @@ -725,8 +716,7 @@ namespace DiscImageChef.DiscImages return ImageInfo.mediaType; } -#region Unsupported features - + #region Unsupported features public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -867,16 +857,18 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -885,8 +877,6 @@ namespace DiscImageChef.DiscImages { return null; } - -#endregion + #endregion } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/UkvFdi.cs b/DiscImageChef.DiscImages/UkvFdi.cs index ee1a24bb..c5c3afab 100644 --- a/DiscImageChef.DiscImages/UkvFdi.cs +++ b/DiscImageChef.DiscImages/UkvFdi.cs @@ -41,515 +41,507 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class UkvFdi : ImagePlugin - { - #region Internal enumerations - [Flags] - enum DiskFlags : byte - { - WriteProtected = 1 - } - - [Flags] - enum SectorFlags : byte - { - CrcOk128 = 0x01, - CrcOk256 = 0x02, - CrcOk512 = 0x04, - CrcOk1024 = 0x08, - CrcOk2048 = 0x10, - CrcOk4096 = 0x20, - Deleted = 0x80, - } - #endregion - - #region Internal constants - readonly byte[] signature = { 0x46, 0x44, 0x49 }; - #endregion - - #region Internal structures - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct FdiHeader - { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] magic; - public DiskFlags flags; - public ushort cylinders; - public ushort heads; - public ushort descOff; - public ushort dataOff; - public ushort addInfoLen; - } - #endregion - - // Cylinder by head, sector data matrix - byte[][][][] sectorsData; - - public UkvFdi() - { - Name = "Spectrum Floppy Disk Image"; - PluginUUID = new Guid("DADFC9B2-67C1-42A3-B124-825528163FC0"); - ImageInfo = new ImageInfo() - { - readableSectorTags = new List<SectorTagType>(), - readableMediaTags = new List<MediaTagType>(), - imageHasPartitions = false, - imageHasSessions = false, - imageVersion = null, - imageApplication = null, - imageApplicationVersion = null, - imageCreator = null, - imageComments = null, - mediaManufacturer = null, - mediaModel = null, - mediaSerialNumber = null, - mediaBarcode = null, - mediaPartNumber = null, - mediaSequence = 0, - lastMediaSequence = 0, - driveManufacturer = null, - driveModel = null, - driveSerialNumber = null, - driveFirmwareRevision = null - }; - } - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - FdiHeader hdr = new FdiHeader(); - - if(stream.Length < Marshal.SizeOf(hdr)) - return false; - - byte[] hdr_b = new byte[Marshal.SizeOf(hdr)]; - stream.Read(hdr_b, 0, hdr_b.Length); - - GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); - hdr = (FdiHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(FdiHeader)); - handle.Free(); - - return hdr.magic.SequenceEqual(signature); - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - - FdiHeader hdr = new FdiHeader(); - - if(stream.Length < Marshal.SizeOf(hdr)) - return false; - - byte[] hdr_b = new byte[Marshal.SizeOf(hdr)]; - stream.Read(hdr_b, 0, hdr_b.Length); - - GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); - hdr = (FdiHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(FdiHeader)); - handle.Free(); - - DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.addInfoLen = {0}", hdr.addInfoLen); - DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.cylinders = {0}", hdr.cylinders); - DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.dataOff = {0}", hdr.dataOff); - DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.descOff = {0}", hdr.descOff); - DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.flags = {0}", hdr.flags); - DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.heads = {0}", hdr.heads); - - stream.Seek(hdr.descOff, SeekOrigin.Begin); - byte[] description = new byte[hdr.dataOff - hdr.descOff]; - stream.Read(description, 0, description.Length); - ImageInfo.imageComments = StringHandlers.CToString(description); - - DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.description = \"{0}\"", ImageInfo.imageComments); - - stream.Seek(0xE + hdr.addInfoLen, SeekOrigin.Begin); - - long spt = long.MaxValue; - uint[][][] sectorsOff = new uint[hdr.cylinders][][]; - sectorsData = new byte[hdr.cylinders][][][]; - - ImageInfo.cylinders = hdr.cylinders; - ImageInfo.heads = hdr.heads; - - // Read track descriptors - for(ushort cyl = 0; cyl < hdr.cylinders; cyl++) - { - sectorsOff[cyl] = new uint[hdr.heads][]; - sectorsData[cyl] = new byte[hdr.heads][][]; - - for(ushort head = 0; head < hdr.heads; head++) - { - byte[] sct_b = new byte[4]; - stream.Read(sct_b, 0, 4); - stream.Seek(2, SeekOrigin.Current); - byte sectors = (byte)stream.ReadByte(); - uint trkOff = BitConverter.ToUInt32(sct_b, 0); - - DicConsole.DebugWriteLine("UkvFdi plugin", "trkhdr.c = {0}", cyl); - DicConsole.DebugWriteLine("UkvFdi plugin", "trkhdr.h = {0}", head); - DicConsole.DebugWriteLine("UkvFdi plugin", "trkhdr.sectors = {0}", sectors); - DicConsole.DebugWriteLine("UkvFdi plugin", "trkhdr.off = {0}", trkOff); - - sectorsOff[cyl][head] = new uint[sectors]; - sectorsData[cyl][head] = new byte[sectors][]; - - if(sectors < spt && sectors > 0) - spt = sectors; - - for(ushort sec = 0; sec < sectors; sec++) - { - byte c = (byte)stream.ReadByte(); - byte h = (byte)stream.ReadByte(); - byte r = (byte)stream.ReadByte(); - byte n = (byte)stream.ReadByte(); - SectorFlags f = (SectorFlags)stream.ReadByte(); - byte[] off_b = new byte[2]; - stream.Read(off_b, 0, 2); - ushort secOff = BitConverter.ToUInt16(off_b, 0); - - DicConsole.DebugWriteLine("UkvFdi plugin", "sechdr.c = {0}", c); - DicConsole.DebugWriteLine("UkvFdi plugin", "sechdr.h = {0}", h); - DicConsole.DebugWriteLine("UkvFdi plugin", "sechdr.r = {0}", r); - DicConsole.DebugWriteLine("UkvFdi plugin", "sechdr.n = {0} ({1})", n, 128 << n); - DicConsole.DebugWriteLine("UkvFdi plugin", "sechdr.f = {0}", f); - DicConsole.DebugWriteLine("UkvFdi plugin", "sechdr.off = {0} ({1})", secOff, secOff + trkOff + hdr.dataOff); - - // TODO: This assumes sequential sectors. - sectorsOff[cyl][head][sec] = secOff + trkOff + hdr.dataOff; - sectorsData[cyl][head][sec] = new byte[128 << n]; - - if(128 << n > ImageInfo.sectorSize) - ImageInfo.sectorSize = (uint)(128 << n); - } - } - } - - // Read sectors - for(ushort cyl = 0; cyl < hdr.cylinders; cyl++) - { - bool emptyCyl = false; - - for(ushort head = 0; head < hdr.heads; head++) - { - for(ushort sec = 0; sec < sectorsOff[cyl][head].Length; sec++) - { - stream.Seek(sectorsOff[cyl][head][sec], SeekOrigin.Begin); - stream.Read(sectorsData[cyl][head][sec], 0, sectorsData[cyl][head][sec].Length); - } - - // For empty cylinders - if(sectorsOff[cyl][head].Length == 0) - { - // Last cylinder - if(cyl + 1 == hdr.cylinders || - // Next cylinder is also empty - sectorsOff[cyl + 1][head].Length == 0 - ) - emptyCyl = true; - // Create empty sectors - else - { - sectorsData[cyl][head] = new byte[spt][]; - for(int i = 0; i < spt; i++) - sectorsData[cyl][head][i] = new byte[ImageInfo.sectorSize]; - } - } - } - - if(emptyCyl) - ImageInfo.cylinders--; - } - - // TODO: What about double sided, half track pitch compact floppies? - ImageInfo.mediaType = MediaType.CompactFloppy; - ImageInfo.imageSize = (ulong)stream.Length - hdr.dataOff; - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.sectorsPerTrack = (uint)spt; - ImageInfo.sectors = ImageInfo.cylinders*ImageInfo.heads*ImageInfo.sectorsPerTrack; - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - - return true; - } - - public override bool ImageHasPartitions() - { - return false; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override string GetImageFormat() - { - return "Spectrum floppy disk image"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - (ushort cylinder, byte head, byte sector) = LbaToChs(sectorAddress); - - if(cylinder >= sectorsData.Length) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(head >= sectorsData[cylinder].Length) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sector > sectorsData[cylinder][head].Length) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - return sectorsData[cylinder][head][sector - 1]; - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - MemoryStream buffer = new MemoryStream(); - for(uint i = 0; i < length; i++) - { - byte[] sector = ReadSector(sectorAddress + i); - buffer.Write(sector, 0, sector.Length); - } - - return buffer.ToArray(); - } - - (ushort cylinder, byte head, byte sector) LbaToChs(ulong lba) - { - ushort cylinder = (ushort)(lba / (ImageInfo.heads * ImageInfo.sectorsPerTrack)); - byte head = (byte)((lba / ImageInfo.sectorsPerTrack) % ImageInfo.heads); - byte sector = (byte)((lba % ImageInfo.sectorsPerTrack) + 1); - - return (cylinder, head, sector); - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetMediaManufacturer() - { - return null; - } - - public override string GetMediaModel() - { - return null; - } - - public override string GetMediaSerialNumber() - { - return null; - } - - public override string GetMediaBarcode() - { - return null; - } - - public override string GetMediaPartNumber() - { - return null; - } - - public override int GetMediaSequence() - { - return 0; - } - - public override int GetLastDiskSequence() - { - return 0; - } - - public override string GetDriveManufacturer() - { - return null; - } - - public override string GetDriveModel() - { - return null; - } - - public override string GetDriveSerialNumber() - { - return null; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifyMediaImage() - { - return null; - } - - #endregion - } + public class UkvFdi : ImagePlugin + { + #region Internal enumerations + [Flags] + enum DiskFlags : byte + { + WriteProtected = 1 + } + + [Flags] + enum SectorFlags : byte + { + CrcOk128 = 0x01, + CrcOk256 = 0x02, + CrcOk512 = 0x04, + CrcOk1024 = 0x08, + CrcOk2048 = 0x10, + CrcOk4096 = 0x20, + Deleted = 0x80, + } + #endregion + + #region Internal constants + readonly byte[] signature = {0x46, 0x44, 0x49}; + #endregion + + #region Internal structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct FdiHeader + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] magic; + public DiskFlags flags; + public ushort cylinders; + public ushort heads; + public ushort descOff; + public ushort dataOff; + public ushort addInfoLen; + } + #endregion + + // Cylinder by head, sector data matrix + byte[][][][] sectorsData; + + public UkvFdi() + { + Name = "Spectrum Floppy Disk Image"; + PluginUUID = new Guid("DADFC9B2-67C1-42A3-B124-825528163FC0"); + ImageInfo = new ImageInfo() + { + readableSectorTags = new List<SectorTagType>(), + readableMediaTags = new List<MediaTagType>(), + imageHasPartitions = false, + imageHasSessions = false, + imageVersion = null, + imageApplication = null, + imageApplicationVersion = null, + imageCreator = null, + imageComments = null, + mediaManufacturer = null, + mediaModel = null, + mediaSerialNumber = null, + mediaBarcode = null, + mediaPartNumber = null, + mediaSequence = 0, + lastMediaSequence = 0, + driveManufacturer = null, + driveModel = null, + driveSerialNumber = null, + driveFirmwareRevision = null + }; + } + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + FdiHeader hdr = new FdiHeader(); + + if(stream.Length < Marshal.SizeOf(hdr)) return false; + + byte[] hdr_b = new byte[Marshal.SizeOf(hdr)]; + stream.Read(hdr_b, 0, hdr_b.Length); + + GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); + hdr = (FdiHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(FdiHeader)); + handle.Free(); + + return hdr.magic.SequenceEqual(signature); + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + + FdiHeader hdr = new FdiHeader(); + + if(stream.Length < Marshal.SizeOf(hdr)) return false; + + byte[] hdr_b = new byte[Marshal.SizeOf(hdr)]; + stream.Read(hdr_b, 0, hdr_b.Length); + + GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); + hdr = (FdiHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(FdiHeader)); + handle.Free(); + + DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.addInfoLen = {0}", hdr.addInfoLen); + DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.cylinders = {0}", hdr.cylinders); + DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.dataOff = {0}", hdr.dataOff); + DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.descOff = {0}", hdr.descOff); + DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.flags = {0}", hdr.flags); + DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.heads = {0}", hdr.heads); + + stream.Seek(hdr.descOff, SeekOrigin.Begin); + byte[] description = new byte[hdr.dataOff - hdr.descOff]; + stream.Read(description, 0, description.Length); + ImageInfo.imageComments = StringHandlers.CToString(description); + + DicConsole.DebugWriteLine("UkvFdi plugin", "hdr.description = \"{0}\"", ImageInfo.imageComments); + + stream.Seek(0xE + hdr.addInfoLen, SeekOrigin.Begin); + + long spt = long.MaxValue; + uint[][][] sectorsOff = new uint[hdr.cylinders][][]; + sectorsData = new byte[hdr.cylinders][][][]; + + ImageInfo.cylinders = hdr.cylinders; + ImageInfo.heads = hdr.heads; + + // Read track descriptors + for(ushort cyl = 0; cyl < hdr.cylinders; cyl++) + { + sectorsOff[cyl] = new uint[hdr.heads][]; + sectorsData[cyl] = new byte[hdr.heads][][]; + + for(ushort head = 0; head < hdr.heads; head++) + { + byte[] sct_b = new byte[4]; + stream.Read(sct_b, 0, 4); + stream.Seek(2, SeekOrigin.Current); + byte sectors = (byte)stream.ReadByte(); + uint trkOff = BitConverter.ToUInt32(sct_b, 0); + + DicConsole.DebugWriteLine("UkvFdi plugin", "trkhdr.c = {0}", cyl); + DicConsole.DebugWriteLine("UkvFdi plugin", "trkhdr.h = {0}", head); + DicConsole.DebugWriteLine("UkvFdi plugin", "trkhdr.sectors = {0}", sectors); + DicConsole.DebugWriteLine("UkvFdi plugin", "trkhdr.off = {0}", trkOff); + + sectorsOff[cyl][head] = new uint[sectors]; + sectorsData[cyl][head] = new byte[sectors][]; + + if(sectors < spt && sectors > 0) spt = sectors; + + for(ushort sec = 0; sec < sectors; sec++) + { + byte c = (byte)stream.ReadByte(); + byte h = (byte)stream.ReadByte(); + byte r = (byte)stream.ReadByte(); + byte n = (byte)stream.ReadByte(); + SectorFlags f = (SectorFlags)stream.ReadByte(); + byte[] off_b = new byte[2]; + stream.Read(off_b, 0, 2); + ushort secOff = BitConverter.ToUInt16(off_b, 0); + + DicConsole.DebugWriteLine("UkvFdi plugin", "sechdr.c = {0}", c); + DicConsole.DebugWriteLine("UkvFdi plugin", "sechdr.h = {0}", h); + DicConsole.DebugWriteLine("UkvFdi plugin", "sechdr.r = {0}", r); + DicConsole.DebugWriteLine("UkvFdi plugin", "sechdr.n = {0} ({1})", n, 128 << n); + DicConsole.DebugWriteLine("UkvFdi plugin", "sechdr.f = {0}", f); + DicConsole.DebugWriteLine("UkvFdi plugin", "sechdr.off = {0} ({1})", secOff, + secOff + trkOff + hdr.dataOff); + + // TODO: This assumes sequential sectors. + sectorsOff[cyl][head][sec] = secOff + trkOff + hdr.dataOff; + sectorsData[cyl][head][sec] = new byte[128 << n]; + + if(128 << n > ImageInfo.sectorSize) ImageInfo.sectorSize = (uint)(128 << n); + } + } + } + + // Read sectors + for(ushort cyl = 0; cyl < hdr.cylinders; cyl++) + { + bool emptyCyl = false; + + for(ushort head = 0; head < hdr.heads; head++) + { + for(ushort sec = 0; sec < sectorsOff[cyl][head].Length; sec++) + { + stream.Seek(sectorsOff[cyl][head][sec], SeekOrigin.Begin); + stream.Read(sectorsData[cyl][head][sec], 0, sectorsData[cyl][head][sec].Length); + } + + // For empty cylinders + if(sectorsOff[cyl][head].Length == 0) + { + // Last cylinder + if(cyl + 1 == hdr.cylinders || + // Next cylinder is also empty + sectorsOff[cyl + 1][head].Length == 0) emptyCyl = true; + // Create empty sectors + else + { + sectorsData[cyl][head] = new byte[spt][]; + for(int i = 0; i < spt; i++) sectorsData[cyl][head][i] = new byte[ImageInfo.sectorSize]; + } + } + } + + if(emptyCyl) ImageInfo.cylinders--; + } + + // TODO: What about double sided, half track pitch compact floppies? + ImageInfo.mediaType = MediaType.CompactFloppy; + ImageInfo.imageSize = (ulong)stream.Length - hdr.dataOff; + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.sectorsPerTrack = (uint)spt; + ImageInfo.sectors = ImageInfo.cylinders * ImageInfo.heads * ImageInfo.sectorsPerTrack; + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + + return true; + } + + public override bool ImageHasPartitions() + { + return false; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override string GetImageFormat() + { + return "Spectrum floppy disk image"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + (ushort cylinder, byte head, byte sector) = LbaToChs(sectorAddress); + + if(cylinder >= sectorsData.Length) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(head >= sectorsData[cylinder].Length) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sector > sectorsData[cylinder][head].Length) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + return sectorsData[cylinder][head][sector - 1]; + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + MemoryStream buffer = new MemoryStream(); + for(uint i = 0; i < length; i++) + { + byte[] sector = ReadSector(sectorAddress + i); + buffer.Write(sector, 0, sector.Length); + } + + return buffer.ToArray(); + } + + (ushort cylinder, byte head, byte sector) LbaToChs(ulong lba) + { + ushort cylinder = (ushort)(lba / (ImageInfo.heads * ImageInfo.sectorsPerTrack)); + byte head = (byte)((lba / ImageInfo.sectorsPerTrack) % ImageInfo.heads); + byte sector = (byte)((lba % ImageInfo.sectorsPerTrack) + 1); + + return (cylinder, head, sector); + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetMediaManufacturer() + { + return null; + } + + public override string GetMediaModel() + { + return null; + } + + public override string GetMediaSerialNumber() + { + return null; + } + + public override string GetMediaBarcode() + { + return null; + } + + public override string GetMediaPartNumber() + { + return null; + } + + public override int GetMediaSequence() + { + return 0; + } + + public override int GetLastDiskSequence() + { + return 0; + } + + public override string GetDriveManufacturer() + { + return null; + } + + public override string GetDriveModel() + { + return null; + } + + public override string GetDriveSerialNumber() + { + return null; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifyMediaImage() + { + return null; + } + #endregion + } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/VDI.cs b/DiscImageChef.DiscImages/VDI.cs index 874f0761..4662fc0e 100644 --- a/DiscImageChef.DiscImages/VDI.cs +++ b/DiscImageChef.DiscImages/VDI.cs @@ -41,7 +41,7 @@ using DiscImageChef.ImagePlugins; namespace DiscImageChef.DiscImages { - public class VDI : ImagePlugin + public class VDI : ImagePlugin { #region Internal constants const uint VDIMagic = 0xBEDA107F; @@ -62,8 +62,7 @@ namespace DiscImageChef.DiscImages /// </summary> struct VDIHeader { - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] - public string creator; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string creator; /// <summary> /// Magic, <see cref="VDIMagic"/> /// </summary> @@ -76,8 +75,7 @@ namespace DiscImageChef.DiscImages public uint headerSize; public uint imageType; public uint imageFlags; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string description; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string description; public uint offsetBlocks; public uint offsetData; public uint cylinders; @@ -94,8 +92,7 @@ namespace DiscImageChef.DiscImages public Guid snapshotUuid; public Guid linkUuid; public Guid parentUuid; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 56)] - public byte[] garbage; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 56)] public byte[] garbage; } #endregion @@ -140,8 +137,7 @@ namespace DiscImageChef.DiscImages Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] vHdr_b = new byte[Marshal.SizeOf(vHdr)]; stream.Read(vHdr_b, 0, Marshal.SizeOf(vHdr)); @@ -159,8 +155,7 @@ namespace DiscImageChef.DiscImages Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] vHdr_b = new byte[Marshal.SizeOf(vHdr)]; stream.Read(vHdr_b, 0, Marshal.SizeOf(vHdr)); @@ -172,7 +167,8 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("VirtualBox plugin", "vHdr.creator = {0}", vHdr.creator); DicConsole.DebugWriteLine("VirtualBox plugin", "vHdr.magic = {0}", vHdr.magic); - DicConsole.DebugWriteLine("VirtualBox plugin", "vHdr.version = {0}.{1}", vHdr.majorVersion, vHdr.minorVersion); + DicConsole.DebugWriteLine("VirtualBox plugin", "vHdr.version = {0}.{1}", vHdr.majorVersion, + vHdr.minorVersion); DicConsole.DebugWriteLine("VirtualBox plugin", "vHdr.headerSize = {0}", vHdr.headerSize); DicConsole.DebugWriteLine("VirtualBox plugin", "vHdr.imageType = {0}", vHdr.imageType); DicConsole.DebugWriteLine("VirtualBox plugin", "vHdr.imageFlags = {0}", vHdr.imageFlags); @@ -194,12 +190,11 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("VirtualBox plugin", "vHdr.parentUuid = {0}", vHdr.parentUuid); DicConsole.DebugWriteLine("VirtualBox plugin", "Reading Image Block Map"); - stream.Seek(vHdr.offsetBlocks, SeekOrigin.Begin); + stream.Seek(vHdr.offsetBlocks, SeekOrigin.Begin); IBM = new uint[vHdr.blocks]; byte[] IBM_b = new byte[vHdr.blocks * 4]; stream.Read(IBM_b, 0, IBM_b.Length); - for(int i = 0; i < IBM.Length; i++) - IBM[i] = BitConverter.ToUInt32(IBM_b, i * 4); + for(int i = 0; i < IBM.Length; i++) IBM[i] = BitConverter.ToUInt32(IBM_b, i * 4); sectorCache = new Dictionary<ulong, byte[]>(); @@ -233,24 +228,25 @@ namespace DiscImageChef.DiscImages ImageInfo.imageApplication = "innotek VirtualBox"; break; } + imageStream = stream; - ImageInfo.cylinders = vHdr.cylinders; - ImageInfo.heads = vHdr.heads; - ImageInfo.sectorsPerTrack = vHdr.spt; + ImageInfo.cylinders = vHdr.cylinders; + ImageInfo.heads = vHdr.heads; + ImageInfo.sectorsPerTrack = vHdr.spt; - return true; + return true; } public override byte[] ReadSector(ulong sectorAddress) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); byte[] sector; - if(sectorCache.TryGetValue(sectorAddress, out sector)) - return sector; + if(sectorCache.TryGetValue(sectorAddress, out sector)) return sector; ulong index = (sectorAddress * vHdr.sectorSize) / vHdr.blockSize; ulong secOff = (sectorAddress * vHdr.sectorSize) % vHdr.blockSize; @@ -258,8 +254,7 @@ namespace DiscImageChef.DiscImages uint ibmOff = IBM[index]; ulong imageOff; - if(ibmOff == VDIEmpty) - return new byte[vHdr.sectorSize]; + if(ibmOff == VDIEmpty) return new byte[vHdr.sectorSize]; imageOff = vHdr.offsetData + (ibmOff * vHdr.blockSize); @@ -269,8 +264,7 @@ namespace DiscImageChef.DiscImages sector = new byte[vHdr.sectorSize]; Array.Copy(cluster, (int)secOff, sector, 0, vHdr.sectorSize); - if(sectorCache.Count > maxCachedSectors) - sectorCache.Clear(); + if(sectorCache.Count > maxCachedSectors) sectorCache.Clear(); sectorCache.Add(sectorAddress, sector); @@ -280,10 +274,14 @@ namespace DiscImageChef.DiscImages public override byte[] ReadSectors(ulong sectorAddress, uint length) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0} + {1}) than available ({2})", sectorAddress, length, ImageInfo.sectors)); + throw new ArgumentOutOfRangeException(nameof(length), + string + .Format("Requested more sectors ({0} + {1}) than available ({2})", + sectorAddress, length, ImageInfo.sectors)); MemoryStream ms = new MemoryStream(); @@ -367,7 +365,6 @@ namespace DiscImageChef.DiscImages } #region Unsupported features - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -508,16 +505,18 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -526,7 +525,6 @@ namespace DiscImageChef.DiscImages { return null; } - #endregion } -} +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/VHD.cs b/DiscImageChef.DiscImages/VHD.cs index 4a847276..8802d9eb 100644 --- a/DiscImageChef.DiscImages/VHD.cs +++ b/DiscImageChef.DiscImages/VHD.cs @@ -41,16 +41,15 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - /// <summary> - /// Supports Connectix/Microsoft Virtual PC hard disk image format - /// Until Virtual PC 5 there existed no format, and the hard disk image was - /// merely a sector by sector (RAW) image with a resource fork giving - /// information to Virtual PC itself. - /// </summary> - public class VHD : ImagePlugin + /// <summary> + /// Supports Connectix/Microsoft Virtual PC hard disk image format + /// Until Virtual PC 5 there existed no format, and the hard disk image was + /// merely a sector by sector (RAW) image with a resource fork giving + /// information to Virtual PC itself. + /// </summary> + public class VHD : ImagePlugin { #region Internal Structures - struct HardDiskFooter { /// <summary> @@ -207,14 +206,11 @@ namespace DiscImageChef.ImagePlugins [StructLayout(LayoutKind.Sequential, Pack = 1)] struct BATSector { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public uint[] blockPointer; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public uint[] blockPointer; } - #endregion #region Internal Constants - /// <summary> /// File magic number, "conectix" /// </summary> @@ -346,11 +342,9 @@ namespace DiscImageChef.ImagePlugins /// Stores a Mac OS X URI (RFC-2396) absolute path in UTF-8, "MacX" /// </summary> const uint platformCodeMacintoshURI = 0x4D616358; - #endregion #region Internal variables - HardDiskFooter thisFooter; DynamicDiskHeader thisDynamic; DateTime thisDateTime; @@ -360,7 +354,6 @@ namespace DiscImageChef.ImagePlugins uint bitmapSize; byte[][] locatorEntriesData; ImagePlugin parentImage; - #endregion public VHD() @@ -391,7 +384,6 @@ namespace DiscImageChef.ImagePlugins } #region public methods - public override bool IdentifyImage(Filter imageFilter) { Stream imageStream = imageFilter.GetDataForkStream(); @@ -401,10 +393,8 @@ namespace DiscImageChef.ImagePlugins byte[] headerCookieBytes = new byte[8]; byte[] footerCookieBytes = new byte[8]; - if((imageStream.Length % 2) == 0) - imageStream.Seek(-512, SeekOrigin.End); - else - imageStream.Seek(-511, SeekOrigin.End); + if((imageStream.Length % 2) == 0) imageStream.Seek(-512, SeekOrigin.End); + else imageStream.Seek(-511, SeekOrigin.End); imageStream.Read(footerCookieBytes, 0, 8); imageStream.Seek(0, SeekOrigin.Begin); @@ -458,8 +448,10 @@ namespace DiscImageChef.ImagePlugins uint headerCalculatedChecksum = VHDChecksum(header); uint footerCalculatedChecksum = VHDChecksum(footer); - DicConsole.DebugWriteLine("VirtualPC plugin", "Header checksum = 0x{0:X8}, calculated = 0x{1:X8}", headerChecksum, headerCalculatedChecksum); - DicConsole.DebugWriteLine("VirtualPC plugin", "Header checksum = 0x{0:X8}, calculated = 0x{1:X8}", footerChecksum, footerCalculatedChecksum); + DicConsole.DebugWriteLine("VirtualPC plugin", "Header checksum = 0x{0:X8}, calculated = 0x{1:X8}", + headerChecksum, headerCalculatedChecksum); + DicConsole.DebugWriteLine("VirtualPC plugin", "Header checksum = 0x{0:X8}, calculated = 0x{1:X8}", + footerChecksum, footerCalculatedChecksum); byte[] usableHeader; uint usableChecksum; @@ -475,7 +467,8 @@ namespace DiscImageChef.ImagePlugins usableChecksum = footerChecksum; } else - throw new ImageNotSupportedException("(VirtualPC plugin): Both header and footer are corrupt, image cannot be opened."); + throw new + ImageNotSupportedException("(VirtualPC plugin): Both header and footer are corrupt, image cannot be opened."); thisFooter = new HardDiskFooter(); thisFooter.cookie = BigEndianBitConverter.ToUInt64(usableHeader, 0x00); @@ -507,120 +500,149 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("VirtualPC plugin", "footer.features = 0x{0:X8}", thisFooter.features); DicConsole.DebugWriteLine("VirtualPC plugin", "footer.version = 0x{0:X8}", thisFooter.version); DicConsole.DebugWriteLine("VirtualPC plugin", "footer.offset = {0}", thisFooter.offset); - DicConsole.DebugWriteLine("VirtualPC plugin", "footer.timestamp = 0x{0:X8} ({1})", thisFooter.timestamp, thisDateTime); - DicConsole.DebugWriteLine("VirtualPC plugin", "footer.creatorApplication = 0x{0:X8} (\"{1}\")", thisFooter.creatorApplication, - Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(thisFooter.creatorApplication))); - DicConsole.DebugWriteLine("VirtualPC plugin", "footer.creatorVersion = 0x{0:X8}", thisFooter.creatorVersion); - DicConsole.DebugWriteLine("VirtualPC plugin", "footer.creatorHostOS = 0x{0:X8} (\"{1}\")", thisFooter.creatorHostOS, - Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(thisFooter.creatorHostOS))); + DicConsole.DebugWriteLine("VirtualPC plugin", "footer.timestamp = 0x{0:X8} ({1})", thisFooter.timestamp, + thisDateTime); + DicConsole.DebugWriteLine("VirtualPC plugin", "footer.creatorApplication = 0x{0:X8} (\"{1}\")", + thisFooter.creatorApplication, + Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(thisFooter + .creatorApplication))); + DicConsole.DebugWriteLine("VirtualPC plugin", "footer.creatorVersion = 0x{0:X8}", + thisFooter.creatorVersion); + DicConsole.DebugWriteLine("VirtualPC plugin", "footer.creatorHostOS = 0x{0:X8} (\"{1}\")", + thisFooter.creatorHostOS, + Encoding.ASCII.GetString(BigEndianBitConverter + .GetBytes(thisFooter.creatorHostOS))); DicConsole.DebugWriteLine("VirtualPC plugin", "footer.originalSize = {0}", thisFooter.originalSize); DicConsole.DebugWriteLine("VirtualPC plugin", "footer.currentSize = {0}", thisFooter.currentSize); - DicConsole.DebugWriteLine("VirtualPC plugin", "footer.diskGeometry = 0x{0:X8} (C/H/S: {1}/{2}/{3})", thisFooter.diskGeometry, - (thisFooter.diskGeometry & 0xFFFF0000) >> 16, (thisFooter.diskGeometry & 0xFF00) >> 8, (thisFooter.diskGeometry & 0xFF)); + DicConsole.DebugWriteLine("VirtualPC plugin", "footer.diskGeometry = 0x{0:X8} (C/H/S: {1}/{2}/{3})", + thisFooter.diskGeometry, (thisFooter.diskGeometry & 0xFFFF0000) >> 16, + (thisFooter.diskGeometry & 0xFF00) >> 8, (thisFooter.diskGeometry & 0xFF)); DicConsole.DebugWriteLine("VirtualPC plugin", "footer.diskType = 0x{0:X8}", thisFooter.diskType); DicConsole.DebugWriteLine("VirtualPC plugin", "footer.checksum = 0x{0:X8}", thisFooter.checksum); DicConsole.DebugWriteLine("VirtualPC plugin", "footer.uniqueId = {0}", thisFooter.uniqueId); DicConsole.DebugWriteLine("VirtualPC plugin", "footer.savedState = 0x{0:X2}", thisFooter.savedState); DicConsole.DebugWriteLine("VirtualPC plugin", "footer.reserved's SHA1 = 0x{0}", sha1Ctx.End()); - if(thisFooter.version == Version1) - ImageInfo.imageVersion = "1.0"; + if(thisFooter.version == Version1) ImageInfo.imageVersion = "1.0"; else - throw new ImageNotSupportedException(string.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", thisFooter.diskType)); + throw new + ImageNotSupportedException(string.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", + thisFooter.diskType)); switch(thisFooter.creatorApplication) { case CreatorQEMU: - { - ImageInfo.imageApplication = "QEMU"; - // QEMU always set same version - ImageInfo.imageApplicationVersion = "Unknown"; + { + ImageInfo.imageApplication = "QEMU"; + // QEMU always set same version + ImageInfo.imageApplicationVersion = "Unknown"; - break; - } + break; + } case CreatorVirtualBox: + { + ImageInfo.imageApplicationVersion = string.Format("{0}.{1:D2}", + (thisFooter.creatorVersion & 0xFFFF0000) >> 16, + (thisFooter.creatorVersion & 0x0000FFFF)); + switch(thisFooter.creatorHostOS) { - ImageInfo.imageApplicationVersion = string.Format("{0}.{1:D2}", (thisFooter.creatorVersion & 0xFFFF0000) >> 16, (thisFooter.creatorVersion & 0x0000FFFF)); - switch(thisFooter.creatorHostOS) - { - case CreatorMacintosh: - case CreatorMacintoshOld: - ImageInfo.imageApplication = "VirtualBox for Mac"; - break; - case CreatorWindows: - // VirtualBox uses Windows creator for any other OS - ImageInfo.imageApplication = "VirtualBox"; - break; - default: - ImageInfo.imageApplication = string.Format("VirtualBox for unknown OS \"{0}\"", Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(thisFooter.creatorHostOS))); - break; - } - break; + case CreatorMacintosh: + case CreatorMacintoshOld: + ImageInfo.imageApplication = "VirtualBox for Mac"; + break; + case CreatorWindows: + // VirtualBox uses Windows creator for any other OS + ImageInfo.imageApplication = "VirtualBox"; + break; + default: + ImageInfo.imageApplication = string.Format("VirtualBox for unknown OS \"{0}\"", + Encoding.ASCII.GetString(BigEndianBitConverter + .GetBytes(thisFooter + .creatorHostOS))); + break; } + + break; + } case CreatorVirtualServer: + { + ImageInfo.imageApplication = "Microsoft Virtual Server"; + switch(thisFooter.creatorVersion) { - ImageInfo.imageApplication = "Microsoft Virtual Server"; - switch(thisFooter.creatorVersion) - { - case VersionVirtualServer2004: - ImageInfo.imageApplicationVersion = "2004"; - break; - default: - ImageInfo.imageApplicationVersion = string.Format("Unknown version 0x{0:X8}", thisFooter.creatorVersion); - break; - } - break; + case VersionVirtualServer2004: + ImageInfo.imageApplicationVersion = "2004"; + break; + default: + ImageInfo.imageApplicationVersion = + string.Format("Unknown version 0x{0:X8}", thisFooter.creatorVersion); + break; } + + break; + } case CreatorVirtualPC: + { + switch(thisFooter.creatorHostOS) { - switch(thisFooter.creatorHostOS) - { - case CreatorMacintosh: - case CreatorMacintoshOld: - switch(thisFooter.creatorVersion) - { - case VersionVirtualPCMac: - ImageInfo.imageApplication = "Connectix Virtual PC"; - ImageInfo.imageApplicationVersion = "5, 6 or 7"; - break; - default: - ImageInfo.imageApplicationVersion = string.Format("Unknown version 0x{0:X8}", thisFooter.creatorVersion); - break; - } - break; - case CreatorWindows: - switch(thisFooter.creatorVersion) - { - case VersionVirtualPCMac: - ImageInfo.imageApplication = "Connectix Virtual PC"; - ImageInfo.imageApplicationVersion = "5, 6 or 7"; - break; - case VersionVirtualPC2004: - ImageInfo.imageApplication = "Microsoft Virtual PC"; - ImageInfo.imageApplicationVersion = "2004"; - break; - case VersionVirtualPC2007: - ImageInfo.imageApplication = "Microsoft Virtual PC"; - ImageInfo.imageApplicationVersion = "2007"; - break; - default: - ImageInfo.imageApplicationVersion = string.Format("Unknown version 0x{0:X8}", thisFooter.creatorVersion); - break; - } - break; - default: - ImageInfo.imageApplication = string.Format("Virtual PC for unknown OS \"{0}\"", Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(thisFooter.creatorHostOS))); - ImageInfo.imageApplicationVersion = string.Format("Unknown version 0x{0:X8}", thisFooter.creatorVersion); - break; - } - break; + case CreatorMacintosh: + case CreatorMacintoshOld: + switch(thisFooter.creatorVersion) + { + case VersionVirtualPCMac: + ImageInfo.imageApplication = "Connectix Virtual PC"; + ImageInfo.imageApplicationVersion = "5, 6 or 7"; + break; + default: + ImageInfo.imageApplicationVersion = + string.Format("Unknown version 0x{0:X8}", thisFooter.creatorVersion); + break; + } + + break; + case CreatorWindows: + switch(thisFooter.creatorVersion) + { + case VersionVirtualPCMac: + ImageInfo.imageApplication = "Connectix Virtual PC"; + ImageInfo.imageApplicationVersion = "5, 6 or 7"; + break; + case VersionVirtualPC2004: + ImageInfo.imageApplication = "Microsoft Virtual PC"; + ImageInfo.imageApplicationVersion = "2004"; + break; + case VersionVirtualPC2007: + ImageInfo.imageApplication = "Microsoft Virtual PC"; + ImageInfo.imageApplicationVersion = "2007"; + break; + default: + ImageInfo.imageApplicationVersion = + string.Format("Unknown version 0x{0:X8}", thisFooter.creatorVersion); + break; + } + + break; + default: + ImageInfo.imageApplication = string.Format("Virtual PC for unknown OS \"{0}\"", + Encoding.ASCII.GetString(BigEndianBitConverter + .GetBytes(thisFooter + .creatorHostOS))); + ImageInfo.imageApplicationVersion = + string.Format("Unknown version 0x{0:X8}", thisFooter.creatorVersion); + break; } + + break; + } default: - { - ImageInfo.imageApplication = string.Format("Unknown application \"{0}\"", Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(thisFooter.creatorHostOS))); - ImageInfo.imageApplicationVersion = string.Format("Unknown version 0x{0:X8}", thisFooter.creatorVersion); - break; - } + { + ImageInfo.imageApplication = string.Format("Unknown application \"{0}\"", + Encoding.ASCII.GetString(BigEndianBitConverter + .GetBytes(thisFooter + .creatorHostOS))); + ImageInfo.imageApplicationVersion = + string.Format("Unknown version 0x{0:X8}", thisFooter.creatorVersion); + break; + } } thisFilter = imageFilter; @@ -632,11 +654,11 @@ namespace DiscImageChef.ImagePlugins ImageInfo.imageLastModificationTime = thisDateTime; ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.cylinders = (thisFooter.diskGeometry & 0xFFFF0000) >> 16; - ImageInfo.heads = (thisFooter.diskGeometry & 0xFF00) >> 8; - ImageInfo.sectorsPerTrack = (thisFooter.diskGeometry & 0xFF); + ImageInfo.cylinders = (thisFooter.diskGeometry & 0xFFFF0000) >> 16; + ImageInfo.heads = (thisFooter.diskGeometry & 0xFF00) >> 8; + ImageInfo.sectorsPerTrack = (thisFooter.diskGeometry & 0xFF); - if(thisFooter.diskType == typeDynamic || thisFooter.diskType == typeDifferencing) + if(thisFooter.diskType == typeDynamic || thisFooter.diskType == typeDifferencing) { imageStream.Seek((long)thisFooter.offset, SeekOrigin.Begin); byte[] dynamicBytes = new byte[1024]; @@ -651,17 +673,19 @@ namespace DiscImageChef.ImagePlugins uint dynamicChecksumCalculated = VHDChecksum(dynamicBytes); - DicConsole.DebugWriteLine("VirtualPC plugin", "Dynamic header checksum = 0x{0:X8}, calculated = 0x{1:X8}", dynamicChecksum, dynamicChecksumCalculated); + DicConsole.DebugWriteLine("VirtualPC plugin", + "Dynamic header checksum = 0x{0:X8}, calculated = 0x{1:X8}", dynamicChecksum, + dynamicChecksumCalculated); if(dynamicChecksum != dynamicChecksumCalculated) - throw new ImageNotSupportedException("(VirtualPC plugin): Both header and footer are corrupt, image cannot be opened."); + throw new + ImageNotSupportedException("(VirtualPC plugin): Both header and footer are corrupt, image cannot be opened."); thisDynamic = new DynamicDiskHeader(); thisDynamic.locatorEntries = new ParentLocatorEntry[8]; thisDynamic.reserved2 = new byte[256]; - for(int i = 0; i < 8; i++) - thisDynamic.locatorEntries[i] = new ParentLocatorEntry(); + for(int i = 0; i < 8; i++) thisDynamic.locatorEntries[i] = new ParentLocatorEntry(); thisDynamic.cookie = BigEndianBitConverter.ToUInt64(dynamicBytes, 0x00); thisDynamic.dataOffset = BigEndianBitConverter.ToUInt64(dynamicBytes, 0x08); @@ -677,11 +701,16 @@ namespace DiscImageChef.ImagePlugins for(int i = 0; i < 8; i++) { - thisDynamic.locatorEntries[i].platformCode = BigEndianBitConverter.ToUInt32(dynamicBytes, 0x240 + 0x00 + 24 * i); - thisDynamic.locatorEntries[i].platformDataSpace = BigEndianBitConverter.ToUInt32(dynamicBytes, 0x240 + 0x04 + 24 * i); - thisDynamic.locatorEntries[i].platformDataLength = BigEndianBitConverter.ToUInt32(dynamicBytes, 0x240 + 0x08 + 24 * i); - thisDynamic.locatorEntries[i].reserved = BigEndianBitConverter.ToUInt32(dynamicBytes, 0x240 + 0x0C + 24 * i); - thisDynamic.locatorEntries[i].platformDataOffset = BigEndianBitConverter.ToUInt64(dynamicBytes, 0x240 + 0x10 + 24 * i); + thisDynamic.locatorEntries[i].platformCode = + BigEndianBitConverter.ToUInt32(dynamicBytes, 0x240 + 0x00 + 24 * i); + thisDynamic.locatorEntries[i].platformDataSpace = + BigEndianBitConverter.ToUInt32(dynamicBytes, 0x240 + 0x04 + 24 * i); + thisDynamic.locatorEntries[i].platformDataLength = + BigEndianBitConverter.ToUInt32(dynamicBytes, 0x240 + 0x08 + 24 * i); + thisDynamic.locatorEntries[i].reserved = + BigEndianBitConverter.ToUInt32(dynamicBytes, 0x240 + 0x0C + 24 * i); + thisDynamic.locatorEntries[i].platformDataOffset = + BigEndianBitConverter.ToUInt64(dynamicBytes, 0x240 + 0x10 + 24 * i); } Array.Copy(dynamicBytes, 0x300, thisDynamic.reserved2, 0, 256); @@ -696,27 +725,44 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.cookie = 0x{0:X8}", thisDynamic.cookie); DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.dataOffset = {0}", thisDynamic.dataOffset); DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.tableOffset = {0}", thisDynamic.tableOffset); - DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.headerVersion = 0x{0:X8}", thisDynamic.headerVersion); - DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.maxTableEntries = {0}", thisDynamic.maxTableEntries); + DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.headerVersion = 0x{0:X8}", + thisDynamic.headerVersion); + DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.maxTableEntries = {0}", + thisDynamic.maxTableEntries); DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.blockSize = {0}", thisDynamic.blockSize); DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.checksum = 0x{0:X8}", thisDynamic.checksum); DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.parentID = {0}", thisDynamic.parentID); - DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.parentTimestamp = 0x{0:X8} ({1})", thisDynamic.parentTimestamp, parentDateTime); + DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.parentTimestamp = 0x{0:X8} ({1})", + thisDynamic.parentTimestamp, parentDateTime); DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.reserved = 0x{0:X8}", thisDynamic.reserved); for(int i = 0; i < 8; i++) { - DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.locatorEntries[{0}].platformCode = 0x{1:X8} (\"{2}\")", i, thisDynamic.locatorEntries[i].platformCode, - Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(thisDynamic.locatorEntries[i].platformCode))); - DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.locatorEntries[{0}].platformDataSpace = {1}", i, thisDynamic.locatorEntries[i].platformDataSpace); - DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.locatorEntries[{0}].platformDataLength = {1}", i, thisDynamic.locatorEntries[i].platformDataLength); - DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.locatorEntries[{0}].reserved = 0x{1:X8}", i, thisDynamic.locatorEntries[i].reserved); - DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.locatorEntries[{0}].platformDataOffset = {1}", i, thisDynamic.locatorEntries[i].platformDataOffset); + DicConsole.DebugWriteLine("VirtualPC plugin", + "dynamic.locatorEntries[{0}].platformCode = 0x{1:X8} (\"{2}\")", i, + thisDynamic.locatorEntries[i].platformCode, + Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(thisDynamic + .locatorEntries + [i] + .platformCode))); + DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.locatorEntries[{0}].platformDataSpace = {1}", + i, thisDynamic.locatorEntries[i].platformDataSpace); + DicConsole.DebugWriteLine("VirtualPC plugin", + "dynamic.locatorEntries[{0}].platformDataLength = {1}", i, + thisDynamic.locatorEntries[i].platformDataLength); + DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.locatorEntries[{0}].reserved = 0x{1:X8}", i, + thisDynamic.locatorEntries[i].reserved); + DicConsole.DebugWriteLine("VirtualPC plugin", + "dynamic.locatorEntries[{0}].platformDataOffset = {1}", i, + thisDynamic.locatorEntries[i].platformDataOffset); } + DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.parentName = \"{0}\"", thisDynamic.parentName); DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.reserved2's SHA1 = 0x{0}", sha1Ctx.End()); if(thisDynamic.headerVersion != Version1) - throw new ImageNotSupportedException(string.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", thisFooter.diskType)); + throw new + ImageNotSupportedException(string.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", + thisFooter.diskType)); DateTime startTime = DateTime.UtcNow; @@ -755,11 +801,13 @@ namespace DiscImageChef.ImagePlugins if(blockAllocationTable.Length >= (i * 512) / 4 + 512 / 4) Array.Copy(batSector.blockPointer, 0, blockAllocationTable, (i * 512) / 4, 512 / 4); else - Array.Copy(batSector.blockPointer, 0, blockAllocationTable, (i * 512) / 4, blockAllocationTable.Length - (i * 512) / 4); + Array.Copy(batSector.blockPointer, 0, blockAllocationTable, (i * 512) / 4, + blockAllocationTable.Length - (i * 512) / 4); } DateTime endTime = DateTime.UtcNow; - DicConsole.DebugWriteLine("VirtualPC plugin", "Filling the BAT took {0} seconds", (endTime - startTime).TotalSeconds); + DicConsole.DebugWriteLine("VirtualPC plugin", "Filling the BAT took {0} seconds", + (endTime - startTime).TotalSeconds); // Too noisy /* @@ -769,12 +817,12 @@ namespace DiscImageChef.ImagePlugins // Get the roundest number of sectors needed to store the block bitmap bitmapSize = (uint)Math.Ceiling(( - // How many sectors do a block store - ((double)thisDynamic.blockSize / 512) - // 1 bit per sector on the bitmap - / 8 - // and aligned to 512 byte boundary - / 512)); + // How many sectors do a block store + ((double)thisDynamic.blockSize / 512) + // 1 bit per sector on the bitmap + / 8 + // and aligned to 512 byte boundary + / 512)); DicConsole.DebugWriteLine("VirtualPC plugin", "Bitmap is {0} sectors", bitmapSize); } @@ -784,126 +832,143 @@ namespace DiscImageChef.ImagePlugins { case typeFixed: case typeDynamic: - { - // Nothing to do here, really. - return true; - } + { + // Nothing to do here, really. + return true; + } case typeDifferencing: + { + locatorEntriesData = new byte[8][]; + for(int i = 0; i < 8; i++) { - locatorEntriesData = new byte[8][]; - for(int i = 0; i < 8; i++) + if(thisDynamic.locatorEntries[i].platformCode != 0x00000000) { - if(thisDynamic.locatorEntries[i].platformCode != 0x00000000) - { - locatorEntriesData[i] = new byte[thisDynamic.locatorEntries[i].platformDataLength]; - imageStream.Seek((long)thisDynamic.locatorEntries[i].platformDataOffset, SeekOrigin.Begin); - imageStream.Read(locatorEntriesData[i], 0, (int)thisDynamic.locatorEntries[i].platformDataLength); + locatorEntriesData[i] = new byte[thisDynamic.locatorEntries[i].platformDataLength]; + imageStream.Seek((long)thisDynamic.locatorEntries[i].platformDataOffset, SeekOrigin.Begin); + imageStream.Read(locatorEntriesData[i], 0, + (int)thisDynamic.locatorEntries[i].platformDataLength); - switch(thisDynamic.locatorEntries[i].platformCode) - { - case platformCodeWindowsAbsolute: - case platformCodeWindowsRelative: - DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.locatorEntries[{0}] = \"{1}\"", i, Encoding.ASCII.GetString(locatorEntriesData[i])); - break; - case platformCodeWindowsAbsoluteU: - case platformCodeWindowsRelativeU: - DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.locatorEntries[{0}] = \"{1}\"", i, Encoding.BigEndianUnicode.GetString(locatorEntriesData[i])); - break; - case platformCodeMacintoshURI: - DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.locatorEntries[{0}] = \"{1}\"", i, Encoding.UTF8.GetString(locatorEntriesData[i])); - break; - default: - DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.locatorEntries[{0}] =", i); - PrintHex.PrintHexArray(locatorEntriesData[i], 64); - break; - } - } - } - - int currentLocator = 0; - bool locatorFound = false; - string parentPath = null; - FiltersList filters; - - while(!locatorFound && currentLocator < 8) - { - switch(thisDynamic.locatorEntries[currentLocator].platformCode) + switch(thisDynamic.locatorEntries[i].platformCode) { case platformCodeWindowsAbsolute: case platformCodeWindowsRelative: - parentPath = Encoding.ASCII.GetString(locatorEntriesData[currentLocator]); + DicConsole.DebugWriteLine("VirtualPC plugin", + "dynamic.locatorEntries[{0}] = \"{1}\"", i, + Encoding.ASCII.GetString(locatorEntriesData[i])); break; case platformCodeWindowsAbsoluteU: case platformCodeWindowsRelativeU: - parentPath = Encoding.BigEndianUnicode.GetString(locatorEntriesData[currentLocator]); + DicConsole.DebugWriteLine("VirtualPC plugin", + "dynamic.locatorEntries[{0}] = \"{1}\"", i, + Encoding.BigEndianUnicode + .GetString(locatorEntriesData[i])); break; case platformCodeMacintoshURI: - parentPath = Uri.UnescapeDataString(Encoding.UTF8.GetString(locatorEntriesData[currentLocator])); - if(parentPath.StartsWith("file://localhost", StringComparison.InvariantCulture)) - parentPath = parentPath.Remove(0, 16); - else - { - DicConsole.DebugWriteLine("VirtualPC plugin", "Unsupported protocol classified found in URI parent path: \"{0}\"", parentPath); - parentPath = null; - } + DicConsole.DebugWriteLine("VirtualPC plugin", + "dynamic.locatorEntries[{0}] = \"{1}\"", i, + Encoding.UTF8.GetString(locatorEntriesData[i])); + break; + default: + DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.locatorEntries[{0}] =", i); + PrintHex.PrintHexArray(locatorEntriesData[i], 64); break; } - - if(parentPath != null) - { - DicConsole.DebugWriteLine("VirtualPC plugin", "Possible parent path: \"{0}\"", parentPath); - Filter parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentPath)); - - if(parentFilter != null) - locatorFound = true; - - if(!locatorFound) - parentPath = null; - } - currentLocator++; } - - if(!locatorFound || parentPath == null) - throw new FileNotFoundException("(VirtualPC plugin): Cannot find parent file for differencing disk image"); - else - { - parentImage = new VHD(); - Filter parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentPath)); - - if(parentFilter == null) - throw new ImageNotSupportedException("(VirtualPC plugin): Cannot find parent image filter"); - /* PluginBase plugins = new PluginBase(); - plugins.RegisterAllPlugins(); - if (!plugins.ImagePluginsList.TryGetValue(Name.ToLower(), out parentImage)) - throw new SystemException("(VirtualPC plugin): Unable to open myself");*/ - - if(!parentImage.IdentifyImage(parentFilter)) - throw new ImageNotSupportedException("(VirtualPC plugin): Parent image is not a Virtual PC disk image"); - - if(!parentImage.OpenImage(parentFilter)) - throw new ImageNotSupportedException("(VirtualPC plugin): Cannot open parent disk image"); - - // While specification says that parent and child disk images should contain UUID relationship - // in reality it seems that old differencing disk images stored a parent UUID that, nonetheless - // the parent never stored itself. So the only real way to know that images are related is - // because the parent IS found and SAME SIZE. Ugly... - // More funny even, tested parent images show an empty host OS, and child images a correct one. - if(parentImage.GetSectors() != GetSectors()) - throw new ImageNotSupportedException("(VirtualPC plugin): Parent image is of different size"); - } - - return true; } + + int currentLocator = 0; + bool locatorFound = false; + string parentPath = null; + FiltersList filters; + + while(!locatorFound && currentLocator < 8) + { + switch(thisDynamic.locatorEntries[currentLocator].platformCode) + { + case platformCodeWindowsAbsolute: + case platformCodeWindowsRelative: + parentPath = Encoding.ASCII.GetString(locatorEntriesData[currentLocator]); + break; + case platformCodeWindowsAbsoluteU: + case platformCodeWindowsRelativeU: + parentPath = Encoding.BigEndianUnicode.GetString(locatorEntriesData[currentLocator]); + break; + case platformCodeMacintoshURI: + parentPath = + Uri.UnescapeDataString(Encoding.UTF8.GetString(locatorEntriesData[currentLocator])); + if(parentPath.StartsWith("file://localhost", StringComparison.InvariantCulture)) + parentPath = parentPath.Remove(0, 16); + else + { + DicConsole.DebugWriteLine("VirtualPC plugin", + "Unsupported protocol classified found in URI parent path: \"{0}\"", + parentPath); + parentPath = null; + } + break; + } + + if(parentPath != null) + { + DicConsole.DebugWriteLine("VirtualPC plugin", "Possible parent path: \"{0}\"", parentPath); + Filter parentFilter = + new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentPath)); + + if(parentFilter != null) locatorFound = true; + + if(!locatorFound) parentPath = null; + } + currentLocator++; + } + + if(!locatorFound || parentPath == null) + throw new + FileNotFoundException("(VirtualPC plugin): Cannot find parent file for differencing disk image"); + else + { + parentImage = new VHD(); + Filter parentFilter = + new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentPath)); + + if(parentFilter == null) + throw new ImageNotSupportedException("(VirtualPC plugin): Cannot find parent image filter"); + /* PluginBase plugins = new PluginBase(); + plugins.RegisterAllPlugins(); + if (!plugins.ImagePluginsList.TryGetValue(Name.ToLower(), out parentImage)) + throw new SystemException("(VirtualPC plugin): Unable to open myself");*/ + + if(!parentImage.IdentifyImage(parentFilter)) + throw new + ImageNotSupportedException("(VirtualPC plugin): Parent image is not a Virtual PC disk image"); + + if(!parentImage.OpenImage(parentFilter)) + throw new ImageNotSupportedException("(VirtualPC plugin): Cannot open parent disk image"); + + // While specification says that parent and child disk images should contain UUID relationship + // in reality it seems that old differencing disk images stored a parent UUID that, nonetheless + // the parent never stored itself. So the only real way to know that images are related is + // because the parent IS found and SAME SIZE. Ugly... + // More funny even, tested parent images show an empty host OS, and child images a correct one. + if(parentImage.GetSectors() != GetSectors()) + throw new + ImageNotSupportedException("(VirtualPC plugin): Parent image is of different size"); + } + + return true; + } case typeDeprecated1: case typeDeprecated2: case typeDeprecated3: - { - throw new ImageNotSupportedException("(VirtualPC plugin): Deprecated image type found. Please submit a bug with an example image."); - } + { + throw new + ImageNotSupportedException("(VirtualPC plugin): Deprecated image type found. Please submit a bug with an example image."); + } default: - { - throw new ImageNotSupportedException(string.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", thisFooter.diskType)); - } + { + throw new + ImageNotSupportedException(string.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", + thisFooter.diskType)); + } } } @@ -931,14 +996,10 @@ namespace DiscImageChef.ImagePlugins { switch(thisFooter.diskType) { - case typeFixed: - return "Virtual PC fixed size disk image"; - case typeDynamic: - return "Virtual PC dynamic size disk image"; - case typeDifferencing: - return "Virtual PC differencing disk image"; - default: - return "Virtual PC disk image"; + case typeFixed: return "Virtual PC fixed size disk image"; + case typeDynamic: return "Virtual PC dynamic size disk image"; + case typeDifferencing: return "Virtual PC differencing disk image"; + default: return "Virtual PC disk image"; } } @@ -987,67 +1048,66 @@ namespace DiscImageChef.ImagePlugins switch(thisFooter.diskType) { case typeDifferencing: + { + // Block number for BAT searching + uint blockNumber = (uint)Math.Floor((double)(sectorAddress / (thisDynamic.blockSize / 512))); + // Sector number inside of block + uint sectorInBlock = (uint)(sectorAddress % (thisDynamic.blockSize / 512)); + + byte[] bitmap = new byte[bitmapSize * 512]; + + // Offset of block in file + uint blockOffset = blockAllocationTable[blockNumber] * 512; + + int bitmapByte = (int)Math.Floor((double)sectorInBlock / 8); + int bitmapBit = (int)(sectorInBlock % 8); + + Stream thisStream = thisFilter.GetDataForkStream(); + + thisStream.Seek(blockOffset, SeekOrigin.Begin); + thisStream.Read(bitmap, 0, (int)bitmapSize * 512); + + byte mask = (byte)(1 << (7 - bitmapBit)); + bool dirty = false || (bitmap[bitmapByte] & mask) == mask; + + /* + DicConsole.DebugWriteLine("VirtualPC plugin", "bitmapSize = {0}", bitmapSize); + DicConsole.DebugWriteLine("VirtualPC plugin", "blockNumber = {0}", blockNumber); + DicConsole.DebugWriteLine("VirtualPC plugin", "sectorInBlock = {0}", sectorInBlock); + DicConsole.DebugWriteLine("VirtualPC plugin", "blockOffset = {0}", blockOffset); + DicConsole.DebugWriteLine("VirtualPC plugin", "bitmapByte = {0}", bitmapByte); + DicConsole.DebugWriteLine("VirtualPC plugin", "bitmapBit = {0}", bitmapBit); + DicConsole.DebugWriteLine("VirtualPC plugin", "mask = 0x{0:X2}", mask); + DicConsole.DebugWriteLine("VirtualPC plugin", "dirty = 0x{0}", dirty); + DicConsole.DebugWriteLine("VirtualPC plugin", "bitmap = "); + PrintHex.PrintHexArray(bitmap, 64); + */ + + // Sector has been written, read from child image + if(dirty) { - // Block number for BAT searching - uint blockNumber = (uint)Math.Floor((double)(sectorAddress / (thisDynamic.blockSize / 512))); - // Sector number inside of block - uint sectorInBlock = (uint)(sectorAddress % (thisDynamic.blockSize / 512)); - - byte[] bitmap = new byte[bitmapSize * 512]; - - // Offset of block in file - uint blockOffset = blockAllocationTable[blockNumber] * 512; - - int bitmapByte = (int)Math.Floor((double)sectorInBlock / 8); - int bitmapBit = (int)(sectorInBlock % 8); - - Stream thisStream = thisFilter.GetDataForkStream(); - - thisStream.Seek(blockOffset, SeekOrigin.Begin); - thisStream.Read(bitmap, 0, (int)bitmapSize * 512); - - byte mask = (byte)(1 << (7 - bitmapBit)); - bool dirty = false || (bitmap[bitmapByte] & mask) == mask; - - /* - DicConsole.DebugWriteLine("VirtualPC plugin", "bitmapSize = {0}", bitmapSize); - DicConsole.DebugWriteLine("VirtualPC plugin", "blockNumber = {0}", blockNumber); - DicConsole.DebugWriteLine("VirtualPC plugin", "sectorInBlock = {0}", sectorInBlock); - DicConsole.DebugWriteLine("VirtualPC plugin", "blockOffset = {0}", blockOffset); - DicConsole.DebugWriteLine("VirtualPC plugin", "bitmapByte = {0}", bitmapByte); - DicConsole.DebugWriteLine("VirtualPC plugin", "bitmapBit = {0}", bitmapBit); - DicConsole.DebugWriteLine("VirtualPC plugin", "mask = 0x{0:X2}", mask); - DicConsole.DebugWriteLine("VirtualPC plugin", "dirty = 0x{0}", dirty); - DicConsole.DebugWriteLine("VirtualPC plugin", "bitmap = "); - PrintHex.PrintHexArray(bitmap, 64); - */ - - // Sector has been written, read from child image - if(dirty) - { - /* Too noisy - DicConsole.DebugWriteLine("VirtualPC plugin", "Sector {0} is dirty", sectorAddress); - */ - - byte[] data = new byte[512]; - uint sectorOffset = blockAllocationTable[blockNumber] + bitmapSize + sectorInBlock; - thisStream = thisFilter.GetDataForkStream(); - - thisStream.Seek((sectorOffset * 512), SeekOrigin.Begin); - thisStream.Read(data, 0, 512); - - return data; - } - /* Too noisy - DicConsole.DebugWriteLine("VirtualPC plugin", "Sector {0} is clean", sectorAddress); + DicConsole.DebugWriteLine("VirtualPC plugin", "Sector {0} is dirty", sectorAddress); */ - // Read sector from parent image - return parentImage.ReadSector(sectorAddress); + byte[] data = new byte[512]; + uint sectorOffset = blockAllocationTable[blockNumber] + bitmapSize + sectorInBlock; + thisStream = thisFilter.GetDataForkStream(); + + thisStream.Seek((sectorOffset * 512), SeekOrigin.Begin); + thisStream.Read(data, 0, 512); + + return data; } - default: - return ReadSectors(sectorAddress, 1); + + /* Too noisy + DicConsole.DebugWriteLine("VirtualPC plugin", "Sector {0} is clean", sectorAddress); + */ + + // Read sector from parent image + return parentImage.ReadSector(sectorAddress); + } + default: return ReadSectors(sectorAddress, 1); } } @@ -1056,116 +1116,114 @@ namespace DiscImageChef.ImagePlugins switch(thisFooter.diskType) { case typeFixed: - { - Stream thisStream; + { + Stream thisStream; - byte[] data = new byte[512 * length]; - thisStream = thisFilter.GetDataForkStream(); + byte[] data = new byte[512 * length]; + thisStream = thisFilter.GetDataForkStream(); - thisStream.Seek((long)(sectorAddress * 512), SeekOrigin.Begin); - thisStream.Read(data, 0, (int)(512 * length)); + thisStream.Seek((long)(sectorAddress * 512), SeekOrigin.Begin); + thisStream.Read(data, 0, (int)(512 * length)); - return data; - } + return data; + } // Contrary to Microsoft's specifications that tell us to check the bitmap // and in case of unused sector just return zeros, as blocks are allocated // as a whole, this would waste time and miss cache, so we read any sector // as long as it is in the block. case typeDynamic: + { + Stream thisStream; + + // Block number for BAT searching + uint blockNumber = (uint)Math.Floor((double)(sectorAddress / (thisDynamic.blockSize / 512))); + // Sector number inside of block + uint sectorInBlock = (uint)(sectorAddress % (thisDynamic.blockSize / 512)); + // How many sectors before reaching end of block + uint remainingInBlock = (thisDynamic.blockSize / 512) - sectorInBlock; + + // Data that can be read in this block + byte[] prefix; + // Data that needs to be read from another block + byte[] suffix = null; + + // How many sectors to read from this block + uint sectorsToReadHere; + + // Asked to read more sectors than are remaining in block + if(length > remainingInBlock) { - Stream thisStream; - - // Block number for BAT searching - uint blockNumber = (uint)Math.Floor((double)(sectorAddress / (thisDynamic.blockSize / 512))); - // Sector number inside of block - uint sectorInBlock = (uint)(sectorAddress % (thisDynamic.blockSize / 512)); - // How many sectors before reaching end of block - uint remainingInBlock = (thisDynamic.blockSize / 512) - sectorInBlock; - - // Data that can be read in this block - byte[] prefix; - // Data that needs to be read from another block - byte[] suffix = null; - - // How many sectors to read from this block - uint sectorsToReadHere; - - // Asked to read more sectors than are remaining in block - if(length > remainingInBlock) - { - suffix = ReadSectors(sectorAddress + remainingInBlock, length - remainingInBlock); - sectorsToReadHere = remainingInBlock; - } - else - sectorsToReadHere = length; - - // Offset of sector in file - uint sectorOffset = blockAllocationTable[blockNumber] + bitmapSize + sectorInBlock; - prefix = new byte[sectorsToReadHere * 512]; - - // 0xFFFFFFFF means unallocated - if(sectorOffset != 0xFFFFFFFF) - { - thisStream = thisFilter.GetDataForkStream(); - thisStream.Seek((sectorOffset * 512), SeekOrigin.Begin); - thisStream.Read(prefix, 0, (int)(512 * sectorsToReadHere)); - } - // If it is unallocated, just fill with zeroes - else - Array.Clear(prefix, 0, prefix.Length); - - // If we needed to read from another block, join all the data - if(suffix != null) - { - byte[] data = new byte[512 * length]; - Array.Copy(prefix, 0, data, 0, prefix.Length); - Array.Copy(suffix, 0, data, prefix.Length, suffix.Length); - return data; - } - - return prefix; + suffix = ReadSectors(sectorAddress + remainingInBlock, length - remainingInBlock); + sectorsToReadHere = remainingInBlock; } + else sectorsToReadHere = length; + + // Offset of sector in file + uint sectorOffset = blockAllocationTable[blockNumber] + bitmapSize + sectorInBlock; + prefix = new byte[sectorsToReadHere * 512]; + + // 0xFFFFFFFF means unallocated + if(sectorOffset != 0xFFFFFFFF) + { + thisStream = thisFilter.GetDataForkStream(); + thisStream.Seek((sectorOffset * 512), SeekOrigin.Begin); + thisStream.Read(prefix, 0, (int)(512 * sectorsToReadHere)); + } + // If it is unallocated, just fill with zeroes + else Array.Clear(prefix, 0, prefix.Length); + + // If we needed to read from another block, join all the data + if(suffix != null) + { + byte[] data = new byte[512 * length]; + Array.Copy(prefix, 0, data, 0, prefix.Length); + Array.Copy(suffix, 0, data, prefix.Length, suffix.Length); + return data; + } + + return prefix; + } case typeDifferencing: + { + // As on differencing images, each independent sector can be read from child or parent + // image, we must read sector one by one + byte[] fullData = new byte[512 * length]; + for(ulong i = 0; i < length; i++) { - // As on differencing images, each independent sector can be read from child or parent - // image, we must read sector one by one - byte[] fullData = new byte[512 * length]; - for(ulong i = 0; i < length; i++) - { - byte[] oneSector = ReadSector(sectorAddress + i); - Array.Copy(oneSector, 0, fullData, (int)(i * 512), 512); - } - return fullData; + byte[] oneSector = ReadSector(sectorAddress + i); + Array.Copy(oneSector, 0, fullData, (int)(i * 512), 512); } + + return fullData; + } case typeDeprecated1: case typeDeprecated2: case typeDeprecated3: - { - throw new ImageNotSupportedException("(VirtualPC plugin): Deprecated image type found. Please submit a bug with an example image."); - } + { + throw new + ImageNotSupportedException("(VirtualPC plugin): Deprecated image type found. Please submit a bug with an example image."); + } default: - { - throw new ImageNotSupportedException(string.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", thisFooter.diskType)); - } + { + throw new + ImageNotSupportedException(string.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", + thisFooter.diskType)); + } } } - #endregion #region private methods - static uint VHDChecksum(byte[] data) { uint checksum = 0; - foreach(byte b in data) - checksum += b; + foreach(byte b in data) checksum += b; + return ~checksum; } - #endregion #region Unsupported features - public override string GetImageComments() { return null; @@ -1311,16 +1369,18 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -1329,8 +1389,6 @@ namespace DiscImageChef.ImagePlugins { return null; } - #endregion } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/VHDX.cs b/DiscImageChef.DiscImages/VHDX.cs index a7f17777..f46868c8 100644 --- a/DiscImageChef.DiscImages/VHDX.cs +++ b/DiscImageChef.DiscImages/VHDX.cs @@ -41,10 +41,9 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class VHDX : ImagePlugin + public class VHDX : ImagePlugin { #region Internal Structures - [StructLayout(LayoutKind.Sequential, Pack = 1)] struct VHDXIdentifier { @@ -55,8 +54,7 @@ namespace DiscImageChef.ImagePlugins /// <summary> /// UTF-16 string containing creator /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] - public byte[] creator; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] creator; } struct VHDXHeader @@ -101,8 +99,7 @@ namespace DiscImageChef.ImagePlugins /// Offset from image start to the log /// </summary> public ulong logOffset; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4016)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4016)] public byte[] reserved; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -165,8 +162,7 @@ namespace DiscImageChef.ImagePlugins /// <summary> /// Reserved /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public uint[] reserved2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public uint[] reserved2; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -241,11 +237,9 @@ namespace DiscImageChef.ImagePlugins /// </summary> public ushort valueLength; } - #endregion #region Internal Constants - const ulong VHDXSignature = 0x656C696678646876; const uint VHDXHeaderSig = 0x64616568; const uint VHDXRegionSig = 0x69676572; @@ -292,13 +286,11 @@ namespace DiscImageChef.ImagePlugins const ulong SectorBitmapPresent = 0x06; const ulong BATFileOffsetMask = 0xFFFFFFFFFFFC0000; - const ulong BATFlagsMask = 0x7; - const ulong BATReservedMask = 0x3FFF8; - + const ulong BATFlagsMask = 0x7; + const ulong BATReservedMask = 0x3FFF8; #endregion #region Internal variables - ulong VirtualDiskSize; Guid Page83Data; uint LogicalSectorSize; @@ -333,7 +325,6 @@ namespace DiscImageChef.ImagePlugins Dictionary<ulong, byte[]> sectorCache; Dictionary<ulong, byte[]> blockCache; - #endregion public VHDX() @@ -364,14 +355,12 @@ namespace DiscImageChef.ImagePlugins } #region public methods - public override bool IdentifyImage(Filter imageFilter) { Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] vhdxId_b = new byte[Marshal.SizeOf(vhdxId)]; stream.Read(vhdxId_b, 0, Marshal.SizeOf(vhdxId)); @@ -389,8 +378,7 @@ namespace DiscImageChef.ImagePlugins Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - if(stream.Length < 512) - return false; + if(stream.Length < 512) return false; byte[] vhdxId_b = new byte[Marshal.SizeOf(vhdxId)]; stream.Read(vhdxId_b, 0, Marshal.SizeOf(vhdxId)); @@ -400,8 +388,7 @@ namespace DiscImageChef.ImagePlugins vhdxId = (VHDXIdentifier)Marshal.PtrToStructure(idPtr, typeof(VHDXIdentifier)); Marshal.FreeHGlobal(idPtr); - if(vhdxId.signature != VHDXSignature) - return false; + if(vhdxId.signature != VHDXSignature) return false; ImageInfo.imageApplication = Encoding.Unicode.GetString(vhdxId.creator); @@ -425,8 +412,7 @@ namespace DiscImageChef.ImagePlugins vHdr = (VHDXHeader)Marshal.PtrToStructure(headerPtr, typeof(VHDXHeader)); Marshal.FreeHGlobal(headerPtr); - if(vHdr.signature != VHDXHeaderSig) - throw new ImageNotSupportedException("VHDX header not found"); + if(vHdr.signature != VHDXHeaderSig) throw new ImageNotSupportedException("VHDX header not found"); } stream.Seek(192 * 1024, SeekOrigin.Begin); @@ -464,19 +450,17 @@ namespace DiscImageChef.ImagePlugins vRegs[i] = (VHDXRegionTableEntry)Marshal.PtrToStructure(vRegPtr, typeof(VHDXRegionTableEntry)); Marshal.FreeHGlobal(vRegPtr); - if(vRegs[i].guid == BATGuid) - batOffset = (long)vRegs[i].offset; - else if(vRegs[i].guid == MetadataGuid) - metadataOffset = (long)vRegs[i].offset; + if(vRegs[i].guid == BATGuid) batOffset = (long)vRegs[i].offset; + else if(vRegs[i].guid == MetadataGuid) metadataOffset = (long)vRegs[i].offset; else if((vRegs[i].flags & RegionFlagsRequired) == RegionFlagsRequired) - throw new ImageNotSupportedException(string.Format("Found unsupported and required region Guid {0}, not proceeding with image.", vRegs[i].guid)); + throw new + ImageNotSupportedException(string.Format("Found unsupported and required region Guid {0}, not proceeding with image.", + vRegs[i].guid)); } - if(batOffset == 0) - throw new Exception("BAT not found, cannot continue."); + if(batOffset == 0) throw new Exception("BAT not found, cannot continue."); - if(metadataOffset == 0) - throw new Exception("Metadata not found, cannot continue."); + if(metadataOffset == 0) throw new Exception("Metadata not found, cannot continue."); uint fileParamsOff = 0, vdSizeOff = 0, p83Off = 0, logOff = 0, physOff = 0, parentOff = 0; @@ -500,20 +484,16 @@ namespace DiscImageChef.ImagePlugins vMets[i] = (VHDXMetadataTableEntry)Marshal.PtrToStructure(vMetPtr, typeof(VHDXMetadataTableEntry)); Marshal.FreeHGlobal(vMetPtr); - if(vMets[i].itemId == FileParametersGuid) - fileParamsOff = vMets[i].offset; - else if(vMets[i].itemId == VirtualDiskSizeGuid) - vdSizeOff = vMets[i].offset; - else if(vMets[i].itemId == Page83DataGuid) - p83Off = vMets[i].offset; - else if(vMets[i].itemId == LogicalSectorSizeGuid) - logOff = vMets[i].offset; - else if(vMets[i].itemId == PhysicalSectorSizeGuid) - physOff = vMets[i].offset; - else if(vMets[i].itemId == ParentLocatorGuid) - parentOff = vMets[i].offset; + if(vMets[i].itemId == FileParametersGuid) fileParamsOff = vMets[i].offset; + else if(vMets[i].itemId == VirtualDiskSizeGuid) vdSizeOff = vMets[i].offset; + else if(vMets[i].itemId == Page83DataGuid) p83Off = vMets[i].offset; + else if(vMets[i].itemId == LogicalSectorSizeGuid) logOff = vMets[i].offset; + else if(vMets[i].itemId == PhysicalSectorSizeGuid) physOff = vMets[i].offset; + else if(vMets[i].itemId == ParentLocatorGuid) parentOff = vMets[i].offset; else if((vMets[i].flags & MetadataFlagsRequired) == MetadataFlagsRequired) - throw new ImageNotSupportedException(string.Format("Found unsupported and required metadata Guid {0}, not proceeding with image.", vMets[i].itemId)); + throw new + ImageNotSupportedException(string.Format("Found unsupported and required metadata Guid {0}, not proceeding with image.", + vMets[i].itemId)); } byte[] tmp; @@ -527,8 +507,7 @@ namespace DiscImageChef.ImagePlugins vFileParms.blockSize = BitConverter.ToUInt32(tmp, 0); vFileParms.flags = BitConverter.ToUInt32(tmp, 4); } - else - throw new Exception("File parameters not found."); + else throw new Exception("File parameters not found."); if(vdSizeOff != 0) { @@ -537,8 +516,7 @@ namespace DiscImageChef.ImagePlugins stream.Read(tmp, 0, 8); VirtualDiskSize = BitConverter.ToUInt64(tmp, 0); } - else - throw new Exception("Virtual disk size not found."); + else throw new Exception("Virtual disk size not found."); if(p83Off != 0) { @@ -555,9 +533,8 @@ namespace DiscImageChef.ImagePlugins stream.Read(tmp, 0, 4); LogicalSectorSize = BitConverter.ToUInt32(tmp, 0); } - else - throw new Exception("Logical sector size not found."); - + else throw new Exception("Logical sector size not found."); + if(physOff != 0) { stream.Seek(physOff + metadataOffset, SeekOrigin.Begin); @@ -565,8 +542,7 @@ namespace DiscImageChef.ImagePlugins stream.Read(tmp, 0, 4); PhysicalSectorSize = BitConverter.ToUInt32(tmp, 0); } - else - throw new Exception("Physical sector size not found."); + else throw new Exception("Physical sector size not found."); if(parentOff != 0 && (vFileParms.flags & FileFlagsHasParent) == FileFlagsHasParent) { @@ -580,7 +556,9 @@ namespace DiscImageChef.ImagePlugins Marshal.FreeHGlobal(vParHdrPtr); if(vParHdr.locatorType != ParentTypeVHDXGuid) - throw new ImageNotSupportedException(string.Format("Found unsupported and required parent locator type {0}, not proceeding with image.", vParHdr.locatorType)); + throw new + ImageNotSupportedException(string.Format("Found unsupported and required parent locator type {0}, not proceeding with image.", + vParHdr.locatorType)); vPars = new VHDXParentLocatorEntry[vParHdr.keyValueCount]; for(int i = 0; i < vPars.Length; i++) @@ -592,13 +570,13 @@ namespace DiscImageChef.ImagePlugins Marshal.Copy(vPar_b, 0, vParPtr, Marshal.SizeOf(vPars[i])); vPars[i] = (VHDXParentLocatorEntry)Marshal.PtrToStructure(vParPtr, typeof(VHDXParentLocatorEntry)); Marshal.FreeHGlobal(vParPtr); - } } else if((vFileParms.flags & FileFlagsHasParent) == FileFlagsHasParent) throw new Exception("Parent locator not found."); - if((vFileParms.flags & FileFlagsHasParent) == FileFlagsHasParent && vParHdr.locatorType == ParentTypeVHDXGuid) + if((vFileParms.flags & FileFlagsHasParent) == FileFlagsHasParent && + vParHdr.locatorType == ParentTypeVHDXGuid) { parentImage = new VHDX(); bool parentWorks = false; @@ -620,7 +598,8 @@ namespace DiscImageChef.ImagePlugins try { - parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), entryValue)); + parentFilter = + new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), entryValue)); if(parentFilter != null && parentImage.OpenImage(parentFilter)) { parentWorks = true; @@ -633,7 +612,8 @@ namespace DiscImageChef.ImagePlugins try { - parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), relEntry)); + parentFilter = + new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), relEntry)); if(parentFilter != null && parentImage.OpenImage(parentFilter)) { parentWorks = true; @@ -652,7 +632,8 @@ namespace DiscImageChef.ImagePlugins try { - parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), entryValue)); + parentFilter = + new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), entryValue)); if(parentFilter != null && parentImage.OpenImage(parentFilter)) { parentWorks = true; @@ -663,29 +644,25 @@ namespace DiscImageChef.ImagePlugins } } - if(!parentWorks) - throw new Exception("Image is differential but parent cannot be opened."); + if(!parentWorks) throw new Exception("Image is differential but parent cannot be opened."); hasParent = true; } chunkRatio = (long)((Math.Pow(2, 23) * LogicalSectorSize) / vFileParms.blockSize); dataBlocks = VirtualDiskSize / vFileParms.blockSize; - if((VirtualDiskSize % vFileParms.blockSize) > 0) - dataBlocks++; + if((VirtualDiskSize % vFileParms.blockSize) > 0) dataBlocks++; long batEntries; if(hasParent) { long sectorBitmapBlocks = (long)dataBlocks / chunkRatio; - if((dataBlocks % (ulong)chunkRatio) > 0) - sectorBitmapBlocks++; + if((dataBlocks % (ulong)chunkRatio) > 0) sectorBitmapBlocks++; sectorBitmapPointers = new ulong[sectorBitmapBlocks]; batEntries = sectorBitmapBlocks * (chunkRatio - 1); } - else - batEntries = (long)(dataBlocks + ((dataBlocks - 1) / (ulong)chunkRatio)); + else batEntries = (long)(dataBlocks + ((dataBlocks - 1) / (ulong)chunkRatio)); DicConsole.DebugWriteLine("VHDX plugin", "Reading BAT"); @@ -732,8 +709,12 @@ namespace DiscImageChef.ImagePlugins sectorBmpMs.Write(bmp, 0, bmp.Length); } else if((pt & BATFlagsMask) != 0) - throw new ImageNotSupportedException(string.Format("Unsupported sector bitmap block flags (0x{0:X16}) found, not proceeding.", pt & BATFlagsMask)); + throw new + ImageNotSupportedException(string + .Format("Unsupported sector bitmap block flags (0x{0:X16}) found, not proceeding.", + pt & BATFlagsMask)); } + sectorBitmap = sectorBmpMs.ToArray(); sectorBmpMs.Close(); } @@ -756,13 +737,13 @@ namespace DiscImageChef.ImagePlugins ImageInfo.sectors = ImageInfo.imageSize / ImageInfo.sectorSize; ImageInfo.driveSerialNumber = Page83Data.ToString(); - // TODO: Separate image application from version, need several samples. + // TODO: Separate image application from version, need several samples. - ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); - ImageInfo.heads = 16; - ImageInfo.sectorsPerTrack = 63; + ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); + ImageInfo.heads = 16; + ImageInfo.sectorsPerTrack = 63; - return true; + return true; } bool CheckBitmap(ulong sectorAddress) @@ -771,8 +752,7 @@ namespace DiscImageChef.ImagePlugins int shift = (int)(sectorAddress % 8); byte val = (byte)(1 << shift); - if(index > sectorBitmap.LongLength) - return false; + if(index > sectorBitmap.LongLength) return false; return ((sectorBitmap[index] & val) == val); } @@ -845,12 +825,12 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSector(ulong sectorAddress) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); byte[] sector; - if(sectorCache.TryGetValue(sectorAddress, out sector)) - return sector; + if(sectorCache.TryGetValue(sectorAddress, out sector)) return sector; ulong index = (sectorAddress * LogicalSectorSize) / vFileParms.blockSize; ulong secOff = (sectorAddress * LogicalSectorSize) % vFileParms.blockSize; @@ -859,22 +839,20 @@ namespace DiscImageChef.ImagePlugins ulong blkFlags = blkPtr & BATFlagsMask; if((blkPtr & BATReservedMask) != 0) - throw new ImageNotSupportedException(string.Format("Unknown flags (0x{0:X16}) set in block pointer", blkPtr & BATReservedMask)); + throw new ImageNotSupportedException(string.Format("Unknown flags (0x{0:X16}) set in block pointer", + blkPtr & BATReservedMask)); if((blkFlags & BATFlagsMask) == PayloadBlockNotPresent) return hasParent ? parentImage.ReadSector(sectorAddress) : new byte[LogicalSectorSize]; - if((blkFlags & BATFlagsMask) == PayloadBlockUndefined || - (blkFlags & BATFlagsMask) == PayloadBlockZero || - (blkFlags & BATFlagsMask) == PayloadBlockUnmapper) - return new byte[LogicalSectorSize]; + if((blkFlags & BATFlagsMask) == PayloadBlockUndefined || (blkFlags & BATFlagsMask) == PayloadBlockZero || + (blkFlags & BATFlagsMask) == PayloadBlockUnmapper) return new byte[LogicalSectorSize]; bool partialBlock; partialBlock = !((blkFlags & BATFlagsMask) == PayloadBlockFullyPresent); partialBlock = (blkFlags & BATFlagsMask) == PayloadBlockPartiallyPresent; - if(partialBlock && hasParent && !CheckBitmap(sectorAddress)) - return parentImage.ReadSector(sectorAddress); + if(partialBlock && hasParent && !CheckBitmap(sectorAddress)) return parentImage.ReadSector(sectorAddress); byte[] block; @@ -884,8 +862,7 @@ namespace DiscImageChef.ImagePlugins imageStream.Seek((long)((blkPtr & BATFileOffsetMask)), SeekOrigin.Begin); imageStream.Read(block, 0, block.Length); - if(blockCache.Count >= maxBlockCache) - blockCache.Clear(); + if(blockCache.Count >= maxBlockCache) blockCache.Clear(); blockCache.Add(blkPtr & BATFileOffsetMask, block); } @@ -893,8 +870,7 @@ namespace DiscImageChef.ImagePlugins sector = new byte[LogicalSectorSize]; Array.Copy(block, (int)secOff, sector, 0, sector.Length); - if(sectorCache.Count >= maxSectorCache) - sectorCache.Clear(); + if(sectorCache.Count >= maxSectorCache) sectorCache.Clear(); sectorCache.Add(sectorAddress, sector); @@ -904,10 +880,13 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectors(ulong sectorAddress, uint length) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than available ({1})", sectorAddress + length, ImageInfo.sectors)); + throw new ArgumentOutOfRangeException(nameof(length), + string.Format("Requested more sectors ({0}) than available ({1})", + sectorAddress + length, ImageInfo.sectors)); MemoryStream ms = new MemoryStream(); @@ -919,23 +898,19 @@ namespace DiscImageChef.ImagePlugins return ms.ToArray(); } - #endregion #region private methods - static uint VHDXChecksum(byte[] data) { uint checksum = 0; - foreach(byte b in data) - checksum += b; + foreach(byte b in data) checksum += b; + return ~checksum; } - #endregion #region Unsupported features - public override string GetImageComments() { return null; @@ -1081,16 +1056,18 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -1099,8 +1076,6 @@ namespace DiscImageChef.ImagePlugins { return null; } - #endregion } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/VMware.cs b/DiscImageChef.DiscImages/VMware.cs index 5de1784f..c058bdf8 100644 --- a/DiscImageChef.DiscImages/VMware.cs +++ b/DiscImageChef.DiscImages/VMware.cs @@ -43,7 +43,7 @@ using DiscImageChef.ImagePlugins; namespace DiscImageChef.DiscImages { - public class VMware : ImagePlugin + public class VMware : ImagePlugin { #region Internal constants const uint VMwareExtentMagic = 0x564D444B; @@ -69,13 +69,21 @@ namespace DiscImageChef.DiscImages const string VMTypeStream = "streamOptimized"; const string DDFMagic = "# Disk DescriptorFile"; - readonly byte[] DDFMagicBytes = { 0x23, 0x20, 0x44, 0x69, 0x73, 0x6B, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6F, 0x72, 0x46, 0x69, 0x6C, 0x65 }; + readonly byte[] DDFMagicBytes = + { + 0x23, 0x20, 0x44, 0x69, 0x73, 0x6B, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6F, 0x72, 0x46, + 0x69, 0x6C, 0x65 + }; const string VersionRegEx = "^\\s*version\\s*=\\s*(?<version>\\d+)$"; const string CidRegEx = "^\\s*CID\\s*=\\s*(?<cid>[0123456789abcdef]{8})$"; const string ParenCidRegEx = "^\\s*parentCID\\s*=\\s*(?<cid>[0123456789abcdef]{8})$"; - const string TypeRegEx = "^\\s*createType\\s*=\\s*\\\"(?<type>custom|monolithicSparse|monolithicFlat|twoGbMaxExtentSparse|twoGbMaxExtentFlat|fullDevice|partitionedDevice|vmfs|vmfsPreallocated|vmfsEagerZeroedThick|vmfsThin|vmfsSparse|vmfsRDM|vmfsRawDeviceMap|vmfsRDMP|vmfsPassthroughRawDeviceMap|vmfsRaw|streamOptimized)\\\"$"; - const string ExtentRegEx = "^\\s*(?<access>(RW|RDONLY|NOACCESS))\\s+(?<sectors>\\d+)\\s+(?<type>(FLAT|SPARSE|ZERO|VMFS|VMFSSPARSE|VMFSRDM|VMFSRAW))\\s+\\\"(?<filename>.+)\\\"(\\s*(?<offset>\\d+))?$"; + const string TypeRegEx = + "^\\s*createType\\s*=\\s*\\\"(?<type>custom|monolithicSparse|monolithicFlat|twoGbMaxExtentSparse|twoGbMaxExtentFlat|fullDevice|partitionedDevice|vmfs|vmfsPreallocated|vmfsEagerZeroedThick|vmfsThin|vmfsSparse|vmfsRDM|vmfsRawDeviceMap|vmfsRDMP|vmfsPassthroughRawDeviceMap|vmfsRaw|streamOptimized)\\\"$" + ; + const string ExtentRegEx = + "^\\s*(?<access>(RW|RDONLY|NOACCESS))\\s+(?<sectors>\\d+)\\s+(?<type>(FLAT|SPARSE|ZERO|VMFS|VMFSSPARSE|VMFSRDM|VMFSRAW))\\s+\\\"(?<filename>.+)\\\"(\\s*(?<offset>\\d+))?$" + ; const string DDBTypeRegEx = "^\\s*ddb\\.adapterType\\s*=\\s*\\\"(?<type>ide|buslogic|lsilogic|legacyESX)\\\"$"; const string DDBSectorsRegEx = "^\\s*ddb\\.geometry\\.sectors\\s*=\\s*\\\"(?<sectors>\\d+)\\\"$"; const string DDBHeadsRegex = "^\\s*ddb\\.geometry\\.heads\\s*=\\s*\\\"(?<heads>\\d+)\\\"$"; @@ -107,15 +115,13 @@ namespace DiscImageChef.DiscImages public ulong rgdOffset; public ulong gdOffset; public ulong overhead; - [MarshalAs(UnmanagedType.U1)] - public bool uncleanShutdown; + [MarshalAs(UnmanagedType.U1)] public bool uncleanShutdown; public byte singleEndLineChar; public byte nonEndLineChar; public byte doubleEndLineChar1; public byte doubleEndLineChar2; public ushort compression; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 433)] - public byte[] padding; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 433)] public byte[] padding; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -133,21 +139,15 @@ namespace DiscImageChef.DiscImages public uint heads; public uint spt; // It stats on cylinders, above, but, don't care - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024 - 12)] - public byte[] parentFileName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024 - 12)] public byte[] parentFileName; public uint parentGeneration; public uint generation; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 60)] - public byte[] name; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] - public byte[] description; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 60)] public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] description; public uint savedGeneration; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] reserved; - [MarshalAs(UnmanagedType.U1)] - public bool uncleanShutdown; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 396)] - public byte[] padding; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] reserved; + [MarshalAs(UnmanagedType.U1)] public bool uncleanShutdown; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 396)] public byte[] padding; } #endregion @@ -245,7 +245,8 @@ namespace DiscImageChef.DiscImages Marshal.FreeHGlobal(headerPtr); } - return DDFMagicBytes.SequenceEqual(ddfMagic) || vmEHdr.magic == VMwareExtentMagic || vmCHdr.magic == VMwareCowMagic; + return DDFMagicBytes.SequenceEqual(ddfMagic) || vmEHdr.magic == VMwareExtentMagic || + vmCHdr.magic == VMwareCowMagic; } stream.Seek(0, SeekOrigin.Begin); @@ -315,8 +316,7 @@ namespace DiscImageChef.DiscImages stream.Seek(0, SeekOrigin.Begin); stream.Read(ddfMagic, 0, 0x15); - if(!DDFMagicBytes.SequenceEqual(ddfMagic)) - throw new Exception("Not a descriptor."); + if(!DDFMagicBytes.SequenceEqual(ddfMagic)) throw new Exception("Not a descriptor."); stream.Seek(0, SeekOrigin.Begin); byte[] ddfExternal = new byte[imageFilter.GetDataForkLength()]; @@ -327,9 +327,9 @@ namespace DiscImageChef.DiscImages extents = new Dictionary<ulong, VMwareExtent>(); ulong currentSector = 0; - bool matchedCyls = false, matchedHds = false, matchedSpt = false; + bool matchedCyls = false, matchedHds = false, matchedSpt = false; - if(cowD) + if(cowD) { int cowCount = 1; string basePath = Path.GetFileNameWithoutExtension(imageFilter.GetBasePath()); @@ -337,15 +337,12 @@ namespace DiscImageChef.DiscImages while(true) { string curPath; - if(cowCount == 1) - curPath = basePath + ".vmdk"; - else - curPath = string.Format("{0}-{1:D2}.vmdk", basePath, cowCount); + if(cowCount == 1) curPath = basePath + ".vmdk"; + else curPath = string.Format("{0}-{1:D2}.vmdk", basePath, cowCount); - if(!File.Exists(curPath)) - break; + if(!File.Exists(curPath)) break; - Filter extentFilter = new FiltersList().GetFilter(curPath); + Filter extentFilter = new FiltersList().GetFilter(curPath); Stream extentStream = extentFilter.GetDataForkStream(); if(stream.Length > Marshal.SizeOf(vmCHdr)) @@ -359,8 +356,7 @@ namespace DiscImageChef.DiscImages extHdrCow = (VMwareCowHeader)Marshal.PtrToStructure(cowPtr, typeof(VMwareCowHeader)); Marshal.FreeHGlobal(cowPtr); - if(extHdrCow.magic != VMwareCowMagic) - break; + if(extHdrCow.magic != VMwareCowMagic) break; VMwareExtent newExtent = new VMwareExtent(); newExtent.access = "RW"; @@ -370,13 +366,14 @@ namespace DiscImageChef.DiscImages newExtent.sectors = extHdrCow.sectors; newExtent.type = "SPARSE"; - DicConsole.DebugWriteLine("VMware plugin", "{0} {1} {2} \"{3}\" {4}", newExtent.access, newExtent.sectors, newExtent.type, newExtent.filename, newExtent.offset); + DicConsole.DebugWriteLine("VMware plugin", "{0} {1} {2} \"{3}\" {4}", newExtent.access, + newExtent.sectors, newExtent.type, newExtent.filename, + newExtent.offset); extents.Add(currentSector, newExtent); currentSector += newExtent.sectors; - } - else - break; + } + else break; cowCount++; } @@ -393,21 +390,21 @@ namespace DiscImageChef.DiscImages Regex RegexType = new Regex(TypeRegEx); Regex RegexExtent = new Regex(ExtentRegEx); Regex RegexParent = new Regex(ParentRegEx); - Regex RegexCylinders = new Regex(DDBCylindersRegEx); - Regex RegexHeads = new Regex(DDBHeadsRegex); - Regex RegexSectors = new Regex(DDBSectorsRegEx); + Regex RegexCylinders = new Regex(DDBCylindersRegEx); + Regex RegexHeads = new Regex(DDBHeadsRegex); + Regex RegexSectors = new Regex(DDBSectorsRegEx); - Match MatchVersion; + Match MatchVersion; Match MatchCid; Match MatchParentCid; Match MatchType; Match MatchExtent; Match MatchParent; - Match MatchCylinders; - Match MatchHeads; - Match MatchSectors; + Match MatchCylinders; + Match MatchHeads; + Match MatchSectors; - StreamReader ddfStreamRdr = new StreamReader(ddfStream); + StreamReader ddfStreamRdr = new StreamReader(ddfStream); while(ddfStreamRdr.Peek() >= 0) { @@ -419,96 +416,101 @@ namespace DiscImageChef.DiscImages MatchType = RegexType.Match(_line); MatchExtent = RegexExtent.Match(_line); MatchParent = RegexParent.Match(_line); - MatchCylinders = RegexCylinders.Match(_line); - MatchHeads = RegexHeads.Match(_line); - MatchSectors = RegexSectors.Match(_line); + MatchCylinders = RegexCylinders.Match(_line); + MatchHeads = RegexHeads.Match(_line); + MatchSectors = RegexSectors.Match(_line); - if(MatchVersion.Success) - { - uint.TryParse(MatchVersion.Groups["version"].Value, out version); - DicConsole.DebugWriteLine("VMware plugin", "version = {0}", version); - } - else if(MatchCid.Success) - { - cid = Convert.ToUInt32(MatchCid.Groups["cid"].Value, 16); - DicConsole.DebugWriteLine("VMware plugin", "cid = {0:x8}", cid); - } - else if(MatchParentCid.Success) - { - parentCid = Convert.ToUInt32(MatchParentCid.Groups["cid"].Value, 16); - DicConsole.DebugWriteLine("VMware plugin", "parentCID = {0:x8}", parentCid); - } - else if(MatchType.Success) - { - imageType = MatchType.Groups["type"].Value; - DicConsole.DebugWriteLine("VMware plugin", "createType = \"{0}\"", imageType); - } - else if(MatchExtent.Success) - { - VMwareExtent newExtent = new VMwareExtent(); - newExtent.access = MatchExtent.Groups["access"].Value; - if(!embedded) - newExtent.filter = new FiltersList().GetFilter(Path.Combine(Path.GetDirectoryName(imageFilter.GetBasePath()), MatchExtent.Groups["filename"].Value)); - else - newExtent.filter = imageFilter; - uint.TryParse(MatchExtent.Groups["offset"].Value, out newExtent.offset); - uint.TryParse(MatchExtent.Groups["sectors"].Value, out newExtent.sectors); - newExtent.type = MatchExtent.Groups["type"].Value; - DicConsole.DebugWriteLine("VMware plugin", "{0} {1} {2} \"{3}\" {4}", newExtent.access, newExtent.sectors, newExtent.type, newExtent.filename, newExtent.offset); + if(MatchVersion.Success) + { + uint.TryParse(MatchVersion.Groups["version"].Value, out version); + DicConsole.DebugWriteLine("VMware plugin", "version = {0}", version); + } + else if(MatchCid.Success) + { + cid = Convert.ToUInt32(MatchCid.Groups["cid"].Value, 16); + DicConsole.DebugWriteLine("VMware plugin", "cid = {0:x8}", cid); + } + else if(MatchParentCid.Success) + { + parentCid = Convert.ToUInt32(MatchParentCid.Groups["cid"].Value, 16); + DicConsole.DebugWriteLine("VMware plugin", "parentCID = {0:x8}", parentCid); + } + else if(MatchType.Success) + { + imageType = MatchType.Groups["type"].Value; + DicConsole.DebugWriteLine("VMware plugin", "createType = \"{0}\"", imageType); + } + else if(MatchExtent.Success) + { + VMwareExtent newExtent = new VMwareExtent(); + newExtent.access = MatchExtent.Groups["access"].Value; + if(!embedded) + newExtent.filter = + new FiltersList() + .GetFilter(Path.Combine(Path.GetDirectoryName(imageFilter.GetBasePath()), + MatchExtent.Groups["filename"].Value)); + else newExtent.filter = imageFilter; + uint.TryParse(MatchExtent.Groups["offset"].Value, out newExtent.offset); + uint.TryParse(MatchExtent.Groups["sectors"].Value, out newExtent.sectors); + newExtent.type = MatchExtent.Groups["type"].Value; + DicConsole.DebugWriteLine("VMware plugin", "{0} {1} {2} \"{3}\" {4}", newExtent.access, + newExtent.sectors, newExtent.type, newExtent.filename, + newExtent.offset); - extents.Add(currentSector, newExtent); - currentSector += newExtent.sectors; - } - else if(MatchParent.Success) - { - parentName = MatchParent.Groups["filename"].Value; - DicConsole.DebugWriteLine("VMware plugin", "parentFileNameHint = \"{0}\"", parentName); - hasParent = true; - } - else if(MatchCylinders.Success) - { - uint.TryParse(MatchCylinders.Groups["cylinders"].Value, out ImageInfo.cylinders); - matchedCyls = true; - } - else if(MatchHeads.Success) - { - uint.TryParse(MatchHeads.Groups["heads"].Value, out ImageInfo.heads); - matchedHds = true; - } - else if(MatchSectors.Success) - { - uint.TryParse(MatchSectors.Groups["sectors"].Value, out ImageInfo.sectorsPerTrack); - matchedSpt = true; - } - } + extents.Add(currentSector, newExtent); + currentSector += newExtent.sectors; + } + else if(MatchParent.Success) + { + parentName = MatchParent.Groups["filename"].Value; + DicConsole.DebugWriteLine("VMware plugin", "parentFileNameHint = \"{0}\"", parentName); + hasParent = true; + } + else if(MatchCylinders.Success) + { + uint.TryParse(MatchCylinders.Groups["cylinders"].Value, out ImageInfo.cylinders); + matchedCyls = true; + } + else if(MatchHeads.Success) + { + uint.TryParse(MatchHeads.Groups["heads"].Value, out ImageInfo.heads); + matchedHds = true; + } + else if(MatchSectors.Success) + { + uint.TryParse(MatchSectors.Groups["sectors"].Value, out ImageInfo.sectorsPerTrack); + matchedSpt = true; + } + } } - if(extents.Count == 0) - throw new Exception("Did not find any extent"); + if(extents.Count == 0) throw new Exception("Did not find any extent"); switch(imageType) { - case VMTypeMonoSparse://"monolithicSparse"; - case VMTypeMonoFlat://"monolithicFlat"; - case VMTypeSplitSparse://"twoGbMaxExtentSparse"; - case VMTypeSplitFlat://"twoGbMaxExtentFlat"; - case VMFSTypeFlat://"vmfsPreallocated"; - case VMFSTypeZero://"vmfsEagerZeroedThick"; - case VMFSTypeThin://"vmfsThin"; - case VMFSTypeSparse://"vmfsSparse"; - case VMFSType://"vmfs"; - case VMTypeStream://"streamOptimized"; + case VMTypeMonoSparse: //"monolithicSparse"; + case VMTypeMonoFlat: //"monolithicFlat"; + case VMTypeSplitSparse: //"twoGbMaxExtentSparse"; + case VMTypeSplitFlat: //"twoGbMaxExtentFlat"; + case VMFSTypeFlat: //"vmfsPreallocated"; + case VMFSTypeZero: //"vmfsEagerZeroedThick"; + case VMFSTypeThin: //"vmfsThin"; + case VMFSTypeSparse: //"vmfsSparse"; + case VMFSType: //"vmfs"; + case VMTypeStream: //"streamOptimized"; break; - case VMTypeFullDevice://"fullDevice"; - case VMTypePartDevice://"partitionedDevice"; - case VMFSTypeRDM://"vmfsRDM"; - case VMFSTypeRDMOld://"vmfsRawDeviceMap"; - case VMFSTypeRDMP://"vmfsRDMP"; - case VMFSTypeRDMPOld://"vmfsPassthroughRawDeviceMap"; - case VMFSTypeRaw://"vmfsRaw"; - throw new ImageNotSupportedException("Raw device image files are not supported, try accessing the device directly."); + case VMTypeFullDevice: //"fullDevice"; + case VMTypePartDevice: //"partitionedDevice"; + case VMFSTypeRDM: //"vmfsRDM"; + case VMFSTypeRDMOld: //"vmfsRawDeviceMap"; + case VMFSTypeRDMP: //"vmfsRDMP"; + case VMFSTypeRDMPOld: //"vmfsPassthroughRawDeviceMap"; + case VMFSTypeRaw: //"vmfsRaw"; + throw new + ImageNotSupportedException("Raw device image files are not supported, try accessing the device directly."); default: - throw new ImageNotSupportedException(string.Format("Dunno how to handle \"{0}\" extents.", imageType)); + throw new ImageNotSupportedException(string.Format("Dunno how to handle \"{0}\" extents.", + imageType)); } bool oneNoFlat = false || cowD; @@ -516,21 +518,17 @@ namespace DiscImageChef.DiscImages foreach(VMwareExtent extent in extents.Values) { if(extent.filter == null) - throw new Exception(string.Format("Extent file {0} not found.", extent.filename)); + throw new Exception(string.Format("Extent file {0} not found.", extent.filename)); - if(extent.access == "NOACCESS") - throw new Exception("Cannot access NOACCESS extents ;)."); + if(extent.access == "NOACCESS") throw new Exception("Cannot access NOACCESS extents ;)."); - if(extent.type != "FLAT" && - extent.type != "ZERO" && - extent.type != "VMFS" && - !cowD) + if(extent.type != "FLAT" && extent.type != "ZERO" && extent.type != "VMFS" && !cowD) { Stream extentStream = extent.filter.GetDataForkStream(); extentStream.Seek(0, SeekOrigin.Begin); if(extentStream.Length < sectorSize) - throw new Exception(string.Format("Extent {0} is too small.", extent.filename)); + throw new Exception(string.Format("Extent {0} is too small.", extent.filename)); VMwareExtentHeader extentHdr = new VMwareExtentHeader(); byte[] extentHdr_b = new byte[Marshal.SizeOf(extentHdr)]; @@ -544,10 +542,12 @@ namespace DiscImageChef.DiscImages throw new Exception(string.Format("{0} is not an VMware extent.", extent.filter)); if(extentHdr.capacity < extent.sectors) - throw new Exception(string.Format("Extent contains incorrect number of sectors, {0}. {1} were expected", extentHdr.capacity, extent.sectors)); + throw new + Exception(string.Format("Extent contains incorrect number of sectors, {0}. {1} were expected", + extentHdr.capacity, extent.sectors)); - // TODO: Support compressed extents - if(extentHdr.compression != CompressionNone) + // TODO: Support compressed extents + if(extentHdr.compression != CompressionNone) throw new ImageNotSupportedException("Compressed extents are not yet supported."); if(!vmEHdrSet) @@ -562,7 +562,8 @@ namespace DiscImageChef.DiscImages } if(oneNoFlat && !vmEHdrSet && !cowD) - throw new Exception("There are sparse extents but there is no header to find the grain tables, cannot proceed."); + throw new + Exception("There are sparse extents but there is no header to find the grain tables, cannot proceed."); ImageInfo.sectors = currentSector; @@ -585,10 +586,13 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("VMware plugin", "vmEHdr.gdOffset = {0}", vmEHdr.gdOffset); DicConsole.DebugWriteLine("VMware plugin", "vmEHdr.overhead = {0}", vmEHdr.overhead); DicConsole.DebugWriteLine("VMware plugin", "vmEHdr.uncleanShutdown = {0}", vmEHdr.uncleanShutdown); - DicConsole.DebugWriteLine("VMware plugin", "vmEHdr.singleEndLineChar = 0x{0:X2}", vmEHdr.singleEndLineChar); + DicConsole.DebugWriteLine("VMware plugin", "vmEHdr.singleEndLineChar = 0x{0:X2}", + vmEHdr.singleEndLineChar); DicConsole.DebugWriteLine("VMware plugin", "vmEHdr.nonEndLineChar = 0x{0:X2}", vmEHdr.nonEndLineChar); - DicConsole.DebugWriteLine("VMware plugin", "vmEHdr.doubleEndLineChar1 = 0x{0:X2}", vmEHdr.doubleEndLineChar1); - DicConsole.DebugWriteLine("VMware plugin", "vmEHdr.doubleEndLineChar2 = 0x{0:X2}", vmEHdr.doubleEndLineChar2); + DicConsole.DebugWriteLine("VMware plugin", "vmEHdr.doubleEndLineChar1 = 0x{0:X2}", + vmEHdr.doubleEndLineChar1); + DicConsole.DebugWriteLine("VMware plugin", "vmEHdr.doubleEndLineChar2 = 0x{0:X2}", + vmEHdr.doubleEndLineChar2); DicConsole.DebugWriteLine("VMware plugin", "vmEHdr.compression = 0x{0:X4}", vmEHdr.compression); grainSize = vmEHdr.grainSize; @@ -596,10 +600,8 @@ namespace DiscImageChef.DiscImages gdEntries = grains / vmEHdr.GTEsPerGT; GTEsPerGT = vmEHdr.GTEsPerGT; - if((vmEHdr.flags & FlagsUseRedundantTable) == FlagsUseRedundantTable) - gdOffset = (long)vmEHdr.rgdOffset; - else - gdOffset = (long)vmEHdr.gdOffset; + if((vmEHdr.flags & FlagsUseRedundantTable) == FlagsUseRedundantTable) gdOffset = (long)vmEHdr.rgdOffset; + else gdOffset = (long)vmEHdr.gdOffset; } else if(oneNoFlat && cowD) { @@ -616,7 +618,8 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("VMware plugin", "vmCHdr.spt = {0}", vmCHdr.spt); DicConsole.DebugWriteLine("VMware plugin", "vmCHdr.generation = {0}", vmCHdr.generation); DicConsole.DebugWriteLine("VMware plugin", "vmCHdr.name = {0}", StringHandlers.CToString(vmCHdr.name)); - DicConsole.DebugWriteLine("VMware plugin", "vmCHdr.description = {0}", StringHandlers.CToString(vmCHdr.description)); + DicConsole.DebugWriteLine("VMware plugin", "vmCHdr.description = {0}", + StringHandlers.CToString(vmCHdr.description)); DicConsole.DebugWriteLine("VMware plugin", "vmCHdr.savedGeneration = {0}", vmCHdr.savedGeneration); DicConsole.DebugWriteLine("VMware plugin", "vmCHdr.uncleanShutdown = {0}", vmCHdr.uncleanShutdown); @@ -632,10 +635,10 @@ namespace DiscImageChef.DiscImages if(oneNoFlat) { - if(grains == 0 || gdEntries == 0) - throw new Exception("Some error ocurred setting GD sizes"); + if(grains == 0 || gdEntries == 0) throw new Exception("Some error ocurred setting GD sizes"); - DicConsole.DebugWriteLine("VMware plugin", "{0} sectors in {1} grains in {2} tables", ImageInfo.sectors, grains, gdEntries); + DicConsole.DebugWriteLine("VMware plugin", "{0} sectors in {1} grains in {2} tables", ImageInfo.sectors, + grains, gdEntries); Stream gdStream = gdFilter.GetDataForkStream(); @@ -645,8 +648,7 @@ namespace DiscImageChef.DiscImages uint[] gd = new uint[gdEntries]; byte[] gdBytes = new byte[gdEntries * 4]; gdStream.Read(gdBytes, 0, gdBytes.Length); - for(int i = 0; i < gdEntries; i++) - gd[i] = BitConverter.ToUInt32(gdBytes, i * 4); + for(int i = 0; i < gdEntries; i++) gd[i] = BitConverter.ToUInt32(gdBytes, i * 4); DicConsole.DebugWriteLine("VMware plugin", "Reading grain tables"); uint currentGrain = 0; @@ -670,9 +672,9 @@ namespace DiscImageChef.DiscImages if(hasParent) { - Filter parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentName)); - if(parentFilter == null) - throw new Exception(string.Format("Cannot find parent \"{0}\".", parentName)); + Filter parentFilter = + new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentName)); + if(parentFilter == null) throw new Exception(string.Format("Cannot find parent \"{0}\".", parentName)); parentImage = new VMware(); @@ -690,36 +692,34 @@ namespace DiscImageChef.DiscImages ImageInfo.mediaType = MediaType.GENERIC_HDD; ImageInfo.imageSize = ImageInfo.sectors * sectorSize; // VMDK version 1 started on VMware 4, so there is a previous version, "COWD" + if(cowD) ImageInfo.imageVersion = string.Format("{0}", version); + else ImageInfo.imageVersion = string.Format("{0}", version + 3); + if(cowD) - ImageInfo.imageVersion = string.Format("{0}", version); - else - ImageInfo.imageVersion = string.Format("{0}", version + 3); + { + ImageInfo.cylinders = vmCHdr.cylinders; + ImageInfo.heads = vmCHdr.heads; + ImageInfo.sectorsPerTrack = vmCHdr.spt; + } + else if(!matchedCyls || !matchedHds || !matchedSpt) + { + ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); + ImageInfo.heads = 16; + ImageInfo.sectorsPerTrack = 63; + } - if(cowD) - { - ImageInfo.cylinders = vmCHdr.cylinders; - ImageInfo.heads = vmCHdr.heads; - ImageInfo.sectorsPerTrack = vmCHdr.spt; - } - else if(!matchedCyls || !matchedHds || !matchedSpt) - { - ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); - ImageInfo.heads = 16; - ImageInfo.sectorsPerTrack = 63; - } - - return true; + return true; } public override byte[] ReadSector(ulong sectorAddress) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); byte[] sector; - if(sectorCache.TryGetValue(sectorAddress, out sector)) - return sector; + if(sectorCache.TryGetValue(sectorAddress, out sector)) return sector; VMwareExtent currentExtent = new VMwareExtent(); bool extentFound = false; @@ -736,7 +736,8 @@ namespace DiscImageChef.DiscImages } if(!extentFound) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); Stream dataStream; @@ -744,8 +745,7 @@ namespace DiscImageChef.DiscImages { sector = new byte[sectorSize]; - if(sectorCache.Count >= maxCachedSectors) - sectorCache.Clear(); + if(sectorCache.Count >= maxCachedSectors) sectorCache.Clear(); sectorCache.Add(sectorAddress, sector); return sector; @@ -754,12 +754,12 @@ namespace DiscImageChef.DiscImages if(currentExtent.type == "FLAT" || currentExtent.type == "VMFS") { dataStream = currentExtent.filter.GetDataForkStream(); - dataStream.Seek((long)((currentExtent.offset + (sectorAddress - extentStartSector)) * sectorSize), SeekOrigin.Begin); + dataStream.Seek((long)((currentExtent.offset + (sectorAddress - extentStartSector)) * sectorSize), + SeekOrigin.Begin); sector = new byte[sectorSize]; dataStream.Read(sector, 0, sector.Length); - if(sectorCache.Count >= maxCachedSectors) - sectorCache.Clear(); + if(sectorCache.Count >= maxCachedSectors) sectorCache.Clear(); sectorCache.Add(sectorAddress, sector); return sector; @@ -770,15 +770,13 @@ namespace DiscImageChef.DiscImages uint grainOff = gTable[index]; - if(grainOff == 0 && hasParent) - return parentImage.ReadSector(sectorAddress); + if(grainOff == 0 && hasParent) return parentImage.ReadSector(sectorAddress); if(grainOff == 0 || grainOff == 1) { sector = new byte[sectorSize]; - if(sectorCache.Count >= maxCachedSectors) - sectorCache.Clear(); + if(sectorCache.Count >= maxCachedSectors) sectorCache.Clear(); sectorCache.Add(sectorAddress, sector); return sector; @@ -793,8 +791,7 @@ namespace DiscImageChef.DiscImages dataStream.Seek((long)(((grainOff - extentStartSector) * sectorSize)), SeekOrigin.Begin); dataStream.Read(grain, 0, grain.Length); - if(grainCache.Count >= maxCachedGrains) - grainCache.Clear(); + if(grainCache.Count >= maxCachedGrains) grainCache.Clear(); grainCache.Add(grainOff, grain); } @@ -802,8 +799,7 @@ namespace DiscImageChef.DiscImages sector = new byte[sectorSize]; Array.Copy(grain, (int)secOff, sector, 0, sectorSize); - if(sectorCache.Count > maxCachedSectors) - sectorCache.Clear(); + if(sectorCache.Count > maxCachedSectors) sectorCache.Clear(); sectorCache.Add(sectorAddress, sector); @@ -813,7 +809,8 @@ namespace DiscImageChef.DiscImages public override byte[] ReadSectors(ulong sectorAddress, uint length) { if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + string.Format("Sector address {0} not found", sectorAddress)); if(sectorAddress + length > ImageInfo.sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); @@ -900,7 +897,6 @@ namespace DiscImageChef.DiscImages } #region Unsupported features - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -1041,16 +1037,18 @@ namespace DiscImageChef.DiscImages throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } @@ -1059,8 +1057,6 @@ namespace DiscImageChef.DiscImages { return null; } - #endregion } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/Virtual98.cs b/DiscImageChef.DiscImages/Virtual98.cs index 400bdbfb..941e7603 100644 --- a/DiscImageChef.DiscImages/Virtual98.cs +++ b/DiscImageChef.DiscImages/Virtual98.cs @@ -42,400 +42,394 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - // Info from Neko Project II emulator - public class Virtual98 : ImagePlugin - { - #region Internal structures - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct Virtual98Header - { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] signature; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] comment; - public uint padding; - public ushort mbsize; - public ushort sectorsize; - public byte sectors; - public byte surfaces; - public ushort cylinders; - public uint totals; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x44)] - public byte[] padding2; - } - #endregion - - readonly byte[] signature = { 0x56, 0x48, 0x44, 0x31, 0x2E, 0x30, 0x30, 0x00 }; - - public Virtual98() - { - Name = "Virtual98 Disk Image"; - PluginUUID = new Guid("C0CDE13D-04D0-4913-8740-AFAA44D0A107"); - ImageInfo = new ImageInfo() - { - readableSectorTags = new List<SectorTagType>(), - readableMediaTags = new List<MediaTagType>(), - imageHasPartitions = false, - imageHasSessions = false, - imageVersion = null, - imageApplication = null, - imageApplicationVersion = null, - imageCreator = null, - imageComments = null, - mediaManufacturer = null, - mediaModel = null, - mediaSerialNumber = null, - mediaBarcode = null, - mediaPartNumber = null, - mediaSequence = 0, - lastMediaSequence = 0, - driveManufacturer = null, - driveModel = null, - driveSerialNumber = null, - driveFirmwareRevision = null - }; - } - - Virtual98Header v98hdr; - Filter nhdImageFilter; - - public override bool IdentifyImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - // Even if comment is supposedly ASCII, I'm pretty sure most emulators allow Shift-JIS to be used :p - Encoding shiftjis = Encoding.GetEncoding("shift_jis"); - - v98hdr = new Virtual98Header(); - - if(stream.Length < Marshal.SizeOf(v98hdr)) - return false; - - byte[] hdr_b = new byte[Marshal.SizeOf(v98hdr)]; - stream.Read(hdr_b, 0, hdr_b.Length); - - GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); - v98hdr = (Virtual98Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Virtual98Header)); - handle.Free(); - - if(!v98hdr.signature.SequenceEqual(signature)) - return false; - - DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.signature = \"{0}\"", StringHandlers.CToString(v98hdr.signature, shiftjis)); - DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.comment = \"{0}\"", StringHandlers.CToString(v98hdr.comment, shiftjis)); - DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.padding = {0}", v98hdr.padding); - DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.mbsize = {0}", v98hdr.mbsize); - DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.sectorsize = {0}", v98hdr.sectorsize); - DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.sectors = {0}", v98hdr.sectors); - DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.surfaces = {0}", v98hdr.surfaces); - DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.cylinders = {0}", v98hdr.cylinders); - DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.totals = {0}", v98hdr.totals); - - return true; - } - - public override bool OpenImage(Filter imageFilter) - { - Stream stream = imageFilter.GetDataForkStream(); - stream.Seek(0, SeekOrigin.Begin); - // Even if comment is supposedly ASCII, I'm pretty sure most emulators allow Shift-JIS to be used :p - Encoding shiftjis = Encoding.GetEncoding("shift_jis"); - - v98hdr = new Virtual98Header(); - - if(stream.Length < Marshal.SizeOf(v98hdr)) - return false; - - byte[] hdr_b = new byte[Marshal.SizeOf(v98hdr)]; - stream.Read(hdr_b, 0, hdr_b.Length); - - GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); - v98hdr = (Virtual98Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Virtual98Header)); - handle.Free(); - - ImageInfo.mediaType = MediaType.GENERIC_HDD; - - ImageInfo.imageSize = (ulong)(stream.Length - 0xDC); - ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); - ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); - ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.sectors = v98hdr.totals; - ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.sectorSize = v98hdr.sectorsize; - ImageInfo.cylinders = v98hdr.cylinders; - ImageInfo.heads = v98hdr.surfaces; - ImageInfo.sectorsPerTrack = v98hdr.sectors; - ImageInfo.imageComments = StringHandlers.CToString(v98hdr.comment, shiftjis); - - nhdImageFilter = imageFilter; - - return true; - } - - public override bool ImageHasPartitions() - { - return false; - } - - public override ulong GetImageSize() - { - return ImageInfo.imageSize; - } - - public override ulong GetSectors() - { - return ImageInfo.sectors; - } - - public override uint GetSectorSize() - { - return ImageInfo.sectorSize; - } - - public override string GetImageFormat() - { - return "Virtual98 disk image"; - } - - public override string GetImageVersion() - { - return ImageInfo.imageVersion; - } - - public override string GetImageApplication() - { - return ImageInfo.imageApplication; - } - - public override string GetImageApplicationVersion() - { - return ImageInfo.imageApplicationVersion; - } - - public override string GetImageCreator() - { - return ImageInfo.imageCreator; - } - - public override DateTime GetImageCreationTime() - { - return ImageInfo.imageCreationTime; - } - - public override DateTime GetImageLastModificationTime() - { - return ImageInfo.imageLastModificationTime; - } - - public override string GetImageName() - { - return ImageInfo.imageName; - } - - public override string GetImageComments() - { - return ImageInfo.imageComments; - } - - public override MediaType GetMediaType() - { - return ImageInfo.mediaType; - } - - public override byte[] ReadSector(ulong sectorAddress) - { - return ReadSectors(sectorAddress, 1); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length) - { - if(sectorAddress > ImageInfo.sectors - 1) - throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); - - if(sectorAddress + length > ImageInfo.sectors) - throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); - - byte[] buffer = new byte[length * ImageInfo.sectorSize]; - - Stream stream = nhdImageFilter.GetDataForkStream(); - - // V98 are lazy allocated - if((long)(0xDC + sectorAddress * ImageInfo.sectorSize) >= stream.Length) - return buffer; - - stream.Seek((long)(0xDC + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); - - int toRead = (int)(length * ImageInfo.sectorSize); - - if(toRead + stream.Position > stream.Length) - toRead = (int)(stream.Length - stream.Position); - - stream.Read(buffer, 0, toRead); - - return buffer; - } - - #region Unsupported features - - public override byte[] ReadDiskTag(MediaTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorLong(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override string GetMediaManufacturer() - { - return null; - } - - public override string GetMediaModel() - { - return null; - } - - public override string GetMediaSerialNumber() - { - return null; - } - - public override string GetMediaBarcode() - { - return null; - } - - public override string GetMediaPartNumber() - { - return null; - } - - public override int GetMediaSequence() - { - return 0; - } - - public override int GetLastDiskSequence() - { - return 0; - } - - public override string GetDriveManufacturer() - { - return null; - } - - public override string GetDriveModel() - { - return null; - } - - public override string GetDriveSerialNumber() - { - return null; - } - - public override List<Partition> GetPartitions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetTracks() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(Session session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Track> GetSessionTracks(ushort session) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override List<Session> GetSessions() - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySector(ulong sectorAddress) - { - return null; - } - - public override bool? VerifySector(ulong sectorAddress, uint track) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - FailingLBAs = new List<ulong>(); - UnknownLBAs = new List<ulong>(); - for(ulong i = 0; i < ImageInfo.sectors; i++) - UnknownLBAs.Add(i); - return null; - } - - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) - { - throw new FeatureUnsupportedImageException("Feature not supported by image format"); - } - - public override bool? VerifyMediaImage() - { - return null; - } - - #endregion - } + // Info from Neko Project II emulator + public class Virtual98 : ImagePlugin + { + #region Internal structures + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct Virtual98Header + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] signature; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] comment; + public uint padding; + public ushort mbsize; + public ushort sectorsize; + public byte sectors; + public byte surfaces; + public ushort cylinders; + public uint totals; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x44)] public byte[] padding2; + } + #endregion + + readonly byte[] signature = {0x56, 0x48, 0x44, 0x31, 0x2E, 0x30, 0x30, 0x00}; + + public Virtual98() + { + Name = "Virtual98 Disk Image"; + PluginUUID = new Guid("C0CDE13D-04D0-4913-8740-AFAA44D0A107"); + ImageInfo = new ImageInfo() + { + readableSectorTags = new List<SectorTagType>(), + readableMediaTags = new List<MediaTagType>(), + imageHasPartitions = false, + imageHasSessions = false, + imageVersion = null, + imageApplication = null, + imageApplicationVersion = null, + imageCreator = null, + imageComments = null, + mediaManufacturer = null, + mediaModel = null, + mediaSerialNumber = null, + mediaBarcode = null, + mediaPartNumber = null, + mediaSequence = 0, + lastMediaSequence = 0, + driveManufacturer = null, + driveModel = null, + driveSerialNumber = null, + driveFirmwareRevision = null + }; + } + + Virtual98Header v98hdr; + Filter nhdImageFilter; + + public override bool IdentifyImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + // Even if comment is supposedly ASCII, I'm pretty sure most emulators allow Shift-JIS to be used :p + Encoding shiftjis = Encoding.GetEncoding("shift_jis"); + + v98hdr = new Virtual98Header(); + + if(stream.Length < Marshal.SizeOf(v98hdr)) return false; + + byte[] hdr_b = new byte[Marshal.SizeOf(v98hdr)]; + stream.Read(hdr_b, 0, hdr_b.Length); + + GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); + v98hdr = (Virtual98Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Virtual98Header)); + handle.Free(); + + if(!v98hdr.signature.SequenceEqual(signature)) return false; + + DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.signature = \"{0}\"", + StringHandlers.CToString(v98hdr.signature, shiftjis)); + DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.comment = \"{0}\"", + StringHandlers.CToString(v98hdr.comment, shiftjis)); + DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.padding = {0}", v98hdr.padding); + DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.mbsize = {0}", v98hdr.mbsize); + DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.sectorsize = {0}", v98hdr.sectorsize); + DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.sectors = {0}", v98hdr.sectors); + DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.surfaces = {0}", v98hdr.surfaces); + DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.cylinders = {0}", v98hdr.cylinders); + DicConsole.DebugWriteLine("Virtual98 plugin", "v98hdr.totals = {0}", v98hdr.totals); + + return true; + } + + public override bool OpenImage(Filter imageFilter) + { + Stream stream = imageFilter.GetDataForkStream(); + stream.Seek(0, SeekOrigin.Begin); + // Even if comment is supposedly ASCII, I'm pretty sure most emulators allow Shift-JIS to be used :p + Encoding shiftjis = Encoding.GetEncoding("shift_jis"); + + v98hdr = new Virtual98Header(); + + if(stream.Length < Marshal.SizeOf(v98hdr)) return false; + + byte[] hdr_b = new byte[Marshal.SizeOf(v98hdr)]; + stream.Read(hdr_b, 0, hdr_b.Length); + + GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned); + v98hdr = (Virtual98Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Virtual98Header)); + handle.Free(); + + ImageInfo.mediaType = MediaType.GENERIC_HDD; + + ImageInfo.imageSize = (ulong)(stream.Length - 0xDC); + ImageInfo.imageCreationTime = imageFilter.GetCreationTime(); + ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime(); + ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); + ImageInfo.sectors = v98hdr.totals; + ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; + ImageInfo.sectorSize = v98hdr.sectorsize; + ImageInfo.cylinders = v98hdr.cylinders; + ImageInfo.heads = v98hdr.surfaces; + ImageInfo.sectorsPerTrack = v98hdr.sectors; + ImageInfo.imageComments = StringHandlers.CToString(v98hdr.comment, shiftjis); + + nhdImageFilter = imageFilter; + + return true; + } + + public override bool ImageHasPartitions() + { + return false; + } + + public override ulong GetImageSize() + { + return ImageInfo.imageSize; + } + + public override ulong GetSectors() + { + return ImageInfo.sectors; + } + + public override uint GetSectorSize() + { + return ImageInfo.sectorSize; + } + + public override string GetImageFormat() + { + return "Virtual98 disk image"; + } + + public override string GetImageVersion() + { + return ImageInfo.imageVersion; + } + + public override string GetImageApplication() + { + return ImageInfo.imageApplication; + } + + public override string GetImageApplicationVersion() + { + return ImageInfo.imageApplicationVersion; + } + + public override string GetImageCreator() + { + return ImageInfo.imageCreator; + } + + public override DateTime GetImageCreationTime() + { + return ImageInfo.imageCreationTime; + } + + public override DateTime GetImageLastModificationTime() + { + return ImageInfo.imageLastModificationTime; + } + + public override string GetImageName() + { + return ImageInfo.imageName; + } + + public override string GetImageComments() + { + return ImageInfo.imageComments; + } + + public override MediaType GetMediaType() + { + return ImageInfo.mediaType; + } + + public override byte[] ReadSector(ulong sectorAddress) + { + return ReadSectors(sectorAddress, 1); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length) + { + if(sectorAddress > ImageInfo.sectors - 1) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found"); + + if(sectorAddress + length > ImageInfo.sectors) + throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); + + byte[] buffer = new byte[length * ImageInfo.sectorSize]; + + Stream stream = nhdImageFilter.GetDataForkStream(); + + // V98 are lazy allocated + if((long)(0xDC + sectorAddress * ImageInfo.sectorSize) >= stream.Length) return buffer; + + stream.Seek((long)(0xDC + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin); + + int toRead = (int)(length * ImageInfo.sectorSize); + + if(toRead + stream.Position > stream.Length) toRead = (int)(stream.Length - stream.Position); + + stream.Read(buffer, 0, toRead); + + return buffer; + } + + #region Unsupported features + public override byte[] ReadDiskTag(MediaTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorLong(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override string GetMediaManufacturer() + { + return null; + } + + public override string GetMediaModel() + { + return null; + } + + public override string GetMediaSerialNumber() + { + return null; + } + + public override string GetMediaBarcode() + { + return null; + } + + public override string GetMediaPartNumber() + { + return null; + } + + public override int GetMediaSequence() + { + return 0; + } + + public override int GetLastDiskSequence() + { + return 0; + } + + public override string GetDriveManufacturer() + { + return null; + } + + public override string GetDriveModel() + { + return null; + } + + public override string GetDriveSerialNumber() + { + return null; + } + + public override List<Partition> GetPartitions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetTracks() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(Session session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Track> GetSessionTracks(ushort session) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override List<Session> GetSessions() + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySector(ulong sectorAddress) + { + return null; + } + + public override bool? VerifySector(ulong sectorAddress, uint track) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + FailingLBAs = new List<ulong>(); + UnknownLBAs = new List<ulong>(); + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); + + return null; + } + + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) + { + throw new FeatureUnsupportedImageException("Feature not supported by image format"); + } + + public override bool? VerifyMediaImage() + { + return null; + } + #endregion + } } \ No newline at end of file diff --git a/DiscImageChef.DiscImages/ZZZRawImage.cs b/DiscImageChef.DiscImages/ZZZRawImage.cs index 9bfc1a6b..af4961d8 100644 --- a/DiscImageChef.DiscImages/ZZZRawImage.cs +++ b/DiscImageChef.DiscImages/ZZZRawImage.cs @@ -39,14 +39,12 @@ using DiscImageChef.Filters; namespace DiscImageChef.ImagePlugins { - public class ZZZRawImage : ImagePlugin + public class ZZZRawImage : ImagePlugin { #region Internal variables - Filter rawImageFilter; bool differentTrackZeroSize; - string extension; - + string extension; #endregion public ZZZRawImage() @@ -82,21 +80,21 @@ namespace DiscImageChef.ImagePlugins // Check if file is not multiple of 512 if((imageFilter.GetDataForkLength() % 512) != 0) { - extension = Path.GetExtension(imageFilter.GetFilename()).ToLower(); + extension = Path.GetExtension(imageFilter.GetFilename()).ToLower(); - if(extension == ".hdf" && ImageInfo.imageSize % 256 == 0) - return true; + if(extension == ".hdf" && ImageInfo.imageSize % 256 == 0) return true; - // Check known disk sizes with sectors smaller than 512 - switch(imageFilter.GetDataForkLength()) + // Check known disk sizes with sectors smaller than 512 + switch(imageFilter.GetDataForkLength()) { - #region Commodore - case 174848: - case 175531: - case 197376: - case 351062: - case 822400: - #endregion Commodore + #region Commodore + case 174848: + case 175531: + case 197376: + case 351062: + case 822400: + #endregion Commodore + case 81664: case 116480: case 242944: @@ -111,10 +109,8 @@ namespace DiscImageChef.ImagePlugins case 1177344: case 1222400: case 1304320: - case 1255168: - return true; - default: - return false; + case 1255168: return true; + default: return false; } } @@ -127,18 +123,16 @@ namespace DiscImageChef.ImagePlugins stream.Seek(0, SeekOrigin.Begin); extension = Path.GetExtension(imageFilter.GetFilename()).ToLower(); - if(extension == ".iso" && (imageFilter.GetDataForkLength() % 2048) == 0) - ImageInfo.sectorSize = 2048; - else if(extension == ".d81" && imageFilter.GetDataForkLength() == 819200) - ImageInfo.sectorSize = 256; - else if((extension == ".adf" || extension == ".adl" || extension == ".ssd" || extension == ".dsd") && - (imageFilter.GetDataForkLength() == 163840 || imageFilter.GetDataForkLength() == 327680 || imageFilter.GetDataForkLength() == 655360)) - ImageInfo.sectorSize = 256; - else if((extension == ".adf" || extension == ".adl") && imageFilter.GetDataForkLength() == 819200) - ImageInfo.sectorSize = 1024; - else - { - switch(imageFilter.GetDataForkLength()) + if(extension == ".iso" && (imageFilter.GetDataForkLength() % 2048) == 0) ImageInfo.sectorSize = 2048; + else if(extension == ".d81" && imageFilter.GetDataForkLength() == 819200) ImageInfo.sectorSize = 256; + else if((extension == ".adf" || extension == ".adl" || extension == ".ssd" || extension == ".dsd") && + (imageFilter.GetDataForkLength() == 163840 || imageFilter.GetDataForkLength() == 327680 || + imageFilter.GetDataForkLength() == 655360)) ImageInfo.sectorSize = 256; + else if((extension == ".adf" || extension == ".adl") && imageFilter.GetDataForkLength() == 819200) + ImageInfo.sectorSize = 1024; + else + { + switch(imageFilter.GetDataForkLength()) { case 242944: case 256256: @@ -162,16 +156,18 @@ namespace DiscImageChef.ImagePlugins case 80384: // T0S0 = 128bps case 325632: // T0S0 = 128bps, T0S1 = 256bps case 653312: // T0S0 = 128bps, T0S1 = 256bps - #region Commodore - case 174848: - case 175531: - case 196608: - case 197376: - case 349696: - case 351062: - case 822400: - #endregion Commodore - ImageInfo.sectorSize = 256; + + #region Commodore + case 174848: + case 175531: + case 196608: + case 197376: + case 349696: + case 351062: + case 822400: + #endregion Commodore + + ImageInfo.sectorSize = 256; break; case 81664: ImageInfo.sectorSize = 319; @@ -185,8 +181,8 @@ namespace DiscImageChef.ImagePlugins case 1304320: // T0S0 = 128bps, T0S1 = 256bps case 1255168: // T0S0 = 128bps, T0S1 = 256bps case 1261568: - case 1638400: - ImageInfo.sectorSize = 1024; + case 1638400: + ImageInfo.sectorSize = 1024; break; default: ImageInfo.sectorSize = 512; @@ -275,19 +271,19 @@ namespace DiscImageChef.ImagePlugins ImageInfo.sectorSize = 8192; // Biggest sector size differentTrackZeroSize = true; break; - case 175531: - ImageInfo.sectors = 683; - break; - case 197375: - ImageInfo.sectors = 768; - break; - case 351062: - ImageInfo.sectors = 1366; - break; - case 822400: - ImageInfo.sectors = 3200; - break; - default: + case 175531: + ImageInfo.sectors = 683; + break; + case 197375: + ImageInfo.sectors = 768; + break; + case 351062: + ImageInfo.sectors = 1366; + break; + case 822400: + ImageInfo.sectors = 3200; + break; + default: ImageInfo.sectors = ImageInfo.imageSize / ImageInfo.sectorSize; break; } @@ -317,337 +313,337 @@ namespace DiscImageChef.ImagePlugins { ImageInfo.sectorSize = 256; ImageInfo.sectors = ImageInfo.imageSize / ImageInfo.sectorSize; - ImageInfo.mediaType = MediaType.GENERIC_HDD; + ImageInfo.mediaType = MediaType.GENERIC_HDD; } } - if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) - { - ImageInfo.imageHasSessions = true; - ImageInfo.imageHasPartitions = true; - } + if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) + { + ImageInfo.imageHasSessions = true; + ImageInfo.imageHasPartitions = true; + } DicConsole.VerboseWriteLine("Raw disk image contains a disk of type {0}", ImageInfo.mediaType); - switch(ImageInfo.mediaType) - { - case MediaType.ACORN_35_DS_DD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 5; - break; - case MediaType.ACORN_35_DS_HD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 10; - break; - case MediaType.ACORN_525_DS_DD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 16; - break; - case MediaType.ACORN_525_SS_DD_40: - ImageInfo.cylinders = 40; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 16; - break; - case MediaType.ACORN_525_SS_DD_80: - ImageInfo.cylinders = 80; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 16; - break; - case MediaType.ACORN_525_SS_SD_40: - ImageInfo.cylinders = 40; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 10; - break; - case MediaType.ACORN_525_SS_SD_80: - ImageInfo.cylinders = 80; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 10; - break; - case MediaType.Apple32DS: - ImageInfo.cylinders = 35; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 13; - break; - case MediaType.Apple32SS: - ImageInfo.cylinders = 36; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 13; - break; - case MediaType.Apple33DS: - ImageInfo.cylinders = 35; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 16; - break; - case MediaType.Apple33SS: - ImageInfo.cylinders = 35; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 16; - break; - case MediaType.AppleSonyDS: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 10; - break; - case MediaType.AppleSonySS: - ImageInfo.cylinders = 80; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 10; - break; - case MediaType.ATARI_35_DS_DD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 10; - break; - case MediaType.ATARI_35_DS_DD_11: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 11; - break; - case MediaType.ATARI_35_SS_DD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 10; - break; - case MediaType.ATARI_35_SS_DD_11: - ImageInfo.cylinders = 80; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 11; - break; - case MediaType.ATARI_525_ED: - ImageInfo.cylinders = 40; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 26; - break; - case MediaType.ATARI_525_SD: - ImageInfo.cylinders = 40; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 18; - break; - case MediaType.CBM_35_DD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 10; - break; - case MediaType.CBM_AMIGA_35_DD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 11; - break; - case MediaType.CBM_AMIGA_35_HD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 22; - break; - case MediaType.DMF: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 21; - break; - case MediaType.DOS_35_DS_DD_9: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 9; - break; - case MediaType.Apricot_35: - ImageInfo.cylinders = 70; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 9; - break; - case MediaType.DOS_35_ED: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 36; - break; - case MediaType.DOS_35_HD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 18; - break; - case MediaType.DOS_35_SS_DD_9: - ImageInfo.cylinders = 80; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 9; - break; - case MediaType.DOS_525_DS_DD_8: - ImageInfo.cylinders = 40; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 8; - break; - case MediaType.DOS_525_DS_DD_9: - ImageInfo.cylinders = 40; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 9; - break; - case MediaType.DOS_525_HD: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 15; - break; - case MediaType.DOS_525_SS_DD_8: - ImageInfo.cylinders = 40; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 8; - break; - case MediaType.DOS_525_SS_DD_9: - ImageInfo.cylinders = 40; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 9; - break; - case MediaType.ECMA_54: - ImageInfo.cylinders = 77; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 26; - break; - case MediaType.ECMA_59: - ImageInfo.cylinders = 77; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 26; - break; - case MediaType.ECMA_66: - ImageInfo.cylinders = 35; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 9; - break; - case MediaType.ECMA_69_8: - ImageInfo.cylinders = 77; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 8; - break; - case MediaType.ECMA_70: - ImageInfo.cylinders = 40; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 16; - break; - case MediaType.ECMA_78: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 16; - break; - case MediaType.ECMA_99_15: - ImageInfo.cylinders = 77; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 15; - break; - case MediaType.ECMA_99_26: - ImageInfo.cylinders = 77; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 26; - break; - case MediaType.ECMA_99_8: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 8; - break; - case MediaType.FDFORMAT_35_DD: - ImageInfo.cylinders = 82; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 10; - break; - case MediaType.FDFORMAT_35_HD: - ImageInfo.cylinders = 82; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 21; - break; - case MediaType.FDFORMAT_525_HD: - ImageInfo.cylinders = 82; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 17; - break; - case MediaType.IBM23FD: - ImageInfo.cylinders = 32; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 8; - break; - case MediaType.IBM33FD_128: - ImageInfo.cylinders = 73; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 26; - break; - case MediaType.IBM33FD_256: - ImageInfo.cylinders = 74; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 15; - break; - case MediaType.IBM33FD_512: - ImageInfo.cylinders = 74; - ImageInfo.heads = 1; - ImageInfo.sectorsPerTrack = 8; - break; - case MediaType.IBM43FD_128: - ImageInfo.cylinders = 74; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 26; - break; - case MediaType.IBM43FD_256: - ImageInfo.cylinders = 74; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 15; - break; - case MediaType.IBM53FD_1024: - ImageInfo.cylinders = 74; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 8; - break; - case MediaType.IBM53FD_256: - ImageInfo.cylinders = 74; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 26; - break; - case MediaType.IBM53FD_512: - ImageInfo.cylinders = 74; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 15; - break; - case MediaType.NEC_35_TD: - ImageInfo.cylinders = 240; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 38; - break; - case MediaType.NEC_525_HD: - ImageInfo.cylinders = 77; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 8; - break; - case MediaType.XDF_35: - ImageInfo.cylinders = 80; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 23; - break; - // Following ones are what the device itself report, not the physical geometry - case MediaType.Jaz: - ImageInfo.cylinders = 1021; - ImageInfo.heads = 64; - ImageInfo.sectorsPerTrack = 32; - break; - case MediaType.PocketZip: - ImageInfo.cylinders = 154; - ImageInfo.heads = 16; - ImageInfo.sectorsPerTrack = 32; - break; - case MediaType.LS120: - ImageInfo.cylinders = 963; - ImageInfo.heads = 8; - ImageInfo.sectorsPerTrack = 32; - break; - case MediaType.LS240: - ImageInfo.cylinders = 262; - ImageInfo.heads = 32; - ImageInfo.sectorsPerTrack = 56; - break; - case MediaType.FD32MB: - ImageInfo.cylinders = 1024; - ImageInfo.heads = 2; - ImageInfo.sectorsPerTrack = 32; - break; - default: - ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); - ImageInfo.heads = 16; - ImageInfo.sectorsPerTrack = 63; - break; - } + switch(ImageInfo.mediaType) + { + case MediaType.ACORN_35_DS_DD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 5; + break; + case MediaType.ACORN_35_DS_HD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 10; + break; + case MediaType.ACORN_525_DS_DD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 16; + break; + case MediaType.ACORN_525_SS_DD_40: + ImageInfo.cylinders = 40; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 16; + break; + case MediaType.ACORN_525_SS_DD_80: + ImageInfo.cylinders = 80; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 16; + break; + case MediaType.ACORN_525_SS_SD_40: + ImageInfo.cylinders = 40; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 10; + break; + case MediaType.ACORN_525_SS_SD_80: + ImageInfo.cylinders = 80; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 10; + break; + case MediaType.Apple32DS: + ImageInfo.cylinders = 35; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 13; + break; + case MediaType.Apple32SS: + ImageInfo.cylinders = 36; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 13; + break; + case MediaType.Apple33DS: + ImageInfo.cylinders = 35; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 16; + break; + case MediaType.Apple33SS: + ImageInfo.cylinders = 35; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 16; + break; + case MediaType.AppleSonyDS: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 10; + break; + case MediaType.AppleSonySS: + ImageInfo.cylinders = 80; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 10; + break; + case MediaType.ATARI_35_DS_DD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 10; + break; + case MediaType.ATARI_35_DS_DD_11: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 11; + break; + case MediaType.ATARI_35_SS_DD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 10; + break; + case MediaType.ATARI_35_SS_DD_11: + ImageInfo.cylinders = 80; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 11; + break; + case MediaType.ATARI_525_ED: + ImageInfo.cylinders = 40; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 26; + break; + case MediaType.ATARI_525_SD: + ImageInfo.cylinders = 40; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 18; + break; + case MediaType.CBM_35_DD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 10; + break; + case MediaType.CBM_AMIGA_35_DD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 11; + break; + case MediaType.CBM_AMIGA_35_HD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 22; + break; + case MediaType.DMF: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 21; + break; + case MediaType.DOS_35_DS_DD_9: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 9; + break; + case MediaType.Apricot_35: + ImageInfo.cylinders = 70; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 9; + break; + case MediaType.DOS_35_ED: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 36; + break; + case MediaType.DOS_35_HD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 18; + break; + case MediaType.DOS_35_SS_DD_9: + ImageInfo.cylinders = 80; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 9; + break; + case MediaType.DOS_525_DS_DD_8: + ImageInfo.cylinders = 40; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 8; + break; + case MediaType.DOS_525_DS_DD_9: + ImageInfo.cylinders = 40; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 9; + break; + case MediaType.DOS_525_HD: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 15; + break; + case MediaType.DOS_525_SS_DD_8: + ImageInfo.cylinders = 40; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 8; + break; + case MediaType.DOS_525_SS_DD_9: + ImageInfo.cylinders = 40; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 9; + break; + case MediaType.ECMA_54: + ImageInfo.cylinders = 77; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 26; + break; + case MediaType.ECMA_59: + ImageInfo.cylinders = 77; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 26; + break; + case MediaType.ECMA_66: + ImageInfo.cylinders = 35; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 9; + break; + case MediaType.ECMA_69_8: + ImageInfo.cylinders = 77; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 8; + break; + case MediaType.ECMA_70: + ImageInfo.cylinders = 40; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 16; + break; + case MediaType.ECMA_78: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 16; + break; + case MediaType.ECMA_99_15: + ImageInfo.cylinders = 77; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 15; + break; + case MediaType.ECMA_99_26: + ImageInfo.cylinders = 77; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 26; + break; + case MediaType.ECMA_99_8: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 8; + break; + case MediaType.FDFORMAT_35_DD: + ImageInfo.cylinders = 82; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 10; + break; + case MediaType.FDFORMAT_35_HD: + ImageInfo.cylinders = 82; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 21; + break; + case MediaType.FDFORMAT_525_HD: + ImageInfo.cylinders = 82; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 17; + break; + case MediaType.IBM23FD: + ImageInfo.cylinders = 32; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 8; + break; + case MediaType.IBM33FD_128: + ImageInfo.cylinders = 73; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 26; + break; + case MediaType.IBM33FD_256: + ImageInfo.cylinders = 74; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 15; + break; + case MediaType.IBM33FD_512: + ImageInfo.cylinders = 74; + ImageInfo.heads = 1; + ImageInfo.sectorsPerTrack = 8; + break; + case MediaType.IBM43FD_128: + ImageInfo.cylinders = 74; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 26; + break; + case MediaType.IBM43FD_256: + ImageInfo.cylinders = 74; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 15; + break; + case MediaType.IBM53FD_1024: + ImageInfo.cylinders = 74; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 8; + break; + case MediaType.IBM53FD_256: + ImageInfo.cylinders = 74; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 26; + break; + case MediaType.IBM53FD_512: + ImageInfo.cylinders = 74; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 15; + break; + case MediaType.NEC_35_TD: + ImageInfo.cylinders = 240; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 38; + break; + case MediaType.NEC_525_HD: + ImageInfo.cylinders = 77; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 8; + break; + case MediaType.XDF_35: + ImageInfo.cylinders = 80; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 23; + break; + // Following ones are what the device itself report, not the physical geometry + case MediaType.Jaz: + ImageInfo.cylinders = 1021; + ImageInfo.heads = 64; + ImageInfo.sectorsPerTrack = 32; + break; + case MediaType.PocketZip: + ImageInfo.cylinders = 154; + ImageInfo.heads = 16; + ImageInfo.sectorsPerTrack = 32; + break; + case MediaType.LS120: + ImageInfo.cylinders = 963; + ImageInfo.heads = 8; + ImageInfo.sectorsPerTrack = 32; + break; + case MediaType.LS240: + ImageInfo.cylinders = 262; + ImageInfo.heads = 32; + ImageInfo.sectorsPerTrack = 56; + break; + case MediaType.FD32MB: + ImageInfo.cylinders = 1024; + ImageInfo.heads = 2; + ImageInfo.sectorsPerTrack = 32; + break; + default: + ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63); + ImageInfo.heads = 16; + ImageInfo.sectorsPerTrack = 63; + break; + } return true; } @@ -679,10 +675,7 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectors(ulong sectorAddress, uint length) { - if(differentTrackZeroSize) - { - throw new NotImplementedException("Not yet implemented"); - } + if(differentTrackZeroSize) { throw new NotImplementedException("Not yet implemented"); } else { if(sectorAddress > ImageInfo.sectors - 1) @@ -700,7 +693,6 @@ namespace DiscImageChef.ImagePlugins stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize)); return buffer; - } } @@ -739,24 +731,24 @@ namespace DiscImageChef.ImagePlugins return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); return null; } - public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, out List<ulong> UnknownLBAs) + public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs, + out List<ulong> UnknownLBAs) { FailingLBAs = new List<ulong>(); UnknownLBAs = new List<ulong>(); - for(ulong i = sectorAddress; i < sectorAddress + length; i++) - UnknownLBAs.Add(i); + for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); return null; } @@ -868,8 +860,7 @@ namespace DiscImageChef.ImagePlugins { if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) { - if(track != 1) - throw new ArgumentOutOfRangeException(nameof(track), "Only a single track is supported"); + if(track != 1) throw new ArgumentOutOfRangeException(nameof(track), "Only a single track is supported"); return ReadSector(sectorAddress); } @@ -881,8 +872,7 @@ namespace DiscImageChef.ImagePlugins { if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) { - if(track != 1) - throw new ArgumentOutOfRangeException(nameof(track), "Only a single track is supported"); + if(track != 1) throw new ArgumentOutOfRangeException(nameof(track), "Only a single track is supported"); return ReadSectors(sectorAddress, length); } @@ -894,8 +884,7 @@ namespace DiscImageChef.ImagePlugins { if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) { - if(track != 1) - throw new ArgumentOutOfRangeException(nameof(track), "Only a single track is supported"); + if(track != 1) throw new ArgumentOutOfRangeException(nameof(track), "Only a single track is supported"); return ReadSector(sectorAddress); } @@ -907,8 +896,7 @@ namespace DiscImageChef.ImagePlugins { if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) { - if(track != 1) - throw new ArgumentOutOfRangeException(nameof(track), "Only a single track is supported"); + if(track != 1) throw new ArgumentOutOfRangeException(nameof(track), "Only a single track is supported"); return ReadSectors(sectorAddress, length); } @@ -917,192 +905,124 @@ namespace DiscImageChef.ImagePlugins } #region Private methods - MediaType CalculateDiskType() { if(ImageInfo.sectorSize == 2048) { - if(ImageInfo.sectors <= 360000) - return MediaType.CD; - if(ImageInfo.sectors <= 2295104) - return MediaType.DVDPR; - if(ImageInfo.sectors <= 2298496) - return MediaType.DVDR; - if(ImageInfo.sectors <= 4171712) - return MediaType.DVDRDL; - if(ImageInfo.sectors <= 4173824) - return MediaType.DVDPRDL; - if(ImageInfo.sectors <= 24438784) - return MediaType.BDR; - if(ImageInfo.sectors <= 62500864) - return MediaType.BDRXL; + if(ImageInfo.sectors <= 360000) return MediaType.CD; + if(ImageInfo.sectors <= 2295104) return MediaType.DVDPR; + if(ImageInfo.sectors <= 2298496) return MediaType.DVDR; + if(ImageInfo.sectors <= 4171712) return MediaType.DVDRDL; + if(ImageInfo.sectors <= 4173824) return MediaType.DVDPRDL; + if(ImageInfo.sectors <= 24438784) return MediaType.BDR; + if(ImageInfo.sectors <= 62500864) return MediaType.BDRXL; + return MediaType.Unknown; } else { switch(ImageInfo.imageSize) { - case 80384: - return MediaType.ECMA_66; - case 81664: - return MediaType.IBM23FD; - case 92160: - return MediaType.ATARI_525_SD; - case 102400: - return MediaType.ACORN_525_SS_SD_40; - case 116480: - return MediaType.Apple32SS; - case 133120: - return MediaType.ATARI_525_ED; - case 143360: - return MediaType.Apple33SS; + case 80384: return MediaType.ECMA_66; + case 81664: return MediaType.IBM23FD; + case 92160: return MediaType.ATARI_525_SD; + case 102400: return MediaType.ACORN_525_SS_SD_40; + case 116480: return MediaType.Apple32SS; + case 133120: return MediaType.ATARI_525_ED; + case 143360: return MediaType.Apple33SS; case 163840: - if(ImageInfo.sectorSize == 256) - return MediaType.ACORN_525_SS_DD_40; - return MediaType.DOS_525_SS_DD_8; - case 184320: - return MediaType.DOS_525_SS_DD_9; - case 204800: - return MediaType.ACORN_525_SS_SD_80; - case 232960: - return MediaType.Apple32DS; - case 242944: - return MediaType.IBM33FD_128; - case 256256: - return MediaType.ECMA_54; - case 286720: - return MediaType.Apple33DS; - case 287488: - return MediaType.IBM33FD_256; - case 306432: - return MediaType.IBM33FD_512; - case 322560: - return MediaType.Apricot_35; - case 325632: - return MediaType.ECMA_70; + if(ImageInfo.sectorSize == 256) return MediaType.ACORN_525_SS_DD_40; + + return MediaType.DOS_525_SS_DD_8; + case 184320: return MediaType.DOS_525_SS_DD_9; + case 204800: return MediaType.ACORN_525_SS_SD_80; + case 232960: return MediaType.Apple32DS; + case 242944: return MediaType.IBM33FD_128; + case 256256: return MediaType.ECMA_54; + case 286720: return MediaType.Apple33DS; + case 287488: return MediaType.IBM33FD_256; + case 306432: return MediaType.IBM33FD_512; + case 322560: return MediaType.Apricot_35; + case 325632: return MediaType.ECMA_70; case 327680: - if(ImageInfo.sectorSize == 256) - return MediaType.ACORN_525_SS_DD_80; - return MediaType.DOS_525_DS_DD_8; + if(ImageInfo.sectorSize == 256) return MediaType.ACORN_525_SS_DD_80; + + return MediaType.DOS_525_DS_DD_8; case 368640: - if(extension == ".st") - return MediaType.DOS_35_SS_DD_9; + if(extension == ".st") return MediaType.DOS_35_SS_DD_9; + return MediaType.DOS_525_DS_DD_9; case 409600: - if(extension == ".st") - return MediaType.ATARI_35_SS_DD; - return MediaType.AppleSonySS; - case 450560: - return MediaType.ATARI_35_SS_DD_11; - case 495872: - return MediaType.IBM43FD_128; - case 512512: - return MediaType.ECMA_59; - case 653312: - return MediaType.ECMA_78; - case 655360: - return MediaType.ACORN_525_DS_DD; - case 737280: - return MediaType.DOS_35_DS_DD_9; + if(extension == ".st") return MediaType.ATARI_35_SS_DD; + + return MediaType.AppleSonySS; + case 450560: return MediaType.ATARI_35_SS_DD_11; + case 495872: return MediaType.IBM43FD_128; + case 512512: return MediaType.ECMA_59; + case 653312: return MediaType.ECMA_78; + case 655360: return MediaType.ACORN_525_DS_DD; + case 737280: return MediaType.DOS_35_DS_DD_9; case 819200: - if(ImageInfo.sectorSize == 256) - return MediaType.CBM_35_DD; - if((extension == ".adf" || extension == ".adl") && ImageInfo.sectorSize == 1024) - return MediaType.ACORN_35_DS_DD; - if(extension == ".st") - return MediaType.ATARI_35_DS_DD; - return MediaType.AppleSonyDS; - case 839680: - return MediaType.FDFORMAT_35_DD; + if(ImageInfo.sectorSize == 256) return MediaType.CBM_35_DD; + if((extension == ".adf" || extension == ".adl") && ImageInfo.sectorSize == 1024) + return MediaType.ACORN_35_DS_DD; + if(extension == ".st") return MediaType.ATARI_35_DS_DD; + + return MediaType.AppleSonyDS; + case 839680: return MediaType.FDFORMAT_35_DD; case 901120: - if(extension == ".st") - return MediaType.ATARI_35_DS_DD_11; - return MediaType.CBM_AMIGA_35_DD; - case 988416: - return MediaType.IBM43FD_256; - case 995072: - return MediaType.IBM53FD_256; - case 1021696: - return MediaType.ECMA_99_26; - case 1146624: - return MediaType.IBM53FD_512; - case 1177344: - return MediaType.ECMA_99_15; - case 1222400: - return MediaType.IBM53FD_1024; - case 1228800: - return MediaType.DOS_525_HD; - case 1255168: - return MediaType.ECMA_69_8; - case 1261568: - return MediaType.NEC_525_HD; - case 1304320: - return MediaType.ECMA_99_8; - case 1427456: - return MediaType.FDFORMAT_525_HD; - case 1474560: - return MediaType.DOS_35_HD; - case 1638400: - return MediaType.ACORN_35_DS_HD; - case 1720320: - return MediaType.DMF; - case 1763328: - return MediaType.FDFORMAT_35_HD; - case 1802240: - return MediaType.CBM_AMIGA_35_HD; - case 1880064: - return MediaType.XDF_35; - case 1884160: - return MediaType.XDF_35; - case 2949120: - return MediaType.DOS_35_ED; - case 9338880: - return MediaType.NEC_35_TD; - case 33554432: - return MediaType.FD32MB; - case 40387584: - return MediaType.PocketZip; - case 126222336: - return MediaType.LS120; - case 127923200: - return MediaType.ECMA_154; - case 201410560: - return MediaType.HiFD; - case 229632000: - return MediaType.ECMA_201; - case 240386048: - return MediaType.LS240; - case 481520640: - return MediaType.ECMA_183_512; - case 533403648: - return MediaType.ECMA_183; - case 596787200: - return MediaType.ECMA_184_512; - case 654540800: - return MediaType.ECMA_184; - case 1070617600: - return MediaType.Jaz; - #region Commodore - case 174848: - case 175531: - return MediaType.CBM_1540; - case 196608: - case 197376: - return MediaType.CBM_1540_Ext; - case 349696: - case 351062: - return MediaType.CBM_1571; - #endregion Commodore - default: - return MediaType.GENERIC_HDD; + if(extension == ".st") return MediaType.ATARI_35_DS_DD_11; + + return MediaType.CBM_AMIGA_35_DD; + case 988416: return MediaType.IBM43FD_256; + case 995072: return MediaType.IBM53FD_256; + case 1021696: return MediaType.ECMA_99_26; + case 1146624: return MediaType.IBM53FD_512; + case 1177344: return MediaType.ECMA_99_15; + case 1222400: return MediaType.IBM53FD_1024; + case 1228800: return MediaType.DOS_525_HD; + case 1255168: return MediaType.ECMA_69_8; + case 1261568: return MediaType.NEC_525_HD; + case 1304320: return MediaType.ECMA_99_8; + case 1427456: return MediaType.FDFORMAT_525_HD; + case 1474560: return MediaType.DOS_35_HD; + case 1638400: return MediaType.ACORN_35_DS_HD; + case 1720320: return MediaType.DMF; + case 1763328: return MediaType.FDFORMAT_35_HD; + case 1802240: return MediaType.CBM_AMIGA_35_HD; + case 1880064: return MediaType.XDF_35; + case 1884160: return MediaType.XDF_35; + case 2949120: return MediaType.DOS_35_ED; + case 9338880: return MediaType.NEC_35_TD; + case 33554432: return MediaType.FD32MB; + case 40387584: return MediaType.PocketZip; + case 126222336: return MediaType.LS120; + case 127923200: return MediaType.ECMA_154; + case 201410560: return MediaType.HiFD; + case 229632000: return MediaType.ECMA_201; + case 240386048: return MediaType.LS240; + case 481520640: return MediaType.ECMA_183_512; + case 533403648: return MediaType.ECMA_183; + case 596787200: return MediaType.ECMA_184_512; + case 654540800: return MediaType.ECMA_184; + case 1070617600: return MediaType.Jaz; + + #region Commodore + case 174848: + case 175531: return MediaType.CBM_1540; + case 196608: + case 197376: return MediaType.CBM_1540_Ext; + case 349696: + case 351062: return MediaType.CBM_1571; + #endregion Commodore + + default: return MediaType.GENERIC_HDD; } } } - #endregion #region Unsupported features - public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) { throw new FeatureUnsupportedImageException("Feature not supported by image format"); @@ -1205,23 +1125,23 @@ namespace DiscImageChef.ImagePlugins public override List<Partition> GetPartitions() { - if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) - { - List<Partition> parts = new List<Partition>(); - Partition part = new Partition - { - Start = 0, - Length = ImageInfo.sectors, - Offset = 0, - Sequence = 0, - Type = "MODE1/2048", - Size = ImageInfo.sectors * ImageInfo.sectorSize - }; - parts.Add(part); - return parts; - } + if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) + { + List<Partition> parts = new List<Partition>(); + Partition part = new Partition + { + Start = 0, + Length = ImageInfo.sectors, + Offset = 0, + Sequence = 0, + Type = "MODE1/2048", + Size = ImageInfo.sectors * ImageInfo.sectorSize + }; + parts.Add(part); + return parts; + } - throw new FeatureUnsupportedImageException("Feature not supported by image format"); + throw new FeatureUnsupportedImageException("Feature not supported by image format"); } public override byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) @@ -1233,8 +1153,6 @@ namespace DiscImageChef.ImagePlugins { throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - #endregion Unsupported features } -} - +} \ No newline at end of file diff --git a/DiscImageChef.DiscImages/packages.config b/DiscImageChef.DiscImages/packages.config index fe0e79b4..a9876f21 100644 --- a/DiscImageChef.DiscImages/packages.config +++ b/DiscImageChef.DiscImages/packages.config @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> + <packages> - <package id="Claunia.RsrcFork" version="1.0.0" targetFramework="net40" /> - <package id="DotNetZip" version="1.10.1" targetFramework="net40" /> - <package id="plist-cil" version="1.16.0" targetFramework="net40" /> - <package id="SharpCompress" version="0.19.2" targetFramework="net40" /> - <package id="System.ValueTuple" version="4.4.0" targetFramework="net40" /> + <package id="Claunia.RsrcFork" version="1.0.0" targetFramework="net40" /> + <package id="DotNetZip" version="1.10.1" targetFramework="net40" /> + <package id="plist-cil" version="1.16.0" targetFramework="net40" /> + <package id="SharpCompress" version="0.19.2" targetFramework="net40" /> + <package id="System.ValueTuple" version="4.4.0" targetFramework="net40" /> </packages> \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AODOS.cs b/DiscImageChef.Filesystems/AODOS.cs index 1269ae6d..d66b1c4b 100644 --- a/DiscImageChef.Filesystems/AODOS.cs +++ b/DiscImageChef.Filesystems/AODOS.cs @@ -82,13 +82,11 @@ namespace DiscImageChef.Filesystems /// <summary> /// " AO-DOS " /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] identifier; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] identifier; /// <summary> /// Volume label /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] volumeLabel; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] volumeLabel; /// <summary> /// How many files are present in disk /// </summary> @@ -99,21 +97,18 @@ namespace DiscImageChef.Filesystems public ushort usedSectors; } - readonly byte[] AODOSIdentifier = { 0x20, 0x41, 0x4F, 0x2D, 0x44, 0x4F, 0x53, 0x20 }; + readonly byte[] AODOSIdentifier = {0x20, 0x41, 0x4F, 0x2D, 0x44, 0x4F, 0x53, 0x20}; public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { // Does AO-DOS support hard disks? - if(partition.Start > 0) - return false; + if(partition.Start > 0) return false; // How is it really? - if(imagePlugin.ImageInfo.sectorSize != 512) - return false; + if(imagePlugin.ImageInfo.sectorSize != 512) return false; // Does AO-DOS support any other kind of disk? - if(imagePlugin.ImageInfo.sectors != 800 && imagePlugin.ImageInfo.sectors != 1600) - return false; + if(imagePlugin.ImageInfo.sectors != 800 && imagePlugin.ImageInfo.sectors != 1600) return false; byte[] sector; @@ -127,7 +122,8 @@ namespace DiscImageChef.Filesystems return bb.identifier.SequenceEqual(AODOSIdentifier); } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { byte[] sector; @@ -157,7 +153,8 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("{0} files on volume", bb.files).AppendLine(); sbInformation.AppendFormat("{0} used sectors on volume", bb.usedSectors).AppendLine(); - sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(bb.volumeLabel, CurrentEncoding)).AppendLine(); + sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(bb.volumeLabel, CurrentEncoding)) + .AppendLine(); information = sbInformation.ToString(); } diff --git a/DiscImageChef.Filesystems/APFS.cs b/DiscImageChef.Filesystems/APFS.cs index 11530eb7..5603a95c 100644 --- a/DiscImageChef.Filesystems/APFS.cs +++ b/DiscImageChef.Filesystems/APFS.cs @@ -78,8 +78,7 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Start >= partition.End) - return false; + if(partition.Start >= partition.End) return false; byte[] sector = imagePlugin.ReadSector(partition.Start); ApfsContainerSuperBlock nxSb; @@ -87,28 +86,25 @@ namespace DiscImageChef.Filesystems try { GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned); - nxSb = (ApfsContainerSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ApfsContainerSuperBlock)); + nxSb = (ApfsContainerSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), + typeof(ApfsContainerSuperBlock)); handle.Free(); } - catch - { - return false; - } + catch { return false; } - if(nxSb.magic == ApfsContainerMagic) - return true; + if(nxSb.magic == ApfsContainerMagic) return true; return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { StringBuilder sbInformation = new StringBuilder(); xmlFSType = new Schemas.FileSystemType(); information = ""; - if(partition.Start >= partition.End) - return; + if(partition.Start >= partition.End) return; byte[] sector = imagePlugin.ReadSector(partition.Start); ApfsContainerSuperBlock nxSb; @@ -116,21 +112,19 @@ namespace DiscImageChef.Filesystems try { GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned); - nxSb = (ApfsContainerSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ApfsContainerSuperBlock)); + nxSb = (ApfsContainerSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), + typeof(ApfsContainerSuperBlock)); handle.Free(); } - catch - { - return; - } + catch { return; } - if(nxSb.magic != ApfsContainerMagic) - return; + if(nxSb.magic != ApfsContainerMagic) return; sbInformation.AppendLine("Apple File System"); sbInformation.AppendLine(); sbInformation.AppendFormat("{0} bytes per block", nxSb.blockSize).AppendLine(); - sbInformation.AppendFormat("Container has {0} bytes in {1} blocks", nxSb.containerBlocks * nxSb.blockSize, nxSb.containerBlocks).AppendLine(); + sbInformation.AppendFormat("Container has {0} bytes in {1} blocks", nxSb.containerBlocks * nxSb.blockSize, + nxSb.containerBlocks).AppendLine(); information = sbInformation.ToString(); @@ -201,5 +195,4 @@ namespace DiscImageChef.Filesystems return Errno.NotImplemented; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Acorn.cs b/DiscImageChef.Filesystems/Acorn.cs index 976a20d9..d6e6e80f 100644 --- a/DiscImageChef.Filesystems/Acorn.cs +++ b/DiscImageChef.Filesystems/Acorn.cs @@ -77,20 +77,16 @@ namespace DiscImageChef.Filesystems { Name = "Acorn Advanced Disc Filing System"; PluginUUID = new Guid("BAFC1E50-9C64-4CD3-8400-80628CC27AFA"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } public AcornADFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Acorn Advanced Disc Filing System"; PluginUUID = new Guid("BAFC1E50-9C64-4CD3-8400-80628CC27AFA"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } /// <summary> @@ -99,8 +95,7 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct BootBlock { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x1C0)] - public byte[] spare; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x1C0)] public byte[] spare; public DiscRecord discRecord; public byte flags; public ushort startCylinder; @@ -127,16 +122,14 @@ namespace DiscImageChef.Filesystems public uint root; public uint disc_size; public ushort disc_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] disc_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] disc_name; public uint disc_type; public uint disc_size_high; public byte flags; public byte nzones_high; public uint format_version; public uint root_size; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] reserved; } /// <summary> @@ -145,13 +138,10 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct OldMapSector0 { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 82 * 3)] - public byte[] freeStart; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 82 * 3)] public byte[] freeStart; public byte reserved; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] name; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] size; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] size; public byte checksum; } @@ -161,10 +151,8 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct OldMapSector1 { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 82 * 3)] - public byte[] freeStart; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 82 * 3)] public byte[] freeStart; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] name; public ushort discId; public byte boot; public byte freeEnd; @@ -208,13 +196,11 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DirectoryEntry { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] name; public uint load; public uint exec; public uint length; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] address; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] address; public byte atts; } @@ -226,12 +212,9 @@ namespace DiscImageChef.Filesystems { public byte lastMark; public ushort reserved; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] parent; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] - public byte[] title; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] parent; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] public byte[] title; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] name; public byte endMasSeq; public uint magic; public byte checkByte; @@ -244,14 +227,10 @@ namespace DiscImageChef.Filesystems struct OldDirectoryTail { public byte lastMark; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] name; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] parent; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] - public byte[] title; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] parent; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] public byte[] title; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] reserved; public byte endMasSeq; public uint magic; public byte checkByte; @@ -264,8 +243,7 @@ namespace DiscImageChef.Filesystems struct OldDirectory { public DirectoryHeader header; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 47)] - public DirectoryEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 47)] public DirectoryEntry[] entries; public OldDirectoryTail tail; } @@ -276,22 +254,19 @@ namespace DiscImageChef.Filesystems struct NewDirectory { public DirectoryHeader header; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 77)] - public DirectoryEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 77)] public DirectoryEntry[] entries; public NewDirectoryTail tail; } // TODO: BBC Master hard disks are untested... public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Start >= partition.End) - return false; + if(partition.Start >= partition.End) return false; ulong sbSector; uint sectorsToRead; - if(imagePlugin.ImageInfo.sectorSize < 256) - return false; + if(imagePlugin.ImageInfo.sectorSize < 256) return false; byte[] sector; GCHandle ptr; @@ -333,12 +308,12 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("ADFS Plugin", "oldMap1.checksum = {0}", oldMap1.checksum); DicConsole.DebugWriteLine("ADFS Plugin", "oldChk1 = {0}", oldChk1); - if(oldMap0.checksum == oldChk0 && oldMap1.checksum == oldChk1 && oldMap0.checksum != 0 && oldMap1.checksum != 0) + if(oldMap0.checksum == oldChk0 && oldMap1.checksum == oldChk1 && oldMap0.checksum != 0 && + oldMap1.checksum != 0) { sbSector = oldDirectoryLocation / imagePlugin.ImageInfo.sectorSize; sectorsToRead = oldDirectorySize / imagePlugin.ImageInfo.sectorSize; - if(oldDirectorySize % imagePlugin.ImageInfo.sectorSize > 0) - sectorsToRead++; + if(oldDirectorySize % imagePlugin.ImageInfo.sectorSize > 0) sectorsToRead++; sector = imagePlugin.ReadSectors(sbSector, sectorsToRead); if(sector.Length > oldDirectorySize) @@ -352,20 +327,20 @@ namespace DiscImageChef.Filesystems oldRoot = (OldDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldDirectory)); dirChk = AcornDirectoryChecksum(sector, (int)oldDirectorySize - 1); - DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.header.magic at 0x200 = {0}", oldRoot.header.magic); + DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.header.magic at 0x200 = {0}", + oldRoot.header.magic); DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.tail.magic at 0x200 = {0}", oldRoot.tail.magic); - DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.tail.checkByte at 0x200 = {0}", oldRoot.tail.checkByte); + DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.tail.checkByte at 0x200 = {0}", + oldRoot.tail.checkByte); DicConsole.DebugWriteLine("ADFS Plugin", "dirChk at 0x200 = {0}", dirChk); if((oldRoot.header.magic == oldDirMagic && oldRoot.tail.magic == oldDirMagic) || - (oldRoot.header.magic == newDirMagic && oldRoot.tail.magic == newDirMagic)) - return true; + (oldRoot.header.magic == newDirMagic && oldRoot.tail.magic == newDirMagic)) return true; // RISC OS says the old directory can't be in the new location, hard disks created by RISC OS 3.10 do that... sbSector = newDirectoryLocation / imagePlugin.ImageInfo.sectorSize; sectorsToRead = newDirectorySize / imagePlugin.ImageInfo.sectorSize; - if(newDirectorySize % imagePlugin.ImageInfo.sectorSize > 0) - sectorsToRead++; + if(newDirectorySize % imagePlugin.ImageInfo.sectorSize > 0) sectorsToRead++; sector = imagePlugin.ReadSectors(sbSector, sectorsToRead); if(sector.Length > oldDirectorySize) @@ -379,14 +354,15 @@ namespace DiscImageChef.Filesystems oldRoot = (OldDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldDirectory)); dirChk = AcornDirectoryChecksum(sector, (int)oldDirectorySize - 1); - DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.header.magic at 0x400 = {0}", oldRoot.header.magic); + DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.header.magic at 0x400 = {0}", + oldRoot.header.magic); DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.tail.magic at 0x400 = {0}", oldRoot.tail.magic); - DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.tail.checkByte at 0x400 = {0}", oldRoot.tail.checkByte); + DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.tail.checkByte at 0x400 = {0}", + oldRoot.tail.checkByte); DicConsole.DebugWriteLine("ADFS Plugin", "dirChk at 0x400 = {0}", dirChk); if((oldRoot.header.magic == oldDirMagic && oldRoot.tail.magic == oldDirMagic) || - (oldRoot.header.magic == newDirMagic && oldRoot.tail.magic == newDirMagic)) - return true; + (oldRoot.header.magic == newDirMagic && oldRoot.tail.magic == newDirMagic)) return true; } } @@ -400,16 +376,14 @@ namespace DiscImageChef.Filesystems sbSector = bootBlockLocation / imagePlugin.ImageInfo.sectorSize; sectorsToRead = bootBlockSize / imagePlugin.ImageInfo.sectorSize; - if(bootBlockSize % imagePlugin.ImageInfo.sectorSize > 0) - sectorsToRead++; + if(bootBlockSize % imagePlugin.ImageInfo.sectorSize > 0) sectorsToRead++; - if(sbSector + partition.Start + sectorsToRead >= partition.End) - return false; + if(sbSector + partition.Start + sectorsToRead >= partition.End) return false; byte[] bootSector = imagePlugin.ReadSectors(sbSector + partition.Start, sectorsToRead); int bootChk = 0; - for(int i = 0; i < 0x1FF; i++) - bootChk = ((bootChk & 0xFF) + (bootChk >> 8) + bootSector[i]); + for(int i = 0; i < 0x1FF; i++) bootChk = ((bootChk & 0xFF) + (bootChk >> 8) + bootSector[i]); + DicConsole.DebugWriteLine("ADFS Plugin", "bootChk = {0}", bootChk); DicConsole.DebugWriteLine("ADFS Plugin", "bBlock.checksum = {0}", bootSector[0x1FF]); @@ -427,33 +401,28 @@ namespace DiscImageChef.Filesystems ptr.Free(); drSb = bBlock.discRecord; } - else - return false; + else return false; DicConsole.DebugWriteLine("ADFS Plugin", "drSb.log2secsize = {0}", drSb.log2secsize); DicConsole.DebugWriteLine("ADFS Plugin", "drSb.idlen = {0}", drSb.idlen); DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_size_high = {0}", drSb.disc_size_high); DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_size = {0}", drSb.disc_size); - DicConsole.DebugWriteLine("ADFS Plugin", "IsNullOrEmpty(drSb.reserved) = {0}", ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)); + DicConsole.DebugWriteLine("ADFS Plugin", "IsNullOrEmpty(drSb.reserved) = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)); - if(drSb.log2secsize < 8 || drSb.log2secsize > 10) - return false; + if(drSb.log2secsize < 8 || drSb.log2secsize > 10) return false; - if(drSb.idlen < (drSb.log2secsize + 3) || drSb.idlen > 19) - return false; + if(drSb.idlen < (drSb.log2secsize + 3) || drSb.idlen > 19) return false; - if((drSb.disc_size_high >> drSb.log2secsize) != 0) - return false; + if((drSb.disc_size_high >> drSb.log2secsize) != 0) return false; - if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)) - return false; + if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)) return false; ulong bytes = drSb.disc_size_high; bytes *= 0x100000000; bytes += drSb.disc_size; - if(bytes > (imagePlugin.GetSectors() * imagePlugin.GetSectorSize())) - return false; + if(bytes > (imagePlugin.GetSectors() * imagePlugin.GetSectorSize())) return false; return true; } @@ -461,7 +430,8 @@ namespace DiscImageChef.Filesystems // TODO: Find root directory on volumes with DiscRecord // TODO: Support big directories (ADFS-G?) // TODO: Find the real freemap on volumes with DiscRecord, as DiscRecord's discid may be empty but this one isn't - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { StringBuilder sbInformation = new StringBuilder(); xmlFSType = new Schemas.FileSystemType(); @@ -505,7 +475,8 @@ namespace DiscImageChef.Filesystems oldMap1 = (OldMapSector1)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldMapSector1)); } - if(oldMap0.checksum == oldChk0 && oldMap1.checksum == oldChk1 && oldMap0.checksum != 0 && oldMap1.checksum != 0) + if(oldMap0.checksum == oldChk0 && oldMap1.checksum == oldChk1 && oldMap0.checksum != 0 && + oldMap1.checksum != 0) { bytes = (ulong)((oldMap0.size[2] << 16) + (oldMap0.size[1] << 8) + oldMap0.size[0]) * 256; byte[] namebytes = new byte[10]; @@ -527,8 +498,7 @@ namespace DiscImageChef.Filesystems { sbSector = oldDirectoryLocation / imagePlugin.ImageInfo.sectorSize; sectorsToRead = oldDirectorySize / imagePlugin.ImageInfo.sectorSize; - if(oldDirectorySize % imagePlugin.ImageInfo.sectorSize > 0) - sectorsToRead++; + if(oldDirectorySize % imagePlugin.ImageInfo.sectorSize > 0) sectorsToRead++; sector = imagePlugin.ReadSectors(sbSector, sectorsToRead); if(sector.Length > oldDirectorySize) @@ -550,8 +520,7 @@ namespace DiscImageChef.Filesystems // RISC OS says the old directory can't be in the new location, hard disks created by RISC OS 3.10 do that... sbSector = newDirectoryLocation / imagePlugin.ImageInfo.sectorSize; sectorsToRead = newDirectorySize / imagePlugin.ImageInfo.sectorSize; - if(newDirectorySize % imagePlugin.ImageInfo.sectorSize > 0) - sectorsToRead++; + if(newDirectorySize % imagePlugin.ImageInfo.sectorSize > 0) sectorsToRead++; sector = imagePlugin.ReadSectors(sbSector, sectorsToRead); if(sector.Length > oldDirectorySize) @@ -562,7 +531,8 @@ namespace DiscImageChef.Filesystems sector = tmp; } ptr = GCHandle.Alloc(sector, GCHandleType.Pinned); - oldRoot = (OldDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldDirectory)); + oldRoot = (OldDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), + typeof(OldDirectory)); if(oldRoot.header.magic == oldDirMagic && oldRoot.tail.magic == oldDirMagic) { @@ -579,7 +549,8 @@ namespace DiscImageChef.Filesystems sector = tmp; } ptr = GCHandle.Alloc(sector, GCHandleType.Pinned); - newRoot = (NewDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(NewDirectory)); + newRoot = (NewDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), + typeof(NewDirectory)); if(newRoot.header.magic == newDirMagic && newRoot.tail.magic == newDirMagic) { namebytes = newRoot.tail.title; @@ -592,7 +563,8 @@ namespace DiscImageChef.Filesystems sbInformation.AppendLine(); sbInformation.AppendFormat("{0} bytes per sector", imagePlugin.ImageInfo.sectorSize).AppendLine(); sbInformation.AppendFormat("Volume has {0} bytes", bytes).AppendLine(); - sbInformation.AppendFormat("Volume name: {0}", StringHandlers.CToString(namebytes, CurrentEncoding)).AppendLine(); + sbInformation.AppendFormat("Volume name: {0}", StringHandlers.CToString(namebytes, CurrentEncoding)) + .AppendLine(); if(oldMap1.discId > 0) { xmlFSType.VolumeSerial = string.Format("{0:X4}", oldMap1.discId); @@ -617,13 +589,12 @@ namespace DiscImageChef.Filesystems sbSector = bootBlockLocation / imagePlugin.ImageInfo.sectorSize; sectorsToRead = bootBlockSize / imagePlugin.ImageInfo.sectorSize; - if(bootBlockSize % imagePlugin.ImageInfo.sectorSize > 0) - sectorsToRead++; + if(bootBlockSize % imagePlugin.ImageInfo.sectorSize > 0) sectorsToRead++; byte[] bootSector = imagePlugin.ReadSectors(sbSector + partition.Start, sectorsToRead); int bootChk = 0; - for(int i = 0; i < 0x1FF; i++) - bootChk = ((bootChk & 0xFF) + (bootChk >> 8) + bootSector[i]); + for(int i = 0; i < 0x1FF; i++) bootChk = ((bootChk & 0xFF) + (bootChk >> 8) + bootSector[i]); + DicConsole.DebugWriteLine("ADFS Plugin", "bootChk = {0}", bootChk); DicConsole.DebugWriteLine("ADFS Plugin", "bBlock.checksum = {0}", bootSector[0x1FF]); @@ -641,8 +612,7 @@ namespace DiscImageChef.Filesystems ptr.Free(); drSb = bBlock.discRecord; } - else - return; + else return; DicConsole.DebugWriteLine("ADFS Plugin", "drSb.log2secsize = {0}", drSb.log2secsize); DicConsole.DebugWriteLine("ADFS Plugin", "drSb.spt = {0}", drSb.spt); @@ -658,7 +628,8 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("ADFS Plugin", "drSb.root = {0}", drSb.root); DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_size = {0}", drSb.disc_size); DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_id = {0}", drSb.disc_id); - DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_name = {0}", StringHandlers.CToString(drSb.disc_name, CurrentEncoding)); + DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_name = {0}", + StringHandlers.CToString(drSb.disc_name, CurrentEncoding)); DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_type = {0}", drSb.disc_type); DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_size_high = {0}", drSb.disc_size_high); DicConsole.DebugWriteLine("ADFS Plugin", "drSb.flags = {0}", drSb.flags); @@ -666,17 +637,13 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("ADFS Plugin", "drSb.format_version = {0}", drSb.format_version); DicConsole.DebugWriteLine("ADFS Plugin", "drSb.root_size = {0}", drSb.root_size); - if(drSb.log2secsize < 8 || drSb.log2secsize > 10) - return; + if(drSb.log2secsize < 8 || drSb.log2secsize > 10) return; - if(drSb.idlen < (drSb.log2secsize + 3) || drSb.idlen > 19) - return; + if(drSb.idlen < (drSb.log2secsize + 3) || drSb.idlen > 19) return; - if((drSb.disc_size_high >> drSb.log2secsize) != 0) - return; + if((drSb.disc_size_high >> drSb.log2secsize) != 0) return; - if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)) - return; + if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)) return; bytes = drSb.disc_size_high; bytes *= 0x100000000; @@ -686,8 +653,7 @@ namespace DiscImageChef.Filesystems zones *= 0x100000000; zones += drSb.nzones; - if(bytes > (imagePlugin.GetSectors() * imagePlugin.GetSectorSize())) - return; + if(bytes > (imagePlugin.GetSectors() * imagePlugin.GetSectorSize())) return; xmlFSType = new Schemas.FileSystemType(); @@ -790,8 +756,7 @@ namespace DiscImageChef.Filesystems int sum = 0; int carry = 0; - if(length > data.Length) - length = data.Length; + if(length > data.Length) length = data.Length; // ADC r0, r0, r1 // MOVS r0, r0, LSL #24 @@ -804,8 +769,7 @@ namespace DiscImageChef.Filesystems carry = 1; sum &= 0xFF; } - else - carry = 0; + else carry = 0; } return (byte)(sum & 0xFF); @@ -852,8 +816,7 @@ namespace DiscImageChef.Filesystems { uint sum = 0; - if(length > data.Length) - length = data.Length; + if(length > data.Length) length = data.Length; // EOR r0, r1, r0, ROR #13 for(int i = 0; i < length; i++) diff --git a/DiscImageChef.Filesystems/AmigaDOS.cs b/DiscImageChef.Filesystems/AmigaDOS.cs index d6de11bb..667f0d39 100644 --- a/DiscImageChef.Filesystems/AmigaDOS.cs +++ b/DiscImageChef.Filesystems/AmigaDOS.cs @@ -52,20 +52,16 @@ namespace DiscImageChef.Filesystems { Name = "Amiga DOS filesystem"; PluginUUID = new Guid("3c882400-208c-427d-a086-9119852a1bc7"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } public AmigaDOSPlugin(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Amiga DOS filesystem"; PluginUUID = new Guid("3c882400-208c-427d-a086-9119852a1bc7"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } /// <summary> @@ -89,8 +85,7 @@ namespace DiscImageChef.Filesystems /// <summary> /// Offset 0x0C, Boot code, til completion. Size is intentionally incorrect to allow marshaling to work. /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] - public byte[] bootCode; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] bootCode; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -124,8 +119,7 @@ namespace DiscImageChef.Filesystems /// Offset 0x18, Hashtable, size = (block size / 4) - 56 or size = hashTableSize. /// Size intentionally bad to allow marshalling to work. /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] - public uint[] hashTable; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public uint[] hashTable; /// <summary> /// Offset 0x18+hashTableSize*4+0, bitmap flag, 0xFFFFFFFF if valid /// </summary> @@ -133,8 +127,7 @@ namespace DiscImageChef.Filesystems /// <summary> /// Offset 0x18+hashTableSize*4+4, bitmap pages, 25 entries /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 25)] - public uint[] bitmapPages; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 25)] public uint[] bitmapPages; /// <summary> /// Offset 0x18+hashTableSize*4+104, pointer to bitmap extension block /// </summary> @@ -154,8 +147,7 @@ namespace DiscImageChef.Filesystems /// <summary> /// Offset 0x18+hashTableSize*4+120, disk name, pascal string, 31 bytes /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] - public byte[] diskName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] public byte[] diskName; /// <summary> /// Offset 0x18+hashTableSize*4+151, unused /// </summary> @@ -218,8 +210,7 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Start >= partition.End) - return false; + if(partition.Start >= partition.End) return false; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -234,16 +225,14 @@ namespace DiscImageChef.Filesystems // AROS boot floppies... if(sector.Length >= 512 && sector[510] == 0x55 && sector[511] == 0xAA && - (bblk.diskType & FFS_Mask) != FFS_Mask && (bblk.diskType & MuFS_Mask) != MuFS_Mask) + (bblk.diskType & FFS_Mask) != FFS_Mask && (bblk.diskType & MuFS_Mask) != MuFS_Mask) { sector = imagePlugin.ReadSectors(1 + partition.Start, 2); bblk = BigEndianMarshal.ByteArrayToStructureBigEndian<BootBlock>(sector); } // Not FFS or MuFS? - if((bblk.diskType & FFS_Mask) != FFS_Mask && - (bblk.diskType & MuFS_Mask) != MuFS_Mask) - return false; + if((bblk.diskType & FFS_Mask) != FFS_Mask && (bblk.diskType & MuFS_Mask) != MuFS_Mask) return false; // Clear checksum on sector sector[4] = sector[5] = sector[6] = sector[7] = 0; @@ -261,17 +250,20 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("AmigaDOS plugin", "Bootblock points to {0} as Rootblock", b_root_ptr); } - ulong[] root_ptrs = { b_root_ptr + partition.Start, ((partition.End - partition.Start) + 1) / 2 + partition.Start - 2, - ((partition.End - partition.Start) + 1) / 2 + partition.Start - 1, ((partition.End - partition.Start) + 1) / 2 + partition.Start, - ((partition.End - partition.Start) + 1) / 2 + partition.Start + 4}; + ulong[] root_ptrs = + { + b_root_ptr + partition.Start, ((partition.End - partition.Start) + 1) / 2 + partition.Start - 2, + ((partition.End - partition.Start) + 1) / 2 + partition.Start - 1, + ((partition.End - partition.Start) + 1) / 2 + partition.Start, + ((partition.End - partition.Start) + 1) / 2 + partition.Start + 4 + }; RootBlock rblk = new RootBlock(); // So to handle even number of sectors foreach(ulong root_ptr in root_ptrs) { - if(root_ptr >= partition.End || root_ptr < partition.Start) - continue; + if(root_ptr >= partition.End || root_ptr < partition.Start) continue; DicConsole.DebugWriteLine("AmigaDOS plugin", "Searching for Rootblock in sector {0}", root_ptr); @@ -279,8 +271,7 @@ namespace DiscImageChef.Filesystems rblk.type = BigEndianBitConverter.ToUInt32(sector, 0x00); DicConsole.DebugWriteLine("AmigaDOS plugin", "rblk.type = {0}", rblk.type); - if(rblk.type != TypeHeader) - continue; + if(rblk.type != TypeHeader) continue; rblk.hashTableSize = BigEndianBitConverter.ToUInt32(sector, 0x0C); @@ -292,11 +283,9 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("AmigaDOS plugin", "blockSize = {0}", blockSize); DicConsole.DebugWriteLine("AmigaDOS plugin", "sectorsPerBlock = {0}", sectorsPerBlock); - if(blockSize % sector.Length > 0) - sectorsPerBlock++; + if(blockSize % sector.Length > 0) sectorsPerBlock++; - if(root_ptr + sectorsPerBlock >= partition.End) - continue; + if(root_ptr + sectorsPerBlock >= partition.End) continue; sector = imagePlugin.ReadSectors(root_ptr, sectorsPerBlock); @@ -311,14 +300,14 @@ namespace DiscImageChef.Filesystems rblk.sec_type = BigEndianBitConverter.ToUInt32(sector, sector.Length - 4); DicConsole.DebugWriteLine("AmigaDOS plugin", "rblk.sec_type = {0}", rblk.sec_type); - if(rblk.sec_type == SubTypeRoot && rblk.checksum == rsum) - return true; + if(rblk.sec_type == SubTypeRoot && rblk.checksum == rsum) return true; } return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { StringBuilder sbInformation = new StringBuilder(); xmlFSType = new Schemas.FileSystemType(); @@ -342,9 +331,13 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("AmigaDOS plugin", "Bootblock points to {0} as Rootblock", b_root_ptr); } - ulong[] root_ptrs = { b_root_ptr + partition.Start, ((partition.End - partition.Start) + 1) / 2 + partition.Start - 2, - ((partition.End - partition.Start) + 1) / 2 + partition.Start - 1, ((partition.End - partition.Start) + 1) / 2 + partition.Start, - ((partition.End - partition.Start) + 1) / 2 + partition.Start + 4}; + ulong[] root_ptrs = + { + b_root_ptr + partition.Start, ((partition.End - partition.Start) + 1) / 2 + partition.Start - 2, + ((partition.End - partition.Start) + 1) / 2 + partition.Start - 1, + ((partition.End - partition.Start) + 1) / 2 + partition.Start, + ((partition.End - partition.Start) + 1) / 2 + partition.Start + 4 + }; RootBlock rootBlk = new RootBlock(); byte[] RootBlockSector = null; @@ -355,8 +348,7 @@ namespace DiscImageChef.Filesystems // So to handle even number of sectors foreach(ulong root_ptr in root_ptrs) { - if(root_ptr >= partition.End || root_ptr < partition.Start) - continue; + if(root_ptr >= partition.End || root_ptr < partition.Start) continue; DicConsole.DebugWriteLine("AmigaDOS plugin", "Searching for Rootblock in sector {0}", root_ptr); @@ -364,8 +356,7 @@ namespace DiscImageChef.Filesystems rootBlk.type = BigEndianBitConverter.ToUInt32(RootBlockSector, 0x00); DicConsole.DebugWriteLine("AmigaDOS plugin", "rootBlk.type = {0}", rootBlk.type); - if(rootBlk.type != TypeHeader) - continue; + if(rootBlk.type != TypeHeader) continue; rootBlk.hashTableSize = BigEndianBitConverter.ToUInt32(RootBlockSector, 0x0C); @@ -377,11 +368,9 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("AmigaDOS plugin", "blockSize = {0}", blockSize); DicConsole.DebugWriteLine("AmigaDOS plugin", "sectorsPerBlock = {0}", sectorsPerBlock); - if(blockSize % RootBlockSector.Length > 0) - sectorsPerBlock++; + if(blockSize % RootBlockSector.Length > 0) sectorsPerBlock++; - if(root_ptr + sectorsPerBlock >= partition.End) - continue; + if(root_ptr + sectorsPerBlock >= partition.End) continue; RootBlockSector = imagePlugin.ReadSectors(root_ptr, sectorsPerBlock); @@ -404,8 +393,7 @@ namespace DiscImageChef.Filesystems } } - if(!root_found) - return; + if(!root_found) return; rootBlk = MarshalRootBlock(RootBlockSector); @@ -447,8 +435,7 @@ namespace DiscImageChef.Filesystems break; } - if((bootBlk.diskType & 0x6D754600) == 0x6D754600) - sbInformation.Append(", with multi-user patches"); + if((bootBlk.diskType & 0x6D754600) == 0x6D754600) sbInformation.Append(", with multi-user patches"); sbInformation.AppendLine(); @@ -463,8 +450,7 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("Boot code SHA1 is {0}", sha1Ctx.End()).AppendLine(); } - if(rootBlk.bitmapFlag == 0xFFFFFFFF) - sbInformation.AppendLine("Volume bitmap is valid"); + if(rootBlk.bitmapFlag == 0xFFFFFFFF) sbInformation.AppendLine("Volume bitmap is valid"); if(rootBlk.bitmapExtensionBlock != 0x00000000 && rootBlk.bitmapExtensionBlock != 0xFFFFFFFF) sbInformation.AppendFormat("Bitmap extension at block {0}", rootBlk.bitmapExtensionBlock).AppendLine(); @@ -472,13 +458,20 @@ namespace DiscImageChef.Filesystems if((bootBlk.diskType & 0xFF) == 4 || (bootBlk.diskType & 0xFF) == 5) sbInformation.AppendFormat("Directory cache starts at block {0}", rootBlk.extension).AppendLine(); - long blocks = (long)((((partition.End - partition.Start) + 1) * imagePlugin.ImageInfo.sectorSize) / blockSize); + long blocks = (long)((((partition.End - partition.Start) + 1) * imagePlugin.ImageInfo.sectorSize) / + blockSize); sbInformation.AppendFormat("Volume block size is {0} bytes", blockSize).AppendLine(); sbInformation.AppendFormat("Volume has {0} blocks", blocks).AppendLine(); - sbInformation.AppendFormat("Volume created on {0}", DateHandlers.AmigaToDateTime(rootBlk.cDays, rootBlk.cMins, rootBlk.cTicks)).AppendLine(); - sbInformation.AppendFormat("Volume last modified on {0}", DateHandlers.AmigaToDateTime(rootBlk.vDays, rootBlk.vMins, rootBlk.vTicks)).AppendLine(); - sbInformation.AppendFormat("Volume root directory last modified on on {0}", DateHandlers.AmigaToDateTime(rootBlk.rDays, rootBlk.rMins, rootBlk.rTicks)).AppendLine(); + sbInformation.AppendFormat("Volume created on {0}", + DateHandlers.AmigaToDateTime(rootBlk.cDays, rootBlk.cMins, rootBlk.cTicks)) + .AppendLine(); + sbInformation.AppendFormat("Volume last modified on {0}", + DateHandlers.AmigaToDateTime(rootBlk.vDays, rootBlk.vMins, rootBlk.vTicks)) + .AppendLine(); + sbInformation.AppendFormat("Volume root directory last modified on on {0}", + DateHandlers.AmigaToDateTime(rootBlk.rDays, rootBlk.rMins, rootBlk.rTicks)) + .AppendLine(); sbInformation.AppendFormat("Root block checksum is 0x{0:X8}", rootBlk.checksum).AppendLine(); information = sbInformation.ToString(); @@ -505,7 +498,7 @@ namespace DiscImageChef.Filesystems BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; for(int i = 0; i < root.hashTable.Length; i++) root.hashTable[i] = BigEndianBitConverter.ToUInt32(block, 24 + i * 4); - + return root; } @@ -524,10 +517,11 @@ namespace DiscImageChef.Filesystems uint sum, psum; sum = 0; - for(int i = 0; i < data.Length; i+=4) { + for(int i = 0; i < data.Length; i += 4) + { psum = sum; - if((sum += (uint)((data[i] << 24) + (data[i + 1] << 16) + (data[i + 2] << 8) + data[i + 3])) < psum) - sum++; + if((sum += (uint)((data[i] << 24) + (data[i + 1] << 16) + (data[i + 2] << 8) + data[i + 3])) < + psum) sum++; } return ~sum; diff --git a/DiscImageChef.Filesystems/AppleDOS/AppleDOS.cs b/DiscImageChef.Filesystems/AppleDOS/AppleDOS.cs index 0cfcc78c..84346650 100644 --- a/DiscImageChef.Filesystems/AppleDOS/AppleDOS.cs +++ b/DiscImageChef.Filesystems/AppleDOS/AppleDOS.cs @@ -98,4 +98,4 @@ namespace DiscImageChef.Filesystems.AppleDOS CurrentEncoding = new Claunia.Encoding.LisaRoman(); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleDOS/Dir.cs b/DiscImageChef.Filesystems/AppleDOS/Dir.cs index 594558a4..fcc52806 100644 --- a/DiscImageChef.Filesystems/AppleDOS/Dir.cs +++ b/DiscImageChef.Filesystems/AppleDOS/Dir.cs @@ -46,8 +46,7 @@ namespace DiscImageChef.Filesystems.AppleDOS /// <param name="dest">Link destination.</param> public override Errno ReadLink(string path, ref string dest) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; return Errno.NotSupported; } @@ -59,15 +58,13 @@ namespace DiscImageChef.Filesystems.AppleDOS /// <param name="contents">Directory contents.</param> public override Errno ReadDir(string path, ref List<string> contents) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) return Errno.NotSupported; contents = new List<string>(); - foreach(string ent in catalogCache.Keys) - contents.Add(ent); + foreach(string ent in catalogCache.Keys) contents.Add(ent); if(debug) { @@ -90,16 +87,14 @@ namespace DiscImageChef.Filesystems.AppleDOS fileSizeCache = new Dictionary<string, int>(); lockedFiles = new List<string>(); - if(lba == 0 || lba > device.ImageInfo.sectors) - return Errno.InvalidArgument; + if(lba == 0 || lba > device.ImageInfo.sectors) return Errno.InvalidArgument; while(lba != 0) { usedSectors++; byte[] catSector_b = device.ReadSector(lba); totalFileEntries += 7; - if(debug) - catalogMs.Write(catSector_b, 0, catSector_b.Length); + if(debug) catalogMs.Write(catSector_b, 0, catSector_b.Length); // Read the catalog sector CatalogSector catSector = new CatalogSector(); @@ -119,13 +114,11 @@ namespace DiscImageChef.Filesystems.AppleDOS ushort ts = (ushort)((entry.extentTrack << 8) | entry.extentSector); // Apple DOS has high byte set over ASCII. - for(int i = 0; i < 30; i++) - filename_b[i] = (byte)(entry.filename[i] & 0x7F); + for(int i = 0; i < 30; i++) filename_b[i] = (byte)(entry.filename[i] & 0x7F); string filename = StringHandlers.SpacePaddedToString(filename_b, CurrentEncoding); - if(!catalogCache.ContainsKey(filename)) - catalogCache.Add(filename, ts); + if(!catalogCache.ContainsKey(filename)) catalogCache.Add(filename, ts); if(!fileTypeCache.ContainsKey(filename)) fileTypeCache.Add(filename, (byte)(entry.typeAndFlags & 0x7F)); @@ -140,14 +133,12 @@ namespace DiscImageChef.Filesystems.AppleDOS lba = (ulong)((catSector.trackOfNext * sectorsPerTrack) + catSector.sectorOfNext); - if(lba > device.ImageInfo.sectors) - break; + if(lba > device.ImageInfo.sectors) break; } - if(debug) - catalogBlocks = catalogMs.ToArray(); + if(debug) catalogBlocks = catalogMs.ToArray(); return Errno.NoError; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleDOS/File.cs b/DiscImageChef.Filesystems/AppleDOS/File.cs index 5464de26..8d0d578b 100644 --- a/DiscImageChef.Filesystems/AppleDOS/File.cs +++ b/DiscImageChef.Filesystems/AppleDOS/File.cs @@ -41,28 +41,23 @@ namespace DiscImageChef.Filesystems.AppleDOS { public override Errno GetAttributes(string path, ref FileAttributes attributes) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; string filename = pathElements[0].ToUpperInvariant(); - if(!fileCache.ContainsKey(filename)) - return Errno.NoSuchFile; + if(!fileCache.ContainsKey(filename)) return Errno.NoSuchFile; attributes = new FileAttributes(); attributes = FileAttributes.Extents; attributes |= FileAttributes.File; - if(lockedFiles.Contains(filename)) - attributes |= FileAttributes.ReadOnly; + if(lockedFiles.Contains(filename)) attributes |= FileAttributes.ReadOnly; - if(debug && - (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 - || string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 - || string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) + if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) { attributes |= FileAttributes.System; } @@ -72,49 +67,38 @@ namespace DiscImageChef.Filesystems.AppleDOS public override Errno Read(string path, long offset, long size, ref byte[] buf) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; byte[] file; Errno error; string filename = pathElements[0].ToUpperInvariant(); - if(filename.Length > 30) - return Errno.NameTooLong; + if(filename.Length > 30) return Errno.NameTooLong; - if(debug && - (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 - || string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 - || string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) + if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) { - if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0) - file = catalogBlocks; - if(string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0) - file = vtocBlocks; - else - file = bootBlocks; + if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0) file = catalogBlocks; + if(string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0) file = vtocBlocks; + else file = bootBlocks; } else { if(!fileCache.TryGetValue(filename, out file)) { error = CacheFile(filename); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; - if(!fileCache.TryGetValue(filename, out file)) - return Errno.InvalidArgument; + if(!fileCache.TryGetValue(filename, out file)) return Errno.InvalidArgument; } } - if(offset >= file.Length) - return Errno.InvalidArgument; + if(offset >= file.Length) return Errno.InvalidArgument; - if(size + offset >= file.Length) - size = file.Length - offset; + if(size + offset >= file.Length) size = file.Length - offset; buf = new byte[size]; @@ -125,19 +109,15 @@ namespace DiscImageChef.Filesystems.AppleDOS public override Errno Stat(string path, ref FileEntryInfo stat) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; string filename = pathElements[0].ToUpperInvariant(); - if(filename.Length > 30) - return Errno.NameTooLong; + if(filename.Length > 30) return Errno.NameTooLong; - if(!fileCache.ContainsKey(filename)) - return Errno.NoSuchFile; + if(!fileCache.ContainsKey(filename)) return Errno.NoSuchFile; int filesize; FileAttributes attrs = new FileAttributes(); @@ -147,10 +127,9 @@ namespace DiscImageChef.Filesystems.AppleDOS stat = new FileEntryInfo(); - if(debug && - (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 - || string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 - || string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) + if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) { if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0) stat.Length = catalogBlocks.Length; @@ -176,8 +155,7 @@ namespace DiscImageChef.Filesystems.AppleDOS public override Errno MapBlock(string path, long fileBlock, ref long deviceBlock) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; // TODO: Not really important. return Errno.NotImplemented; @@ -185,18 +163,15 @@ namespace DiscImageChef.Filesystems.AppleDOS Errno CacheFile(string path) { - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; string filename = pathElements[0].ToUpperInvariant(); - if(filename.Length > 30) - return Errno.NameTooLong; + if(filename.Length > 30) return Errno.NameTooLong; ushort ts; - if(!catalogCache.TryGetValue(filename, out ts)) - return Errno.NoSuchFile; + if(!catalogCache.TryGetValue(filename, out ts)) return Errno.NoSuchFile; ulong lba = (ulong)((((ts & 0xFF00) >> 8) * sectorsPerTrack) + (ts & 0xFF)); MemoryStream fileMs = new MemoryStream(); @@ -207,8 +182,7 @@ namespace DiscImageChef.Filesystems.AppleDOS { usedSectors++; byte[] tsSector_b = device.ReadSector(lba); - if(debug) - tsListMs.Write(tsSector_b, 0, tsSector_b.Length); + if(debug) tsListMs.Write(tsSector_b, 0, tsSector_b.Length); // Read the track/sector list sector TrackSectorList tsSector = new TrackSectorList(); @@ -231,8 +205,7 @@ namespace DiscImageChef.Filesystems.AppleDOS usedSectors++; ulong blockLba = (ulong)((entry.track * sectorsPerTrack) + entry.sector); - if(blockLba == 0) - break; + if(blockLba == 0) break; byte[] fileBlock = device.ReadSector(blockLba); fileMs.Write(fileBlock, 0, fileBlock.Length); @@ -242,10 +215,8 @@ namespace DiscImageChef.Filesystems.AppleDOS lba = (ulong)((tsSector.nextListTrack * sectorsPerTrack) + tsSector.nextListSector); } - if(fileCache.ContainsKey(filename)) - fileCache.Remove(filename); - if(extentCache.ContainsKey(filename)) - extentCache.Remove(filename); + if(fileCache.ContainsKey(filename)) fileCache.Remove(filename); + if(extentCache.ContainsKey(filename)) extentCache.Remove(filename); fileCache.Add(filename, fileMs.ToArray()); extentCache.Add(filename, tsListMs.ToArray()); @@ -262,15 +233,12 @@ namespace DiscImageChef.Filesystems.AppleDOS foreach(string file in catalogCache.Keys) { error = CacheFile(file); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; } uint tracksOnBoot = 1; - if(!track1UsedByFiles) - tracksOnBoot++; - if(!track2UsedByFiles) - tracksOnBoot++; + if(!track1UsedByFiles) tracksOnBoot++; + if(!track2UsedByFiles) tracksOnBoot++; bootBlocks = device.ReadSectors(0, (uint)(tracksOnBoot * sectorsPerTrack)); usedSectors += bootBlocks.Length / vtoc.bytesPerSector; @@ -278,4 +246,4 @@ namespace DiscImageChef.Filesystems.AppleDOS return Errno.NoError; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleDOS/Info.cs b/DiscImageChef.Filesystems/AppleDOS/Info.cs index 2ba1bb32..f24f75ec 100644 --- a/DiscImageChef.Filesystems/AppleDOS/Info.cs +++ b/DiscImageChef.Filesystems/AppleDOS/Info.cs @@ -42,17 +42,13 @@ namespace DiscImageChef.Filesystems.AppleDOS { public override bool Identify(ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.ImageInfo.sectors != 455 && imagePlugin.ImageInfo.sectors != 560) - return false; + if(imagePlugin.ImageInfo.sectors != 455 && imagePlugin.ImageInfo.sectors != 560) return false; - if(partition.Start > 0 || imagePlugin.ImageInfo.sectorSize != 256) - return false; + if(partition.Start > 0 || imagePlugin.ImageInfo.sectorSize != 256) return false; int spt = 0; - if(imagePlugin.ImageInfo.sectors == 455) - spt = 13; - else - spt = 16; + if(imagePlugin.ImageInfo.sectors == 455) spt = 13; + else spt = 16; byte[] vtoc_b = imagePlugin.ReadSector((ulong)(17 * spt)); vtoc = new VTOC(); @@ -61,7 +57,8 @@ namespace DiscImageChef.Filesystems.AppleDOS vtoc = (VTOC)Marshal.PtrToStructure(vtocPtr, typeof(VTOC)); Marshal.FreeHGlobal(vtocPtr); - return vtoc.catalogSector < spt && vtoc.maxTrackSectorPairsPerSector <= 122 && vtoc.sectorsPerTrack == spt && vtoc.bytesPerSector == 256; + return vtoc.catalogSector < spt && vtoc.maxTrackSectorPairsPerSector <= 122 && + vtoc.sectorsPerTrack == spt && vtoc.bytesPerSector == 256; } public override void GetInformation(ImagePlugin imagePlugin, Partition partition, out string information) @@ -70,10 +67,8 @@ namespace DiscImageChef.Filesystems.AppleDOS StringBuilder sb = new StringBuilder(); int spt = 0; - if(imagePlugin.ImageInfo.sectors == 455) - spt = 13; - else - spt = 16; + if(imagePlugin.ImageInfo.sectors == 455) spt = 13; + else spt = 16; byte[] vtoc_b = imagePlugin.ReadSector((ulong)(17 * spt)); vtoc = new VTOC(); @@ -84,14 +79,16 @@ namespace DiscImageChef.Filesystems.AppleDOS sb.AppendLine("Apple DOS File System"); sb.AppendLine(); - sb.AppendFormat("Catalog starts at sector {0} of track {1}", vtoc.catalogSector, vtoc.catalogTrack).AppendLine(); + sb.AppendFormat("Catalog starts at sector {0} of track {1}", vtoc.catalogSector, vtoc.catalogTrack) + .AppendLine(); sb.AppendFormat("File system initialized by DOS release {0}", vtoc.dosRelease).AppendLine(); sb.AppendFormat("Disk volume number {0}", vtoc.volumeNumber).AppendLine(); sb.AppendFormat("Sectors allocated at most in track {0}", vtoc.lastAllocatedSector).AppendLine(); sb.AppendFormat("{0} tracks in volume", vtoc.tracks).AppendLine(); sb.AppendFormat("{0} sectors per track", vtoc.sectorsPerTrack).AppendLine(); sb.AppendFormat("{0} bytes per sector", vtoc.bytesPerSector).AppendLine(); - sb.AppendFormat("Track allocation is {0}", vtoc.allocationDirection > 0 ? "forward" : "reverse").AppendLine(); + sb.AppendFormat("Track allocation is {0}", vtoc.allocationDirection > 0 ? "forward" : "reverse") + .AppendLine(); information = sb.ToString(); @@ -104,4 +101,4 @@ namespace DiscImageChef.Filesystems.AppleDOS return; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleDOS/Structs.cs b/DiscImageChef.Filesystems/AppleDOS/Structs.cs index ae8c7793..8efb998d 100644 --- a/DiscImageChef.Filesystems/AppleDOS/Structs.cs +++ b/DiscImageChef.Filesystems/AppleDOS/Structs.cs @@ -43,23 +43,18 @@ namespace DiscImageChef.Filesystems.AppleDOS public byte catalogTrack; public byte catalogSector; public byte dosRelease; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] unused2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] unused2; public byte volumeNumber; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] unused3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] unused3; public byte maxTrackSectorPairsPerSector; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] unused4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] unused4; public byte lastAllocatedSector; public sbyte allocationDirection; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] unused5; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] unused5; public byte tracks; public byte sectorsPerTrack; public ushort bytesPerSector; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 200)] - public byte[] bitmap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 200)] public byte[] bitmap; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -68,10 +63,8 @@ namespace DiscImageChef.Filesystems.AppleDOS public byte unused1; public byte trackOfNext; public byte sectorOfNext; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] unused2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] - public FileEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] unused2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public FileEntry[] entries; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -80,8 +73,7 @@ namespace DiscImageChef.Filesystems.AppleDOS public byte extentTrack; public byte extentSector; public byte typeAndFlags; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 30)] - public byte[] filename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 30)] public byte[] filename; public ushort length; } @@ -91,13 +83,10 @@ namespace DiscImageChef.Filesystems.AppleDOS public byte unused1; public byte nextListTrack; public byte nextListSector; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] unused2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] unused2; public ushort sectorOffset; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] unused3; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 122)] - public TrackSectorListEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] unused3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 122)] public TrackSectorListEntry[] entries; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -107,4 +96,4 @@ namespace DiscImageChef.Filesystems.AppleDOS public byte sector; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleDOS/Super.cs b/DiscImageChef.Filesystems/AppleDOS/Super.cs index 19852dbc..27b66eb8 100644 --- a/DiscImageChef.Filesystems/AppleDOS/Super.cs +++ b/DiscImageChef.Filesystems/AppleDOS/Super.cs @@ -69,10 +69,8 @@ namespace DiscImageChef.Filesystems.AppleDOS return Errno.InOutError; } - if(device.ImageInfo.sectors == 455) - sectorsPerTrack = 13; - else - sectorsPerTrack = 16; + if(device.ImageInfo.sectors == 455) sectorsPerTrack = 13; + else sectorsPerTrack = 16; // Read the VTOC byte[] vtoc_b = device.ReadSector((ulong)(17 * sectorsPerTrack)); @@ -150,4 +148,4 @@ namespace DiscImageChef.Filesystems.AppleDOS return Errno.NoError; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleDOS/Xattr.cs b/DiscImageChef.Filesystems/AppleDOS/Xattr.cs index deb721ed..522db20c 100644 --- a/DiscImageChef.Filesystems/AppleDOS/Xattr.cs +++ b/DiscImageChef.Filesystems/AppleDOS/Xattr.cs @@ -45,34 +45,26 @@ namespace DiscImageChef.Filesystems.AppleDOS /// <param name="xattrs">List of extended attributes, alternate data streams and forks.</param> public override Errno ListXAttr(string path, ref List<string> xattrs) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; string filename = pathElements[0].ToUpperInvariant(); - if(filename.Length > 30) - return Errno.NameTooLong; + if(filename.Length > 30) return Errno.NameTooLong; xattrs = new List<string>(); - if(debug && - (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 - || string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 - || string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) - { - } + if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) { } else { - if(!catalogCache.ContainsKey(filename)) - return Errno.NoSuchFile; + if(!catalogCache.ContainsKey(filename)) return Errno.NoSuchFile; xattrs.Add("com.apple.dos.type"); - if(debug) - xattrs.Add("com.apple.dos.tracksectorlist"); + if(debug) xattrs.Add("com.apple.dos.tracksectorlist"); } return Errno.NoError; @@ -87,33 +79,28 @@ namespace DiscImageChef.Filesystems.AppleDOS /// <param name="buf">Buffer.</param> public override Errno GetXattr(string path, string xattr, ref byte[] buf) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; string filename = pathElements[0].ToUpperInvariant(); - if(filename.Length > 30) - return Errno.NameTooLong; + if(filename.Length > 30) return Errno.NameTooLong; - if(debug && - (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 - || string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 - || string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) + if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) { return Errno.NoSuchExtendedAttribute; } - if(!catalogCache.ContainsKey(filename)) - return Errno.NoSuchFile; + if(!catalogCache.ContainsKey(filename)) return Errno.NoSuchFile; if(string.Compare(xattr, "com.apple.dos.type", StringComparison.InvariantCulture) == 0) { byte type; - if(!fileTypeCache.TryGetValue(filename, out type)) - return Errno.InvalidArgument; + if(!fileTypeCache.TryGetValue(filename, out type)) return Errno.InvalidArgument; + buf = new byte[1]; buf[0] = type; return Errno.NoError; @@ -122,8 +109,8 @@ namespace DiscImageChef.Filesystems.AppleDOS if(string.Compare(xattr, "com.apple.dos.tracksectorlist", StringComparison.InvariantCulture) == 0 && debug) { byte[] ts; - if(!extentCache.TryGetValue(filename, out ts)) - return Errno.InvalidArgument; + if(!extentCache.TryGetValue(filename, out ts)) return Errno.InvalidArgument; + buf = new byte[ts.Length]; Array.Copy(ts, 0, buf, 0, buf.Length); return Errno.NoError; @@ -132,4 +119,4 @@ namespace DiscImageChef.Filesystems.AppleDOS return Errno.NoSuchExtendedAttribute; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleHFS.cs b/DiscImageChef.Filesystems/AppleHFS.cs index 668788ce..3f0797fc 100644 --- a/DiscImageChef.Filesystems/AppleHFS.cs +++ b/DiscImageChef.Filesystems/AppleHFS.cs @@ -66,40 +66,38 @@ namespace DiscImageChef.Filesystems { Name = "Apple Hierarchical File System"; PluginUUID = new Guid("36405F8D-0D26-6ECC-0BBB-1D5225FF404F"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("macintosh"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("macintosh"); + else CurrentEncoding = encoding; } public AppleHFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Apple Hierarchical File System"; PluginUUID = new Guid("36405F8D-0D26-6ECC-0BBB-1D5225FF404F"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("macintosh"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("macintosh"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((2 + partition.Start) >= partition.End) - return false; + if((2 + partition.Start) >= partition.End) return false; byte[] mdb_sector; ushort drSigWord; - if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || imagePlugin.GetSectorSize() == 2048) + if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || + imagePlugin.GetSectorSize() == 2048) { mdb_sector = imagePlugin.ReadSectors(partition.Start, 2); - foreach(int offset in new[] { 0, 0x200, 0x400, 0x600, 0x800, 0xA00 }) + foreach(int offset in new[] {0, 0x200, 0x400, 0x600, 0x800, 0xA00}) { drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, offset); if(drSigWord == HFS_MAGIC) { - drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, offset + 0x7C); // Seek to embedded HFS+ signature + drSigWord = + BigEndianBitConverter + .ToUInt16(mdb_sector, offset + 0x7C); // Seek to embedded HFS+ signature return drSigWord != HFSP_MAGIC; } @@ -117,10 +115,12 @@ namespace DiscImageChef.Filesystems return drSigWord != HFSP_MAGIC; } } + return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -135,37 +135,34 @@ namespace DiscImageChef.Filesystems bool APMFromHDDOnCD = false; - if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || imagePlugin.GetSectorSize() == 2048) + if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || + imagePlugin.GetSectorSize() == 2048) { byte[] tmp_sector = imagePlugin.ReadSectors(partition.Start, 2); - foreach(int offset in new[] { 0, 0x200, 0x400, 0x600, 0x800, 0xA00 }) + foreach(int offset in new[] {0, 0x200, 0x400, 0x600, 0x800, 0xA00}) { drSigWord = BigEndianBitConverter.ToUInt16(tmp_sector, offset); if(drSigWord == HFS_MAGIC) { bb_sector = new byte[1024]; mdb_sector = new byte[512]; - if(offset >= 0x400) - Array.Copy(tmp_sector, offset - 0x400, bb_sector, 0, 1024); + if(offset >= 0x400) Array.Copy(tmp_sector, offset - 0x400, bb_sector, 0, 1024); Array.Copy(tmp_sector, offset, mdb_sector, 0, 512); APMFromHDDOnCD = true; break; } } - if(!APMFromHDDOnCD) - return; + if(!APMFromHDDOnCD) return; } else { mdb_sector = imagePlugin.ReadSector(2 + partition.Start); drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0); - if(drSigWord == HFS_MAGIC) - bb_sector = imagePlugin.ReadSector(partition.Start); - else - return; + if(drSigWord == HFS_MAGIC) bb_sector = imagePlugin.ReadSector(partition.Start); + else return; } MDB = BigEndianMarshal.ByteArrayToStructureBigEndian<HFS_MasterDirectoryBlock>(mdb_sector); @@ -183,29 +180,18 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(MDB.drVolBkUp)).AppendLine(); sb.AppendFormat("Backup sequence number: {0}", MDB.drVSeqNum).AppendLine(); } - else - sb.AppendLine("Volume has never been backed up"); + else sb.AppendLine("Volume has never been backed up"); - if((MDB.drAtrb & 0x80) == 0x80) - sb.AppendLine("Volume is locked by hardware."); - if((MDB.drAtrb & 0x100) == 0x100) - sb.AppendLine("Volume was unmonted."); - else - sb.AppendLine("Volume is mounted."); - if((MDB.drAtrb & 0x200) == 0x200) - sb.AppendLine("Volume has spared bad blocks."); - if((MDB.drAtrb & 0x400) == 0x400) - sb.AppendLine("Volume does not need cache."); - if((MDB.drAtrb & 0x800) == 0x800) - sb.AppendLine("Boot volume is inconsistent."); - if((MDB.drAtrb & 0x1000) == 0x1000) - sb.AppendLine("There are reused CNIDs."); - if((MDB.drAtrb & 0x2000) == 0x2000) - sb.AppendLine("Volume is journaled."); - if((MDB.drAtrb & 0x4000) == 0x4000) - sb.AppendLine("Volume is seriously inconsistent."); - if((MDB.drAtrb & 0x8000) == 0x8000) - sb.AppendLine("Volume is locked by software."); + if((MDB.drAtrb & 0x80) == 0x80) sb.AppendLine("Volume is locked by hardware."); + if((MDB.drAtrb & 0x100) == 0x100) sb.AppendLine("Volume was unmonted."); + else sb.AppendLine("Volume is mounted."); + if((MDB.drAtrb & 0x200) == 0x200) sb.AppendLine("Volume has spared bad blocks."); + if((MDB.drAtrb & 0x400) == 0x400) sb.AppendLine("Volume does not need cache."); + if((MDB.drAtrb & 0x800) == 0x800) sb.AppendLine("Boot volume is inconsistent."); + if((MDB.drAtrb & 0x1000) == 0x1000) sb.AppendLine("There are reused CNIDs."); + if((MDB.drAtrb & 0x2000) == 0x2000) sb.AppendLine("Volume is journaled."); + if((MDB.drAtrb & 0x4000) == 0x4000) sb.AppendLine("Volume is seriously inconsistent."); + if((MDB.drAtrb & 0x8000) == 0x8000) sb.AppendLine("Volume is locked by software."); sb.AppendFormat("{0} files on root directory", MDB.drNmFls).AppendLine(); sb.AppendFormat("{0} directories on root directory", MDB.drNmRtDirs).AppendLine(); @@ -256,26 +242,27 @@ namespace DiscImageChef.Filesystems sb.AppendLine("Volume is bootable."); sb.AppendLine(); sb.AppendLine("Boot Block:"); - if((BB.boot_flags & 0x40) == 0x40) - sb.AppendLine("Boot block should be executed."); - if((BB.boot_flags & 0x80) == 0x80) - { - sb.AppendLine("Boot block is in new unknown format."); - } + if((BB.boot_flags & 0x40) == 0x40) sb.AppendLine("Boot block should be executed."); + if((BB.boot_flags & 0x80) == 0x80) { sb.AppendLine("Boot block is in new unknown format."); } else { - if(BB.boot_flags > 0) - sb.AppendLine("Allocate secondary sound buffer at boot."); - else if(BB.boot_flags < 0) - sb.AppendLine("Allocate secondary sound and video buffers at boot."); + if(BB.boot_flags > 0) sb.AppendLine("Allocate secondary sound buffer at boot."); + else if(BB.boot_flags < 0) sb.AppendLine("Allocate secondary sound and video buffers at boot."); - sb.AppendFormat("System filename: {0}", StringHandlers.PascalToString(BB.system_name, CurrentEncoding)).AppendLine(); - sb.AppendFormat("Finder filename: {0}", StringHandlers.PascalToString(BB.finder_name, CurrentEncoding)).AppendLine(); - sb.AppendFormat("Debugger filename: {0}", StringHandlers.PascalToString(BB.debug_name, CurrentEncoding)).AppendLine(); - sb.AppendFormat("Disassembler filename: {0}", StringHandlers.PascalToString(BB.disasm_name, CurrentEncoding)).AppendLine(); - sb.AppendFormat("Startup screen filename: {0}", StringHandlers.PascalToString(BB.stupscr_name, CurrentEncoding)).AppendLine(); - sb.AppendFormat("First program to execute at boot: {0}", StringHandlers.PascalToString(BB.bootup_name, CurrentEncoding)).AppendLine(); - sb.AppendFormat("Clipboard filename: {0}", StringHandlers.PascalToString(BB.clipbrd_name, CurrentEncoding)).AppendLine(); + sb.AppendFormat("System filename: {0}", + StringHandlers.PascalToString(BB.system_name, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Finder filename: {0}", + StringHandlers.PascalToString(BB.finder_name, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Debugger filename: {0}", + StringHandlers.PascalToString(BB.debug_name, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Disassembler filename: {0}", + StringHandlers.PascalToString(BB.disasm_name, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Startup screen filename: {0}", + StringHandlers.PascalToString(BB.stupscr_name, CurrentEncoding)).AppendLine(); + sb.AppendFormat("First program to execute at boot: {0}", + StringHandlers.PascalToString(BB.bootup_name, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Clipboard filename: {0}", + StringHandlers.PascalToString(BB.clipbrd_name, CurrentEncoding)).AppendLine(); sb.AppendFormat("Maximum opened files: {0}", BB.max_files * 4).AppendLine(); sb.AppendFormat("Event queue size: {0}", BB.queue_size).AppendLine(); sb.AppendFormat("Heap size with 128KiB of RAM: {0} bytes", BB.heap_128k).AppendLine(); @@ -283,10 +270,9 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Heap size with 512KiB of RAM or more: {0} bytes", BB.heap_512k).AppendLine(); } } - else if (MDB.drFndrInfo0 != 0 || MDB.drFndrInfo3 != 0 || MDB.drFndrInfo5 != 0) + else if(MDB.drFndrInfo0 != 0 || MDB.drFndrInfo3 != 0 || MDB.drFndrInfo5 != 0) sb.AppendLine("Volume is bootable."); - else - sb.AppendLine("Volume is not bootable."); + else sb.AppendLine("Volume is not bootable."); information = sb.ToString(); @@ -296,7 +282,8 @@ namespace DiscImageChef.Filesystems xmlFSType.BackupDate = DateHandlers.MacToDateTime(MDB.drVolBkUp); xmlFSType.BackupDateSpecified = true; } - xmlFSType.Bootable = BB.signature == HFSBB_MAGIC || (MDB.drFndrInfo0 != 0 || MDB.drFndrInfo3 != 0 || MDB.drFndrInfo5 != 0); + xmlFSType.Bootable = BB.signature == HFSBB_MAGIC || + (MDB.drFndrInfo0 != 0 || MDB.drFndrInfo3 != 0 || MDB.drFndrInfo5 != 0); xmlFSType.Clusters = MDB.drNmAlBlks; xmlFSType.ClusterSize = (int)MDB.drAlBlkSiz; if(MDB.drCrDate > 0) @@ -368,8 +355,7 @@ namespace DiscImageChef.Filesystems /// <summary>0x022, Free allocation blocks</summary> public ushort drFreeBks; /// <summary>0x024, Volume name (28 bytes)</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] - public byte[] drVN; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] public byte[] drVN; /// <summary>0x040, Volume last backup time</summary> public uint drVolBkUp; /// <summary>0x044, Volume backup sequence number</summary> @@ -440,26 +426,19 @@ namespace DiscImageChef.Filesystems /// <summary>0x006, Boot block flags</summary> public short boot_flags; /// <summary>0x00A, System file name (16 bytes)</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] system_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] system_name; /// <summary>0x01A, Finder file name (16 bytes)</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] finder_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] finder_name; /// <summary>0x02A, Debugger file name (16 bytes)</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] debug_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] debug_name; /// <summary>0x03A, Disassembler file name (16 bytes)</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] disasm_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] disasm_name; /// <summary>0x04A, Startup screen file name (16 bytes)</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] stupscr_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] stupscr_name; /// <summary>0x05A, First program to execute on boot (16 bytes)</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] bootup_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] bootup_name; /// <summary>0x06A, Clipboard file name (16 bytes)</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] clipbrd_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] clipbrd_name; /// <summary>0x07A, 1/4 of maximum opened at a time files</summary> public ushort max_files; /// <summary>0x07C, Event queue size</summary> @@ -538,4 +517,4 @@ namespace DiscImageChef.Filesystems return Errno.NotImplemented; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleHFSPlus.cs b/DiscImageChef.Filesystems/AppleHFSPlus.cs index 7595ed9e..58512ed2 100644 --- a/DiscImageChef.Filesystems/AppleHFSPlus.cs +++ b/DiscImageChef.Filesystems/AppleHFSPlus.cs @@ -77,8 +77,7 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((2 + partition.Start) >= partition.End) - return false; + if((2 + partition.Start) >= partition.End) return false; ushort drSigWord; ushort xdrStABNt; @@ -89,10 +88,10 @@ namespace DiscImageChef.Filesystems ulong hfsp_offset; uint sectorsToRead = 0x800 / imagePlugin.ImageInfo.sectorSize; - if(0x800 % imagePlugin.ImageInfo.sectorSize > 0) - sectorsToRead++; + if(0x800 % imagePlugin.ImageInfo.sectorSize > 0) sectorsToRead++; - vh_sector = imagePlugin.ReadSectors(partition.Start, sectorsToRead); // Read volume header, of HFS Wrapper MDB + vh_sector = imagePlugin.ReadSectors(partition.Start, + sectorsToRead); // Read volume header, of HFS Wrapper MDB drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0x400); // Check for HFS Wrapper MDB @@ -102,33 +101,30 @@ namespace DiscImageChef.Filesystems if(drSigWord == HFSP_MAGIC) // "H+" { - xdrStABNt = BigEndianBitConverter.ToUInt16(vh_sector, 0x47E); // Starting block number of embedded HFS+ volume + xdrStABNt = BigEndianBitConverter + .ToUInt16(vh_sector, 0x47E); // Starting block number of embedded HFS+ volume drAlBlkSiz = BigEndianBitConverter.ToUInt32(vh_sector, 0x414); // Block size - drAlBlSt = BigEndianBitConverter.ToUInt16(vh_sector, 0x41C); // Start of allocated blocks (in 512-byte/block) + drAlBlSt = BigEndianBitConverter + .ToUInt16(vh_sector, 0x41C); // Start of allocated blocks (in 512-byte/block) hfsp_offset = (ulong)(((drAlBlSt * 512) + (xdrStABNt * drAlBlkSiz)) / imagePlugin.GetSectorSize()); } - else - { - hfsp_offset = 0; - } - } - else - { - hfsp_offset = 0; + else { hfsp_offset = 0; } } + else { hfsp_offset = 0; } vh_sector = imagePlugin.ReadSectors(partition.Start + hfsp_offset, sectorsToRead); // Read volume header drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0x400); - if(drSigWord == HFSP_MAGIC || drSigWord == HFSX_MAGIC) - return true; + if(drSigWord == HFSP_MAGIC || drSigWord == HFSX_MAGIC) return true; + return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -143,10 +139,10 @@ namespace DiscImageChef.Filesystems byte[] vh_sector; uint sectorsToRead = 0x800 / imagePlugin.ImageInfo.sectorSize; - if(0x800 % imagePlugin.ImageInfo.sectorSize > 0) - sectorsToRead++; + if(0x800 % imagePlugin.ImageInfo.sectorSize > 0) sectorsToRead++; - vh_sector = imagePlugin.ReadSectors(partition.Start, sectorsToRead); // Read volume header, of HFS Wrapper MDB + vh_sector = imagePlugin.ReadSectors(partition.Start, + sectorsToRead); // Read volume header, of HFS Wrapper MDB drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0x400); // Check for HFS Wrapper MDB @@ -156,11 +152,13 @@ namespace DiscImageChef.Filesystems if(drSigWord == HFSP_MAGIC) // "H+" { - xdrStABNt = BigEndianBitConverter.ToUInt16(vh_sector, 0x47E); // Starting block number of embedded HFS+ volume + xdrStABNt = BigEndianBitConverter + .ToUInt16(vh_sector, 0x47E); // Starting block number of embedded HFS+ volume drAlBlkSiz = BigEndianBitConverter.ToUInt32(vh_sector, 0x414); // Block size - drAlBlSt = BigEndianBitConverter.ToUInt16(vh_sector, 0x41C); // Start of allocated blocks (in 512-byte/block) + drAlBlSt = BigEndianBitConverter + .ToUInt16(vh_sector, 0x41C); // Start of allocated blocks (in 512-byte/block) hfsp_offset = (ulong)(((drAlBlSt * 512) + (xdrStABNt * drAlBlkSiz)) / imagePlugin.GetSectorSize()); wrapped = true; @@ -184,12 +182,9 @@ namespace DiscImageChef.Filesystems { StringBuilder sb = new StringBuilder(); - if(HPVH.signature == 0x482B) - sb.AppendLine("HFS+ filesystem."); - if(HPVH.signature == 0x4858) - sb.AppendLine("HFSX filesystem."); - if(wrapped) - sb.AppendLine("Volume is wrapped inside an HFS volume."); + if(HPVH.signature == 0x482B) sb.AppendLine("HFS+ filesystem."); + if(HPVH.signature == 0x4858) sb.AppendLine("HFSX filesystem."); + if(wrapped) sb.AppendLine("Volume is wrapped inside an HFS volume."); byte[] tmp = new byte[0x400]; Array.Copy(vh_sector, 0x400, tmp, 0, 0x400); @@ -199,39 +194,32 @@ namespace DiscImageChef.Filesystems if(HPVH.version == 4 || HPVH.version == 5) { - sb.AppendFormat("Filesystem version is {0}.", HPVH.version).AppendLine(); - if((HPVH.attributes & 0x80) == 0x80) - sb.AppendLine("Volume is locked on hardware."); - if((HPVH.attributes & 0x100) == 0x100) - sb.AppendLine("Volume is unmounted."); - if((HPVH.attributes & 0x200) == 0x200) - sb.AppendLine("There are bad blocks in the extents file."); - if((HPVH.attributes & 0x400) == 0x400) - sb.AppendLine("Volume does not require cache."); - if((HPVH.attributes & 0x800) == 0x800) - sb.AppendLine("Volume state is inconsistent."); - if((HPVH.attributes & 0x1000) == 0x1000) - sb.AppendLine("CNIDs are reused."); - if((HPVH.attributes & 0x2000) == 0x2000) - sb.AppendLine("Volume is journaled."); - if((HPVH.attributes & 0x8000) == 0x8000) - sb.AppendLine("Volume is locked on software."); + if((HPVH.attributes & 0x80) == 0x80) sb.AppendLine("Volume is locked on hardware."); + if((HPVH.attributes & 0x100) == 0x100) sb.AppendLine("Volume is unmounted."); + if((HPVH.attributes & 0x200) == 0x200) sb.AppendLine("There are bad blocks in the extents file."); + if((HPVH.attributes & 0x400) == 0x400) sb.AppendLine("Volume does not require cache."); + if((HPVH.attributes & 0x800) == 0x800) sb.AppendLine("Volume state is inconsistent."); + if((HPVH.attributes & 0x1000) == 0x1000) sb.AppendLine("CNIDs are reused."); + if((HPVH.attributes & 0x2000) == 0x2000) sb.AppendLine("Volume is journaled."); + if((HPVH.attributes & 0x8000) == 0x8000) sb.AppendLine("Volume is locked on software."); - sb.AppendFormat("Implementation that last mounted the volume: \"{0}\".", Encoding.ASCII.GetString(HPVH.lastMountedVersion)).AppendLine(); + sb.AppendFormat("Implementation that last mounted the volume: \"{0}\".", + Encoding.ASCII.GetString(HPVH.lastMountedVersion)).AppendLine(); if((HPVH.attributes & 0x2000) == 0x2000) sb.AppendFormat("Journal starts at allocation block {0}.", HPVH.journalInfoBlock).AppendLine(); sb.AppendFormat("Creation date: {0}", DateHandlers.MacToDateTime(HPVH.createDate)).AppendLine(); - sb.AppendFormat("Last modification date: {0}", DateHandlers.MacToDateTime(HPVH.modifyDate)).AppendLine(); + sb.AppendFormat("Last modification date: {0}", DateHandlers.MacToDateTime(HPVH.modifyDate)) + .AppendLine(); if(HPVH.backupDate > 0) - sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(HPVH.backupDate)).AppendLine(); - else - sb.AppendLine("Volume has never been backed up"); + sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(HPVH.backupDate)) + .AppendLine(); + else sb.AppendLine("Volume has never been backed up"); if(HPVH.backupDate > 0) - sb.AppendFormat("Last check date: {0}", DateHandlers.MacToDateTime(HPVH.checkedDate)).AppendLine(); - else - sb.AppendLine("Volume has never been checked up"); + sb.AppendFormat("Last check date: {0}", DateHandlers.MacToDateTime(HPVH.checkedDate)) + .AppendLine(); + else sb.AppendLine("Volume has never been checked up"); sb.AppendFormat("{0} files on volume.", HPVH.fileCount).AppendLine(); sb.AppendFormat("{0} folders on volume.", HPVH.folderCount).AppendLine(); sb.AppendFormat("{0} bytes per allocation block.", HPVH.blockSize).AppendLine(); @@ -254,7 +242,8 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("CNID of bootable Mac OS 8 or 9 directory: {0}", HPVH.drFndrInfo3).AppendLine(); sb.AppendFormat("CNID of bootable Mac OS X directory: {0}", HPVH.drFndrInfo5).AppendLine(); if(HPVH.drFndrInfo6 != 0 && HPVH.drFndrInfo7 != 0) - sb.AppendFormat("Mac OS X Volume ID: {0:X8}{1:X8}", HPVH.drFndrInfo6, HPVH.drFndrInfo7).AppendLine(); + sb.AppendFormat("Mac OS X Volume ID: {0:X8}{1:X8}", HPVH.drFndrInfo6, HPVH.drFndrInfo7) + .AppendLine(); xmlFSType = new Schemas.FileSystemType(); if(HPVH.backupDate > 0) @@ -280,10 +269,8 @@ namespace DiscImageChef.Filesystems xmlFSType.ModificationDate = DateHandlers.MacToDateTime(HPVH.modifyDate); xmlFSType.ModificationDateSpecified = true; } - if(HPVH.signature == 0x482B) - xmlFSType.Type = "HFS+"; - if(HPVH.signature == 0x4858) - xmlFSType.Type = "HFSX"; + if(HPVH.signature == 0x482B) xmlFSType.Type = "HFS+"; + if(HPVH.signature == 0x4858) xmlFSType.Type = "HFSX"; if(HPVH.drFndrInfo6 != 0 && HPVH.drFndrInfo7 != 0) xmlFSType.VolumeSerial = string.Format("{0:X8}{1:X8}", HPVH.drFndrInfo6, HPVH.drFndrInfo7); xmlFSType.SystemIdentifier = Encoding.ASCII.GetString(HPVH.lastMountedVersion); @@ -296,8 +283,7 @@ namespace DiscImageChef.Filesystems information = sb.ToString(); } - else - return; + else return; } /// <summary> @@ -318,8 +304,7 @@ namespace DiscImageChef.Filesystems /// "10.0" Mac OS X /// "HFSJ" Journaled implementation /// "fsck" /sbin/fsck</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] lastMountedVersion; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] lastMountedVersion; /// <summary>0x00C, Allocation block number containing the journal</summary> public uint journalInfoBlock; /// <summary>0x010, Date of volume creation</summary> @@ -625,4 +610,4 @@ namespace DiscImageChef.Filesystems return Errno.NotImplemented; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleMFS/AppleMFS.cs b/DiscImageChef.Filesystems/AppleMFS/AppleMFS.cs index 58d42a84..a7c7de4a 100644 --- a/DiscImageChef.Filesystems/AppleMFS/AppleMFS.cs +++ b/DiscImageChef.Filesystems/AppleMFS/AppleMFS.cs @@ -73,10 +73,8 @@ namespace DiscImageChef.Filesystems.AppleMFS { Name = "Apple Macintosh File System"; PluginUUID = new Guid("36405F8D-0D26-4066-6538-5DBF5D065C3A"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("macintosh"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("macintosh"); + else CurrentEncoding = encoding; } public AppleMFS(ImagePlugin imagePlugin, Partition partition, Encoding encoding) @@ -85,10 +83,8 @@ namespace DiscImageChef.Filesystems.AppleMFS PluginUUID = new Guid("36405F8D-0D26-4066-6538-5DBF5D065C3A"); device = imagePlugin; partitionStart = partition.Start; - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("macintosh"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("macintosh"); + else CurrentEncoding = encoding; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleMFS/Consts.cs b/DiscImageChef.Filesystems/AppleMFS/Consts.cs index 9a40b29b..dd72bf98 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Consts.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Consts.cs @@ -48,5 +48,4 @@ namespace DiscImageChef.Filesystems.AppleMFS const int BMAP_LAST = 1; const int BMAP_DIR = 0xFFF; } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleMFS/Dir.cs b/DiscImageChef.Filesystems/AppleMFS/Dir.cs index ed1bb0c3..7f1aa4d6 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Dir.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Dir.cs @@ -41,23 +41,20 @@ namespace DiscImageChef.Filesystems.AppleMFS { public override Errno ReadDir(string path, ref List<string> contents) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) return Errno.NotSupported; contents = new List<string>(); - foreach(KeyValuePair<uint, string> kvp in idToFilename) - contents.Add(kvp.Value); + foreach(KeyValuePair<uint, string> kvp in idToFilename) contents.Add(kvp.Value); if(debug) { contents.Add("$"); contents.Add("$Bitmap"); contents.Add("$MDB"); - if(bootBlocks != null) - contents.Add("$Boot"); + if(bootBlocks != null) contents.Add("$Boot"); } contents.Sort(); @@ -78,8 +75,8 @@ namespace DiscImageChef.Filesystems.AppleMFS entry.flUsrWds = new byte[16]; entry.flFlags = (MFS_FileFlags)directoryBlocks[offset + 0]; - if(!entry.flFlags.HasFlag(MFS_FileFlags.Used)) - break; + if(!entry.flFlags.HasFlag(MFS_FileFlags.Used)) break; + entry.flTyp = directoryBlocks[offset + 1]; Array.Copy(directoryBlocks, offset + 2, entry.flUsrWds, 0, 16); entry.flFlNum = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 18); @@ -93,14 +90,16 @@ namespace DiscImageChef.Filesystems.AppleMFS entry.flMdDat = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 46); entry.flNam = new byte[directoryBlocks[offset + 50] + 1]; Array.Copy(directoryBlocks, offset + 50, entry.flNam, 0, entry.flNam.Length); - lowerFilename = StringHandlers.PascalToString(entry.flNam, CurrentEncoding).ToLowerInvariant().Replace('/', ':'); + lowerFilename = StringHandlers.PascalToString(entry.flNam, CurrentEncoding).ToLowerInvariant() + .Replace('/', ':'); if(entry.flFlags.HasFlag(MFS_FileFlags.Used) && !idToFilename.ContainsKey(entry.flFlNum) && !idToEntry.ContainsKey(entry.flFlNum) && !filenameToId.ContainsKey(lowerFilename) && entry.flFlNum > 0) { idToEntry.Add(entry.flFlNum, entry); - idToFilename.Add(entry.flFlNum, StringHandlers.PascalToString(entry.flNam, CurrentEncoding).Replace('/', ':')); + idToFilename.Add(entry.flFlNum, + StringHandlers.PascalToString(entry.flNam, CurrentEncoding).Replace('/', ':')); filenameToId.Add(lowerFilename, entry.flFlNum); DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flFlags = {0}", entry.flFlags); @@ -112,16 +111,18 @@ namespace DiscImageChef.Filesystems.AppleMFS DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flRStBlk = {0}", entry.flRStBlk); DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flRLgLen = {0}", entry.flRLgLen); DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flRPyLen = {0}", entry.flRPyLen); - DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flCrDat = {0}", DateHandlers.MacToDateTime(entry.flCrDat)); - DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flMdDat = {0}", DateHandlers.MacToDateTime(entry.flMdDat)); - DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flNam0 = {0}", StringHandlers.PascalToString(entry.flNam, CurrentEncoding)); + DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flCrDat = {0}", + DateHandlers.MacToDateTime(entry.flCrDat)); + DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flMdDat = {0}", + DateHandlers.MacToDateTime(entry.flMdDat)); + DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flNam0 = {0}", + StringHandlers.PascalToString(entry.flNam, CurrentEncoding)); } offset += (50 + entry.flNam.Length); // "Entries are always an integral number of words" - if((offset % 2) != 0) - offset++; + if((offset % 2) != 0) offset++; // TODO: "Entries don't cross logical block boundaries" } @@ -129,5 +130,4 @@ namespace DiscImageChef.Filesystems.AppleMFS return true; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleMFS/File.cs b/DiscImageChef.Filesystems/AppleMFS/File.cs index b508a45f..f958059c 100644 --- a/DiscImageChef.Filesystems/AppleMFS/File.cs +++ b/DiscImageChef.Filesystems/AppleMFS/File.cs @@ -43,24 +43,19 @@ namespace DiscImageChef.Filesystems.AppleMFS { deviceBlock = new long(); - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; uint fileID; MFS_FileEntry entry; - if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out fileID)) - return Errno.NoSuchFile; + if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out fileID)) return Errno.NoSuchFile; - if(!idToEntry.TryGetValue(fileID, out entry)) - return Errno.NoSuchFile; + if(!idToEntry.TryGetValue(fileID, out entry)) return Errno.NoSuchFile; - if(fileBlock > (entry.flPyLen / volMDB.drAlBlkSiz)) - return Errno.InvalidArgument; + if(fileBlock > (entry.flPyLen / volMDB.drAlBlkSiz)) return Errno.InvalidArgument; uint nextBlock = entry.flStBlk; long relBlock = 0; @@ -73,8 +68,7 @@ namespace DiscImageChef.Filesystems.AppleMFS return Errno.NoError; } - if(blockMap[nextBlock] == BMAP_FREE || blockMap[nextBlock] == BMAP_LAST) - break; + if(blockMap[nextBlock] == BMAP_FREE || blockMap[nextBlock] == BMAP_LAST) break; nextBlock = blockMap[nextBlock]; relBlock++; @@ -85,77 +79,56 @@ namespace DiscImageChef.Filesystems.AppleMFS public override Errno GetAttributes(string path, ref FileAttributes attributes) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; uint fileID; MFS_FileEntry entry; - if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out fileID)) - return Errno.NoSuchFile; + if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out fileID)) return Errno.NoSuchFile; - if(!idToEntry.TryGetValue(fileID, out entry)) - return Errno.NoSuchFile; + if(!idToEntry.TryGetValue(fileID, out entry)) return Errno.NoSuchFile; attributes = new FileAttributes(); MFS_FinderFlags fdFlags = (MFS_FinderFlags)BigEndianBitConverter.ToUInt16(entry.flUsrWds, 0x08); - if(fdFlags.HasFlag(MFS_FinderFlags.kIsAlias)) - attributes |= FileAttributes.Alias; - if(fdFlags.HasFlag(MFS_FinderFlags.kHasBundle)) - attributes |= FileAttributes.Bundle; - if(fdFlags.HasFlag(MFS_FinderFlags.kHasBeenInited)) - attributes |= FileAttributes.HasBeenInited; - if(fdFlags.HasFlag(MFS_FinderFlags.kHasCustomIcon)) - attributes |= FileAttributes.HasCustomIcon; - if(fdFlags.HasFlag(MFS_FinderFlags.kHasNoINITs)) - attributes |= FileAttributes.HasNoINITs; - if(fdFlags.HasFlag(MFS_FinderFlags.kIsInvisible)) - attributes |= FileAttributes.Hidden; - if(entry.flFlags.HasFlag(MFS_FileFlags.Locked)) - attributes |= FileAttributes.Immutable; - if(fdFlags.HasFlag(MFS_FinderFlags.kIsOnDesk)) - attributes |= FileAttributes.IsOnDesk; - if(fdFlags.HasFlag(MFS_FinderFlags.kIsShared)) - attributes |= FileAttributes.Shared; - if(fdFlags.HasFlag(MFS_FinderFlags.kIsStationery)) - attributes |= FileAttributes.Stationery; + if(fdFlags.HasFlag(MFS_FinderFlags.kIsAlias)) attributes |= FileAttributes.Alias; + if(fdFlags.HasFlag(MFS_FinderFlags.kHasBundle)) attributes |= FileAttributes.Bundle; + if(fdFlags.HasFlag(MFS_FinderFlags.kHasBeenInited)) attributes |= FileAttributes.HasBeenInited; + if(fdFlags.HasFlag(MFS_FinderFlags.kHasCustomIcon)) attributes |= FileAttributes.HasCustomIcon; + if(fdFlags.HasFlag(MFS_FinderFlags.kHasNoINITs)) attributes |= FileAttributes.HasNoINITs; + if(fdFlags.HasFlag(MFS_FinderFlags.kIsInvisible)) attributes |= FileAttributes.Hidden; + if(entry.flFlags.HasFlag(MFS_FileFlags.Locked)) attributes |= FileAttributes.Immutable; + if(fdFlags.HasFlag(MFS_FinderFlags.kIsOnDesk)) attributes |= FileAttributes.IsOnDesk; + if(fdFlags.HasFlag(MFS_FinderFlags.kIsShared)) attributes |= FileAttributes.Shared; + if(fdFlags.HasFlag(MFS_FinderFlags.kIsStationery)) attributes |= FileAttributes.Stationery; - if(!attributes.HasFlag(FileAttributes.Alias) && - !attributes.HasFlag(FileAttributes.Bundle) && - !attributes.HasFlag(FileAttributes.Stationery)) - attributes |= FileAttributes.File; + if(!attributes.HasFlag(FileAttributes.Alias) && !attributes.HasFlag(FileAttributes.Bundle) && + !attributes.HasFlag(FileAttributes.Stationery)) attributes |= FileAttributes.File; attributes |= FileAttributes.BlockUnits; - + return Errno.NoError; } public override Errno Read(string path, long offset, long size, ref byte[] buf) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; byte[] file; Errno error = Errno.NoError; - if(debug && string.Compare(path, "$", StringComparison.InvariantCulture) == 0) - file = directoryBlocks; - else if(debug && string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 && bootBlocks != null) - file = bootBlocks; + if(debug && string.Compare(path, "$", StringComparison.InvariantCulture) == 0) file = directoryBlocks; + else if(debug && string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 && bootBlocks != null + ) file = bootBlocks; else if(debug && string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0) file = blockMapBytes; - else if(debug && string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0) - file = mdbBlocks; - else - error = ReadFile(path, out file, false, false); - - if(error != Errno.NoError) - return error; + else if(debug && string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0) file = mdbBlocks; + else error = ReadFile(path, out file, false, false); + + if(error != Errno.NoError) return error; if(size == 0) { @@ -163,11 +136,9 @@ namespace DiscImageChef.Filesystems.AppleMFS return Errno.NoError; } - if(offset >= file.Length) - return Errno.InvalidArgument; + if(offset >= file.Length) return Errno.InvalidArgument; - if(size + offset >= file.Length) - size = file.Length - offset; + if(size + offset >= file.Length) size = file.Length - offset; buf = new byte[size]; @@ -178,12 +149,10 @@ namespace DiscImageChef.Filesystems.AppleMFS public override Errno Stat(string path, ref FileEntryInfo stat) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; if(debug) { @@ -205,7 +174,8 @@ namespace DiscImageChef.Filesystems.AppleMFS if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0) { - stat.Blocks = (directoryBlocks.Length / stat.BlockSize) + (directoryBlocks.Length % stat.BlockSize); + stat.Blocks = (directoryBlocks.Length / stat.BlockSize) + + (directoryBlocks.Length % stat.BlockSize); stat.Length = directoryBlocks.Length; } else if(string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0) @@ -223,8 +193,7 @@ namespace DiscImageChef.Filesystems.AppleMFS stat.Blocks = (mdbBlocks.Length / stat.BlockSize) + (mdbBlocks.Length % stat.BlockSize); stat.Length = mdbBlocks.Length; } - else - return Errno.InvalidArgument; + else return Errno.InvalidArgument; return Errno.NoError; } @@ -233,16 +202,13 @@ namespace DiscImageChef.Filesystems.AppleMFS uint fileID; MFS_FileEntry entry; - if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out fileID)) - return Errno.NoSuchFile; + if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out fileID)) return Errno.NoSuchFile; - if(!idToEntry.TryGetValue(fileID, out entry)) - return Errno.NoSuchFile; + if(!idToEntry.TryGetValue(fileID, out entry)) return Errno.NoSuchFile; FileAttributes attr = new FileAttributes(); Errno error = GetAttributes(path, ref attr); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; stat = new FileEntryInfo(); stat.Attributes = attr; @@ -270,21 +236,17 @@ namespace DiscImageChef.Filesystems.AppleMFS { buf = null; - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; uint fileID; MFS_FileEntry entry; - if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out fileID)) - return Errno.NoSuchFile; + if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out fileID)) return Errno.NoSuchFile; - if(!idToEntry.TryGetValue(fileID, out entry)) - return Errno.NoSuchFile; + if(!idToEntry.TryGetValue(fileID, out entry)) return Errno.NoSuchFile; uint nextBlock; @@ -295,6 +257,7 @@ namespace DiscImageChef.Filesystems.AppleMFS buf = new byte[0]; return Errno.NoError; } + nextBlock = entry.flRStBlk; } else @@ -314,9 +277,13 @@ namespace DiscImageChef.Filesystems.AppleMFS do { if(tags) - sectors = device.ReadSectorsTag((ulong)((nextBlock - 2) * sectorsPerBlock) + volMDB.drAlBlSt + partitionStart, (uint)sectorsPerBlock, ImagePlugins.SectorTagType.AppleSectorTag); + sectors = + device.ReadSectorsTag((ulong)((nextBlock - 2) * sectorsPerBlock) + volMDB.drAlBlSt + partitionStart, + (uint)sectorsPerBlock, ImagePlugins.SectorTagType.AppleSectorTag); else - sectors = device.ReadSectors((ulong)((nextBlock - 2) * sectorsPerBlock) + volMDB.drAlBlSt + partitionStart, (uint)sectorsPerBlock); + sectors = + device.ReadSectors((ulong)((nextBlock - 2) * sectorsPerBlock) + volMDB.drAlBlSt + partitionStart, + (uint)sectorsPerBlock); ms.Write(sectors, 0, sectors.Length); @@ -330,14 +297,12 @@ namespace DiscImageChef.Filesystems.AppleMFS } while(nextBlock > BMAP_LAST); - if(tags) - buf = ms.ToArray(); + if(tags) buf = ms.ToArray(); else { if(resourceFork) { - if(ms.Length < entry.flRLgLen) - buf = ms.ToArray(); + if(ms.Length < entry.flRLgLen) buf = ms.ToArray(); else { buf = new byte[entry.flRLgLen]; @@ -346,8 +311,7 @@ namespace DiscImageChef.Filesystems.AppleMFS } else { - if(ms.Length < entry.flLgLen) - buf = ms.ToArray(); + if(ms.Length < entry.flLgLen) buf = ms.ToArray(); else { buf = new byte[entry.flLgLen]; @@ -359,5 +323,4 @@ namespace DiscImageChef.Filesystems.AppleMFS return Errno.NoError; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleMFS/Info.cs b/DiscImageChef.Filesystems/AppleMFS/Info.cs index 8a457e41..2664371f 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Info.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Info.cs @@ -43,8 +43,7 @@ namespace DiscImageChef.Filesystems.AppleMFS { ushort drSigWord; - if((2 + partition.Start) >= partition.End) - return false; + if((2 + partition.Start) >= partition.End) return false; byte[] mdb_sector = imagePlugin.ReadSector(2 + partition.Start); @@ -55,7 +54,8 @@ namespace DiscImageChef.Filesystems.AppleMFS return drSigWord == MFS_MAGIC; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -73,8 +73,7 @@ namespace DiscImageChef.Filesystems.AppleMFS BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; MDB.drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0x000); - if(MDB.drSigWord != MFS_MAGIC) - return; + if(MDB.drSigWord != MFS_MAGIC) return; MDB.drCrDate = BigEndianBitConverter.ToUInt32(mdb_sector, 0x002); MDB.drLsBkUp = BigEndianBitConverter.ToUInt32(mdb_sector, 0x006); @@ -89,8 +88,8 @@ namespace DiscImageChef.Filesystems.AppleMFS MDB.drNxtFNum = BigEndianBitConverter.ToUInt32(mdb_sector, 0x01E); MDB.drFreeBks = BigEndianBitConverter.ToUInt16(mdb_sector, 0x022); MDB.drVNSiz = mdb_sector[0x024]; - variable_size = new byte[MDB.drVNSiz+1]; - Array.Copy(mdb_sector, 0x024, variable_size, 0, MDB.drVNSiz+1); + variable_size = new byte[MDB.drVNSiz + 1]; + Array.Copy(mdb_sector, 0x024, variable_size, 0, MDB.drVNSiz + 1); MDB.drVN = StringHandlers.PascalToString(variable_size, CurrentEncoding); BB.signature = BigEndianBitConverter.ToUInt16(bb_sector, 0x000); @@ -124,18 +123,15 @@ namespace DiscImageChef.Filesystems.AppleMFS BB.heap_256k = BigEndianBitConverter.ToUInt32(bb_sector, 0x082); BB.heap_512k = BigEndianBitConverter.ToUInt32(bb_sector, 0x086); } - else - BB.signature = 0x0000; + else BB.signature = 0x0000; sb.AppendLine("Apple Macintosh File System"); sb.AppendLine(); sb.AppendLine("Master Directory Block:"); sb.AppendFormat("Creation date: {0}", DateHandlers.MacToDateTime(MDB.drCrDate)).AppendLine(); sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(MDB.drLsBkUp)).AppendLine(); - if((MDB.drAtrb & 0x80) == 0x80) - sb.AppendLine("Volume is locked by hardware."); - if((MDB.drAtrb & 0x8000) == 0x8000) - sb.AppendLine("Volume is locked by software."); + if((MDB.drAtrb & 0x80) == 0x80) sb.AppendLine("Volume is locked by hardware."); + if((MDB.drAtrb & 0x8000) == 0x8000) sb.AppendLine("Volume is locked by software."); sb.AppendFormat("{0} files on volume", MDB.drNmFls).AppendLine(); sb.AppendFormat("First directory sector: {0}", MDB.drDirSt).AppendLine(); sb.AppendFormat("{0} sectors in directory.", MDB.drBlLen).AppendLine(); @@ -152,18 +148,12 @@ namespace DiscImageChef.Filesystems.AppleMFS sb.AppendLine("Volume is bootable."); sb.AppendLine(); sb.AppendLine("Boot Block:"); - if((BB.boot_flags & 0x40) == 0x40) - sb.AppendLine("Boot block should be executed."); - if((BB.boot_flags & 0x80) == 0x80) - { - sb.AppendLine("Boot block is in new unknown format."); - } + if((BB.boot_flags & 0x40) == 0x40) sb.AppendLine("Boot block should be executed."); + if((BB.boot_flags & 0x80) == 0x80) { sb.AppendLine("Boot block is in new unknown format."); } else { - if(BB.sec_sv_pages > 0) - sb.AppendLine("Allocate secondary sound buffer at boot."); - else if(BB.sec_sv_pages < 0) - sb.AppendLine("Allocate secondary sound and video buffers at boot."); + if(BB.sec_sv_pages > 0) sb.AppendLine("Allocate secondary sound buffer at boot."); + else if(BB.sec_sv_pages < 0) sb.AppendLine("Allocate secondary sound and video buffers at boot."); sb.AppendFormat("System filename: {0}", BB.system_name).AppendLine(); sb.AppendFormat("Finder filename: {0}", BB.finder_name).AppendLine(); @@ -179,8 +169,7 @@ namespace DiscImageChef.Filesystems.AppleMFS sb.AppendFormat("Heap size with 512KiB of RAM or more: {0} bytes", BB.heap_512k).AppendLine(); } } - else - sb.AppendLine("Volume is not bootable."); + else sb.AppendLine("Volume is not bootable."); information = sb.ToString(); @@ -208,5 +197,4 @@ namespace DiscImageChef.Filesystems.AppleMFS return; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleMFS/Structs.cs b/DiscImageChef.Filesystems/AppleMFS/Structs.cs index c82d0b4a..6655ffb0 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Structs.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Structs.cs @@ -186,5 +186,4 @@ namespace DiscImageChef.Filesystems.AppleMFS public byte[] flNam; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleMFS/Super.cs b/DiscImageChef.Filesystems/AppleMFS/Super.cs index 24700872..68d17d76 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Super.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Super.cs @@ -50,8 +50,7 @@ namespace DiscImageChef.Filesystems.AppleMFS BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; volMDB.drSigWord = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x000); - if(volMDB.drSigWord != MFS_MAGIC) - return Errno.InvalidArgument; + if(volMDB.drSigWord != MFS_MAGIC) return Errno.InvalidArgument; volMDB.drCrDate = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x002); volMDB.drLsBkUp = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x006); @@ -74,42 +73,34 @@ namespace DiscImageChef.Filesystems.AppleMFS int bytesInBlockMap = ((volMDB.drNmAlBlks * 12) / 8) + ((volMDB.drNmAlBlks * 12) % 8); int bytesBeforeBlockMap = 64; int bytesInWholeMDB = bytesInBlockMap + bytesBeforeBlockMap; - int sectorsInWholeMDB = (bytesInWholeMDB / (int)device.ImageInfo.sectorSize) + (bytesInWholeMDB % (int)device.ImageInfo.sectorSize); + int sectorsInWholeMDB = (bytesInWholeMDB / (int)device.ImageInfo.sectorSize) + + (bytesInWholeMDB % (int)device.ImageInfo.sectorSize); byte[] wholeMDB = device.ReadSectors(partitionStart + 2, (uint)sectorsInWholeMDB); blockMapBytes = new byte[bytesInBlockMap]; Array.Copy(wholeMDB, bytesBeforeBlockMap, blockMapBytes, 0, blockMapBytes.Length); int offset = 0; blockMap = new uint[volMDB.drNmAlBlks + 2 + 1]; - for(int i = 2; i < volMDB.drNmAlBlks + 2; i+=8) + for(int i = 2; i < volMDB.drNmAlBlks + 2; i += 8) { uint tmp1 = 0; uint tmp2 = 0; uint tmp3 = 0; - if(offset + 4 <= blockMapBytes.Length) - tmp1 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset); + if(offset + 4 <= blockMapBytes.Length) tmp1 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset); if(offset + 4 + 4 <= blockMapBytes.Length) tmp2 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset + 4); if(offset + 8 + 4 <= blockMapBytes.Length) tmp3 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset + 8); - if(i < blockMap.Length) - blockMap[i] = (tmp1 & 0xFFF00000) >> 20; - if(i + 2 < blockMap.Length) - blockMap[i + 1] = (tmp1 & 0xFFF00) >> 8; - if(i + 3 < blockMap.Length) - blockMap[i + 2] = ((tmp1 & 0xFF) << 4) + ((tmp2 & 0xF0000000) >> 28); - if(i + 4 < blockMap.Length) - blockMap[i + 3] = (tmp2 & 0xFFF0000) >> 16; - if(i + 5 < blockMap.Length) - blockMap[i + 4] = (tmp2 & 0xFFF0) >> 4; - if(i + 6 < blockMap.Length) - blockMap[i + 5] = ((tmp2 & 0xF) << 8) + ((tmp3 & 0xFF000000) >> 24); - if(i + 7 < blockMap.Length) - blockMap[i + 6] = (tmp3 & 0xFFF000) >> 12; - if(i + 8 < blockMap.Length) - blockMap[i + 7] = (tmp3 & 0xFFF); + if(i < blockMap.Length) blockMap[i] = (tmp1 & 0xFFF00000) >> 20; + if(i + 2 < blockMap.Length) blockMap[i + 1] = (tmp1 & 0xFFF00) >> 8; + if(i + 3 < blockMap.Length) blockMap[i + 2] = ((tmp1 & 0xFF) << 4) + ((tmp2 & 0xF0000000) >> 28); + if(i + 4 < blockMap.Length) blockMap[i + 3] = (tmp2 & 0xFFF0000) >> 16; + if(i + 5 < blockMap.Length) blockMap[i + 4] = (tmp2 & 0xFFF0) >> 4; + if(i + 6 < blockMap.Length) blockMap[i + 5] = ((tmp2 & 0xF) << 8) + ((tmp3 & 0xFF000000) >> 24); + if(i + 7 < blockMap.Length) blockMap[i + 6] = (tmp3 & 0xFFF000) >> 12; + if(i + 8 < blockMap.Length) blockMap[i + 7] = (tmp3 & 0xFFF); offset += 12; } @@ -118,21 +109,21 @@ namespace DiscImageChef.Filesystems.AppleMFS { mdbTags = device.ReadSectorTag(2 + partitionStart, ImagePlugins.SectorTagType.AppleSectorTag); bootTags = device.ReadSectorTag(0 + partitionStart, ImagePlugins.SectorTagType.AppleSectorTag); - directoryTags = device.ReadSectorsTag(volMDB.drDirSt + partitionStart, volMDB.drBlLen, ImagePlugins.SectorTagType.AppleSectorTag); - bitmapTags = device.ReadSectorsTag(partitionStart + 2, (uint)sectorsInWholeMDB, ImagePlugins.SectorTagType.AppleSectorTag); + directoryTags = device.ReadSectorsTag(volMDB.drDirSt + partitionStart, volMDB.drBlLen, + ImagePlugins.SectorTagType.AppleSectorTag); + bitmapTags = device.ReadSectorsTag(partitionStart + 2, (uint)sectorsInWholeMDB, + ImagePlugins.SectorTagType.AppleSectorTag); } sectorsPerBlock = (int)(volMDB.drAlBlkSiz / device.ImageInfo.sectorSize); - if(!FillDirectory()) - return Errno.InvalidArgument; + if(!FillDirectory()) return Errno.InvalidArgument; mounted = true; ushort bbSig = BigEndianBitConverter.ToUInt16(bootBlocks, 0x000); - if(bbSig != MFSBB_MAGIC) - bootBlocks = null; + if(bbSig != MFSBB_MAGIC) bootBlocks = null; xmlFSType = new Schemas.FileSystemType(); if(volMDB.drLsBkUp > 0) @@ -188,5 +179,4 @@ namespace DiscImageChef.Filesystems.AppleMFS return Errno.NoError; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleMFS/Xattr.cs b/DiscImageChef.Filesystems/AppleMFS/Xattr.cs index ff45b96d..edd49536 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Xattr.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Xattr.cs @@ -41,12 +41,10 @@ namespace DiscImageChef.Filesystems.AppleMFS { public override Errno ListXAttr(string path, ref List<string> xattrs) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; xattrs = new List<string>(); @@ -67,11 +65,9 @@ namespace DiscImageChef.Filesystems.AppleMFS uint fileID; MFS_FileEntry entry; - if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out fileID)) - return Errno.NoSuchFile; + if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out fileID)) return Errno.NoSuchFile; - if(!idToEntry.TryGetValue(fileID, out entry)) - return Errno.NoSuchFile; + if(!idToEntry.TryGetValue(fileID, out entry)) return Errno.NoSuchFile; if(entry.flRLgLen > 0) { @@ -80,11 +76,10 @@ namespace DiscImageChef.Filesystems.AppleMFS xattrs.Add("com.apple.ResourceFork.tags"); } - if(!ArrayHelpers.ArrayIsNullOrEmpty(entry.flUsrWds)) - xattrs.Add("com.apple.FinderInfo"); + if(!ArrayHelpers.ArrayIsNullOrEmpty(entry.flUsrWds)) xattrs.Add("com.apple.FinderInfo"); - if(debug && device.ImageInfo.readableSectorTags.Contains(ImagePlugins.SectorTagType.AppleSectorTag) && entry.flLgLen > 0) - xattrs.Add("com.apple.macintosh.tags"); + if(debug && device.ImageInfo.readableSectorTags.Contains(ImagePlugins.SectorTagType.AppleSectorTag) && + entry.flLgLen > 0) xattrs.Add("com.apple.macintosh.tags"); xattrs.Sort(); @@ -93,12 +88,10 @@ namespace DiscImageChef.Filesystems.AppleMFS public override Errno GetXattr(string path, string xattr, ref byte[] buf) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; if(debug) { @@ -138,8 +131,7 @@ namespace DiscImageChef.Filesystems.AppleMFS return Errno.NoError; } } - else - return Errno.NoSuchExtendedAttribute; + else return Errno.NoSuchExtendedAttribute; } } @@ -147,25 +139,26 @@ namespace DiscImageChef.Filesystems.AppleMFS MFS_FileEntry entry; Errno error; - if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out fileID)) - return Errno.NoSuchFile; + if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out fileID)) return Errno.NoSuchFile; - if(!idToEntry.TryGetValue(fileID, out entry)) - return Errno.NoSuchFile; + if(!idToEntry.TryGetValue(fileID, out entry)) return Errno.NoSuchFile; - if(entry.flRLgLen > 0 && string.Compare(xattr, "com.apple.ResourceFork", StringComparison.InvariantCulture) == 0) + if(entry.flRLgLen > 0 && + string.Compare(xattr, "com.apple.ResourceFork", StringComparison.InvariantCulture) == 0) { error = ReadFile(path, out buf, true, false); return error; } - if(entry.flRLgLen > 0 && string.Compare(xattr, "com.apple.ResourceFork.tags", StringComparison.InvariantCulture) == 0) + if(entry.flRLgLen > 0 && + string.Compare(xattr, "com.apple.ResourceFork.tags", StringComparison.InvariantCulture) == 0) { error = ReadFile(path, out buf, true, true); return error; } - if(!ArrayHelpers.ArrayIsNullOrEmpty(entry.flUsrWds) && string.Compare(xattr, "com.apple.FinderInfo", StringComparison.InvariantCulture) == 0) + if(!ArrayHelpers.ArrayIsNullOrEmpty(entry.flUsrWds) && + string.Compare(xattr, "com.apple.FinderInfo", StringComparison.InvariantCulture) == 0) { buf = new byte[16]; Array.Copy(entry.flUsrWds, 0, buf, 0, 16); @@ -182,5 +175,4 @@ namespace DiscImageChef.Filesystems.AppleMFS return Errno.NoSuchExtendedAttribute; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AtheOS.cs b/DiscImageChef.Filesystems/AtheOS.cs index 20e93f4c..7e65cf71 100644 --- a/DiscImageChef.Filesystems/AtheOS.cs +++ b/DiscImageChef.Filesystems/AtheOS.cs @@ -59,20 +59,16 @@ namespace DiscImageChef.Filesystems { Name = "AtheOS Filesystem"; PluginUUID = new Guid("AAB2C4F1-DC07-49EE-A948-576CC51B58C5"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public AtheOS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "AtheOS Filesystem"; PluginUUID = new Guid("AAB2C4F1-DC07-49EE-A948-576CC51B58C5"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) @@ -84,8 +80,7 @@ namespace DiscImageChef.Filesystems if(imagePlugin.GetSectorSize() < AFS_SUPERBLOCK_SIZE) run = AFS_SUPERBLOCK_SIZE / imagePlugin.GetSectorSize(); - if((sector + partition.Start) >= partition.End) - return false; + if((sector + partition.Start) >= partition.End) return false; uint magic; @@ -98,7 +93,8 @@ namespace DiscImageChef.Filesystems return magic == AFS_MAGIC1; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -123,26 +119,37 @@ namespace DiscImageChef.Filesystems sb.AppendLine("Atheos filesystem"); - if(afs_sb.flags == 1) - sb.AppendLine("Filesystem is read-only"); + if(afs_sb.flags == 1) sb.AppendLine("Filesystem is read-only"); sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(afs_sb.name, CurrentEncoding)).AppendLine(); sb.AppendFormat("{0} bytes per block", afs_sb.block_size).AppendLine(); - sb.AppendFormat("{0} blocks in volume ({1} bytes)", afs_sb.num_blocks, afs_sb.num_blocks * afs_sb.block_size).AppendLine(); - sb.AppendFormat("{0} used blocks ({1} bytes)", afs_sb.used_blocks, afs_sb.used_blocks * afs_sb.block_size).AppendLine(); + sb.AppendFormat("{0} blocks in volume ({1} bytes)", afs_sb.num_blocks, + afs_sb.num_blocks * afs_sb.block_size).AppendLine(); + sb.AppendFormat("{0} used blocks ({1} bytes)", afs_sb.used_blocks, afs_sb.used_blocks * afs_sb.block_size) + .AppendLine(); sb.AppendFormat("{0} bytes per i-node", afs_sb.inode_size).AppendLine(); - sb.AppendFormat("{0} blocks per allocation group ({1} bytes)", afs_sb.blocks_per_ag, afs_sb.blocks_per_ag * afs_sb.block_size).AppendLine(); + sb.AppendFormat("{0} blocks per allocation group ({1} bytes)", afs_sb.blocks_per_ag, + afs_sb.blocks_per_ag * afs_sb.block_size).AppendLine(); sb.AppendFormat("{0} allocation groups in volume", afs_sb.num_ags).AppendLine(); - sb.AppendFormat("Journal resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", afs_sb.log_blocks_start, - afs_sb.log_blocks_ag, afs_sb.log_blocks_len, afs_sb.log_blocks_len * afs_sb.block_size).AppendLine(); - sb.AppendFormat("Journal starts in byte {0} and has {1} bytes in {2} blocks", afs_sb.log_start, afs_sb.log_size, afs_sb.log_valid_blocks).AppendLine(); - sb.AppendFormat("Root folder's i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", afs_sb.root_dir_start, - afs_sb.root_dir_ag, afs_sb.root_dir_len, afs_sb.root_dir_len * afs_sb.block_size).AppendLine(); - sb.AppendFormat("Directory containing files scheduled for deletion's i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", afs_sb.deleted_start, - afs_sb.deleted_ag, afs_sb.deleted_len, afs_sb.deleted_len * afs_sb.block_size).AppendLine(); - sb.AppendFormat("Indices' i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", afs_sb.indices_start, - afs_sb.indices_ag, afs_sb.indices_len, afs_sb.indices_len * afs_sb.block_size).AppendLine(); - sb.AppendFormat("{0} blocks for bootloader ({1} bytes)", afs_sb.boot_size, afs_sb.boot_size * afs_sb.block_size).AppendLine(); + sb.AppendFormat("Journal resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", + afs_sb.log_blocks_start, afs_sb.log_blocks_ag, afs_sb.log_blocks_len, + afs_sb.log_blocks_len * afs_sb.block_size).AppendLine(); + sb.AppendFormat("Journal starts in byte {0} and has {1} bytes in {2} blocks", afs_sb.log_start, + afs_sb.log_size, afs_sb.log_valid_blocks).AppendLine(); + sb + .AppendFormat("Root folder's i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", + afs_sb.root_dir_start, afs_sb.root_dir_ag, afs_sb.root_dir_len, + afs_sb.root_dir_len * afs_sb.block_size).AppendLine(); + sb + .AppendFormat("Directory containing files scheduled for deletion's i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", + afs_sb.deleted_start, afs_sb.deleted_ag, afs_sb.deleted_len, + afs_sb.deleted_len * afs_sb.block_size).AppendLine(); + sb + .AppendFormat("Indices' i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", + afs_sb.indices_start, afs_sb.indices_ag, afs_sb.indices_len, + afs_sb.indices_len * afs_sb.block_size).AppendLine(); + sb.AppendFormat("{0} blocks for bootloader ({1} bytes)", afs_sb.boot_size, + afs_sb.boot_size * afs_sb.block_size).AppendLine(); information = sb.ToString(); @@ -165,8 +172,7 @@ namespace DiscImageChef.Filesystems struct AtheosSuperBlock { /// <summary>0x000, Volume name, 32 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] name; /// <summary>0x020, "AFS1", 0x41465331</summary> public uint magic1; /// <summary>0x024, "BIGE", 0x42494745</summary> diff --git a/DiscImageChef.Filesystems/BFS.cs b/DiscImageChef.Filesystems/BFS.cs index 3a6c15a5..ad7f35f8 100644 --- a/DiscImageChef.Filesystems/BFS.cs +++ b/DiscImageChef.Filesystems/BFS.cs @@ -64,26 +64,21 @@ namespace DiscImageChef.Filesystems { Name = "Be Filesystem"; PluginUUID = new Guid("dc8572b3-b6ad-46e4-8de9-cbe123ff6672"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public BeFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Be Filesystem"; PluginUUID = new Guid("dc8572b3-b6ad-46e4-8de9-cbe123ff6672"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((2 + partition.Start) >= partition.End) - return false; + if((2 + partition.Start) >= partition.End) return false; uint magic; uint magic_be; @@ -93,8 +88,7 @@ namespace DiscImageChef.Filesystems magic = BitConverter.ToUInt32(sb_sector, 0x20); magic_be = BigEndianBitConverter.ToUInt32(sb_sector, 0x20); - if(magic == BEFS_MAGIC1 || magic_be == BEFS_MAGIC1) - return true; + if(magic == BEFS_MAGIC1 || magic_be == BEFS_MAGIC1) return true; if(sb_sector.Length >= 0x400) { @@ -102,20 +96,20 @@ namespace DiscImageChef.Filesystems magic_be = BigEndianBitConverter.ToUInt32(sb_sector, 0x220); } - if(magic == BEFS_MAGIC1 || magic_be == BEFS_MAGIC1) - return true; + if(magic == BEFS_MAGIC1 || magic_be == BEFS_MAGIC1) return true; sb_sector = imagePlugin.ReadSector(1 + partition.Start); magic = BitConverter.ToUInt32(sb_sector, 0x20); magic_be = BigEndianBitConverter.ToUInt32(sb_sector, 0x20); - if(magic == BEFS_MAGIC1 || magic_be == BEFS_MAGIC1) - return true; + if(magic == BEFS_MAGIC1 || magic_be == BEFS_MAGIC1) return true; + return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; byte[] name_bytes = new byte[32]; @@ -153,11 +147,9 @@ namespace DiscImageChef.Filesystems sb_sector = new byte[0x200]; Array.Copy(temp, 0x200, sb_sector, 0, 0x200); } - else - return; + else return; } - else - return; + else return; } if(littleEndian) @@ -166,56 +158,59 @@ namespace DiscImageChef.Filesystems besb = (BeSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(BeSuperBlock)); handle.Free(); } - else - besb = BigEndianMarshal.ByteArrayToStructureBigEndian<BeSuperBlock>(sb_sector); + else besb = BigEndianMarshal.ByteArrayToStructureBigEndian<BeSuperBlock>(sb_sector); if(littleEndian) // Big-endian filesystem sb.AppendLine("Little-endian BeFS"); - else - sb.AppendLine("Big-endian BeFS"); + else sb.AppendLine("Big-endian BeFS"); - if(besb.magic1 != BEFS_MAGIC1 || besb.fs_byte_order != BEFS_ENDIAN || - besb.magic2 != BEFS_MAGIC2 || besb.magic3 != BEFS_MAGIC3 || - besb.root_dir_len != 1 || besb.indices_len != 1 || - (1 << (int)besb.block_shift) != besb.block_size) + if(besb.magic1 != BEFS_MAGIC1 || besb.fs_byte_order != BEFS_ENDIAN || besb.magic2 != BEFS_MAGIC2 || + besb.magic3 != BEFS_MAGIC3 || besb.root_dir_len != 1 || besb.indices_len != 1 || + (1 << (int)besb.block_shift) != besb.block_size) { sb.AppendLine("Superblock seems corrupt, following information may be incorrect"); sb.AppendFormat("Magic 1: 0x{0:X8} (Should be 0x42465331)", besb.magic1).AppendLine(); sb.AppendFormat("Magic 2: 0x{0:X8} (Should be 0xDD121031)", besb.magic2).AppendLine(); sb.AppendFormat("Magic 3: 0x{0:X8} (Should be 0x15B6830E)", besb.magic3).AppendLine(); - sb.AppendFormat("Filesystem endianness: 0x{0:X8} (Should be 0x42494745)", besb.fs_byte_order).AppendLine(); + sb.AppendFormat("Filesystem endianness: 0x{0:X8} (Should be 0x42494745)", besb.fs_byte_order) + .AppendLine(); sb.AppendFormat("Root folder's i-node size: {0} blocks (Should be 1)", besb.root_dir_len).AppendLine(); sb.AppendFormat("Indices' i-node size: {0} blocks (Should be 1)", besb.indices_len).AppendLine(); sb.AppendFormat("1 << block_shift == block_size => 1 << {0} == {1} (Should be {2})", besb.block_shift, - 1 << (int)besb.block_shift, besb.block_size).AppendLine(); + 1 << (int)besb.block_shift, besb.block_size).AppendLine(); } if(besb.flags == BEFS_CLEAN) { - if(besb.log_start == besb.log_end) - sb.AppendLine("Filesystem is clean"); - else - sb.AppendLine("Filesystem is dirty"); + if(besb.log_start == besb.log_end) sb.AppendLine("Filesystem is clean"); + else sb.AppendLine("Filesystem is dirty"); } - else if(besb.flags == BEFS_DIRTY) - sb.AppendLine("Filesystem is dirty"); - else - sb.AppendFormat("Unknown flags: {0:X8}", besb.flags).AppendLine(); + else if(besb.flags == BEFS_DIRTY) sb.AppendLine("Filesystem is dirty"); + else sb.AppendFormat("Unknown flags: {0:X8}", besb.flags).AppendLine(); sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(besb.name, CurrentEncoding)).AppendLine(); sb.AppendFormat("{0} bytes per block", besb.block_size).AppendLine(); - sb.AppendFormat("{0} blocks in volume ({1} bytes)", besb.num_blocks, besb.num_blocks * besb.block_size).AppendLine(); - sb.AppendFormat("{0} used blocks ({1} bytes)", besb.used_blocks, besb.used_blocks * besb.block_size).AppendLine(); + sb.AppendFormat("{0} blocks in volume ({1} bytes)", besb.num_blocks, besb.num_blocks * besb.block_size) + .AppendLine(); + sb.AppendFormat("{0} used blocks ({1} bytes)", besb.used_blocks, besb.used_blocks * besb.block_size) + .AppendLine(); sb.AppendFormat("{0} bytes per i-node", besb.inode_size).AppendLine(); - sb.AppendFormat("{0} blocks per allocation group ({1} bytes)", besb.blocks_per_ag, besb.blocks_per_ag * besb.block_size).AppendLine(); + sb.AppendFormat("{0} blocks per allocation group ({1} bytes)", besb.blocks_per_ag, + besb.blocks_per_ag * besb.block_size).AppendLine(); sb.AppendFormat("{0} allocation groups in volume", besb.num_ags).AppendLine(); - sb.AppendFormat("Journal resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", besb.log_blocks_start, - besb.log_blocks_ag, besb.log_blocks_len, besb.log_blocks_len * besb.block_size).AppendLine(); - sb.AppendFormat("Journal starts in byte {0} and ends in byte {1}", besb.log_start, besb.log_end).AppendLine(); - sb.AppendFormat("Root folder's i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", besb.root_dir_start, - besb.root_dir_ag, besb.root_dir_len, besb.root_dir_len * besb.block_size).AppendLine(); - sb.AppendFormat("Indices' i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", besb.indices_start, - besb.indices_ag, besb.indices_len, besb.indices_len * besb.block_size).AppendLine(); + sb.AppendFormat("Journal resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", + besb.log_blocks_start, besb.log_blocks_ag, besb.log_blocks_len, + besb.log_blocks_len * besb.block_size).AppendLine(); + sb.AppendFormat("Journal starts in byte {0} and ends in byte {1}", besb.log_start, besb.log_end) + .AppendLine(); + sb + .AppendFormat("Root folder's i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", + besb.root_dir_start, besb.root_dir_ag, besb.root_dir_len, + besb.root_dir_len * besb.block_size).AppendLine(); + sb + .AppendFormat("Indices' i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", + besb.indices_start, besb.indices_ag, besb.indices_len, besb.indices_len * besb.block_size) + .AppendLine(); information = sb.ToString(); @@ -236,8 +231,7 @@ namespace DiscImageChef.Filesystems struct BeSuperBlock { /// <summary>0x000, Volume name, 32 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] name; /// <summary>0x020, "BFS1", 0x42465331</summary> public uint magic1; /// <summary>0x024, "BIGE", 0x42494745</summary> diff --git a/DiscImageChef.Filesystems/BTRFS.cs b/DiscImageChef.Filesystems/BTRFS.cs index dd06e692..6998e580 100644 --- a/DiscImageChef.Filesystems/BTRFS.cs +++ b/DiscImageChef.Filesystems/BTRFS.cs @@ -57,27 +57,22 @@ namespace DiscImageChef.Filesystems { Name = "B-tree file system"; PluginUUID = new Guid("C904CF15-5222-446B-B7DB-02EAC5D781B3"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public BTRFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "B-tree file system"; PluginUUID = new Guid("C904CF15-5222-446B-B7DB-02EAC5D781B3"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SuperBlock { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)] - public byte[] checksum; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)] public byte[] checksum; public Guid uuid; public ulong pba; public ulong flags; @@ -105,14 +100,10 @@ namespace DiscImageChef.Filesystems public byte chunk_root_level; public byte log_root_level; public DevItem dev_item; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x100)] - public string label; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x100)] - public byte[] reserved; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x800)] - public byte[] chunkpairs; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x4D5)] - public byte[] unused; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x100)] public string label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x100)] public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x800)] public byte[] chunkpairs; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x4D5)] public byte[] unused; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -136,14 +127,12 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Start >= partition.End) - return false; + if(partition.Start >= partition.End) return false; ulong sbSectorOff = 0x10000 / imagePlugin.GetSectorSize(); uint sbSectorSize = 0x1000 / imagePlugin.GetSectorSize(); - if((sbSectorOff + partition.Start) >= partition.End) - return false; + if((sbSectorOff + partition.Start) >= partition.End) return false; byte[] sector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSectorSize); SuperBlock btrfsSb; @@ -154,10 +143,7 @@ namespace DiscImageChef.Filesystems btrfsSb = (SuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SuperBlock)); handle.Free(); } - catch - { - return false; - } + catch { return false; } DicConsole.DebugWriteLine("BTRFS Plugin", "sbSectorOff = {0}", sbSectorOff); DicConsole.DebugWriteLine("BTRFS Plugin", "sbSectorSize = {0}", sbSectorSize); @@ -167,7 +153,8 @@ namespace DiscImageChef.Filesystems return btrfsSb.magic == btrfsMagic; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { StringBuilder sbInformation = new StringBuilder(); xmlFSType = new Schemas.FileSystemType(); @@ -202,7 +189,8 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.leafsize = {0}", btrfsSb.leafsize); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.stripesize = {0}", btrfsSb.stripesize); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.n = {0}", btrfsSb.n); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.chunk_root_generation = {0}", btrfsSb.chunk_root_generation); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.chunk_root_generation = {0}", + btrfsSb.chunk_root_generation); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.compat_flags = 0x{0:X16}", btrfsSb.compat_flags); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.compat_ro_flags = 0x{0:X16}", btrfsSb.compat_ro_flags); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.incompat_flags = 0x{0:X16}", btrfsSb.incompat_flags); @@ -213,16 +201,21 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.id = 0x{0:X16}", btrfsSb.dev_item.id); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.bytes = {0}", btrfsSb.dev_item.bytes); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.used = {0}", btrfsSb.dev_item.used); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.optimal_align = {0}", btrfsSb.dev_item.optimal_align); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.optimal_width = {0}", btrfsSb.dev_item.optimal_width); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.minimal_size = {0}", btrfsSb.dev_item.minimal_size); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.optimal_align = {0}", + btrfsSb.dev_item.optimal_align); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.optimal_width = {0}", + btrfsSb.dev_item.optimal_width); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.minimal_size = {0}", + btrfsSb.dev_item.minimal_size); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.type = {0}", btrfsSb.dev_item.type); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.generation = {0}", btrfsSb.dev_item.generation); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.start_offset = {0}", btrfsSb.dev_item.start_offset); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.start_offset = {0}", + btrfsSb.dev_item.start_offset); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.dev_group = {0}", btrfsSb.dev_item.dev_group); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.seek_speed = {0}", btrfsSb.dev_item.seek_speed); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.bandwitdh = {0}", btrfsSb.dev_item.bandwitdh); - DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.device_uuid = {0}", btrfsSb.dev_item.device_uuid); + DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.device_uuid = {0}", + btrfsSb.dev_item.device_uuid); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.dev_item.uuid = {0}", btrfsSb.dev_item.uuid); DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.label = {0}", btrfsSb.label); @@ -232,7 +225,8 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("Root tree starts at LBA {0}", btrfsSb.root_lba).AppendLine(); sbInformation.AppendFormat("Chunk tree starts at LBA {0}", btrfsSb.chunk_lba).AppendLine(); sbInformation.AppendFormat("Log tree starts at LBA {0}", btrfsSb.log_lba).AppendLine(); - sbInformation.AppendFormat("Volume has {0} bytes spanned in {1} devices", btrfsSb.total_bytes, btrfsSb.num_devices).AppendLine(); + sbInformation.AppendFormat("Volume has {0} bytes spanned in {1} devices", btrfsSb.total_bytes, + btrfsSb.num_devices).AppendLine(); sbInformation.AppendFormat("Volume has {0} bytes used", btrfsSb.bytes_used).AppendLine(); sbInformation.AppendFormat("{0} bytes/sector", btrfsSb.sectorsize).AppendLine(); sbInformation.AppendFormat("{0} bytes/node", btrfsSb.nodesize).AppendLine(); @@ -318,5 +312,4 @@ namespace DiscImageChef.Filesystems return Errno.NotImplemented; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/CBM.cs b/DiscImageChef.Filesystems/CBM.cs index 1c26cb2d..7949307f 100644 --- a/DiscImageChef.Filesystems/CBM.cs +++ b/DiscImageChef.Filesystems/CBM.cs @@ -83,13 +83,11 @@ namespace DiscImageChef.Filesystems /// <summary> /// Block allocation map /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 140)] - public byte[] bam; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 140)] public byte[] bam; /// <summary> /// Disk name /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] name; /// <summary> /// Filled with 0xA0 /// </summary> @@ -117,23 +115,19 @@ namespace DiscImageChef.Filesystems /// <summary> /// Block allocation map for Dolphin DOS extended tracks /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] dolphinBam; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] dolphinBam; /// <summary> /// Block allocation map for Speed DOS extended tracks /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] speedBam; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] speedBam; /// <summary> /// Unused /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] - public byte[] unused2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] public byte[] unused2; /// <summary> /// Free sector count for second side in 1571 /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] - public byte[] freeCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] public byte[] freeCount; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -158,8 +152,7 @@ namespace DiscImageChef.Filesystems /// <summary> /// Disk name /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] name; /// <summary> /// Filled with 0xA0 /// </summary> @@ -188,15 +181,12 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Start > 0) - return false; + if(partition.Start > 0) return false; - if(imagePlugin.ImageInfo.sectorSize != 256) - return false; + if(imagePlugin.ImageInfo.sectorSize != 256) return false; if(imagePlugin.ImageInfo.sectors != 683 && imagePlugin.ImageInfo.sectors != 768 && - imagePlugin.ImageInfo.sectors != 1366 && imagePlugin.ImageInfo.sectors != 3200) - return false; + imagePlugin.ImageInfo.sectors != 1366 && imagePlugin.ImageInfo.sectors != 3200) return false; byte[] sector; @@ -221,14 +211,15 @@ namespace DiscImageChef.Filesystems cbmBam = (CommodoreBAM)Marshal.PtrToStructure(cbmBamPtr, typeof(CommodoreBAM)); Marshal.FreeHGlobal(cbmBamPtr); - if(cbmBam.dosVersion == 0x41 && (cbmBam.doubleSided == 0x00 || cbmBam.doubleSided == 0x80) && cbmBam.unused1 == 0x00 && cbmBam.directoryTrack == 0x12) - return true; + if(cbmBam.dosVersion == 0x41 && (cbmBam.doubleSided == 0x00 || cbmBam.doubleSided == 0x80) && + cbmBam.unused1 == 0x00 && cbmBam.directoryTrack == 0x12) return true; } return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { byte[] sector; @@ -250,12 +241,18 @@ namespace DiscImageChef.Filesystems cbmHdr = (CommodoreHeader)Marshal.PtrToStructure(cbmHdrPtr, typeof(CommodoreHeader)); Marshal.FreeHGlobal(cbmHdrPtr); - sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmHdr.directoryTrack, cbmHdr.directorySector).AppendLine(); - sbInformation.AppendFormat("Disk DOS Version: {0}", Encoding.ASCII.GetString(new byte[] { cbmHdr.diskDosVersion })).AppendLine(); - sbInformation.AppendFormat("DOS Version: {0}", Encoding.ASCII.GetString(new byte[] { cbmHdr.dosVersion })).AppendLine(); - sbInformation.AppendFormat("Disk Version: {0}", Encoding.ASCII.GetString(new byte[] { cbmHdr.diskVersion })).AppendLine(); + sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmHdr.directoryTrack, + cbmHdr.directorySector).AppendLine(); + sbInformation.AppendFormat("Disk DOS Version: {0}", + Encoding.ASCII.GetString(new byte[] {cbmHdr.diskDosVersion})).AppendLine(); + sbInformation.AppendFormat("DOS Version: {0}", Encoding.ASCII.GetString(new byte[] {cbmHdr.dosVersion})) + .AppendLine(); + sbInformation + .AppendFormat("Disk Version: {0}", Encoding.ASCII.GetString(new byte[] {cbmHdr.diskVersion})) + .AppendLine(); sbInformation.AppendFormat("Disk ID: {0}", cbmHdr.diskId).AppendLine(); - sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmHdr.name, CurrentEncoding)).AppendLine(); + sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmHdr.name, CurrentEncoding)) + .AppendLine(); xmlFSType.VolumeName = StringHandlers.CToString(cbmHdr.name, CurrentEncoding); xmlFSType.VolumeSerial = string.Format("{0}", cbmHdr.diskId); @@ -269,11 +266,16 @@ namespace DiscImageChef.Filesystems cbmBam = (CommodoreBAM)Marshal.PtrToStructure(cbmBamPtr, typeof(CommodoreBAM)); Marshal.FreeHGlobal(cbmBamPtr); - sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmBam.directoryTrack, cbmBam.directorySector).AppendLine(); - sbInformation.AppendFormat("Disk DOS type: {0}", Encoding.ASCII.GetString(BitConverter.GetBytes(cbmBam.dosType))).AppendLine(); - sbInformation.AppendFormat("DOS Version: {0}", Encoding.ASCII.GetString(new byte[] { cbmBam.dosVersion })).AppendLine(); + sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmBam.directoryTrack, + cbmBam.directorySector).AppendLine(); + sbInformation.AppendFormat("Disk DOS type: {0}", + Encoding.ASCII.GetString(BitConverter.GetBytes(cbmBam.dosType))) + .AppendLine(); + sbInformation.AppendFormat("DOS Version: {0}", Encoding.ASCII.GetString(new byte[] {cbmBam.dosVersion})) + .AppendLine(); sbInformation.AppendFormat("Disk ID: {0}", cbmBam.diskId).AppendLine(); - sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmBam.name, CurrentEncoding)).AppendLine(); + sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmBam.name, CurrentEncoding)) + .AppendLine(); xmlFSType.VolumeName = StringHandlers.CToString(cbmBam.name, CurrentEncoding); xmlFSType.VolumeSerial = string.Format("{0}", cbmBam.diskId); diff --git a/DiscImageChef.Filesystems/CPM/CPM.cs b/DiscImageChef.Filesystems/CPM/CPM.cs index 8e87f031..9eab814a 100644 --- a/DiscImageChef.Filesystems/CPM/CPM.cs +++ b/DiscImageChef.Filesystems/CPM/CPM.cs @@ -121,10 +121,8 @@ namespace DiscImageChef.Filesystems.CPM { Name = "CP/M File System"; PluginUUID = new Guid("AA2B8585-41DF-4E3B-8A35-D1A935E2F8A1"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("IBM437"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("IBM437"); + else CurrentEncoding = encoding; } public CPM(ImagePlugin imagePlugin, Partition partition, Encoding encoding) @@ -133,11 +131,8 @@ namespace DiscImageChef.Filesystems.CPM this.partition = partition; Name = "CP/M File System"; PluginUUID = new Guid("AA2B8585-41DF-4E3B-8A35-D1A935E2F8A1"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("IBM437"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("IBM437"); + else CurrentEncoding = encoding; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/CPM/Consts.cs b/DiscImageChef.Filesystems/CPM/Consts.cs index ce554e7f..afe83b8c 100644 --- a/DiscImageChef.Filesystems/CPM/Consts.cs +++ b/DiscImageChef.Filesystems/CPM/Consts.cs @@ -81,5 +81,4 @@ namespace DiscImageChef.Filesystems.CPM k720Alt = 0x94 } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/CPM/Definitions.cs b/DiscImageChef.Filesystems/CPM/Definitions.cs index c10ca21e..9de9d31e 100644 --- a/DiscImageChef.Filesystems/CPM/Definitions.cs +++ b/DiscImageChef.Filesystems/CPM/Definitions.cs @@ -48,7 +48,9 @@ namespace DiscImageChef.Filesystems.CPM { try { - XmlReader defsReader = XmlReader.Create(Assembly.GetExecutingAssembly().GetManifestResourceStream("DiscImageChef.Filesystems.CPM.cpmdefs.xml")); + XmlReader defsReader = + XmlReader.Create(Assembly.GetExecutingAssembly() + .GetManifestResourceStream("DiscImageChef.Filesystems.CPM.cpmdefs.xml")); XmlSerializer defsSerializer = new XmlSerializer(typeof(CpmDefinitions)); definitions = (CpmDefinitions)defsSerializer.Deserialize(defsReader); @@ -60,8 +62,7 @@ namespace DiscImageChef.Filesystems.CPM def.side1 = new Side(); def.side1.sideId = 0; def.side1.sectorIds = new int[def.sectorsPerTrack]; - for(int i = 0; i < def.sectorsPerTrack; i++) - def.side1.sectorIds[i] = i + 1; + for(int i = 0; i < def.sectorsPerTrack; i++) def.side1.sectorIds[i] = i + 1; } if(def.sides == 2 && def.side2 == null) @@ -69,17 +70,13 @@ namespace DiscImageChef.Filesystems.CPM def.side2 = new Side(); def.side2.sideId = 1; def.side2.sectorIds = new int[def.sectorsPerTrack]; - for(int i = 0; i < def.sectorsPerTrack; i++) - def.side2.sectorIds[i] = i + 1; + for(int i = 0; i < def.sectorsPerTrack; i++) def.side2.sectorIds[i] = i + 1; } } return true; } - catch - { - return false; - } + catch { return false; } } } @@ -211,5 +208,4 @@ namespace DiscImageChef.Filesystems.CPM /// </summary> public int[] sectorIds; } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/CPM/Dir.cs b/DiscImageChef.Filesystems/CPM/Dir.cs index df328ab1..9aa0477c 100644 --- a/DiscImageChef.Filesystems/CPM/Dir.cs +++ b/DiscImageChef.Filesystems/CPM/Dir.cs @@ -41,8 +41,7 @@ namespace DiscImageChef.Filesystems.CPM { public override Errno ReadDir(string path, ref List<string> contents) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) return Errno.NotSupported; @@ -64,8 +63,7 @@ namespace DiscImageChef.Filesystems.CPM { try { - if(directory == null) - return false; + if(directory == null) return false; int fileCount = 0; @@ -81,31 +79,26 @@ namespace DiscImageChef.Filesystems.CPM { for(int f = 0; f < 8; f++) { - if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00) - return false; + if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00) return false; } for(int e = 0; e < 3; e++) { - if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00) - return false; + if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00) return false; } - if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(entry.filename)) - fileCount++; + if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(entry.filename)) fileCount++; } else if(entry.statusUser == 0x20) { for(int f = 0; f < 8; f++) { - if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00) - return false; + if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00) return false; } for(int e = 0; e < 3; e++) { - if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00) - return false; + if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00) return false; } label = Encoding.ASCII.GetString(directory, off + 1, 11).Trim(); @@ -116,21 +109,14 @@ namespace DiscImageChef.Filesystems.CPM } else if(entry.statusUser == 0x21) { - if(directory[off + 1] == 0x00) - { - thirdPartyTimestamps = true; - } + if(directory[off + 1] == 0x00) { thirdPartyTimestamps = true; } else standardTimestamps |= (directory[off + 21] == 0x00 && directory[off + 31] == 0x00); } } return fileCount > 0; } - catch - { - return false; - } + catch { return false; } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/CPM/File.cs b/DiscImageChef.Filesystems/CPM/File.cs index 4034ec14..70e7a91e 100644 --- a/DiscImageChef.Filesystems/CPM/File.cs +++ b/DiscImageChef.Filesystems/CPM/File.cs @@ -38,16 +38,15 @@ namespace DiscImageChef.Filesystems.CPM { public override Errno GetAttributes(string path, ref FileAttributes attributes) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; FileEntryInfo fInfo; - if(string.IsNullOrEmpty(pathElements[0]) || string.Compare(pathElements[0], "/", StringComparison.OrdinalIgnoreCase) == 0) + if(string.IsNullOrEmpty(pathElements[0]) || + string.Compare(pathElements[0], "/", StringComparison.OrdinalIgnoreCase) == 0) { attributes = new FileAttributes(); attributes = FileAttributes.Directory; @@ -65,8 +64,7 @@ namespace DiscImageChef.Filesystems.CPM public override Errno MapBlock(string path, long fileBlock, ref long deviceBlock) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; // TODO: Implementing this would require storing the interleaving return Errno.NotImplemented; @@ -74,8 +72,7 @@ namespace DiscImageChef.Filesystems.CPM public override Errno Read(string path, long offset, long size, ref byte[] buf) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; if(size == 0) { @@ -83,23 +80,18 @@ namespace DiscImageChef.Filesystems.CPM return Errno.NoError; } - if(offset < 0) - return Errno.InvalidArgument; + if(offset < 0) return Errno.InvalidArgument; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; byte[] file; - if(!fileCache.TryGetValue(pathElements[0].ToUpperInvariant(), out file)) - return Errno.NoSuchFile; + if(!fileCache.TryGetValue(pathElements[0].ToUpperInvariant(), out file)) return Errno.NoSuchFile; - if(offset >= file.Length) - return Errno.EINVAL; + if(offset >= file.Length) return Errno.EINVAL; - if(size + offset >= file.Length) - size = file.Length - offset; + if(size + offset >= file.Length) size = file.Length - offset; buf = new byte[size]; Array.Copy(file, offset, buf, 0, size); @@ -108,38 +100,30 @@ namespace DiscImageChef.Filesystems.CPM public override Errno ReadLink(string path, ref string dest) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; return Errno.NotSupported; } public override Errno Stat(string path, ref FileEntryInfo stat) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; if(string.IsNullOrEmpty(path) || string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) == 0) { - if(labelCreationDate != null) - stat.CreationTime = DateHandlers.CPMToDateTime(labelCreationDate); - if(labelUpdateDate != null) - stat.StatusChangeTime = DateHandlers.CPMToDateTime(labelUpdateDate); + if(labelCreationDate != null) stat.CreationTime = DateHandlers.CPMToDateTime(labelCreationDate); + if(labelUpdateDate != null) stat.StatusChangeTime = DateHandlers.CPMToDateTime(labelUpdateDate); stat.Attributes = FileAttributes.Directory; stat.BlockSize = xmlFSType.ClusterSize; return Errno.NoError; } - if(statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out stat)) - return Errno.NoError; + if(statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out stat)) return Errno.NoError; return Errno.NoSuchFile; } - } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/CPM/Info.cs b/DiscImageChef.Filesystems/CPM/Info.cs index cb15da8c..8d075852 100644 --- a/DiscImageChef.Filesystems/CPM/Info.cs +++ b/DiscImageChef.Filesystems/CPM/Info.cs @@ -153,12 +153,10 @@ namespace DiscImageChef.Filesystems.CPM case MediaType.RP06: case MediaType.RP06_18: case MediaType.GENERIC_HDD: - case MediaType.FlashDrive: - break; - default: - return false; + case MediaType.FlashDrive: break; + default: return false; } - + // This will try to identify a CP/M filesystem // However as it contains no identification marks whatsoever it's more something of trial-and-error // As anything can happen, better try{}catch{} than sorry ;) @@ -186,8 +184,7 @@ namespace DiscImageChef.Filesystems.CPM sig3 = BitConverter.ToUInt32(sector, 0x7C); // PCW16 extended boot record - if(sig1 == 0x4D2F5043 && sig2 == 0x004B5344 && sig3 == sig1) - amsSbOffset = 0x80; + if(sig1 == 0x4D2F5043 && sig2 == 0x004B5344 && sig3 == sig1) amsSbOffset = 0x80; // Read the superblock AmstradSuperBlock amsSb = new AmstradSuperBlock(); @@ -207,8 +204,7 @@ namespace DiscImageChef.Filesystems.CPM sectorSize = (ulong)(128 << amsSb.psh); // Compare device limits from superblock to real limits - if(sectorSize == imagePlugin.GetSectorSize() && - sectorCount == imagePlugin.GetSectors()) + if(sectorSize == imagePlugin.GetSectorSize() && sectorCount == imagePlugin.GetSectors()) { cpmFound = true; firstDirectorySector = (ulong)((amsSb.off * amsSb.spt)); @@ -218,8 +214,8 @@ namespace DiscImageChef.Filesystems.CPM dpb.al0 = sectorCount == 1440 ? (byte)0xF0 : (byte)0xC0; dpb.spt = amsSb.spt; dpb.bsh = amsSb.bsh; - for(int i = 0; i < dpb.bsh; i++) - dpb.blm += (byte)Math.Pow(2, i); + for(int i = 0; i < dpb.bsh; i++) dpb.blm += (byte)Math.Pow(2, i); + if(sectorCount >= 1440) { dpb.cks = 0x40; @@ -234,11 +230,12 @@ namespace DiscImageChef.Filesystems.CPM dpb.exm = sectorCount == 2880 ? (byte)1 : (byte)0; dpb.off = amsSb.off; dpb.psh = amsSb.psh; - for(int i = 0; i < dpb.psh; i++) - dpb.phm += (byte)Math.Pow(2, i); + for(int i = 0; i < dpb.psh; i++) dpb.phm += (byte)Math.Pow(2, i); + dpb.spt = (ushort)(amsSb.spt * (sectorSize / 128)); uint directoryLength = (uint)((((ulong)dpb.drm + 1) * 32) / sectorSize); - directory = imagePlugin.ReadSectors(firstDirectorySector + partition.Start, directoryLength); + directory = imagePlugin.ReadSectors(firstDirectorySector + partition.Start, + directoryLength); // Build a CP/M disk definition workingDefinition = new CpmDefinition(); @@ -262,26 +259,20 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition.side1 = new Side(); workingDefinition.side1.sideId = 0; workingDefinition.side1.sectorIds = new int[amsSb.spt]; - for(int si = 0; si < amsSb.spt; si++) - workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < amsSb.spt; si++) workingDefinition.side1.sectorIds[si] = si + 1; if(amsSb.format == 2) { - if((amsSb.sidedness & 0x02) == 1) - workingDefinition.order = "SIDES"; - else if((amsSb.sidedness & 0x02) == 2) - workingDefinition.order = "CYLINDERS"; - else - workingDefinition.order = null; + if((amsSb.sidedness & 0x02) == 1) workingDefinition.order = "SIDES"; + else if((amsSb.sidedness & 0x02) == 2) workingDefinition.order = "CYLINDERS"; + else workingDefinition.order = null; workingDefinition.side2 = new Side(); workingDefinition.side2.sideId = 1; workingDefinition.side2.sectorIds = new int[amsSb.spt]; - for(int si = 0; si < amsSb.spt; si++) - workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < amsSb.spt; si++) workingDefinition.side2.sectorIds[si] = si + 1; } - else - workingDefinition.order = null; + else workingDefinition.order = null; workingDefinition.skew = 2; workingDefinition.sofs = 0; @@ -299,8 +290,7 @@ namespace DiscImageChef.Filesystems.CPM ushort sum = 0; // Sum of all 16-bit words that make this sector must be 0 - for(int i = 0; i < sector.Length; i += 2) - sum += BitConverter.ToUInt16(sector, i); + for(int i = 0; i < sector.Length; i += 2) sum += BitConverter.ToUInt16(sector, i); // It may happen that there is a corrupted superblock // Better to ignore corrupted than to false positive the rest @@ -316,11 +306,11 @@ namespace DiscImageChef.Filesystems.CPM // Calculate volume size sectorSize = (ulong)(hddSb.recordsPerSector * 128); ulong sectorsInPartition = (ulong)(hddSb.cylinders * hddSb.heads * hddSb.sectorsPerTrack); - ulong startingSector = (ulong)((hddSb.firstCylinder * hddSb.heads + hddSb.heads) * hddSb.sectorsPerTrack); + ulong startingSector = + (ulong)((hddSb.firstCylinder * hddSb.heads + hddSb.heads) * hddSb.sectorsPerTrack); // If volume size corresponds with working partition (this variant will be inside MBR partitioning) - if(sectorSize == imagePlugin.GetSectorSize() && - startingSector == partition.Start && + if(sectorSize == imagePlugin.GetSectorSize() && startingSector == partition.Start && sectorsInPartition + partition.Start <= partition.End) { cpmFound = true; @@ -341,7 +331,8 @@ namespace DiscImageChef.Filesystems.CPM dpb.psh = 0; // Needed? dpb.spt = hddSb.spt; uint directoryLength = (uint)((((ulong)dpb.drm + 1) * 32) / sectorSize); - directory = imagePlugin.ReadSectors(firstDirectorySector + partition.Start, directoryLength); + directory = imagePlugin.ReadSectors(firstDirectorySector + partition.Start, + directoryLength); DicConsole.DebugWriteLine("CP/M Plugin", "Found CP/M-86 hard disk superblock."); // Build a CP/M disk definition @@ -367,12 +358,13 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition.side1.sectorIds = new int[hddSb.sectorsPerTrack]; for(int si = 0; si < hddSb.sectorsPerTrack; si++) workingDefinition.side1.sectorIds[si] = si + 1; + workingDefinition.order = "SIDES"; workingDefinition.side2 = new Side(); workingDefinition.side2.sideId = 1; workingDefinition.side2.sectorIds = new int[hddSb.sectorsPerTrack]; - for(int si = 0; si < hddSb.spt; si++) - workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < hddSb.spt; si++) workingDefinition.side2.sectorIds[si] = si + 1; + workingDefinition.skew = 0; workingDefinition.sofs = 0; } @@ -389,13 +381,10 @@ namespace DiscImageChef.Filesystems.CPM // Check for alternate location of format ID if(sector.Last() == 0x00 || sector.Last() == 0xFF) { - if(sector[0x40] == 0x94 || sector[0x40] == 0x26) - formatByte = sector[0x40]; - else - formatByte = sector.Last(); + if(sector[0x40] == 0x94 || sector[0x40] == 0x26) formatByte = sector[0x40]; + else formatByte = sector.Last(); } - else - formatByte = sector.Last(); + else formatByte = sector.Last(); uint firstDirectorySector86 = 0; @@ -445,11 +434,12 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition.side1 = new Side(); workingDefinition.side1.sideId = 0; workingDefinition.side1.sectorIds = new int[8]; - for(int si = 0; si < 8; si++) - workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 8; si++) workingDefinition.side1.sectorIds[si] = si + 1; + workingDefinition.skew = 0; workingDefinition.sofs = 0; } + break; case FormatByte.k320: if(imagePlugin.GetSectorSize() == 512 && imagePlugin.GetSectors() == 640) @@ -490,17 +480,18 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition.side1 = new Side(); workingDefinition.side1.sideId = 0; workingDefinition.side1.sectorIds = new int[8]; - for(int si = 0; si < 8; si++) - workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 8; si++) workingDefinition.side1.sectorIds[si] = si + 1; + workingDefinition.order = "SIDES"; workingDefinition.side2 = new Side(); workingDefinition.side2.sideId = 1; workingDefinition.side2.sectorIds = new int[8]; - for(int si = 0; si < 8; si++) - workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < 8; si++) workingDefinition.side2.sectorIds[si] = si + 1; + workingDefinition.skew = 0; workingDefinition.sofs = 0; } + break; case FormatByte.k360: case FormatByte.k360Alt: @@ -543,17 +534,18 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition.side1 = new Side(); workingDefinition.side1.sideId = 0; workingDefinition.side1.sectorIds = new int[9]; - for(int si = 0; si < 9; si++) - workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 9; si++) workingDefinition.side1.sectorIds[si] = si + 1; + workingDefinition.order = "SIDES"; workingDefinition.side2 = new Side(); workingDefinition.side2.sideId = 1; workingDefinition.side2.sectorIds = new int[9]; - for(int si = 0; si < 9; si++) - workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < 9; si++) workingDefinition.side2.sectorIds[si] = si + 1; + workingDefinition.skew = 0; workingDefinition.sofs = 0; } + break; case FormatByte.k720: case FormatByte.k720Alt: @@ -595,17 +587,18 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition.side1 = new Side(); workingDefinition.side1.sideId = 0; workingDefinition.side1.sectorIds = new int[9]; - for(int si = 0; si < 9; si++) - workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 9; si++) workingDefinition.side1.sectorIds[si] = si + 1; + workingDefinition.order = "SIDES"; workingDefinition.side2 = new Side(); workingDefinition.side2.sideId = 1; workingDefinition.side2.sectorIds = new int[9]; - for(int si = 0; si < 9; si++) - workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < 9; si++) workingDefinition.side2.sectorIds[si] = si + 1; + workingDefinition.skew = 0; workingDefinition.sofs = 0; } + break; case FormatByte.f720: if(imagePlugin.GetSectorSize() == 512 && imagePlugin.GetSectors() == 1440) @@ -646,17 +639,18 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition.side1 = new Side(); workingDefinition.side1.sideId = 0; workingDefinition.side1.sectorIds = new int[9]; - for(int si = 0; si < 9; si++) - workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 9; si++) workingDefinition.side1.sectorIds[si] = si + 1; + workingDefinition.order = "CYLINDERS"; workingDefinition.side2 = new Side(); workingDefinition.side2.sideId = 1; workingDefinition.side2.sectorIds = new int[9]; - for(int si = 0; si < 9; si++) - workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < 9; si++) workingDefinition.side2.sectorIds[si] = si + 1; + workingDefinition.skew = 0; workingDefinition.sofs = 0; } + break; case FormatByte.f1200: if(imagePlugin.GetSectorSize() == 512 && imagePlugin.GetSectors() == 2400) @@ -697,17 +691,18 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition.side1 = new Side(); workingDefinition.side1.sideId = 0; workingDefinition.side1.sectorIds = new int[15]; - for(int si = 0; si < 15; si++) - workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 15; si++) workingDefinition.side1.sectorIds[si] = si + 1; + workingDefinition.order = "CYLINDERS"; workingDefinition.side2 = new Side(); workingDefinition.side2.sideId = 1; workingDefinition.side2.sectorIds = new int[15]; - for(int si = 0; si < 15; si++) - workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < 15; si++) workingDefinition.side2.sectorIds[si] = si + 1; + workingDefinition.skew = 0; workingDefinition.sofs = 0; } + break; case FormatByte.f1440: if(imagePlugin.GetSectorSize() == 512 && imagePlugin.GetSectors() == 2880) @@ -748,17 +743,18 @@ namespace DiscImageChef.Filesystems.CPM workingDefinition.side1 = new Side(); workingDefinition.side1.sideId = 0; workingDefinition.side1.sectorIds = new int[18]; - for(int si = 0; si < 18; si++) - workingDefinition.side1.sectorIds[si] = si + 1; + for(int si = 0; si < 18; si++) workingDefinition.side1.sectorIds[si] = si + 1; + workingDefinition.order = "CYLINDERS"; workingDefinition.side2 = new Side(); workingDefinition.side2.sideId = 1; workingDefinition.side2.sectorIds = new int[18]; - for(int si = 0; si < 18; si++) - workingDefinition.side2.sectorIds[si] = si + 1; + for(int si = 0; si < 18; si++) workingDefinition.side2.sectorIds[si] = si + 1; + workingDefinition.skew = 0; workingDefinition.sofs = 0; } + break; } @@ -787,7 +783,8 @@ namespace DiscImageChef.Filesystems.CPM { // Load all definitions DicConsole.DebugWriteLine("CP/M Plugin", "Trying to load definitions."); - if(LoadDefinitions() && definitions != null && definitions.definitions != null && definitions.definitions.Count > 0) + if(LoadDefinitions() && definitions != null && definitions.definitions != null && + definitions.definitions.Count > 0) { DicConsole.DebugWriteLine("CP/M Plugin", "Trying all known definitions."); foreach(CpmDefinition def in definitions.definitions) @@ -799,10 +796,8 @@ namespace DiscImageChef.Filesystems.CPM { DicConsole.DebugWriteLine("CP/M Plugin", "Trying definition \"{0}\"", def.comment); ulong offset; - if(def.sofs != 0) - offset = (ulong)def.sofs; - else - offset = (ulong)(def.ofs * def.sectorsPerTrack); + if(def.sofs != 0) offset = (ulong)def.sofs; + else offset = (ulong)(def.ofs * def.sectorsPerTrack); int dirLen = ((def.drm + 1) * 32) / def.bytesPerSector; @@ -815,39 +810,51 @@ namespace DiscImageChef.Filesystems.CPM else { // Head changes after every track - if(string.Compare(def.order, "SIDES", StringComparison.InvariantCultureIgnoreCase) == 0) + if(string.Compare(def.order, "SIDES", + StringComparison.InvariantCultureIgnoreCase) == 0) { sectorMask = new int[def.side1.sectorIds.Length + def.side2.sectorIds.Length]; for(int m = 0; m < def.side1.sectorIds.Length; m++) sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0]; // Skip first track (first side) for(int m = 0; m < def.side2.sectorIds.Length; m++) - sectorMask[m + def.side1.sectorIds.Length] = (def.side2.sectorIds[m] - def.side2.sectorIds[0]) + def.side1.sectorIds.Length; + sectorMask[m + def.side1.sectorIds.Length] = + (def.side2.sectorIds[m] - def.side2.sectorIds[0]) + + def.side1.sectorIds.Length; } // Head changes after whole side - else if(string.Compare(def.order, "CYLINDERS", StringComparison.InvariantCultureIgnoreCase) == 0) + else if(string.Compare(def.order, "CYLINDERS", + StringComparison.InvariantCultureIgnoreCase) == 0) { for(int m = 0; m < def.side1.sectorIds.Length; m++) sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0]; // Skip first track (first side) and first track (second side) for(int m = 0; m < def.side1.sectorIds.Length; m++) - sectorMask[m + def.side1.sectorIds.Length] = (def.side1.sectorIds[m] - def.side1.sectorIds[0]) + def.side1.sectorIds.Length + def.side2.sectorIds.Length; + sectorMask[m + def.side1.sectorIds.Length] = + (def.side1.sectorIds[m] - def.side1.sectorIds[0]) + + def.side1.sectorIds.Length + def.side2.sectorIds.Length; } // TODO: Implement COLUMBIA ordering - else if(string.Compare(def.order, "COLUMBIA", StringComparison.InvariantCultureIgnoreCase) == 0) + else if(string.Compare(def.order, "COLUMBIA", + StringComparison.InvariantCultureIgnoreCase) == 0) { - DicConsole.DebugWriteLine("CP/M Plugin", "Don't know how to handle COLUMBIA ordering, not proceeding with this definition."); + DicConsole.DebugWriteLine("CP/M Plugin", + "Don't know how to handle COLUMBIA ordering, not proceeding with this definition."); continue; } // TODO: Implement EAGLE ordering - else if(string.Compare(def.order, "EAGLE", StringComparison.InvariantCultureIgnoreCase) == 0) + else if(string.Compare(def.order, "EAGLE", + StringComparison.InvariantCultureIgnoreCase) == 0) { - DicConsole.DebugWriteLine("CP/M Plugin", "Don't know how to handle EAGLE ordering, not proceeding with this definition."); + DicConsole.DebugWriteLine("CP/M Plugin", + "Don't know how to handle EAGLE ordering, not proceeding with this definition."); continue; } else { - DicConsole.DebugWriteLine("CP/M Plugin", "Unknown order type \"{0}\", not proceeding with this definition.", def.order); + DicConsole.DebugWriteLine("CP/M Plugin", + "Unknown order type \"{0}\", not proceeding with this definition.", + def.order); continue; } } @@ -856,13 +863,18 @@ namespace DiscImageChef.Filesystems.CPM MemoryStream ms = new MemoryStream(); for(int p = 0; p < dirLen; p++) { - byte[] dirSector = imagePlugin.ReadSector((ulong)((int)offset + (int)partition.Start + (p / sectorMask.Length) * sectorMask.Length + sectorMask[p % sectorMask.Length])); + byte[] dirSector = + imagePlugin.ReadSector((ulong)((int)offset + (int)partition.Start + + (p / sectorMask.Length) * sectorMask.Length + + sectorMask[p % sectorMask.Length])); ms.Write(dirSector, 0, dirSector.Length); } + directory = ms.ToArray(); if(def.evenOdd) - DicConsole.DebugWriteLine("CP/M Plugin", "Definition contains EVEN-ODD field, with unknown meaning, detection may be wrong."); + DicConsole.DebugWriteLine("CP/M Plugin", + "Definition contains EVEN-ODD field, with unknown meaning, detection may be wrong."); // Complement of the directory bytes if needed if(def.complement) @@ -874,7 +886,9 @@ namespace DiscImageChef.Filesystems.CPM // Check the directory if(CheckDir(directory)) { - DicConsole.DebugWriteLine("CP/M Plugin", "Definition \"{0}\" has a correct directory", def.comment); + DicConsole.DebugWriteLine("CP/M Plugin", + "Definition \"{0}\" has a correct directory", + def.comment); // Build a Disc Parameter Block workingDefinition = def; @@ -927,6 +941,7 @@ namespace DiscImageChef.Filesystems.CPM dpb.phm = 255; break; } + dpb.spt = (ushort)((def.sectorsPerTrack * def.bytesPerSector) / 128); cpmFound = true; workingDefinition = def; @@ -962,8 +977,7 @@ namespace DiscImageChef.Filesystems.CPM { information = ""; // As the identification is so complex, just call Identify() and relay on its findings - if(!Identify(imagePlugin, partition) || !cpmFound || workingDefinition == null || dpb == null) - return; + if(!Identify(imagePlugin, partition) || !cpmFound || workingDefinition == null || dpb == null) return; StringBuilder sb = new StringBuilder(); sb.AppendLine("CP/M filesystem"); @@ -971,12 +985,15 @@ namespace DiscImageChef.Filesystems.CPM sb.AppendFormat("Identified as {0}", workingDefinition.comment).AppendLine(); sb.AppendFormat("Volume block is {0} bytes", 128 << dpb.bsh).AppendLine(); if(dpb.dsm > 0) - sb.AppendFormat("Volume contains {0} blocks ({1} bytes)", dpb.dsm, (dpb.dsm) * (128 << dpb.bsh)).AppendLine(); + sb.AppendFormat("Volume contains {0} blocks ({1} bytes)", dpb.dsm, (dpb.dsm) * (128 << dpb.bsh)) + .AppendLine(); sb.AppendFormat("Volume contains {0} directory entries", dpb.drm + 1).AppendLine(); if(workingDefinition.sofs > 0) sb.AppendFormat("Volume reserves {0} sectors for system", workingDefinition.sofs).AppendLine(); else - sb.AppendFormat("Volume reserves {1} tracks ({0} sectors) for system", workingDefinition.ofs * workingDefinition.sectorsPerTrack, workingDefinition.ofs).AppendLine(); + sb.AppendFormat("Volume reserves {1} tracks ({0} sectors) for system", + workingDefinition.ofs * workingDefinition.sectorsPerTrack, workingDefinition.ofs) + .AppendLine(); int interleaveSide1; int interleaveSide2 = 1; @@ -987,7 +1004,7 @@ namespace DiscImageChef.Filesystems.CPM if(interleaveSide1 > 1) sb.AppendFormat("Side 0 uses {0}:1 software interleaving", interleaveSide1).AppendLine(); } - + if(workingDefinition.sides == 2) { if(workingDefinition.side2.sectorIds.Length >= 2) @@ -1014,18 +1031,19 @@ namespace DiscImageChef.Filesystems.CPM sb.AppendFormat("Device uses {0}:1 hardware interleaving", workingDefinition.skew).AppendLine(); if(workingDefinition.sofs > 0) - sb.AppendFormat("BSH {0} BLM {1} EXM {2} DSM {3} DRM {4} AL0 {5:X2}H AL1 {6:X2}H SOFS {7}", dpb.bsh, dpb.blm, dpb.exm, dpb.dsm, dpb.drm, dpb.al0, dpb.al1, workingDefinition.sofs).AppendLine(); + sb.AppendFormat("BSH {0} BLM {1} EXM {2} DSM {3} DRM {4} AL0 {5:X2}H AL1 {6:X2}H SOFS {7}", dpb.bsh, + dpb.blm, dpb.exm, dpb.dsm, dpb.drm, dpb.al0, dpb.al1, workingDefinition.sofs) + .AppendLine(); else - sb.AppendFormat("BSH {0} BLM {1} EXM {2} DSM {3} DRM {4} AL0 {5:X2}H AL1 {6:X2}H OFS {7}", dpb.bsh, dpb.blm, dpb.exm, dpb.dsm, dpb.drm, dpb.al0, dpb.al1, workingDefinition.ofs).AppendLine(); + sb.AppendFormat("BSH {0} BLM {1} EXM {2} DSM {3} DRM {4} AL0 {5:X2}H AL1 {6:X2}H OFS {7}", dpb.bsh, + dpb.blm, dpb.exm, dpb.dsm, dpb.drm, dpb.al0, dpb.al1, workingDefinition.ofs) + .AppendLine(); - if(label != null) - sb.AppendFormat("Volume label {0}", label).AppendLine(); + if(label != null) sb.AppendFormat("Volume label {0}", label).AppendLine(); - if(standardTimestamps) - sb.AppendLine("Volume uses standard CP/M timestamps"); + if(standardTimestamps) sb.AppendLine("Volume uses standard CP/M timestamps"); - if(thirdPartyTimestamps) - sb.AppendLine("Volume uses third party timestamps"); + if(thirdPartyTimestamps) sb.AppendLine("Volume uses third party timestamps"); if(labelCreationDate != null) sb.AppendFormat("Volume created on {0}", DateHandlers.CPMToDateTime(labelCreationDate)).AppendLine(); @@ -1035,10 +1053,8 @@ namespace DiscImageChef.Filesystems.CPM xmlFSType = new Schemas.FileSystemType(); xmlFSType.Bootable |= (workingDefinition.sofs > 0 || workingDefinition.ofs > 0); xmlFSType.ClusterSize = 128 << dpb.bsh; - if(dpb.dsm > 0) - xmlFSType.Clusters = dpb.dsm; - else - xmlFSType.Clusters = (long)(partition.End - partition.Start); + if(dpb.dsm > 0) xmlFSType.Clusters = dpb.dsm; + else xmlFSType.Clusters = (long)(partition.End - partition.Start); if(labelCreationDate != null) { xmlFSType.CreationDate = DateHandlers.CPMToDateTime(labelCreationDate); @@ -1055,5 +1071,4 @@ namespace DiscImageChef.Filesystems.CPM information = sb.ToString(); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/CPM/Structs.cs b/DiscImageChef.Filesystems/CPM/Structs.cs index fc1a25e9..238ef74f 100644 --- a/DiscImageChef.Filesystems/CPM/Structs.cs +++ b/DiscImageChef.Filesystems/CPM/Structs.cs @@ -176,8 +176,7 @@ namespace DiscImageChef.Filesystems.CPM /// <summary> /// Copyright string /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x1F)] - public byte[] copyright; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x1F)] public byte[] copyright; /// <summary> /// First cylinder of disk where this volume resides /// </summary> @@ -289,8 +288,7 @@ namespace DiscImageChef.Filesystems.CPM /// <summary> /// Label in ASCII /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] label; /// <summary> /// Label flags. Bit 0 = label exists, bit 4 = creation timestamp, bit 5 = modification timestamp, bit 6 = access timestamp, bit 7 = password enabled /// </summary> @@ -306,18 +304,15 @@ namespace DiscImageChef.Filesystems.CPM /// <summary> /// Password XOR'ed with <see cref="passwordDecoder"/> /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] password; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] password; /// <summary> /// Label creation time /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] ctime; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] ctime; /// <summary> /// Label modification time /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] mtime; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] mtime; } /// <summary> @@ -333,8 +328,7 @@ namespace DiscImageChef.Filesystems.CPM /// <summary> /// File 1 create/access timestamp /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] date1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] date1; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] /// <summary> /// File 1 modification timestamp @@ -348,13 +342,11 @@ namespace DiscImageChef.Filesystems.CPM /// <summary> /// File 2 create/access timestamp /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] date3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] date3; /// <summary> /// File 2 modification timestamp /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] date4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] date4; /// <summary> /// File 2 password mode /// </summary> @@ -363,13 +355,11 @@ namespace DiscImageChef.Filesystems.CPM /// <summary> /// File 3 create/access timestamp /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] date5; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] date5; /// <summary> /// File 3 modification timestamp /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] date6; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] date6; /// <summary> /// File 3 password mode /// </summary> @@ -390,13 +380,11 @@ namespace DiscImageChef.Filesystems.CPM /// <summary> /// Filename /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] filename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] filename; /// <summary> /// Extension /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] extension; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] extension; /// <summary> /// Password mode. Bit 7 = required for read, bit 6 = required for write, bit 5 = required for delete /// </summary> @@ -405,15 +393,12 @@ namespace DiscImageChef.Filesystems.CPM /// Password decoder byte /// </summary> public byte passwordDecoder; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] reserved; /// <summary> /// Password XOR'ed with <see cref="passwordDecoder"/> /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] password; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] reserved2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] password; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] reserved2; } /// <summary> @@ -430,48 +415,39 @@ namespace DiscImageChef.Filesystems.CPM /// <summary> /// Creation year for file 1 /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] create1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] create1; /// <summary> /// Modification time for file 1 /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] modify1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] modify1; /// <summary> /// Access time for file 1 /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] access1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] access1; /// <summary> /// Creation year for file 2 /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] create2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] create2; /// <summary> /// Modification time for file 2 /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] modify2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] modify2; /// <summary> /// Access time for file 2 /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] access2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] access2; /// <summary> /// Creation year for file 3 /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] create3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] create3; /// <summary> /// Modification time for file 3 /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] modify3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] modify3; /// <summary> /// Access time for file 3 /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] access3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] access3; } /// <summary> @@ -487,13 +463,11 @@ namespace DiscImageChef.Filesystems.CPM /// <summary> /// Filename and bit 7 as flags /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] filename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] filename; /// <summary> /// Extension and bit 7 as flags /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] extension; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] extension; /// <summary> /// Low byte of extent number /// </summary> @@ -514,8 +488,7 @@ namespace DiscImageChef.Filesystems.CPM /// <summary> /// Allocation blocks /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] allocations; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] allocations; } /// <summary> @@ -531,13 +504,11 @@ namespace DiscImageChef.Filesystems.CPM /// <summary> /// Filename and bit 7 as flags /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] filename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] filename; /// <summary> /// Extension and bit 7 as flags /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] extension; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] extension; /// <summary> /// Low byte of extent number /// </summary> @@ -558,9 +529,7 @@ namespace DiscImageChef.Filesystems.CPM /// <summary> /// Allocation blocks /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public ushort[] allocations; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public ushort[] allocations; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/CPM/Super.cs b/DiscImageChef.Filesystems/CPM/Super.cs index 2fa6ef50..63b6cedc 100644 --- a/DiscImageChef.Filesystems/CPM/Super.cs +++ b/DiscImageChef.Filesystems/CPM/Super.cs @@ -66,59 +66,75 @@ namespace DiscImageChef.Filesystems.CPM // Head changes after every track if(string.Compare(workingDefinition.order, "SIDES", StringComparison.InvariantCultureIgnoreCase) == 0) { - sectorMask = new int[workingDefinition.side1.sectorIds.Length + workingDefinition.side2.sectorIds.Length]; + sectorMask = new int[workingDefinition.side1.sectorIds.Length + + workingDefinition.side2.sectorIds.Length]; for(int m = 0; m < workingDefinition.side1.sectorIds.Length; m++) sectorMask[m] = workingDefinition.side1.sectorIds[m] - workingDefinition.side1.sectorIds[0]; // Skip first track (first side) for(int m = 0; m < workingDefinition.side2.sectorIds.Length; m++) - sectorMask[m + workingDefinition.side1.sectorIds.Length] = (workingDefinition.side2.sectorIds[m] - workingDefinition.side2.sectorIds[0]) + workingDefinition.side1.sectorIds.Length; + sectorMask[m + workingDefinition.side1.sectorIds.Length] = + (workingDefinition.side2.sectorIds[m] - workingDefinition.side2.sectorIds[0]) + + workingDefinition.side1.sectorIds.Length; } // Head changes after whole side - else if(string.Compare(workingDefinition.order, "CYLINDERS", StringComparison.InvariantCultureIgnoreCase) == 0) + else if(string.Compare(workingDefinition.order, "CYLINDERS", + StringComparison.InvariantCultureIgnoreCase) == 0) { for(int m = 0; m < workingDefinition.side1.sectorIds.Length; m++) sectorMask[m] = workingDefinition.side1.sectorIds[m] - workingDefinition.side1.sectorIds[0]; // Skip first track (first side) and first track (second side) for(int m = 0; m < workingDefinition.side1.sectorIds.Length; m++) - sectorMask[m + workingDefinition.side1.sectorIds.Length] = (workingDefinition.side1.sectorIds[m] - workingDefinition.side1.sectorIds[0]) + workingDefinition.side1.sectorIds.Length + workingDefinition.side2.sectorIds.Length; + sectorMask[m + workingDefinition.side1.sectorIds.Length] = + (workingDefinition.side1.sectorIds[m] - workingDefinition.side1.sectorIds[0]) + + workingDefinition.side1.sectorIds.Length + workingDefinition.side2.sectorIds.Length; // TODO: Implement CYLINDERS ordering DicConsole.DebugWriteLine("CP/M Plugin", "CYLINDERS ordering not yet implemented."); return Errno.NotImplemented; } // TODO: Implement COLUMBIA ordering - else if(string.Compare(workingDefinition.order, "COLUMBIA", StringComparison.InvariantCultureIgnoreCase) == 0) + else if( + string.Compare(workingDefinition.order, "COLUMBIA", StringComparison.InvariantCultureIgnoreCase) == + 0) { - DicConsole.DebugWriteLine("CP/M Plugin", "Don't know how to handle COLUMBIA ordering, not proceeding with this definition."); + DicConsole.DebugWriteLine("CP/M Plugin", + "Don't know how to handle COLUMBIA ordering, not proceeding with this definition."); return Errno.NotImplemented; } // TODO: Implement EAGLE ordering - else if(string.Compare(workingDefinition.order, "EAGLE", StringComparison.InvariantCultureIgnoreCase) == 0) + else if(string.Compare(workingDefinition.order, "EAGLE", StringComparison.InvariantCultureIgnoreCase) == + 0) { - DicConsole.DebugWriteLine("CP/M Plugin", "Don't know how to handle EAGLE ordering, not proceeding with this definition."); + DicConsole.DebugWriteLine("CP/M Plugin", + "Don't know how to handle EAGLE ordering, not proceeding with this definition."); return Errno.NotImplemented; } else { - DicConsole.DebugWriteLine("CP/M Plugin", "Unknown order type \"{0}\", not proceeding with this definition.", workingDefinition.order); + DicConsole.DebugWriteLine("CP/M Plugin", + "Unknown order type \"{0}\", not proceeding with this definition.", + workingDefinition.order); return Errno.NotSupported; } } // Deinterleave whole volume Dictionary<ulong, byte[]> deinterleavedSectors = new Dictionary<ulong, byte[]>(); - if(workingDefinition.sides == 1 || string.Compare(workingDefinition.order, "SIDES", StringComparison.InvariantCultureIgnoreCase) == 0) + if(workingDefinition.sides == 1 || + string.Compare(workingDefinition.order, "SIDES", StringComparison.InvariantCultureIgnoreCase) == 0) { DicConsole.DebugWriteLine("CP/M Plugin", "Deinterleaving whole volume."); for(int p = 0; p <= (int)(partition.End - partition.Start); p++) { - byte[] readSector = device.ReadSector((ulong)((int)partition.Start + (p / sectorMask.Length) * sectorMask.Length + sectorMask[p % sectorMask.Length])); + byte[] readSector = + device.ReadSector((ulong)((int)partition.Start + (p / sectorMask.Length) * sectorMask.Length + + sectorMask[p % sectorMask.Length])); if(workingDefinition.complement) { - for(int b = 0; b < readSector.Length; b++) - readSector[b] = (byte)(~readSector[b] & 0xFF); + for(int b = 0; b < readSector.Length; b++) readSector[b] = (byte)(~readSector[b] & 0xFF); } + deinterleavedSectors.Add((ulong)p, readSector); } } @@ -161,18 +177,15 @@ namespace DiscImageChef.Filesystems.CPM } } // CP/M blocks are same size than physical sectors - else - allocationBlocks.Add(blockNo++, sector); + else allocationBlocks.Add(blockNo++, sector); } DicConsole.DebugWriteLine("CP/M Plugin", "Reading directory."); int dirOff; int dirSectors = ((dpb.drm + 1) * 32) / workingDefinition.bytesPerSector; - if(workingDefinition.sofs > 0) - dirOff = workingDefinition.sofs; - else - dirOff = workingDefinition.ofs * workingDefinition.sectorsPerTrack; + if(workingDefinition.sofs > 0) dirOff = workingDefinition.sofs; + else dirOff = workingDefinition.ofs * workingDefinition.sectorsPerTrack; // Read the whole directory blocks MemoryStream dirMs = new MemoryStream(); @@ -182,16 +195,17 @@ namespace DiscImageChef.Filesystems.CPM deinterleavedSectors.TryGetValue((ulong)(d + dirOff), out sector); dirMs.Write(sector, 0, sector.Length); } + byte[] directory = dirMs.ToArray(); - if(directory == null) - return Errno.InvalidArgument; + if(directory == null) return Errno.InvalidArgument; int dirCnt = 0; string file1 = null; string file2 = null; string file3 = null; - Dictionary<string, Dictionary<int, List<ushort>>> fileExtents = new Dictionary<string, Dictionary<int, List<ushort>>>(); + Dictionary<string, Dictionary<int, List<ushort>>> fileExtents = + new Dictionary<string, Dictionary<int, List<ushort>>>(); statCache = new Dictionary<string, FileEntryInfo>(); cpmStat = new FileSystemInfo(); bool atime = false; @@ -236,17 +250,14 @@ namespace DiscImageChef.Filesystems.CPM validEntry &= entry.extension[i] >= 0x20; } - if(!validEntry) - continue; + if(!validEntry) continue; string filename = Encoding.ASCII.GetString(entry.filename).Trim(); string extension = Encoding.ASCII.GetString(entry.extension).Trim(); // If user is != 0, append user to name to have identical filenames - if(user > 0) - filename = string.Format("{0:X1}:{1}", user, filename); - if(!string.IsNullOrEmpty(extension)) - filename = filename + "." + extension; + if(user > 0) filename = string.Format("{0:X1}:{1}", user, filename); + if(!string.IsNullOrEmpty(extension)) filename = filename + "." + extension; int entryNo = ((32 * entry.extentCounter) + entry.extentCounterHigh) / (dpb.exm + 1); List<ushort> blocks; @@ -254,8 +265,7 @@ namespace DiscImageChef.Filesystems.CPM FileEntryInfo fInfo; // Do we have a stat for the file already? - if(statCache.TryGetValue(filename, out fInfo)) - statCache.Remove(filename); + if(statCache.TryGetValue(filename, out fInfo)) statCache.Remove(filename); else { fInfo = new FileEntryInfo(); @@ -263,24 +273,17 @@ namespace DiscImageChef.Filesystems.CPM } // And any extent? - if(fileExtents.TryGetValue(filename, out extentBlocks)) - fileExtents.Remove(filename); - else - extentBlocks = new Dictionary<int, List<ushort>>(); + if(fileExtents.TryGetValue(filename, out extentBlocks)) fileExtents.Remove(filename); + else extentBlocks = new Dictionary<int, List<ushort>>(); // Do we already have this extent? Should never happen - if(extentBlocks.TryGetValue(entryNo, out blocks)) - extentBlocks.Remove(entryNo); - else - blocks = new List<ushort>(); + if(extentBlocks.TryGetValue(entryNo, out blocks)) extentBlocks.Remove(entryNo); + else blocks = new List<ushort>(); // Attributes - if(hidden) - fInfo.Attributes |= FileAttributes.Hidden; - if(rdOnly) - fInfo.Attributes |= FileAttributes.ReadOnly; - if(system) - fInfo.Attributes |= FileAttributes.System; + if(hidden) fInfo.Attributes |= FileAttributes.Hidden; + if(rdOnly) fInfo.Attributes |= FileAttributes.ReadOnly; + if(system) fInfo.Attributes |= FileAttributes.System; // Supposedly there is a value in the directory entry telling how many blocks are designated in this entry // However some implementations tend to do whatever they wish, but none will ever allocate block 0 for a file @@ -289,8 +292,7 @@ namespace DiscImageChef.Filesystems.CPM // we must ignore it. foreach(ushort blk in entry.allocations) { - if(!blocks.Contains(blk) && blk != 0) - blocks.Add(blk); + if(!blocks.Contains(blk) && blk != 0) blocks.Add(blk); } // Save the file @@ -300,8 +302,7 @@ namespace DiscImageChef.Filesystems.CPM statCache.Add(filename, fInfo); // Add the file to the directory listing - if(!dirList.Contains(filename)) - dirList.Add(filename); + if(!dirList.Contains(filename)) dirList.Add(filename); // Count entries 3 by 3 for timestamps switch(dirCnt % 3) @@ -316,6 +317,7 @@ namespace DiscImageChef.Filesystems.CPM file3 = filename; break; } + dirCnt++; } else @@ -345,17 +347,14 @@ namespace DiscImageChef.Filesystems.CPM validEntry &= entry.extension[i] >= 0x20; } - if(!validEntry) - continue; + if(!validEntry) continue; string filename = Encoding.ASCII.GetString(entry.filename).Trim(); string extension = Encoding.ASCII.GetString(entry.extension).Trim(); // If user is != 0, append user to name to have identical filenames - if(user > 0) - filename = string.Format("{0:X1}:{1}", user, filename); - if(!string.IsNullOrEmpty(extension)) - filename = filename + "." + extension; + if(user > 0) filename = string.Format("{0:X1}:{1}", user, filename); + if(!string.IsNullOrEmpty(extension)) filename = filename + "." + extension; int entryNo = ((32 * entry.extentCounterHigh) + entry.extentCounter) / (dpb.exm + 1); List<ushort> blocks; @@ -363,8 +362,7 @@ namespace DiscImageChef.Filesystems.CPM FileEntryInfo fInfo; // Do we have a stat for the file already? - if(statCache.TryGetValue(filename, out fInfo)) - statCache.Remove(filename); + if(statCache.TryGetValue(filename, out fInfo)) statCache.Remove(filename); else { fInfo = new FileEntryInfo(); @@ -372,24 +370,17 @@ namespace DiscImageChef.Filesystems.CPM } // And any extent? - if(fileExtents.TryGetValue(filename, out extentBlocks)) - fileExtents.Remove(filename); - else - extentBlocks = new Dictionary<int, List<ushort>>(); + if(fileExtents.TryGetValue(filename, out extentBlocks)) fileExtents.Remove(filename); + else extentBlocks = new Dictionary<int, List<ushort>>(); // Do we already have this extent? Should never happen - if(extentBlocks.TryGetValue(entryNo, out blocks)) - extentBlocks.Remove(entryNo); - else - blocks = new List<ushort>(); + if(extentBlocks.TryGetValue(entryNo, out blocks)) extentBlocks.Remove(entryNo); + else blocks = new List<ushort>(); // Attributes - if(hidden) - fInfo.Attributes |= FileAttributes.Hidden; - if(rdOnly) - fInfo.Attributes |= FileAttributes.ReadOnly; - if(system) - fInfo.Attributes |= FileAttributes.System; + if(hidden) fInfo.Attributes |= FileAttributes.Hidden; + if(rdOnly) fInfo.Attributes |= FileAttributes.ReadOnly; + if(system) fInfo.Attributes |= FileAttributes.System; // Supposedly there is a value in the directory entry telling how many blocks are designated in this entry // However some implementations tend to do whatever they wish, but none will ever allocate block 0 for a file @@ -398,8 +389,7 @@ namespace DiscImageChef.Filesystems.CPM // we must ignore it. foreach(ushort blk in entry.allocations) { - if(!blocks.Contains(blk) && blk != 0) - blocks.Add(blk); + if(!blocks.Contains(blk) && blk != 0) blocks.Add(blk); } // Save the file @@ -409,8 +399,7 @@ namespace DiscImageChef.Filesystems.CPM statCache.Add(filename, fInfo); // Add the file to the directory listing - if(!dirList.Contains(filename)) - dirList.Add(filename); + if(!dirList.Contains(filename)) dirList.Add(filename); // Count entries 3 by 3 for timestamps switch(dirCnt % 3) @@ -425,6 +414,7 @@ namespace DiscImageChef.Filesystems.CPM file3 = filename; break; } + dirCnt++; } } @@ -439,23 +429,18 @@ namespace DiscImageChef.Filesystems.CPM int user = (entry.userNumber & 0x0F); - for(int i = 0; i < 8; i++) - entry.filename[i] &= 0x7F; - for(int i = 0; i < 3; i++) - entry.extension[i] &= 0x7F; + for(int i = 0; i < 8; i++) entry.filename[i] &= 0x7F; + for(int i = 0; i < 3; i++) entry.extension[i] &= 0x7F; string filename = Encoding.ASCII.GetString(entry.filename).Trim(); string extension = Encoding.ASCII.GetString(entry.extension).Trim(); // If user is != 0, append user to name to have identical filenames - if(user > 0) - filename = string.Format("{0:X1}:{1}", user, filename); - if(!string.IsNullOrEmpty(extension)) - filename = filename + "." + extension; + if(user > 0) filename = string.Format("{0:X1}:{1}", user, filename); + if(!string.IsNullOrEmpty(extension)) filename = filename + "." + extension; // Do not repeat passwords - if(passwordCache.ContainsKey(filename)) - passwordCache.Remove(filename); + if(passwordCache.ContainsKey(filename)) passwordCache.Remove(filename); // Copy whole password entry byte[] tmp = new byte[32]; @@ -475,6 +460,7 @@ namespace DiscImageChef.Filesystems.CPM file3 = filename; break; } + dirCnt++; } // Volume label and password entry. Volume password is ignored. @@ -508,15 +494,14 @@ namespace DiscImageChef.Filesystems.CPM file3 = null; break; } + dirCnt++; } // Timestamp entry else if((directory[dOff] & 0x7F) == 0x21) { // These places must be zero on CP/M 3 timestamp - if(directory[dOff + 10] == 0x00 && - directory[dOff + 20] == 0x00 && - directory[dOff + 30] == 0x00 && + if(directory[dOff + 10] == 0x00 && directory[dOff + 20] == 0x00 && directory[dOff + 30] == 0x00 && directory[dOff + 31] == 0x00) { DateEntry entry = new DateEntry(); @@ -530,15 +515,11 @@ namespace DiscImageChef.Filesystems.CPM // Entry contains timestamps for last 3 entries, whatever the kind they are. if(!string.IsNullOrEmpty(file1)) { - if(statCache.TryGetValue(file1, out fInfo)) - statCache.Remove(file1); - else - fInfo = new FileEntryInfo(); + if(statCache.TryGetValue(file1, out fInfo)) statCache.Remove(file1); + else fInfo = new FileEntryInfo(); - if(atime) - fInfo.AccessTime = DateHandlers.CPMToDateTime(entry.date1); - else - fInfo.CreationTime = DateHandlers.CPMToDateTime(entry.date1); + if(atime) fInfo.AccessTime = DateHandlers.CPMToDateTime(entry.date1); + else fInfo.CreationTime = DateHandlers.CPMToDateTime(entry.date1); fInfo.LastWriteTime = DateHandlers.CPMToDateTime(entry.date2); @@ -547,15 +528,11 @@ namespace DiscImageChef.Filesystems.CPM if(!string.IsNullOrEmpty(file2)) { - if(statCache.TryGetValue(file2, out fInfo)) - statCache.Remove(file2); - else - fInfo = new FileEntryInfo(); + if(statCache.TryGetValue(file2, out fInfo)) statCache.Remove(file2); + else fInfo = new FileEntryInfo(); - if(atime) - fInfo.AccessTime = DateHandlers.CPMToDateTime(entry.date3); - else - fInfo.CreationTime = DateHandlers.CPMToDateTime(entry.date3); + if(atime) fInfo.AccessTime = DateHandlers.CPMToDateTime(entry.date3); + else fInfo.CreationTime = DateHandlers.CPMToDateTime(entry.date3); fInfo.LastWriteTime = DateHandlers.CPMToDateTime(entry.date4); @@ -564,15 +541,11 @@ namespace DiscImageChef.Filesystems.CPM if(!string.IsNullOrEmpty(file3)) { - if(statCache.TryGetValue(file3, out fInfo)) - statCache.Remove(file3); - else - fInfo = new FileEntryInfo(); + if(statCache.TryGetValue(file3, out fInfo)) statCache.Remove(file3); + else fInfo = new FileEntryInfo(); - if(atime) - fInfo.AccessTime = DateHandlers.CPMToDateTime(entry.date5); - else - fInfo.CreationTime = DateHandlers.CPMToDateTime(entry.date5); + if(atime) fInfo.AccessTime = DateHandlers.CPMToDateTime(entry.date5); + else fInfo.CreationTime = DateHandlers.CPMToDateTime(entry.date5); fInfo.LastWriteTime = DateHandlers.CPMToDateTime(entry.date6); @@ -598,10 +571,8 @@ namespace DiscImageChef.Filesystems.CPM // Entry contains timestamps for last 3 entries, whatever the kind they are. if(!string.IsNullOrEmpty(file1)) { - if(statCache.TryGetValue(file1, out fInfo)) - statCache.Remove(file1); - else - fInfo = new FileEntryInfo(); + if(statCache.TryGetValue(file1, out fInfo)) statCache.Remove(file1); + else fInfo = new FileEntryInfo(); byte[] ctime = new byte[4]; ctime[0] = entry.create1[0]; @@ -616,10 +587,8 @@ namespace DiscImageChef.Filesystems.CPM if(!string.IsNullOrEmpty(file2)) { - if(statCache.TryGetValue(file2, out fInfo)) - statCache.Remove(file2); - else - fInfo = new FileEntryInfo(); + if(statCache.TryGetValue(file2, out fInfo)) statCache.Remove(file2); + else fInfo = new FileEntryInfo(); byte[] ctime = new byte[4]; ctime[0] = entry.create2[0]; @@ -634,10 +603,8 @@ namespace DiscImageChef.Filesystems.CPM if(!string.IsNullOrEmpty(file3)) { - if(statCache.TryGetValue(file1, out fInfo)) - statCache.Remove(file3); - else - fInfo = new FileEntryInfo(); + if(statCache.TryGetValue(file1, out fInfo)) statCache.Remove(file3); + else fInfo = new FileEntryInfo(); byte[] ctime = new byte[4]; ctime[0] = entry.create3[0]; @@ -668,8 +635,7 @@ namespace DiscImageChef.Filesystems.CPM MemoryStream fileMs = new MemoryStream(); FileEntryInfo fInfo = new FileEntryInfo(); - if(statCache.TryGetValue(filename, out fInfo)) - statCache.Remove(filename); + if(statCache.TryGetValue(filename, out fInfo)) statCache.Remove(filename); fInfo.Blocks = 0; @@ -712,8 +678,7 @@ namespace DiscImageChef.Filesystems.CPM { byte[] tmp = new byte[8]; Array.Copy(kvp.Value, 16, tmp, 0, 8); - for(int t = 0; t < 8; t++) - tmp[t] ^= kvp.Value[13]; + for(int t = 0; t < 8; t++) tmp[t] ^= kvp.Value[13]; decodedPasswordCache.Add(kvp.Key, tmp); } @@ -746,8 +711,7 @@ namespace DiscImageChef.Filesystems.CPM xmlFSType.FreeClusters = cpmStat.FreeBlocks; xmlFSType.FreeClustersSpecified = true; xmlFSType.Type = "CP/M filesystem"; - if(!string.IsNullOrEmpty(label)) - xmlFSType.VolumeName = label; + if(!string.IsNullOrEmpty(label)) xmlFSType.VolumeName = label; mounted = true; return Errno.NoError; @@ -759,8 +723,7 @@ namespace DiscImageChef.Filesystems.CPM /// <param name="stat">Information about the mounted volume.</param> public override Errno StatFs(ref FileSystemInfo stat) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; stat = cpmStat; @@ -773,7 +736,7 @@ namespace DiscImageChef.Filesystems.CPM definitions = null; cpmFound = false; workingDefinition = null; - dpb = null; + dpb = null; sectorMask = null; label = null; thirdPartyTimestamps = false; @@ -783,5 +746,4 @@ namespace DiscImageChef.Filesystems.CPM return Errno.NoError; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/CPM/Xattr.cs b/DiscImageChef.Filesystems/CPM/Xattr.cs index 82d70e61..9ecd57c6 100644 --- a/DiscImageChef.Filesystems/CPM/Xattr.cs +++ b/DiscImageChef.Filesystems/CPM/Xattr.cs @@ -46,26 +46,21 @@ namespace DiscImageChef.Filesystems.CPM /// <param name="buf">Buffer.</param> public override Errno GetXattr(string path, string xattr, ref byte[] buf) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; - if(!fileCache.ContainsKey(pathElements[0].ToUpperInvariant())) - return Errno.NoSuchFile; + if(!fileCache.ContainsKey(pathElements[0].ToUpperInvariant())) return Errno.NoSuchFile; if(string.Compare(xattr, "com.caldera.cpm.password", StringComparison.InvariantCulture) == 0) { - if(!passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf)) - return Errno.NoError; + if(!passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf)) return Errno.NoError; } if(string.Compare(xattr, "com.caldera.cpm.password.text", StringComparison.InvariantCulture) == 0) { - if(!passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf)) - return Errno.NoError; + if(!passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf)) return Errno.NoError; } return Errno.NoSuchExtendedAttribute; @@ -79,19 +74,15 @@ namespace DiscImageChef.Filesystems.CPM /// <param name="xattrs">List of extended attributes, alternate data streams and forks.</param> public override Errno ListXAttr(string path, ref List<string> xattrs) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; - if(!fileCache.ContainsKey(pathElements[0].ToUpperInvariant())) - return Errno.NoSuchFile; + if(!fileCache.ContainsKey(pathElements[0].ToUpperInvariant())) return Errno.NoSuchFile; xattrs = new List<string>(); - if(passwordCache.ContainsKey(pathElements[0].ToUpperInvariant())) - xattrs.Add("com.caldera.cpm.password"); + if(passwordCache.ContainsKey(pathElements[0].ToUpperInvariant())) xattrs.Add("com.caldera.cpm.password"); if(decodedPasswordCache.ContainsKey(pathElements[0].ToUpperInvariant())) xattrs.Add("com.caldera.cpm.password.text"); @@ -99,5 +90,4 @@ namespace DiscImageChef.Filesystems.CPM return Errno.NoError; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/CPM/cpmdefs.xml b/DiscImageChef.Filesystems/CPM/cpmdefs.xml index 61b0bc22..67f27d32 100644 --- a/DiscImageChef.Filesystems/CPM/cpmdefs.xml +++ b/DiscImageChef.Filesystems/CPM/cpmdefs.xml @@ -1,21848 +1,21849 @@ <?xml version="1.0" encoding="utf-8"?> + <CpmDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <definitions> - <CpmDefinition> - <comment>Generic CP/M - SSSD 8" - 128 x 26</comment> - <encoding>FM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>128</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>25</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>23</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>21</int> - <int>2</int> - <int>8</int> - <int>14</int> - <int>20</int> - <int>26</int> - <int>6</int> - <int>12</int> - <int>18</int> - <int>24</int> - <int>4</int> - <int>10</int> - <int>16</int> - <int>22</int> - </sectorIds> - </side1> - <label>A1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>242</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>ABC-80 - SSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>8</int> - <int>15</int> - <int>6</int> - <int>13</int> - <int>4</int> - <int>11</int> - <int>2</int> - <int>9</int> - <int>16</int> - <int>7</int> - <int>14</int> - <int>5</int> - <int>12</int> - <int>3</int> - <int>10</int> - </sectorIds> - </side1> - <label>ABC1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>151</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>A. B. Dick Magna III - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - <int>21</int> - <int>22</int> - <int>23</int> - <int>24</int> - <int>25</int> - <int>26</int> - <int>27</int> - <int>28</int> - <int>29</int> - <int>30</int> - <int>31</int> - <int>32</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ABD1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>255</dsm> - <drm>255</drm> - <al0>255</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Actrix (Access Matrix) - SSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side1> - <label>ACT1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Actrix (Access Matrix) - DSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ACT2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>174</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Adler Textriter - SSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - </sectorIds> - </side1> - <label>ADL1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>159</dsm> - <drm>31</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Advanced Digital Super 6 - SSDD 48 tpi 5.25" - 1024 x 4</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>4</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - </sectorIds> - </side1> - <label>ADV1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>77</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Advanced Digital Super 6 - DSDD 48 tpi 5.25" - 1024 x 4</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>4</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ADV2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>155</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Advanced Digital Super 6 - DSDD 96 tpi 5.25" - 1024 x 4</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>4</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ADV3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>300</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Advanced Digital Super 8 - DSDD 8" - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ADV4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>608</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Advanced Digital TurboDOS 312K - DSDD 48 tpi 5.25" - 1024 x 4</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>4</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ADV5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>155</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Advanced Digital TurboDOS 366K - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ADV6</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>182</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Advanced Controls - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ADV7</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>385</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Allen-Bradley Advisor+ - DSDD 3.5" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ALL1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>318</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>1</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Alspa - SSDD 8" - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <label>ALS1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>300</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Altos - SSSD 8" - 128 x 26</comment> - <encoding>FM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>128</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>25</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>23</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>21</int> - <int>2</int> - <int>8</int> - <int>14</int> - </sectorIds> - </side1> - <label>ALT1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>242</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Altos - DSSD 8" - 128 x 26</comment> - <encoding>FM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>128</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>25</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>23</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>21</int> - <int>2</int> - <int>8</int> - <int>14</int> - <int>20</int> - <int>26</int> - <int>6</int> - <int>12</int> - <int>18</int> - <int>24</int> - <int>4</int> - <int>10</int> - <int>16</int> - <int>22</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>25</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>23</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>21</int> - <int>2</int> - <int>8</int> - <int>14</int> - <int>20</int> - <int>26</int> - <int>6</int> - <int>12</int> - <int>18</int> - <int>24</int> - <int>4</int> - <int>10</int> - <int>16</int> - <int>22</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ALT2</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>122</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Altos - SSDD 8" - 512 x 15</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>15</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side1> - <label>ALT3</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>139</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Altos - DSDD 8" - 512 x 15</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>15</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ALT4</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>1</exm> - <dsm>284</dsm> - <drm>255</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Altos Series 5 - DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ALT5</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>176</dsm> - <drm>176</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amigo - SSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <label>AMI1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>189</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amigo - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AMI2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>195</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Ampro - SSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <label>AMP1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>94</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Ampro - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - <int>21</int> - <int>22</int> - <int>23</int> - <int>24</int> - <int>25</int> - <int>26</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - <int>21</int> - <int>22</int> - <int>23</int> - <int>24</int> - <int>25</int> - <int>26</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AMP2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Ampro - SSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <label>AMP3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Ampro - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - <int>21</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - <int>21</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AMP4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>394</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad PCW 8256 - SSDD 48 tpi 3.00"</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <label>AMS0</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>175</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad PCW 8256 - DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AMS1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>356</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad CPC464 - SSDD 48 tpi 5.25"/3" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>65</int> - <int>66</int> - <int>67</int> - <int>68</int> - <int>69</int> - <int>70</int> - <int>71</int> - <int>72</int> - <int>73</int> - </sectorIds> - </side1> - <label>AMS2</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>171</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad CPC464 - SSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>65</int> - <int>66</int> - <int>67</int> - <int>68</int> - <int>69</int> - <int>70</int> - <int>71</int> - <int>72</int> - <int>73</int> - </sectorIds> - </side1> - <label>AMS3</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>87</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad PCW 8512 - DSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AMS5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>356</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad CPC 6128 - DSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>65</int> - <int>66</int> - <int>67</int> - <int>68</int> - <int>69</int> - <int>70</int> - <int>71</int> - <int>72</int> - <int>73</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>65</int> - <int>66</int> - <int>67</int> - <int>68</int> - <int>69</int> - <int>70</int> - <int>71</int> - <int>72</int> - <int>73</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AMS7</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>175</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad CPC 6128 - DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>65</int> - <int>66</int> - <int>67</int> - <int>68</int> - <int>69</int> - <int>70</int> - <int>71</int> - <int>72</int> - <int>73</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>65</int> - <int>66</int> - <int>67</int> - <int>68</int> - <int>69</int> - <int>70</int> - <int>71</int> - <int>72</int> - <int>73</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AMS8</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>175</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad CPC 6128 Side 1 - SSDD 3.5" / 3" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>193</int> - <int>194</int> - <int>195</int> - <int>196</int> - <int>197</int> - <int>198</int> - <int>199</int> - <int>200</int> - <int>201</int> - </sectorIds> - </side1> - <label>AMS9</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>180</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad CPC 6128 Side 2 - SSDD 3.5" / 3" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>193</int> - <int>194</int> - <int>195</int> - <int>196</int> - <int>197</int> - <int>198</int> - <int>199</int> - <int>200</int> - <int>201</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>193</int> - <int>194</int> - <int>195</int> - <int>196</int> - <int>197</int> - <int>198</int> - <int>199</int> - <int>200</int> - <int>201</int> - </sectorIds> - </side2> - <label>AMSA</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>180</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>80</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad PCW w/DU49, Moonstone XFORMAT - DSDD 3.5" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AMSB</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>198</dsm> - <drm>255</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad CPC 6128 Vortex - DSDD 3.5"/96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AMSC</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>178</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Archive I - SSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>2</int> - <int>5</int> - <int>3</int> - </sectorIds> - </side1> - <label>ARC1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Archive II & III - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>2</int> - <int>5</int> - <int>3</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>2</int> - <int>5</int> - <int>3</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ARC2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>394</dsm> - <drm>319</drm> - <al0>248</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>true</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Arisia - SSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - </sectorIds> - </side1> - <label>ARI1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>147</dsm> - <drm>127</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Associate - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ASO1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>195</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Aster CT-80 - DSDD 96 tpi 5.25" - 1024 x 5, 3:1</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AST1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>394</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>ATR-8000 - SSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <label>ATR1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>189</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>ATR-8000 - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ATR2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>189</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>ATR-8000 - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>ATR3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>189</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>ATT-7700 - DSDD 3.5" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>17</int> - <int>19</int> - <int>21</int> - <int>23</int> - <int>25</int> - <int>27</int> - <int>29</int> - <int>31</int> - <int>18</int> - <int>20</int> - <int>22</int> - <int>24</int> - <int>26</int> - <int>28</int> - <int>30</int> - <int>32</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ATT1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>316</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Avatar - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>4</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>4</int> - <int>8</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>AVA1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>191</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Barudan - DSDD 3.5" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>BAR1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>155</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Beehive - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>BEE1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Beehive Microbee - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>2</int> - <int>5</int> - <int>8</int> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>2</int> - <int>5</int> - <int>8</int> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>BEE2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Beehive Microbee - SSDD 3.5" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>2</int> - <int>5</int> - <int>8</int> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side1> - <label>BEE3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Microbee Systems - DSDD 3.5" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>22</int> - <int>25</int> - <int>28</int> - <int>21</int> - <int>24</int> - <int>27</int> - <int>30</int> - <int>23</int> - <int>26</int> - <int>29</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>22</int> - <int>25</int> - <int>28</int> - <int>21</int> - <int>24</int> - <int>27</int> - <int>30</int> - <int>23</int> - <int>26</int> - <int>29</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>BEE4</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Microbee Dreamdisk format - DSDD 3.5" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>2</int> - <int>5</int> - <int>8</int> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>2</int> - <int>5</int> - <int>8</int> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>BEE5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>391</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Computer Bell - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>BEL1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>192</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Big Board (512 bytes/sector) - SSDD 8" - 512 x 15</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>15</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side1> - <label>BIG1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>280</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Big Board (512 bytes/sector) - DSDD 8" - 512 x 15</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>15</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>BIG2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>569</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Big Board SWP 1024 bytes/sector - SSDD 8" - 1024 x 9</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <label>BIG4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>336</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Bitelex - SSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side1> - <label>BIT1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>131</dsm> - <drm>95</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>BMC IF800 Model 20 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>3</int> - <int>9</int> - <int>15</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>3</int> - <int>9</int> - <int>15</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>BMC1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>191</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Bondwell 12 - SSDD 48 tpi 5.25" - 256 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <label>BON1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>84</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Bondwell 14 - DSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>BON2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>174</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Bondwell 2 - SSDD 3.5" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <label>BON3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>174</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>BOSS TurboDOS - DSDD 8" - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>BOS1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>616</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>BTI Systems - DSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>BTI1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>175</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Burr-Brown - DSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>10</int> - <int>2</int> - <int>11</int> - <int>3</int> - <int>12</int> - <int>4</int> - <int>13</int> - <int>5</int> - <int>14</int> - <int>6</int> - <int>15</int> - <int>7</int> - <int>16</int> - <int>8</int> - <int>17</int> - <int>9</int> - <int>18</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>10</int> - <int>2</int> - <int>11</int> - <int>3</int> - <int>12</int> - <int>4</int> - <int>13</int> - <int>5</int> - <int>14</int> - <int>6</int> - <int>15</int> - <int>7</int> - <int>16</int> - <int>8</int> - <int>17</int> - <int>9</int> - <int>18</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>BUR1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Cal-PC - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CAL1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Cashcom 100 - DSDD 96 tpi 5.25" - 1024 x 4</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>4</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CAS1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>303</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Commodore Business Machines 1581 drive - DSDD 3.5" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CBM1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>397</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CCS (256 bytes/sector) - DSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>17</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>18</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>17</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>18</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CCS1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>165</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CCS (512 bytes/sector) - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>2</int> - <int>5</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>2</int> - <int>5</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CCS2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>184</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CCS (1024 bytes/sector) - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CCS3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>184</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CCS 8 - DSDD 8" - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CCS4</label> - <bsh>6</bsh> - <blm>63</blm> - <exm>7</exm> - <dsm>149</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CCS 2442 - SSDD 8" - 512 x 15</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>15</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>4</int> - <int>8</int> - <int>12</int> - </sectorIds> - </side1> - <label>CCS5</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>139</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CCS (1024 bytes alternate) - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CCS6</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>184</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CDC-110 Viking - DSDD 8" - 512 x 16</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CDC1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>608</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CDI-5000 - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>2</int> - <int>5</int> - <int>3</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>2</int> - <int>5</int> - <int>3</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CDI1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>COLEX 850 - SSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>4</int> - <int>8</int> - </sectorIds> - </side1> - <label>CLX1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>COLEX 850 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>4</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>11</int> - <int>15</int> - <int>19</int> - <int>13</int> - <int>17</int> - <int>12</int> - <int>16</int> - <int>20</int> - <int>14</int> - <int>18</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CLX2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>389</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CMC Supersystem 2 - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CMC1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>391</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Coin - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>COI1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>392</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Coleco ADAM, 40 track - SSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>3</int> - <int>8</int> - <int>5</int> - <int>2</int> - <int>7</int> - <int>4</int> - </sectorIds> - </side1> - <label>COL1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>146</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>26</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Coleco ADAM, 254K - DSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>3</int> - <int>8</int> - <int>5</int> - <int>2</int> - <int>7</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>3</int> - <int>8</int> - <int>5</int> - <int>2</int> - <int>7</int> - <int>4</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>COL2</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>255</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>26</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Coleco ADAM, 320K - DSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>3</int> - <int>8</int> - <int>5</int> - <int>2</int> - <int>7</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>3</int> - <int>8</int> - <int>5</int> - <int>2</int> - <int>7</int> - <int>4</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>COL3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>152</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>26</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Coleco ADAM, 720K - DSDD 3.5" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>4</int> - <int>8</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>4</int> - <int>8</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>COL4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>354</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>26</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Coleco ADAM, 360K - DSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>COL5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>179</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>4</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Coleco ADAM, E&T PROM 720K - DSDD 3.5" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>4</int> - <int>8</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>4</int> - <int>8</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>COL6</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>354</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>26</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Coleco ADAM, 720K - DSDD 3.5" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>4</int> - <int>8</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>4</int> - <int>8</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>COL7</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>358</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>4</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Coleco ADAM, 1.44M - DSHD 3.5" - 512 x 18</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>15</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>18</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>16</int> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>17</int> - <int>3</int> - <int>7</int> - <int>11</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>17</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>18</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>COL8</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>712</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Coleco Adam TDOS - DSDD 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>3</int> - <int>8</int> - <int>5</int> - <int>2</int> - <int>7</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>3</int> - <int>8</int> - <int>5</int> - <int>2</int> - <int>7</int> - <int>4</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>COL9</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>255</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>26</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Columbia Commander 964 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>COLUMBIA</order> - <label>COLA</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>190</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Columbia 1600 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>COLUMBIA</order> - <label>COLB</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>197</dsm> - <drm>255</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Columbia M64 - SSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <label>COLC</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>190</dsm> - <drm>127</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>true</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Compis - DSDD 96 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>COM1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>317</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Compugraphic MCS-5 - SSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <label>COM2</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>155</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Compustar Model 30 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>35</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>COM3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>169</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>true</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Compupro (Viasyn) - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>COM7</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>389</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Compupro (Viasyn) 8/16 - SSDD 8" - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - </sectorIds> - </side1> - <label>COM8</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>299</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Compupro (Viasyn) 8/16 - DSDD 8" - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>COM9</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>599</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Compupro (Viasyn) - SSDD 8" - 512 x 15</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>15</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>4</int> - <int>8</int> - <int>12</int> - </sectorIds> - </side1> - <label>COMA</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>280</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Compupro (Viasyn) - SSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>10</int> - <int>19</int> - <int>2</int> - <int>11</int> - <int>20</int> - <int>3</int> - <int>12</int> - <int>21</int> - <int>4</int> - <int>13</int> - <int>22</int> - <int>5</int> - <int>14</int> - <int>23</int> - <int>6</int> - </sectorIds> - </side1> - <label>COMB</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>242</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Compupro (Viasyn) 256 bytes/sector - DSHD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>10</int> - <int>19</int> - <int>2</int> - <int>11</int> - <int>20</int> - <int>3</int> - <int>12</int> - <int>21</int> - <int>4</int> - <int>13</int> - <int>22</int> - <int>5</int> - <int>14</int> - <int>23</int> - <int>6</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>10</int> - <int>19</int> - <int>2</int> - <int>11</int> - <int>20</int> - <int>3</int> - <int>12</int> - <int>21</int> - <int>4</int> - <int>13</int> - <int>22</int> - <int>5</int> - <int>14</int> - <int>23</int> - <int>6</int> - </sectorIds> - </side2> - <label>COME</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>487</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPT Phoenix CP/M - DSDD 3.5" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CPT1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>355</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Cromemco CDOS - SSSD 48 tpi 5.25" - 128 x 18</comment> - <encoding>FM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>128</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>11</int> - <int>16</int> - <int>3</int> - <int>8</int> - <int>13</int> - <int>18</int> - <int>5</int> - <int>10</int> - <int>15</int> - <int>2</int> - <int>7</int> - <int>12</int> - <int>17</int> - <int>4</int> - <int>9</int> - <int>14</int> - </sectorIds> - </side1> - <label>CRO1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>82</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Cromemco CDOS - DSSD 48 tpi 5.25" - 128 x 18</comment> - <encoding>FM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>128</sectorsPerTrack> - <bytesPerSector>18</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>11</int> - <int>16</int> - <int>3</int> - <int>8</int> - <int>13</int> - <int>18</int> - <int>5</int> - <int>10</int> - <int>15</int> - <int>2</int> - <int>7</int> - <int>12</int> - <int>17</int> - <int>4</int> - <int>9</int> - <int>14</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>11</int> - <int>16</int> - <int>3</int> - <int>8</int> - <int>13</int> - <int>18</int> - <int>5</int> - <int>10</int> - <int>15</int> - <int>2</int> - <int>7</int> - <int>12</int> - <int>17</int> - <int>4</int> - <int>9</int> - <int>14</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CRO2</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>172</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Cromemco CDOS - SSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>4</int> - <int>8</int> - </sectorIds> - </side1> - <label>CRO3</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>189</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Cromemco CDOS - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>4</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>4</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CRO4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Cromemco CDOS - DSDD 8" - 512 x 16</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>12</int> - <int>7</int> - <int>2</int> - <int>13</int> - <int>8</int> - <int>3</int> - <int>14</int> - <int>9</int> - <int>4</int> - <int>15</int> - <int>10</int> - <int>5</int> - <int>16</int> - <int>11</int> - <int>6</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>12</int> - <int>7</int> - <int>2</int> - <int>13</int> - <int>8</int> - <int>3</int> - <int>14</int> - <int>9</int> - <int>4</int> - <int>15</int> - <int>10</int> - <int>5</int> - <int>16</int> - <int>11</int> - <int>6</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CRO5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>608</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Cromemco CP/M - SSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>2</int> - <int>5</int> - <int>8</int> - </sectorIds> - </side1> - <label>CRO6</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>94</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Cromemco CP/M - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>2</int> - <int>5</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>2</int> - <int>5</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CRO7</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Cykey - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>CYK1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>153</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Datavue DV80 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>129</int> - <int>130</int> - <int>131</int> - <int>132</int> - <int>133</int> - <int>134</int> - <int>135</int> - <int>136</int> - <int>137</int> - <int>138</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>129</int> - <int>130</int> - <int>131</int> - <int>132</int> - <int>133</int> - <int>134</int> - <int>135</int> - <int>136</int> - <int>137</int> - <int>138</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DAT1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>94</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Datavue DV80 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>193</int> - <int>194</int> - <int>195</int> - <int>196</int> - <int>197</int> - <int>198</int> - <int>199</int> - <int>200</int> - <int>201</int> - <int>202</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>193</int> - <int>194</int> - <int>195</int> - <int>196</int> - <int>197</int> - <int>198</int> - <int>199</int> - <int>200</int> - <int>201</int> - <int>202</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DAT2</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Davidge - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DAV1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>384</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>DEC DECMate II - SSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <label>DEC1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>195</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>DEC VT-180 - SSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - </sectorIds> - </side1> - <label>DEC3</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Dictaphone 6000 CP/M - DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DIC1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>352</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Dictaphone 6000 CP/M - DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DIC2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>345</dsm> - <drm>319</drm> - <al0>248</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Digilog 2500 - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>35</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>DIG1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>166</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Digilog 1500 - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>DIG2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>392</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Digitech 500 series - SSDD 3.5" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <label>DIG3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>199</dsm> - <drm>319</drm> - <al0>248</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Digitech 500 series - DSDD 3.5" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DIG4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>398</dsm> - <drm>319</drm> - <al0>248</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Digital Group, TVC-80 FDC - SSDD 8" - 1024 x 9</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <label>DIG5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>342</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Dimension 68000 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DIM1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>195</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Direct 1025 - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DIR1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>152</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Discovery - DSDD 96 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DIS1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>313</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Duet CP/M - DSDD 96tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DUE1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>355</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Eagle I, II - SSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <label>EAG1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>191</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Eagle III, IV, V - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>EAG2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>394</dsm> - <drm>191</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Electroglas/Xynetics - DSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <order>EAGLE</order> - <label>ELE1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>158</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Electroglas/Xynetics - DSDD 3.5" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <order>SIDES</order> - <label>ELE2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>397</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Epson QX-10 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>EPS1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>189</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Epson QX-10 (256 bytes/sector) - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>EPS2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>139</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>8</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Epson PX-10/8 - DSDD 3.5" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>EPS3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>139</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>8</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Epson QX-16 640K - DSDD 3.5" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>EPS4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>304</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>8</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Epson QX-16 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>EPS5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>389</dsm> - <drm>255</drm> - <al0>252</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Ericsson DTC - SSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <label>ERI1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>77</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Ericsson DTC - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>ERI2</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>157</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Ericsson Step One - DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ERI3</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>174</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Estimation Inc. EST101 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>EST1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>394</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Everett/Charles Kryterion 165 - DSDD 8" - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>EVE1</label> - <bsh>6</bsh> - <blm>63</blm> - <exm>3</exm> - <dsm>151</dsm> - <drm>255</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Eureka A4 - DSDD 3.5" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>2</int> - <int>5</int> - <int>8</int> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>2</int> - <int>5</int> - <int>8</int> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>EUR1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>399</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Exidy Sorcerer - SSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>11</int> - <int>16</int> - <int>5</int> - <int>10</int> - <int>15</int> - <int>4</int> - <int>9</int> - <int>14</int> - <int>3</int> - <int>8</int> - <int>13</int> - <int>2</int> - <int>7</int> - <int>12</int> - </sectorIds> - </side1> - <label>EXI1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>76</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>33</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>EXO - SSDD 8" - 512 x 16</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <label>EXO1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>149</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>EXO - DSDD 8" - 512 x 15</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>15</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>EXO2</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>1</exm> - <dsm>303</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Florida Graphics - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>FLO1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>295</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>12</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Formula 1 - DSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>5</int> - <int>6</int> - <int>9</int> - <int>10</int> - <int>13</int> - <int>14</int> - <int>17</int> - <int>18</int> - <int>3</int> - <int>4</int> - <int>7</int> - <int>8</int> - <int>11</int> - <int>12</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>5</int> - <int>6</int> - <int>9</int> - <int>10</int> - <int>13</int> - <int>14</int> - <int>17</int> - <int>18</int> - <int>3</int> - <int>4</int> - <int>7</int> - <int>8</int> - <int>11</int> - <int>12</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>FOR1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>172</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Fujitsu Micro 8 - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>FUJ2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>151</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Future FX-20 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>4</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>FUT1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>196</dsm> - <drm>95</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Gemini Galaxy - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>GEM1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>196</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Globe 101 - DSDD 96 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>GLO1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>319</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>13</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Gnat System 10 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>35</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>GNA1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>169</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Graco OM-5000 - DSHD 5.25" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <label>GRA1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>248</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Hagiwara HPU 801 CP/M 68K - DSDD 3.5" Special - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - <int>21</int> - <int>22</int> - <int>23</int> - <int>24</int> - <int>25</int> - <int>26</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - <int>21</int> - <int>22</int> - <int>23</int> - <int>24</int> - <int>25</int> - <int>26</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>HAG1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>486</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Hazeltine - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>HAZ1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>379</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>HCL System 2 - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>HCL1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>388</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Heath H89, Magnolia CP/M - SSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <label>HEA1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>82</dsm> - <drm>95</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Heath H89, Magnolia CP/M - DSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>HEA2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>172</dsm> - <drm>95</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Heath H89, Magnolia CP/M - DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>HEA3</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>176</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Heurikon MLZ-91A - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>5</int> - <int>6</int> - <int>9</int> - <int>10</int> - <int>13</int> - <int>14</int> - <int>3</int> - <int>4</int> - <int>7</int> - <int>8</int> - <int>11</int> - <int>12</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>5</int> - <int>6</int> - <int>9</int> - <int>10</int> - <int>13</int> - <int>14</int> - <int>3</int> - <int>4</int> - <int>7</int> - <int>8</int> - <int>11</int> - <int>12</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>HEU1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>315</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Hewlett-Packard HP86/87/120/125 - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>HEW1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>251</dsm> - <drm>127</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Hewlett Packard HP 125 - SSSD 8" - 256 x 16</comment> - <encoding>FM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>66</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>6</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side1> - <label>HEW2</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>251</dsm> - <drm>127</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Hewlett Packard HP 125 - SSDD 3.5" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>66</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>6</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side1> - <label>HEW3</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>251</dsm> - <drm>127</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Hitachi HPC-6000 CP/M 68K - DSHD 1.2M 3.5" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - <int>21</int> - <int>22</int> - <int>23</int> - <int>24</int> - <int>25</int> - <int>26</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - <int>21</int> - <int>22</int> - <int>23</int> - <int>24</int> - <int>25</int> - <int>26</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>HIT1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>242</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Hitachi R-1500 CP/M 68K - DSHD 1.2M 5.25" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - <int>21</int> - <int>22</int> - <int>23</int> - <int>24</int> - <int>25</int> - <int>26</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - <int>21</int> - <int>22</int> - <int>23</int> - <int>24</int> - <int>25</int> - <int>26</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>HIT2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>494</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Strippit Houdaille Fab/V - DSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>HOU1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>174</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>IBM PC, CP/M-86 - SSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <label>IBM1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>155</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>IBM PC, CP/M-86 - DSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>IBM2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>157</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>IBS Ultraframe Turbo DOS - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>IBS1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>397</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>IBEX 7300 - DSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>IBX1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>246</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>IBEX 7301 - DSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>25</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>23</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>21</int> - <int>2</int> - <int>8</int> - <int>14</int> - <int>20</int> - <int>26</int> - <int>6</int> - <int>12</int> - <int>18</int> - <int>24</int> - <int>4</int> - <int>10</int> - <int>16</int> - <int>22</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>25</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>23</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>21</int> - <int>2</int> - <int>8</int> - <int>14</int> - <int>20</int> - <int>26</int> - <int>6</int> - <int>12</int> - <int>18</int> - <int>24</int> - <int>4</int> - <int>10</int> - <int>16</int> - <int>22</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>IBX2</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>2</exm> - <dsm>242</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>ICL DRS 20 - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>11</int> - <int>16</int> - <int>5</int> - <int>10</int> - <int>15</int> - <int>4</int> - <int>9</int> - <int>14</int> - <int>3</int> - <int>8</int> - <int>13</int> - <int>2</int> - <int>7</int> - <int>12</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>11</int> - <int>16</int> - <int>5</int> - <int>10</int> - <int>15</int> - <int>4</int> - <int>9</int> - <int>14</int> - <int>3</int> - <int>8</int> - <int>13</int> - <int>2</int> - <int>7</int> - <int>12</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ICL1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>158</dsm> - <drm>255</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>ICL DRS 300 - DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ICL2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>350</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>ICL Model 35/36 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ICL3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>391</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>36</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>IMS 5000 - SSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>9</int> - <int>2</int> - <int>10</int> - <int>3</int> - <int>11</int> - <int>4</int> - <int>12</int> - <int>5</int> - <int>13</int> - <int>6</int> - <int>14</int> - <int>7</int> - <int>15</int> - <int>8</int> - <int>16</int> - </sectorIds> - </side1> - <label>IMS1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>147</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>IMS 5000 TurboDOS - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>IMS2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>390</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>IMS 5000 TurboDOS - SSDD 8" - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <label>IMS3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>308</dsm> - <drm>191</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>IMS 5000 CP/M - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>IMS4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>395</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Intel iPDS 100 - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>INT1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>307</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Intuit - SSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <label>INT2</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>190</dsm> - <drm>127</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Insight Enterprises - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>INS1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>155</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Ithaca Intersystems - SSDD 96 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>5</int> - <int>6</int> - <int>9</int> - <int>10</int> - <int>13</int> - <int>14</int> - <int>17</int> - <int>18</int> - <int>3</int> - <int>4</int> - <int>7</int> - <int>8</int> - <int>11</int> - <int>12</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <label>ITH1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>174</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Ithaca Intersystems - SSDD 8" - 512 x 15</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>15</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>4</int> - <int>8</int> - <int>12</int> - </sectorIds> - </side1> - <label>ITH2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>284</dsm> - <drm>191</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Ithaca Intersystems - DSDD 8" - 512 x 15</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>15</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>4</int> - <int>8</int> - <int>12</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>4</int> - <int>8</int> - <int>12</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ITH3</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>1</exm> - <dsm>284</dsm> - <drm>255</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>ITT 3030 - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>35</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>ITT1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>247</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>ITT 3030 - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>70</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>ITT2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>270</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sel ITT 3030 - 70 Tracks 560 kB - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>70</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>ITT3030</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>271</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Jonos - SSDD 3.5" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>70</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <label>JON1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>152</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Kaypro II/2 - SSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <label>KAY1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>194</dsm> - <drm>63</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Kaypro 2X/4/10 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>KAY2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>196</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Kaypro 2X/4/10 (Alternate) - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>KAY3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>196</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Kaypro, Pro-8 ROM - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>20</int> - <int>21</int> - <int>22</int> - <int>23</int> - <int>24</int> - <int>25</int> - <int>26</int> - <int>27</int> - <int>28</int> - <int>29</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>KAY4</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>196</dsm> - <drm>95</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Kaypro Advent TurboROM - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>KAY5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>195</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Kaypro Advent TurboROM - SSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <label>KAY6</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>185</dsm> - <drm>31</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Kaypro Advent TurboROM - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>21</int> - <int>22</int> - <int>23</int> - <int>24</int> - <int>25</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>KAY7</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>395</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Kontron - DSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>19</int> - <int>22</int> - <int>25</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>18</int> - <int>21</int> - <int>24</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - <int>17</int> - <int>20</int> - <int>23</int> - <int>26</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>19</int> - <int>22</int> - <int>25</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>18</int> - <int>21</int> - <int>24</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - <int>17</int> - <int>20</int> - <int>23</int> - <int>26</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>KON1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>489</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Kontron/Zeiss - DSDD 96 tpi 5.25" - 128 x 16</comment> - <encoding>FM</encoding> - <bitrate>LOW</bitrate> - <cylinders>35</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>128</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>KON2</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>106</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>17</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Kontron Transient Recorder- DSDD 96 tpi 5.25"/3.5" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>KON3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>299</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Lanier LTD READ-ONLY - DSDD 96 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <label>LAN1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>318</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Lexoriter - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - </sectorIds> - </side2> - <label>LEX2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>159</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Lobo Max-80 - SSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <label>LOB1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>165</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Lobo Max-80 (256) - DSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>LOB2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>172</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Lobo Max-80 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>LOB3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>191</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Lobo Max-80 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>LOB4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>391</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Lobo CP/M 2.2 - SSHD 8" - 256 x 30</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>30</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - </sectorIds> - </side1> - <label>LOB5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>280</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>LNW 2 - SSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>11</int> - <int>16</int> - <int>3</int> - <int>8</int> - <int>13</int> - <int>18</int> - <int>5</int> - <int>10</int> - <int>15</int> - <int>2</int> - <int>7</int> - <int>12</int> - <int>17</int> - <int>4</int> - <int>9</int> - <int>14</int> - </sectorIds> - </side1> - <label>LNW1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>82</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Lockheed-Martin Wire Harness Tester - DSDD 3.5" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>2</int> - <int>5</int> - <int>3</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>2</int> - <int>5</int> - <int>3</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>LOC1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>394</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Macsym 150 - SSDD 96 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <label>MAC1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>155</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>MAI Basic Four - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>MAI1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>312</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Marconi Midata 510 - DSDD 3.5" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>MAR1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>197</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Memotech MaxBP - DSDD 3.5" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>MEM1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>394</dsm> - <drm>191</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Memotech FDX - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>MEM2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>156</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>26</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Micro Source M6000 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>4</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>11</int> - <int>15</int> - <int>19</int> - <int>13</int> - <int>17</int> - <int>12</int> - <int>16</int> - <int>20</int> - <int>14</int> - <int>18</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>MIC6</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>189</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Michels and Kleberhoff CP/M 3 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>MIC7</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>394</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>true</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Michels and Kleberhoff CP/M 3 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>35</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>MIC8</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>true</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>MicroMint SB180 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>27</int> - <int>28</int> - <int>29</int> - <int>30</int> - <int>31</int> - <int>32</int> - <int>33</int> - <int>34</int> - <int>35</int> - <int>36</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>27</int> - <int>28</int> - <int>29</int> - <int>30</int> - <int>31</int> - <int>32</int> - <int>33</int> - <int>34</int> - <int>35</int> - <int>36</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>MM7</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>200</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Molecular Series 9 - DSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <order>SIDES</order> - <label>MOL1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>179</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Molecular/Durango Poppy 54 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>128</int> - <int>129</int> - <int>130</int> - <int>131</int> - <int>132</int> - <int>133</int> - <int>134</int> - <int>135</int> - <int>136</int> - <int>137</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>138</int> - <int>139</int> - <int>140</int> - <int>141</int> - <int>142</int> - <int>143</int> - <int>144</int> - <int>145</int> - <int>146</int> - <int>147</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>MOL2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>389</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Molecular - SSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>25</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>23</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>21</int> - <int>2</int> - <int>8</int> - <int>14</int> - </sectorIds> - </side1> - <label>MOL3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>249</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Monroe 8800 Series - SSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>16</int> - </sectorIds> - </side1> - <label>MON1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>153</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Monroe System 2000 - DSDD 96 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>MON2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>315</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Morrow MD2 - SSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>2</int> - <int>5</int> - <int>3</int> - </sectorIds> - </side1> - <label>MOR1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>94</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Morrow MD3, 5, 11, 16, 34 - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>2</int> - <int>5</int> - <int>3</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>2</int> - <int>5</int> - <int>3</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>MOR2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>191</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Morrow TurboDOS - DSDD 48 tpi 5.25" - 1024 x 4</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>4</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>MOR6</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>155</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Morrow MD3...CP/M Plus - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>2</int> - <int>5</int> - <int>3</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>2</int> - <int>5</int> - <int>3</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>MOR7</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Morrow 5/11/34 - SSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>2</int> - <int>5</int> - <int>3</int> - </sectorIds> - </side1> - <label>MOR8</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>92</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>MOS 80 - DSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>10</int> - <int>19</int> - <int>2</int> - <int>11</int> - <int>20</int> - <int>3</int> - <int>12</int> - <int>21</int> - <int>4</int> - <int>13</int> - <int>22</int> - <int>5</int> - <int>14</int> - <int>23</int> - <int>6</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>10</int> - <int>19</int> - <int>2</int> - <int>11</int> - <int>20</int> - <int>3</int> - <int>12</int> - <int>21</int> - <int>4</int> - <int>13</int> - <int>22</int> - <int>5</int> - <int>14</int> - <int>23</int> - <int>6</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>MOS1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>0</exm> - <dsm>244</dsm> - <drm>251</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Multitech MIC-540 - DSDD 96 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>MUL1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>356</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>MUPD/MDISK, Side I - SSSD 96 tpi 5.25" - 256 x 10</comment> - <encoding>FM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - </sectorIds> - </side1> - <label>MUP1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>96</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>MUPD/MDISK, Side II - SSSD 96 tpi 5.25" - 256 x 10</comment> - <encoding>FM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>MUP2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>96</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>83</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>MSD Systems PSC-1 POS - DSDD 96 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>MSD1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>158</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>NCHQ System II - SSSD 48tpi 5.25" - 128 x 18</comment> - <encoding>FM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>128</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>17</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - <int>18</int> - </sectorIds> - </side1> - <label>NCH1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>84</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>NCR Decision Mate V - DSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>NCR1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>153</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>NCR FirstStep - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>16</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>15</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>14</int> - <int>2</int> - <int>6</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>16</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>15</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>14</int> - <int>2</int> - <int>6</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>NCR2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>275</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>NEC PC-8801A - DSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>6</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - <int>21</int> - <int>22</int> - <int>23</int> - <int>24</int> - <int>25</int> - <int>26</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - <int>21</int> - <int>22</int> - <int>23</int> - <int>24</int> - <int>25</int> - <int>26</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>NEC2</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>242</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>NEC PC-8801A - DSDD 8" - 512 x 15</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>15</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>6</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>NEC3</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>1</exm> - <dsm>280</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>NEC PC-8801A - DSDD 8" - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>NEC4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>599</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>NEC PC-8001A - SSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <label>NEC5</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>151</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>NEC PC-8001B - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>NEC6</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>151</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>NEC PC 8801A - DSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>NEC8</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>151</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>NEC PC 8801A - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <label>NEC9</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>189</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>NEC PC 8500/8431A, Starlet - DSDD 3.5" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <label>NECA</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>151</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>NEC APC CP/M-86 - DSHD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>19</int> - <int>22</int> - <int>25</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - <int>17</int> - <int>20</int> - <int>23</int> - <int>26</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>18</int> - <int>21</int> - <int>24</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>19</int> - <int>22</int> - <int>25</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - <int>17</int> - <int>20</int> - <int>23</int> - <int>26</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>18</int> - <int>21</int> - <int>24</int> - </sectorIds> - </side2> - <label>NECC</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>494</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>NEC APC TurboDOS - SSDD 8" - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <label>NECD</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>308</dsm> - <drm>224</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>New Brain - SSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <label>NEW1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>97</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Niat - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>16</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>NIA1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>157</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Nixdorf 8810/30 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>NIX1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>384</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Norsonic 830/836 - DSDD 3.5" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>NOR1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>199</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Numeridex 7000 - DSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>25</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>23</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>21</int> - <int>2</int> - <int>8</int> - <int>14</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>28</int> - <int>34</int> - <int>40</int> - <int>46</int> - <int>52</int> - <int>32</int> - <int>38</int> - <int>44</int> - <int>50</int> - <int>30</int> - <int>36</int> - <int>42</int> - <int>48</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>NUM1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>248</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Octagon 8/16 - SSDD 8" - 1024 x 9</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <label>OCT1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>1</exm> - <dsm>167</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>OEM Screen Typist - SSDD 3.5" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <label>OEM1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>94</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Olivetti ETV300 - SSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>17</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - <int>18</int> - </sectorIds> - </side1> - <label>OLI1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Olivetti M20 - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>OLI2</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>255</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Olivetti 250, CWP1 - SSDD 3.5" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side1> - <order>SIDES</order> - <label>OLI3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>157</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Olivetti ETV 1010, CP/M 86 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>OLI5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>198</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Olivetti ETV 112 - SSDD 3.5" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>17</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - <int>18</int> - </sectorIds> - </side1> - <label>OLI6</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>174</dsm> - <drm>191</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Olympia EX-100 - DSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>OLY1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>174</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Olympia ETX II - SSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <label>OLY2</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>170</dsm> - <drm>127</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Olympia Olytext 20 - DSDD 3.5" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>OLY3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>312</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Osborne 1 - SSSD 48 tpi 5.25" - 256 x 10</comment> - <encoding>FM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <label>OSB1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>45</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Osborne 1 - SSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <label>OSB2</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>184</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Osborne G2 System - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>OSB4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>189</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Osborne G2 System - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>OSB5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>389</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Osborne 1 + Osmosis - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>OSB6</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>384</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Osborne Nuevo - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>6</int> - <int>8</int> - <int>10</int> - <int>7</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>OSB7</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Osborne Vixen - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>OSB8</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Osborne Executive w/Z3 - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>OSB9</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>395</dsm> - <drm>127</drm> - <al0>248</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Osborne Executive Dig. Arts - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>OSBA</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>248</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Osborne Nuevo 2.1 - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>OSBB</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>394</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>OSM Zeus 4 - DSDD 96 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>OSM1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>311</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Otrona Attache - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>OTR1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>181</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Otrona Attache - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>OTR2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>386</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Potter & Brumfield - SSSD 48 tpi 5.25" - 128 x 18</comment> - <encoding>FM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>128</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>17</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>18</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>16</int> - </sectorIds> - </side1> - <label>PB1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>83</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Pegasus Data Logger - DSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>PEG1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>People's World Computer - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>PEO1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>398</dsm> - <drm>127</drm> - <al0>120</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>People's World Computer Boot - SSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>PEO2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>397</dsm> - <drm>127</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Pericom - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>PER1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>395</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Philips PC-2010 - SSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side1> - <label>PHI1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>151</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Philips PC-2012 - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>PHI2</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>157</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Philips PC-3000 - 3004 - SSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - </sectorIds> - </side1> - <label>PHI3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>147</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Physical Acoutstics - DSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>PHY1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>173</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Pied Piper - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>PIE1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>391</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Proglas 770K - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>PRO1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>388</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Pulsar LBB - SSHD 8" - 512 x 17</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>17</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - <int>17</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - </sectorIds> - </side1> - <label>PUL1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>317</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Research Machines Limited 380Z - 128 x 16</comment> - <encoding>FM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>128</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - </sectorIds> - </side1> - <label>RML1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>74</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Royal Alphatronic - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ROY1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>151</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sage IV - DSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>SAG1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>155</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sage IV - DSDD 96 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SAG2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>315</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sanyo MBC-1000, MBC-1150 - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SAN1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>155</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sanyo MBC-2000 - SSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>11</int> - <int>16</int> - <int>5</int> - <int>10</int> - <int>15</int> - <int>4</int> - <int>9</int> - <int>14</int> - <int>3</int> - <int>8</int> - <int>13</int> - <int>2</int> - <int>7</int> - <int>12</int> - </sectorIds> - </side1> - <label>SAN3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>152</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sanyo MBC-3000 - DSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>25</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>23</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>21</int> - <int>2</int> - <int>8</int> - <int>14</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>25</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>23</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>21</int> - <int>2</int> - <int>8</int> - <int>14</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SAN4</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>237</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sanco 8001 - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side2> - <label>SAN5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>194</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Schneider CPC 6128 Side 1 - DSDD 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>193</int> - <int>194</int> - <int>195</int> - <int>196</int> - <int>197</int> - <int>198</int> - <int>199</int> - <int>200</int> - <int>201</int> - </sectorIds> - </side1> - <label>SCH1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>180</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Schneider CPC 6128 Side 2 - DSDD 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>193</int> - <int>194</int> - <int>195</int> - <int>196</int> - <int>197</int> - <int>198</int> - <int>199</int> - <int>200</int> - <int>201</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>193</int> - <int>194</int> - <int>195</int> - <int>196</int> - <int>197</int> - <int>198</int> - <int>199</int> - <int>200</int> - <int>201</int> - </sectorIds> - </side2> - <label>SCH2</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>180</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>40</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>S.D. Systems 40 track - SSDD 3.5" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - </sectorIds> - </side1> - <label>SDS1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>84</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>S.D. Systems 80 track - DSDD 3.5" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <order>SIDES</order> - <label>SDS2</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>0</exm> - <dsm>176</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>S.D. Systems 80 track - SSDD 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - </sectorIds> - </side1> - <label>SDS3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>175</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>S.D. Systems - SSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>1</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>17</int> - <int>21</int> - <int>25</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>19</int> - <int>23</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>18</int> - <int>22</int> - <int>26</int> - </sectorIds> - </side1> - <label>SDS4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>240</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Seiko - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SEI1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>315</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>SemiDisk DT42 - DSHD 96 tpi 5.25" - 512 x 15</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>15</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SEM3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>562</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sharp MZ-80 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SHA1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>169</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>true</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sharp MZ-80B - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>1</sideId> - <sectorIds> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SHA2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>195</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>true</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sharp 3500/5500 - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SHA3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>151</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sharp 5600 - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SHA4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>312</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sharp MZ 3541 - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <order>SIDES</order> - <label>SHA5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Shelton SIG/NET 2 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SHL2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>195</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>true</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Shelton SIG/NET 2 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SHL3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>395</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>true</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Siemens PG-685 DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SIE1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>350</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Siemens PG-675 DSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SIE2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Silver-Reed WP System - DSDD 3.5" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>2</int> - <int>4</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SIL1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>189</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Smart Aleck - SSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - </sectorIds> - </side1> - <label>SMA1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sorbus TurboDOS - 5.25" DSHD (or 8" DSDD) - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SOR1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>1</exm> - <dsm>308</dsm> - <drm>255</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sony SMC-70 - SSDD 3.5" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>70</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - </sectorIds> - </side1> - <label>SON1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>135</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Spectravideo 318/328 - SSDD 48 tpi 5.25" - 256 x 17</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>17</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <label>SPE1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>156</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Spectravideo SV-328 - DSDD 48 tpi 5.25" - 256 x 17</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>17</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>SPE2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>162</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Sperry UTS 30, UTS 5000 - DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SPE2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>354</dsm> - <drm>383</drm> - <al0>252</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Spectravideo - SSDD 48 tpi 5.25" - 256 x 17</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>17</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <label>SPE3</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>157</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Spectravideo - DSDD 48 tpi 5.25" - 256 x 17</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>17</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>SPE4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>163</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Spectravideo - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SPE5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>197</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Spectravideo - SSDD 3.5" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <label>SPE6</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>163</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Superbrain JR - SSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>35</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <label>SUP1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>81</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>true</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Superbrain 40 track - SSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <label>SUP2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>94</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>true</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Superbrain QD - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>35</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>SUP3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>169</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>true</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Superbrain II - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>SUP4</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>196</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>true</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Superbrain - SSDD 48 tpi 5.25" - 128 x 30</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>30</sectorsPerTrack> - <bytesPerSector>128</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>19</int> - <int>22</int> - <int>25</int> - <int>28</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - <int>17</int> - <int>20</int> - <int>23</int> - <int>26</int> - <int>29</int> - </sectorIds> - </side1> - <label>SUP5</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>142</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>true</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>System Group 2800 - DSDD 8" - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SYS1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>1</exm> - <dsm>303</dsm> - <drm>255</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Tarbell - DSDD 8" - 512 x 15</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>15</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>12</int> - <int>13</int> - <int>14</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>12</int> - <int>13</int> - <int>14</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TAR1</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>0</exm> - <dsm>303</dsm> - <drm>169</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Tatung TPC2000 - DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>TAT1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>354</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Techron TEF 10 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>2</int> - <int>5</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>2</int> - <int>5</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TEC1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>394</dsm> - <drm>319</drm> - <al0>248</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Techron TEF 12 - DSHD 96 tpi 5.25" - 512 x 17</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>17</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TEC2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>670</dsm> - <drm>767</drm> - <al0>255</al0> - <al1>240</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Tektronix 4170 - DSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>TEK1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>153</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Teletek - SSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>25</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>23</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>21</int> - <int>2</int> - <int>8</int> - <int>14</int> - </sectorIds> - </side1> - <label>TEL1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>242</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Teletek Systemaster - DSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>2</int> - <int>8</int> - <int>14</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>4</int> - <int>10</int> - <int>16</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>6</int> - <int>12</int> - <int>18</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>2</int> - <int>8</int> - <int>14</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>4</int> - <int>10</int> - <int>16</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>6</int> - <int>12</int> - <int>18</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>TEL2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>172</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Teletek Systemaster - DSDD 96 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>2</int> - <int>8</int> - <int>14</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>4</int> - <int>10</int> - <int>16</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>6</int> - <int>12</int> - <int>18</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>2</int> - <int>8</int> - <int>14</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>4</int> - <int>10</int> - <int>16</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>6</int> - <int>12</int> - <int>18</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>TEL3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>353</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TeleVideo 8nn/TPC-1 CP/M - DSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>6</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TEL4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TeleVideo 1603 - DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TEL5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>354</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TeleVideo 806 TurboDOS - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TEL6</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>200</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TeleVideo 8nn TurboDOS - DSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>6</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TEL7</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Timex/Sinclair 2068+AERCO FD-68 RP/M - DSDD 48 tpi 5.25" -1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TIM1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>189</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Tokyo Electron 80W - DSHD 3.5" - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TOK1</label> - <bsh>6</bsh> - <blm>63</blm> - <exm>3</exm> - <dsm>160</dsm> - <drm>255</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Toshiba T100, T200 - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TOS1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>255</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>6</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Toshiba 300 - DSDD 96 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TOS2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>318</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Toshiba T-250 - DSHD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>19</int> - <int>22</int> - <int>25</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - <int>17</int> - <int>20</int> - <int>23</int> - <int>26</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>18</int> - <int>21</int> - <int>24</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>10</int> - <int>13</int> - <int>16</int> - <int>19</int> - <int>22</int> - <int>25</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>11</int> - <int>14</int> - <int>17</int> - <int>20</int> - <int>23</int> - <int>26</int> - <int>3</int> - <int>6</int> - <int>9</int> - <int>12</int> - <int>15</int> - <int>18</int> - <int>21</int> - <int>24</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TOS3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>487</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Transtec - SSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <label>TRA1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TRS-80 Model 1, Omikron CP/M - SSSD 48 tpi 5.25" - 128 x 18</comment> - <encoding>FM</encoding> - <bitrate>LOW</bitrate> - <cylinders>35</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>128</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>13</int> - <int>17</int> - <int>3</int> - <int>7</int> - <int>11</int> - <int>15</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>14</int> - <int>18</int> - <int>4</int> - <int>8</int> - <int>12</int> - <int>16</int> - </sectorIds> - </side1> - <label>TRS1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>71</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TRS-80 Model 1, Bigmem CP/M - SSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>7</int> - <int>13</int> - <int>19</int> - <int>25</int> - <int>5</int> - <int>11</int> - <int>17</int> - <int>23</int> - <int>3</int> - <int>9</int> - <int>15</int> - <int>21</int> - <int>2</int> - <int>8</int> - <int>14</int> - </sectorIds> - </side1> - <label>TRS2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>243</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TRS-80 Model 1, ColorPower II - SSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - </sectorIds> - </side1> - <label>TRS3</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TRS-80, Pickles & Trout CP/M - SSDD 8" - 512 x 16</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <label>TRS6</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>299</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TRS-80, Holmes CP/M - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TRS7</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>190</dsm> - <drm>63</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TRS-80, MM CP/M - SSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <label>TRS8</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>94</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TRS-80 Model 4, 4P; MT CP/M - SSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>17</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - <int>18</int> - </sectorIds> - </side1> - <label>TRS9</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>84</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TRS-80 Model 4, 4P; MT CP/M - DSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>17</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - <int>18</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>17</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - <int>18</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TRSA</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>174</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TRS-80 Model 4, 4P - SSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <label>TRSB</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>155</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TRS-80 Model 4P-Montezuma800K - DSDD 96tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TRSD</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>399</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TRS-80 II/12/16 Aton CP/M - DSHD 8" - 1024 x 8</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>4</int> - <int>7</int> - <int>2</int> - <int>5</int> - <int>8</int> - <int>3</int> - <int>6</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>TRSF</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>608</dsm> - <drm>191</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TRS-80 II/12/16 Pickles & Trout - DSHD 8" - 512 x 16</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>4</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>TRSG</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>608</dsm> - <drm>191</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>TRS-80 Model 4, Montezuma - DSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>17</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - <int>18</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>11</int> - <int>13</int> - <int>15</int> - <int>17</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - <int>10</int> - <int>12</int> - <int>14</int> - <int>16</int> - <int>18</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>TRSH</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>174</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>U-Micro 1000 - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>UMI1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>395</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Varian Spectra AA/20, DS-15 - DSDD 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>VAR1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>317</dsm> - <drm>63</drm> - <al0>96</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>2</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Vector 4 - DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <order>EAGLE</order> - <label>VEC1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>356</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Visual 1050 - SSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <label>VIS1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Wangwriter - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>WAN1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>155</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Wave Mate Bullet - SSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <label>WAV1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>189</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Wave Mate Bullet - DSDD 96 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>WAV2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>394</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Wave Mate Bullet - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>WAV3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Wave Mate Bullet - SSHD 8" - 1024 x 9</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <label>WAV4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>336</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xerox - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>XER1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>170</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xerox 820 - SSSD 48 tpi 5.25" - 128 x 18</comment> - <encoding>FM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>128</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>11</int> - <int>16</int> - <int>3</int> - <int>8</int> - <int>13</int> - <int>18</int> - <int>5</int> - <int>10</int> - <int>15</int> - <int>2</int> - <int>7</int> - <int>12</int> - <int>17</int> - <int>4</int> - <int>9</int> - <int>14</int> - </sectorIds> - </side1> - <label>XER2</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>83</dsm> - <drm>31</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xerox 820 II - SSDD 48 tpi 5.25" - 256 x 17</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>17</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <label>XER3</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>156</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xerox 820-II, 16/8 - DSDD 48 tpi 5.25" - 256 x 17</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>17</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>XER4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>162</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xerox 16/8 - SSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <label>XER5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>242</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>XEROX 16/8 - DSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <order>CYLINDERS</order> - <label>XER7</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>162</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xerox 820, S/W Publishers DD - SSDD 48 tpi 5.25" - 256 x 18</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>18</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - </sectorIds> - </side1> - <label>XER8</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>166</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xerox 3700 Laser Printer - DSDD 48 tpi 5.25" - 256 x 17</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>17</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <order>CYLINDERS</order> - <label>XER9</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>162</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xerox 16/8, 820 II - SSDD 48 tpi 5.25"</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>17</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <label>XERB</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>156</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xerox 16/8 - SSDD 48 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <label>XERC</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xerox 16/8 Special - SSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <label>XERD</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>151</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xerox 16/8, 820-II - DSDD 48 tpi 5.25" - 256 x 17</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>17</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <order>EAGLE</order> - <label>XERE</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>162</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xerox 16/8 Special - DSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <order>CYLINDERS</order> - <label>XERF</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>155</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xerox 3700 Laser Printer - DSDD 48 tpi 5.25" - 256 x 17</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>17</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>XERG</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>162</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Xor 5 - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>2</int> - <int>7</int> - <int>3</int> - <int>8</int> - <int>4</int> - <int>9</int> - <int>5</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>6</int> - <int>2</int> - <int>7</int> - <int>3</int> - <int>8</int> - <int>4</int> - <int>9</int> - <int>5</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>XOR1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>191</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>XYZ - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>5</int> - <int>9</int> - <int>3</int> - <int>7</int> - <int>2</int> - <int>6</int> - <int>10</int> - <int>4</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>11</int> - <int>15</int> - <int>19</int> - <int>13</int> - <int>17</int> - <int>12</int> - <int>16</int> - <int>20</int> - <int>14</int> - <int>18</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>XYZ1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zeiss Video Analysis System - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>ZEI1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>299</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zenith Z-37 Disk - SSSD 48 tpi 5.25" - 256 x 10</comment> - <encoding>FM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <label>ZEN1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>91</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zenith Z-37 Disk - DSDD 96 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ZEN2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>315</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zenith Z89, Heath H89 - DSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ZEN3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>155</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zenith Z90 - SSDD 48 tpi 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <label>ZEN5</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>151</dsm> - <drm>127</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zenith Z-100 - SSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <label>ZEN7</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>151</dsm> - <drm>127</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zenith Z-100 - DSDD 48 tpi 5.25" - 512 x 8</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ZEN8</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>155</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zenith Z-100 - SSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>10</int> - <int>19</int> - <int>2</int> - <int>11</int> - <int>20</int> - <int>3</int> - <int>12</int> - <int>21</int> - <int>4</int> - <int>13</int> - <int>22</int> - <int>5</int> - <int>14</int> - <int>23</int> - <int>6</int> - </sectorIds> - </side1> - <label>ZENA</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>242</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zenith Z-37 Disk - DSDD 96 (Half drive) 5.25" - 256 x 16</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ZENB</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>155</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zenith/Heath H-89 Ext Density - DSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ZENC</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>195</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zenith Z-100, Heath H-47 - DSDD 8" - 256 x 26</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>2</sides> - <sectorsPerTrack>26</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>10</int> - <int>19</int> - <int>2</int> - <int>11</int> - <int>20</int> - <int>3</int> - <int>12</int> - <int>21</int> - <int>4</int> - <int>13</int> - <int>22</int> - <int>5</int> - <int>14</int> - <int>23</int> - <int>6</int> - <int>15</int> - <int>24</int> - <int>7</int> - <int>16</int> - <int>25</int> - <int>8</int> - <int>17</int> - <int>26</int> - <int>9</int> - <int>18</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>10</int> - <int>19</int> - <int>2</int> - <int>11</int> - <int>20</int> - <int>3</int> - <int>12</int> - <int>21</int> - <int>4</int> - <int>13</int> - <int>22</int> - <int>5</int> - <int>14</int> - <int>23</int> - <int>6</int> - <int>15</int> - <int>24</int> - <int>7</int> - <int>16</int> - <int>25</int> - <int>8</int> - <int>17</int> - <int>26</int> - <int>9</int> - <int>18</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ZENE</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>497</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zenith Z-37 - SSDD 48 tpi 5.25" - 1024 x 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <label>ZENF</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>190</dsm> - <drm>127</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zenith/Heath H89/H90 Magnolia 7736 - SSHD 8" - 512 x 16</comment> - <encoding>MFM</encoding> - <bitrate>HIGH</bitrate> - <cylinders>77</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <label>ZENH</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>299</dsm> - <drm>191</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zorba - DSDD 48 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ZOR1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Zorba - DSDD 96 tpi 5.25" - 512 x 10</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ZOR2</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>194</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>PIC-DISK SSDD 96tpi 3.5"</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>1</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>3</int> - <int>5</int> - <int>7</int> - <int>9</int> - <int>2</int> - <int>4</int> - <int>6</int> - <int>8</int> - </sectorIds> - </side1> - <label>PIC1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>194</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>SAM COUPE Pro-DOS - DSDD 160 tpi 3.5"</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>A2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>356</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Acorn CPM</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>CYLINDERS</order> - <label>ACPM</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>200</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC 178K Data 40trk 9sct 64dir 1Kpb Side 2</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>DA1B</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>179</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>40</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC 187K Data 42trk 9sct 64dir 1Kpb Side 2</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>42</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>DA2B</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>188</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>42</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC-B360 358K Data 80trk 9sct 64dir 2Kpb Side 1</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - </sectorIds> - </side1> - <label>DA4A</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>179</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC-B360 358K Data 80trk 9sct 64dir 2Kpb Side 2</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>DA4B</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>179</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>80</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC 356K Data 40trk 9sct 128dir 2Kpb Two Sides</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DAT5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>179</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>DOBBERTIN 716K Data 80trk 9sct 128dir 4Kpb Two Sides</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>0</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>0</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DDOB</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>179</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC-STD 169K System 40trk 9sct 64dir 1Kpb Side 1</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side1> - <label>SY1A</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC 169K System 40trk 9sct 64dir 1Kpb Side 2</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>SY1B</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>42</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC 178K System 42trk 9sct 64dir 1Kpb Side 1</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>42</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side1> - <label>SY2A</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>179</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC 178K System 42trk 9sct 64dir 1Kpb Side 2</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>42</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>SY2B</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>179</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>44</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC 253K System 60trk 9sct 64dir 1Kpb Side 1 </comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>60</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side1> - <label>SY3A</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>254</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC 253K System 60trk 9sct 64dir 1Kpb Side 2</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>60</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>SY3B</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>254</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>62</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC-B360 348K System 80trk 9sct 64dir 2Kpb Side 1</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side1> - <label>SY4A</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>174</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC-B360 348K System 80trk 9sct 64dir 2Kpb Side 2</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>SY4B</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>174</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>82</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC 346K System 40trk 9sct 128dir 2Kpb Two Sides</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SYS5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>174</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC 344K System 80trk 9sct 128dir 4Kpb Side 1</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side1> - <label>SY6A</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>86</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC 344K System 80trk 9sct 128dir 4Kpb Side 2</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>SY6B</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>86</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>82</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>DOBBERTIN 704K System 80trk 9sct 128dir 4Kpb Two Sides</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SDOB</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>176</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>ReadBIG 706K System 80trk 9sct 128dir 2Kpb Two Sides</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>41</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SBIG</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>354</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC-STD 154K Ibm-Cpm86 40trk 8sct 64dir 1Kpb Side 1</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - </sectorIds> - </side1> - <label>IB1A</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>155</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>CPC 154K Ibm-Cpm86 40trk 8sct 64dir 1Kpb Side 2</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>8</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>IB1B</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>155</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>41</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>PCW-STD 173K Format 40trk 9sct 64dir 1Kpb Side 1</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <label>PC1A</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>174</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>PCW 173K Format 40trk 9sct 64dir 1Kpb Side 2</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>EAGLE</order> - <label>PC1B</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>174</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>41</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>PCW 346K Format 40trk 9sct 256dir 2Kpb Two Sides</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>PCW2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>176</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>PCW 706K Format 80trk 9sct 256dir 2Kpb Two Sides</comment> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <label>PCW3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>356</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>PCW 784K Format 80trk 10sct 256dir 4Kpb Two Sides</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DXT3</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>197</dsm> - <drm>255</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>DiskPara3 796K Format 80trk 10sct 128dir 2Kpb Two Sides</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DXT4</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>399</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>DiskPara 824K Format 83trk 10sct 192dir 2Kpb Two Sides</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>83</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>0</sideId> - <sectorIds> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - <int>17</int> - <int>18</int> - <int>19</int> - <int>20</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>DXT5</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>414</dsm> - <drm>191</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>VORTEX 704K Format 80trk 9sct 128dir 4Kpb Two Sides</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>VRTX</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>176</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>RAMDOS-D1 716K Format 80trk 9sct 128dir 2Kpb Two Sides </comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>RDD1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>359</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>RAMDOS-D10 796K Format 80trk 10sct 128dir 2Kpb Two Sides</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>11</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>11</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>RD10</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>399</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>RAMDOS-D2 712K Format 80trk 9sct 256dir 2Kpb Two Sides </comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>21</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>21</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>RDD2</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>359</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>RAMDOS-D20 792K Format 80trk 10sct 256dir 2Kpb Two Sides</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>31</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>31</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>RD20</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>399</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad ZX Spectrum +3 - SSDD 64dir 1Kpb 180K - 173K user free</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <label>ZX0</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>174</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad ZX Spectrum +3 - DSDD 128dir 2Kpb 720K - 710K user free</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>3</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ZX3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>356</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Altos Series 5 - DSDD 96 tpi 5.25" - 512 x 9</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>ALT6</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>176</dsm> - <drm>255</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>64</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>PC1715 SCP (80*2* 5,1024 4 OFS 4k DIR) 5.25"</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>A780</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>389</dsm> - <drm>127</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>4</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>PC1715 CPA (80*2* 5,1024 0 OFS 6k DIR) 5.25"</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>5</sectorsPerTrack> - <bytesPerSector>1024</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>A800</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>399</dsm> - <drm>191</drm> - <al0>224</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad PCW8256 - DSDD 48 tpi 5.25"</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AMS1</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>356</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad PCW8256 - SSDD 48 tpi 3" (JOYCE-SYSTEM)</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <label>AMS3</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>174</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad CPC System - SSDD 48 tpi 3" or 5.25"</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>65</int> - <int>66</int> - <int>67</int> - <int>68</int> - <int>69</int> - <int>70</int> - <int>71</int> - <int>72</int> - <int>73</int> - </sectorIds> - </side1> - <label>AMS4</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>170</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad CPC-Data - SSDD 48 tpi 3" or 5.25"</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>40</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>5</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>193</int> - <int>194</int> - <int>195</int> - <int>196</int> - <int>197</int> - <int>198</int> - <int>199</int> - <int>200</int> - <int>201</int> - </sectorIds> - </side1> - <label>AMS5</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>179</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad B360K - SSDD 96 tpi 5.25" SKEW 2</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>65</int> - <int>66</int> - <int>67</int> - <int>68</int> - <int>69</int> - <int>70</int> - <int>71</int> - <int>72</int> - <int>73</int> - </sectorIds> - </side1> - <label>AMS6</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>1</exm> - <dsm>174</dsm> - <drm>63</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad VORTEX - DSDD 96 tpi 5.25"</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AMS7</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>176</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad CPC System DSDD 96tpi 5.25" - DOBBERTIN -</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>65</int> - <int>66</int> - <int>67</int> - <int>68</int> - <int>69</int> - <int>70</int> - <int>71</int> - <int>72</int> - <int>73</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>65</int> - <int>66</int> - <int>67</int> - <int>68</int> - <int>69</int> - <int>70</int> - <int>71</int> - <int>72</int> - <int>73</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AMS8</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>176</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>2</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad DOBBERTIN DATA DSDD 96 tpi 5.25" Skew 5</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>193</int> - <int>194</int> - <int>195</int> - <int>196</int> - <int>197</int> - <int>198</int> - <int>199</int> - <int>200</int> - <int>201</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>193</int> - <int>194</int> - <int>195</int> - <int>196</int> - <int>197</int> - <int>198</int> - <int>199</int> - <int>200</int> - <int>201</int> - </sectorIds> - </side2> - <label>AMS9</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>179</dsm> - <drm>127</drm> - <al0>128</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad PCW8256 - DSDD 96 tpi 5.25" 10 x 512 788K</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>AMSA</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>197</dsm> - <drm>255</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad PCW Joyce - SF2DD (824 kb - 256 entries)</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>84</cylinders> - <sides>2</sides> - <sectorsPerTrack>10</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>SF2D</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>208</dsm> - <drm>255</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Amstrad PCW Joyce - 168 Track DD (740 kb - 256 entries)</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>84</cylinders> - <sides>2</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - </sectorIds> - </side2> - <order>SIDES</order> - <label>168D</label> - <bsh>5</bsh> - <blm>31</blm> - <exm>3</exm> - <dsm>187</dsm> - <drm>255</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>1</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Extended CPC 3" 43-track</comment> - <encoding>MFM</encoding> - <bitrate>LOW</bitrate> - <cylinders>43</cylinders> - <sides>1</sides> - <sectorsPerTrack>9</sectorsPerTrack> - <bytesPerSector>512</bytesPerSector> - <skew>2</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>193</int> - <int>194</int> - <int>195</int> - <int>196</int> - <int>197</int> - <int>198</int> - <int>199</int> - <int>200</int> - <int>201</int> - </sectorIds> - </side1> - <label>AMS7</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>193</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>0</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Apple // CPM card 13-sector</comment> - <encoding>GCR</encoding> - <bitrate>LOW</bitrate> - <cylinders>35</cylinders> - <sides>1</sides> - <sectorsPerTrack>13</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - </sectorIds> - </side1> - <label>APL1</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>103</dsm> - <drm>47</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Apple // CPM card 16-sector</comment> - <encoding>GCR</encoding> - <bitrate>LOW</bitrate> - <cylinders>35</cylinders> - <sides>1</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <label>APL2</label> - <bsh>3</bsh> - <blm>7</blm> - <exm>0</exm> - <dsm>127</dsm> - <drm>63</drm> - <al0>192</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - <CpmDefinition> - <comment>Apple // CPM card special</comment> - <encoding>GCR</encoding> - <bitrate>LOW</bitrate> - <cylinders>80</cylinders> - <sides>2</sides> - <sectorsPerTrack>16</sectorsPerTrack> - <bytesPerSector>256</bytesPerSector> - <skew>0</skew> - <side1> - <sideId>0</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side1> - <side2> - <sideId>1</sideId> - <sectorIds> - <int>1</int> - <int>2</int> - <int>3</int> - <int>4</int> - <int>5</int> - <int>6</int> - <int>7</int> - <int>8</int> - <int>9</int> - <int>10</int> - <int>11</int> - <int>12</int> - <int>13</int> - <int>14</int> - <int>15</int> - <int>16</int> - </sectorIds> - </side2> - <label>APL3</label> - <bsh>4</bsh> - <blm>15</blm> - <exm>0</exm> - <dsm>313</dsm> - <drm>255</drm> - <al0>240</al0> - <al1>0</al1> - <ofs>3</ofs> - <sofs>0</sofs> - <complement>false</complement> - <evenOdd>false</evenOdd> - </CpmDefinition> - </definitions> - <creation>2016-08-24T02:44:59.045767Z</creation> + <definitions> + <CpmDefinition> + <comment>Generic CP/M - SSSD 8" - 128 x 26</comment> + <encoding>FM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>128</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>25</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>23</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>21</int> + <int>2</int> + <int>8</int> + <int>14</int> + <int>20</int> + <int>26</int> + <int>6</int> + <int>12</int> + <int>18</int> + <int>24</int> + <int>4</int> + <int>10</int> + <int>16</int> + <int>22</int> + </sectorIds> + </side1> + <label>A1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>242</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>ABC-80 - SSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>8</int> + <int>15</int> + <int>6</int> + <int>13</int> + <int>4</int> + <int>11</int> + <int>2</int> + <int>9</int> + <int>16</int> + <int>7</int> + <int>14</int> + <int>5</int> + <int>12</int> + <int>3</int> + <int>10</int> + </sectorIds> + </side1> + <label>ABC1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>151</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>A. B. Dick Magna III - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + <int>21</int> + <int>22</int> + <int>23</int> + <int>24</int> + <int>25</int> + <int>26</int> + <int>27</int> + <int>28</int> + <int>29</int> + <int>30</int> + <int>31</int> + <int>32</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ABD1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>255</dsm> + <drm>255</drm> + <al0>255</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Actrix (Access Matrix) - SSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side1> + <label>ACT1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Actrix (Access Matrix) - DSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ACT2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>174</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Adler Textriter - SSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + </sectorIds> + </side1> + <label>ADL1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>159</dsm> + <drm>31</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Advanced Digital Super 6 - SSDD 48 tpi 5.25" - 1024 x 4</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>4</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + </sectorIds> + </side1> + <label>ADV1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>77</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Advanced Digital Super 6 - DSDD 48 tpi 5.25" - 1024 x 4</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>4</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ADV2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>155</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Advanced Digital Super 6 - DSDD 96 tpi 5.25" - 1024 x 4</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>4</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ADV3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>300</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Advanced Digital Super 8 - DSDD 8" - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ADV4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>608</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Advanced Digital TurboDOS 312K - DSDD 48 tpi 5.25" - 1024 x 4</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>4</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ADV5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>155</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Advanced Digital TurboDOS 366K - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ADV6</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>182</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Advanced Controls - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ADV7</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>385</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Allen-Bradley Advisor+ - DSDD 3.5" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ALL1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>318</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>1</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Alspa - SSDD 8" - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <label>ALS1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>300</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Altos - SSSD 8" - 128 x 26</comment> + <encoding>FM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>128</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>25</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>23</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>21</int> + <int>2</int> + <int>8</int> + <int>14</int> + </sectorIds> + </side1> + <label>ALT1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>242</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Altos - DSSD 8" - 128 x 26</comment> + <encoding>FM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>128</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>25</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>23</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>21</int> + <int>2</int> + <int>8</int> + <int>14</int> + <int>20</int> + <int>26</int> + <int>6</int> + <int>12</int> + <int>18</int> + <int>24</int> + <int>4</int> + <int>10</int> + <int>16</int> + <int>22</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>25</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>23</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>21</int> + <int>2</int> + <int>8</int> + <int>14</int> + <int>20</int> + <int>26</int> + <int>6</int> + <int>12</int> + <int>18</int> + <int>24</int> + <int>4</int> + <int>10</int> + <int>16</int> + <int>22</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ALT2</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>122</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Altos - SSDD 8" - 512 x 15</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>15</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side1> + <label>ALT3</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>139</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Altos - DSDD 8" - 512 x 15</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>15</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ALT4</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>1</exm> + <dsm>284</dsm> + <drm>255</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Altos Series 5 - DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ALT5</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>176</dsm> + <drm>176</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amigo - SSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <label>AMI1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>189</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amigo - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AMI2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>195</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Ampro - SSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <label>AMP1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>94</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Ampro - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + <int>21</int> + <int>22</int> + <int>23</int> + <int>24</int> + <int>25</int> + <int>26</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + <int>21</int> + <int>22</int> + <int>23</int> + <int>24</int> + <int>25</int> + <int>26</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AMP2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Ampro - SSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <label>AMP3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Ampro - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + <int>21</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + <int>21</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AMP4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>394</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad PCW 8256 - SSDD 48 tpi 3.00"</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <label>AMS0</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>175</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad PCW 8256 - DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AMS1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>356</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad CPC464 - SSDD 48 tpi 5.25"/3" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>65</int> + <int>66</int> + <int>67</int> + <int>68</int> + <int>69</int> + <int>70</int> + <int>71</int> + <int>72</int> + <int>73</int> + </sectorIds> + </side1> + <label>AMS2</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>171</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad CPC464 - SSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>65</int> + <int>66</int> + <int>67</int> + <int>68</int> + <int>69</int> + <int>70</int> + <int>71</int> + <int>72</int> + <int>73</int> + </sectorIds> + </side1> + <label>AMS3</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>87</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad PCW 8512 - DSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AMS5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>356</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad CPC 6128 - DSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>65</int> + <int>66</int> + <int>67</int> + <int>68</int> + <int>69</int> + <int>70</int> + <int>71</int> + <int>72</int> + <int>73</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>65</int> + <int>66</int> + <int>67</int> + <int>68</int> + <int>69</int> + <int>70</int> + <int>71</int> + <int>72</int> + <int>73</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AMS7</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>175</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad CPC 6128 - DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>65</int> + <int>66</int> + <int>67</int> + <int>68</int> + <int>69</int> + <int>70</int> + <int>71</int> + <int>72</int> + <int>73</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>65</int> + <int>66</int> + <int>67</int> + <int>68</int> + <int>69</int> + <int>70</int> + <int>71</int> + <int>72</int> + <int>73</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AMS8</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>175</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad CPC 6128 Side 1 - SSDD 3.5" / 3" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>193</int> + <int>194</int> + <int>195</int> + <int>196</int> + <int>197</int> + <int>198</int> + <int>199</int> + <int>200</int> + <int>201</int> + </sectorIds> + </side1> + <label>AMS9</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>180</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad CPC 6128 Side 2 - SSDD 3.5" / 3" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>193</int> + <int>194</int> + <int>195</int> + <int>196</int> + <int>197</int> + <int>198</int> + <int>199</int> + <int>200</int> + <int>201</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>193</int> + <int>194</int> + <int>195</int> + <int>196</int> + <int>197</int> + <int>198</int> + <int>199</int> + <int>200</int> + <int>201</int> + </sectorIds> + </side2> + <label>AMSA</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>180</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>80</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad PCW w/DU49, Moonstone XFORMAT - DSDD 3.5" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AMSB</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>198</dsm> + <drm>255</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad CPC 6128 Vortex - DSDD 3.5"/96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AMSC</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>178</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Archive I - SSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>2</int> + <int>5</int> + <int>3</int> + </sectorIds> + </side1> + <label>ARC1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Archive II & III - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>2</int> + <int>5</int> + <int>3</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>2</int> + <int>5</int> + <int>3</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ARC2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>394</dsm> + <drm>319</drm> + <al0>248</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>true</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Arisia - SSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + </sectorIds> + </side1> + <label>ARI1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>147</dsm> + <drm>127</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Associate - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ASO1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>195</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Aster CT-80 - DSDD 96 tpi 5.25" - 1024 x 5, 3:1</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AST1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>394</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>ATR-8000 - SSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <label>ATR1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>189</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>ATR-8000 - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ATR2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>189</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>ATR-8000 - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>ATR3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>189</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>ATT-7700 - DSDD 3.5" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>17</int> + <int>19</int> + <int>21</int> + <int>23</int> + <int>25</int> + <int>27</int> + <int>29</int> + <int>31</int> + <int>18</int> + <int>20</int> + <int>22</int> + <int>24</int> + <int>26</int> + <int>28</int> + <int>30</int> + <int>32</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ATT1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>316</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Avatar - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>4</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>4</int> + <int>8</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>AVA1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>191</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Barudan - DSDD 3.5" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>BAR1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>155</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Beehive - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>BEE1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Beehive Microbee - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>2</int> + <int>5</int> + <int>8</int> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>2</int> + <int>5</int> + <int>8</int> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>BEE2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Beehive Microbee - SSDD 3.5" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>2</int> + <int>5</int> + <int>8</int> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side1> + <label>BEE3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Microbee Systems - DSDD 3.5" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>22</int> + <int>25</int> + <int>28</int> + <int>21</int> + <int>24</int> + <int>27</int> + <int>30</int> + <int>23</int> + <int>26</int> + <int>29</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>22</int> + <int>25</int> + <int>28</int> + <int>21</int> + <int>24</int> + <int>27</int> + <int>30</int> + <int>23</int> + <int>26</int> + <int>29</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>BEE4</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Microbee Dreamdisk format - DSDD 3.5" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>2</int> + <int>5</int> + <int>8</int> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>2</int> + <int>5</int> + <int>8</int> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>BEE5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>391</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Computer Bell - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>BEL1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>192</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Big Board (512 bytes/sector) - SSDD 8" - 512 x 15</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>15</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side1> + <label>BIG1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>280</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Big Board (512 bytes/sector) - DSDD 8" - 512 x 15</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>15</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>BIG2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>569</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Big Board SWP 1024 bytes/sector - SSDD 8" - 1024 x 9</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <label>BIG4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>336</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Bitelex - SSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side1> + <label>BIT1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>131</dsm> + <drm>95</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>BMC IF800 Model 20 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>3</int> + <int>9</int> + <int>15</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>3</int> + <int>9</int> + <int>15</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>BMC1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>191</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Bondwell 12 - SSDD 48 tpi 5.25" - 256 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <label>BON1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>84</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Bondwell 14 - DSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>BON2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>174</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Bondwell 2 - SSDD 3.5" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <label>BON3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>174</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>BOSS TurboDOS - DSDD 8" - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>BOS1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>616</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>BTI Systems - DSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>BTI1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>175</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Burr-Brown - DSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>10</int> + <int>2</int> + <int>11</int> + <int>3</int> + <int>12</int> + <int>4</int> + <int>13</int> + <int>5</int> + <int>14</int> + <int>6</int> + <int>15</int> + <int>7</int> + <int>16</int> + <int>8</int> + <int>17</int> + <int>9</int> + <int>18</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>10</int> + <int>2</int> + <int>11</int> + <int>3</int> + <int>12</int> + <int>4</int> + <int>13</int> + <int>5</int> + <int>14</int> + <int>6</int> + <int>15</int> + <int>7</int> + <int>16</int> + <int>8</int> + <int>17</int> + <int>9</int> + <int>18</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>BUR1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Cal-PC - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CAL1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Cashcom 100 - DSDD 96 tpi 5.25" - 1024 x 4</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>4</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CAS1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>303</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Commodore Business Machines 1581 drive - DSDD 3.5" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CBM1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>397</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CCS (256 bytes/sector) - DSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>17</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>18</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>17</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>18</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CCS1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>165</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CCS (512 bytes/sector) - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>2</int> + <int>5</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>2</int> + <int>5</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CCS2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>184</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CCS (1024 bytes/sector) - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CCS3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>184</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CCS 8 - DSDD 8" - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CCS4</label> + <bsh>6</bsh> + <blm>63</blm> + <exm>7</exm> + <dsm>149</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CCS 2442 - SSDD 8" - 512 x 15</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>15</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>4</int> + <int>8</int> + <int>12</int> + </sectorIds> + </side1> + <label>CCS5</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>139</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CCS (1024 bytes alternate) - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CCS6</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>184</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CDC-110 Viking - DSDD 8" - 512 x 16</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CDC1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>608</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CDI-5000 - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>2</int> + <int>5</int> + <int>3</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>2</int> + <int>5</int> + <int>3</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CDI1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>COLEX 850 - SSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>4</int> + <int>8</int> + </sectorIds> + </side1> + <label>CLX1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>COLEX 850 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>4</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>11</int> + <int>15</int> + <int>19</int> + <int>13</int> + <int>17</int> + <int>12</int> + <int>16</int> + <int>20</int> + <int>14</int> + <int>18</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CLX2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>389</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CMC Supersystem 2 - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CMC1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>391</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Coin - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>COI1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>392</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Coleco ADAM, 40 track - SSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>3</int> + <int>8</int> + <int>5</int> + <int>2</int> + <int>7</int> + <int>4</int> + </sectorIds> + </side1> + <label>COL1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>146</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>26</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Coleco ADAM, 254K - DSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>3</int> + <int>8</int> + <int>5</int> + <int>2</int> + <int>7</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>3</int> + <int>8</int> + <int>5</int> + <int>2</int> + <int>7</int> + <int>4</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>COL2</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>255</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>26</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Coleco ADAM, 320K - DSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>3</int> + <int>8</int> + <int>5</int> + <int>2</int> + <int>7</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>3</int> + <int>8</int> + <int>5</int> + <int>2</int> + <int>7</int> + <int>4</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>COL3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>152</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>26</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Coleco ADAM, 720K - DSDD 3.5" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>4</int> + <int>8</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>4</int> + <int>8</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>COL4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>354</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>26</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Coleco ADAM, 360K - DSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>COL5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>179</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>4</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Coleco ADAM, E&T PROM 720K - DSDD 3.5" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>4</int> + <int>8</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>4</int> + <int>8</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>COL6</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>354</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>26</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Coleco ADAM, 720K - DSDD 3.5" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>4</int> + <int>8</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>4</int> + <int>8</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>COL7</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>358</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>4</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Coleco ADAM, 1.44M - DSHD 3.5" - 512 x 18</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>15</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>18</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>16</int> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>17</int> + <int>3</int> + <int>7</int> + <int>11</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>17</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>18</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>COL8</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>712</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Coleco Adam TDOS - DSDD 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>3</int> + <int>8</int> + <int>5</int> + <int>2</int> + <int>7</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>3</int> + <int>8</int> + <int>5</int> + <int>2</int> + <int>7</int> + <int>4</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>COL9</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>255</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>26</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Columbia Commander 964 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>COLUMBIA</order> + <label>COLA</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>190</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Columbia 1600 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>COLUMBIA</order> + <label>COLB</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>197</dsm> + <drm>255</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Columbia M64 - SSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <label>COLC</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>190</dsm> + <drm>127</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>true</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Compis - DSDD 96 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>COM1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>317</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Compugraphic MCS-5 - SSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <label>COM2</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>155</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Compustar Model 30 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>35</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>COM3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>169</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>true</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Compupro (Viasyn) - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>COM7</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>389</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Compupro (Viasyn) 8/16 - SSDD 8" - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + </sectorIds> + </side1> + <label>COM8</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>299</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Compupro (Viasyn) 8/16 - DSDD 8" - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>COM9</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>599</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Compupro (Viasyn) - SSDD 8" - 512 x 15</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>15</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>4</int> + <int>8</int> + <int>12</int> + </sectorIds> + </side1> + <label>COMA</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>280</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Compupro (Viasyn) - SSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>10</int> + <int>19</int> + <int>2</int> + <int>11</int> + <int>20</int> + <int>3</int> + <int>12</int> + <int>21</int> + <int>4</int> + <int>13</int> + <int>22</int> + <int>5</int> + <int>14</int> + <int>23</int> + <int>6</int> + </sectorIds> + </side1> + <label>COMB</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>242</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Compupro (Viasyn) 256 bytes/sector - DSHD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>10</int> + <int>19</int> + <int>2</int> + <int>11</int> + <int>20</int> + <int>3</int> + <int>12</int> + <int>21</int> + <int>4</int> + <int>13</int> + <int>22</int> + <int>5</int> + <int>14</int> + <int>23</int> + <int>6</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>10</int> + <int>19</int> + <int>2</int> + <int>11</int> + <int>20</int> + <int>3</int> + <int>12</int> + <int>21</int> + <int>4</int> + <int>13</int> + <int>22</int> + <int>5</int> + <int>14</int> + <int>23</int> + <int>6</int> + </sectorIds> + </side2> + <label>COME</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>487</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPT Phoenix CP/M - DSDD 3.5" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CPT1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>355</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Cromemco CDOS - SSSD 48 tpi 5.25" - 128 x 18</comment> + <encoding>FM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>128</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>11</int> + <int>16</int> + <int>3</int> + <int>8</int> + <int>13</int> + <int>18</int> + <int>5</int> + <int>10</int> + <int>15</int> + <int>2</int> + <int>7</int> + <int>12</int> + <int>17</int> + <int>4</int> + <int>9</int> + <int>14</int> + </sectorIds> + </side1> + <label>CRO1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>82</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Cromemco CDOS - DSSD 48 tpi 5.25" - 128 x 18</comment> + <encoding>FM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>128</sectorsPerTrack> + <bytesPerSector>18</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>11</int> + <int>16</int> + <int>3</int> + <int>8</int> + <int>13</int> + <int>18</int> + <int>5</int> + <int>10</int> + <int>15</int> + <int>2</int> + <int>7</int> + <int>12</int> + <int>17</int> + <int>4</int> + <int>9</int> + <int>14</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>11</int> + <int>16</int> + <int>3</int> + <int>8</int> + <int>13</int> + <int>18</int> + <int>5</int> + <int>10</int> + <int>15</int> + <int>2</int> + <int>7</int> + <int>12</int> + <int>17</int> + <int>4</int> + <int>9</int> + <int>14</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CRO2</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>172</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Cromemco CDOS - SSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>4</int> + <int>8</int> + </sectorIds> + </side1> + <label>CRO3</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>189</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Cromemco CDOS - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>4</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>4</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CRO4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Cromemco CDOS - DSDD 8" - 512 x 16</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>12</int> + <int>7</int> + <int>2</int> + <int>13</int> + <int>8</int> + <int>3</int> + <int>14</int> + <int>9</int> + <int>4</int> + <int>15</int> + <int>10</int> + <int>5</int> + <int>16</int> + <int>11</int> + <int>6</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>12</int> + <int>7</int> + <int>2</int> + <int>13</int> + <int>8</int> + <int>3</int> + <int>14</int> + <int>9</int> + <int>4</int> + <int>15</int> + <int>10</int> + <int>5</int> + <int>16</int> + <int>11</int> + <int>6</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CRO5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>608</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Cromemco CP/M - SSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>2</int> + <int>5</int> + <int>8</int> + </sectorIds> + </side1> + <label>CRO6</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>94</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Cromemco CP/M - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>2</int> + <int>5</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>2</int> + <int>5</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CRO7</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Cykey - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>CYK1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>153</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Datavue DV80 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>129</int> + <int>130</int> + <int>131</int> + <int>132</int> + <int>133</int> + <int>134</int> + <int>135</int> + <int>136</int> + <int>137</int> + <int>138</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>129</int> + <int>130</int> + <int>131</int> + <int>132</int> + <int>133</int> + <int>134</int> + <int>135</int> + <int>136</int> + <int>137</int> + <int>138</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DAT1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>94</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Datavue DV80 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>193</int> + <int>194</int> + <int>195</int> + <int>196</int> + <int>197</int> + <int>198</int> + <int>199</int> + <int>200</int> + <int>201</int> + <int>202</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>193</int> + <int>194</int> + <int>195</int> + <int>196</int> + <int>197</int> + <int>198</int> + <int>199</int> + <int>200</int> + <int>201</int> + <int>202</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DAT2</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Davidge - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DAV1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>384</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>DEC DECMate II - SSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <label>DEC1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>195</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>DEC VT-180 - SSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + </sectorIds> + </side1> + <label>DEC3</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Dictaphone 6000 CP/M - DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DIC1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>352</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Dictaphone 6000 CP/M - DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DIC2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>345</dsm> + <drm>319</drm> + <al0>248</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Digilog 2500 - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>35</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>DIG1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>166</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Digilog 1500 - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>DIG2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>392</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Digitech 500 series - SSDD 3.5" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <label>DIG3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>199</dsm> + <drm>319</drm> + <al0>248</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Digitech 500 series - DSDD 3.5" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DIG4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>398</dsm> + <drm>319</drm> + <al0>248</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Digital Group, TVC-80 FDC - SSDD 8" - 1024 x 9</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <label>DIG5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>342</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Dimension 68000 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DIM1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>195</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Direct 1025 - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DIR1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>152</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Discovery - DSDD 96 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DIS1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>313</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Duet CP/M - DSDD 96tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DUE1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>355</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Eagle I, II - SSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <label>EAG1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>191</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Eagle III, IV, V - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>EAG2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>394</dsm> + <drm>191</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Electroglas/Xynetics - DSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <order>EAGLE</order> + <label>ELE1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>158</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Electroglas/Xynetics - DSDD 3.5" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <order>SIDES</order> + <label>ELE2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>397</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Epson QX-10 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>EPS1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>189</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Epson QX-10 (256 bytes/sector) - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>EPS2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>139</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>8</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Epson PX-10/8 - DSDD 3.5" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>EPS3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>139</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>8</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Epson QX-16 640K - DSDD 3.5" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>EPS4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>304</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>8</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Epson QX-16 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>EPS5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>389</dsm> + <drm>255</drm> + <al0>252</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Ericsson DTC - SSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <label>ERI1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>77</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Ericsson DTC - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>ERI2</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>157</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Ericsson Step One - DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ERI3</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>174</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Estimation Inc. EST101 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>EST1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>394</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Everett/Charles Kryterion 165 - DSDD 8" - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>EVE1</label> + <bsh>6</bsh> + <blm>63</blm> + <exm>3</exm> + <dsm>151</dsm> + <drm>255</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Eureka A4 - DSDD 3.5" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>2</int> + <int>5</int> + <int>8</int> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>2</int> + <int>5</int> + <int>8</int> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>EUR1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>399</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Exidy Sorcerer - SSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>11</int> + <int>16</int> + <int>5</int> + <int>10</int> + <int>15</int> + <int>4</int> + <int>9</int> + <int>14</int> + <int>3</int> + <int>8</int> + <int>13</int> + <int>2</int> + <int>7</int> + <int>12</int> + </sectorIds> + </side1> + <label>EXI1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>76</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>33</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>EXO - SSDD 8" - 512 x 16</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <label>EXO1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>149</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>EXO - DSDD 8" - 512 x 15</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>15</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>EXO2</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>1</exm> + <dsm>303</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Florida Graphics - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>FLO1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>295</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>12</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Formula 1 - DSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>5</int> + <int>6</int> + <int>9</int> + <int>10</int> + <int>13</int> + <int>14</int> + <int>17</int> + <int>18</int> + <int>3</int> + <int>4</int> + <int>7</int> + <int>8</int> + <int>11</int> + <int>12</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>5</int> + <int>6</int> + <int>9</int> + <int>10</int> + <int>13</int> + <int>14</int> + <int>17</int> + <int>18</int> + <int>3</int> + <int>4</int> + <int>7</int> + <int>8</int> + <int>11</int> + <int>12</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>FOR1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>172</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Fujitsu Micro 8 - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>FUJ2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>151</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Future FX-20 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>4</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>FUT1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>196</dsm> + <drm>95</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Gemini Galaxy - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>GEM1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>196</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Globe 101 - DSDD 96 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>GLO1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>319</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>13</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Gnat System 10 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>35</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>GNA1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>169</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Graco OM-5000 - DSHD 5.25" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <label>GRA1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>248</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Hagiwara HPU 801 CP/M 68K - DSDD 3.5" Special - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + <int>21</int> + <int>22</int> + <int>23</int> + <int>24</int> + <int>25</int> + <int>26</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + <int>21</int> + <int>22</int> + <int>23</int> + <int>24</int> + <int>25</int> + <int>26</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>HAG1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>486</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Hazeltine - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>HAZ1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>379</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>HCL System 2 - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>HCL1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>388</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Heath H89, Magnolia CP/M - SSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <label>HEA1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>82</dsm> + <drm>95</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Heath H89, Magnolia CP/M - DSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>HEA2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>172</dsm> + <drm>95</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Heath H89, Magnolia CP/M - DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>HEA3</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>176</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Heurikon MLZ-91A - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>5</int> + <int>6</int> + <int>9</int> + <int>10</int> + <int>13</int> + <int>14</int> + <int>3</int> + <int>4</int> + <int>7</int> + <int>8</int> + <int>11</int> + <int>12</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>5</int> + <int>6</int> + <int>9</int> + <int>10</int> + <int>13</int> + <int>14</int> + <int>3</int> + <int>4</int> + <int>7</int> + <int>8</int> + <int>11</int> + <int>12</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>HEU1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>315</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Hewlett-Packard HP86/87/120/125 - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>HEW1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>251</dsm> + <drm>127</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Hewlett Packard HP 125 - SSSD 8" - 256 x 16</comment> + <encoding>FM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>66</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>6</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side1> + <label>HEW2</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>251</dsm> + <drm>127</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Hewlett Packard HP 125 - SSDD 3.5" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>66</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>6</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side1> + <label>HEW3</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>251</dsm> + <drm>127</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Hitachi HPC-6000 CP/M 68K - DSHD 1.2M 3.5" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + <int>21</int> + <int>22</int> + <int>23</int> + <int>24</int> + <int>25</int> + <int>26</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + <int>21</int> + <int>22</int> + <int>23</int> + <int>24</int> + <int>25</int> + <int>26</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>HIT1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>242</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Hitachi R-1500 CP/M 68K - DSHD 1.2M 5.25" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + <int>21</int> + <int>22</int> + <int>23</int> + <int>24</int> + <int>25</int> + <int>26</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + <int>21</int> + <int>22</int> + <int>23</int> + <int>24</int> + <int>25</int> + <int>26</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>HIT2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>494</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Strippit Houdaille Fab/V - DSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>HOU1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>174</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>IBM PC, CP/M-86 - SSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <label>IBM1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>155</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>IBM PC, CP/M-86 - DSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>IBM2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>157</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>IBS Ultraframe Turbo DOS - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>IBS1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>397</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>IBEX 7300 - DSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>IBX1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>246</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>IBEX 7301 - DSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>25</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>23</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>21</int> + <int>2</int> + <int>8</int> + <int>14</int> + <int>20</int> + <int>26</int> + <int>6</int> + <int>12</int> + <int>18</int> + <int>24</int> + <int>4</int> + <int>10</int> + <int>16</int> + <int>22</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>25</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>23</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>21</int> + <int>2</int> + <int>8</int> + <int>14</int> + <int>20</int> + <int>26</int> + <int>6</int> + <int>12</int> + <int>18</int> + <int>24</int> + <int>4</int> + <int>10</int> + <int>16</int> + <int>22</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>IBX2</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>2</exm> + <dsm>242</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>ICL DRS 20 - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>11</int> + <int>16</int> + <int>5</int> + <int>10</int> + <int>15</int> + <int>4</int> + <int>9</int> + <int>14</int> + <int>3</int> + <int>8</int> + <int>13</int> + <int>2</int> + <int>7</int> + <int>12</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>11</int> + <int>16</int> + <int>5</int> + <int>10</int> + <int>15</int> + <int>4</int> + <int>9</int> + <int>14</int> + <int>3</int> + <int>8</int> + <int>13</int> + <int>2</int> + <int>7</int> + <int>12</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ICL1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>158</dsm> + <drm>255</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>ICL DRS 300 - DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ICL2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>350</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>ICL Model 35/36 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ICL3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>391</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>36</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>IMS 5000 - SSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>9</int> + <int>2</int> + <int>10</int> + <int>3</int> + <int>11</int> + <int>4</int> + <int>12</int> + <int>5</int> + <int>13</int> + <int>6</int> + <int>14</int> + <int>7</int> + <int>15</int> + <int>8</int> + <int>16</int> + </sectorIds> + </side1> + <label>IMS1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>147</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>IMS 5000 TurboDOS - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>IMS2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>390</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>IMS 5000 TurboDOS - SSDD 8" - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <label>IMS3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>308</dsm> + <drm>191</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>IMS 5000 CP/M - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>IMS4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>395</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Intel iPDS 100 - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>INT1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>307</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Intuit - SSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <label>INT2</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>190</dsm> + <drm>127</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Insight Enterprises - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>INS1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>155</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Ithaca Intersystems - SSDD 96 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>5</int> + <int>6</int> + <int>9</int> + <int>10</int> + <int>13</int> + <int>14</int> + <int>17</int> + <int>18</int> + <int>3</int> + <int>4</int> + <int>7</int> + <int>8</int> + <int>11</int> + <int>12</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <label>ITH1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>174</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Ithaca Intersystems - SSDD 8" - 512 x 15</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>15</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>4</int> + <int>8</int> + <int>12</int> + </sectorIds> + </side1> + <label>ITH2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>284</dsm> + <drm>191</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Ithaca Intersystems - DSDD 8" - 512 x 15</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>15</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>4</int> + <int>8</int> + <int>12</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>4</int> + <int>8</int> + <int>12</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ITH3</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>1</exm> + <dsm>284</dsm> + <drm>255</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>ITT 3030 - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>35</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>ITT1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>247</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>ITT 3030 - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>70</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>ITT2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>270</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sel ITT 3030 - 70 Tracks 560 kB - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>70</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>ITT3030</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>271</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Jonos - SSDD 3.5" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>70</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <label>JON1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>152</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Kaypro II/2 - SSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <label>KAY1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>194</dsm> + <drm>63</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Kaypro 2X/4/10 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>KAY2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>196</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Kaypro 2X/4/10 (Alternate) - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>KAY3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>196</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Kaypro, Pro-8 ROM - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>20</int> + <int>21</int> + <int>22</int> + <int>23</int> + <int>24</int> + <int>25</int> + <int>26</int> + <int>27</int> + <int>28</int> + <int>29</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>KAY4</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>196</dsm> + <drm>95</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Kaypro Advent TurboROM - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>KAY5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>195</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Kaypro Advent TurboROM - SSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <label>KAY6</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>185</dsm> + <drm>31</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Kaypro Advent TurboROM - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>21</int> + <int>22</int> + <int>23</int> + <int>24</int> + <int>25</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>KAY7</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>395</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Kontron - DSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>19</int> + <int>22</int> + <int>25</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>18</int> + <int>21</int> + <int>24</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + <int>17</int> + <int>20</int> + <int>23</int> + <int>26</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>19</int> + <int>22</int> + <int>25</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>18</int> + <int>21</int> + <int>24</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + <int>17</int> + <int>20</int> + <int>23</int> + <int>26</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>KON1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>489</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Kontron/Zeiss - DSDD 96 tpi 5.25" - 128 x 16</comment> + <encoding>FM</encoding> + <bitrate>LOW</bitrate> + <cylinders>35</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>128</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>KON2</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>106</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>17</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Kontron Transient Recorder- DSDD 96 tpi 5.25"/3.5" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>KON3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>299</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Lanier LTD READ-ONLY - DSDD 96 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <label>LAN1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>318</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Lexoriter - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + </sectorIds> + </side2> + <label>LEX2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>159</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Lobo Max-80 - SSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <label>LOB1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>165</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Lobo Max-80 (256) - DSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>LOB2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>172</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Lobo Max-80 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>LOB3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>191</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Lobo Max-80 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>LOB4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>391</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Lobo CP/M 2.2 - SSHD 8" - 256 x 30</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>30</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + </sectorIds> + </side1> + <label>LOB5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>280</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>LNW 2 - SSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>11</int> + <int>16</int> + <int>3</int> + <int>8</int> + <int>13</int> + <int>18</int> + <int>5</int> + <int>10</int> + <int>15</int> + <int>2</int> + <int>7</int> + <int>12</int> + <int>17</int> + <int>4</int> + <int>9</int> + <int>14</int> + </sectorIds> + </side1> + <label>LNW1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>82</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Lockheed-Martin Wire Harness Tester - DSDD 3.5" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>2</int> + <int>5</int> + <int>3</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>2</int> + <int>5</int> + <int>3</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>LOC1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>394</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Macsym 150 - SSDD 96 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <label>MAC1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>155</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>MAI Basic Four - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>MAI1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>312</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Marconi Midata 510 - DSDD 3.5" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>MAR1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>197</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Memotech MaxBP - DSDD 3.5" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>MEM1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>394</dsm> + <drm>191</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Memotech FDX - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>MEM2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>156</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>26</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Micro Source M6000 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>4</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>11</int> + <int>15</int> + <int>19</int> + <int>13</int> + <int>17</int> + <int>12</int> + <int>16</int> + <int>20</int> + <int>14</int> + <int>18</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>MIC6</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>189</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Michels and Kleberhoff CP/M 3 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>MIC7</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>394</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>true</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Michels and Kleberhoff CP/M 3 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>35</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>MIC8</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>true</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>MicroMint SB180 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>27</int> + <int>28</int> + <int>29</int> + <int>30</int> + <int>31</int> + <int>32</int> + <int>33</int> + <int>34</int> + <int>35</int> + <int>36</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>27</int> + <int>28</int> + <int>29</int> + <int>30</int> + <int>31</int> + <int>32</int> + <int>33</int> + <int>34</int> + <int>35</int> + <int>36</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>MM7</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>200</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Molecular Series 9 - DSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <order>SIDES</order> + <label>MOL1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>179</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Molecular/Durango Poppy 54 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>128</int> + <int>129</int> + <int>130</int> + <int>131</int> + <int>132</int> + <int>133</int> + <int>134</int> + <int>135</int> + <int>136</int> + <int>137</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>138</int> + <int>139</int> + <int>140</int> + <int>141</int> + <int>142</int> + <int>143</int> + <int>144</int> + <int>145</int> + <int>146</int> + <int>147</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>MOL2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>389</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Molecular - SSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>25</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>23</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>21</int> + <int>2</int> + <int>8</int> + <int>14</int> + </sectorIds> + </side1> + <label>MOL3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>249</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Monroe 8800 Series - SSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>16</int> + </sectorIds> + </side1> + <label>MON1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>153</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Monroe System 2000 - DSDD 96 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>MON2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>315</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Morrow MD2 - SSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>2</int> + <int>5</int> + <int>3</int> + </sectorIds> + </side1> + <label>MOR1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>94</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Morrow MD3, 5, 11, 16, 34 - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>2</int> + <int>5</int> + <int>3</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>2</int> + <int>5</int> + <int>3</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>MOR2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>191</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Morrow TurboDOS - DSDD 48 tpi 5.25" - 1024 x 4</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>4</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>MOR6</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>155</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Morrow MD3...CP/M Plus - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>2</int> + <int>5</int> + <int>3</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>2</int> + <int>5</int> + <int>3</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>MOR7</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Morrow 5/11/34 - SSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>2</int> + <int>5</int> + <int>3</int> + </sectorIds> + </side1> + <label>MOR8</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>92</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>MOS 80 - DSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>10</int> + <int>19</int> + <int>2</int> + <int>11</int> + <int>20</int> + <int>3</int> + <int>12</int> + <int>21</int> + <int>4</int> + <int>13</int> + <int>22</int> + <int>5</int> + <int>14</int> + <int>23</int> + <int>6</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>10</int> + <int>19</int> + <int>2</int> + <int>11</int> + <int>20</int> + <int>3</int> + <int>12</int> + <int>21</int> + <int>4</int> + <int>13</int> + <int>22</int> + <int>5</int> + <int>14</int> + <int>23</int> + <int>6</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>MOS1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>0</exm> + <dsm>244</dsm> + <drm>251</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Multitech MIC-540 - DSDD 96 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>MUL1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>356</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>MUPD/MDISK, Side I - SSSD 96 tpi 5.25" - 256 x 10</comment> + <encoding>FM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + </sectorIds> + </side1> + <label>MUP1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>96</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>MUPD/MDISK, Side II - SSSD 96 tpi 5.25" - 256 x 10</comment> + <encoding>FM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>MUP2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>96</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>83</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>MSD Systems PSC-1 POS - DSDD 96 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>MSD1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>158</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>NCHQ System II - SSSD 48tpi 5.25" - 128 x 18</comment> + <encoding>FM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>128</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>17</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + <int>18</int> + </sectorIds> + </side1> + <label>NCH1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>84</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>NCR Decision Mate V - DSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>NCR1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>153</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>NCR FirstStep - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>16</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>15</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>14</int> + <int>2</int> + <int>6</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>16</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>15</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>14</int> + <int>2</int> + <int>6</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>NCR2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>275</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>NEC PC-8801A - DSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>6</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + <int>21</int> + <int>22</int> + <int>23</int> + <int>24</int> + <int>25</int> + <int>26</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + <int>21</int> + <int>22</int> + <int>23</int> + <int>24</int> + <int>25</int> + <int>26</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>NEC2</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>242</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>NEC PC-8801A - DSDD 8" - 512 x 15</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>15</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>6</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>NEC3</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>1</exm> + <dsm>280</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>NEC PC-8801A - DSDD 8" - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>NEC4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>599</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>NEC PC-8001A - SSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <label>NEC5</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>151</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>NEC PC-8001B - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>NEC6</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>151</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>NEC PC 8801A - DSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>NEC8</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>151</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>NEC PC 8801A - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <label>NEC9</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>189</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>NEC PC 8500/8431A, Starlet - DSDD 3.5" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <label>NECA</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>151</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>NEC APC CP/M-86 - DSHD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>19</int> + <int>22</int> + <int>25</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + <int>17</int> + <int>20</int> + <int>23</int> + <int>26</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>18</int> + <int>21</int> + <int>24</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>19</int> + <int>22</int> + <int>25</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + <int>17</int> + <int>20</int> + <int>23</int> + <int>26</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>18</int> + <int>21</int> + <int>24</int> + </sectorIds> + </side2> + <label>NECC</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>494</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>NEC APC TurboDOS - SSDD 8" - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <label>NECD</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>308</dsm> + <drm>224</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>New Brain - SSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <label>NEW1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>97</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Niat - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>16</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>NIA1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>157</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Nixdorf 8810/30 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>NIX1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>384</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Norsonic 830/836 - DSDD 3.5" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>NOR1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>199</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Numeridex 7000 - DSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>25</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>23</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>21</int> + <int>2</int> + <int>8</int> + <int>14</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>28</int> + <int>34</int> + <int>40</int> + <int>46</int> + <int>52</int> + <int>32</int> + <int>38</int> + <int>44</int> + <int>50</int> + <int>30</int> + <int>36</int> + <int>42</int> + <int>48</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>NUM1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>248</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Octagon 8/16 - SSDD 8" - 1024 x 9</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <label>OCT1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>1</exm> + <dsm>167</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>OEM Screen Typist - SSDD 3.5" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <label>OEM1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>94</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Olivetti ETV300 - SSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>17</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + <int>18</int> + </sectorIds> + </side1> + <label>OLI1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Olivetti M20 - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>OLI2</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>255</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Olivetti 250, CWP1 - SSDD 3.5" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side1> + <order>SIDES</order> + <label>OLI3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>157</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Olivetti ETV 1010, CP/M 86 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>OLI5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>198</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Olivetti ETV 112 - SSDD 3.5" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>17</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + <int>18</int> + </sectorIds> + </side1> + <label>OLI6</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>174</dsm> + <drm>191</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Olympia EX-100 - DSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>OLY1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>174</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Olympia ETX II - SSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <label>OLY2</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>170</dsm> + <drm>127</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Olympia Olytext 20 - DSDD 3.5" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>OLY3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>312</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Osborne 1 - SSSD 48 tpi 5.25" - 256 x 10</comment> + <encoding>FM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <label>OSB1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>45</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Osborne 1 - SSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <label>OSB2</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>184</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Osborne G2 System - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>OSB4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>189</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Osborne G2 System - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>OSB5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>389</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Osborne 1 + Osmosis - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>OSB6</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>384</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Osborne Nuevo - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>6</int> + <int>8</int> + <int>10</int> + <int>7</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>OSB7</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Osborne Vixen - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>OSB8</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Osborne Executive w/Z3 - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>OSB9</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>395</dsm> + <drm>127</drm> + <al0>248</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Osborne Executive Dig. Arts - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>OSBA</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>248</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Osborne Nuevo 2.1 - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>OSBB</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>394</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>OSM Zeus 4 - DSDD 96 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>OSM1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>311</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Otrona Attache - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>OTR1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>181</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Otrona Attache - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>OTR2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>386</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Potter & Brumfield - SSSD 48 tpi 5.25" - 128 x 18</comment> + <encoding>FM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>128</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>17</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>18</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>16</int> + </sectorIds> + </side1> + <label>PB1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>83</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Pegasus Data Logger - DSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>PEG1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>People's World Computer - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>PEO1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>398</dsm> + <drm>127</drm> + <al0>120</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>People's World Computer Boot - SSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>PEO2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>397</dsm> + <drm>127</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Pericom - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>PER1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>395</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Philips PC-2010 - SSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side1> + <label>PHI1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>151</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Philips PC-2012 - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>PHI2</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>157</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Philips PC-3000 - 3004 - SSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + </sectorIds> + </side1> + <label>PHI3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>147</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Physical Acoutstics - DSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>PHY1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>173</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Pied Piper - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>PIE1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>391</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Proglas 770K - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>PRO1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>388</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Pulsar LBB - SSHD 8" - 512 x 17</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>17</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + <int>17</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + </sectorIds> + </side1> + <label>PUL1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>317</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Research Machines Limited 380Z - 128 x 16</comment> + <encoding>FM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>128</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + </sectorIds> + </side1> + <label>RML1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>74</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Royal Alphatronic - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ROY1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>151</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sage IV - DSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>SAG1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>155</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sage IV - DSDD 96 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SAG2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>315</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sanyo MBC-1000, MBC-1150 - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SAN1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>155</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sanyo MBC-2000 - SSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>11</int> + <int>16</int> + <int>5</int> + <int>10</int> + <int>15</int> + <int>4</int> + <int>9</int> + <int>14</int> + <int>3</int> + <int>8</int> + <int>13</int> + <int>2</int> + <int>7</int> + <int>12</int> + </sectorIds> + </side1> + <label>SAN3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>152</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sanyo MBC-3000 - DSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>25</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>23</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>21</int> + <int>2</int> + <int>8</int> + <int>14</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>25</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>23</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>21</int> + <int>2</int> + <int>8</int> + <int>14</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SAN4</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>237</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sanco 8001 - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side2> + <label>SAN5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>194</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Schneider CPC 6128 Side 1 - DSDD 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>193</int> + <int>194</int> + <int>195</int> + <int>196</int> + <int>197</int> + <int>198</int> + <int>199</int> + <int>200</int> + <int>201</int> + </sectorIds> + </side1> + <label>SCH1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>180</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Schneider CPC 6128 Side 2 - DSDD 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>193</int> + <int>194</int> + <int>195</int> + <int>196</int> + <int>197</int> + <int>198</int> + <int>199</int> + <int>200</int> + <int>201</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>193</int> + <int>194</int> + <int>195</int> + <int>196</int> + <int>197</int> + <int>198</int> + <int>199</int> + <int>200</int> + <int>201</int> + </sectorIds> + </side2> + <label>SCH2</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>180</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>40</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>S.D. Systems 40 track - SSDD 3.5" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + </sectorIds> + </side1> + <label>SDS1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>84</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>S.D. Systems 80 track - DSDD 3.5" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <order>SIDES</order> + <label>SDS2</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>0</exm> + <dsm>176</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>S.D. Systems 80 track - SSDD 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + </sectorIds> + </side1> + <label>SDS3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>175</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>S.D. Systems - SSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>1</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>17</int> + <int>21</int> + <int>25</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>19</int> + <int>23</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>18</int> + <int>22</int> + <int>26</int> + </sectorIds> + </side1> + <label>SDS4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>240</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Seiko - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SEI1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>315</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>SemiDisk DT42 - DSHD 96 tpi 5.25" - 512 x 15</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>15</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SEM3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>562</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sharp MZ-80 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SHA1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>169</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>true</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sharp MZ-80B - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>1</sideId> + <sectorIds> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SHA2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>195</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>true</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sharp 3500/5500 - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SHA3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>151</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sharp 5600 - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SHA4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>312</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sharp MZ 3541 - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <order>SIDES</order> + <label>SHA5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Shelton SIG/NET 2 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SHL2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>195</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>true</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Shelton SIG/NET 2 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SHL3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>395</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>true</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Siemens PG-685 DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SIE1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>350</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Siemens PG-675 DSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SIE2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Silver-Reed WP System - DSDD 3.5" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>2</int> + <int>4</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SIL1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>189</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Smart Aleck - SSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + </sectorIds> + </side1> + <label>SMA1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sorbus TurboDOS - 5.25" DSHD (or 8" DSDD) - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SOR1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>1</exm> + <dsm>308</dsm> + <drm>255</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sony SMC-70 - SSDD 3.5" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>70</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + </sectorIds> + </side1> + <label>SON1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>135</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Spectravideo 318/328 - SSDD 48 tpi 5.25" - 256 x 17</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>17</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <label>SPE1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>156</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Spectravideo SV-328 - DSDD 48 tpi 5.25" - 256 x 17</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>17</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>SPE2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>162</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Sperry UTS 30, UTS 5000 - DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SPE2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>354</dsm> + <drm>383</drm> + <al0>252</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Spectravideo - SSDD 48 tpi 5.25" - 256 x 17</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>17</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <label>SPE3</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>157</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Spectravideo - DSDD 48 tpi 5.25" - 256 x 17</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>17</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>SPE4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>163</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Spectravideo - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SPE5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>197</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Spectravideo - SSDD 3.5" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <label>SPE6</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>163</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Superbrain JR - SSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>35</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <label>SUP1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>81</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>true</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Superbrain 40 track - SSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <label>SUP2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>94</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>true</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Superbrain QD - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>35</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>SUP3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>169</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>true</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Superbrain II - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>SUP4</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>196</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>true</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Superbrain - SSDD 48 tpi 5.25" - 128 x 30</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>30</sectorsPerTrack> + <bytesPerSector>128</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>19</int> + <int>22</int> + <int>25</int> + <int>28</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + <int>17</int> + <int>20</int> + <int>23</int> + <int>26</int> + <int>29</int> + </sectorIds> + </side1> + <label>SUP5</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>142</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>true</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>System Group 2800 - DSDD 8" - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SYS1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>1</exm> + <dsm>303</dsm> + <drm>255</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Tarbell - DSDD 8" - 512 x 15</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>15</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>12</int> + <int>13</int> + <int>14</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>12</int> + <int>13</int> + <int>14</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TAR1</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>0</exm> + <dsm>303</dsm> + <drm>169</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Tatung TPC2000 - DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>TAT1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>354</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Techron TEF 10 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>2</int> + <int>5</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>2</int> + <int>5</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TEC1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>394</dsm> + <drm>319</drm> + <al0>248</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Techron TEF 12 - DSHD 96 tpi 5.25" - 512 x 17</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>17</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TEC2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>670</dsm> + <drm>767</drm> + <al0>255</al0> + <al1>240</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Tektronix 4170 - DSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>TEK1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>153</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Teletek - SSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>25</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>23</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>21</int> + <int>2</int> + <int>8</int> + <int>14</int> + </sectorIds> + </side1> + <label>TEL1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>242</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Teletek Systemaster - DSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>2</int> + <int>8</int> + <int>14</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>4</int> + <int>10</int> + <int>16</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>6</int> + <int>12</int> + <int>18</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>2</int> + <int>8</int> + <int>14</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>4</int> + <int>10</int> + <int>16</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>6</int> + <int>12</int> + <int>18</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>TEL2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>172</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Teletek Systemaster - DSDD 96 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>2</int> + <int>8</int> + <int>14</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>4</int> + <int>10</int> + <int>16</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>6</int> + <int>12</int> + <int>18</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>2</int> + <int>8</int> + <int>14</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>4</int> + <int>10</int> + <int>16</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>6</int> + <int>12</int> + <int>18</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>TEL3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>353</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TeleVideo 8nn/TPC-1 CP/M - DSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>6</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TEL4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TeleVideo 1603 - DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TEL5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>354</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TeleVideo 806 TurboDOS - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TEL6</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>200</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TeleVideo 8nn TurboDOS - DSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>6</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TEL7</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Timex/Sinclair 2068+AERCO FD-68 RP/M - DSDD 48 tpi 5.25" -1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TIM1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>189</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Tokyo Electron 80W - DSHD 3.5" - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TOK1</label> + <bsh>6</bsh> + <blm>63</blm> + <exm>3</exm> + <dsm>160</dsm> + <drm>255</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Toshiba T100, T200 - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TOS1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>255</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>6</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Toshiba 300 - DSDD 96 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TOS2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>318</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Toshiba T-250 - DSHD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>19</int> + <int>22</int> + <int>25</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + <int>17</int> + <int>20</int> + <int>23</int> + <int>26</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>18</int> + <int>21</int> + <int>24</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>10</int> + <int>13</int> + <int>16</int> + <int>19</int> + <int>22</int> + <int>25</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>11</int> + <int>14</int> + <int>17</int> + <int>20</int> + <int>23</int> + <int>26</int> + <int>3</int> + <int>6</int> + <int>9</int> + <int>12</int> + <int>15</int> + <int>18</int> + <int>21</int> + <int>24</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TOS3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>487</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Transtec - SSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <label>TRA1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TRS-80 Model 1, Omikron CP/M - SSSD 48 tpi 5.25" - 128 x 18</comment> + <encoding>FM</encoding> + <bitrate>LOW</bitrate> + <cylinders>35</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>128</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>13</int> + <int>17</int> + <int>3</int> + <int>7</int> + <int>11</int> + <int>15</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>14</int> + <int>18</int> + <int>4</int> + <int>8</int> + <int>12</int> + <int>16</int> + </sectorIds> + </side1> + <label>TRS1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>71</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TRS-80 Model 1, Bigmem CP/M - SSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>7</int> + <int>13</int> + <int>19</int> + <int>25</int> + <int>5</int> + <int>11</int> + <int>17</int> + <int>23</int> + <int>3</int> + <int>9</int> + <int>15</int> + <int>21</int> + <int>2</int> + <int>8</int> + <int>14</int> + </sectorIds> + </side1> + <label>TRS2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>243</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TRS-80 Model 1, ColorPower II - SSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + </sectorIds> + </side1> + <label>TRS3</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TRS-80, Pickles & Trout CP/M - SSDD 8" - 512 x 16</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <label>TRS6</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>299</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TRS-80, Holmes CP/M - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TRS7</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>190</dsm> + <drm>63</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TRS-80, MM CP/M - SSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <label>TRS8</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>94</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TRS-80 Model 4, 4P; MT CP/M - SSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>17</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + <int>18</int> + </sectorIds> + </side1> + <label>TRS9</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>84</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TRS-80 Model 4, 4P; MT CP/M - DSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>17</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + <int>18</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>17</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + <int>18</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TRSA</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>174</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TRS-80 Model 4, 4P - SSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <label>TRSB</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>155</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TRS-80 Model 4P-Montezuma800K - DSDD 96tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TRSD</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>399</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TRS-80 II/12/16 Aton CP/M - DSHD 8" - 1024 x 8</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>4</int> + <int>7</int> + <int>2</int> + <int>5</int> + <int>8</int> + <int>3</int> + <int>6</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>TRSF</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>608</dsm> + <drm>191</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TRS-80 II/12/16 Pickles & Trout - DSHD 8" - 512 x 16</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>4</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>TRSG</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>608</dsm> + <drm>191</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>TRS-80 Model 4, Montezuma - DSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>17</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + <int>18</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>11</int> + <int>13</int> + <int>15</int> + <int>17</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + <int>10</int> + <int>12</int> + <int>14</int> + <int>16</int> + <int>18</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>TRSH</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>174</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>U-Micro 1000 - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>UMI1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>395</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Varian Spectra AA/20, DS-15 - DSDD 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>VAR1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>317</dsm> + <drm>63</drm> + <al0>96</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>2</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Vector 4 - DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <order>EAGLE</order> + <label>VEC1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>356</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Visual 1050 - SSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <label>VIS1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Wangwriter - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>WAN1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>155</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Wave Mate Bullet - SSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <label>WAV1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>189</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Wave Mate Bullet - DSDD 96 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>WAV2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>394</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Wave Mate Bullet - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>WAV3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Wave Mate Bullet - SSHD 8" - 1024 x 9</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <label>WAV4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>336</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xerox - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>XER1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>170</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xerox 820 - SSSD 48 tpi 5.25" - 128 x 18</comment> + <encoding>FM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>128</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>11</int> + <int>16</int> + <int>3</int> + <int>8</int> + <int>13</int> + <int>18</int> + <int>5</int> + <int>10</int> + <int>15</int> + <int>2</int> + <int>7</int> + <int>12</int> + <int>17</int> + <int>4</int> + <int>9</int> + <int>14</int> + </sectorIds> + </side1> + <label>XER2</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>83</dsm> + <drm>31</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xerox 820 II - SSDD 48 tpi 5.25" - 256 x 17</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>17</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <label>XER3</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>156</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xerox 820-II, 16/8 - DSDD 48 tpi 5.25" - 256 x 17</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>17</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>XER4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>162</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xerox 16/8 - SSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <label>XER5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>242</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>XEROX 16/8 - DSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <order>CYLINDERS</order> + <label>XER7</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>162</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xerox 820, S/W Publishers DD - SSDD 48 tpi 5.25" - 256 x 18</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>18</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + </sectorIds> + </side1> + <label>XER8</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>166</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xerox 3700 Laser Printer - DSDD 48 tpi 5.25" - 256 x 17</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>17</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <order>CYLINDERS</order> + <label>XER9</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>162</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xerox 16/8, 820 II - SSDD 48 tpi 5.25"</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>17</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <label>XERB</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>156</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xerox 16/8 - SSDD 48 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <label>XERC</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xerox 16/8 Special - SSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <label>XERD</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>151</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xerox 16/8, 820-II - DSDD 48 tpi 5.25" - 256 x 17</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>17</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <order>EAGLE</order> + <label>XERE</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>162</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xerox 16/8 Special - DSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <order>CYLINDERS</order> + <label>XERF</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>155</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xerox 3700 Laser Printer - DSDD 48 tpi 5.25" - 256 x 17</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>17</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>XERG</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>162</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Xor 5 - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>2</int> + <int>7</int> + <int>3</int> + <int>8</int> + <int>4</int> + <int>9</int> + <int>5</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>6</int> + <int>2</int> + <int>7</int> + <int>3</int> + <int>8</int> + <int>4</int> + <int>9</int> + <int>5</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>XOR1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>191</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>XYZ - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>5</int> + <int>9</int> + <int>3</int> + <int>7</int> + <int>2</int> + <int>6</int> + <int>10</int> + <int>4</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>11</int> + <int>15</int> + <int>19</int> + <int>13</int> + <int>17</int> + <int>12</int> + <int>16</int> + <int>20</int> + <int>14</int> + <int>18</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>XYZ1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zeiss Video Analysis System - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>ZEI1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>299</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zenith Z-37 Disk - SSSD 48 tpi 5.25" - 256 x 10</comment> + <encoding>FM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <label>ZEN1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>91</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zenith Z-37 Disk - DSDD 96 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ZEN2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>315</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zenith Z89, Heath H89 - DSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ZEN3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>155</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zenith Z90 - SSDD 48 tpi 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <label>ZEN5</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>151</dsm> + <drm>127</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zenith Z-100 - SSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <label>ZEN7</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>151</dsm> + <drm>127</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zenith Z-100 - DSDD 48 tpi 5.25" - 512 x 8</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ZEN8</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>155</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zenith Z-100 - SSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>10</int> + <int>19</int> + <int>2</int> + <int>11</int> + <int>20</int> + <int>3</int> + <int>12</int> + <int>21</int> + <int>4</int> + <int>13</int> + <int>22</int> + <int>5</int> + <int>14</int> + <int>23</int> + <int>6</int> + </sectorIds> + </side1> + <label>ZENA</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>242</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zenith Z-37 Disk - DSDD 96 (Half drive) 5.25" - 256 x 16</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ZENB</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>155</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zenith/Heath H-89 Ext Density - DSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ZENC</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>195</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zenith Z-100, Heath H-47 - DSDD 8" - 256 x 26</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>2</sides> + <sectorsPerTrack>26</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>10</int> + <int>19</int> + <int>2</int> + <int>11</int> + <int>20</int> + <int>3</int> + <int>12</int> + <int>21</int> + <int>4</int> + <int>13</int> + <int>22</int> + <int>5</int> + <int>14</int> + <int>23</int> + <int>6</int> + <int>15</int> + <int>24</int> + <int>7</int> + <int>16</int> + <int>25</int> + <int>8</int> + <int>17</int> + <int>26</int> + <int>9</int> + <int>18</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>10</int> + <int>19</int> + <int>2</int> + <int>11</int> + <int>20</int> + <int>3</int> + <int>12</int> + <int>21</int> + <int>4</int> + <int>13</int> + <int>22</int> + <int>5</int> + <int>14</int> + <int>23</int> + <int>6</int> + <int>15</int> + <int>24</int> + <int>7</int> + <int>16</int> + <int>25</int> + <int>8</int> + <int>17</int> + <int>26</int> + <int>9</int> + <int>18</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ZENE</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>497</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zenith Z-37 - SSDD 48 tpi 5.25" - 1024 x 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <label>ZENF</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>190</dsm> + <drm>127</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zenith/Heath H89/H90 Magnolia 7736 - SSHD 8" - 512 x 16</comment> + <encoding>MFM</encoding> + <bitrate>HIGH</bitrate> + <cylinders>77</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <label>ZENH</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>299</dsm> + <drm>191</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zorba - DSDD 48 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ZOR1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Zorba - DSDD 96 tpi 5.25" - 512 x 10</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ZOR2</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>194</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>PIC-DISK SSDD 96tpi 3.5"</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>1</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>3</int> + <int>5</int> + <int>7</int> + <int>9</int> + <int>2</int> + <int>4</int> + <int>6</int> + <int>8</int> + </sectorIds> + </side1> + <label>PIC1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>194</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>SAM COUPE Pro-DOS - DSDD 160 tpi 3.5"</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>A2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>356</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Acorn CPM</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>CYLINDERS</order> + <label>ACPM</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>200</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC 178K Data 40trk 9sct 64dir 1Kpb Side 2</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>DA1B</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>179</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>40</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC 187K Data 42trk 9sct 64dir 1Kpb Side 2</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>42</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>DA2B</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>188</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>42</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC-B360 358K Data 80trk 9sct 64dir 2Kpb Side 1</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + </sectorIds> + </side1> + <label>DA4A</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>179</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC-B360 358K Data 80trk 9sct 64dir 2Kpb Side 2</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>DA4B</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>179</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>80</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC 356K Data 40trk 9sct 128dir 2Kpb Two Sides</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DAT5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>179</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>DOBBERTIN 716K Data 80trk 9sct 128dir 4Kpb Two Sides</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>0</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>0</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DDOB</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>179</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC-STD 169K System 40trk 9sct 64dir 1Kpb Side 1</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side1> + <label>SY1A</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC 169K System 40trk 9sct 64dir 1Kpb Side 2</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>SY1B</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>42</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC 178K System 42trk 9sct 64dir 1Kpb Side 1</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>42</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side1> + <label>SY2A</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>179</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC 178K System 42trk 9sct 64dir 1Kpb Side 2</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>42</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>SY2B</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>179</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>44</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC 253K System 60trk 9sct 64dir 1Kpb Side 1 </comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>60</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side1> + <label>SY3A</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>254</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC 253K System 60trk 9sct 64dir 1Kpb Side 2</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>60</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>SY3B</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>254</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>62</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC-B360 348K System 80trk 9sct 64dir 2Kpb Side 1</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side1> + <label>SY4A</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>174</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC-B360 348K System 80trk 9sct 64dir 2Kpb Side 2</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>SY4B</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>174</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>82</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC 346K System 40trk 9sct 128dir 2Kpb Two Sides</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SYS5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>174</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC 344K System 80trk 9sct 128dir 4Kpb Side 1</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side1> + <label>SY6A</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>86</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC 344K System 80trk 9sct 128dir 4Kpb Side 2</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>SY6B</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>86</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>82</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>DOBBERTIN 704K System 80trk 9sct 128dir 4Kpb Two Sides</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SDOB</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>176</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>ReadBIG 706K System 80trk 9sct 128dir 2Kpb Two Sides</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>41</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SBIG</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>354</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC-STD 154K Ibm-Cpm86 40trk 8sct 64dir 1Kpb Side 1</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + </sectorIds> + </side1> + <label>IB1A</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>155</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>CPC 154K Ibm-Cpm86 40trk 8sct 64dir 1Kpb Side 2</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>8</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>IB1B</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>155</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>41</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>PCW-STD 173K Format 40trk 9sct 64dir 1Kpb Side 1</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <label>PC1A</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>174</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>PCW 173K Format 40trk 9sct 64dir 1Kpb Side 2</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>EAGLE</order> + <label>PC1B</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>174</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>41</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>PCW 346K Format 40trk 9sct 256dir 2Kpb Two Sides</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>PCW2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>176</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>PCW 706K Format 80trk 9sct 256dir 2Kpb Two Sides</comment> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <label>PCW3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>356</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>PCW 784K Format 80trk 10sct 256dir 4Kpb Two Sides</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DXT3</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>197</dsm> + <drm>255</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>DiskPara3 796K Format 80trk 10sct 128dir 2Kpb Two Sides</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DXT4</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>399</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>DiskPara 824K Format 83trk 10sct 192dir 2Kpb Two Sides</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>83</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>0</sideId> + <sectorIds> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + <int>17</int> + <int>18</int> + <int>19</int> + <int>20</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>DXT5</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>414</dsm> + <drm>191</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>VORTEX 704K Format 80trk 9sct 128dir 4Kpb Two Sides</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>VRTX</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>176</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>RAMDOS-D1 716K Format 80trk 9sct 128dir 2Kpb Two Sides </comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>RDD1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>359</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>RAMDOS-D10 796K Format 80trk 10sct 128dir 2Kpb Two Sides</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>11</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>11</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>RD10</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>399</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>RAMDOS-D2 712K Format 80trk 9sct 256dir 2Kpb Two Sides </comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>21</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>21</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>RDD2</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>359</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>RAMDOS-D20 792K Format 80trk 10sct 256dir 2Kpb Two Sides</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>31</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>31</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>RD20</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>399</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad ZX Spectrum +3 - SSDD 64dir 1Kpb 180K - 173K user free</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <label>ZX0</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>174</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad ZX Spectrum +3 - DSDD 128dir 2Kpb 720K - 710K user free</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>3</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ZX3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>356</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Altos Series 5 - DSDD 96 tpi 5.25" - 512 x 9</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>ALT6</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>176</dsm> + <drm>255</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>64</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>PC1715 SCP (80*2* 5,1024 4 OFS 4k DIR) 5.25"</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>A780</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>389</dsm> + <drm>127</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>4</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>PC1715 CPA (80*2* 5,1024 0 OFS 6k DIR) 5.25"</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>5</sectorsPerTrack> + <bytesPerSector>1024</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>A800</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>399</dsm> + <drm>191</drm> + <al0>224</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad PCW8256 - DSDD 48 tpi 5.25"</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AMS1</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>356</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad PCW8256 - SSDD 48 tpi 3" (JOYCE-SYSTEM)</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <label>AMS3</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>174</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad CPC System - SSDD 48 tpi 3" or 5.25"</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>65</int> + <int>66</int> + <int>67</int> + <int>68</int> + <int>69</int> + <int>70</int> + <int>71</int> + <int>72</int> + <int>73</int> + </sectorIds> + </side1> + <label>AMS4</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>170</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad CPC-Data - SSDD 48 tpi 3" or 5.25"</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>40</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>5</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>193</int> + <int>194</int> + <int>195</int> + <int>196</int> + <int>197</int> + <int>198</int> + <int>199</int> + <int>200</int> + <int>201</int> + </sectorIds> + </side1> + <label>AMS5</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>179</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad B360K - SSDD 96 tpi 5.25" SKEW 2</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>65</int> + <int>66</int> + <int>67</int> + <int>68</int> + <int>69</int> + <int>70</int> + <int>71</int> + <int>72</int> + <int>73</int> + </sectorIds> + </side1> + <label>AMS6</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>1</exm> + <dsm>174</dsm> + <drm>63</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad VORTEX - DSDD 96 tpi 5.25"</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AMS7</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>176</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad CPC System DSDD 96tpi 5.25" - DOBBERTIN -</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>65</int> + <int>66</int> + <int>67</int> + <int>68</int> + <int>69</int> + <int>70</int> + <int>71</int> + <int>72</int> + <int>73</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>65</int> + <int>66</int> + <int>67</int> + <int>68</int> + <int>69</int> + <int>70</int> + <int>71</int> + <int>72</int> + <int>73</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AMS8</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>176</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>2</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad DOBBERTIN DATA DSDD 96 tpi 5.25" Skew 5</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>193</int> + <int>194</int> + <int>195</int> + <int>196</int> + <int>197</int> + <int>198</int> + <int>199</int> + <int>200</int> + <int>201</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>193</int> + <int>194</int> + <int>195</int> + <int>196</int> + <int>197</int> + <int>198</int> + <int>199</int> + <int>200</int> + <int>201</int> + </sectorIds> + </side2> + <label>AMS9</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>179</dsm> + <drm>127</drm> + <al0>128</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad PCW8256 - DSDD 96 tpi 5.25" 10 x 512 788K</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>AMSA</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>197</dsm> + <drm>255</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad PCW Joyce - SF2DD (824 kb - 256 entries)</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>84</cylinders> + <sides>2</sides> + <sectorsPerTrack>10</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>SF2D</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>208</dsm> + <drm>255</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Amstrad PCW Joyce - 168 Track DD (740 kb - 256 entries)</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>84</cylinders> + <sides>2</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + </sectorIds> + </side2> + <order>SIDES</order> + <label>168D</label> + <bsh>5</bsh> + <blm>31</blm> + <exm>3</exm> + <dsm>187</dsm> + <drm>255</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>1</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Extended CPC 3" 43-track</comment> + <encoding>MFM</encoding> + <bitrate>LOW</bitrate> + <cylinders>43</cylinders> + <sides>1</sides> + <sectorsPerTrack>9</sectorsPerTrack> + <bytesPerSector>512</bytesPerSector> + <skew>2</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>193</int> + <int>194</int> + <int>195</int> + <int>196</int> + <int>197</int> + <int>198</int> + <int>199</int> + <int>200</int> + <int>201</int> + </sectorIds> + </side1> + <label>AMS7</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>193</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>0</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Apple // CPM card 13-sector</comment> + <encoding>GCR</encoding> + <bitrate>LOW</bitrate> + <cylinders>35</cylinders> + <sides>1</sides> + <sectorsPerTrack>13</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + </sectorIds> + </side1> + <label>APL1</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>103</dsm> + <drm>47</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Apple // CPM card 16-sector</comment> + <encoding>GCR</encoding> + <bitrate>LOW</bitrate> + <cylinders>35</cylinders> + <sides>1</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <label>APL2</label> + <bsh>3</bsh> + <blm>7</blm> + <exm>0</exm> + <dsm>127</dsm> + <drm>63</drm> + <al0>192</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + <CpmDefinition> + <comment>Apple // CPM card special</comment> + <encoding>GCR</encoding> + <bitrate>LOW</bitrate> + <cylinders>80</cylinders> + <sides>2</sides> + <sectorsPerTrack>16</sectorsPerTrack> + <bytesPerSector>256</bytesPerSector> + <skew>0</skew> + <side1> + <sideId>0</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side1> + <side2> + <sideId>1</sideId> + <sectorIds> + <int>1</int> + <int>2</int> + <int>3</int> + <int>4</int> + <int>5</int> + <int>6</int> + <int>7</int> + <int>8</int> + <int>9</int> + <int>10</int> + <int>11</int> + <int>12</int> + <int>13</int> + <int>14</int> + <int>15</int> + <int>16</int> + </sectorIds> + </side2> + <label>APL3</label> + <bsh>4</bsh> + <blm>15</blm> + <exm>0</exm> + <dsm>313</dsm> + <drm>255</drm> + <al0>240</al0> + <al1>0</al1> + <ofs>3</ofs> + <sofs>0</sofs> + <complement>false</complement> + <evenOdd>false</evenOdd> + </CpmDefinition> + </definitions> + <creation>2016-08-24T02:44:59.045767Z</creation> </CpmDefinitions> \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Cram.cs b/DiscImageChef.Filesystems/Cram.cs index c34de482..d921332b 100644 --- a/DiscImageChef.Filesystems/Cram.cs +++ b/DiscImageChef.Filesystems/Cram.cs @@ -51,20 +51,16 @@ namespace DiscImageChef.Filesystems { Name = "Cram filesystem"; PluginUUID = new Guid("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public Cram(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Cram filesystem"; PluginUUID = new Guid("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } enum CramCompression : ushort @@ -83,14 +79,12 @@ namespace DiscImageChef.Filesystems public uint size; public uint flags; public uint future; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] signature; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] signature; public uint crc; public uint edition; public uint blocks; public uint files; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] name; } /// <summary> @@ -101,8 +95,7 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Start >= partition.End) - return false; + if(partition.Start >= partition.End) return false; byte[] sector = imagePlugin.ReadSector(partition.Start); @@ -111,7 +104,8 @@ namespace DiscImageChef.Filesystems return magic == Cram_MAGIC || magic == Cram_CIGAM; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { byte[] sector = imagePlugin.ReadSector(partition.Start); uint magic = BitConverter.ToUInt32(sector, 0x00); @@ -135,12 +129,11 @@ namespace DiscImageChef.Filesystems StringBuilder sbInformation = new StringBuilder(); sbInformation.AppendLine("Cram file system"); - if(littleEndian) - sbInformation.AppendLine("Little-endian"); - else - sbInformation.AppendLine("Big-endian"); + if(littleEndian) sbInformation.AppendLine("Little-endian"); + else sbInformation.AppendLine("Big-endian"); sbInformation.AppendFormat("Volume edition {0}", crSb.edition).AppendLine(); - sbInformation.AppendFormat("Volume name: {0}", StringHandlers.CToString(crSb.name, CurrentEncoding)).AppendLine(); + sbInformation.AppendFormat("Volume name: {0}", StringHandlers.CToString(crSb.name, CurrentEncoding)) + .AppendLine(); sbInformation.AppendFormat("Volume has {0} bytes", crSb.size).AppendLine(); sbInformation.AppendFormat("Volume has {0} blocks", crSb.blocks).AppendLine(); sbInformation.AppendFormat("Volume has {0} files", crSb.files).AppendLine(); diff --git a/DiscImageChef.Filesystems/ECMA67.cs b/DiscImageChef.Filesystems/ECMA67.cs index 10eb5322..6dbc624f 100644 --- a/DiscImageChef.Filesystems/ECMA67.cs +++ b/DiscImageChef.Filesystems/ECMA67.cs @@ -53,63 +53,48 @@ namespace DiscImageChef.Filesystems { Name = "ECMA-67"; PluginUUID = new Guid("62A2D44A-CBC1-4377-B4B6-28C5C92034A1"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } public ECMA67(ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "ECMA-67"; PluginUUID = new Guid("62A2D44A-CBC1-4377-B4B6-28C5C92034A1"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } - readonly byte[] ECMA67_Magic = { 0x56, 0x4F, 0x4C }; + readonly byte[] ECMA67_Magic = {0x56, 0x4F, 0x4C}; [StructLayout(LayoutKind.Sequential, Pack = 1)] struct VolumeLabel { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] labelIdentifier; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] labelIdentifier; public byte labelNumber; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] volumeIdentifier; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] volumeIdentifier; public byte volumeAccessibility; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 26)] - public byte[] reserved1; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public byte[] owner; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] reserved2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 26)] public byte[] reserved1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] owner; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] reserved2; public byte surface; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] reserved3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] reserved3; public byte recordLength; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] reserved4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] reserved4; public byte fileLabelAllocation; public byte labelStandardVersion; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] - public byte[] reserved5; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] public byte[] reserved5; } public override bool Identify(ImagePlugin imagePlugin, Partition partition) { - if(partition.Start > 0) - return false; + if(partition.Start > 0) return false; - if(partition.End < 8) - return false; + if(partition.End < 8) return false; byte[] sector = imagePlugin.ReadSector(6); - if(sector.Length != 128) - return false; + if(sector.Length != 128) return false; VolumeLabel vol = new VolumeLabel(); IntPtr volPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vol)); diff --git a/DiscImageChef.Filesystems/EFS.cs b/DiscImageChef.Filesystems/EFS.cs index d7af2710..2c9cf730 100644 --- a/DiscImageChef.Filesystems/EFS.cs +++ b/DiscImageChef.Filesystems/EFS.cs @@ -67,11 +67,9 @@ namespace DiscImageChef.Filesystems /* 28: magic [0] */ public uint sb_magic; /* 32: name of filesystem */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] sb_fname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] sb_fname; /* 38: name of filesystem pack */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] sb_fpack; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] sb_fpack; /* 44: bitmap size (in bytes) */ public int sb_bmsize; /* 48: total free data blocks */ @@ -85,8 +83,7 @@ namespace DiscImageChef.Filesystems /* 64: last allocated inode */ public int sb_lastinode; /* 68: unused */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] sb_spare; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] sb_spare; /* 88: checksum (all above) */ public uint sb_checksum; } @@ -105,26 +102,21 @@ namespace DiscImageChef.Filesystems { Name = "Extent File System Plugin"; PluginUUID = new Guid("52A43F90-9AF3-4391-ADFE-65598DEEABAB"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public EFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Extent File System Plugin"; PluginUUID = new Guid("52A43F90-9AF3-4391-ADFE-65598DEEABAB"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; // Misaligned if(imagePlugin.ImageInfo.xmlMediaType == ImagePlugins.XmlMediaType.OpticalDisc) @@ -132,12 +124,10 @@ namespace DiscImageChef.Filesystems EFS_Superblock efs_sb = new EFS_Superblock(); uint sbSize = (uint)((Marshal.SizeOf(efs_sb) + 0x200) / imagePlugin.GetSectorSize()); - if((Marshal.SizeOf(efs_sb) + 0x200) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if((Marshal.SizeOf(efs_sb) + 0x200) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize); - if(sector.Length < Marshal.SizeOf(efs_sb)) - return false; + if(sector.Length < Marshal.SizeOf(efs_sb)) return false; byte[] sbpiece = new byte[Marshal.SizeOf(efs_sb)]; @@ -145,39 +135,37 @@ namespace DiscImageChef.Filesystems efs_sb = BigEndianMarshal.ByteArrayToStructureBigEndian<EFS_Superblock>(sbpiece); - DicConsole.DebugWriteLine("EFS plugin", "magic at 0x{0:X3} = 0x{1:X8} (expected 0x{2:X8} or 0x{3:X8})", 0x200, efs_sb.sb_magic, EFS_Magic, EFS_Magic_New); + DicConsole.DebugWriteLine("EFS plugin", "magic at 0x{0:X3} = 0x{1:X8} (expected 0x{2:X8} or 0x{3:X8})", + 0x200, efs_sb.sb_magic, EFS_Magic, EFS_Magic_New); - if(efs_sb.sb_magic == EFS_Magic || efs_sb.sb_magic == EFS_Magic_New) - return true; + if(efs_sb.sb_magic == EFS_Magic || efs_sb.sb_magic == EFS_Magic_New) return true; } else { EFS_Superblock efsSb = new EFS_Superblock(); uint sbSize = (uint)(Marshal.SizeOf(efsSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(efsSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(efsSb) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start + 1, sbSize); - if(sector.Length < Marshal.SizeOf(efsSb)) - return false; + if(sector.Length < Marshal.SizeOf(efsSb)) return false; efsSb = BigEndianMarshal.ByteArrayToStructureBigEndian<EFS_Superblock>(sector); - DicConsole.DebugWriteLine("EFS plugin", "magic at {0} = 0x{1:X8} (expected 0x{2:X8} or 0x{3:X8})", 1, efsSb.sb_magic, EFS_Magic, EFS_Magic_New); + DicConsole.DebugWriteLine("EFS plugin", "magic at {0} = 0x{1:X8} (expected 0x{2:X8} or 0x{3:X8})", 1, + efsSb.sb_magic, EFS_Magic, EFS_Magic_New); - if(efsSb.sb_magic == EFS_Magic || efsSb.sb_magic == EFS_Magic_New) - return true; + if(efsSb.sb_magic == EFS_Magic || efsSb.sb_magic == EFS_Magic_New) return true; } return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < 512) - return; + if(imagePlugin.GetSectorSize() < 512) return; EFS_Superblock efsSb = new EFS_Superblock(); @@ -185,12 +173,10 @@ namespace DiscImageChef.Filesystems if(imagePlugin.ImageInfo.xmlMediaType == ImagePlugins.XmlMediaType.OpticalDisc) { uint sbSize = (uint)((Marshal.SizeOf(efsSb) + 0x400) / imagePlugin.GetSectorSize()); - if((Marshal.SizeOf(efsSb) + 0x400) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if((Marshal.SizeOf(efsSb) + 0x400) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize); - if(sector.Length < Marshal.SizeOf(efsSb)) - return; + if(sector.Length < Marshal.SizeOf(efsSb)) return; byte[] sbpiece = new byte[Marshal.SizeOf(efsSb)]; @@ -198,31 +184,29 @@ namespace DiscImageChef.Filesystems efsSb = BigEndianMarshal.ByteArrayToStructureBigEndian<EFS_Superblock>(sbpiece); - DicConsole.DebugWriteLine("EFS plugin", "magic at 0x{0:X3} = 0x{1:X8} (expected 0x{2:X8} or 0x{3:X8})", 0x200, efsSb.sb_magic, EFS_Magic, EFS_Magic_New); + DicConsole.DebugWriteLine("EFS plugin", "magic at 0x{0:X3} = 0x{1:X8} (expected 0x{2:X8} or 0x{3:X8})", + 0x200, efsSb.sb_magic, EFS_Magic, EFS_Magic_New); } else { uint sbSize = (uint)(Marshal.SizeOf(efsSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(efsSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(efsSb) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start + 1, sbSize); - if(sector.Length < Marshal.SizeOf(efsSb)) - return; + if(sector.Length < Marshal.SizeOf(efsSb)) return; efsSb = BigEndianMarshal.ByteArrayToStructureBigEndian<EFS_Superblock>(sector); - DicConsole.DebugWriteLine("EFS plugin", "magic at {0} = 0x{1:X8} (expected 0x{2:X8} or 0x{3:X8})", 1, efsSb.sb_magic, EFS_Magic, EFS_Magic_New); + DicConsole.DebugWriteLine("EFS plugin", "magic at {0} = 0x{1:X8} (expected 0x{2:X8} or 0x{3:X8})", 1, + efsSb.sb_magic, EFS_Magic, EFS_Magic_New); } - if(efsSb.sb_magic != EFS_Magic && efsSb.sb_magic != EFS_Magic_New) - return; + if(efsSb.sb_magic != EFS_Magic && efsSb.sb_magic != EFS_Magic_New) return; StringBuilder sb = new StringBuilder(); sb.AppendLine("SGI extent filesystem"); - if(efsSb.sb_magic == EFS_Magic_New) - sb.AppendLine("New version"); + if(efsSb.sb_magic == EFS_Magic_New) sb.AppendLine("New version"); sb.AppendFormat("Filesystem size: {0} basic blocks", efsSb.sb_size).AppendLine(); sb.AppendFormat("First cylinder group starts at block {0}", efsSb.sb_firstcg).AppendLine(); sb.AppendFormat("Cylinder group size: {0} basic blocks", efsSb.sb_cgfsize).AppendLine(); @@ -234,14 +218,11 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} bytes on bitmap", efsSb.sb_bmsize).AppendLine(); sb.AppendFormat("{0} free blocks", efsSb.sb_tfree).AppendLine(); sb.AppendFormat("{0} free inodes", efsSb.sb_tinode).AppendLine(); - if(efsSb.sb_bmblock > 0) - sb.AppendFormat("Bitmap resides at block {0}", efsSb.sb_bmblock).AppendLine(); + if(efsSb.sb_bmblock > 0) sb.AppendFormat("Bitmap resides at block {0}", efsSb.sb_bmblock).AppendLine(); if(efsSb.sb_replsb > 0) sb.AppendFormat("Replacement superblock resides at block {0}", efsSb.sb_replsb).AppendLine(); - if(efsSb.sb_lastinode > 0) - sb.AppendFormat("Last inode allocated: {0}", efsSb.sb_lastinode).AppendLine(); - if(efsSb.sb_dirty > 0) - sb.AppendLine("Volume is dirty"); + if(efsSb.sb_lastinode > 0) sb.AppendFormat("Last inode allocated: {0}", efsSb.sb_lastinode).AppendLine(); + if(efsSb.sb_dirty > 0) sb.AppendLine("Volume is dirty"); sb.AppendFormat("Checksum: 0x{0:X8}", efsSb.sb_checksum).AppendLine(); sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(efsSb.sb_fname, CurrentEncoding)).AppendLine(); sb.AppendFormat("Volume pack: {0}", StringHandlers.CToString(efsSb.sb_fpack, CurrentEncoding)).AppendLine(); diff --git a/DiscImageChef.Filesystems/F2FS.cs b/DiscImageChef.Filesystems/F2FS.cs index 166b8787..8a1cc0ed 100644 --- a/DiscImageChef.Filesystems/F2FS.cs +++ b/DiscImageChef.Filesystems/F2FS.cs @@ -71,36 +71,23 @@ namespace DiscImageChef.Filesystems public uint node_ino; public uint meta_ino; public Guid uuid; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)] - public byte[] volume_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)] public byte[] volume_name; public uint extension_count; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list1; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list3; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list4; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list5; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list6; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list7; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list8; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list5; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list6; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list7; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list8; public uint cp_payload; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] - public byte[] version; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] - public byte[] init_version; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] version; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] init_version; public uint feature; public byte encryption_level; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] encrypt_pw_salt; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 871)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] encrypt_pw_salt; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 871)] public byte[] reserved; } const uint F2FS_Magic = 0xF2F52010; @@ -136,21 +123,17 @@ namespace DiscImageChef.Filesystems return false; uint sbAddr = F2FS_SuperOffset / imagePlugin.GetSectorSize(); - if(sbAddr == 0) - sbAddr = 1; + if(sbAddr == 0) sbAddr = 1; F2FS_Superblock f2fsSb = new F2FS_Superblock(); uint sbSize = (uint)(Marshal.SizeOf(f2fsSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(f2fsSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(f2fsSb) % imagePlugin.GetSectorSize() != 0) sbSize++; - if(partition.Start + sbAddr >= partition.End) - return false; + if(partition.Start + sbAddr >= partition.End) return false; byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize); - if(sector.Length < Marshal.SizeOf(f2fsSb)) - return false; + if(sector.Length < Marshal.SizeOf(f2fsSb)) return false; IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(f2fsSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(f2fsSb)); @@ -160,40 +143,37 @@ namespace DiscImageChef.Filesystems return f2fsSb.magic == F2FS_Magic; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < F2FS_MinSector || imagePlugin.GetSectorSize() > F2FS_MaxSector) - return; + if(imagePlugin.GetSectorSize() < F2FS_MinSector || imagePlugin.GetSectorSize() > F2FS_MaxSector) return; uint sbAddr = F2FS_SuperOffset / imagePlugin.GetSectorSize(); - if(sbAddr == 0) - sbAddr = 1; + if(sbAddr == 0) sbAddr = 1; F2FS_Superblock f2fsSb = new F2FS_Superblock(); uint sbSize = (uint)(Marshal.SizeOf(f2fsSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(f2fsSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(f2fsSb) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize); - if(sector.Length < Marshal.SizeOf(f2fsSb)) - return; + if(sector.Length < Marshal.SizeOf(f2fsSb)) return; IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(f2fsSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(f2fsSb)); f2fsSb = (F2FS_Superblock)Marshal.PtrToStructure(sbPtr, typeof(F2FS_Superblock)); Marshal.FreeHGlobal(sbPtr); - if(f2fsSb.magic != F2FS_Magic) - return; + if(f2fsSb.magic != F2FS_Magic) return; StringBuilder sb = new StringBuilder(); sb.AppendLine("F2FS filesystem"); sb.AppendFormat("Version {0}.{1}", f2fsSb.major_ver, f2fsSb.minor_ver).AppendLine(); sb.AppendFormat("{0} bytes per sector", 1 << (int)f2fsSb.log_sectorsize).AppendLine(); - sb.AppendFormat("{0} sectors ({1} bytes) per block", 1 << (int)f2fsSb.log_sectors_per_block, 1 << (int)f2fsSb.log_blocksize).AppendLine(); + sb.AppendFormat("{0} sectors ({1} bytes) per block", 1 << (int)f2fsSb.log_sectors_per_block, + 1 << (int)f2fsSb.log_blocksize).AppendLine(); sb.AppendFormat("{0} blocks per segment", f2fsSb.log_blocks_per_seg).AppendLine(); sb.AppendFormat("{0} blocks in volume", f2fsSb.block_count).AppendLine(); sb.AppendFormat("{0} segments per section", f2fsSb.segs_per_sec).AppendLine(); @@ -202,9 +182,12 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} segments", f2fsSb.segment_count).AppendLine(); sb.AppendFormat("Root directory resides on inode {0}", f2fsSb.root_ino).AppendLine(); sb.AppendFormat("Volume UUID: {0}", f2fsSb.uuid).AppendLine(); - sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(f2fsSb.volume_name, Encoding.Unicode, true)).AppendLine(); - sb.AppendFormat("Volume last mounted on kernel version: {0}", StringHandlers.CToString(f2fsSb.version)).AppendLine(); - sb.AppendFormat("Volume created on kernel version: {0}", StringHandlers.CToString(f2fsSb.init_version)).AppendLine(); + sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(f2fsSb.volume_name, Encoding.Unicode, true)) + .AppendLine(); + sb.AppendFormat("Volume last mounted on kernel version: {0}", StringHandlers.CToString(f2fsSb.version)) + .AppendLine(); + sb.AppendFormat("Volume created on kernel version: {0}", StringHandlers.CToString(f2fsSb.init_version)) + .AppendLine(); information = sb.ToString(); diff --git a/DiscImageChef.Filesystems/FAT.cs b/DiscImageChef.Filesystems/FAT.cs index b6578d10..095b3a96 100644 --- a/DiscImageChef.Filesystems/FAT.cs +++ b/DiscImageChef.Filesystems/FAT.cs @@ -55,26 +55,21 @@ namespace DiscImageChef.Filesystems { Name = "Microsoft File Allocation Table"; PluginUUID = new Guid("33513B2C-0D26-0D2D-32C3-79D8611158E0"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("IBM437"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("IBM437"); + else CurrentEncoding = encoding; } public FAT(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Microsoft File Allocation Table"; PluginUUID = new Guid("33513B2C-0D26-0D2D-32C3-79D8611158E0"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("IBM437"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("IBM437"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((2 + partition.Start) >= partition.End) - return false; + if((2 + partition.Start) >= partition.End) return false; ushort bps; byte spc; @@ -116,16 +111,16 @@ namespace DiscImageChef.Filesystems huge_sectors = BitConverter.ToUInt64(bpb_sector, 0x052); fat_id = fat_sector[0]; int bits_in_bps = Helpers.CountBits.Count(bps); - if(imagePlugin.ImageInfo.sectorSize >= 512) - bootable = BitConverter.ToUInt16(bpb_sector, 0x1FE); + if(imagePlugin.ImageInfo.sectorSize >= 512) bootable = BitConverter.ToUInt16(bpb_sector, 0x1FE); bool correct_spc = spc == 1 || spc == 2 || spc == 4 || spc == 8 || spc == 16 || spc == 32 || spc == 64; string msx_string = Encoding.ASCII.GetString(msx_id); string fat32_string = Encoding.ASCII.GetString(fat32_id); bool atari_oem_correct = atari_oem[0] >= 0x20 && atari_oem[1] >= 0x20 && atari_oem[2] >= 0x20 && atari_oem[3] >= 0x20 && atari_oem[4] >= 0x20 && atari_oem[5] >= 0x20; - bool dos_oem_correct = dos_oem[0] >= 0x20 && dos_oem[1] >= 0x20 && dos_oem[2] >= 0x20 && dos_oem[3] >= 0x20 && - dos_oem[4] >= 0x20 && dos_oem[5] >= 0x20 && dos_oem[6] >= 0x20 && dos_oem[7] >= 0x20; + bool dos_oem_correct = dos_oem[0] >= 0x20 && dos_oem[1] >= 0x20 && dos_oem[2] >= 0x20 && + dos_oem[3] >= 0x20 && dos_oem[4] >= 0x20 && dos_oem[5] >= 0x20 && + dos_oem[6] >= 0x20 && dos_oem[7] >= 0x20; string atari_string = Encoding.ASCII.GetString(atari_oem); string oem_string = Encoding.ASCII.GetString(dos_oem); @@ -157,7 +152,8 @@ namespace DiscImageChef.Filesystems ushort apricot_sectors = BitConverter.ToUInt16(bpb_sector, 0x58); byte apricot_media_descriptor = bpb_sector[0x5A]; ushort apricot_fat_sectors = BitConverter.ToUInt16(bpb_sector, 0x5B); - bool apricot_correct_spc = apricot_spc == 1 || apricot_spc == 2 || apricot_spc == 4 || apricot_spc == 8 || apricot_spc == 16 || apricot_spc == 32 || apricot_spc == 64; + bool apricot_correct_spc = apricot_spc == 1 || apricot_spc == 2 || apricot_spc == 4 || apricot_spc == 8 || + apricot_spc == 16 || apricot_spc == 32 || apricot_spc == 64; int bits_in_apricot_bps = Helpers.CountBits.Count(apricot_bps); byte apricot_partitions = bpb_sector[0x0C]; @@ -180,53 +176,60 @@ namespace DiscImageChef.Filesystems } // exFAT - if(oem_string == "EXFAT ") - return false; + if(oem_string == "EXFAT ") return false; // NTFS - if(oem_string == "NTFS " && bootable == 0xAA55 && fats_no == 0 && fat_sectors == 0) - return false; + if(oem_string == "NTFS " && bootable == 0xAA55 && fats_no == 0 && fat_sectors == 0) return false; // QNX4 - if(oem_string == "FQNX4FS ") - return false; + if(oem_string == "FQNX4FS ") return false; // HPFS if(16 + partition.Start <= partition.End) { uint hpfs_magic1, hpfs_magic2; - byte[] hpfs_sb_sector = imagePlugin.ReadSector(16 + partition.Start); // Seek to superblock, on logical sector 16 + byte[] hpfs_sb_sector = + imagePlugin.ReadSector(16 + partition.Start); // Seek to superblock, on logical sector 16 hpfs_magic1 = BitConverter.ToUInt32(hpfs_sb_sector, 0x000); hpfs_magic2 = BitConverter.ToUInt32(hpfs_sb_sector, 0x004); - if(hpfs_magic1 == 0xF995E849 && hpfs_magic2 == 0xFA53E9C5) - return false; + if(hpfs_magic1 == 0xF995E849 && hpfs_magic2 == 0xFA53E9C5) return false; } // FAT32 for sure - if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && sectors == 0 && fat_sectors == 0 && fat32_signature == 0x29 && fat32_string == "FAT32 ") - return true; + if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && sectors == 0 && fat_sectors == 0 && + fat32_signature == 0x29 && fat32_string == "FAT32 ") return true; // short FAT32 - if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && sectors == 0 && fat_sectors == 0 && fat32_signature == 0x28) - return big_sectors == 0 ? huge_sectors <= (partition.End - partition.Start) + 1 : big_sectors <= (partition.End - partition.Start) + 1; + if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && sectors == 0 && fat_sectors == 0 && + fat32_signature == 0x28) + return big_sectors == 0 + ? huge_sectors <= (partition.End - partition.Start) + 1 + : big_sectors <= (partition.End - partition.Start) + 1; // MSX-DOS FAT12 - if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && root_entries > 0 && sectors <= (partition.End - partition.Start) + 1 && fat_sectors > 0 && msx_string == "VOL_ID") - return true; + if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && root_entries > 0 && + sectors <= (partition.End - partition.Start) + 1 && fat_sectors > 0 && + msx_string == "VOL_ID") return true; // EBPB - if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && root_entries > 0 && fat_sectors > 0 && (bpb_signature == 0x28 || bpb_signature == 0x29)) - return sectors == 0 ? big_sectors <= (partition.End - partition.Start) + 1 : sectors <= (partition.End - partition.Start) + 1; + if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && root_entries > 0 && fat_sectors > 0 && + (bpb_signature == 0x28 || bpb_signature == 0x29)) + return sectors == 0 + ? big_sectors <= (partition.End - partition.Start) + 1 + : sectors <= (partition.End - partition.Start) + 1; // BPB - if(bits_in_bps == 1 && correct_spc && reserved_secs < (partition.End - partition.Start) && fats_no <= 2 && root_entries > 0 && fat_sectors > 0) - return sectors == 0 ? big_sectors <= (partition.End - partition.Start) + 1 : sectors <= (partition.End - partition.Start) + 1; + if(bits_in_bps == 1 && correct_spc && reserved_secs < (partition.End - partition.Start) && fats_no <= 2 && + root_entries > 0 && fat_sectors > 0) + return sectors == 0 + ? big_sectors <= (partition.End - partition.Start) + 1 + : sectors <= (partition.End - partition.Start) + 1; // Apricot BPB - if(bits_in_apricot_bps == 1 && apricot_correct_spc && apricot_reserved_secs < (partition.End - partition.Start) && apricot_fats_no <= 2 && apricot_root_entries > 0 && - apricot_fat_sectors > 0 && apricot_sectors <= (partition.End - partition.Start) + 1 && apricot_partitions == 0) - return true; + if(bits_in_apricot_bps == 1 && apricot_correct_spc && + apricot_reserved_secs < (partition.End - partition.Start) && apricot_fats_no <= 2 && + apricot_root_entries > 0 && apricot_fat_sectors > 0 && + apricot_sectors <= (partition.End - partition.Start) + 1 && apricot_partitions == 0) return true; // All FAT12 without BPB can only be used on floppies, without partitions. - if(partition.Start != 0) - return false; + if(partition.Start != 0) return false; // DEC Rainbow, lacks a BPB but has a very concrete structure... if(imagePlugin.GetSectors() == 800 && imagePlugin.GetSectorSize() == 512) @@ -240,11 +243,12 @@ namespace DiscImageChef.Filesystems bool equal_fat_ids = fat1_sector0[0] == fat2_sector0[0] && fat1_sector0[1] == fat2_sector0[1]; // Volume is software interleaved 2:1 MemoryStream rootMs = new MemoryStream(); - foreach(ulong rootSector in new[] { 0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20 }) + foreach(ulong rootSector in new[] {0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20}) { byte[] tmp = imagePlugin.ReadSector(rootSector); rootMs.Write(tmp, 0, tmp.Length); } + byte[] root_dir = rootMs.ToArray(); rootMs = null; bool valid_root_dir = true; @@ -254,19 +258,19 @@ namespace DiscImageChef.Filesystems { for(int c = 0; c < 11; c++) { - if((root_dir[c + e] < 0x20 && root_dir[c + e] != 0x00 && root_dir[c + e] != 0x05) || root_dir[c + e] == 0xFF || root_dir[c + e] == 0x2E) + if((root_dir[c + e] < 0x20 && root_dir[c + e] != 0x00 && root_dir[c + e] != 0x05) || + root_dir[c + e] == 0xFF || root_dir[c + e] == 0x2E) { valid_root_dir = false; break; } } - if(!valid_root_dir) - break; + if(!valid_root_dir) break; } - if(z80_di == 0xF3 && equal_fat_ids && (fat1_sector0[0] & 0xF0) == 0xF0 && fat1_sector0[1] == 0xFF && valid_root_dir) - return true; + if(z80_di == 0xF3 && equal_fat_ids && (fat1_sector0[0] & 0xF0) == 0xF0 && fat1_sector0[1] == 0xFF && + valid_root_dir) return true; } byte fat2 = fat_sector[1]; @@ -274,8 +278,7 @@ namespace DiscImageChef.Filesystems ushort fat_2nd_cluster = (ushort)(((fat2 << 8) + fat3) & 0xFFF); DicConsole.DebugWriteLine("FAT plugin", "1st fat cluster 1 = {0:X3}", fat_2nd_cluster); - if(fat_2nd_cluster < 0xFF0) - return false; + if(fat_2nd_cluster < 0xFF0) return false; ulong fat2_sector_no = 0; @@ -310,14 +313,13 @@ namespace DiscImageChef.Filesystems fat2_sector_no = 2; break; default: - if(fat_id < 0xE8) - return false; + if(fat_id < 0xE8) return false; + fat2_sector_no = 2; break; } - if(fat2_sector_no > partition.End) - return false; + if(fat2_sector_no > partition.End) return false; DicConsole.DebugWriteLine("FAT plugin", "2nd fat starts at = {0}", fat2_sector_no); @@ -326,13 +328,13 @@ namespace DiscImageChef.Filesystems fat2 = fat2_sector[1]; fat3 = fat2_sector[2]; fat_2nd_cluster = (ushort)(((fat2 << 8) + fat3) & 0xFFF); - if(fat_2nd_cluster < 0xFF0) - return false; + if(fat_2nd_cluster < 0xFF0) return false; return fat_id == fat2_sector[0]; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -378,9 +380,11 @@ namespace DiscImageChef.Filesystems dos30BPB = (BIOSParameterBlock30)Marshal.PtrToStructure(bpbPtr, typeof(BIOSParameterBlock30)); dos32BPB = (BIOSParameterBlock32)Marshal.PtrToStructure(bpbPtr, typeof(BIOSParameterBlock32)); dos33BPB = (BIOSParameterBlock33)Marshal.PtrToStructure(bpbPtr, typeof(BIOSParameterBlock33)); - shortEBPB = (BIOSParameterBlockShortEBPB)Marshal.PtrToStructure(bpbPtr, typeof(BIOSParameterBlockShortEBPB)); + shortEBPB = + (BIOSParameterBlockShortEBPB)Marshal.PtrToStructure(bpbPtr, typeof(BIOSParameterBlockShortEBPB)); EBPB = (BIOSParameterBlockEBPB)Marshal.PtrToStructure(bpbPtr, typeof(BIOSParameterBlockEBPB)); - shortFat32BPB = (FAT32ParameterBlockShort)Marshal.PtrToStructure(bpbPtr, typeof(FAT32ParameterBlockShort)); + shortFat32BPB = + (FAT32ParameterBlockShort)Marshal.PtrToStructure(bpbPtr, typeof(FAT32ParameterBlockShort)); Fat32BPB = (FAT32ParameterBlock)Marshal.PtrToStructure(bpbPtr, typeof(FAT32ParameterBlock)); ApricotBPB = (ApricotLabel)Marshal.PtrToStructure(bpbPtr, typeof(ApricotLabel)); @@ -398,17 +402,38 @@ namespace DiscImageChef.Filesystems int bits_in_bps_fat32 = Helpers.CountBits.Count(Fat32BPB.bps); int bits_in_bps_apricot = Helpers.CountBits.Count(ApricotBPB.mainBPB.bps); - bool correct_spc_atari = atariBPB.spc == 1 || atariBPB.spc == 2 || atariBPB.spc == 4 || atariBPB.spc == 8 || atariBPB.spc == 16 || atariBPB.spc == 32 || atariBPB.spc == 64; - bool correct_spc_msx = msxBPB.spc == 1 || msxBPB.spc == 2 || msxBPB.spc == 4 || msxBPB.spc == 8 || msxBPB.spc == 16 || msxBPB.spc == 32 || msxBPB.spc == 64; - bool correct_spc_dos20 = dos2BPB.spc == 1 || dos2BPB.spc == 2 || dos2BPB.spc == 4 || dos2BPB.spc == 8 || dos2BPB.spc == 16 || dos2BPB.spc == 32 || dos2BPB.spc == 64; - bool correct_spc_dos30 = dos30BPB.spc == 1 || dos30BPB.spc == 2 || dos30BPB.spc == 4 || dos30BPB.spc == 8 || dos30BPB.spc == 16 || dos30BPB.spc == 32 || dos30BPB.spc == 64; - bool correct_spc_dos32 = dos32BPB.spc == 1 || dos32BPB.spc == 2 || dos32BPB.spc == 4 || dos32BPB.spc == 8 || dos32BPB.spc == 16 || dos32BPB.spc == 32 || dos32BPB.spc == 64; - bool correct_spc_dos33 = dos33BPB.spc == 1 || dos33BPB.spc == 2 || dos33BPB.spc == 4 || dos33BPB.spc == 8 || dos33BPB.spc == 16 || dos33BPB.spc == 32 || dos33BPB.spc == 64; - bool correct_spc_dos34 = shortEBPB.spc == 1 || shortEBPB.spc == 2 || shortEBPB.spc == 4 || shortEBPB.spc == 8 || shortEBPB.spc == 16 || shortEBPB.spc == 32 || shortEBPB.spc == 64; - bool correct_spc_dos40 = EBPB.spc == 1 || EBPB.spc == 2 || EBPB.spc == 4 || EBPB.spc == 8 || EBPB.spc == 16 || EBPB.spc == 32 || EBPB.spc == 64; - bool correct_spc_fat32_short = shortFat32BPB.spc == 1 || shortFat32BPB.spc == 2 || shortFat32BPB.spc == 4 || shortFat32BPB.spc == 8 || shortFat32BPB.spc == 16 || shortFat32BPB.spc == 32 || shortFat32BPB.spc == 64; - bool correct_spc_fat32 = Fat32BPB.spc == 1 || Fat32BPB.spc == 2 || Fat32BPB.spc == 4 || Fat32BPB.spc == 8 || Fat32BPB.spc == 16 || Fat32BPB.spc == 32 || Fat32BPB.spc == 64; - bool correct_spc_apricot = ApricotBPB.mainBPB.spc == 1 || ApricotBPB.mainBPB.spc == 2 || ApricotBPB.mainBPB.spc == 4 || ApricotBPB.mainBPB.spc == 8 || ApricotBPB.mainBPB.spc == 16 || ApricotBPB.mainBPB.spc == 32 || ApricotBPB.mainBPB.spc == 64; + bool correct_spc_atari = atariBPB.spc == 1 || atariBPB.spc == 2 || atariBPB.spc == 4 || + atariBPB.spc == 8 || atariBPB.spc == 16 || atariBPB.spc == 32 || + atariBPB.spc == 64; + bool correct_spc_msx = msxBPB.spc == 1 || msxBPB.spc == 2 || msxBPB.spc == 4 || msxBPB.spc == 8 || + msxBPB.spc == 16 || msxBPB.spc == 32 || msxBPB.spc == 64; + bool correct_spc_dos20 = dos2BPB.spc == 1 || dos2BPB.spc == 2 || dos2BPB.spc == 4 || dos2BPB.spc == 8 || + dos2BPB.spc == 16 || dos2BPB.spc == 32 || dos2BPB.spc == 64; + bool correct_spc_dos30 = dos30BPB.spc == 1 || dos30BPB.spc == 2 || dos30BPB.spc == 4 || + dos30BPB.spc == 8 || dos30BPB.spc == 16 || dos30BPB.spc == 32 || + dos30BPB.spc == 64; + bool correct_spc_dos32 = dos32BPB.spc == 1 || dos32BPB.spc == 2 || dos32BPB.spc == 4 || + dos32BPB.spc == 8 || dos32BPB.spc == 16 || dos32BPB.spc == 32 || + dos32BPB.spc == 64; + bool correct_spc_dos33 = dos33BPB.spc == 1 || dos33BPB.spc == 2 || dos33BPB.spc == 4 || + dos33BPB.spc == 8 || dos33BPB.spc == 16 || dos33BPB.spc == 32 || + dos33BPB.spc == 64; + bool correct_spc_dos34 = shortEBPB.spc == 1 || shortEBPB.spc == 2 || shortEBPB.spc == 4 || + shortEBPB.spc == 8 || shortEBPB.spc == 16 || shortEBPB.spc == 32 || + shortEBPB.spc == 64; + bool correct_spc_dos40 = EBPB.spc == 1 || EBPB.spc == 2 || EBPB.spc == 4 || EBPB.spc == 8 || + EBPB.spc == 16 || EBPB.spc == 32 || EBPB.spc == 64; + bool correct_spc_fat32_short = shortFat32BPB.spc == 1 || shortFat32BPB.spc == 2 || + shortFat32BPB.spc == 4 || shortFat32BPB.spc == 8 || + shortFat32BPB.spc == 16 || shortFat32BPB.spc == 32 || + shortFat32BPB.spc == 64; + bool correct_spc_fat32 = Fat32BPB.spc == 1 || Fat32BPB.spc == 2 || Fat32BPB.spc == 4 || + Fat32BPB.spc == 8 || Fat32BPB.spc == 16 || Fat32BPB.spc == 32 || + Fat32BPB.spc == 64; + bool correct_spc_apricot = ApricotBPB.mainBPB.spc == 1 || ApricotBPB.mainBPB.spc == 2 || + ApricotBPB.mainBPB.spc == 4 || ApricotBPB.mainBPB.spc == 8 || + ApricotBPB.mainBPB.spc == 16 || ApricotBPB.mainBPB.spc == 32 || + ApricotBPB.mainBPB.spc == 64; // This is to support FAT partitions on hybrid ISO/USB images if(imagePlugin.ImageInfo.xmlMediaType == ImagePlugins.XmlMediaType.OpticalDisc) @@ -432,30 +457,43 @@ namespace DiscImageChef.Filesystems ApricotBPB.mainBPB.sectors /= 4; } - andos_oem_correct = dos33BPB.oem_name[0] < 0x20 && dos33BPB.oem_name[1] >= 0x20 && dos33BPB.oem_name[2] >= 0x20 && dos33BPB.oem_name[3] >= 0x20 && - dos33BPB.oem_name[4] >= 0x20 && dos33BPB.oem_name[5] >= 0x20 && dos33BPB.oem_name[6] >= 0x20 && dos33BPB.oem_name[7] >= 0x20; + andos_oem_correct = dos33BPB.oem_name[0] < 0x20 && dos33BPB.oem_name[1] >= 0x20 && + dos33BPB.oem_name[2] >= 0x20 && dos33BPB.oem_name[3] >= 0x20 && + dos33BPB.oem_name[4] >= 0x20 && dos33BPB.oem_name[5] >= 0x20 && + dos33BPB.oem_name[6] >= 0x20 && dos33BPB.oem_name[7] >= 0x20; - if(bits_in_bps_fat32 == 1 && correct_spc_fat32 && Fat32BPB.fats_no <= 2 && Fat32BPB.sectors == 0 && Fat32BPB.spfat == 0 && Fat32BPB.signature == 0x29 && Encoding.ASCII.GetString(Fat32BPB.fs_type) == "FAT32 ") + if(bits_in_bps_fat32 == 1 && correct_spc_fat32 && Fat32BPB.fats_no <= 2 && Fat32BPB.sectors == 0 && + Fat32BPB.spfat == 0 && Fat32BPB.signature == 0x29 && + Encoding.ASCII.GetString(Fat32BPB.fs_type) == "FAT32 ") { DicConsole.DebugWriteLine("FAT plugin", "Using FAT32 BPB"); useLongFAT32 = true; } - else if(bits_in_bps_fat32_short == 1 && correct_spc_fat32_short && shortFat32BPB.fats_no <= 2 && shortFat32BPB.sectors == 0 && shortFat32BPB.spfat == 0 && shortFat32BPB.signature == 0x28) + else if(bits_in_bps_fat32_short == 1 && correct_spc_fat32_short && shortFat32BPB.fats_no <= 2 && + shortFat32BPB.sectors == 0 && shortFat32BPB.spfat == 0 && shortFat32BPB.signature == 0x28) { DicConsole.DebugWriteLine("FAT plugin", "Using short FAT32 BPB"); - useShortFAT32 = shortFat32BPB.big_sectors == 0 ? shortFat32BPB.huge_sectors <= (partition.End - partition.Start) + 1 : shortFat32BPB.big_sectors <= (partition.End - partition.Start) + 1; + useShortFAT32 = shortFat32BPB.big_sectors == 0 + ? shortFat32BPB.huge_sectors <= (partition.End - partition.Start) + 1 + : shortFat32BPB.big_sectors <= (partition.End - partition.Start) + 1; } - else if(bits_in_bps_msx == 1 && correct_spc_msx && msxBPB.fats_no <= 2 && msxBPB.root_ent > 0 && msxBPB.sectors <= (partition.End - partition.Start) + 1 && msxBPB.spfat > 0 && Encoding.ASCII.GetString(msxBPB.vol_id) == "VOL_ID") + else if(bits_in_bps_msx == 1 && correct_spc_msx && msxBPB.fats_no <= 2 && msxBPB.root_ent > 0 && + msxBPB.sectors <= (partition.End - partition.Start) + 1 && msxBPB.spfat > 0 && + Encoding.ASCII.GetString(msxBPB.vol_id) == "VOL_ID") { DicConsole.DebugWriteLine("FAT plugin", "Using MSX BPB"); useMSXBPB = true; } - else if(bits_in_bps_apricot == 1 && correct_spc_apricot && ApricotBPB.mainBPB.fats_no <= 2 && ApricotBPB.mainBPB.root_ent > 0 && ApricotBPB.mainBPB.sectors <= (partition.End - partition.Start) + 1 && ApricotBPB.mainBPB.spfat > 0 && ApricotBPB.partitionCount == 0) + else if(bits_in_bps_apricot == 1 && correct_spc_apricot && ApricotBPB.mainBPB.fats_no <= 2 && + ApricotBPB.mainBPB.root_ent > 0 && + ApricotBPB.mainBPB.sectors <= (partition.End - partition.Start) + 1 && + ApricotBPB.mainBPB.spfat > 0 && ApricotBPB.partitionCount == 0) { DicConsole.DebugWriteLine("FAT plugin", "Using Apricot BPB"); useApricotBPB = true; } - else if(bits_in_bps_dos40 == 1 && correct_spc_dos40 && EBPB.fats_no <= 2 && EBPB.root_ent > 0 && EBPB.spfat > 0 && (EBPB.signature == 0x28 || EBPB.signature == 0x29 || andos_oem_correct)) + else if(bits_in_bps_dos40 == 1 && correct_spc_dos40 && EBPB.fats_no <= 2 && EBPB.root_ent > 0 && + EBPB.spfat > 0 && (EBPB.signature == 0x28 || EBPB.signature == 0x29 || andos_oem_correct)) { if(EBPB.sectors == 0) { @@ -487,16 +525,21 @@ namespace DiscImageChef.Filesystems } } } - else if(bits_in_bps_dos33 == 1 && correct_spc_dos33 && dos33BPB.rsectors < (partition.End - partition.Start) && dos33BPB.fats_no <= 2 && dos33BPB.root_ent > 0 && dos33BPB.spfat > 0) + else if(bits_in_bps_dos33 == 1 && correct_spc_dos33 && + dos33BPB.rsectors < (partition.End - partition.Start) && dos33BPB.fats_no <= 2 && + dos33BPB.root_ent > 0 && dos33BPB.spfat > 0) { - if(dos33BPB.sectors == 0 && dos33BPB.hsectors <= partition.Start && dos33BPB.big_sectors > 0 && dos33BPB.big_sectors <= (partition.End - partition.Start) + 1) + if(dos33BPB.sectors == 0 && dos33BPB.hsectors <= partition.Start && dos33BPB.big_sectors > 0 && + dos33BPB.big_sectors <= (partition.End - partition.Start) + 1) { DicConsole.DebugWriteLine("FAT plugin", "Using DOS 3.3 BPB"); useDOS33BPB = true; } - else if(dos33BPB.big_sectors == 0 && dos33BPB.hsectors <= partition.Start && dos33BPB.sectors > 0 && dos33BPB.sectors <= (partition.End - partition.Start) + 1) + else if(dos33BPB.big_sectors == 0 && dos33BPB.hsectors <= partition.Start && dos33BPB.sectors > 0 && + dos33BPB.sectors <= (partition.End - partition.Start) + 1) { - if(atariBPB.jump[0] == 0x60 || (atariBPB.jump[0] == 0xE9 && atariBPB.jump[1] == 0x00) && Encoding.ASCII.GetString(dos33BPB.oem_name) != "NEXT ") + if(atariBPB.jump[0] == 0x60 || (atariBPB.jump[0] == 0xE9 && atariBPB.jump[1] == 0x00) && + Encoding.ASCII.GetString(dos33BPB.oem_name) != "NEXT ") { DicConsole.DebugWriteLine("FAT plugin", "Using Atari BPB"); useAtariBPB = true; @@ -509,14 +552,16 @@ namespace DiscImageChef.Filesystems } else { - if(dos32BPB.hsectors <= partition.Start && dos32BPB.hsectors + dos32BPB.sectors == dos32BPB.total_sectors) + if(dos32BPB.hsectors <= partition.Start && + dos32BPB.hsectors + dos32BPB.sectors == dos32BPB.total_sectors) { DicConsole.DebugWriteLine("FAT plugin", "Using DOS 3.2 BPB"); useDOS32BPB = true; } else if(dos30BPB.sptrk > 0 && dos30BPB.sptrk < 64 && dos30BPB.heads > 0 && dos30BPB.heads < 256) { - if(atariBPB.jump[0] == 0x60 || (atariBPB.jump[0] == 0xE9 && atariBPB.jump[1] == 0x00) && Encoding.ASCII.GetString(dos33BPB.oem_name) != "NEXT ") + if(atariBPB.jump[0] == 0x60 || (atariBPB.jump[0] == 0xE9 && atariBPB.jump[1] == 0x00) && + Encoding.ASCII.GetString(dos33BPB.oem_name) != "NEXT ") { DicConsole.DebugWriteLine("FAT plugin", "Using Atari BPB"); useAtariBPB = true; @@ -529,7 +574,8 @@ namespace DiscImageChef.Filesystems } else { - if(atariBPB.jump[0] == 0x60 || (atariBPB.jump[0] == 0xE9 && atariBPB.jump[1] == 0x00) && Encoding.ASCII.GetString(dos33BPB.oem_name) != "NEXT ") + if(atariBPB.jump[0] == 0x60 || (atariBPB.jump[0] == 0xE9 && atariBPB.jump[1] == 0x00) && + Encoding.ASCII.GetString(dos33BPB.oem_name) != "NEXT ") { DicConsole.DebugWriteLine("FAT plugin", "Using Atari BPB"); useAtariBPB = true; @@ -562,8 +608,9 @@ namespace DiscImageChef.Filesystems uint sectors_for_root_directory = 0; // DEC Rainbow, lacks a BPB but has a very concrete structure... - if(imagePlugin.GetSectors() == 800 && imagePlugin.GetSectorSize() == 512 && - !useAtariBPB && !useMSXBPB && !useDOS2BPB && !useDOS3BPB && !useDOS32BPB && !useDOS33BPB && !useShortEBPB && !useEBPB && !useShortFAT32 && !useLongFAT32 && !useApricotBPB) + if(imagePlugin.GetSectors() == 800 && imagePlugin.GetSectorSize() == 512 && !useAtariBPB && !useMSXBPB && + !useDOS2BPB && !useDOS3BPB && !useDOS32BPB && !useDOS33BPB && !useShortEBPB && !useEBPB && + !useShortFAT32 && !useLongFAT32 && !useApricotBPB) { // DEC Rainbow boots up with a Z80, first byte should be DI (disable interrupts) byte z80_di = bpb_sector[0]; @@ -574,11 +621,12 @@ namespace DiscImageChef.Filesystems bool equal_fat_ids = fat1_sector0[0] == fat2_sector0[0] && fat1_sector0[1] == fat2_sector0[1]; // Volume is software interleaved 2:1 MemoryStream rootMs = new MemoryStream(); - foreach(ulong rootSector in new[] { 0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20 }) + foreach(ulong rootSector in new[] {0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20}) { byte[] tmp = imagePlugin.ReadSector(rootSector); rootMs.Write(tmp, 0, tmp.Length); } + byte[] root_dir = rootMs.ToArray(); rootMs = null; bool valid_root_dir = true; @@ -588,18 +636,19 @@ namespace DiscImageChef.Filesystems { for(int c = 0; c < 11; c++) { - if((root_dir[c + e] < 0x20 && root_dir[c + e] != 0x00 && root_dir[c + e] != 0x05) || root_dir[c + e] == 0xFF || root_dir[c + e] == 0x2E) + if((root_dir[c + e] < 0x20 && root_dir[c + e] != 0x00 && root_dir[c + e] != 0x05) || + root_dir[c + e] == 0xFF || root_dir[c + e] == 0x2E) { valid_root_dir = false; break; } } - if(!valid_root_dir) - break; + if(!valid_root_dir) break; } - if(z80_di == 0xF3 && equal_fat_ids && (fat1_sector0[0] & 0xF0) == 0xF0 && fat1_sector0[1] == 0xFF && valid_root_dir) + if(z80_di == 0xF3 && equal_fat_ids && (fat1_sector0[0] & 0xF0) == 0xF0 && fat1_sector0[1] == 0xFF && + valid_root_dir) { useDecRainbowBPB = true; DicConsole.DebugWriteLine("FAT plugin", "Using DEC Rainbow hardcoded BPB."); @@ -620,7 +669,8 @@ namespace DiscImageChef.Filesystems } } - if(!useAtariBPB && !useMSXBPB && !useDOS2BPB && !useDOS3BPB && !useDOS32BPB && !useDOS33BPB && !useShortEBPB && !useEBPB && !useShortFAT32 && !useLongFAT32 && !useApricotBPB && !useDecRainbowBPB) + if(!useAtariBPB && !useMSXBPB && !useDOS2BPB && !useDOS3BPB && !useDOS32BPB && !useDOS33BPB && + !useShortEBPB && !useEBPB && !useShortFAT32 && !useLongFAT32 && !useApricotBPB && !useDecRainbowBPB) { isFAT12 = true; fat_sector = imagePlugin.ReadSector(1 + partition.Start); @@ -818,8 +868,7 @@ namespace DiscImageChef.Filesystems { if(Fat32BPB.oem_name[5] == 0x49 && Fat32BPB.oem_name[6] == 0x48 && Fat32BPB.oem_name[7] == 0x43) sb.AppendLine("Volume has been modified by Windows 9x/Me Volume Tracker."); - else - xmlFSType.SystemIdentifier = StringHandlers.CToString(Fat32BPB.oem_name); + else xmlFSType.SystemIdentifier = StringHandlers.CToString(Fat32BPB.oem_name); } if(!string.IsNullOrEmpty(xmlFSType.SystemIdentifier)) @@ -830,12 +879,14 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} sectors reserved between BPB and FAT.", Fat32BPB.rsectors).AppendLine(); if(Fat32BPB.big_sectors == 0 && Fat32BPB.signature == 0x28) { - sb.AppendFormat("{0} sectors on volume ({1} bytes).", shortFat32BPB.huge_sectors, shortFat32BPB.huge_sectors * shortFat32BPB.bps).AppendLine(); + sb.AppendFormat("{0} sectors on volume ({1} bytes).", shortFat32BPB.huge_sectors, + shortFat32BPB.huge_sectors * shortFat32BPB.bps).AppendLine(); xmlFSType.Clusters = (long)(shortFat32BPB.huge_sectors / shortFat32BPB.spc); } else { - sb.AppendFormat("{0} sectors on volume ({1} bytes).", Fat32BPB.big_sectors, Fat32BPB.big_sectors * Fat32BPB.bps).AppendLine(); + sb.AppendFormat("{0} sectors on volume ({1} bytes).", Fat32BPB.big_sectors, + Fat32BPB.big_sectors * Fat32BPB.bps).AppendLine(); xmlFSType.Clusters = Fat32BPB.big_sectors / Fat32BPB.spc; } sb.AppendFormat("{0} clusters on volume.", xmlFSType.Clusters).AppendLine(); @@ -858,17 +909,15 @@ namespace DiscImageChef.Filesystems sb.AppendLine("Volume should be checked on next mount."); xmlFSType.Dirty = true; } - if((Fat32BPB.flags & 0x02) == 0x02) - sb.AppendLine("Disk surface should be on next mount."); + if((Fat32BPB.flags & 0x02) == 0x02) sb.AppendLine("Disk surface should be on next mount."); } if((Fat32BPB.mirror_flags & 0x80) == 0x80) - sb.AppendFormat("FATs are out of sync. FAT #{0} is in use.", Fat32BPB.mirror_flags & 0xF).AppendLine(); - else - sb.AppendLine("All copies of FAT are the same."); + sb.AppendFormat("FATs are out of sync. FAT #{0} is in use.", Fat32BPB.mirror_flags & 0xF) + .AppendLine(); + else sb.AppendLine("All copies of FAT are the same."); - if((Fat32BPB.mirror_flags & 0x6F20) == 0x6F20) - sb.AppendLine("DR-DOS will boot this FAT32 using CHS."); + if((Fat32BPB.mirror_flags & 0x6F20) == 0x6F20) sb.AppendLine("DR-DOS will boot this FAT32 using CHS."); else if((Fat32BPB.mirror_flags & 0x4F20) == 0x4F20) sb.AppendLine("DR-DOS will boot this FAT32 using LBA."); @@ -878,16 +927,18 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Filesystem type: {0}", Encoding.ASCII.GetString(Fat32BPB.fs_type)).AppendLine(); bootChk = sha1Ctx.Data(Fat32BPB.boot_code, out chkTmp); } - else - bootChk = sha1Ctx.Data(shortFat32BPB.boot_code, out chkTmp); + else bootChk = sha1Ctx.Data(shortFat32BPB.boot_code, out chkTmp); // Check that jumps to a correct boot code position and has boot signature set. // This will mean that the volume will boot, even if just to say "this is not bootable change disk"...... - xmlFSType.Bootable |= (Fat32BPB.jump[0] == 0xEB && Fat32BPB.jump[1] > 0x58 && Fat32BPB.jump[1] < 0x80 && Fat32BPB.boot_signature == 0xAA55); + xmlFSType.Bootable |= (Fat32BPB.jump[0] == 0xEB && Fat32BPB.jump[1] > 0x58 && Fat32BPB.jump[1] < 0x80 && + Fat32BPB.boot_signature == 0xAA55); sectors_per_real_sector = Fat32BPB.bps / imagePlugin.ImageInfo.sectorSize; // First root directory sector - root_directory_sector = (ulong)((Fat32BPB.root_cluster - 2) * Fat32BPB.spc + Fat32BPB.big_spfat * Fat32BPB.fats_no + Fat32BPB.rsectors) * sectors_per_real_sector; + root_directory_sector = + (ulong)((Fat32BPB.root_cluster - 2) * Fat32BPB.spc + Fat32BPB.big_spfat * Fat32BPB.fats_no + + Fat32BPB.rsectors) * sectors_per_real_sector; sectors_for_root_directory = 1; if(Fat32BPB.fsinfo_sector + partition.Start <= partition.End) @@ -898,9 +949,8 @@ namespace DiscImageChef.Filesystems FSInfoSector fs_info = (FSInfoSector)Marshal.PtrToStructure(fsinfo_ptr, typeof(FSInfoSector)); Marshal.FreeHGlobal(fsinfo_ptr); - if(fs_info.signature1 == fsinfo_signature1 && - fs_info.signature2 == fsinfo_signature2 && - fs_info.signature3 == fsinfo_signature3) + if(fs_info.signature1 == fsinfo_signature1 && fs_info.signature2 == fsinfo_signature2 && + fs_info.signature3 == fsinfo_signature3) { if(fs_info.free_clusters < 0xFFFFFFFF) { @@ -914,8 +964,7 @@ namespace DiscImageChef.Filesystems } } } - else if(useEBPB) - fakeBPB = EBPB; + else if(useEBPB) fakeBPB = EBPB; else if(useShortEBPB) { fakeBPB.jump = shortEBPB.jump; @@ -1049,17 +1098,19 @@ namespace DiscImageChef.Filesystems ushort sum = 0; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - for(int i = 0; i < bpb_sector.Length; i += 2) - sum += BigEndianBitConverter.ToUInt16(bpb_sector, i); + for(int i = 0; i < bpb_sector.Length; i += 2) sum += BigEndianBitConverter.ToUInt16(bpb_sector, i); // TODO: Check this if(sum == 0x1234) { xmlFSType.Bootable = true; StringBuilder atariSb = new StringBuilder(); - atariSb.AppendFormat("cmdload will be loaded with value {0:X4}h", BigEndianBitConverter.ToUInt16(bpb_sector, 0x01E)).AppendLine(); - atariSb.AppendFormat("Boot program will be loaded at address {0:X4}h", atariBPB.ldaaddr).AppendLine(); - atariSb.AppendFormat("FAT and directory will be cached at address {0:X4}h", atariBPB.fatbuf).AppendLine(); + atariSb.AppendFormat("cmdload will be loaded with value {0:X4}h", + BigEndianBitConverter.ToUInt16(bpb_sector, 0x01E)).AppendLine(); + atariSb.AppendFormat("Boot program will be loaded at address {0:X4}h", atariBPB.ldaaddr) + .AppendLine(); + atariSb.AppendFormat("FAT and directory will be cached at address {0:X4}h", atariBPB.fatbuf) + .AppendLine(); if(atariBPB.ldmode == 0) { byte[] tmp = new byte[8]; @@ -1070,15 +1121,15 @@ namespace DiscImageChef.Filesystems string extension = Encoding.ASCII.GetString(tmp).Trim(); string filename; - if(string.IsNullOrEmpty(extension)) - filename = fname; - else - filename = fname + "." + extension; + if(string.IsNullOrEmpty(extension)) filename = fname; + else filename = fname + "." + extension; atariSb.AppendFormat("Boot program resides in file \"{0}\"", filename).AppendLine(); } else - atariSb.AppendFormat("Boot program starts in sector {0} and is {1} sectors long ({2} bytes)", atariBPB.ssect, atariBPB.sectcnt, atariBPB.sectcnt * atariBPB.bps).AppendLine(); + atariSb.AppendFormat("Boot program starts in sector {0} and is {1} sectors long ({2} bytes)", + atariBPB.ssect, atariBPB.sectcnt, atariBPB.sectcnt * atariBPB.bps) + .AppendLine(); extraInfo = atariSb.ToString(); } @@ -1097,9 +1148,11 @@ namespace DiscImageChef.Filesystems fakeBPB.sptrk = ApricotBPB.spt; xmlFSType.Bootable = ApricotBPB.bootType > 0; - if(ApricotBPB.bootLocation > 0 && ApricotBPB.bootLocation + ApricotBPB.bootSize < imagePlugin.GetSectors()) + if(ApricotBPB.bootLocation > 0 && + ApricotBPB.bootLocation + ApricotBPB.bootSize < imagePlugin.GetSectors()) fakeBPB.boot_code = imagePlugin.ReadSectors(ApricotBPB.bootLocation, - (uint)(ApricotBPB.sectorSize * ApricotBPB.bootSize) / imagePlugin.GetSectorSize()); + (uint)(ApricotBPB.sectorSize * ApricotBPB.bootSize) / + imagePlugin.GetSectorSize()); } if(!isFAT32) @@ -1114,8 +1167,7 @@ namespace DiscImageChef.Filesystems fakeBPB.sptrk /= 4; fakeBPB.rsectors /= 4; - if(fakeBPB.spc == 0) - fakeBPB.spc = 1; + if(fakeBPB.spc == 0) fakeBPB.spc = 1; } // This assumes no sane implementation will violate cluster size rules @@ -1128,31 +1180,23 @@ namespace DiscImageChef.Filesystems if(fakeBPB.sectors == 0) clusters = fakeBPB.spc == 0 ? fakeBPB.big_sectors : fakeBPB.big_sectors / fakeBPB.spc; - else - clusters = fakeBPB.spc == 0 ? (ulong)fakeBPB.sectors : (ulong)fakeBPB.sectors / fakeBPB.spc; + else clusters = fakeBPB.spc == 0 ? (ulong)fakeBPB.sectors : (ulong)fakeBPB.sectors / fakeBPB.spc; - if(clusters < 4089) - isFAT12 = true; - else - isFAT16 = true; + if(clusters < 4089) isFAT12 = true; + else isFAT16 = true; } if(isFAT12) { - if(useAtariBPB) - sb.AppendLine("Atari FAT12"); - else if(useApricotBPB) - sb.AppendLine("Apricot FAT12"); - else - sb.AppendLine("Microsoft FAT12"); + if(useAtariBPB) sb.AppendLine("Atari FAT12"); + else if(useApricotBPB) sb.AppendLine("Apricot FAT12"); + else sb.AppendLine("Microsoft FAT12"); xmlFSType.Type = "FAT12"; } else if(isFAT16) { - if(useAtariBPB) - sb.AppendLine("Atari FAT16"); - else - sb.AppendLine("Microsoft FAT16"); + if(useAtariBPB) sb.AppendLine("Atari FAT16"); + else sb.AppendLine("Microsoft FAT16"); xmlFSType.Type = "FAT16"; } @@ -1161,11 +1205,11 @@ namespace DiscImageChef.Filesystems if(atariBPB.serial_no[0] == 0x49 && atariBPB.serial_no[1] == 0x48 && atariBPB.serial_no[2] == 0x43) sb.AppendLine("Volume has been modified by Windows 9x/Me Volume Tracker."); else - xmlFSType.VolumeSerial = string.Format("{0:X2}{1:X2}{2:X2}", atariBPB.serial_no[0], atariBPB.serial_no[1], atariBPB.serial_no[2]); + xmlFSType.VolumeSerial = string.Format("{0:X2}{1:X2}{2:X2}", atariBPB.serial_no[0], + atariBPB.serial_no[1], atariBPB.serial_no[2]); xmlFSType.SystemIdentifier = StringHandlers.CToString(atariBPB.oem_name); - if(string.IsNullOrEmpty(xmlFSType.SystemIdentifier)) - xmlFSType.SystemIdentifier = null; + if(string.IsNullOrEmpty(xmlFSType.SystemIdentifier)) xmlFSType.SystemIdentifier = null; } else if(fakeBPB.oem_name != null) { @@ -1175,24 +1219,23 @@ namespace DiscImageChef.Filesystems { // Later versions of Windows create a DOS 3 BPB without OEM name on 8 sectors/track floppies // OEM ID should be ASCII, otherwise ignore it - if(fakeBPB.oem_name[0] >= 0x20 && fakeBPB.oem_name[0] <= 0x7F && - fakeBPB.oem_name[1] >= 0x20 && fakeBPB.oem_name[1] <= 0x7F && - fakeBPB.oem_name[2] >= 0x20 && fakeBPB.oem_name[2] <= 0x7F && - fakeBPB.oem_name[3] >= 0x20 && fakeBPB.oem_name[3] <= 0x7F && - fakeBPB.oem_name[4] >= 0x20 && fakeBPB.oem_name[4] <= 0x7F && - fakeBPB.oem_name[5] >= 0x20 && fakeBPB.oem_name[5] <= 0x7F && - fakeBPB.oem_name[6] >= 0x20 && fakeBPB.oem_name[6] <= 0x7F && - fakeBPB.oem_name[7] >= 0x20 && fakeBPB.oem_name[7] <= 0x7F) + if(fakeBPB.oem_name[0] >= 0x20 && fakeBPB.oem_name[0] <= 0x7F && fakeBPB.oem_name[1] >= 0x20 && + fakeBPB.oem_name[1] <= 0x7F && fakeBPB.oem_name[2] >= 0x20 && fakeBPB.oem_name[2] <= 0x7F && + fakeBPB.oem_name[3] >= 0x20 && fakeBPB.oem_name[3] <= 0x7F && fakeBPB.oem_name[4] >= 0x20 && + fakeBPB.oem_name[4] <= 0x7F && fakeBPB.oem_name[5] >= 0x20 && fakeBPB.oem_name[5] <= 0x7F && + fakeBPB.oem_name[6] >= 0x20 && fakeBPB.oem_name[6] <= 0x7F && fakeBPB.oem_name[7] >= 0x20 && + fakeBPB.oem_name[7] <= 0x7F) xmlFSType.SystemIdentifier = StringHandlers.CToString(fakeBPB.oem_name); - else if(fakeBPB.oem_name[0] < 0x20 && - fakeBPB.oem_name[1] >= 0x20 && fakeBPB.oem_name[1] <= 0x7F && - fakeBPB.oem_name[2] >= 0x20 && fakeBPB.oem_name[2] <= 0x7F && - fakeBPB.oem_name[3] >= 0x20 && fakeBPB.oem_name[3] <= 0x7F && - fakeBPB.oem_name[4] >= 0x20 && fakeBPB.oem_name[4] <= 0x7F && - fakeBPB.oem_name[5] >= 0x20 && fakeBPB.oem_name[5] <= 0x7F && - fakeBPB.oem_name[6] >= 0x20 && fakeBPB.oem_name[6] <= 0x7F && - fakeBPB.oem_name[7] >= 0x20 && fakeBPB.oem_name[7] <= 0x7F) - xmlFSType.SystemIdentifier = StringHandlers.CToString(fakeBPB.oem_name, CurrentEncoding, start: 1); + else if(fakeBPB.oem_name[0] < 0x20 && fakeBPB.oem_name[1] >= 0x20 && + fakeBPB.oem_name[1] <= 0x7F && fakeBPB.oem_name[2] >= 0x20 && + fakeBPB.oem_name[2] <= 0x7F && fakeBPB.oem_name[3] >= 0x20 && + fakeBPB.oem_name[3] <= 0x7F && fakeBPB.oem_name[4] >= 0x20 && + fakeBPB.oem_name[4] <= 0x7F && fakeBPB.oem_name[5] >= 0x20 && + fakeBPB.oem_name[5] <= 0x7F && fakeBPB.oem_name[6] >= 0x20 && + fakeBPB.oem_name[6] <= 0x7F && fakeBPB.oem_name[7] >= 0x20 && + fakeBPB.oem_name[7] <= 0x7F) + xmlFSType.SystemIdentifier = + StringHandlers.CToString(fakeBPB.oem_name, CurrentEncoding, start: 1); } if(fakeBPB.signature == 0x28 || fakeBPB.signature == 0x29) @@ -1205,12 +1248,14 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} bytes per sector.", fakeBPB.bps).AppendLine(); if(fakeBPB.sectors == 0) { - sb.AppendFormat("{0} sectors on volume ({1} bytes).", fakeBPB.big_sectors, fakeBPB.big_sectors * fakeBPB.bps).AppendLine(); + sb.AppendFormat("{0} sectors on volume ({1} bytes).", fakeBPB.big_sectors, + fakeBPB.big_sectors * fakeBPB.bps).AppendLine(); xmlFSType.Clusters = fakeBPB.spc == 0 ? fakeBPB.big_sectors : fakeBPB.big_sectors / fakeBPB.spc; } else { - sb.AppendFormat("{0} sectors on volume ({1} bytes).", fakeBPB.sectors, fakeBPB.sectors * fakeBPB.bps).AppendLine(); + sb.AppendFormat("{0} sectors on volume ({1} bytes).", fakeBPB.sectors, + fakeBPB.sectors * fakeBPB.bps).AppendLine(); xmlFSType.Clusters = fakeBPB.spc == 0 ? fakeBPB.sectors : fakeBPB.sectors / fakeBPB.spc; } sb.AppendFormat("{0} sectors per cluster.", fakeBPB.spc).AppendLine(); @@ -1220,16 +1265,14 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} FATs.", fakeBPB.fats_no).AppendLine(); sb.AppendFormat("{0} entries on root directory.", fakeBPB.root_ent).AppendLine(); - if(fakeBPB.media > 0) - sb.AppendFormat("Media descriptor: 0x{0:X2}", fakeBPB.media).AppendLine(); - + if(fakeBPB.media > 0) sb.AppendFormat("Media descriptor: 0x{0:X2}", fakeBPB.media).AppendLine(); + sb.AppendFormat("{0} sectors per FAT.", fakeBPB.spfat).AppendLine(); if(fakeBPB.sptrk > 0 && fakeBPB.sptrk < 64 && fakeBPB.heads > 0 && fakeBPB.heads < 256) { sb.AppendFormat("{0} sectors per track.", fakeBPB.sptrk).AppendLine(); sb.AppendFormat("{0} heads.", fakeBPB.heads).AppendLine(); - } if(fakeBPB.hsectors <= partition.Start) sb.AppendFormat("{0} hidden sectors before BPB.", fakeBPB.hsectors).AppendLine(); @@ -1248,8 +1291,7 @@ namespace DiscImageChef.Filesystems sb.AppendLine("Volume should be checked on next mount."); xmlFSType.Dirty = true; } - if((fakeBPB.flags & 0x02) == 0x02) - sb.AppendLine("Disk surface should be on next mount."); + if((fakeBPB.flags & 0x02) == 0x02) sb.AppendLine("Disk surface should be on next mount."); } if(fakeBPB.signature == 0x29 || andos_oem_correct) @@ -1266,29 +1308,33 @@ namespace DiscImageChef.Filesystems // Check that jumps to a correct boot code position and has boot signature set. // This will mean that the volume will boot, even if just to say "this is not bootable change disk"...... if(xmlFSType.Bootable == false && fakeBPB.jump != null) - xmlFSType.Bootable |= (fakeBPB.jump[0] == 0xEB && fakeBPB.jump[1] > 0x58 && fakeBPB.jump[1] < 0x80 && fakeBPB.boot_signature == 0xAA55); + xmlFSType.Bootable |= (fakeBPB.jump[0] == 0xEB && fakeBPB.jump[1] > 0x58 && + fakeBPB.jump[1] < 0x80 && fakeBPB.boot_signature == 0xAA55); sectors_per_real_sector = fakeBPB.bps / imagePlugin.ImageInfo.sectorSize; // First root directory sector - root_directory_sector = (ulong)(fakeBPB.spfat * fakeBPB.fats_no + fakeBPB.rsectors) * sectors_per_real_sector; + root_directory_sector = + (ulong)(fakeBPB.spfat * fakeBPB.fats_no + fakeBPB.rsectors) * sectors_per_real_sector; sectors_for_root_directory = (uint)((fakeBPB.root_ent * 32) / imagePlugin.ImageInfo.sectorSize); } - if(extraInfo != null) - sb.Append(extraInfo); + if(extraInfo != null) sb.Append(extraInfo); - if(root_directory_sector + partition.Start < partition.End && imagePlugin.ImageInfo.xmlMediaType != ImagePlugins.XmlMediaType.OpticalDisc) + if(root_directory_sector + partition.Start < partition.End && + imagePlugin.ImageInfo.xmlMediaType != ImagePlugins.XmlMediaType.OpticalDisc) { - byte[] root_directory = imagePlugin.ReadSectors(root_directory_sector + partition.Start, sectors_for_root_directory); + byte[] root_directory = + imagePlugin.ReadSectors(root_directory_sector + partition.Start, sectors_for_root_directory); if(useDecRainbowBPB) { MemoryStream rootMs = new MemoryStream(); - foreach(ulong rootSector in new[] { 0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20 }) + foreach(ulong rootSector in new[] {0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20}) { byte[] tmp = imagePlugin.ReadSector(rootSector); rootMs.Write(tmp, 0, tmp.Length); } + root_directory = rootMs.ToArray(); rootMs = null; } @@ -1296,16 +1342,13 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < root_directory.Length; i += 32) { // Not a correct entry - if(root_directory[i] < 0x20 && root_directory[i] != 0x05) - continue; + if(root_directory[i] < 0x20 && root_directory[i] != 0x05) continue; // Deleted or subdirectory entry - if(root_directory[i] == 0x2E || root_directory[i] == 0xE5) - continue; + if(root_directory[i] == 0x2E || root_directory[i] == 0xE5) continue; // Not a volume label - if(root_directory[i + 0x0B] != 0x08 && root_directory[i + 0x0B] != 0x28) - continue; + if(root_directory[i + 0x0B] != 0x08 && root_directory[i + 0x0B] != 0x28) continue; IntPtr entry_ptr = Marshal.AllocHGlobal(32); Marshal.Copy(root_directory, i, entry_ptr, 32); @@ -1318,17 +1361,14 @@ namespace DiscImageChef.Filesystems string volname = CurrentEncoding.GetString(fullname).Trim(); if(!string.IsNullOrEmpty(volname)) { - if((entry.caseinfo & 0x0C) > 0) - xmlFSType.VolumeName = volname.ToLower(); - else - xmlFSType.VolumeName = volname; + if((entry.caseinfo & 0x0C) > 0) xmlFSType.VolumeName = volname.ToLower(); + else xmlFSType.VolumeName = volname; } if(entry.ctime > 0 && entry.cdate > 0) { xmlFSType.CreationDate = DateHandlers.DOSToDateTime(entry.cdate, entry.ctime); - if(entry.ctime_ms > 0) - xmlFSType.CreationDate.AddMilliseconds(entry.ctime_ms * 10); + if(entry.ctime_ms > 0) xmlFSType.CreationDate.AddMilliseconds(entry.ctime_ms * 10); xmlFSType.CreationDateSpecified = true; sb.AppendFormat("Volume created on {0}", xmlFSType.CreationDate).AppendLine(); } @@ -1341,7 +1381,8 @@ namespace DiscImageChef.Filesystems } if(entry.adate > 0) - sb.AppendFormat("Volume last accessed on {0:d}", DateHandlers.DOSToDateTime(entry.adate, 0)).AppendLine(); + sb.AppendFormat("Volume last accessed on {0:d}", DateHandlers.DOSToDateTime(entry.adate, 0)) + .AppendLine(); break; } @@ -1365,14 +1406,11 @@ namespace DiscImageChef.Filesystems public struct AtariParameterBlock { /// <summary>68000 BRA.S jump or x86 loop</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] jump; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] jump; /// <summary>OEM Name, 6 bytes, space-padded, "Loader" for Atari ST boot loader</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] oem_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] oem_name; /// <summary>Volume serial number<summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] serial_no; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] serial_no; /// <summary>Bytes per sector</summary> public ushort bps; /// <summary>Sectors per cluster</summary> @@ -1412,13 +1450,11 @@ namespace DiscImageChef.Filesystems /// <summary>Unknown.</summary> public ushort unknown; /// <summary>Filename to be loaded for booting.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] fname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] fname; /// <summary>Reserved</summary> public ushort reserved; /// <summary>Boot code.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 455)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 455)] public byte[] boot_code; /// <summary>Big endian word to make big endian sum of all sector words be equal to 0x1234 if disk is bootable.</summary> public ushort checksum; } @@ -1430,11 +1466,9 @@ namespace DiscImageChef.Filesystems public struct MSXParameterBlock { /// <summary>x86 loop</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump; /// <summary>OEM Name, 8 bytes, space-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] oem_name; /// <summary>Bytes per sector</summary> public ushort bps; /// <summary>Sectors per cluster</summary> @@ -1460,20 +1494,17 @@ namespace DiscImageChef.Filesystems /// <summary>Jump for MSX-DOS 1 boot code</summary> public ushort msxdos_jmp; /// <summary>Set to "VOL_ID" by MSX-DOS 2</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] vol_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] vol_id; /// <summary>Bigger than 0 if there are deleted files (MSX-DOS 2)</summary> public byte undelete_flag; /// <summary>Volume serial number (MSX-DOS 2)<summary> public uint serial_no; /// <summary>Reserved (MSX-DOS 2)<summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] reserved; /// <summary>Jump for MSX-DOS 2 boot code (MSX-DOS 2)</summary> public ushort msxdos2_jmp; /// <summary>Boot code.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 460)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 460)] public byte[] boot_code; /// <summary>Always 0x55 0xAA.</summary> public ushort boot_signature; } @@ -1483,11 +1514,9 @@ namespace DiscImageChef.Filesystems public struct BIOSParameterBlock2 { /// <summary>x86 jump</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump; /// <summary>OEM Name, 8 bytes, space-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] oem_name; /// <summary>Bytes per sector</summary> public ushort bps; /// <summary>Sectors per cluster</summary> @@ -1505,8 +1534,7 @@ namespace DiscImageChef.Filesystems /// <summary>Sectors per FAT</summary> public ushort spfat; /// <summary>Boot code.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 486)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 486)] public byte[] boot_code; /// <summary>0x55 0xAA if bootable.</summary> public ushort boot_signature; } @@ -1516,11 +1544,9 @@ namespace DiscImageChef.Filesystems public struct BIOSParameterBlock30 { /// <summary>x86 jump</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump; /// <summary>OEM Name, 8 bytes, space-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] oem_name; /// <summary>Bytes per sector</summary> public ushort bps; /// <summary>Sectors per cluster</summary> @@ -1544,8 +1570,7 @@ namespace DiscImageChef.Filesystems /// <summary>Hidden sectors before BPB</summary> public ushort hsectors; /// <summary>Boot code.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 480)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 480)] public byte[] boot_code; /// <summary>Always 0x55 0xAA.</summary> public ushort boot_signature; } @@ -1555,11 +1580,9 @@ namespace DiscImageChef.Filesystems public struct BIOSParameterBlock32 { /// <summary>x86 jump</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump; /// <summary>OEM Name, 8 bytes, space-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] oem_name; /// <summary>Bytes per sector</summary> public ushort bps; /// <summary>Sectors per cluster</summary> @@ -1585,8 +1608,7 @@ namespace DiscImageChef.Filesystems /// <summary>Total sectors including hidden ones</summary> public ushort total_sectors; /// <summary>Boot code.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 478)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 478)] public byte[] boot_code; /// <summary>Always 0x55 0xAA.</summary> public ushort boot_signature; } @@ -1596,11 +1618,9 @@ namespace DiscImageChef.Filesystems public struct BIOSParameterBlock33 { /// <summary>x86 jump</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump; /// <summary>OEM Name, 8 bytes, space-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] oem_name; /// <summary>Bytes per sector</summary> public ushort bps; /// <summary>Sectors per cluster</summary> @@ -1626,8 +1646,7 @@ namespace DiscImageChef.Filesystems /// <summary>Sectors in volume if > 65535</summary> public uint big_sectors; /// <summary>Boot code.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 474)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 474)] public byte[] boot_code; /// <summary>Always 0x55 0xAA.</summary> public ushort boot_signature; } @@ -1637,11 +1656,9 @@ namespace DiscImageChef.Filesystems public struct BIOSParameterBlockShortEBPB { /// <summary>x86 jump</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump; /// <summary>OEM Name, 8 bytes, space-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] oem_name; /// <summary>Bytes per sector</summary> public ushort bps; /// <summary>Sectors per cluster</summary> @@ -1675,8 +1692,7 @@ namespace DiscImageChef.Filesystems /// <summary>Volume serial number<summary> public uint serial_no; /// <summary>Boot code.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 467)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 467)] public byte[] boot_code; /// <summary>Always 0x55 0xAA.</summary> public ushort boot_signature; } @@ -1686,11 +1702,9 @@ namespace DiscImageChef.Filesystems public struct BIOSParameterBlockEBPB { /// <summary>x86 jump</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump; /// <summary>OEM Name, 8 bytes, space-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] oem_name; /// <summary>Bytes per sector</summary> public ushort bps; /// <summary>Sectors per cluster</summary> @@ -1724,14 +1738,11 @@ namespace DiscImageChef.Filesystems /// <summary>Volume serial number<summary> public uint serial_no; /// <summary>Volume label, 11 bytes, space-padded - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] volume_label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] volume_label; /// <summary>Filesystem type, 8 bytes, space-padded - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] fs_type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] fs_type; /// <summary>Boot code.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 448)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 448)] public byte[] boot_code; /// <summary>Always 0x55 0xAA.</summary> public ushort boot_signature; } @@ -1741,11 +1752,9 @@ namespace DiscImageChef.Filesystems public struct FAT32ParameterBlockShort { /// <summary>x86 jump</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump; /// <summary>OEM Name, 8 bytes, space-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] oem_name; /// <summary>Bytes per sector</summary> public ushort bps; /// <summary>Sectors per cluster</summary> @@ -1783,8 +1792,7 @@ namespace DiscImageChef.Filesystems /// <summary>Sector of FAT32PB backup</summary> public ushort backup_sector; /// <summary>Reserved</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] reserved; /// <summary>Drive number</summary> public byte drive_no; /// <summary>Volume flags</summary> @@ -1794,13 +1802,11 @@ namespace DiscImageChef.Filesystems /// <summary>Volume serial number</summary> public uint serial_no; /// <summary>Volume label, 11 bytes, space-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] reserved2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] reserved2; /// <summary>Sectors in volume if <see cref="big_sectors"/> equals 0</summary> public ulong huge_sectors; /// <summary>Boot code.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 420)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 420)] public byte[] boot_code; /// <summary>Always 0x55 0xAA.</summary> public ushort boot_signature; } @@ -1810,11 +1816,9 @@ namespace DiscImageChef.Filesystems public struct FAT32ParameterBlock { /// <summary>x86 jump</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump; /// <summary>OEM Name, 8 bytes, space-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] oem_name; /// <summary>Bytes per sector</summary> public ushort bps; /// <summary>Sectors per cluster</summary> @@ -1852,8 +1856,7 @@ namespace DiscImageChef.Filesystems /// <summary>Sector of FAT32PB backup</summary> public ushort backup_sector; /// <summary>Reserved</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] reserved; /// <summary>Drive number</summary> public byte drive_no; /// <summary>Volume flags</summary> @@ -1863,14 +1866,11 @@ namespace DiscImageChef.Filesystems /// <summary>Volume serial number</summary> public uint serial_no; /// <summary>Volume label, 11 bytes, space-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] volume_label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] volume_label; /// <summary>Filesystem type, 8 bytes, space-padded, must be "FAT32 "</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] fs_type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] fs_type; /// <summary>Boot code.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 419)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 419)] public byte[] boot_code; /// <summary>Always 0x55 0xAA.</summary> public ushort boot_signature; } @@ -1880,23 +1880,19 @@ namespace DiscImageChef.Filesystems public struct ApricotLabel { /// <summary>Version of format which created disk</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] version; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] version; /// <summary>Operating system.</summary> public byte operatingSystem; /// <summary>Software write protection.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool writeProtected; + [MarshalAs(UnmanagedType.U1)] public bool writeProtected; /// <summary>Copy protected.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool copyProtected; + [MarshalAs(UnmanagedType.U1)] public bool copyProtected; /// <summary>Boot type.</summary> public byte bootType; /// <summary>Partitions.</summary> public byte partitionCount; /// <summary>Is hard disk?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool winchester; + [MarshalAs(UnmanagedType.U1)] public bool winchester; /// <summary>Sector size.</summary> public ushort sectorSize; /// <summary>Sectors per track.</summary> @@ -1928,39 +1924,31 @@ namespace DiscImageChef.Filesystems /// <summary>Maximum number of copies.</summary> public ushort maxCopies; /// <summary>Serial number.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] serialNumber; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] serialNumber; /// <summary>Part number.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] partNumber; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] partNumber; /// <summary>Copyright.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public byte[] copyright; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] copyright; /// <summary>BPB for whole disk.</summary> public ApricotParameterBlock mainBPB; /// <summary>Name of FONT file.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] fontName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] fontName; /// <summary>Name of KEYBOARD file.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] keyboardName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] keyboardName; /// <summary>Minor BIOS version.</summary> public byte biosMinorVersion; /// <summary>Major BIOS version.</summary> public byte biosMajorVersion; /// <summary>Diagnostics enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool diagnosticsFlag; + [MarshalAs(UnmanagedType.U1)] public bool diagnosticsFlag; /// <summary>Printer device.</summary> public byte prnDevice; /// <summary>Bell volume.</summary> public byte bellVolume; /// <summary>Cache enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool enableCache; + [MarshalAs(UnmanagedType.U1)] public bool enableCache; /// <summary>Graphics enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool enableGraphics; + [MarshalAs(UnmanagedType.U1)] public bool enableGraphics; /// <summary>Length in sectors of DOS.</summary> public byte dosLength; /// <summary>Length in sectors of FONT file.</summary> @@ -1976,8 +1964,7 @@ namespace DiscImageChef.Filesystems /// <summary>Keyboard click volume.</summary> public byte keyboardVolume; /// <summary>Auto-repeat enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool autorepeat; + [MarshalAs(UnmanagedType.U1)] public bool autorepeat; /// <summary>Auto-repeat lead-in.</summary> public byte autorepeatLeadIn; /// <summary>Auto-repeat interval.</summary> @@ -1985,18 +1972,15 @@ namespace DiscImageChef.Filesystems /// <summary>Microscreen mode.</summary> public byte microscreenMode; /// <summary>Spare area for keyboard values expansion.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] spareKeyboard; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] spareKeyboard; /// <summary>Screen line mode.</summary> public byte lineMode; /// <summary>Screen line width.</summary> public byte lineWidth; /// <summary>Screen disabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool imageOff; + [MarshalAs(UnmanagedType.U1)] public bool imageOff; /// <summary>Spare area for screen values expansion.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] - public byte[] spareScreen; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] public byte[] spareScreen; /// <summary>TX baud rate.</summary> public byte txBaudRate; /// <summary>RX baud rate.</summary> @@ -2008,16 +1992,13 @@ namespace DiscImageChef.Filesystems /// <summary>Stop bits.</summary> public byte stopBits; /// <summary>Parity enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool parityCheck; + [MarshalAs(UnmanagedType.U1)] public bool parityCheck; /// <summary>Parity type.</summary> public byte parityType; /// <summary>Xon/Xoff enabled on TX.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool txXonXoff; + [MarshalAs(UnmanagedType.U1)] public bool txXonXoff; /// <summary>Xon/Xoff enabled on RX.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool rxXonXoff; + [MarshalAs(UnmanagedType.U1)] public bool rxXonXoff; /// <summary>Xon character.</summary> public byte xonCharacter; /// <summary>Xoff character.</summary> @@ -2025,63 +2006,45 @@ namespace DiscImageChef.Filesystems /// <summary>Xon/Xoff buffer on RX.</summary> public ushort rxXonXoffBuffer; /// <summary>DTR/DSR enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool dtrDsr; + [MarshalAs(UnmanagedType.U1)] public bool dtrDsr; /// <summary>CTS/RTS enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool ctsRts; + [MarshalAs(UnmanagedType.U1)] public bool ctsRts; /// <summary>NULLs after CR.</summary> public byte nullsAfterCr; /// <summary>NULLs after 0xFF.</summary> public byte nullsAfterFF; /// <summary>Send LF after CR in serial port.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool lfAfterCRSerial; + [MarshalAs(UnmanagedType.U1)] public bool lfAfterCRSerial; /// <summary>BIOS error report in serial port.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool biosErrorReportSerial; + [MarshalAs(UnmanagedType.U1)] public bool biosErrorReportSerial; /// <summary>Spare area for serial port values expansion.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] - public byte[] spareSerial; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] public byte[] spareSerial; /// <summary>Send LF after CR in parallel port.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool lfAfterCrParallel; + [MarshalAs(UnmanagedType.U1)] public bool lfAfterCrParallel; /// <summary>Select line supported?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool selectLine; + [MarshalAs(UnmanagedType.U1)] public bool selectLine; /// <summary>Paper empty supported?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool paperEmpty; + [MarshalAs(UnmanagedType.U1)] public bool paperEmpty; /// <summary>Fault line supported?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool faultLine; + [MarshalAs(UnmanagedType.U1)] public bool faultLine; /// <summary>BIOS error report in parallel port.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool biosErrorReportParallel; + [MarshalAs(UnmanagedType.U1)] public bool biosErrorReportParallel; /// <summary>Spare area for parallel port values expansion.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] spareParallel; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] spareParallel; /// <summary>Spare area for Winchester values expansion.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public byte[] spareWinchester; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] spareWinchester; /// <summary>Parking enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool parkingEnabled; + [MarshalAs(UnmanagedType.U1)] public bool parkingEnabled; /// <summary>Format protection?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool formatProtection; + [MarshalAs(UnmanagedType.U1)] public bool formatProtection; /// <summary>Spare area for RAM disk values expansion.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] spareRamDisk; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] spareRamDisk; /// <summary>List of bad blocks.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public ushort[] badBlocks; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public ushort[] badBlocks; /// <summary>Array of partition BPBs.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public ApricotParameterBlock[] partitions; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public ApricotParameterBlock[] partitions; /// <summary>Spare area.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 63)] - public byte[] spare; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 63)] public byte[] spare; /// <summary>CP/M double side indicator?.</summary> public bool cpmDoubleSided; } @@ -2122,8 +2085,7 @@ namespace DiscImageChef.Filesystems /// <summary>Signature must be <see cref="fsinfo_signature1"/></summary> public uint signature1; /// <summary>Reserved</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 480)] - public byte[] reserved1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 480)] public byte[] reserved1; /// <summary>Signature must be <see cref="fsinfo_signature2"/></summary> public uint signature2; /// <summary>Free clusters</summary> @@ -2131,8 +2093,7 @@ namespace DiscImageChef.Filesystems /// <summary> cated cluster</summary> public uint last_cluster; /// <summary>Reserved</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] reserved2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] reserved2; /// <summary>Signature must be <see cref="fsinfo_signature3"/></summary> public uint signature3; } @@ -2154,10 +2115,8 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct DirectoryEntry { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] filename; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] extension; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] filename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] extension; public FatAttributes attributes; public byte caseinfo; public byte ctime_ms; diff --git a/DiscImageChef.Filesystems/FATX.cs b/DiscImageChef.Filesystems/FATX.cs index 7b24e324..5ef7822c 100644 --- a/DiscImageChef.Filesystems/FATX.cs +++ b/DiscImageChef.Filesystems/FATX.cs @@ -74,8 +74,7 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; FATX_Superblock fatxSb = new FATX_Superblock(); byte[] sector = imagePlugin.ReadSector(partition.Start); @@ -85,11 +84,11 @@ namespace DiscImageChef.Filesystems return fatxSb.magic == FATX_Magic; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < 512) - return; + if(imagePlugin.GetSectorSize() < 512) return; FATX_Superblock fatxSb = new FATX_Superblock(); @@ -97,14 +96,14 @@ namespace DiscImageChef.Filesystems fatxSb = BigEndianMarshal.ByteArrayToStructureBigEndian<FATX_Superblock>(sector); - if(fatxSb.magic != FATX_Magic) - return; + if(fatxSb.magic != FATX_Magic) return; StringBuilder sb = new StringBuilder(); sb.AppendLine("FATX filesystem"); sb.AppendFormat("Filesystem id {0}", fatxSb.id).AppendLine(); - sb.AppendFormat("{0} sectors ({1} bytes) per cluster", fatxSb.sectorsPerCluster, fatxSb.sectorsPerCluster * imagePlugin.ImageInfo.sectorSize).AppendLine(); + sb.AppendFormat("{0} sectors ({1} bytes) per cluster", fatxSb.sectorsPerCluster, + fatxSb.sectorsPerCluster * imagePlugin.ImageInfo.sectorSize).AppendLine(); sb.AppendFormat("Root directory starts on cluster {0}", fatxSb.rootDirectoryCluster).AppendLine(); information = sb.ToString(); @@ -112,7 +111,8 @@ namespace DiscImageChef.Filesystems xmlFSType = new Schemas.FileSystemType(); xmlFSType.Type = "FATX filesystem"; xmlFSType.ClusterSize = (int)(fatxSb.sectorsPerCluster * imagePlugin.ImageInfo.sectorSize); - xmlFSType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.sectorSize / (ulong)xmlFSType.ClusterSize); + xmlFSType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.sectorSize / + (ulong)xmlFSType.ClusterSize); } public override Errno Mount() diff --git a/DiscImageChef.Filesystems/FFS.cs b/DiscImageChef.Filesystems/FFS.cs index 46284ea9..0bc8edf6 100644 --- a/DiscImageChef.Filesystems/FFS.cs +++ b/DiscImageChef.Filesystems/FFS.cs @@ -55,37 +55,36 @@ namespace DiscImageChef.Filesystems { Name = "BSD Fast File System (aka UNIX File System, UFS)"; PluginUUID = new Guid("CC90D342-05DB-48A8-988C-C1FE000034A3"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public FFSPlugin(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "BSD Fast File System (aka UNIX File System, UFS)"; PluginUUID = new Guid("CC90D342-05DB-48A8-988C-C1FE000034A3"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((2 + partition.Start) >= partition.End) - return false; + if((2 + partition.Start) >= partition.End) return false; uint magic; uint sb_size_in_sectors; byte[] ufs_sb_sectors; - if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) - sb_size_in_sectors = block_size / 2048; - else - sb_size_in_sectors = block_size / imagePlugin.GetSectorSize(); + if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || + imagePlugin.GetSectorSize() == 2448) sb_size_in_sectors = block_size / 2048; + else sb_size_in_sectors = block_size / imagePlugin.GetSectorSize(); - ulong[] locations = { sb_start_floppy, sb_start_boot, sb_start_long_boot, sb_start_piggy, sb_start_att_dsdd, 8192 / imagePlugin.GetSectorSize(), 65536 / imagePlugin.GetSectorSize(), 262144 / imagePlugin.GetSectorSize() }; + ulong[] locations = + { + sb_start_floppy, sb_start_boot, sb_start_long_boot, sb_start_piggy, sb_start_att_dsdd, + 8192 / imagePlugin.GetSectorSize(), 65536 / imagePlugin.GetSectorSize(), + 262144 / imagePlugin.GetSectorSize() + }; foreach(ulong loc in locations) { @@ -94,15 +93,17 @@ namespace DiscImageChef.Filesystems ufs_sb_sectors = imagePlugin.ReadSectors(partition.Start + loc, sb_size_in_sectors); magic = BitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - if(magic == UFS_MAGIC || magic == UFS_CIGAM || magic == UFS_MAGIC_BW || magic == UFS_CIGAM_BW || magic == UFS2_MAGIC || magic == UFS2_CIGAM || magic == UFS_BAD_MAGIC || magic == UFS_BAD_CIGAM) - return true; + if(magic == UFS_MAGIC || magic == UFS_CIGAM || magic == UFS_MAGIC_BW || magic == UFS_CIGAM_BW || + magic == UFS2_MAGIC || magic == UFS2_CIGAM || magic == UFS_BAD_MAGIC || + magic == UFS_BAD_CIGAM) return true; } } return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; StringBuilder sbInformation = new StringBuilder(); @@ -119,12 +120,16 @@ namespace DiscImageChef.Filesystems bool fs_type_sun = false; bool fs_type_sun86 = false; - if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) - sb_size_in_sectors = block_size / 2048; - else - sb_size_in_sectors = block_size / imagePlugin.GetSectorSize(); + if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || + imagePlugin.GetSectorSize() == 2448) sb_size_in_sectors = block_size / 2048; + else sb_size_in_sectors = block_size / imagePlugin.GetSectorSize(); - ulong[] locations = { sb_start_floppy, sb_start_boot, sb_start_long_boot, sb_start_piggy, sb_start_att_dsdd, 8192 / imagePlugin.GetSectorSize(), 65536 / imagePlugin.GetSectorSize(), 262144 / imagePlugin.GetSectorSize() }; + ulong[] locations = + { + sb_start_floppy, sb_start_boot, sb_start_long_boot, sb_start_piggy, sb_start_att_dsdd, + 8192 / imagePlugin.GetSectorSize(), 65536 / imagePlugin.GetSectorSize(), + 262144 / imagePlugin.GetSectorSize() + }; foreach(ulong loc in locations) { @@ -133,7 +138,8 @@ namespace DiscImageChef.Filesystems ufs_sb_sectors = imagePlugin.ReadSectors(partition.Start + loc, sb_size_in_sectors); magic = BitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - if(magic == UFS_MAGIC || magic == UFS_CIGAM || magic == UFS_MAGIC_BW || magic == UFS_CIGAM_BW || magic == UFS2_MAGIC || magic == UFS2_CIGAM || magic == UFS_BAD_MAGIC || magic == UFS_BAD_CIGAM) + if(magic == UFS_MAGIC || magic == UFS_CIGAM || magic == UFS_MAGIC_BW || magic == UFS_CIGAM_BW || + magic == UFS2_MAGIC || magic == UFS2_CIGAM || magic == UFS_BAD_MAGIC || magic == UFS_BAD_CIGAM) { sb_offset = partition.Start + loc; break; @@ -258,15 +264,15 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("FFS plugin", "fs_flags: 0x{0:X2}", ufs_sb.fs_flags); DicConsole.DebugWriteLine("FFS plugin", "fs_magic: 0x{0:X8}", ufs_sb.fs_magic); - if(ufs_sb.fs_magic == UFS2_MAGIC) - { - fs_type_ufs2 = true; - } + if(ufs_sb.fs_magic == UFS2_MAGIC) { fs_type_ufs2 = true; } else { - const uint SunOSEpoch = 0x1A54C580; // We are supposing there cannot be a Sun's fs created before 1/1/1982 00:00:00 + const uint + SunOSEpoch = + 0x1A54C580; // We are supposing there cannot be a Sun's fs created before 1/1/1982 00:00:00 - fs_type_43bsd = true; // There is no way of knowing this is the version, but there is of knowing it is not. + fs_type_43bsd = + true; // There is no way of knowing this is the version, but there is of knowing it is not. if(ufs_sb.fs_link > 0) { @@ -274,7 +280,8 @@ namespace DiscImageChef.Filesystems fs_type_43bsd = false; } - if((ufs_sb.fs_maxfilesize & 0xFFFFFFFF) > SunOSEpoch && DateHandlers.UNIXUnsignedToDateTime(ufs_sb.fs_maxfilesize & 0xFFFFFFFF) < DateTime.Now) + if((ufs_sb.fs_maxfilesize & 0xFFFFFFFF) > SunOSEpoch && + DateHandlers.UNIXUnsignedToDateTime(ufs_sb.fs_maxfilesize & 0xFFFFFFFF) < DateTime.Now) { fs_type_42bsd = false; fs_type_sun = true; @@ -282,7 +289,8 @@ namespace DiscImageChef.Filesystems } // This is for sure, as it is shared with a sectors/track with non-x86 SunOS, Epoch is absurdly high for that - if(ufs_sb.fs_old_npsect > SunOSEpoch && DateHandlers.UNIXToDateTime(ufs_sb.fs_old_npsect) < DateTime.Now) + if(ufs_sb.fs_old_npsect > SunOSEpoch && DateHandlers.UNIXToDateTime(ufs_sb.fs_old_npsect) < DateTime.Now + ) { fs_type_42bsd = false; fs_type_sun86 = true; @@ -309,21 +317,16 @@ namespace DiscImageChef.Filesystems if(!fs_type_ufs2) { sbInformation.AppendLine("There are a lot of variants of UFS using overlapped values on same fields"); - sbInformation.AppendLine("I will try to guess which one it is, but unless it's UFS2, I may be surely wrong"); + sbInformation + .AppendLine("I will try to guess which one it is, but unless it's UFS2, I may be surely wrong"); } - if(fs_type_42bsd) - sbInformation.AppendLine("Guessed as 42BSD FFS"); - if(fs_type_43bsd) - sbInformation.AppendLine("Guessed as 43BSD FFS"); - if(fs_type_44bsd) - sbInformation.AppendLine("Guessed as 44BSD FFS"); - if(fs_type_sun) - sbInformation.AppendLine("Guessed as SunOS FFS"); - if(fs_type_sun86) - sbInformation.AppendLine("Guessed as SunOS/x86 FFS"); - if(fs_type_ufs) - sbInformation.AppendLine("Guessed as UFS"); + if(fs_type_42bsd) sbInformation.AppendLine("Guessed as 42BSD FFS"); + if(fs_type_43bsd) sbInformation.AppendLine("Guessed as 43BSD FFS"); + if(fs_type_44bsd) sbInformation.AppendLine("Guessed as 44BSD FFS"); + if(fs_type_sun) sbInformation.AppendLine("Guessed as SunOS FFS"); + if(fs_type_sun86) sbInformation.AppendLine("Guessed as SunOS/x86 FFS"); + if(fs_type_ufs) sbInformation.AppendLine("Guessed as UFS"); if(fs_type_42bsd) sbInformation.AppendFormat("Linked list of filesystems: 0x{0:X8}", ufs_sb.fs_link).AppendLine(); @@ -332,20 +335,24 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("inode-block LBA: {0}", ufs_sb.fs_iblkno).AppendLine(); sbInformation.AppendFormat("First data block LBA: {0}", ufs_sb.fs_dblkno).AppendLine(); sbInformation.AppendFormat("Cylinder group offset in cylinder: {0}", ufs_sb.fs_old_cgoffset).AppendLine(); - sbInformation.AppendFormat("Volume last written on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_old_time)).AppendLine(); + sbInformation.AppendFormat("Volume last written on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_old_time)) + .AppendLine(); xmlFSType.ModificationDate = DateHandlers.UNIXToDateTime(ufs_sb.fs_old_time); xmlFSType.ModificationDateSpecified = true; - sbInformation.AppendFormat("{0} blocks in volume ({1} bytes)", ufs_sb.fs_old_size, (long)ufs_sb.fs_old_size * ufs_sb.fs_fsize).AppendLine(); + sbInformation.AppendFormat("{0} blocks in volume ({1} bytes)", ufs_sb.fs_old_size, + (long)ufs_sb.fs_old_size * ufs_sb.fs_fsize).AppendLine(); xmlFSType.Clusters = ufs_sb.fs_old_size; xmlFSType.ClusterSize = (int)ufs_sb.fs_fsize; - sbInformation.AppendFormat("{0} data blocks in volume ({1} bytes)", ufs_sb.fs_old_dsize, (long)ufs_sb.fs_old_dsize * ufs_sb.fs_fsize).AppendLine(); + sbInformation.AppendFormat("{0} data blocks in volume ({1} bytes)", ufs_sb.fs_old_dsize, + (long)ufs_sb.fs_old_dsize * ufs_sb.fs_fsize).AppendLine(); sbInformation.AppendFormat("{0} cylinder groups in volume", ufs_sb.fs_ncg).AppendLine(); sbInformation.AppendFormat("{0} bytes in a basic block", ufs_sb.fs_bsize).AppendLine(); sbInformation.AppendFormat("{0} bytes in a frag block", ufs_sb.fs_fsize).AppendLine(); sbInformation.AppendFormat("{0} frags in a block", ufs_sb.fs_frag).AppendLine(); sbInformation.AppendFormat("{0}% of blocks must be free", ufs_sb.fs_minfree).AppendLine(); sbInformation.AppendFormat("{0}ms for optimal next block", ufs_sb.fs_old_rotdelay).AppendLine(); - sbInformation.AppendFormat("disk rotates {0} times per second ({1}rpm)", ufs_sb.fs_old_rps, ufs_sb.fs_old_rps * 60).AppendLine(); + sbInformation.AppendFormat("disk rotates {0} times per second ({1}rpm)", ufs_sb.fs_old_rps, + ufs_sb.fs_old_rps * 60).AppendLine(); /* sbInformation.AppendFormat("fs_bmask: 0x{0:X8}", ufs_sb.fs_bmask).AppendLine(); sbInformation.AppendFormat("fs_fmask: 0x{0:X8}", ufs_sb.fs_fmask).AppendLine(); sbInformation.AppendFormat("fs_bshift: 0x{0:X8}", ufs_sb.fs_bshift).AppendLine(); @@ -356,16 +363,13 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("NINDIR: 0x{0:X8}", ufs_sb.fs_nindir).AppendLine(); sbInformation.AppendFormat("INOPB: 0x{0:X8}", ufs_sb.fs_inopb).AppendLine(); sbInformation.AppendFormat("NSPF: 0x{0:X8}", ufs_sb.fs_old_nspf).AppendLine(); - if(ufs_sb.fs_optim == 0) - sbInformation.AppendLine("Filesystem will minimize allocation time"); - else if(ufs_sb.fs_optim == 1) - sbInformation.AppendLine("Filesystem will minimize volume fragmentation"); - else - sbInformation.AppendFormat("Unknown optimization value: 0x{0:X8}", ufs_sb.fs_optim).AppendLine(); - if(fs_type_sun) - sbInformation.AppendFormat("{0} sectors/track", ufs_sb.fs_old_npsect).AppendLine(); + if(ufs_sb.fs_optim == 0) sbInformation.AppendLine("Filesystem will minimize allocation time"); + else if(ufs_sb.fs_optim == 1) sbInformation.AppendLine("Filesystem will minimize volume fragmentation"); + else sbInformation.AppendFormat("Unknown optimization value: 0x{0:X8}", ufs_sb.fs_optim).AppendLine(); + if(fs_type_sun) sbInformation.AppendFormat("{0} sectors/track", ufs_sb.fs_old_npsect).AppendLine(); else if(fs_type_sun86) - sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_old_npsect)).AppendLine(); + sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_old_npsect)) + .AppendLine(); sbInformation.AppendFormat("Hardware sector interleave: {0}", ufs_sb.fs_old_interleave).AppendLine(); sbInformation.AppendFormat("Sector 0 skew: {0}/track", ufs_sb.fs_old_trackskew).AppendLine(); if(!fs_type_43bsd && ufs_sb.fs_id_1 > 0 && ufs_sb.fs_id_2 > 0) @@ -390,7 +394,8 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("{0} inodes per cylinder group", ufs_sb.fs_ipg).AppendLine(); sbInformation.AppendFormat("{0} blocks per group", ufs_sb.fs_fpg / ufs_sb.fs_frag).AppendLine(); sbInformation.AppendFormat("{0} directories", ufs_sb.fs_old_cstotal.cs_ndir).AppendLine(); - sbInformation.AppendFormat("{0} free blocks ({1} bytes)", ufs_sb.fs_old_cstotal.cs_nbfree, (long)ufs_sb.fs_old_cstotal.cs_nbfree * ufs_sb.fs_fsize).AppendLine(); + sbInformation.AppendFormat("{0} free blocks ({1} bytes)", ufs_sb.fs_old_cstotal.cs_nbfree, + (long)ufs_sb.fs_old_cstotal.cs_nbfree * ufs_sb.fs_fsize).AppendLine(); xmlFSType.FreeClusters = ufs_sb.fs_old_cstotal.cs_nbfree; xmlFSType.FreeClustersSpecified = true; sbInformation.AppendFormat("{0} free inodes", ufs_sb.fs_old_cstotal.cs_nifree).AppendLine(); @@ -400,17 +405,18 @@ namespace DiscImageChef.Filesystems sbInformation.AppendLine("Superblock is under modification"); xmlFSType.Dirty = true; } - if(ufs_sb.fs_clean == 1) - sbInformation.AppendLine("Volume is clean"); - if(ufs_sb.fs_ronly == 1) - sbInformation.AppendLine("Volume is read-only"); + if(ufs_sb.fs_clean == 1) sbInformation.AppendLine("Volume is clean"); + if(ufs_sb.fs_ronly == 1) sbInformation.AppendLine("Volume is read-only"); sbInformation.AppendFormat("Volume flags: 0x{0:X2}", ufs_sb.fs_flags).AppendLine(); if(fs_type_ufs) - sbInformation.AppendFormat("Volume last mounted on \"{0}\"", StringHandlers.CToString(ufs_sb.fs_fsmnt)).AppendLine(); + sbInformation.AppendFormat("Volume last mounted on \"{0}\"", StringHandlers.CToString(ufs_sb.fs_fsmnt)) + .AppendLine(); else if(fs_type_ufs2) { - sbInformation.AppendFormat("Volume last mounted on \"{0}\"", StringHandlers.CToString(ufs_sb.fs_fsmnt)).AppendLine(); - sbInformation.AppendFormat("Volume name: \"{0}\"", StringHandlers.CToString(ufs_sb.fs_volname)).AppendLine(); + sbInformation.AppendFormat("Volume last mounted on \"{0}\"", StringHandlers.CToString(ufs_sb.fs_fsmnt)) + .AppendLine(); + sbInformation.AppendFormat("Volume name: \"{0}\"", StringHandlers.CToString(ufs_sb.fs_volname)) + .AppendLine(); xmlFSType.VolumeName = StringHandlers.CToString(ufs_sb.fs_volname); sbInformation.AppendFormat("Volume ID: 0x{0:X16}", ufs_sb.fs_swuid).AppendLine(); //xmlFSType.VolumeSerial = string.Format("{0:X16}", ufs_sb.fs_swuid); @@ -418,36 +424,41 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("{0} contiguously allocated directories", ufs_sb.fs_contigdirs).AppendLine(); sbInformation.AppendFormat("Standard superblock LBA: {0}", ufs_sb.fs_sblkno).AppendLine(); sbInformation.AppendFormat("{0} directories", ufs_sb.fs_cstotal.cs_ndir).AppendLine(); - sbInformation.AppendFormat("{0} free blocks ({1} bytes)", ufs_sb.fs_cstotal.cs_nbfree, ufs_sb.fs_cstotal.cs_nbfree * ufs_sb.fs_fsize).AppendLine(); + sbInformation.AppendFormat("{0} free blocks ({1} bytes)", ufs_sb.fs_cstotal.cs_nbfree, + ufs_sb.fs_cstotal.cs_nbfree * ufs_sb.fs_fsize).AppendLine(); xmlFSType.FreeClusters = (long)ufs_sb.fs_cstotal.cs_nbfree; xmlFSType.FreeClustersSpecified = true; sbInformation.AppendFormat("{0} free inodes", ufs_sb.fs_cstotal.cs_nifree).AppendLine(); sbInformation.AppendFormat("{0} free frags", ufs_sb.fs_cstotal.cs_nffree).AppendLine(); sbInformation.AppendFormat("{0} free clusters", ufs_sb.fs_cstotal.cs_numclusters).AppendLine(); - sbInformation.AppendFormat("Volume last written on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_time)).AppendLine(); + sbInformation.AppendFormat("Volume last written on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_time)) + .AppendLine(); xmlFSType.ModificationDate = DateHandlers.UNIXToDateTime(ufs_sb.fs_time); xmlFSType.ModificationDateSpecified = true; - sbInformation.AppendFormat("{0} blocks ({1} bytes)", ufs_sb.fs_size, ufs_sb.fs_size * ufs_sb.fs_fsize).AppendLine(); + sbInformation.AppendFormat("{0} blocks ({1} bytes)", ufs_sb.fs_size, ufs_sb.fs_size * ufs_sb.fs_fsize) + .AppendLine(); xmlFSType.Clusters = (long)ufs_sb.fs_size; - sbInformation.AppendFormat("{0} data blocks ({1} bytes)", ufs_sb.fs_dsize, ufs_sb.fs_dsize * ufs_sb.fs_fsize).AppendLine(); + sbInformation + .AppendFormat("{0} data blocks ({1} bytes)", ufs_sb.fs_dsize, ufs_sb.fs_dsize * ufs_sb.fs_fsize) + .AppendLine(); sbInformation.AppendFormat("Cylinder group summary area LBA: {0}", ufs_sb.fs_csaddr).AppendLine(); sbInformation.AppendFormat("{0} blocks pending of being freed", ufs_sb.fs_pendingblocks).AppendLine(); sbInformation.AppendFormat("{0} inodes pending of being freed", ufs_sb.fs_pendinginodes).AppendLine(); } if(fs_type_sun) { - sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_old_npsect)).AppendLine(); - } - else if(fs_type_sun86) - { - sbInformation.AppendFormat("{0} sectors/track", ufs_sb.fs_state).AppendLine(); + sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_old_npsect)) + .AppendLine(); } + else if(fs_type_sun86) { sbInformation.AppendFormat("{0} sectors/track", ufs_sb.fs_state).AppendLine(); } else if(fs_type_44bsd) { sbInformation.AppendFormat("{0} blocks on cluster summary array", ufs_sb.fs_contigsumsize).AppendLine(); - sbInformation.AppendFormat("Maximum length of a symbolic link: {0}", ufs_sb.fs_maxsymlinklen).AppendLine(); + sbInformation.AppendFormat("Maximum length of a symbolic link: {0}", ufs_sb.fs_maxsymlinklen) + .AppendLine(); sbInformation.AppendFormat("A file can be {0} bytes at max", ufs_sb.fs_maxfilesize).AppendLine(); - sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_state)).AppendLine(); + sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_state)) + .AppendLine(); } if(ufs_sb.fs_old_nrpos > 0) sbInformation.AppendFormat("{0} rotational positions", ufs_sb.fs_old_nrpos).AppendLine(); @@ -489,7 +500,6 @@ namespace DiscImageChef.Filesystems // Big-endian incomplete newfs const uint UFS_BAD_CIGAM = 0x08049619; - [StructLayout(LayoutKind.Sequential, Pack = 1)] struct csum { @@ -517,8 +527,7 @@ namespace DiscImageChef.Filesystems /// <summary>number of free clusters</summary> public long cs_numclusters; /// <summary>future expansion</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public long[] cs_spare; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public long[] cs_spare; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -647,11 +656,9 @@ namespace DiscImageChef.Filesystems /// <summary>old FS_ flags</summary> public sbyte fs_old_flags; /// <summary>name mounted on</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 468)] - public byte[] fs_fsmnt; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 468)] public byte[] fs_fsmnt; /// <summary>volume name</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] fs_volname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] fs_volname; /// <summary>system-wide uid</summary> public ulong fs_swuid; /// <summary>due to alignment of fs_swuid</summary> @@ -660,8 +667,7 @@ namespace DiscImageChef.Filesystems /// <summary>last cg searched</summary> public int fs_cgrotor; /// <summary>padding; was list of fs_cs buffers</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] - public uint[] fs_ocsp; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] public uint[] fs_ocsp; /// <summary>(u) # of contig. allocated dirs</summary> public uint fs_contigdirs; /// <summary>(u) cg summary info buffer</summary> @@ -681,8 +687,7 @@ namespace DiscImageChef.Filesystems /// <summary>size of area reserved for metadata</summary> public long fs_metaspace; /// <summary>old rotation block list head</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public long[] fs_sparecon64; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public long[] fs_sparecon64; /// <summary>byte offset of standard superblock</summary> public long fs_sblockloc; /// <summary>(u) cylinder summary information</summary> @@ -700,8 +705,7 @@ namespace DiscImageChef.Filesystems /// <summary>(u) inodes being freed</summary> public uint fs_pendinginodes; /// <summary>list of snapshot inode numbers</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public uint[] fs_snapinum; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public uint[] fs_snapinum; /// <summary>expected average file size</summary> public uint fs_avgfilesize; /// <summary>expected # of files per directory</summary> @@ -713,8 +717,7 @@ namespace DiscImageChef.Filesystems /// <summary>SUJ free list</summary> public int fs_sujfree; /// <summary>reserved for future constants</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 23)] - public int[] fs_sparecon32; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 23)] public int[] fs_sparecon32; /// <summary>see FS_ flags below</summary> public int fs_flags; /// <summary>size of cluster summary array</summary> @@ -742,8 +745,7 @@ namespace DiscImageChef.Filesystems /// <summary>magic number</summary> public uint fs_magic; /// <summary>list of blocks for each rotation</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] - public byte[] fs_rotbl; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] fs_rotbl; } public override Errno Mount() diff --git a/DiscImageChef.Filesystems/Filesystem.cs b/DiscImageChef.Filesystems/Filesystem.cs index f5505003..0cd4a407 100644 --- a/DiscImageChef.Filesystems/Filesystem.cs +++ b/DiscImageChef.Filesystems/Filesystem.cs @@ -40,7 +40,7 @@ namespace DiscImageChef.Filesystems /// <summary> /// Abstract class to implement filesystem plugins. /// </summary> - public abstract class Filesystem + public abstract class Filesystem { /// <summary>Plugin name.</summary> public string Name; @@ -55,20 +55,13 @@ namespace DiscImageChef.Filesystems /// <value>Information about the filesystem as expected by CICM Metadata XML</value> public Schemas.FileSystemType XmlFSType { - get - { - return xmlFSType; - } + get { return xmlFSType; } } - protected Filesystem() - { - } + protected Filesystem() { } // TODO: Call other constructors - protected Filesystem(Encoding encoding) - { - } + protected Filesystem(Encoding encoding) { } /// <summary> /// Initializes a filesystem instance prepared for reading contents @@ -76,9 +69,7 @@ namespace DiscImageChef.Filesystems /// <param name="imagePlugin">Image plugin.</param> /// <param name="partition">Partition.</param> /// <param name="encoding">Which encoding to use for this filesystem.</param> - protected Filesystem(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) - { - } + protected Filesystem(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { } /// <summary> /// Identifies the filesystem in the specified LBA @@ -94,7 +85,8 @@ namespace DiscImageChef.Filesystems /// <param name="imagePlugin">Disk image.</param> /// <param name="partition">Partition.</param> /// <param name="information">Filesystem information.</param> - public abstract void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information); + public abstract void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information); /// <summary> /// Initializates whatever internal structures the filesystem plugin needs to be able to read files and directories from the filesystem. @@ -181,5 +173,4 @@ namespace DiscImageChef.Filesystems /// <param name="dest">Link destination.</param> public abstract Errno ReadLink(string path, ref string dest); } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Fossil.cs b/DiscImageChef.Filesystems/Fossil.cs index 82fc8eaf..ddb75f41 100644 --- a/DiscImageChef.Filesystems/Fossil.cs +++ b/DiscImageChef.Filesystems/Fossil.cs @@ -112,13 +112,11 @@ namespace DiscImageChef.Filesystems /// <summary> /// Venti score of last successful archive /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] last; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] last; /// <summary> /// name of file system(just a comment) /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] name; } const uint Fossil_HdrMagic = 0x3776AE89; @@ -155,22 +153,22 @@ namespace DiscImageChef.Filesystems FossilHeader hdr = new FossilHeader(); - if(partition.Start + hdrSector > imagePlugin.GetSectors()) - return false; + if(partition.Start + hdrSector > imagePlugin.GetSectors()) return false; byte[] sector = imagePlugin.ReadSector(partition.Start + hdrSector); hdr = BigEndianMarshal.ByteArrayToStructureBigEndian<FossilHeader>(sector); - DicConsole.DebugWriteLine("Fossil plugin", "magic at 0x{0:X8} (expected 0x{1:X8})", hdr.magic, Fossil_HdrMagic); + DicConsole.DebugWriteLine("Fossil plugin", "magic at 0x{0:X8} (expected 0x{1:X8})", hdr.magic, + Fossil_HdrMagic); return hdr.magic == Fossil_HdrMagic; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < 512) - return; + if(imagePlugin.GetSectorSize() < 512) return; ulong hdrSector = HeaderPos / imagePlugin.GetSectorSize(); @@ -179,7 +177,8 @@ namespace DiscImageChef.Filesystems byte[] sector = imagePlugin.ReadSector(partition.Start + hdrSector); hdr = BigEndianMarshal.ByteArrayToStructureBigEndian<FossilHeader>(sector); - DicConsole.DebugWriteLine("Fossil plugin", "magic at 0x{0:X8} (expected 0x{1:X8})", hdr.magic, Fossil_HdrMagic); + DicConsole.DebugWriteLine("Fossil plugin", "magic at 0x{0:X8} (expected 0x{1:X8})", hdr.magic, + Fossil_HdrMagic); StringBuilder sb = new StringBuilder(); @@ -205,7 +204,8 @@ namespace DiscImageChef.Filesystems sector = imagePlugin.ReadSector(sbLocation); FossilSuperBlock fsb = BigEndianMarshal.ByteArrayToStructureBigEndian<FossilSuperBlock>(sector); - DicConsole.DebugWriteLine("Fossil plugin", "magic 0x{0:X8} (expected 0x{1:X8})", fsb.magic, Fossil_SbMagic); + DicConsole.DebugWriteLine("Fossil plugin", "magic 0x{0:X8} (expected 0x{1:X8})", fsb.magic, + Fossil_SbMagic); if(fsb.magic == Fossil_SbMagic) { @@ -215,7 +215,8 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Active root block {0}", fsb.active).AppendLine(); sb.AppendFormat("Next root block {0}", fsb.next).AppendLine(); sb.AppendFormat("Curren root block {0}", fsb.current).AppendLine(); - sb.AppendFormat("Volume label: \"{0}\"", StringHandlers.CToString(fsb.name, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Volume label: \"{0}\"", StringHandlers.CToString(fsb.name, CurrentEncoding)) + .AppendLine(); xmlFSType.VolumeName = StringHandlers.CToString(fsb.name, CurrentEncoding); } } diff --git a/DiscImageChef.Filesystems/HAMMER.cs b/DiscImageChef.Filesystems/HAMMER.cs index c480eb2e..1709fb68 100644 --- a/DiscImageChef.Filesystems/HAMMER.cs +++ b/DiscImageChef.Filesystems/HAMMER.cs @@ -59,31 +59,25 @@ namespace DiscImageChef.Filesystems { Name = "HAMMER Filesystem"; PluginUUID = new Guid("91A188BF-5FD7-4677-BBD3-F59EBA9C864D"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public HAMMER(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "HAMMER Filesystem"; PluginUUID = new Guid("91A188BF-5FD7-4677-BBD3-F59EBA9C864D"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { uint run = HAMMER_VOLHDR_SIZE / imagePlugin.GetSectorSize(); - if(HAMMER_VOLHDR_SIZE % imagePlugin.GetSectorSize() > 0) - run++; + if(HAMMER_VOLHDR_SIZE % imagePlugin.GetSectorSize() > 0) run++; - if((run + partition.Start) >= partition.End) - return false; + if((run + partition.Start) >= partition.End) return false; ulong magic; @@ -94,7 +88,8 @@ namespace DiscImageChef.Filesystems return magic == HAMMER_FSBUF_VOLUME || magic == HAMMER_FSBUF_VOLUME_REV; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -104,8 +99,7 @@ namespace DiscImageChef.Filesystems uint run = HAMMER_VOLHDR_SIZE / imagePlugin.GetSectorSize(); - if(HAMMER_VOLHDR_SIZE % imagePlugin.GetSectorSize() > 0) - run++; + if(HAMMER_VOLHDR_SIZE % imagePlugin.GetSectorSize() > 0) run++; ulong magic; @@ -116,19 +110,19 @@ namespace DiscImageChef.Filesystems if(magic == HAMMER_FSBUF_VOLUME) { GCHandle handle = GCHandle.Alloc(sb_sector, GCHandleType.Pinned); - hammer_sb = (HammerSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(HammerSuperBlock)); + hammer_sb = (HammerSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), + typeof(HammerSuperBlock)); handle.Free(); } - else - { - hammer_sb = BigEndianMarshal.ByteArrayToStructureBigEndian<HammerSuperBlock>(sb_sector); - } + else { hammer_sb = BigEndianMarshal.ByteArrayToStructureBigEndian<HammerSuperBlock>(sb_sector); } sb.AppendLine("HAMMER filesystem"); sb.AppendFormat("Volume version: {0}", hammer_sb.vol_version).AppendLine(); - sb.AppendFormat("Volume {0} of {1} on this filesystem", hammer_sb.vol_no + 1, hammer_sb.vol_count).AppendLine(); - sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(hammer_sb.vol_label, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Volume {0} of {1} on this filesystem", hammer_sb.vol_no + 1, hammer_sb.vol_count) + .AppendLine(); + sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(hammer_sb.vol_label, CurrentEncoding)) + .AppendLine(); sb.AppendFormat("Volume serial: {0}", hammer_sb.vol_fsid).AppendLine(); sb.AppendFormat("Filesystem type: {0}", hammer_sb.vol_fstype).AppendLine(); sb.AppendFormat("Boot area starts at {0}", hammer_sb.vol_bot_beg).AppendLine(); @@ -148,8 +142,10 @@ namespace DiscImageChef.Filesystems if(hammer_sb.vol_no == hammer_sb.vol_rootvol) { - sb.AppendFormat("Filesystem contains {0} \"big-blocks\" ({1} bytes)", hammer_sb.vol0_stat_bigblocks, hammer_sb.vol0_stat_bigblocks * HAMMER_BIGBLOCK_SIZE).AppendLine(); - sb.AppendFormat("Filesystem has {0} \"big-blocks\" free ({1} bytes)", hammer_sb.vol0_stat_freebigblocks, hammer_sb.vol0_stat_freebigblocks * HAMMER_BIGBLOCK_SIZE).AppendLine(); + sb.AppendFormat("Filesystem contains {0} \"big-blocks\" ({1} bytes)", hammer_sb.vol0_stat_bigblocks, + hammer_sb.vol0_stat_bigblocks * HAMMER_BIGBLOCK_SIZE).AppendLine(); + sb.AppendFormat("Filesystem has {0} \"big-blocks\" free ({1} bytes)", hammer_sb.vol0_stat_freebigblocks, + hammer_sb.vol0_stat_freebigblocks * HAMMER_BIGBLOCK_SIZE).AppendLine(); sb.AppendFormat("Filesystem has {0} inode used", hammer_sb.vol0_stat_inodes).AppendLine(); xmlFSType.Clusters = hammer_sb.vol0_stat_bigblocks; @@ -173,7 +169,7 @@ namespace DiscImageChef.Filesystems /// <summary><see cref="HAMMER_FSBUF_VOLUME"/> for a valid header</summary> public ulong vol_signature; - /* These are relative to block device offset, not zone offsets. */ + /* These are relative to block device offset, not zone offsets. */ /// <summary>offset of boot area</summary> public long vol_bot_beg; /// <summary>offset of memory log</summary> @@ -189,8 +185,7 @@ namespace DiscImageChef.Filesystems /// <summary>identify filesystem type</summary> public Guid vol_fstype; /// <summary>filesystem label</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] vol_label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] vol_label; /// <summary>volume number within filesystem</summary> public int vol_no; @@ -206,8 +201,7 @@ namespace DiscImageChef.Filesystems /// <summary>the root volume number (must be 0)</summary> public uint vol_rootvol; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public uint[] vol_reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public uint[] vol_reserved; /* * These fields are initialized and space is reserved in every @@ -231,12 +225,10 @@ namespace DiscImageChef.Filesystems public hammer_off_t vol0_reserved03; /// <summary>Blockmaps for zones. Not all zones use a blockmap. Note that the entire root blockmap is cached in the hammer_mount structure.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public HammerBlockMap[] vol0_blockmap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public HammerBlockMap[] vol0_blockmap; /// <summary>Array of zone-2 addresses for undo FIFO.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public hammer_off_t[] vol0_undo_array; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public hammer_off_t[] vol0_undo_array; } struct HammerBlockMap @@ -313,5 +305,4 @@ namespace DiscImageChef.Filesystems return Errno.NotImplemented; } } -} - \ No newline at end of file +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/HPFS.cs b/DiscImageChef.Filesystems/HPFS.cs index ae60be37..02587d73 100644 --- a/DiscImageChef.Filesystems/HPFS.cs +++ b/DiscImageChef.Filesystems/HPFS.cs @@ -53,39 +53,36 @@ namespace DiscImageChef.Filesystems { Name = "OS/2 High Performance File System"; PluginUUID = new Guid("33513B2C-f590-4acb-8bf2-0b1d5e19dec5"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("ibm850"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("ibm850"); + else CurrentEncoding = encoding; } public HPFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "OS/2 High Performance File System"; PluginUUID = new Guid("33513B2C-f590-4acb-8bf2-0b1d5e19dec5"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("ibm850"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("ibm850"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((16 + partition.Start) >= partition.End) - return false; + if((16 + partition.Start) >= partition.End) return false; uint magic1, magic2; - byte[] hpfs_sb_sector = imagePlugin.ReadSector(16 + partition.Start); // Seek to superblock, on logical sector 16 + byte[] hpfs_sb_sector = + imagePlugin.ReadSector(16 + partition.Start); // Seek to superblock, on logical sector 16 magic1 = BitConverter.ToUInt32(hpfs_sb_sector, 0x000); magic2 = BitConverter.ToUInt32(hpfs_sb_sector, 0x004); - if(magic1 == 0xF995E849 && magic2 == 0xFA53E9C5) - return true; + if(magic1 == 0xF995E849 && magic2 == 0xFA53E9C5) return true; + return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -98,9 +95,12 @@ namespace DiscImageChef.Filesystems byte[] oem_name = new byte[8]; byte[] volume_name = new byte[11]; - byte[] hpfs_bpb_sector = imagePlugin.ReadSector(0 + partition.Start); // Seek to BIOS parameter block, on logical sector 0 - byte[] hpfs_sb_sector = imagePlugin.ReadSector(16 + partition.Start); // Seek to superblock, on logical sector 16 - byte[] hpfs_sp_sector = imagePlugin.ReadSector(17 + partition.Start); // Seek to spareblock, on logical sector 17 + byte[] hpfs_bpb_sector = + imagePlugin.ReadSector(0 + partition.Start); // Seek to BIOS parameter block, on logical sector 0 + byte[] hpfs_sb_sector = + imagePlugin.ReadSector(16 + partition.Start); // Seek to superblock, on logical sector 16 + byte[] hpfs_sp_sector = + imagePlugin.ReadSector(17 + partition.Start); // Seek to spareblock, on logical sector 17 IntPtr bpbPtr = Marshal.AllocHGlobal(512); Marshal.Copy(hpfs_bpb_sector, 0, bpbPtr, 512); @@ -117,9 +117,8 @@ namespace DiscImageChef.Filesystems hpfs_sp = (HPFS_SpareBlock)Marshal.PtrToStructure(spPtr, typeof(HPFS_SpareBlock)); Marshal.FreeHGlobal(spPtr); - if(StringHandlers.CToString(hpfs_bpb.fs_type) != "HPFS " || - hpfs_sb.magic1 != 0xF995E849 || hpfs_sb.magic2 != 0xFA53E9C5 || - hpfs_sp.magic1 != 0xF9911849 || hpfs_sp.magic2 != 0xFA5229C5) + if(StringHandlers.CToString(hpfs_bpb.fs_type) != "HPFS " || hpfs_sb.magic1 != 0xF995E849 || + hpfs_sb.magic2 != 0xFA53E9C5 || hpfs_sp.magic1 != 0xF9911849 || hpfs_sp.magic2 != 0xFA5229C5) { sb.AppendLine("This may not be HPFS, following information may be not correct."); sb.AppendFormat("File system type: \"{0}\" (Should be \"HPFS \")", hpfs_bpb.fs_type).AppendLine(); @@ -141,13 +140,15 @@ namespace DiscImageChef.Filesystems // sb.AppendFormat("{0} sectors per track", hpfs_bpb.sptrk).AppendLine(); // sb.AppendFormat("{0} heads", hpfs_bpb.heads).AppendLine(); sb.AppendFormat("{0} sectors hidden before BPB", hpfs_bpb.hsectors).AppendLine(); - sb.AppendFormat("{0} sectors on volume ({1} bytes)", hpfs_sb.sectors, hpfs_sb.sectors * hpfs_bpb.bps).AppendLine(); + sb.AppendFormat("{0} sectors on volume ({1} bytes)", hpfs_sb.sectors, hpfs_sb.sectors * hpfs_bpb.bps) + .AppendLine(); // sb.AppendFormat("{0} sectors on volume ({1} bytes)", hpfs_bpb.big_sectors, hpfs_bpb.big_sectors * hpfs_bpb.bps).AppendLine(); sb.AppendFormat("BIOS Drive Number: 0x{0:X2}", hpfs_bpb.drive_no).AppendLine(); - sb.AppendFormat("NT Flags: 0x{0:X2}", hpfs_bpb.nt_flags).AppendLine(); + sb.AppendFormat("NT Flags: 0x{0:X2}", hpfs_bpb.nt_flags).AppendLine(); sb.AppendFormat("Signature: 0x{0:X2}", hpfs_bpb.signature).AppendLine(); sb.AppendFormat("Serial number: 0x{0:X8}", hpfs_bpb.serial_no).AppendLine(); - sb.AppendFormat("Volume label: {0}", StringHandlers.CToString(hpfs_bpb.volume_label, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Volume label: {0}", StringHandlers.CToString(hpfs_bpb.volume_label, CurrentEncoding)) + .AppendLine(); // sb.AppendFormat("Filesystem type: \"{0}\"", hpfs_bpb.fs_type).AppendLine(); DateTime last_chk = DateHandlers.UNIXToDateTime(hpfs_sb.last_chkdsk); @@ -159,14 +160,10 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} sectors are marked bad", hpfs_sb.badblocks).AppendLine(); sb.AppendFormat("Sector of free space bitmaps: {0}", hpfs_sb.bitmap_lsn).AppendLine(); sb.AppendFormat("Sector of bad blocks list: {0}", hpfs_sb.badblock_lsn).AppendLine(); - if(hpfs_sb.last_chkdsk > 0) - sb.AppendFormat("Date of last integrity check: {0}", last_chk).AppendLine(); - else - sb.AppendLine("Filesystem integrity has never been checked"); - if(hpfs_sb.last_optim > 0) - sb.AppendFormat("Date of last optimization {0}", last_optim).AppendLine(); - else - sb.AppendLine("Filesystem has never been optimized"); + if(hpfs_sb.last_chkdsk > 0) sb.AppendFormat("Date of last integrity check: {0}", last_chk).AppendLine(); + else sb.AppendLine("Filesystem integrity has never been checked"); + if(hpfs_sb.last_optim > 0) sb.AppendFormat("Date of last optimization {0}", last_optim).AppendLine(); + else sb.AppendLine("Filesystem has never been optimized"); sb.AppendFormat("Directory band has {0} sectors", hpfs_sb.dband_sectors).AppendLine(); sb.AppendFormat("Directory band starts at sector {0}", hpfs_sb.dband_start).AppendLine(); sb.AppendFormat("Directory band ends at sector {0}", hpfs_sb.dband_last).AppendLine(); @@ -184,45 +181,29 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("SpareBlock CRC32: {0:X8}", hpfs_sp.sp_crc32).AppendLine(); sb.AppendLine("Flags:"); - if((hpfs_sp.flags1 & 0x01) == 0x01) - sb.AppendLine("Filesystem is dirty."); - else - sb.AppendLine("Filesystem is clean."); - if((hpfs_sp.flags1 & 0x02) == 0x02) - sb.AppendLine("Spare directory blocks are in use"); - if((hpfs_sp.flags1 & 0x04) == 0x04) - sb.AppendLine("Hotfixes are in use"); - if((hpfs_sp.flags1 & 0x08) == 0x08) - sb.AppendLine("Disk contains bad sectors"); - if((hpfs_sp.flags1 & 0x10) == 0x10) - sb.AppendLine("Disk has a bad bitmap"); - if((hpfs_sp.flags1 & 0x20) == 0x20) - sb.AppendLine("Filesystem was formatted fast"); - if((hpfs_sp.flags1 & 0x40) == 0x40) - sb.AppendLine("Unknown flag 0x40 on flags1 is active"); - if((hpfs_sp.flags1 & 0x80) == 0x80) - sb.AppendLine("Filesystem has been mounted by an old IFS"); - if((hpfs_sp.flags2 & 0x01) == 0x01) - sb.AppendLine("Install DASD limits"); - if((hpfs_sp.flags2 & 0x02) == 0x02) - sb.AppendLine("Resync DASD limits"); - if((hpfs_sp.flags2 & 0x04) == 0x04) - sb.AppendLine("DASD limits are operational"); - if((hpfs_sp.flags2 & 0x08) == 0x08) - sb.AppendLine("Multimedia is active"); - if((hpfs_sp.flags2 & 0x10) == 0x10) - sb.AppendLine("DCE ACLs are active"); - if((hpfs_sp.flags2 & 0x20) == 0x20) - sb.AppendLine("DASD limits are dirty"); - if((hpfs_sp.flags2 & 0x40) == 0x40) - sb.AppendLine("Unknown flag 0x40 on flags2 is active"); - if((hpfs_sp.flags2 & 0x80) == 0x80) - sb.AppendLine("Unknown flag 0x80 on flags2 is active"); + if((hpfs_sp.flags1 & 0x01) == 0x01) sb.AppendLine("Filesystem is dirty."); + else sb.AppendLine("Filesystem is clean."); + if((hpfs_sp.flags1 & 0x02) == 0x02) sb.AppendLine("Spare directory blocks are in use"); + if((hpfs_sp.flags1 & 0x04) == 0x04) sb.AppendLine("Hotfixes are in use"); + if((hpfs_sp.flags1 & 0x08) == 0x08) sb.AppendLine("Disk contains bad sectors"); + if((hpfs_sp.flags1 & 0x10) == 0x10) sb.AppendLine("Disk has a bad bitmap"); + if((hpfs_sp.flags1 & 0x20) == 0x20) sb.AppendLine("Filesystem was formatted fast"); + if((hpfs_sp.flags1 & 0x40) == 0x40) sb.AppendLine("Unknown flag 0x40 on flags1 is active"); + if((hpfs_sp.flags1 & 0x80) == 0x80) sb.AppendLine("Filesystem has been mounted by an old IFS"); + if((hpfs_sp.flags2 & 0x01) == 0x01) sb.AppendLine("Install DASD limits"); + if((hpfs_sp.flags2 & 0x02) == 0x02) sb.AppendLine("Resync DASD limits"); + if((hpfs_sp.flags2 & 0x04) == 0x04) sb.AppendLine("DASD limits are operational"); + if((hpfs_sp.flags2 & 0x08) == 0x08) sb.AppendLine("Multimedia is active"); + if((hpfs_sp.flags2 & 0x10) == 0x10) sb.AppendLine("DCE ACLs are active"); + if((hpfs_sp.flags2 & 0x20) == 0x20) sb.AppendLine("DASD limits are dirty"); + if((hpfs_sp.flags2 & 0x40) == 0x40) sb.AppendLine("Unknown flag 0x40 on flags2 is active"); + if((hpfs_sp.flags2 & 0x80) == 0x80) sb.AppendLine("Unknown flag 0x80 on flags2 is active"); xmlFSType = new Schemas.FileSystemType(); // Theoretically everything from BPB to SB is boot code, should I hash everything or only the sector loaded by BIOS itself? - if(hpfs_bpb.jump[0] == 0xEB && hpfs_bpb.jump[1] > 0x3C && hpfs_bpb.jump[1] < 0x80 && hpfs_bpb.signature2 == 0xAA55) + if(hpfs_bpb.jump[0] == 0xEB && hpfs_bpb.jump[1] > 0x3C && hpfs_bpb.jump[1] < 0x80 && + hpfs_bpb.signature2 == 0xAA55) { xmlFSType.Bootable = true; SHA1Context sha1Ctx = new SHA1Context(); @@ -250,11 +231,9 @@ namespace DiscImageChef.Filesystems struct HPFS_BIOSParameterBlock { /// <summary>0x000, Jump to boot code</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump; /// <summary>0x003, OEM Name, 8 bytes, space-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] oem_name; /// <summary>0x00B, Bytes per sector</summary> public ushort bps; /// <summary>0x00D, Sectors per cluster</summary> @@ -288,14 +267,11 @@ namespace DiscImageChef.Filesystems /// <summary>0x02B, Volume serial number</summary> public uint serial_no; /// <summary>0x02F, Volume label, 11 bytes, space-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] volume_label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] volume_label; /// <summary>0x03A, Filesystem type, 8 bytes, space-padded ("HPFS ")</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] fs_type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] fs_type; /// <summary>Boot code.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 448)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 448)] public byte[] boot_code; /// <summary>0x1FE, 0xAA55</summary> public ushort signature2; } @@ -450,4 +426,4 @@ namespace DiscImageChef.Filesystems return Errno.NotImplemented; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/AAIP.cs b/DiscImageChef.Filesystems/ISO9660/Consts/AAIP.cs index 6eea90e6..0641c695 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/AAIP.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/AAIP.cs @@ -45,4 +45,4 @@ namespace DiscImageChef.Filesystems.ISO9660 Continue = 1 } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/Amiga.cs b/DiscImageChef.Filesystems/ISO9660/Consts/Amiga.cs index 31a932dc..e44c1bd8 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/Amiga.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/Amiga.cs @@ -72,4 +72,4 @@ namespace DiscImageChef.Filesystems.ISO9660 Reserved = 1 << 7, } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/Apple.cs b/DiscImageChef.Filesystems/ISO9660/Consts/Apple.cs index 896ce197..b783c67d 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/Apple.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/Apple.cs @@ -53,4 +53,4 @@ namespace DiscImageChef.Filesystems.ISO9660 HFS = 6 } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/CDi.cs b/DiscImageChef.Filesystems/ISO9660/Consts/CDi.cs index fe0bfae2..432b644f 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/CDi.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/CDi.cs @@ -64,4 +64,4 @@ namespace DiscImageChef.Filesystems.ISO9660 Directory = 1 << 15, } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/ElTorito.cs b/DiscImageChef.Filesystems/ISO9660/Consts/ElTorito.cs index 4dfa1fec..6e65f834 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/ElTorito.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/ElTorito.cs @@ -74,4 +74,4 @@ namespace DiscImageChef.Filesystems.ISO9660 SCSI = 0x08 } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/HighSierra.cs b/DiscImageChef.Filesystems/ISO9660/Consts/HighSierra.cs index c6b1a6d7..6c31989f 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/HighSierra.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/HighSierra.cs @@ -36,4 +36,4 @@ namespace DiscImageChef.Filesystems.ISO9660 { readonly string HighSierraMagic = "CDROM"; } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/ISO.cs b/DiscImageChef.Filesystems/ISO9660/Consts/ISO.cs index 3cd0a694..9bf9db4f 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/ISO.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/ISO.cs @@ -77,4 +77,4 @@ namespace DiscImageChef.Filesystems.ISO9660 ControlContained = 2, } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/RRIP.cs b/DiscImageChef.Filesystems/ISO9660/Consts/RRIP.cs index fb747528..16445e3a 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/RRIP.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/RRIP.cs @@ -110,4 +110,4 @@ namespace DiscImageChef.Filesystems.ISO9660 LongFormat = 1 << 7, } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/SUSP.cs b/DiscImageChef.Filesystems/ISO9660/Consts/SUSP.cs index c9a9cedc..7b3cd079 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/SUSP.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/SUSP.cs @@ -42,4 +42,4 @@ namespace DiscImageChef.Filesystems.ISO9660 const ushort SUSP_Selector = 0x4553; // "ES" const ushort SUSP_Magic = 0xBEEF; } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/XA.cs b/DiscImageChef.Filesystems/ISO9660/Consts/XA.cs index 4dccfc54..00dcbeeb 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/XA.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/XA.cs @@ -54,4 +54,4 @@ namespace DiscImageChef.Filesystems.ISO9660 Directory = 0x8000, } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/Ziso.cs b/DiscImageChef.Filesystems/ISO9660/Consts/Ziso.cs index 71bec334..82ed7528 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts/Ziso.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts/Ziso.cs @@ -39,4 +39,4 @@ namespace DiscImageChef.Filesystems.ISO9660 const ushort ziso_Magic = 0x5A46; // "ZF" const ushort ziso_PagedZlib = 0x707A; // "pz" } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Dir.cs b/DiscImageChef.Filesystems/ISO9660/Dir.cs index 4d095653..292d4992 100644 --- a/DiscImageChef.Filesystems/ISO9660/Dir.cs +++ b/DiscImageChef.Filesystems/ISO9660/Dir.cs @@ -46,4 +46,4 @@ namespace DiscImageChef.Filesystems.ISO9660 return Errno.NotImplemented; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Extent.cs b/DiscImageChef.Filesystems/ISO9660/Extent.cs index 9f2f23d8..3dfe3c0d 100644 --- a/DiscImageChef.Filesystems/ISO9660/Extent.cs +++ b/DiscImageChef.Filesystems/ISO9660/Extent.cs @@ -39,4 +39,4 @@ namespace DiscImageChef.Filesystems.ISO9660 return Errno.NotImplemented; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/File.cs b/DiscImageChef.Filesystems/ISO9660/File.cs index c0452ac6..4a323b53 100644 --- a/DiscImageChef.Filesystems/ISO9660/File.cs +++ b/DiscImageChef.Filesystems/ISO9660/File.cs @@ -49,4 +49,4 @@ namespace DiscImageChef.Filesystems.ISO9660 return Errno.NotImplemented; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/ISO9660.cs b/DiscImageChef.Filesystems/ISO9660/ISO9660.cs index 4f4fa910..55fd3212 100644 --- a/DiscImageChef.Filesystems/ISO9660/ISO9660.cs +++ b/DiscImageChef.Filesystems/ISO9660/ISO9660.cs @@ -50,20 +50,16 @@ namespace DiscImageChef.Filesystems.ISO9660 { Name = "ISO9660 Filesystem"; PluginUUID = new Guid("d812f4d3-c357-400d-90fd-3b22ef786aa8"); - if(encoding == null) - CurrentEncoding = Encoding.ASCII; - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.ASCII; + else CurrentEncoding = encoding; } public ISO9660(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "ISO9660 Filesystem"; PluginUUID = new Guid("d812f4d3-c357-400d-90fd-3b22ef786aa8"); - if(encoding == null) - CurrentEncoding = Encoding.ASCII; - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.ASCII; + else CurrentEncoding = encoding; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Info.cs b/DiscImageChef.Filesystems/ISO9660/Info.cs index 1a62dd49..43bc9180 100644 --- a/DiscImageChef.Filesystems/ISO9660/Info.cs +++ b/DiscImageChef.Filesystems/ISO9660/Info.cs @@ -46,27 +46,23 @@ namespace DiscImageChef.Filesystems.ISO9660 byte VDType; // ISO9660 is designed for 2048 bytes/sector devices - if(imagePlugin.GetSectorSize() < 2048) - return false; + if(imagePlugin.GetSectorSize() < 2048) return false; // ISO9660 Primary Volume Descriptor starts at sector 16, so that's minimal size. - if(partition.End <= (16 + partition.Start)) - return false; + if(partition.End <= (16 + partition.Start)) return false; // Read to Volume Descriptor byte[] vd_sector = imagePlugin.ReadSector(16 + partition.Start); int xa_off = 0; - if(vd_sector.Length == 2336) - xa_off = 8; + if(vd_sector.Length == 2336) xa_off = 8; VDType = vd_sector[0 + xa_off]; byte[] VDMagic = new byte[5]; byte[] HSMagic = new byte[5]; // This indicates the end of a volume descriptor. HighSierra here would have 16 so no problem - if(VDType == 255) - return false; + if(VDType == 255) return false; Array.Copy(vd_sector, 0x001 + xa_off, VDMagic, 0, 5); Array.Copy(vd_sector, 0x009 + xa_off, HSMagic, 0, 5); @@ -74,16 +70,19 @@ namespace DiscImageChef.Filesystems.ISO9660 DicConsole.DebugWriteLine("ISO9660 plugin", "VDMagic = {0}", CurrentEncoding.GetString(VDMagic)); DicConsole.DebugWriteLine("ISO9660 plugin", "HSMagic = {0}", CurrentEncoding.GetString(HSMagic)); - return CurrentEncoding.GetString(VDMagic) == IsoMagic || CurrentEncoding.GetString(HSMagic) == HighSierraMagic || CurrentEncoding.GetString(VDMagic) == CdiMagic; + return CurrentEncoding.GetString(VDMagic) == IsoMagic || + CurrentEncoding.GetString(HSMagic) == HighSierraMagic || + CurrentEncoding.GetString(VDMagic) == CdiMagic; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; StringBuilder ISOMetadata = new StringBuilder(); - byte VDType; // Volume Descriptor Type, should be 1 or 2. - byte[] VDMagic = new byte[5]; // Volume Descriptor magic "CD001" - byte[] HSMagic = new byte[5]; // Volume Descriptor magic "CDROM" + byte VDType; // Volume Descriptor Type, should be 1 or 2. + byte[] VDMagic = new byte[5]; // Volume Descriptor magic "CD001" + byte[] HSMagic = new byte[5]; // Volume Descriptor magic "CDROM" string BootSpec = ""; @@ -98,12 +97,10 @@ namespace DiscImageChef.Filesystems.ISO9660 ElToritoBootRecord? torito = null; // ISO9660 is designed for 2048 bytes/sector devices - if(imagePlugin.GetSectorSize() < 2048) - return; + if(imagePlugin.GetSectorSize() < 2048) return; // ISO9660 Primary Volume Descriptor starts at sector 16, so that's minimal size. - if(partition.End < 16) - return; + if(partition.End < 16) return; ulong counter = 0; @@ -112,8 +109,7 @@ namespace DiscImageChef.Filesystems.ISO9660 Array.Copy(vd_sector, 0x009 + xa_off, HSMagic, 0, 5); bool HighSierra = CurrentEncoding.GetString(HSMagic) == HighSierraMagic; int hs_off = 0; - if(HighSierra) - hs_off = 8; + if(HighSierra) hs_off = 8; bool CDi = false; while(true) @@ -130,18 +126,21 @@ namespace DiscImageChef.Filesystems.ISO9660 if(VDType == 255) // Supposedly we are in the PVD. { - if(counter == 0) - return; + if(counter == 0) return; + break; } Array.Copy(vd_sector, 0x001, VDMagic, 0, 5); Array.Copy(vd_sector, 0x009, HSMagic, 0, 5); - if(CurrentEncoding.GetString(VDMagic) != IsoMagic && CurrentEncoding.GetString(HSMagic) != HighSierraMagic && CurrentEncoding.GetString(VDMagic) != CdiMagic) // Recognized, it is an ISO9660, now check for rest of data. + if(CurrentEncoding.GetString(VDMagic) != IsoMagic && + CurrentEncoding.GetString(HSMagic) != HighSierraMagic && + CurrentEncoding.GetString(VDMagic) != CdiMagic + ) // Recognized, it is an ISO9660, now check for rest of data. { - if(counter == 0) - return; + if(counter == 0) return; + break; } @@ -150,74 +149,72 @@ namespace DiscImageChef.Filesystems.ISO9660 switch(VDType) { case 0: + { + bvd = new BootRecord(); + IntPtr ptr = Marshal.AllocHGlobal(2048); + Marshal.Copy(vd_sector, hs_off, ptr, 2048 - hs_off); + bvd = (BootRecord)Marshal.PtrToStructure(ptr, typeof(BootRecord)); + Marshal.FreeHGlobal(ptr); + + BootSpec = "Unknown"; + + if(CurrentEncoding.GetString(bvd.Value.system_id).Substring(0, 23) == "EL TORITO SPECIFICATION") { - bvd = new BootRecord(); - IntPtr ptr = Marshal.AllocHGlobal(2048); + BootSpec = "El Torito"; + torito = new ElToritoBootRecord(); + ptr = Marshal.AllocHGlobal(2048); Marshal.Copy(vd_sector, hs_off, ptr, 2048 - hs_off); - bvd = (BootRecord)Marshal.PtrToStructure(ptr, typeof(BootRecord)); + torito = (ElToritoBootRecord)Marshal.PtrToStructure(ptr, typeof(ElToritoBootRecord)); Marshal.FreeHGlobal(ptr); - - BootSpec = "Unknown"; - - if(CurrentEncoding.GetString(bvd.Value.system_id).Substring(0, 23) == "EL TORITO SPECIFICATION") - { - BootSpec = "El Torito"; - torito = new ElToritoBootRecord(); - ptr = Marshal.AllocHGlobal(2048); - Marshal.Copy(vd_sector, hs_off, ptr, 2048 - hs_off); - torito = (ElToritoBootRecord)Marshal.PtrToStructure(ptr, typeof(ElToritoBootRecord)); - Marshal.FreeHGlobal(ptr); - } - - break; } + + break; + } case 1: + { + if(HighSierra) { - if(HighSierra) - { - hsvd = new HighSierraPrimaryVolumeDescriptor(); - IntPtr ptr = Marshal.AllocHGlobal(2048); - Marshal.Copy(vd_sector, 0, ptr, 2048); - hsvd = (HighSierraPrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(HighSierraPrimaryVolumeDescriptor)); - Marshal.FreeHGlobal(ptr); - } - else if(CDi) - fsvd = BigEndianMarshal.ByteArrayToStructureBigEndian<FileStructureVolumeDescriptor>(vd_sector); - else - { - pvd = new PrimaryVolumeDescriptor(); - IntPtr ptr = Marshal.AllocHGlobal(2048); - Marshal.Copy(vd_sector, 0, ptr, 2048); - pvd = (PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor)); - Marshal.FreeHGlobal(ptr); - } - break; - } - case 2: - { - PrimaryVolumeDescriptor svd = new PrimaryVolumeDescriptor(); + hsvd = new HighSierraPrimaryVolumeDescriptor(); IntPtr ptr = Marshal.AllocHGlobal(2048); Marshal.Copy(vd_sector, 0, ptr, 2048); - svd = (PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor)); + hsvd = + (HighSierraPrimaryVolumeDescriptor) + Marshal.PtrToStructure(ptr, typeof(HighSierraPrimaryVolumeDescriptor)); Marshal.FreeHGlobal(ptr); - - // Check if this is Joliet - if(svd.escape_sequences[0] == '%' && svd.escape_sequences[1] == '/') - { - if(svd.escape_sequences[2] == '@' || svd.escape_sequences[2] == 'C' || svd.escape_sequences[2] == 'E') - { - jolietvd = svd; - } - else - { - break; - } - } - else - DicConsole.WriteLine("ISO9660 plugin", "Found unknown supplementary volume descriptor"); - - break; } + else if(CDi) + fsvd = + BigEndianMarshal + .ByteArrayToStructureBigEndian<FileStructureVolumeDescriptor>(vd_sector); + else + { + pvd = new PrimaryVolumeDescriptor(); + IntPtr ptr = Marshal.AllocHGlobal(2048); + Marshal.Copy(vd_sector, 0, ptr, 2048); + pvd = (PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor)); + Marshal.FreeHGlobal(ptr); + } + break; + } + case 2: + { + PrimaryVolumeDescriptor svd = new PrimaryVolumeDescriptor(); + IntPtr ptr = Marshal.AllocHGlobal(2048); + Marshal.Copy(vd_sector, 0, ptr, 2048); + svd = (PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor)); + Marshal.FreeHGlobal(ptr); + + // Check if this is Joliet + if(svd.escape_sequences[0] == '%' && svd.escape_sequences[1] == '/') + { + if(svd.escape_sequences[2] == '@' || svd.escape_sequences[2] == 'C' || + svd.escape_sequences[2] == 'E') { jolietvd = svd; } + else { break; } + } + else DicConsole.WriteLine("ISO9660 plugin", "Found unknown supplementary volume descriptor"); + + break; + } } counter++; @@ -234,15 +231,11 @@ namespace DiscImageChef.Filesystems.ISO9660 return; } - if(HighSierra) - decodedVD = DecodeVolumeDescriptor(hsvd.Value); - else if(CDi) - decodedVD = DecodeVolumeDescriptor(fsvd.Value); - else - decodedVD = DecodeVolumeDescriptor(pvd.Value); - - if(jolietvd != null) - decodedJolietVD = DecodeJolietDescriptor(jolietvd.Value); + if(HighSierra) decodedVD = DecodeVolumeDescriptor(hsvd.Value); + else if(CDi) decodedVD = DecodeVolumeDescriptor(fsvd.Value); + else decodedVD = DecodeVolumeDescriptor(pvd.Value); + + if(jolietvd != null) decodedJolietVD = DecodeJolietDescriptor(jolietvd.Value); uint rootLocation = 0; uint rootSize = 0; @@ -250,19 +243,19 @@ namespace DiscImageChef.Filesystems.ISO9660 // No need to read root on CD-i, as extensions are not supported... if(!CDi) { - rootLocation = HighSierra ? hsvd.Value.root_directory_record.extent : pvd.Value.root_directory_record.extent; + rootLocation = HighSierra + ? hsvd.Value.root_directory_record.extent + : pvd.Value.root_directory_record.extent; if(HighSierra) { rootSize = hsvd.Value.root_directory_record.size / hsvd.Value.logical_block_size; - if(hsvd.Value.root_directory_record.size % hsvd.Value.logical_block_size > 0) - rootSize++; + if(hsvd.Value.root_directory_record.size % hsvd.Value.logical_block_size > 0) rootSize++; } else { rootSize = pvd.Value.root_directory_record.size / pvd.Value.logical_block_size; - if(pvd.Value.root_directory_record.size % pvd.Value.logical_block_size > 0) - rootSize++; + if(pvd.Value.root_directory_record.size % pvd.Value.logical_block_size > 0) rootSize++; } } @@ -315,8 +308,7 @@ namespace DiscImageChef.Filesystems.ISO9660 } } - if(sa_off + 2 >= sa_len) - break; + if(sa_off + 2 >= sa_len) break; ushort nextSignature = BigEndianBitConverter.ToUInt16(sa, sa_off); @@ -368,8 +360,7 @@ namespace DiscImageChef.Filesystems.ISO9660 if(nextSignature == AppleMagic) { // Can collide with AAIP - if(sa[sa_off + 3] == 1 && sa[sa_off + 2] == 7) - Apple = true; + if(sa[sa_off + 3] == 1 && sa[sa_off + 2] == 7) Apple = true; else Apple |= sa[sa_off + 3] != 1; } @@ -377,7 +368,8 @@ namespace DiscImageChef.Filesystems.ISO9660 { byte[] ce = new byte[sa[sa_off + 2]]; Array.Copy(sa, sa_off, ce, 0, ce.Length); - ContinuationArea ca = BigEndianMarshal.ByteArrayToStructureBigEndian<ContinuationArea>(ce); + ContinuationArea ca = + BigEndianMarshal.ByteArrayToStructureBigEndian<ContinuationArea>(ce); contareas.Add(ca); } @@ -389,38 +381,37 @@ namespace DiscImageChef.Filesystems.ISO9660 } RRIP |= nextSignature == RRIP_Magic || nextSignature == RRIP_PosixAttributes || - nextSignature == RRIP_PosixDevNo || nextSignature == RRIP_Symlink || - nextSignature == RRIP_Name || nextSignature == RRIP_Childlink || - nextSignature == RRIP_Parentlink || nextSignature == RRIP_RelocatedDir || - nextSignature == RRIP_Timestamps || nextSignature == RRIP_Sparse; + nextSignature == RRIP_PosixDevNo || nextSignature == RRIP_Symlink || + nextSignature == RRIP_Name || nextSignature == RRIP_Childlink || + nextSignature == RRIP_Parentlink || nextSignature == RRIP_RelocatedDir || + nextSignature == RRIP_Timestamps || nextSignature == RRIP_Sparse; ziso |= nextSignature == ziso_Magic; Amiga |= nextSignature == Amiga_Magic; - AAIP |= nextSignature == AAIP_Magic || (nextSignature == AAIP_OldMagic && sa[sa_off + 3] == 1 && sa[sa_off + 2] >= 9); + AAIP |= nextSignature == AAIP_Magic || + (nextSignature == AAIP_OldMagic && sa[sa_off + 3] == 1 && sa[sa_off + 2] >= 9); sa_off += sa[sa_off + 2]; - if(nextSignature == SUSP_Terminator) - break; + if(nextSignature == SUSP_Terminator) break; } } - if(noneFound) - break; + if(noneFound) break; } } rootOff += record.length; - if(record.length == 0) - break; + if(record.length == 0) break; } foreach(ContinuationArea ca in contareas) { - uint ca_len = (ca.ca_length_be + ca.offset_be) / (HighSierra ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size); - if((ca.ca_length_be + ca.offset_be) % (HighSierra ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size) > 0) - ca_len++; + uint ca_len = (ca.ca_length_be + ca.offset_be) / + (HighSierra ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size); + if((ca.ca_length_be + ca.offset_be) % + (HighSierra ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size) > 0) ca_len++; byte[] ca_sectors = imagePlugin.ReadSectors(ca.block_be, ca_len); byte[] ca_data = new byte[ca.ca_length_be]; @@ -435,8 +426,7 @@ namespace DiscImageChef.Filesystems.ISO9660 if(nextSignature == AppleMagic) { // Can collide with AAIP - if(ca_data[ca_off + 3] == 1 && ca_data[ca_off + 2] == 7) - Apple = true; + if(ca_data[ca_off + 3] == 1 && ca_data[ca_off + 2] == 7) Apple = true; else Apple |= ca_data[ca_off + 3] != 1; } @@ -448,14 +438,15 @@ namespace DiscImageChef.Filesystems.ISO9660 } RRIP |= nextSignature == RRIP_Magic || nextSignature == RRIP_PosixAttributes || - nextSignature == RRIP_PosixDevNo || nextSignature == RRIP_Symlink || - nextSignature == RRIP_Name || nextSignature == RRIP_Childlink || - nextSignature == RRIP_Parentlink || nextSignature == RRIP_RelocatedDir || - nextSignature == RRIP_Timestamps || nextSignature == RRIP_Sparse; + nextSignature == RRIP_PosixDevNo || nextSignature == RRIP_Symlink || + nextSignature == RRIP_Name || nextSignature == RRIP_Childlink || + nextSignature == RRIP_Parentlink || nextSignature == RRIP_RelocatedDir || + nextSignature == RRIP_Timestamps || nextSignature == RRIP_Sparse; ziso |= nextSignature == ziso_Magic; Amiga |= nextSignature == Amiga_Magic; - AAIP |= nextSignature == AAIP_Magic || (nextSignature == AAIP_OldMagic && ca_data[ca_off + 3] == 1 && ca_data[ca_off + 2] >= 9); + AAIP |= nextSignature == AAIP_Magic || + (nextSignature == AAIP_OldMagic && ca_data[ca_off + 3] == 1 && ca_data[ca_off + 2] >= 9); ca_off += ca_data[ca_off + 2]; } @@ -473,7 +464,8 @@ namespace DiscImageChef.Filesystems.ISO9660 ReferenceArea er = BigEndianMarshal.ByteArrayToStructureBigEndian<ReferenceArea>(erb); string ext_id = CurrentEncoding.GetString(erb, Marshal.SizeOf(er), er.id_len); string ext_des = CurrentEncoding.GetString(erb, Marshal.SizeOf(er) + er.id_len, er.des_len); - string ext_src = CurrentEncoding.GetString(erb, Marshal.SizeOf(er) + er.id_len + er.des_len, er.src_len); + string ext_src = + CurrentEncoding.GetString(erb, Marshal.SizeOf(er) + er.id_len + er.des_len, er.src_len); suspInformation.AppendFormat("Extension: {0}", counter).AppendLine(); suspInformation.AppendFormat("\tID: {0}, version {1}", ext_id, er.ext_ver).AppendLine(); suspInformation.AppendFormat("\tDescription: {0}", ext_des).AppendLine(); @@ -488,28 +480,18 @@ namespace DiscImageChef.Filesystems.ISO9660 Decoders.Sega.Dreamcast.IPBin? Dreamcast = Decoders.Sega.Dreamcast.DecodeIPBin(ipbin_sector); string fsFormat; - if(HighSierra) - fsFormat = "High Sierra Format"; - else if (CDi) - fsFormat = "CD-i"; - else - fsFormat = "ISO9660"; - + if(HighSierra) fsFormat = "High Sierra Format"; + else if(CDi) fsFormat = "CD-i"; + else fsFormat = "ISO9660"; + ISOMetadata.AppendFormat("{0} file system", fsFormat).AppendLine(); - if(XA) - ISOMetadata.AppendLine("CD-ROM XA extensions present."); - if(Apple) - ISOMetadata.AppendLine("Apple extensions present."); - if(jolietvd != null) - ISOMetadata.AppendLine("Joliet extensions present."); - if(SUSP) - ISOMetadata.AppendLine("System Use Sharing Protocol present."); - if(RRIP) - ISOMetadata.AppendLine("Rock Ridge Interchange Protocol present."); - if(AAIP) - ISOMetadata.AppendLine("Arbitrary Attribute Interchange Protocol present."); - if(ziso) - ISOMetadata.AppendLine("zisofs compression present."); + if(XA) ISOMetadata.AppendLine("CD-ROM XA extensions present."); + if(Apple) ISOMetadata.AppendLine("Apple extensions present."); + if(jolietvd != null) ISOMetadata.AppendLine("Joliet extensions present."); + if(SUSP) ISOMetadata.AppendLine("System Use Sharing Protocol present."); + if(RRIP) ISOMetadata.AppendLine("Rock Ridge Interchange Protocol present."); + if(AAIP) ISOMetadata.AppendLine("Arbitrary Attribute Interchange Protocol present."); + if(ziso) ISOMetadata.AppendLine("zisofs compression present."); if(bvd != null) ISOMetadata.AppendFormat("Disc bootable following {0} specifications.", BootSpec).AppendLine(); if(SegaCD != null) @@ -539,17 +521,15 @@ namespace DiscImageChef.Filesystems.ISO9660 ISOMetadata.AppendFormat("Volume creation date: {0}", decodedVD.CreationTime).AppendLine(); if(decodedVD.HasModificationTime) ISOMetadata.AppendFormat("Volume modification date: {0}", decodedVD.ModificationTime).AppendLine(); - else - ISOMetadata.AppendFormat("Volume has not been modified.").AppendLine(); + else ISOMetadata.AppendFormat("Volume has not been modified.").AppendLine(); if(decodedVD.HasExpirationTime) ISOMetadata.AppendFormat("Volume expiration date: {0}", decodedVD.ExpirationTime).AppendLine(); - else - ISOMetadata.AppendFormat("Volume does not expire.").AppendLine(); + else ISOMetadata.AppendFormat("Volume does not expire.").AppendLine(); if(decodedVD.HasEffectiveTime) ISOMetadata.AppendFormat("Volume effective date: {0}", decodedVD.EffectiveTime).AppendLine(); - else - ISOMetadata.AppendFormat("Volume has always been effective.").AppendLine(); - ISOMetadata.AppendFormat("Volume has {0} blocks of {1} bytes each", decodedVD.Blocks, decodedVD.BlockSize).AppendLine(); + else ISOMetadata.AppendFormat("Volume has always been effective.").AppendLine(); + ISOMetadata.AppendFormat("Volume has {0} blocks of {1} bytes each", decodedVD.Blocks, decodedVD.BlockSize) + .AppendLine(); if(jolietvd != null) { @@ -558,23 +538,25 @@ namespace DiscImageChef.Filesystems.ISO9660 ISOMetadata.AppendLine("-------------------------------------"); ISOMetadata.AppendFormat("System identifier: {0}", decodedJolietVD.SystemIdentifier).AppendLine(); ISOMetadata.AppendFormat("Volume identifier: {0}", decodedJolietVD.VolumeIdentifier).AppendLine(); - ISOMetadata.AppendFormat("Volume set identifier: {0}", decodedJolietVD.VolumeSetIdentifier).AppendLine(); + ISOMetadata.AppendFormat("Volume set identifier: {0}", decodedJolietVD.VolumeSetIdentifier) + .AppendLine(); ISOMetadata.AppendFormat("Publisher identifier: {0}", decodedJolietVD.PublisherIdentifier).AppendLine(); - ISOMetadata.AppendFormat("Data preparer identifier: {0}", decodedJolietVD.DataPreparerIdentifier).AppendLine(); - ISOMetadata.AppendFormat("Application identifier: {0}", decodedJolietVD.ApplicationIdentifier).AppendLine(); + ISOMetadata.AppendFormat("Data preparer identifier: {0}", decodedJolietVD.DataPreparerIdentifier) + .AppendLine(); + ISOMetadata.AppendFormat("Application identifier: {0}", decodedJolietVD.ApplicationIdentifier) + .AppendLine(); ISOMetadata.AppendFormat("Volume creation date: {0}", decodedJolietVD.CreationTime).AppendLine(); if(decodedJolietVD.HasModificationTime) - ISOMetadata.AppendFormat("Volume modification date: {0}", decodedJolietVD.ModificationTime).AppendLine(); - else - ISOMetadata.AppendFormat("Volume has not been modified.").AppendLine(); + ISOMetadata.AppendFormat("Volume modification date: {0}", decodedJolietVD.ModificationTime) + .AppendLine(); + else ISOMetadata.AppendFormat("Volume has not been modified.").AppendLine(); if(decodedJolietVD.HasExpirationTime) - ISOMetadata.AppendFormat("Volume expiration date: {0}", decodedJolietVD.ExpirationTime).AppendLine(); - else - ISOMetadata.AppendFormat("Volume does not expire.").AppendLine(); + ISOMetadata.AppendFormat("Volume expiration date: {0}", decodedJolietVD.ExpirationTime) + .AppendLine(); + else ISOMetadata.AppendFormat("Volume does not expire.").AppendLine(); if(decodedJolietVD.HasEffectiveTime) ISOMetadata.AppendFormat("Volume effective date: {0}", decodedJolietVD.EffectiveTime).AppendLine(); - else - ISOMetadata.AppendFormat("Volume has always been effective.").AppendLine(); + else ISOMetadata.AppendFormat("Volume has always been effective.").AppendLine(); } if(torito != null) @@ -586,8 +568,7 @@ namespace DiscImageChef.Filesystems.ISO9660 int torito_off = 0; - if(vd_sector[torito_off] != 1) - goto exit_torito; + if(vd_sector[torito_off] != 1) goto exit_torito; ElToritoValidationEntry valentry = new ElToritoValidationEntry(); IntPtr ptr = Marshal.AllocHGlobal(ElToritoEntrySize); @@ -595,8 +576,7 @@ namespace DiscImageChef.Filesystems.ISO9660 valentry = (ElToritoValidationEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoValidationEntry)); Marshal.FreeHGlobal(ptr); - if(valentry.signature != ElToritoMagic) - goto exit_torito; + if(valentry.signature != ElToritoMagic) goto exit_torito; torito_off += ElToritoEntrySize; @@ -607,22 +587,28 @@ namespace DiscImageChef.Filesystems.ISO9660 Marshal.FreeHGlobal(ptr); initial_entry.boot_type = (ElToritoEmulation)((byte)initial_entry.boot_type & 0xF); - boot_image = imagePlugin.ReadSectors(initial_entry.load_rba + partition.Start, initial_entry.sector_count); + boot_image = + imagePlugin.ReadSectors(initial_entry.load_rba + partition.Start, initial_entry.sector_count); ISOMetadata.AppendLine("----------------------"); ISOMetadata.AppendLine("EL TORITO INFORMATION:"); ISOMetadata.AppendLine("----------------------"); ISOMetadata.AppendLine("Initial entry:"); - ISOMetadata.AppendFormat("\tDeveloper ID: {0}", CurrentEncoding.GetString(valentry.developer_id)).AppendLine(); + ISOMetadata.AppendFormat("\tDeveloper ID: {0}", CurrentEncoding.GetString(valentry.developer_id)) + .AppendLine(); if(initial_entry.bootable == ElToritoIndicator.Bootable) { ISOMetadata.AppendFormat("\tBootable on {0}", valentry.platform_id).AppendLine(); - ISOMetadata.AppendFormat("\tBootable image starts at sector {0} and runs for {1} sectors", initial_entry.load_rba, initial_entry.sector_count).AppendLine(); + ISOMetadata.AppendFormat("\tBootable image starts at sector {0} and runs for {1} sectors", + initial_entry.load_rba, initial_entry.sector_count).AppendLine(); if(valentry.platform_id == ElToritoPlatform.x86) - ISOMetadata.AppendFormat("\tBootable image will be loaded at segment {0:X4}h", initial_entry.load_seg == 0 ? 0x7C0 : initial_entry.load_seg).AppendLine(); + ISOMetadata.AppendFormat("\tBootable image will be loaded at segment {0:X4}h", + initial_entry.load_seg == 0 ? 0x7C0 : initial_entry.load_seg) + .AppendLine(); else - ISOMetadata.AppendFormat("\tBootable image will be loaded at 0x{0:X8}", (uint)initial_entry.load_seg * 10).AppendLine(); + ISOMetadata.AppendFormat("\tBootable image will be loaded at 0x{0:X8}", + (uint)initial_entry.load_seg * 10).AppendLine(); switch(initial_entry.boot_type) { case ElToritoEmulation.None: @@ -638,32 +624,38 @@ namespace DiscImageChef.Filesystems.ISO9660 ISOMetadata.AppendLine("\tImage emulates a 3.5\" extra-density (MF2ED, 2.88Mb) floppy"); break; default: - ISOMetadata.AppendFormat("\tImage uses unknown emulation type {0}", (byte)initial_entry.boot_type).AppendLine(); + ISOMetadata.AppendFormat("\tImage uses unknown emulation type {0}", + (byte)initial_entry.boot_type).AppendLine(); break; } + ISOMetadata.AppendFormat("\tSystem type: 0x{0:X2}", initial_entry.system_type).AppendLine(); - ISOMetadata.AppendFormat("\tBootable image's SHA1: {0}", sha1Ctx.Data(boot_image, out byte[] hash)).AppendLine(); + ISOMetadata.AppendFormat("\tBootable image's SHA1: {0}", sha1Ctx.Data(boot_image, out byte[] hash)) + .AppendLine(); } - else - ISOMetadata.AppendLine("\tNot bootable"); + else ISOMetadata.AppendLine("\tNot bootable"); torito_off += ElToritoEntrySize; int section_counter = 2; - while(torito_off < vd_sector.Length && (vd_sector[torito_off] == (byte)ElToritoIndicator.Header || vd_sector[torito_off] == (byte)ElToritoIndicator.LastHeader)) + while(torito_off < vd_sector.Length && (vd_sector[torito_off] == (byte)ElToritoIndicator.Header || + vd_sector[torito_off] == (byte)ElToritoIndicator.LastHeader)) { ElToritoSectionHeaderEntry section_header = new ElToritoSectionHeaderEntry(); ptr = Marshal.AllocHGlobal(ElToritoEntrySize); Marshal.Copy(vd_sector, torito_off, ptr, ElToritoEntrySize); - section_header = (ElToritoSectionHeaderEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoSectionHeaderEntry)); + section_header = + (ElToritoSectionHeaderEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoSectionHeaderEntry)); Marshal.FreeHGlobal(ptr); torito_off += ElToritoEntrySize; ISOMetadata.AppendFormat("Boot section {0}:", section_counter); - ISOMetadata.AppendFormat("\tSection ID: {0}", CurrentEncoding.GetString(section_header.identifier)).AppendLine(); + ISOMetadata.AppendFormat("\tSection ID: {0}", CurrentEncoding.GetString(section_header.identifier)) + .AppendLine(); - for(int entry_counter = 1; entry_counter <= section_header.entries && torito_off < vd_sector.Length; entry_counter++) + for(int entry_counter = 1; entry_counter <= section_header.entries && torito_off < vd_sector.Length; + entry_counter++) { ElToritoSectionEntry section_entry = new ElToritoSectionEntry(); ptr = Marshal.AllocHGlobal(ElToritoEntrySize); @@ -675,44 +667,55 @@ namespace DiscImageChef.Filesystems.ISO9660 ISOMetadata.AppendFormat("\tEntry {0}:", entry_counter); if(section_entry.bootable == ElToritoIndicator.Bootable) { - boot_image = imagePlugin.ReadSectors(section_entry.load_rba + partition.Start, section_entry.sector_count); + boot_image = + imagePlugin.ReadSectors(section_entry.load_rba + partition.Start, + section_entry.sector_count); ISOMetadata.AppendFormat("\t\tBootable on {0}", section_header.platform_id).AppendLine(); - ISOMetadata.AppendFormat("\t\tBootable image starts at sector {0} and runs for {1} sectors", section_entry.load_rba, section_entry.sector_count).AppendLine(); + ISOMetadata.AppendFormat("\t\tBootable image starts at sector {0} and runs for {1} sectors", + section_entry.load_rba, section_entry.sector_count).AppendLine(); if(valentry.platform_id == ElToritoPlatform.x86) - ISOMetadata.AppendFormat("\t\tBootable image will be loaded at segment {0:X4}h", section_entry.load_seg == 0 ? 0x7C0 : section_entry.load_seg).AppendLine(); + ISOMetadata.AppendFormat("\t\tBootable image will be loaded at segment {0:X4}h", + section_entry.load_seg == 0 ? 0x7C0 : section_entry.load_seg) + .AppendLine(); else - ISOMetadata.AppendFormat("\t\tBootable image will be loaded at 0x{0:X8}", (uint)section_entry.load_seg * 10).AppendLine(); + ISOMetadata.AppendFormat("\t\tBootable image will be loaded at 0x{0:X8}", + (uint)section_entry.load_seg * 10).AppendLine(); switch((ElToritoEmulation)((byte)section_entry.boot_type & 0xF)) { case ElToritoEmulation.None: ISOMetadata.AppendLine("\t\tImage uses no emulation"); break; case ElToritoEmulation.Md2hd: - ISOMetadata.AppendLine("\t\tImage emulates a 5.25\" high-density (MD2HD, 1.2Mb) floppy"); + ISOMetadata + .AppendLine("\t\tImage emulates a 5.25\" high-density (MD2HD, 1.2Mb) floppy"); break; case ElToritoEmulation.Mf2hd: - ISOMetadata.AppendLine("\t\tImage emulates a 3.5\" high-density (MF2HD, 1.44Mb) floppy"); + ISOMetadata + .AppendLine("\t\tImage emulates a 3.5\" high-density (MF2HD, 1.44Mb) floppy"); break; case ElToritoEmulation.Mf2ed: - ISOMetadata.AppendLine("\t\tImage emulates a 3.5\" extra-density (MF2ED, 2.88Mb) floppy"); + ISOMetadata + .AppendLine("\t\tImage emulates a 3.5\" extra-density (MF2ED, 2.88Mb) floppy"); break; default: - ISOMetadata.AppendFormat("\t\tImage uses unknown emulation type {0}", (byte)initial_entry.boot_type).AppendLine(); + ISOMetadata.AppendFormat("\t\tImage uses unknown emulation type {0}", + (byte)initial_entry.boot_type).AppendLine(); break; } - ISOMetadata.AppendFormat("\t\tSelection criteria type: {0}", section_entry.selection_criteria_type).AppendLine(); - ISOMetadata.AppendFormat("\t\tSystem type: 0x{0:X2}", section_entry.system_type).AppendLine(); - ISOMetadata.AppendFormat("\t\tBootable image's SHA1: {0}", sha1Ctx.Data(boot_image, out byte[] hash)).AppendLine(); + ISOMetadata.AppendFormat("\t\tSelection criteria type: {0}", + section_entry.selection_criteria_type).AppendLine(); + ISOMetadata.AppendFormat("\t\tSystem type: 0x{0:X2}", section_entry.system_type) + .AppendLine(); + ISOMetadata.AppendFormat("\t\tBootable image's SHA1: {0}", + sha1Ctx.Data(boot_image, out byte[] hash)).AppendLine(); } - else - ISOMetadata.AppendLine("\t\tNot bootable"); + else ISOMetadata.AppendLine("\t\tNot bootable"); ElToritoFlags flags = (ElToritoFlags)((byte)section_entry.boot_type & 0xF0); if(flags.HasFlag(ElToritoFlags.ATAPI)) ISOMetadata.AppendLine("\t\tImage contains ATAPI drivers"); - if(flags.HasFlag(ElToritoFlags.SCSI)) - ISOMetadata.AppendLine("\t\tImage contains SCSI drivers"); + if(flags.HasFlag(ElToritoFlags.SCSI)) ISOMetadata.AppendLine("\t\tImage contains SCSI drivers"); if(flags.HasFlag(ElToritoFlags.Continued)) { @@ -721,24 +724,23 @@ namespace DiscImageChef.Filesystems.ISO9660 ElToritoSectionEntryExtension section_extension = new ElToritoSectionEntryExtension(); ptr = Marshal.AllocHGlobal(ElToritoEntrySize); Marshal.Copy(vd_sector, torito_off, ptr, ElToritoEntrySize); - section_extension = (ElToritoSectionEntryExtension)Marshal.PtrToStructure(ptr, typeof(ElToritoSectionEntryExtension)); + section_extension = + (ElToritoSectionEntryExtension) + Marshal.PtrToStructure(ptr, typeof(ElToritoSectionEntryExtension)); Marshal.FreeHGlobal(ptr); torito_off += ElToritoEntrySize; - if(!section_extension.extension_flags.HasFlag(ElToritoFlags.Continued)) - break; + if(!section_extension.extension_flags.HasFlag(ElToritoFlags.Continued)) break; } } } - if(section_header.header_id == ElToritoIndicator.LastHeader) - break; + if(section_header.header_id == ElToritoIndicator.LastHeader) break; } } - exit_torito: - if(refareas.Count > 0) - ISOMetadata.Append(suspInformation.ToString()); + exit_torito: + if(refareas.Count > 0) ISOMetadata.Append(suspInformation.ToString()); xmlFSType.Type = fsFormat; @@ -746,30 +748,30 @@ namespace DiscImageChef.Filesystems.ISO9660 { xmlFSType.VolumeName = decodedJolietVD.VolumeIdentifier; - if(decodedJolietVD.SystemIdentifier == null || decodedVD.SystemIdentifier.Length > decodedJolietVD.SystemIdentifier.Length) + if(decodedJolietVD.SystemIdentifier == null || + decodedVD.SystemIdentifier.Length > decodedJolietVD.SystemIdentifier.Length) xmlFSType.SystemIdentifier = decodedVD.SystemIdentifier; - else - xmlFSType.SystemIdentifier = decodedJolietVD.SystemIdentifier; + else xmlFSType.SystemIdentifier = decodedJolietVD.SystemIdentifier; - if(decodedJolietVD.VolumeSetIdentifier == null || decodedVD.VolumeSetIdentifier.Length > decodedJolietVD.VolumeSetIdentifier.Length) + if(decodedJolietVD.VolumeSetIdentifier == null || decodedVD.VolumeSetIdentifier.Length > + decodedJolietVD.VolumeSetIdentifier.Length) xmlFSType.VolumeSetIdentifier = decodedVD.VolumeSetIdentifier; - else - xmlFSType.VolumeSetIdentifier = decodedJolietVD.VolumeSetIdentifier; + else xmlFSType.VolumeSetIdentifier = decodedJolietVD.VolumeSetIdentifier; - if(decodedJolietVD.PublisherIdentifier == null || decodedVD.PublisherIdentifier.Length > decodedJolietVD.PublisherIdentifier.Length) + if(decodedJolietVD.PublisherIdentifier == null || decodedVD.PublisherIdentifier.Length > + decodedJolietVD.PublisherIdentifier.Length) xmlFSType.PublisherIdentifier = decodedVD.PublisherIdentifier; - else - xmlFSType.PublisherIdentifier = decodedJolietVD.PublisherIdentifier; + else xmlFSType.PublisherIdentifier = decodedJolietVD.PublisherIdentifier; - if(decodedJolietVD.DataPreparerIdentifier == null || decodedVD.DataPreparerIdentifier.Length > decodedJolietVD.DataPreparerIdentifier.Length) + if(decodedJolietVD.DataPreparerIdentifier == null || decodedVD.DataPreparerIdentifier.Length > + decodedJolietVD.DataPreparerIdentifier.Length) xmlFSType.DataPreparerIdentifier = decodedVD.DataPreparerIdentifier; - else - xmlFSType.DataPreparerIdentifier = decodedJolietVD.SystemIdentifier; + else xmlFSType.DataPreparerIdentifier = decodedJolietVD.SystemIdentifier; - if(decodedJolietVD.ApplicationIdentifier == null || decodedVD.ApplicationIdentifier.Length > decodedJolietVD.ApplicationIdentifier.Length) + if(decodedJolietVD.ApplicationIdentifier == null || decodedVD.ApplicationIdentifier.Length > + decodedJolietVD.ApplicationIdentifier.Length) xmlFSType.ApplicationIdentifier = decodedVD.ApplicationIdentifier; - else - xmlFSType.ApplicationIdentifier = decodedJolietVD.SystemIdentifier; + else xmlFSType.ApplicationIdentifier = decodedJolietVD.SystemIdentifier; xmlFSType.CreationDate = decodedJolietVD.CreationTime; xmlFSType.CreationDateSpecified = true; @@ -823,4 +825,4 @@ namespace DiscImageChef.Filesystems.ISO9660 information = ISOMetadata.ToString(); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs index b8968d3c..bae81c0d 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs @@ -56,4 +56,4 @@ namespace DiscImageChef.Filesystems.ISO9660 public AmigaAttributes Protection; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Apple.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Apple.cs index 3fbde08c..5daac284 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/Apple.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Apple.cs @@ -87,8 +87,7 @@ namespace DiscImageChef.Filesystems.ISO9660 public AppleOldId id; public ushort type; public ushort creator; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] icon; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] icon; } // Big-endian @@ -102,4 +101,4 @@ namespace DiscImageChef.Filesystems.ISO9660 public ushort finder_flags; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/CDi.cs b/DiscImageChef.Filesystems/ISO9660/Structs/CDi.cs index f8ec71ae..5f41c2d6 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/CDi.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/CDi.cs @@ -41,20 +41,15 @@ namespace DiscImageChef.Filesystems.ISO9660 struct FileStructureVolumeDescriptor { public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] id; public byte version; public CdiVolumeFlags flags; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] volume_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] reserved1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] system_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] volume_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] reserved1; public uint volume_space_size; // Only used in SVDs - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] escape_sequences; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] escape_sequences; public ushort reserved2; public ushort volume_set_size; public ushort reserved3; @@ -65,46 +60,29 @@ namespace DiscImageChef.Filesystems.ISO9660 public uint path_table_size; public ulong reserved6; public uint path_table_addr; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 38)] - public byte[] reserved7; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] volume_set_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] publisher_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] preparer_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] application_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] copyright_file_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] reserved8; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] abstract_file_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] reserved9; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] bibliographic_file_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] reserved10; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] creation_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 38)] public byte[] reserved7; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] volume_set_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] publisher_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] preparer_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] application_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] copyright_file_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] reserved8; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] abstract_file_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] reserved9; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] bibliographic_file_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] reserved10; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] creation_date; public byte reserved11; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] modification_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] modification_date; public byte reserved12; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] expiration_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] expiration_date; public byte reserved13; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] effective_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] effective_date; public byte reserved14; public byte file_structure_version; public byte reserved15; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] - public byte[] application_data; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 653)] - public byte[] reserved16; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] application_data; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 653)] public byte[] reserved16; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -116,8 +94,7 @@ namespace DiscImageChef.Filesystems.ISO9660 public uint start_lbn; public uint reserved2; public uint size; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] date; public byte reserved3; public CdiFileFlags flags; public ushort file_unit_size; @@ -142,16 +119,16 @@ namespace DiscImageChef.Filesystems.ISO9660 { DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); - decodedVD.SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim(new[] { '\0' }); + decodedVD.SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.ApplicationIdentifier = + Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim(new[] {'\0'}); if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) decodedVD.CreationTime = System.DateTime.MinValue; - else - decodedVD.CreationTime = DateHandlers.HighSierraToDateTime(pvd.creation_date); + else decodedVD.CreationTime = DateHandlers.HighSierraToDateTime(pvd.creation_date); if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) { @@ -163,20 +140,14 @@ namespace DiscImageChef.Filesystems.ISO9660 decodedVD.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date); } - if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) - { - decodedVD.HasExpirationTime = false; - } + if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) { decodedVD.HasExpirationTime = false; } else { decodedVD.HasExpirationTime = true; decodedVD.ExpirationTime = DateHandlers.HighSierraToDateTime(pvd.expiration_date); } - if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) - { - decodedVD.HasEffectiveTime = false; - } + if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) { decodedVD.HasEffectiveTime = false; } else { decodedVD.HasEffectiveTime = true; @@ -189,4 +160,4 @@ namespace DiscImageChef.Filesystems.ISO9660 return decodedVD; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Common.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Common.cs index 43231802..2ad041cb 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/Common.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Common.cs @@ -55,4 +55,4 @@ namespace DiscImageChef.Filesystems.ISO9660 public uint Blocks; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/ElTorito.cs b/DiscImageChef.Filesystems/ISO9660/Structs/ElTorito.cs index 13f56ec7..93029ccc 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/ElTorito.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/ElTorito.cs @@ -40,16 +40,12 @@ namespace DiscImageChef.Filesystems.ISO9660 struct ElToritoBootRecord { public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] id; public byte version; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] boot_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] system_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] boot_id; public uint catalog_sector; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1974)] - public byte[] boot_use; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1974)] public byte[] boot_use; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -58,8 +54,7 @@ namespace DiscImageChef.Filesystems.ISO9660 public ElToritoIndicator header_id; public ElToritoPlatform platform_id; public ushort reserved; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] - public byte[] developer_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] developer_id; public ushort checksum; public ushort signature; } @@ -74,8 +69,7 @@ namespace DiscImageChef.Filesystems.ISO9660 public byte reserved1; public ushort sector_count; public uint load_rba; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] reserved2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] reserved2; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -84,8 +78,7 @@ namespace DiscImageChef.Filesystems.ISO9660 public ElToritoIndicator header_id; public ElToritoPlatform platform_id; public ushort entries; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] - public byte[] identifier; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] public byte[] identifier; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -99,8 +92,7 @@ namespace DiscImageChef.Filesystems.ISO9660 public ushort sector_count; public uint load_rba; public byte selection_criteria_type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] - public byte[] selection_criterias; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] public byte[] selection_criterias; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -108,8 +100,7 @@ namespace DiscImageChef.Filesystems.ISO9660 { public ElToritoIndicator extension_indicator; public ElToritoFlags extension_flags; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 30)] - public byte[] selection_criterias; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 30)] public byte[] selection_criterias; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/HighSierra.cs b/DiscImageChef.Filesystems/ISO9660/Structs/HighSierra.cs index 4588191f..7502deee 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/HighSierra.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/HighSierra.cs @@ -43,20 +43,16 @@ namespace DiscImageChef.Filesystems.ISO9660 public uint volume_lbn; public uint volume_lbn_be; public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] id; public byte version; // Only used in SVDs public byte flags; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] volume_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] system_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] volume_id; public ulong reserved1; public uint volume_space_size; public uint volume_space_size_be; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] escape_sequences; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] escape_sequences; public ushort volume_set_size; public ushort volume_set_size_be; public ushort volume_sequence_number; @@ -75,32 +71,20 @@ namespace DiscImageChef.Filesystems.ISO9660 public uint opt_path_table_msb_3; public HighSierraDirectoryRecord root_directory_record; public byte root_directory_name; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] volume_set_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] publisher_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] preparer_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] application_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] copyright_file_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] abstract_file_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] creation_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] modification_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] expiration_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] effective_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] volume_set_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] publisher_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] preparer_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] application_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] copyright_file_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] abstract_file_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] creation_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] modification_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] expiration_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] effective_date; public byte file_structure_version; public byte reserved2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] - public byte[] application_data; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 680)] - public byte[] reserved3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] application_data; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 680)] public byte[] reserved3; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -112,8 +96,7 @@ namespace DiscImageChef.Filesystems.ISO9660 public uint extent_be; public uint size; public uint size_be; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] date; public FileFlags flags; public byte reserved; public byte interleave_size; @@ -128,16 +111,16 @@ namespace DiscImageChef.Filesystems.ISO9660 { DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); - decodedVD.SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim(new[] { '\0' }); + decodedVD.SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.ApplicationIdentifier = + Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim(new[] {'\0'}); if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) decodedVD.CreationTime = System.DateTime.MinValue; - else - decodedVD.CreationTime = DateHandlers.HighSierraToDateTime(pvd.creation_date); + else decodedVD.CreationTime = DateHandlers.HighSierraToDateTime(pvd.creation_date); if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) { @@ -149,20 +132,14 @@ namespace DiscImageChef.Filesystems.ISO9660 decodedVD.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date); } - if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) - { - decodedVD.HasExpirationTime = false; - } + if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) { decodedVD.HasExpirationTime = false; } else { decodedVD.HasExpirationTime = true; decodedVD.ExpirationTime = DateHandlers.HighSierraToDateTime(pvd.expiration_date); } - if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) - { - decodedVD.HasEffectiveTime = false; - } + if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) { decodedVD.HasEffectiveTime = false; } else { decodedVD.HasEffectiveTime = true; @@ -175,4 +152,4 @@ namespace DiscImageChef.Filesystems.ISO9660 return decodedVD; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/ISO.cs b/DiscImageChef.Filesystems/ISO9660/Structs/ISO.cs index 890805a8..0c469634 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/ISO.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/ISO.cs @@ -41,21 +41,17 @@ namespace DiscImageChef.Filesystems.ISO9660 struct PrimaryVolumeDescriptor { public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] id; public byte version; // Only used in SVDs public byte flags; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] volume_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] system_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] volume_id; public ulong reserved1; public uint volume_space_size; public uint volume_space_size_be; // Only used in SVDs - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] escape_sequences; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] escape_sequences; public ushort volume_set_size; public ushort volume_set_size_be; public ushort volume_sequence_number; @@ -70,69 +66,48 @@ namespace DiscImageChef.Filesystems.ISO9660 public uint opt_type_m_path_table; public DirectoryRecord root_directory_record; public byte root_directory_name; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] volume_set_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] publisher_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] preparer_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] application_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)] - public byte[] copyright_file_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)] - public byte[] abstract_file_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)] - public byte[] bibliographic_file_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] creation_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] modification_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] expiration_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] effective_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] volume_set_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] publisher_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] preparer_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] application_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)] public byte[] copyright_file_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)] public byte[] abstract_file_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)] public byte[] bibliographic_file_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] public byte[] creation_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] public byte[] modification_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] public byte[] expiration_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] public byte[] effective_date; public byte file_structure_version; public byte reserved2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] - public byte[] application_data; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 653)] - public byte[] reserved3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] application_data; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 653)] public byte[] reserved3; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct BootRecord { public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] id; public byte version; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] boot_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1977)] - public byte[] boot_use; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] system_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] boot_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1977)] public byte[] boot_use; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PartitionDescriptor { public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] id; public byte version; public byte reserved1; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] partition_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] system_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] partition_id; public uint partition_location; public uint partition_location_be; public uint partition_size; public uint partition_size_be; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1960)] - public byte[] system_use; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1960)] public byte[] system_use; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -144,8 +119,7 @@ namespace DiscImageChef.Filesystems.ISO9660 public uint extent_be; public uint size; public uint size_be; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] - public byte[] date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public byte[] date; public FileFlags flags; public byte file_unit_size; public byte interleave; @@ -163,26 +137,19 @@ namespace DiscImageChef.Filesystems.ISO9660 public ushort group; public ushort group_be; public Permissions permissions; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] creation_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] modification_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] expiration_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] effective_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] public byte[] creation_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] public byte[] modification_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] public byte[] expiration_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] public byte[] effective_date; public RecordFormat record_format; public RecordAttribute record_attributes; public ushort record_length; public ushort record_length_be; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_use; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] system_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] system_use; public byte record_version; public byte escape_len; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] reserved1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] reserved1; public ushort app_use_len; public ushort app_use_len_be; } @@ -202,16 +169,16 @@ namespace DiscImageChef.Filesystems.ISO9660 { DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); - decodedVD.SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim(new[] { '\0' }); + decodedVD.SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim(new[] {'\0'}); + decodedVD.ApplicationIdentifier = + Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim(new[] {'\0'}); if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) decodedVD.CreationTime = System.DateTime.MinValue; - else - decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(pvd.creation_date); + else decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(pvd.creation_date); if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) { @@ -223,20 +190,14 @@ namespace DiscImageChef.Filesystems.ISO9660 decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(pvd.modification_date); } - if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) - { - decodedVD.HasExpirationTime = false; - } + if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) { decodedVD.HasExpirationTime = false; } else { decodedVD.HasExpirationTime = true; decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(pvd.expiration_date); } - if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) - { - decodedVD.HasEffectiveTime = false; - } + if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) { decodedVD.HasEffectiveTime = false; } else { decodedVD.HasEffectiveTime = true; @@ -249,4 +210,4 @@ namespace DiscImageChef.Filesystems.ISO9660 return decodedVD; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Joliet.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Joliet.cs index 57c88ad9..8eacb4af 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/Joliet.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Joliet.cs @@ -40,16 +40,21 @@ namespace DiscImageChef.Filesystems.ISO9660 { DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); - decodedVD.SystemIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.system_id).TrimEnd().Trim(new[] { '\u0000' }); - decodedVD.VolumeIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_id).TrimEnd().Trim(new[] { '\u0000' }); - decodedVD.VolumeSetIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_set_id).TrimEnd().Trim(new[] { '\u0000' }); - decodedVD.PublisherIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.publisher_id).TrimEnd().Trim(new[] { '\u0000' }); - decodedVD.DataPreparerIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.preparer_id).TrimEnd().Trim(new[] { '\u0000' }); - decodedVD.ApplicationIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.application_id).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.SystemIdentifier = + Encoding.BigEndianUnicode.GetString(jolietvd.system_id).TrimEnd().Trim(new[] {'\u0000'}); + decodedVD.VolumeIdentifier = + Encoding.BigEndianUnicode.GetString(jolietvd.volume_id).TrimEnd().Trim(new[] {'\u0000'}); + decodedVD.VolumeSetIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_set_id).TrimEnd() + .Trim(new[] {'\u0000'}); + decodedVD.PublisherIdentifier = + Encoding.BigEndianUnicode.GetString(jolietvd.publisher_id).TrimEnd().Trim(new[] {'\u0000'}); + decodedVD.DataPreparerIdentifier = + Encoding.BigEndianUnicode.GetString(jolietvd.preparer_id).TrimEnd().Trim(new[] {'\u0000'}); + decodedVD.ApplicationIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.application_id).TrimEnd() + .Trim(new[] {'\u0000'}); if(jolietvd.creation_date[0] < 0x31 || jolietvd.creation_date[0] > 0x39) decodedVD.CreationTime = System.DateTime.MinValue; - else - decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(jolietvd.creation_date); + else decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(jolietvd.creation_date); if(jolietvd.modification_date[0] < 0x31 || jolietvd.modification_date[0] > 0x39) { @@ -87,4 +92,4 @@ namespace DiscImageChef.Filesystems.ISO9660 return decodedVD; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/RRIP.cs b/DiscImageChef.Filesystems/ISO9660/Structs/RRIP.cs index 0a8a0852..5470439b 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/RRIP.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/RRIP.cs @@ -152,4 +152,4 @@ namespace DiscImageChef.Filesystems.ISO9660 public byte table_depth; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/SUSP.cs b/DiscImageChef.Filesystems/ISO9660/Structs/SUSP.cs index 3d275502..b0c2e7f4 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/SUSP.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/SUSP.cs @@ -100,4 +100,4 @@ namespace DiscImageChef.Filesystems.ISO9660 public byte sequence; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/XA.cs b/DiscImageChef.Filesystems/ISO9660/Structs/XA.cs index 6eeefe0b..3a3e4b06 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/XA.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/XA.cs @@ -45,8 +45,7 @@ namespace DiscImageChef.Filesystems.ISO9660 public XaAttributes attributes; public ushort signature; public byte filenumber; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] reserved; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Ziso.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Ziso.cs index 97485eb7..c66e5718 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/Ziso.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Ziso.cs @@ -59,4 +59,4 @@ namespace DiscImageChef.Filesystems.ISO9660 public uint uncomp_len_be; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Super.cs b/DiscImageChef.Filesystems/ISO9660/Super.cs index bf283ca9..e1d62117 100644 --- a/DiscImageChef.Filesystems/ISO9660/Super.cs +++ b/DiscImageChef.Filesystems/ISO9660/Super.cs @@ -54,4 +54,4 @@ namespace DiscImageChef.Filesystems.ISO9660 return Errno.NotImplemented; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Xattr.cs b/DiscImageChef.Filesystems/ISO9660/Xattr.cs index f2d88e35..6d3c05e7 100644 --- a/DiscImageChef.Filesystems/ISO9660/Xattr.cs +++ b/DiscImageChef.Filesystems/ISO9660/Xattr.cs @@ -46,4 +46,4 @@ namespace DiscImageChef.Filesystems.ISO9660 return Errno.NotImplemented; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/JFS.cs b/DiscImageChef.Filesystems/JFS.cs index 32dbe338..23f2c868 100644 --- a/DiscImageChef.Filesystems/JFS.cs +++ b/DiscImageChef.Filesystems/JFS.cs @@ -43,29 +43,29 @@ namespace DiscImageChef.Filesystems [Flags] enum JFS_Flags : uint { - Unicode = 0x00000001, - RemountRO = 0x00000002, - Continue = 0x00000004, - Panic = 0x00000008, - UserQuota = 0x00000010, - GroupQuota = 0x00000020, - NoJournal = 0x00000040, - Discard = 0x00000080, - GroupCommit = 0x00000100, - LazyCommit = 0x00000200, - Temporary = 0x00000400, - InlineLog = 0x00000800, + Unicode = 0x00000001, + RemountRO = 0x00000002, + Continue = 0x00000004, + Panic = 0x00000008, + UserQuota = 0x00000010, + GroupQuota = 0x00000020, + NoJournal = 0x00000040, + Discard = 0x00000080, + GroupCommit = 0x00000100, + LazyCommit = 0x00000200, + Temporary = 0x00000400, + InlineLog = 0x00000800, InlineMoving = 0x00001000, - BadSAIT = 0x00010000, - Sparse = 0x00020000, - DASDEnabled = 0x00040000, - DASDPrime = 0x00080000, - SwapBytes = 0x00100000, - DirIndex = 0x00200000, - Linux = 0x10000000, - DFS = 0x20000000, - OS2 = 0x40000000, - AIX = 0x80000000 + BadSAIT = 0x00010000, + Sparse = 0x00020000, + DASDEnabled = 0x00040000, + DASDPrime = 0x00080000, + SwapBytes = 0x00100000, + DirIndex = 0x00200000, + Linux = 0x10000000, + DFS = 0x20000000, + OS2 = 0x40000000, + AIX = 0x80000000 } [Flags] @@ -120,14 +120,12 @@ namespace DiscImageChef.Filesystems public JFS_TimeStruct s_time; public uint s_fsckloglen; public sbyte s_fscklog; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] s_fpack; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] s_fpack; public ulong s_xsize; public JFS_Extent s_xfsckpxd; public JFS_Extent s_xlogpxd; public Guid s_uuid; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] s_label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] s_label; public Guid s_loguuid; } @@ -145,31 +143,25 @@ namespace DiscImageChef.Filesystems { Name = "JFS Plugin"; PluginUUID = new Guid("D3BE2A41-8F28-4055-94DC-BB6C72A0E9C4"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public JFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "JFS Plugin"; PluginUUID = new Guid("D3BE2A41-8F28-4055-94DC-BB6C72A0E9C4"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { uint bootSectors = JFS_BootBlocksSize / imagePlugin.GetSectorSize(); - if(partition.Start + bootSectors >= partition.End) - return false; - + if(partition.Start + bootSectors >= partition.End) return false; + byte[] sector = imagePlugin.ReadSector(partition.Start + bootSectors); - if(sector.Length < 512) - return false; + if(sector.Length < 512) return false; JFS_SuperBlock jfsSb = new JFS_SuperBlock(); IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(jfsSb)); @@ -180,14 +172,14 @@ namespace DiscImageChef.Filesystems return jfsSb.s_magic == JFS_Magic; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; StringBuilder sb = new StringBuilder(); uint bootSectors = JFS_BootBlocksSize / imagePlugin.GetSectorSize(); byte[] sector = imagePlugin.ReadSector(partition.Start + bootSectors); - if(sector.Length < 512) - return; + if(sector.Length < 512) return; JFS_SuperBlock jfsSb = new JFS_SuperBlock(); IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(jfsSb)); @@ -200,59 +192,38 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} blocks of {1} bytes", jfsSb.s_size, jfsSb.s_bsize).AppendLine(); sb.AppendFormat("{0} blocks per allocation group", jfsSb.s_agsize).AppendLine(); - if(jfsSb.s_flags.HasFlag(JFS_Flags.Unicode)) - sb.AppendLine("Volume uses Unicode for directory entries"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.RemountRO)) - sb.AppendLine("Volume remounts read-only on error"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.Continue)) - sb.AppendLine("Volume continues on error"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.Panic)) - sb.AppendLine("Volume panics on error"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.UserQuota)) - sb.AppendLine("Volume has user quotas enabled"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.GroupQuota)) - sb.AppendLine("Volume has group quotas enabled"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.NoJournal)) - sb.AppendLine("Volume is not using any journal"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.Unicode)) sb.AppendLine("Volume uses Unicode for directory entries"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.RemountRO)) sb.AppendLine("Volume remounts read-only on error"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.Continue)) sb.AppendLine("Volume continues on error"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.Panic)) sb.AppendLine("Volume panics on error"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.UserQuota)) sb.AppendLine("Volume has user quotas enabled"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.GroupQuota)) sb.AppendLine("Volume has group quotas enabled"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.NoJournal)) sb.AppendLine("Volume is not using any journal"); if(jfsSb.s_flags.HasFlag(JFS_Flags.Discard)) sb.AppendLine("Volume sends TRIM/UNMAP commands to underlying device"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.GroupCommit)) - sb.AppendLine("Volume commits in groups of 1"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.LazyCommit)) - sb.AppendLine("Volume commits lazy"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.Temporary)) - sb.AppendLine("Volume does not commit to log"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.InlineLog)) - sb.AppendLine("Volume has log withing itself"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.GroupCommit)) sb.AppendLine("Volume commits in groups of 1"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.LazyCommit)) sb.AppendLine("Volume commits lazy"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.Temporary)) sb.AppendLine("Volume does not commit to log"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.InlineLog)) sb.AppendLine("Volume has log withing itself"); if(jfsSb.s_flags.HasFlag(JFS_Flags.InlineMoving)) sb.AppendLine("Volume has log withing itself and is moving it out"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.BadSAIT)) - sb.AppendLine("Volume has bad current secondary ait"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.Sparse)) - sb.AppendLine("Volume supports sparse files"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.DASDEnabled)) - sb.AppendLine("Volume has DASD limits enabled"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.DASDPrime)) - sb.AppendLine("Volume primes DASD on boot"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.SwapBytes)) - sb.AppendLine("Volume is in a big-endian system"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.DirIndex)) - sb.AppendLine("Volume has presistent indexes"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.Linux)) - sb.AppendLine("Volume supports Linux"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.DFS)) - sb.AppendLine("Volume supports DCE DFS LFS"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.OS2)) - sb.AppendLine("Volume supports OS/2, and is case insensitive"); - if(jfsSb.s_flags.HasFlag(JFS_Flags.AIX)) - sb.AppendLine("Volume supports AIX"); - if(jfsSb.s_state != 0) - sb.AppendLine("Volume is dirty"); - sb.AppendFormat("Volume was last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec)).AppendLine(); + if(jfsSb.s_flags.HasFlag(JFS_Flags.BadSAIT)) sb.AppendLine("Volume has bad current secondary ait"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.Sparse)) sb.AppendLine("Volume supports sparse files"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.DASDEnabled)) sb.AppendLine("Volume has DASD limits enabled"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.DASDPrime)) sb.AppendLine("Volume primes DASD on boot"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.SwapBytes)) sb.AppendLine("Volume is in a big-endian system"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.DirIndex)) sb.AppendLine("Volume has presistent indexes"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.Linux)) sb.AppendLine("Volume supports Linux"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.DFS)) sb.AppendLine("Volume supports DCE DFS LFS"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.OS2)) sb.AppendLine("Volume supports OS/2, and is case insensitive"); + if(jfsSb.s_flags.HasFlag(JFS_Flags.AIX)) sb.AppendLine("Volume supports AIX"); + if(jfsSb.s_state != 0) sb.AppendLine("Volume is dirty"); + sb.AppendFormat("Volume was last updated on {0}", + DateHandlers.UNIXUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec)) + .AppendLine(); if(jfsSb.s_version == 1) sb.AppendFormat("Volume name: {0}", CurrentEncoding.GetString(jfsSb.s_fpack)).AppendLine(); - else - sb.AppendFormat("Volume name: {0}", CurrentEncoding.GetString(jfsSb.s_label)).AppendLine(); + else sb.AppendFormat("Volume name: {0}", CurrentEncoding.GetString(jfsSb.s_label)).AppendLine(); sb.AppendFormat("Volume UUID: {0}", jfsSb.s_uuid).AppendLine(); xmlFSType = new Schemas.FileSystemType(); @@ -260,15 +231,12 @@ namespace DiscImageChef.Filesystems xmlFSType.Clusters = (long)jfsSb.s_size; xmlFSType.ClusterSize = (int)jfsSb.s_bsize; xmlFSType.Bootable = true; - if(jfsSb.s_version == 1) - xmlFSType.VolumeName = CurrentEncoding.GetString(jfsSb.s_fpack); - else - xmlFSType.VolumeName = CurrentEncoding.GetString(jfsSb.s_label); + if(jfsSb.s_version == 1) xmlFSType.VolumeName = CurrentEncoding.GetString(jfsSb.s_fpack); + else xmlFSType.VolumeName = CurrentEncoding.GetString(jfsSb.s_label); xmlFSType.VolumeSerial = string.Format("{0}", jfsSb.s_uuid); xmlFSType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec); xmlFSType.ModificationDateSpecified = true; - if(jfsSb.s_state != 0) - xmlFSType.Dirty = true; + if(jfsSb.s_state != 0) xmlFSType.Dirty = true; information = sb.ToString(); return; diff --git a/DiscImageChef.Filesystems/LIF.cs b/DiscImageChef.Filesystems/LIF.cs index b8d7dd89..a34468a8 100644 --- a/DiscImageChef.Filesystems/LIF.cs +++ b/DiscImageChef.Filesystems/LIF.cs @@ -46,8 +46,7 @@ namespace DiscImageChef.Filesystems struct LIF_SystemBlock { public ushort magic; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] volumeLabel; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] volumeLabel; public uint directoryStart; public ushort lifId; public ushort unused; @@ -57,8 +56,7 @@ namespace DiscImageChef.Filesystems public uint tracks; public uint heads; public uint sectors; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] creationDate; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] creationDate; } const uint LIF_Magic = 0x8000; @@ -74,26 +72,21 @@ namespace DiscImageChef.Filesystems { Name = "HP Logical Interchange Format Plugin"; PluginUUID = new Guid("41535647-77A5-477B-9206-DA727ACDC704"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public LIF(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "HP Logical Interchange Format Plugin"; PluginUUID = new Guid("41535647-77A5-477B-9206-DA727ACDC704"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.GetSectorSize() < 256) - return false; + if(imagePlugin.GetSectorSize() < 256) return false; LIF_SystemBlock LIFSb = new LIF_SystemBlock(); @@ -104,20 +97,19 @@ namespace DiscImageChef.Filesystems return LIFSb.magic == LIF_Magic; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < 256) - return; + if(imagePlugin.GetSectorSize() < 256) return; LIF_SystemBlock LIFSb = new LIF_SystemBlock(); byte[] sector = imagePlugin.ReadSector(partition.Start); LIFSb = BigEndianMarshal.ByteArrayToStructureBigEndian<LIF_SystemBlock>(sector); - if(LIFSb.magic != LIF_Magic) - return; + if(LIFSb.magic != LIF_Magic) return; StringBuilder sb = new StringBuilder(); @@ -130,7 +122,8 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} tracks", LIFSb.tracks).AppendLine(); sb.AppendFormat("{0} heads", LIFSb.heads).AppendLine(); sb.AppendFormat("{0} sectors", LIFSb.sectors).AppendLine(); - sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(LIFSb.volumeLabel, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(LIFSb.volumeLabel, CurrentEncoding)) + .AppendLine(); sb.AppendFormat("Volume created on {0}", DateHandlers.LifToDateTime(LIFSb.creationDate)).AppendLine(); information = sb.ToString(); diff --git a/DiscImageChef.Filesystems/LisaFS/Consts.cs b/DiscImageChef.Filesystems/LisaFS/Consts.cs index 79cab222..20b72987 100644 --- a/DiscImageChef.Filesystems/LisaFS/Consts.cs +++ b/DiscImageChef.Filesystems/LisaFS/Consts.cs @@ -160,5 +160,4 @@ namespace DiscImageChef.Filesystems.LisaFS KilledObject = 15 } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/LisaFS/Dir.cs b/DiscImageChef.Filesystems/LisaFS/Dir.cs index 46998108..37096a4b 100644 --- a/DiscImageChef.Filesystems/LisaFS/Dir.cs +++ b/DiscImageChef.Filesystems/LisaFS/Dir.cs @@ -60,11 +60,9 @@ namespace DiscImageChef.Filesystems.LisaFS short fileId; bool isDir; Errno error = LookupFileId(path, out fileId, out isDir); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; - if(!isDir) - return Errno.NotDirectory; + if(!isDir) return Errno.NotDirectory; /*List<CatalogEntry> catalog; error = ReadCatalog(fileId, out catalog); @@ -108,8 +106,7 @@ namespace DiscImageChef.Filesystems.LisaFS /// </summary> Errno ReadCatalog() { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; catalogCache = new List<CatalogEntry>(); @@ -186,8 +183,7 @@ namespace DiscImageChef.Filesystems.LisaFS } // Catalog not found - if(firstCatalogBlock == null) - return Errno.NoSuchFile; + if(firstCatalogBlock == null) return Errno.NoSuchFile; ulong prevCatalogPointer; prevCatalogPointer = BigEndianBitConverter.ToUInt32(firstCatalogBlock, 0x7F6); @@ -196,10 +192,10 @@ namespace DiscImageChef.Filesystems.LisaFS while(prevCatalogPointer != 0xFFFFFFFF) { LisaTag.PriamTag prevTag; - DecodeTag(device.ReadSectorTag(prevCatalogPointer + mddf.mddf_block + volumePrefix, SectorTagType.AppleSectorTag), out prevTag); + DecodeTag(device.ReadSectorTag(prevCatalogPointer + mddf.mddf_block + volumePrefix, SectorTagType.AppleSectorTag), + out prevTag); - if(prevTag.fileID != FILEID_CATALOG) - return Errno.InvalidArgument; + if(prevTag.fileID != FILEID_CATALOG) return Errno.InvalidArgument; firstCatalogBlock = device.ReadSectors(prevCatalogPointer + mddf.mddf_block + volumePrefix, 4); prevCatalogPointer = BigEndianBitConverter.ToUInt32(firstCatalogBlock, 0x7F6); @@ -215,10 +211,10 @@ namespace DiscImageChef.Filesystems.LisaFS while(nextCatalogPointer != 0xFFFFFFFF) { LisaTag.PriamTag nextTag; - DecodeTag(device.ReadSectorTag(nextCatalogPointer + mddf.mddf_block + volumePrefix, SectorTagType.AppleSectorTag), out nextTag); + DecodeTag(device.ReadSectorTag(nextCatalogPointer + mddf.mddf_block + volumePrefix, SectorTagType.AppleSectorTag), + out nextTag); - if(nextTag.fileID != FILEID_CATALOG) - return Errno.InvalidArgument; + if(nextTag.fileID != FILEID_CATALOG) return Errno.InvalidArgument; byte[] nextCatalogBlock = device.ReadSectors(nextCatalogPointer + mddf.mddf_block + volumePrefix, 4); nextCatalogPointer = BigEndianBitConverter.ToUInt32(nextCatalogBlock, 0x7FA); @@ -234,14 +230,11 @@ namespace DiscImageChef.Filesystems.LisaFS while((offset + 64) <= buf.Length) { // Catalog block header - if(buf[offset + 0x24] == 0x08) - offset += 78; + if(buf[offset + 0x24] == 0x08) offset += 78; // Maybe just garbage? Found in more than 1 disk - else if(buf[offset + 0x24] == 0x7C) - offset += 50; + else if(buf[offset + 0x24] == 0x7C) offset += 50; // Apparently reserved to indicate end of catalog? - else if(buf[offset + 0x24] == 0xFF) - break; + else if(buf[offset + 0x24] == 0xFF) break; // Normal entry else if(buf[offset + 0x24] == 0x03 && buf[offset] == 0x24) { @@ -298,8 +291,7 @@ namespace DiscImageChef.Filesystems.LisaFS offset += 48; } - else - break; + else break; } } @@ -310,8 +302,7 @@ namespace DiscImageChef.Filesystems.LisaFS { stat = null; - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; stat = new FileEntryInfo(); stat.Attributes = new FileAttributes(); diff --git a/DiscImageChef.Filesystems/LisaFS/Extent.cs b/DiscImageChef.Filesystems/LisaFS/Extent.cs index 960638b6..1b249009 100644 --- a/DiscImageChef.Filesystems/LisaFS/Extent.cs +++ b/DiscImageChef.Filesystems/LisaFS/Extent.cs @@ -55,24 +55,20 @@ namespace DiscImageChef.Filesystems.LisaFS { file = new ExtentFile(); - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; if(fileId < 4 || (fileId == 4 && (mddf.fsversion != LisaFSv2 && mddf.fsversion != LisaFSv1))) return Errno.InvalidArgument; - if(extentCache.TryGetValue(fileId, out file)) - return Errno.NoError; + if(extentCache.TryGetValue(fileId, out file)) return Errno.NoError; // A file ID that cannot be stored in the S-Records File - if(fileId >= srecords.Length) - return Errno.InvalidArgument; + if(fileId >= srecords.Length) return Errno.InvalidArgument; ulong ptr = srecords[fileId].extent_ptr; // An invalid pointer denotes file does not exist - if(ptr == 0xFFFFFFFF || ptr == 0x00000000) - return Errno.NoSuchFile; + if(ptr == 0xFFFFFFFF || ptr == 0x00000000) return Errno.NoSuchFile; // Pointers are relative to MDDF ptr += mddf.mddf_block + volumePrefix; @@ -96,8 +92,7 @@ namespace DiscImageChef.Filesystems.LisaFS } } - if(!found) - return Errno.InvalidArgument; + if(!found) return Errno.InvalidArgument; } // Checks that the sector tag indicates its the Extents File we are searching for @@ -107,13 +102,10 @@ namespace DiscImageChef.Filesystems.LisaFS { byte[] sector; - if(mddf.fsversion == LisaFSv1) - sector = device.ReadSectors(ptr, 2); - else - sector = device.ReadSector(ptr); + if(mddf.fsversion == LisaFSv1) sector = device.ReadSectors(ptr, 2); + else sector = device.ReadSector(ptr); - if(sector[0] >= 32 || sector[0] == 0) - return Errno.InvalidArgument; + if(sector[0] >= 32 || sector[0] == 0) return Errno.InvalidArgument; file.filenameLen = sector[0]; file.filename = new byte[file.filenameLen]; @@ -174,8 +166,7 @@ namespace DiscImageChef.Filesystems.LisaFS for(int j = 0; j < 41; j++) { - if(BigEndianBitConverter.ToInt16(sector, extentsOffset + j * 6 + 4) == 0) - break; + if(BigEndianBitConverter.ToInt16(sector, extentsOffset + j * 6 + 4) == 0) break; extentsCount++; } @@ -195,54 +186,85 @@ namespace DiscImageChef.Filesystems.LisaFS { if(!printedExtents.Contains(fileId)) { - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filenameLen = {1}", fileId, file.filenameLen); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filename = {1}", fileId, StringHandlers.CToString(file.filename, CurrentEncoding)); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown1 = 0x{1:X4}", fileId, file.unknown1); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].file_uid = 0x{1:X16}", fileId, file.file_uid); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown2 = 0x{1:X2}", fileId, file.unknown2); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].etype = 0x{1:X2}", fileId, file.etype); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filenameLen = {1}", fileId, + file.filenameLen); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filename = {1}", fileId, + StringHandlers.CToString(file.filename, CurrentEncoding)); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown1 = 0x{1:X4}", fileId, + file.unknown1); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].file_uid = 0x{1:X16}", fileId, + file.file_uid); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown2 = 0x{1:X2}", fileId, + file.unknown2); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].etype = 0x{1:X2}", fileId, + file.etype); DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].ftype = {1}", fileId, file.ftype); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown3 = 0x{1:X2}", fileId, file.unknown3); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown3 = 0x{1:X2}", fileId, + file.unknown3); DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dtc = {1}", fileId, file.dtc); DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dta = {1}", fileId, file.dta); DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dtm = {1}", fileId, file.dtm); DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dtb = {1}", fileId, file.dtb); DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dts = {1}", fileId, file.dts); DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].serial = {1}", fileId, file.serial); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown4 = 0x{1:X2}", fileId, file.unknown4); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].locked = {1}", fileId, file.locked > 0); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].protect = {1}", fileId, file.protect > 0); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].master = {1}", fileId, file.master > 0); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].scavenged = {1}", fileId, file.scavenged > 0); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].closed = {1}", fileId, file.closed > 0); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown4 = 0x{1:X2}", fileId, + file.unknown4); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].locked = {1}", fileId, + file.locked > 0); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].protect = {1}", fileId, + file.protect > 0); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].master = {1}", fileId, + file.master > 0); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].scavenged = {1}", fileId, + file.scavenged > 0); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].closed = {1}", fileId, + file.closed > 0); DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].open = {1}", fileId, file.open > 0); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown5 = 0x{1:X2}{2:X2}{3:X2}{4:X2}{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}" + - "{10:X2}{11:X2}", fileId, file.unknown5[0], file.unknown5[1], file.unknown5[2], file.unknown5[3], - file.unknown5[4], file.unknown5[5], file.unknown5[6], file.unknown5[7], file.unknown5[8], file.unknown5[9], - file.unknown5[10]); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].release = {1}", fileId, file.release); + DicConsole.DebugWriteLine("LisaFS plugin", + "ExtentFile[{0}].unknown5 = 0x{1:X2}{2:X2}{3:X2}{4:X2}{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}" + + "{10:X2}{11:X2}", fileId, file.unknown5[0], file.unknown5[1], + file.unknown5[2], file.unknown5[3], file.unknown5[4], + file.unknown5[5], file.unknown5[6], file.unknown5[7], + file.unknown5[8], file.unknown5[9], file.unknown5[10]); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].release = {1}", fileId, + file.release); DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].build = {1}", fileId, file.build); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].compatibility = {1}", fileId, file.compatibility); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].revision = {1}", fileId, file.revision); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown6 = 0x{1:X4}", fileId, file.unknown6); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].password_valid = {1}", fileId, file.password_valid > 0); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].password = {1}", fileId, CurrentEncoding.GetString(file.password)); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown7 = 0x{1:X2}{2:X2}{3:X2}", fileId, file.unknown7[0], - file.unknown7[1], file.unknown7[2]); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].overhead = {1}", fileId, file.overhead); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown8 = 0x{1:X2}{2:X2}{3:X2}{4:X2}{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}" + - "{10:X2}{11:X2}{12:X2}{13:X2}{14:X2}{15:X2}{16:X2}", fileId, file.unknown8[0], file.unknown8[1], file.unknown8[2], - file.unknown8[3], file.unknown8[4], file.unknown8[5], file.unknown8[6], file.unknown8[7], file.unknown8[8], - file.unknown8[9], file.unknown8[10], file.unknown8[11], file.unknown8[12], file.unknown8[13], file.unknown8[14], + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].compatibility = {1}", fileId, + file.compatibility); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].revision = {1}", fileId, + file.revision); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown6 = 0x{1:X4}", fileId, + file.unknown6); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].password_valid = {1}", fileId, + file.password_valid > 0); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].password = {1}", fileId, + CurrentEncoding.GetString(file.password)); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown7 = 0x{1:X2}{2:X2}{3:X2}", + fileId, file.unknown7[0], file.unknown7[1], file.unknown7[2]); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].overhead = {1}", fileId, + file.overhead); + DicConsole.DebugWriteLine("LisaFS plugin", + "ExtentFile[{0}].unknown8 = 0x{1:X2}{2:X2}{3:X2}{4:X2}{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}" + + "{10:X2}{11:X2}{12:X2}{13:X2}{14:X2}{15:X2}{16:X2}", fileId, + file.unknown8[0], file.unknown8[1], file.unknown8[2], + file.unknown8[3], file.unknown8[4], file.unknown8[5], + file.unknown8[6], file.unknown8[7], file.unknown8[8], + file.unknown8[9], file.unknown8[10], file.unknown8[11], + file.unknown8[12], file.unknown8[13], file.unknown8[14], file.unknown8[15]); DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].length = {1}", fileId, file.length); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown9 = 0x{1:X8}", fileId, file.unknown9); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown9 = 0x{1:X8}", fileId, + file.unknown9); for(int ext = 0; ext < file.extents.Length; ext++) { - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].extents[{1}].start = {2}", fileId, ext, file.extents[ext].start); - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].extents[{1}].length = {2}", fileId, ext, file.extents[ext].length); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].extents[{1}].start = {2}", + fileId, ext, file.extents[ext].start); + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].extents[{1}].length = {2}", + fileId, ext, file.extents[ext].length); } - DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown10 = 0x{1:X4}", fileId, file.unknown10); + + DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown10 = 0x{1:X4}", fileId, + file.unknown10); printedExtents.Add(fileId); } @@ -259,8 +281,7 @@ namespace DiscImageChef.Filesystems.LisaFS /// </summary> Errno ReadSRecords() { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; // Searches the S-Records place using MDDF pointers byte[] sectors = device.ReadSectors(mddf.srec_ptr + mddf.mddf_block + volumePrefix, mddf.srec_len); @@ -280,5 +301,4 @@ namespace DiscImageChef.Filesystems.LisaFS return Errno.NoError; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/LisaFS/File.cs b/DiscImageChef.Filesystems/LisaFS/File.cs index e6e1706d..18068c21 100644 --- a/DiscImageChef.Filesystems/LisaFS/File.cs +++ b/DiscImageChef.Filesystems/LisaFS/File.cs @@ -44,11 +44,9 @@ namespace DiscImageChef.Filesystems.LisaFS short fileId; bool isDir; Errno error = LookupFileId(path, out fileId, out isDir); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; - if(!isDir) - return GetAttributes(fileId, ref attributes); + if(!isDir) return GetAttributes(fileId, ref attributes); attributes = new FileAttributes(); attributes = FileAttributes.Directory; @@ -64,14 +62,12 @@ namespace DiscImageChef.Filesystems.LisaFS return Errno.NoError; } - if(offset < 0) - return Errno.InvalidArgument; + if(offset < 0) return Errno.InvalidArgument; short fileId; bool isDir; Errno error = LookupFileId(path, out fileId, out isDir); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; byte[] tmp; if(debug) @@ -91,17 +87,13 @@ namespace DiscImageChef.Filesystems.LisaFS break; } } - else - error = ReadFile(fileId, out tmp); + else error = ReadFile(fileId, out tmp); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; - if(offset >= tmp.Length) - return Errno.EINVAL; + if(offset >= tmp.Length) return Errno.EINVAL; - if(size + offset >= tmp.Length) - size = tmp.Length - offset; + if(size + offset >= tmp.Length) size = tmp.Length - offset; buf = new byte[size]; Array.Copy(tmp, offset, buf, 0, size); @@ -113,21 +105,18 @@ namespace DiscImageChef.Filesystems.LisaFS short fileId; bool isDir; Errno error = LookupFileId(path, out fileId, out isDir); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; return isDir ? StatDir(fileId, out stat) : Stat(fileId, out stat); } Errno GetAttributes(short fileId, ref FileAttributes attributes) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; if(fileId < 4) { - if(!debug) - return Errno.NoSuchFile; + if(!debug) return Errno.NoSuchFile; attributes = new FileAttributes(); attributes = FileAttributes.System; @@ -141,8 +130,7 @@ namespace DiscImageChef.Filesystems.LisaFS ExtentFile extFile; Errno error = ReadExtentsFile(fileId, out extFile); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; attributes = new FileAttributes(); @@ -158,20 +146,16 @@ namespace DiscImageChef.Filesystems.LisaFS case FileType.Pipe: attributes |= FileAttributes.Pipe; break; - case FileType.Undefined: - break; + case FileType.Undefined: break; default: attributes |= FileAttributes.File; attributes |= FileAttributes.Extents; break; } - if(extFile.protect > 0) - attributes |= FileAttributes.Immutable; - if(extFile.locked > 0) - attributes |= FileAttributes.ReadOnly; - if(extFile.password_valid > 0) - attributes |= FileAttributes.Password; + if(extFile.protect > 0) attributes |= FileAttributes.Immutable; + if(extFile.locked > 0) attributes |= FileAttributes.ReadOnly; + if(extFile.password_valid > 0) attributes |= FileAttributes.Password; return Errno.NoError; } @@ -184,17 +168,14 @@ namespace DiscImageChef.Filesystems.LisaFS Errno ReadSystemFile(short fileId, out byte[] buf, bool tags) { buf = null; - if(!mounted || !debug) - return Errno.AccessDenied; + if(!mounted || !debug) return Errno.AccessDenied; if(fileId > 4 || fileId <= 0) { - if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) - return Errno.InvalidArgument; + if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) return Errno.InvalidArgument; } - if(systemFileCache.TryGetValue(fileId, out buf) && !tags) - return Errno.NoError; + if(systemFileCache.TryGetValue(fileId, out buf) && !tags) return Errno.NoError; int count = 0; @@ -208,7 +189,8 @@ namespace DiscImageChef.Filesystems.LisaFS } else { - buf = device.ReadSectorsTag(mddf.mddf_block + volumePrefix + mddf.srec_ptr, mddf.srec_len, SectorTagType.AppleSectorTag); + buf = device.ReadSectorsTag(mddf.mddf_block + volumePrefix + mddf.srec_ptr, mddf.srec_len, + SectorTagType.AppleSectorTag); return Errno.NoError; } } @@ -220,17 +202,13 @@ namespace DiscImageChef.Filesystems.LisaFS { DecodeTag(device.ReadSectorTag(i, SectorTagType.AppleSectorTag), out sysTag); - if(sysTag.fileID == fileId) - count++; + if(sysTag.fileID == fileId) count++; } - if(count == 0) - return Errno.NoSuchFile; + if(count == 0) return Errno.NoSuchFile; - if(!tags) - buf = new byte[count * device.GetSectorSize()]; - else - buf = new byte[count * devTagSize]; + if(!tags) buf = new byte[count * device.GetSectorSize()]; + else buf = new byte[count * devTagSize]; // Should be enough to check 100 sectors? for(ulong i = 0; i < 100; i++) @@ -241,21 +219,17 @@ namespace DiscImageChef.Filesystems.LisaFS { byte[] sector; - if(!tags) - sector = device.ReadSector(i); - else - sector = device.ReadSectorTag(i, SectorTagType.AppleSectorTag); + if(!tags) sector = device.ReadSector(i); + else sector = device.ReadSectorTag(i, SectorTagType.AppleSectorTag); // Relative block for $Loader starts at $Boot block - if(sysTag.fileID == FILEID_LOADER_SIGNED) - sysTag.relPage--; + if(sysTag.fileID == FILEID_LOADER_SIGNED) sysTag.relPage--; Array.Copy(sector, 0, buf, sector.Length * sysTag.relPage, sector.Length); } } - if(!tags) - systemFileCache.Add(fileId, buf); + if(!tags) systemFileCache.Add(fileId, buf); return Errno.NoError; } @@ -264,30 +238,26 @@ namespace DiscImageChef.Filesystems.LisaFS { stat = null; - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; Errno error; ExtentFile file; if(fileId <= 4) { - if(!debug || fileId == 0) - return Errno.NoSuchFile; + if(!debug || fileId == 0) return Errno.NoSuchFile; else { stat = new FileEntryInfo(); stat.Attributes = new FileAttributes(); error = GetAttributes(fileId, ref stat.Attributes); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; if(fileId < 0 && fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) { error = ReadExtentsFile((short)(fileId * -1), out file); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; stat.CreationTime = DateHandlers.LisaToDateTime(file.dtc); stat.AccessTime = DateHandlers.LisaToDateTime(file.dta); @@ -308,13 +278,10 @@ namespace DiscImageChef.Filesystems.LisaFS { byte[] buf; error = ReadSystemFile(fileId, out buf); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; - if(fileId != 4) - stat.CreationTime = mddf.dtvc; - else - stat.CreationTime = mddf.dtcc; + if(fileId != 4) stat.CreationTime = mddf.dtvc; + else stat.CreationTime = mddf.dtcc; stat.BackupTime = mddf.dtvb; @@ -361,10 +328,8 @@ namespace DiscImageChef.Filesystems.LisaFS stat.GID = 0; stat.DeviceNo = 0; int len; - if(!fileSizeCache.TryGetValue(fileId, out len)) - stat.Length = srecords[fileId].filesize; - else - stat.Length = len; + if(!fileSizeCache.TryGetValue(fileId, out len)) stat.Length = srecords[fileId].filesize; + else stat.Length = len; stat.BlockSize = mddf.datasize; stat.Blocks = file.length; @@ -379,29 +344,24 @@ namespace DiscImageChef.Filesystems.LisaFS Errno ReadFile(short fileId, out byte[] buf, bool tags) { buf = null; - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; tags &= debug; if(fileId < 4 || (fileId == 4 && (mddf.fsversion != LisaFSv2 && mddf.fsversion != LisaFSv1))) return Errno.InvalidArgument; - if(!tags && fileCache.TryGetValue(fileId, out buf)) - return Errno.NoError; + if(!tags && fileCache.TryGetValue(fileId, out buf)) return Errno.NoError; Errno error; ExtentFile file; error = ReadExtentsFile(fileId, out file); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; int sectorSize; - if(tags) - sectorSize = devTagSize; - else - sectorSize = (int)device.GetSectorSize(); + if(tags) sectorSize = devTagSize; + else sectorSize = (int)device.GetSectorSize(); byte[] temp = new byte[file.length * sectorSize]; @@ -411,9 +371,11 @@ namespace DiscImageChef.Filesystems.LisaFS byte[] sector; if(!tags) - sector = device.ReadSectors(((ulong)file.extents[i].start + mddf.mddf_block + volumePrefix), (uint)file.extents[i].length); + sector = device.ReadSectors(((ulong)file.extents[i].start + mddf.mddf_block + volumePrefix), + (uint)file.extents[i].length); else - sector = device.ReadSectorsTag(((ulong)file.extents[i].start + mddf.mddf_block + volumePrefix), (uint)file.extents[i].length, SectorTagType.AppleSectorTag); + sector = device.ReadSectorsTag(((ulong)file.extents[i].start + mddf.mddf_block + volumePrefix), + (uint)file.extents[i].length, SectorTagType.AppleSectorTag); Array.Copy(sector, 0, temp, offset, sector.Length); offset += sector.Length; @@ -424,15 +386,13 @@ namespace DiscImageChef.Filesystems.LisaFS int realSize; if(fileSizeCache.TryGetValue(fileId, out realSize)) { - if(realSize > temp.Length) - DicConsole.ErrorWriteLine("File {0} gets truncated.", fileId); + if(realSize > temp.Length) DicConsole.ErrorWriteLine("File {0} gets truncated.", fileId); } buf = temp; fileCache.Add(fileId, buf); } - else - buf = temp; + else buf = temp; return Errno.NoError; } @@ -442,10 +402,9 @@ namespace DiscImageChef.Filesystems.LisaFS fileId = 0; isDir = false; - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length == 0) { @@ -455,8 +414,7 @@ namespace DiscImageChef.Filesystems.LisaFS } // Only V3 supports subdirectories - if(pathElements.Length > 1 && mddf.fsversion != LisaFSv3) - return Errno.NotSupported; + if(pathElements.Length > 1 && mddf.fsversion != LisaFSv3) return Errno.NotSupported; if(debug && pathElements.Length == 1) { @@ -507,19 +465,17 @@ namespace DiscImageChef.Filesystems.LisaFS string filename = StringHandlers.CToString(entry.filename, CurrentEncoding); // LisaOS is case insensitive - if(string.Compare(wantedFilename, filename, StringComparison.InvariantCultureIgnoreCase) == 0 - && entry.parentID == fileId) + if(string.Compare(wantedFilename, filename, StringComparison.InvariantCultureIgnoreCase) == 0 && + entry.parentID == fileId) { fileId = entry.fileID; isDir = entry.fileType == 0x01; // Not last path element, and it's not a directory - if(lvl != pathElements.Length - 1 && !isDir) - return Errno.NotDirectory; + if(lvl != pathElements.Length - 1 && !isDir) return Errno.NotDirectory; // Arrived last path element - if(lvl == pathElements.Length - 1) - return Errno.NoError; + if(lvl == pathElements.Length - 1) return Errno.NoError; } } } @@ -527,5 +483,4 @@ namespace DiscImageChef.Filesystems.LisaFS return Errno.NoSuchFile; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/LisaFS/Info.cs b/DiscImageChef.Filesystems/LisaFS/Info.cs index 69e9586f..baba40e2 100644 --- a/DiscImageChef.Filesystems/LisaFS/Info.cs +++ b/DiscImageChef.Filesystems/LisaFS/Info.cs @@ -45,18 +45,15 @@ namespace DiscImageChef.Filesystems.LisaFS { try { - if(imagePlugin.ImageInfo.readableSectorTags == null) - return false; + if(imagePlugin.ImageInfo.readableSectorTags == null) return false; - if(!imagePlugin.ImageInfo.readableSectorTags.Contains(SectorTagType.AppleSectorTag)) - return false; + if(!imagePlugin.ImageInfo.readableSectorTags.Contains(SectorTagType.AppleSectorTag)) return false; // LisaOS is big-endian BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; // Minimal LisaOS disk is 3.5" single sided double density, 800 sectors - if(imagePlugin.GetSectors() < 800) - return false; + if(imagePlugin.GetSectors() < 800) return false; int before_mddf = -1; @@ -68,8 +65,7 @@ namespace DiscImageChef.Filesystems.LisaFS DicConsole.DebugWriteLine("LisaFS plugin", "Sector {0}, file ID 0x{1:X4}", i, searchTag.fileID); - if(before_mddf == -1 && searchTag.fileID == FILEID_LOADER_SIGNED) - before_mddf = i - 1; + if(before_mddf == -1 && searchTag.fileID == FILEID_LOADER_SIGNED) before_mddf = i - 1; if(searchTag.fileID == FILEID_MDDF) { @@ -87,32 +83,29 @@ namespace DiscImageChef.Filesystems.LisaFS DicConsole.DebugWriteLine("LisaFS plugin", "mddf.mddf_block = {0}", info_mddf.mddf_block); DicConsole.DebugWriteLine("LisaFS plugin", "Disk size = {0} sectors", imagePlugin.GetSectors()); DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size = {0} sectors", info_mddf.vol_size); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - 1 = {0}", info_mddf.volsize_minus_one); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - mddf.mddf_block -1 = {0}", info_mddf.volsize_minus_mddf_minus_one); - DicConsole.DebugWriteLine("LisaFS plugin", "Disk sector = {0} bytes", imagePlugin.GetSectorSize()); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - 1 = {0}", + info_mddf.volsize_minus_one); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - mddf.mddf_block -1 = {0}", + info_mddf.volsize_minus_mddf_minus_one); + DicConsole.DebugWriteLine("LisaFS plugin", "Disk sector = {0} bytes", + imagePlugin.GetSectorSize()); DicConsole.DebugWriteLine("LisaFS plugin", "mddf.blocksize = {0} bytes", info_mddf.blocksize); DicConsole.DebugWriteLine("LisaFS plugin", "mddf.datasize = {0} bytes", info_mddf.datasize); - if(info_mddf.mddf_block != i - before_mddf) - return false; + if(info_mddf.mddf_block != i - before_mddf) return false; - if(info_mddf.vol_size > imagePlugin.GetSectors()) - return false; + if(info_mddf.vol_size > imagePlugin.GetSectors()) return false; - if(info_mddf.vol_size - 1 != info_mddf.volsize_minus_one) - return false; + if(info_mddf.vol_size - 1 != info_mddf.volsize_minus_one) return false; if(info_mddf.vol_size - i - 1 != info_mddf.volsize_minus_mddf_minus_one - before_mddf) return false; - if(info_mddf.datasize > info_mddf.blocksize) - return false; + if(info_mddf.datasize > info_mddf.blocksize) return false; - if(info_mddf.blocksize < imagePlugin.GetSectorSize()) - return false; + if(info_mddf.blocksize < imagePlugin.GetSectorSize()) return false; - if(info_mddf.datasize != imagePlugin.GetSectorSize()) - return false; + if(info_mddf.datasize != imagePlugin.GetSectorSize()) return false; return true; } @@ -134,18 +127,15 @@ namespace DiscImageChef.Filesystems.LisaFS try { - if(imagePlugin.ImageInfo.readableSectorTags == null) - return; + if(imagePlugin.ImageInfo.readableSectorTags == null) return; - if(!imagePlugin.ImageInfo.readableSectorTags.Contains(SectorTagType.AppleSectorTag)) - return; + if(!imagePlugin.ImageInfo.readableSectorTags.Contains(SectorTagType.AppleSectorTag)) return; // LisaOS is big-endian BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; // Minimal LisaOS disk is 3.5" single sided double density, 800 sectors - if(imagePlugin.GetSectors() < 800) - return; + if(imagePlugin.GetSectors() < 800) return; int before_mddf = -1; @@ -157,8 +147,7 @@ namespace DiscImageChef.Filesystems.LisaFS DicConsole.DebugWriteLine("LisaFS plugin", "Sector {0}, file ID 0x{1:X4}", i, searchTag.fileID); - if(before_mddf == -1 && searchTag.fileID == FILEID_LOADER_SIGNED) - before_mddf = i - 1; + if(before_mddf == -1 && searchTag.fileID == FILEID_LOADER_SIGNED) before_mddf = i - 1; if(searchTag.fileID == FILEID_MDDF) { @@ -177,8 +166,7 @@ namespace DiscImageChef.Filesystems.LisaFS // Prevent garbage if(pString[0] <= 32) info_mddf.password = StringHandlers.PascalToString(pString, CurrentEncoding); - else - info_mddf.password = ""; + else info_mddf.password = ""; info_mddf.unknown2 = sector[0x4F]; info_mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50); info_mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54); @@ -249,65 +237,97 @@ namespace DiscImageChef.Filesystems.LisaFS info_mddf.vol_sequence = BigEndianBitConverter.ToUInt16(sector, 0x136); info_mddf.vol_left_mounted = sector[0x138]; - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown1 = 0x{0:X2} ({0})", info_mddf.unknown1); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown2 = 0x{0:X2} ({0})", info_mddf.unknown2); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown3 = 0x{0:X8} ({0})", info_mddf.unknown3); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown4 = 0x{0:X4} ({0})", info_mddf.unknown4); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown5 = 0x{0:X8} ({0})", info_mddf.unknown5); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown6 = 0x{0:X8} ({0})", info_mddf.unknown6); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown7 = 0x{0:X8} ({0})", info_mddf.unknown7); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown9 = 0x{0:X4} ({0})", info_mddf.unknown9); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown10 = 0x{0:X8} ({0})", info_mddf.unknown10); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown11 = 0x{0:X8} ({0})", info_mddf.unknown11); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown12 = 0x{0:X8} ({0})", info_mddf.unknown12); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown13 = 0x{0:X8} ({0})", info_mddf.unknown13); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown14 = 0x{0:X8} ({0})", info_mddf.unknown14); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown15 = 0x{0:X8} ({0})", info_mddf.unknown15); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown16 = 0x{0:X8} ({0})", info_mddf.unknown16); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown17 = 0x{0:X4} ({0})", info_mddf.unknown17); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown18 = 0x{0:X8} ({0})", info_mddf.unknown18); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown19 = 0x{0:X8} ({0})", info_mddf.unknown19); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown20 = 0x{0:X8} ({0})", info_mddf.unknown20); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown21 = 0x{0:X8} ({0})", info_mddf.unknown21); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown22 = 0x{0:X8} ({0})", info_mddf.unknown22); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown23 = 0x{0:X8} ({0})", info_mddf.unknown23); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown24 = 0x{0:X8} ({0})", info_mddf.unknown24); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown25 = 0x{0:X8} ({0})", info_mddf.unknown25); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown26 = 0x{0:X8} ({0})", info_mddf.unknown26); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown27 = 0x{0:X8} ({0})", info_mddf.unknown27); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown28 = 0x{0:X8} ({0})", info_mddf.unknown28); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown29 = 0x{0:X8} ({0})", info_mddf.unknown29); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown30 = 0x{0:X8} ({0})", info_mddf.unknown30); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown31 = 0x{0:X8} ({0})", info_mddf.unknown31); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown32 = 0x{0:X8} ({0})", info_mddf.unknown32); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown33 = 0x{0:X8} ({0})", info_mddf.unknown33); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown34 = 0x{0:X8} ({0})", info_mddf.unknown34); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown35 = 0x{0:X8} ({0})", info_mddf.unknown35); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown36 = 0x{0:X8} ({0})", info_mddf.unknown36); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown37 = 0x{0:X8} ({0})", info_mddf.unknown37); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown38 = 0x{0:X8} ({0})", info_mddf.unknown38); - DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown_timestamp = 0x{0:X8} ({0}, {1})", info_mddf.unknown_timestamp, DateHandlers.LisaToDateTime(info_mddf.unknown_timestamp)); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown1 = 0x{0:X2} ({0})", + info_mddf.unknown1); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown2 = 0x{0:X2} ({0})", + info_mddf.unknown2); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown3 = 0x{0:X8} ({0})", + info_mddf.unknown3); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown4 = 0x{0:X4} ({0})", + info_mddf.unknown4); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown5 = 0x{0:X8} ({0})", + info_mddf.unknown5); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown6 = 0x{0:X8} ({0})", + info_mddf.unknown6); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown7 = 0x{0:X8} ({0})", + info_mddf.unknown7); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown9 = 0x{0:X4} ({0})", + info_mddf.unknown9); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown10 = 0x{0:X8} ({0})", + info_mddf.unknown10); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown11 = 0x{0:X8} ({0})", + info_mddf.unknown11); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown12 = 0x{0:X8} ({0})", + info_mddf.unknown12); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown13 = 0x{0:X8} ({0})", + info_mddf.unknown13); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown14 = 0x{0:X8} ({0})", + info_mddf.unknown14); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown15 = 0x{0:X8} ({0})", + info_mddf.unknown15); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown16 = 0x{0:X8} ({0})", + info_mddf.unknown16); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown17 = 0x{0:X4} ({0})", + info_mddf.unknown17); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown18 = 0x{0:X8} ({0})", + info_mddf.unknown18); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown19 = 0x{0:X8} ({0})", + info_mddf.unknown19); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown20 = 0x{0:X8} ({0})", + info_mddf.unknown20); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown21 = 0x{0:X8} ({0})", + info_mddf.unknown21); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown22 = 0x{0:X8} ({0})", + info_mddf.unknown22); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown23 = 0x{0:X8} ({0})", + info_mddf.unknown23); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown24 = 0x{0:X8} ({0})", + info_mddf.unknown24); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown25 = 0x{0:X8} ({0})", + info_mddf.unknown25); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown26 = 0x{0:X8} ({0})", + info_mddf.unknown26); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown27 = 0x{0:X8} ({0})", + info_mddf.unknown27); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown28 = 0x{0:X8} ({0})", + info_mddf.unknown28); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown29 = 0x{0:X8} ({0})", + info_mddf.unknown29); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown30 = 0x{0:X8} ({0})", + info_mddf.unknown30); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown31 = 0x{0:X8} ({0})", + info_mddf.unknown31); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown32 = 0x{0:X8} ({0})", + info_mddf.unknown32); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown33 = 0x{0:X8} ({0})", + info_mddf.unknown33); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown34 = 0x{0:X8} ({0})", + info_mddf.unknown34); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown35 = 0x{0:X8} ({0})", + info_mddf.unknown35); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown36 = 0x{0:X8} ({0})", + info_mddf.unknown36); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown37 = 0x{0:X8} ({0})", + info_mddf.unknown37); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown38 = 0x{0:X8} ({0})", + info_mddf.unknown38); + DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown_timestamp = 0x{0:X8} ({0}, {1})", + info_mddf.unknown_timestamp, + DateHandlers.LisaToDateTime(info_mddf.unknown_timestamp)); - if(info_mddf.mddf_block != i - before_mddf) - return; + if(info_mddf.mddf_block != i - before_mddf) return; - if(info_mddf.vol_size > imagePlugin.GetSectors()) - return; + if(info_mddf.vol_size > imagePlugin.GetSectors()) return; - if(info_mddf.vol_size - 1 != info_mddf.volsize_minus_one) - return; + if(info_mddf.vol_size - 1 != info_mddf.volsize_minus_one) return; - if(info_mddf.vol_size - i - 1 != info_mddf.volsize_minus_mddf_minus_one - before_mddf) - return; + if(info_mddf.vol_size - i - 1 != info_mddf.volsize_minus_mddf_minus_one - before_mddf) return; - if(info_mddf.datasize > info_mddf.blocksize) - return; + if(info_mddf.datasize > info_mddf.blocksize) return; - if(info_mddf.blocksize < imagePlugin.GetSectorSize()) - return; + if(info_mddf.blocksize < imagePlugin.GetSectorSize()) return; - if(info_mddf.datasize != imagePlugin.GetSectorSize()) - return; + if(info_mddf.datasize != imagePlugin.GetSectorSize()) return; switch(info_mddf.fsversion) { @@ -332,10 +352,13 @@ namespace DiscImageChef.Filesystems.LisaFS sb.AppendFormat("Master copy ID: 0x{0:X8}", info_mddf.master_copy_id).AppendLine(); - sb.AppendFormat("Volume is number {0} of {1}", info_mddf.volnum, info_mddf.vol_sequence).AppendLine(); + sb.AppendFormat("Volume is number {0} of {1}", info_mddf.volnum, info_mddf.vol_sequence) + .AppendLine(); - sb.AppendFormat("Serial number of Lisa computer that created this volume: {0}", info_mddf.machine_id).AppendLine(); - sb.AppendFormat("Serial number of Lisa computer that can use this volume's software {0}", info_mddf.serialization).AppendLine(); + sb.AppendFormat("Serial number of Lisa computer that created this volume: {0}", + info_mddf.machine_id).AppendLine(); + sb.AppendFormat("Serial number of Lisa computer that can use this volume's software {0}", + info_mddf.serialization).AppendLine(); sb.AppendFormat("Volume created on {0}", info_mddf.dtvc).AppendLine(); sb.AppendFormat("Some timestamp, says {0}", info_mddf.dtcc).AppendLine(); @@ -344,7 +367,8 @@ namespace DiscImageChef.Filesystems.LisaFS sb.AppendFormat("MDDF is in block {0}", info_mddf.mddf_block + before_mddf).AppendLine(); sb.AppendFormat("There are {0} reserved blocks before volume", before_mddf).AppendLine(); sb.AppendFormat("{0} blocks minus one", info_mddf.volsize_minus_one).AppendLine(); - sb.AppendFormat("{0} blocks minus one minus MDDF offset", info_mddf.volsize_minus_mddf_minus_one).AppendLine(); + sb.AppendFormat("{0} blocks minus one minus MDDF offset", + info_mddf.volsize_minus_mddf_minus_one).AppendLine(); sb.AppendFormat("{0} blocks in volume", info_mddf.vol_size).AppendLine(); sb.AppendFormat("{0} bytes per sector (uncooked)", info_mddf.blocksize).AppendLine(); sb.AppendFormat("{0} bytes per sector", info_mddf.datasize).AppendLine(); @@ -358,12 +382,12 @@ namespace DiscImageChef.Filesystems.LisaFS sb.AppendFormat("Boot code: 0x{0:X8}", info_mddf.boot_code).AppendLine(); sb.AppendFormat("Boot environment: 0x{0:X8}", info_mddf.boot_environ).AppendLine(); sb.AppendFormat("Overmount stamp: 0x{0:X16}", info_mddf.overmount_stamp).AppendLine(); - sb.AppendFormat("S-Records start at {0} and spans for {1} blocks", info_mddf.srec_ptr + info_mddf.mddf_block + before_mddf, info_mddf.srec_len).AppendLine(); + sb.AppendFormat("S-Records start at {0} and spans for {1} blocks", + info_mddf.srec_ptr + info_mddf.mddf_block + before_mddf, info_mddf.srec_len) + .AppendLine(); - if(info_mddf.vol_left_mounted == 0) - sb.AppendLine("Volume is clean"); - else - sb.AppendLine("Volume is dirty"); + if(info_mddf.vol_left_mounted == 0) sb.AppendLine("Volume is clean"); + else sb.AppendLine("Volume is dirty"); information = sb.ToString(); @@ -402,5 +426,4 @@ namespace DiscImageChef.Filesystems.LisaFS } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/LisaFS/LisaFS.cs b/DiscImageChef.Filesystems/LisaFS/LisaFS.cs index 88e09c67..852f6fe5 100644 --- a/DiscImageChef.Filesystems/LisaFS/LisaFS.cs +++ b/DiscImageChef.Filesystems/LisaFS/LisaFS.cs @@ -90,4 +90,4 @@ namespace DiscImageChef.Filesystems.LisaFS CurrentEncoding = new Claunia.Encoding.LisaRoman(); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/LisaFS/Structs.cs b/DiscImageChef.Filesystems/LisaFS/Structs.cs index b90583cd..1c59ccd2 100644 --- a/DiscImageChef.Filesystems/LisaFS/Structs.cs +++ b/DiscImageChef.Filesystems/LisaFS/Structs.cs @@ -371,7 +371,6 @@ namespace DiscImageChef.Filesystems.LisaFS public ushort flags; } - /// <summary> /// The catalog entry for the V1 and V2 volume formats. /// It merely contains the file name, type and ID, plus a few (mostly empty) unknown fields. @@ -399,5 +398,4 @@ namespace DiscImageChef.Filesystems.LisaFS public byte[] unknown3; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/LisaFS/Super.cs b/DiscImageChef.Filesystems/LisaFS/Super.cs index 3400c4ac..dcf363e9 100644 --- a/DiscImageChef.Filesystems/LisaFS/Super.cs +++ b/DiscImageChef.Filesystems/LisaFS/Super.cs @@ -106,10 +106,8 @@ namespace DiscImageChef.Filesystems.LisaFS mddf.unknown1 = sector[0x2D]; Array.Copy(sector, 0x2E, pString, 0, 33); // Prevent garbage - if(pString[0] <= 32) - mddf.password = StringHandlers.PascalToString(pString, CurrentEncoding); - else - mddf.password = ""; + if(pString[0] <= 32) mddf.password = StringHandlers.PascalToString(pString, CurrentEncoding); + else mddf.password = ""; mddf.unknown2 = sector[0x4F]; mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50); mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54); @@ -181,13 +179,11 @@ namespace DiscImageChef.Filesystems.LisaFS mddf.vol_left_mounted = sector[0x138]; // Check that the MDDF is correct - if(mddf.mddf_block != i - volumePrefix || - mddf.vol_size > device.GetSectors() || - mddf.vol_size - 1 != mddf.volsize_minus_one || - mddf.vol_size - i - 1 != mddf.volsize_minus_mddf_minus_one - volumePrefix || - mddf.datasize > mddf.blocksize || - mddf.blocksize < device.GetSectorSize() || - mddf.datasize != device.GetSectorSize()) + if(mddf.mddf_block != i - volumePrefix || mddf.vol_size > device.GetSectors() || + mddf.vol_size - 1 != mddf.volsize_minus_one || + mddf.vol_size - i - 1 != mddf.volsize_minus_mddf_minus_one - volumePrefix || + mddf.datasize > mddf.blocksize || mddf.blocksize < device.GetSectorSize() || + mddf.datasize != device.GetSectorSize()) { DicConsole.DebugWriteLine("LisaFS plugin", "Incorrect MDDF found"); return Errno.InvalidArgument; @@ -222,10 +218,7 @@ namespace DiscImageChef.Filesystems.LisaFS mounted = true; this.debug = debug; - if(debug) - { - printedExtents = new List<short>(); - } + if(debug) { printedExtents = new List<short>(); } // Read the S-Records file error = ReadSRecords(); @@ -243,7 +236,8 @@ namespace DiscImageChef.Filesystems.LisaFS if(error != Errno.NoError) { - DicConsole.DebugWriteLine("LisaFS plugin", "Cannot read Catalog File, error {0}", error.ToString()); + DicConsole.DebugWriteLine("LisaFS plugin", "Cannot read Catalog File, error {0}", + error.ToString()); mounted = false; return error; } @@ -357,8 +351,7 @@ namespace DiscImageChef.Filesystems.LisaFS /// <param name="stat">Information about the mounted volume.</param> public override Errno StatFs(ref FileSystemInfo stat) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; stat = new FileSystemInfo(); stat.Blocks = mddf.vol_size; @@ -385,5 +378,4 @@ namespace DiscImageChef.Filesystems.LisaFS return Errno.NoError; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/LisaFS/Xattr.cs b/DiscImageChef.Filesystems/LisaFS/Xattr.cs index 223a807d..5c744c59 100644 --- a/DiscImageChef.Filesystems/LisaFS/Xattr.cs +++ b/DiscImageChef.Filesystems/LisaFS/Xattr.cs @@ -51,8 +51,7 @@ namespace DiscImageChef.Filesystems.LisaFS short fileId; bool isDir; Errno error = LookupFileId(path, out fileId, out isDir); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; return isDir ? Errno.InvalidArgument : ListXAttr(fileId, ref xattrs); } @@ -69,8 +68,7 @@ namespace DiscImageChef.Filesystems.LisaFS short fileId; bool isDir; Errno error = LookupFileId(path, out fileId, out isDir); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; return isDir ? Errno.InvalidArgument : GetXattr(fileId, xattr, out buf); } @@ -85,14 +83,12 @@ namespace DiscImageChef.Filesystems.LisaFS { xattrs = null; - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; // System files if(fileId < 4) { - if(!debug || fileId == 0) - return Errno.InvalidArgument; + if(!debug || fileId == 0) return Errno.InvalidArgument; xattrs = new List<string>(); @@ -102,8 +98,7 @@ namespace DiscImageChef.Filesystems.LisaFS byte[] buf = Encoding.ASCII.GetBytes(mddf.password); // If the MDDF contains a password, show it - if(buf.Length > 0) - xattrs.Add("com.apple.lisa.password"); + if(buf.Length > 0) xattrs.Add("com.apple.lisa.password"); } } else @@ -112,27 +107,22 @@ namespace DiscImageChef.Filesystems.LisaFS ExtentFile file; Errno error = ReadExtentsFile(fileId, out file); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; xattrs = new List<string>(); // Password field is never emptied, check if valid - if(file.password_valid > 0) - xattrs.Add("com.apple.lisa.password"); + if(file.password_valid > 0) xattrs.Add("com.apple.lisa.password"); // Check for a valid copy-protection serial number - if(file.serial > 0) - xattrs.Add("com.apple.lisa.serial"); + if(file.serial > 0) xattrs.Add("com.apple.lisa.serial"); // Check if the label contains something or is empty - if(!ArrayHelpers.ArrayIsNullOrEmpty(file.LisaInfo)) - xattrs.Add("com.apple.lisa.label"); + if(!ArrayHelpers.ArrayIsNullOrEmpty(file.LisaInfo)) xattrs.Add("com.apple.lisa.label"); } // On debug mode allow sector tags to be accessed as an xattr - if(debug) - xattrs.Add("com.apple.lisa.tags"); + if(debug) xattrs.Add("com.apple.lisa.tags"); xattrs.Sort(); @@ -150,14 +140,12 @@ namespace DiscImageChef.Filesystems.LisaFS { buf = null; - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; // System files if(fileId < 4) { - if(!debug || fileId == 0) - return Errno.InvalidArgument; + if(!debug || fileId == 0) return Errno.InvalidArgument; // Only MDDF contains an extended attributes if(fileId == FILEID_MDDF) @@ -170,8 +158,7 @@ namespace DiscImageChef.Filesystems.LisaFS } // But on debug mode even system files contain tags - if(debug && xattr == "com.apple.lisa.tags") - return ReadSystemFile(fileId, out buf, true); + if(debug && xattr == "com.apple.lisa.tags") return ReadSystemFile(fileId, out buf, true); return Errno.NoSuchExtendedAttribute; } @@ -180,8 +167,7 @@ namespace DiscImageChef.Filesystems.LisaFS ExtentFile file; Errno error = ReadExtentsFile(fileId, out file); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; if(xattr == "com.apple.lisa.password" && file.password_valid > 0) { @@ -203,8 +189,7 @@ namespace DiscImageChef.Filesystems.LisaFS return Errno.NoError; } - if(debug && xattr == "com.apple.lisa.tags") - return ReadFile(fileId, out buf, true); + if(debug && xattr == "com.apple.lisa.tags") return ReadFile(fileId, out buf, true); return Errno.NoSuchExtendedAttribute; } @@ -220,8 +205,7 @@ namespace DiscImageChef.Filesystems.LisaFS decoded = new LisaTag.PriamTag(); LisaTag.PriamTag? pmTag = LisaTag.DecodeTag(tag); - if(!pmTag.HasValue) - return Errno.InvalidArgument; + if(!pmTag.HasValue) return Errno.InvalidArgument; decoded = pmTag.Value; return Errno.NoError; diff --git a/DiscImageChef.Filesystems/Locus.cs b/DiscImageChef.Filesystems/Locus.cs index 875cb0bd..bd719ce7 100644 --- a/DiscImageChef.Filesystems/Locus.cs +++ b/DiscImageChef.Filesystems/Locus.cs @@ -63,107 +63,101 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Locus_Superblock { - public uint s_magic; /* identifies this as a locus filesystem */ - /* defined as a constant below */ - public gfs_t s_gfs; /* global filesystem number */ - public daddr_t s_fsize; /* size in blocks of entire volume */ - /* several ints for replicated filsystems */ - public commitcnt_t s_lwm; /* all prior commits propagated */ - public commitcnt_t s_hwm; /* highest commit propagated */ - /* oldest committed version in the list. - * llst mod NCMTLST is the offset of commit #llst in the list, - * which wraps around from there. - */ + public uint s_magic; /* identifies this as a locus filesystem */ + /* defined as a constant below */ + public gfs_t s_gfs; /* global filesystem number */ + public daddr_t s_fsize; /* size in blocks of entire volume */ + /* several ints for replicated filsystems */ + public commitcnt_t s_lwm; /* all prior commits propagated */ + public commitcnt_t s_hwm; /* highest commit propagated */ + /* oldest committed version in the list. + * llst mod NCMTLST is the offset of commit #llst in the list, + * which wraps around from there. + */ public commitcnt_t s_llst; - public fstore_t s_fstore; /* filesystem storage bit mask; if the + public fstore_t s_fstore; /* filesystem storage bit mask; if the filsys is replicated and this is not a primary or backbone copy, this bit mask determines which files are stored */ - public time_t s_time; /* last super block update */ - public daddr_t s_tfree; /* total free blocks*/ + public time_t s_time; /* last super block update */ + public daddr_t s_tfree; /* total free blocks*/ - public ino_t s_isize; /* size in blocks of i-list */ - public short s_nfree; /* number of addresses in s_free */ - public LocusFlags s_flags; /* filsys flags, defined below */ - public ino_t s_tinode; /* total free inodes */ - public ino_t s_lasti; /* start place for circular search */ - public ino_t s_nbehind; /* est # free inodes before s_lasti */ - public pckno_t s_gfspack; /* global filesystem pack number */ - public short s_ninode; /* number of i-nodes in s_inode */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public short[] s_dinfo; /* interleave stuff */ - //#define s_m s_dinfo[0] - //#define s_skip s_dinfo[0] /* AIX defines */ - //#define s_n s_dinfo[1] - //#define s_cyl s_dinfo[1] /* AIX defines */ - public byte s_flock; /* lock during free list manipulation */ - public byte s_ilock; /* lock during i-list manipulation */ - public byte s_fmod; /* super block modified flag */ - public LocusVersion s_version; /* version of the data format in fs. */ - /* defined below. */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] s_fsmnt; /* name of this file system */ + public ino_t s_isize; /* size in blocks of i-list */ + public short s_nfree; /* number of addresses in s_free */ + public LocusFlags s_flags; /* filsys flags, defined below */ + public ino_t s_tinode; /* total free inodes */ + public ino_t s_lasti; /* start place for circular search */ + public ino_t s_nbehind; /* est # free inodes before s_lasti */ + public pckno_t s_gfspack; /* global filesystem pack number */ + public short s_ninode; /* number of i-nodes in s_inode */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public short[] s_dinfo; /* interleave stuff */ + //#define s_m s_dinfo[0] + //#define s_skip s_dinfo[0] /* AIX defines */ + //#define s_n s_dinfo[1] + //#define s_cyl s_dinfo[1] /* AIX defines */ + public byte s_flock; /* lock during free list manipulation */ + public byte s_ilock; /* lock during i-list manipulation */ + public byte s_fmod; /* super block modified flag */ + public LocusVersion s_version; /* version of the data format in fs. */ + /* defined below. */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] s_fsmnt; /* name of this file system */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] s_fpack; /* name of this physical volume */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = NICINOD)] - public ino_t[] s_inode; /* free i-node list */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = NICINOD)] public ino_t[] s_inode; /* free i-node list */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NICFREE)] - public daddr_t[] su_free; /* free block list for non-replicated filsys */ - public byte s_byteorder; /* byte order of integers */ + public daddr_t[] su_free; /* free block list for non-replicated filsys */ + public byte s_byteorder; /* byte order of integers */ } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Locus_OldSuperblock { - public uint s_magic; /* identifies this as a locus filesystem */ - /* defined as a constant below */ - public gfs_t s_gfs; /* global filesystem number */ - public daddr_t s_fsize; /* size in blocks of entire volume */ - /* several ints for replicated filsystems */ - public commitcnt_t s_lwm; /* all prior commits propagated */ - public commitcnt_t s_hwm; /* highest commit propagated */ - /* oldest committed version in the list. - * llst mod NCMTLST is the offset of commit #llst in the list, - * which wraps around from there. - */ + public uint s_magic; /* identifies this as a locus filesystem */ + /* defined as a constant below */ + public gfs_t s_gfs; /* global filesystem number */ + public daddr_t s_fsize; /* size in blocks of entire volume */ + /* several ints for replicated filsystems */ + public commitcnt_t s_lwm; /* all prior commits propagated */ + public commitcnt_t s_hwm; /* highest commit propagated */ + /* oldest committed version in the list. + * llst mod NCMTLST is the offset of commit #llst in the list, + * which wraps around from there. + */ public commitcnt_t s_llst; - public fstore_t s_fstore; /* filesystem storage bit mask; if the + public fstore_t s_fstore; /* filesystem storage bit mask; if the filsys is replicated and this is not a primary or backbone copy, this bit mask determines which files are stored */ - public time_t s_time; /* last super block update */ - public daddr_t s_tfree; /* total free blocks*/ + public time_t s_time; /* last super block update */ + public daddr_t s_tfree; /* total free blocks*/ - public ino_t s_isize; /* size in blocks of i-list */ - public short s_nfree; /* number of addresses in s_free */ - public LocusFlags s_flags; /* filsys flags, defined below */ - public ino_t s_tinode; /* total free inodes */ - public ino_t s_lasti; /* start place for circular search */ - public ino_t s_nbehind; /* est # free inodes before s_lasti */ - public pckno_t s_gfspack; /* global filesystem pack number */ - public short s_ninode; /* number of i-nodes in s_inode */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public short[] s_dinfo; /* interleave stuff */ - //#define s_m s_dinfo[0] - //#define s_skip s_dinfo[0] /* AIX defines */ - //#define s_n s_dinfo[1] - //#define s_cyl s_dinfo[1] /* AIX defines */ - public byte s_flock; /* lock during free list manipulation */ - public byte s_ilock; /* lock during i-list manipulation */ - public byte s_fmod; /* super block modified flag */ - public LocusVersion s_version; /* version of the data format in fs. */ - /* defined below. */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] s_fsmnt; /* name of this file system */ + public ino_t s_isize; /* size in blocks of i-list */ + public short s_nfree; /* number of addresses in s_free */ + public LocusFlags s_flags; /* filsys flags, defined below */ + public ino_t s_tinode; /* total free inodes */ + public ino_t s_lasti; /* start place for circular search */ + public ino_t s_nbehind; /* est # free inodes before s_lasti */ + public pckno_t s_gfspack; /* global filesystem pack number */ + public short s_ninode; /* number of i-nodes in s_inode */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public short[] s_dinfo; /* interleave stuff */ + //#define s_m s_dinfo[0] + //#define s_skip s_dinfo[0] /* AIX defines */ + //#define s_n s_dinfo[1] + //#define s_cyl s_dinfo[1] /* AIX defines */ + public byte s_flock; /* lock during free list manipulation */ + public byte s_ilock; /* lock during i-list manipulation */ + public byte s_fmod; /* super block modified flag */ + public LocusVersion s_version; /* version of the data format in fs. */ + /* defined below. */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] s_fsmnt; /* name of this file system */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] s_fpack; /* name of this physical volume */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = OLDNICINOD)] - public ino_t[] s_inode; /* free i-node list */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = OLDNICINOD)] public ino_t[] s_inode; /* free i-node list */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = OLDNICFREE)] - public daddr_t[] su_free; /* free block list for non-replicated filsys */ - public byte s_byteorder; /* byte order of integers */ + public daddr_t[] su_free; /* free block list for non-replicated filsys */ + public byte s_byteorder; /* byte order of integers */ } [Flags] @@ -173,22 +167,22 @@ namespace DiscImageChef.Filesystems SB_CLEAN = 0x2, /* fs unmounted cleanly (or checks run) */ SB_DIRTY = 0x4, /* fs mounted without CLEAN bit set */ SB_RMV = 0x8, /* fs is a removable file system */ - SB_PRIMPACK = 0x10, /* This is the primary pack of the filesystem */ - SB_REPLTYPE = 0x20, /* This is a replicated type filesystem. */ - SB_USER = 0x40, /* This is a "user" replicated filesystem. */ - SB_BACKBONE = 0x80, /* backbone pack ; complete copy of primary pack but not modifiable */ - SB_NFS = 0x100, /* This is a NFS type filesystem */ - SB_BYHAND = 0x200, /* Inhibits automatic fscks on a mangled file system */ - SB_NOSUID = 0x400, /* Set-uid/Set-gid is disabled */ - SB_SYNCW = 0x800 /* Synchronous Write */ + SB_PRIMPACK = 0x10, /* This is the primary pack of the filesystem */ + SB_REPLTYPE = 0x20, /* This is a replicated type filesystem. */ + SB_USER = 0x40, /* This is a "user" replicated filesystem. */ + SB_BACKBONE = 0x80, /* backbone pack ; complete copy of primary pack but not modifiable */ + SB_NFS = 0x100, /* This is a NFS type filesystem */ + SB_BYHAND = 0x200, /* Inhibits automatic fscks on a mangled file system */ + SB_NOSUID = 0x400, /* Set-uid/Set-gid is disabled */ + SB_SYNCW = 0x800 /* Synchronous Write */ } [Flags] enum LocusVersion : byte { - SB_SB4096 = 1, /* smallblock filesys with 4096 byte blocks */ - SB_B1024 = 2, /* 1024 byte block filesystem */ - NUMSCANDEV = 5 /* Used by scangfs(), refed in space.h */ + SB_SB4096 = 1, /* smallblock filesys with 4096 byte blocks */ + SB_B1024 = 2, /* 1024 byte block filesystem */ + NUMSCANDEV = 5 /* Used by scangfs(), refed in space.h */ } const uint Locus_Magic = 0xFFEEDDCD; @@ -207,41 +201,33 @@ namespace DiscImageChef.Filesystems { Name = "Locus Filesystem Plugin"; PluginUUID = new Guid("1A70B30A-437D-479A-88E1-D0C9C1797FF4"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public Locus(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Locus Filesystem Plugin"; PluginUUID = new Guid("1A70B30A-437D-479A-88E1-D0C9C1797FF4"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; for(ulong location = 0; location <= 8; location++) { Locus_Superblock LocusSb = new Locus_Superblock(); uint sbSize = (uint)((Marshal.SizeOf(LocusSb)) / imagePlugin.GetSectorSize()); - if((Marshal.SizeOf(LocusSb)) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if((Marshal.SizeOf(LocusSb)) % imagePlugin.GetSectorSize() != 0) sbSize++; - if(partition.Start + location + sbSize >= imagePlugin.GetSectors()) - break; + if(partition.Start + location + sbSize >= imagePlugin.GetSectors()) break; byte[] sector = imagePlugin.ReadSectors(partition.Start + location, sbSize); - if(sector.Length < Marshal.SizeOf(LocusSb)) - return false; + if(sector.Length < Marshal.SizeOf(LocusSb)) return false; IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(LocusSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(LocusSb)); @@ -251,18 +237,17 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("Locus plugin", "magic at {1} = 0x{0:X8}", LocusSb.s_magic, location); if(LocusSb.s_magic == Locus_Magic || LocusSb.s_magic == Locus_Cigam || - LocusSb.s_magic == Locus_OldMagic || LocusSb.s_magic == Locus_OldCigam) - return true; + LocusSb.s_magic == Locus_OldMagic || LocusSb.s_magic == Locus_OldCigam) return true; } return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < 512) - return; + if(imagePlugin.GetSectorSize() < 512) return; Locus_Superblock LocusSb = new Locus_Superblock(); byte[] sector = null; @@ -270,12 +255,10 @@ namespace DiscImageChef.Filesystems for(ulong location = 0; location <= 8; location++) { uint sbSize = (uint)((Marshal.SizeOf(LocusSb)) / imagePlugin.GetSectorSize()); - if((Marshal.SizeOf(LocusSb)) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if((Marshal.SizeOf(LocusSb)) % imagePlugin.GetSectorSize() != 0) sbSize++; sector = imagePlugin.ReadSectors(partition.Start + location, sbSize); - if(sector.Length < Marshal.SizeOf(LocusSb)) - return; + if(sector.Length < Marshal.SizeOf(LocusSb)) return; IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(LocusSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(LocusSb)); @@ -283,14 +266,12 @@ namespace DiscImageChef.Filesystems Marshal.FreeHGlobal(sbPtr); if(LocusSb.s_magic == Locus_Magic || LocusSb.s_magic == Locus_Cigam || - LocusSb.s_magic == Locus_OldMagic || LocusSb.s_magic == Locus_OldCigam) - break; + LocusSb.s_magic == Locus_OldMagic || LocusSb.s_magic == Locus_OldCigam) break; } // We don't care about old version for information - if(LocusSb.s_magic != Locus_Magic && LocusSb.s_magic != Locus_Cigam && - LocusSb.s_magic != Locus_OldMagic && LocusSb.s_magic != Locus_OldCigam) - return; + if(LocusSb.s_magic != Locus_Magic && LocusSb.s_magic != Locus_Cigam && LocusSb.s_magic != Locus_OldMagic && + LocusSb.s_magic != Locus_OldCigam) return; // Numerical arrays are not important for information so no need to swap them if(LocusSb.s_magic == Locus_Cigam || LocusSb.s_magic == Locus_OldCigam) @@ -301,16 +282,12 @@ namespace DiscImageChef.Filesystems StringBuilder sb = new StringBuilder(); - if(LocusSb.s_magic == Locus_OldMagic) - sb.AppendLine("Locus filesystem (old)"); - else - sb.AppendLine("Locus filesystem"); + if(LocusSb.s_magic == Locus_OldMagic) sb.AppendLine("Locus filesystem (old)"); + else sb.AppendLine("Locus filesystem"); int blockSize; - if(LocusSb.s_version == LocusVersion.SB_SB4096) - blockSize = 4096; - else - blockSize = 1024; + if(LocusSb.s_version == LocusVersion.SB_SB4096) blockSize = 4096; + else blockSize = 1024; string s_fsmnt = StringHandlers.CToString(LocusSb.s_fsmnt, CurrentEncoding); string s_fpack = StringHandlers.CToString(LocusSb.s_fpack, CurrentEncoding); @@ -337,37 +314,28 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fmod = {0}", LocusSb.s_fmod); DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_version = {0}", LocusSb.s_version); - sb.AppendFormat("Superblock last modified on {0}", DateHandlers.UNIXToDateTime(LocusSb.s_time)).AppendLine(); - sb.AppendFormat("Volume has {0} blocks of {1} bytes each (total {2} bytes)", LocusSb.s_fsize, blockSize, LocusSb.s_fsize * blockSize).AppendLine(); + sb.AppendFormat("Superblock last modified on {0}", DateHandlers.UNIXToDateTime(LocusSb.s_time)) + .AppendLine(); + sb.AppendFormat("Volume has {0} blocks of {1} bytes each (total {2} bytes)", LocusSb.s_fsize, blockSize, + LocusSb.s_fsize * blockSize).AppendLine(); sb.AppendFormat("{0} blocks free ({1} bytes)", LocusSb.s_tfree, LocusSb.s_tfree * blockSize).AppendLine(); sb.AppendFormat("I-node list uses {0} blocks", LocusSb.s_isize).AppendLine(); sb.AppendFormat("{0} free inodes", LocusSb.s_tinode).AppendLine(); sb.AppendFormat("Next free inode search will start at inode {0}", LocusSb.s_lasti).AppendLine(); - sb.AppendFormat("There are an estimate of {0} free inodes before next search start", LocusSb.s_nbehind).AppendLine(); - if(LocusSb.s_flags.HasFlag(LocusFlags.SB_RDONLY)) - sb.AppendLine("Read-only volume"); - if(LocusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN)) - sb.AppendLine("Clean volume"); - if(LocusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY)) - sb.AppendLine("Dirty volume"); - if(LocusSb.s_flags.HasFlag(LocusFlags.SB_RMV)) - sb.AppendLine("Removable volume"); - if(LocusSb.s_flags.HasFlag(LocusFlags.SB_PRIMPACK)) - sb.AppendLine("This is the primary pack"); - if(LocusSb.s_flags.HasFlag(LocusFlags.SB_REPLTYPE)) - sb.AppendLine("Replicated volume"); - if(LocusSb.s_flags.HasFlag(LocusFlags.SB_USER)) - sb.AppendLine("User replicated volume"); - if(LocusSb.s_flags.HasFlag(LocusFlags.SB_BACKBONE)) - sb.AppendLine("Backbone volume"); - if(LocusSb.s_flags.HasFlag(LocusFlags.SB_NFS)) - sb.AppendLine("NFS volume"); - if(LocusSb.s_flags.HasFlag(LocusFlags.SB_BYHAND)) - sb.AppendLine("Volume inhibits automatic fsck"); - if(LocusSb.s_flags.HasFlag(LocusFlags.SB_NOSUID)) - sb.AppendLine("Set-uid/set-gid is disabled"); - if(LocusSb.s_flags.HasFlag(LocusFlags.SB_SYNCW)) - sb.AppendLine("Volume uses synchronous writes"); + sb.AppendFormat("There are an estimate of {0} free inodes before next search start", LocusSb.s_nbehind) + .AppendLine(); + if(LocusSb.s_flags.HasFlag(LocusFlags.SB_RDONLY)) sb.AppendLine("Read-only volume"); + if(LocusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN)) sb.AppendLine("Clean volume"); + if(LocusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY)) sb.AppendLine("Dirty volume"); + if(LocusSb.s_flags.HasFlag(LocusFlags.SB_RMV)) sb.AppendLine("Removable volume"); + if(LocusSb.s_flags.HasFlag(LocusFlags.SB_PRIMPACK)) sb.AppendLine("This is the primary pack"); + if(LocusSb.s_flags.HasFlag(LocusFlags.SB_REPLTYPE)) sb.AppendLine("Replicated volume"); + if(LocusSb.s_flags.HasFlag(LocusFlags.SB_USER)) sb.AppendLine("User replicated volume"); + if(LocusSb.s_flags.HasFlag(LocusFlags.SB_BACKBONE)) sb.AppendLine("Backbone volume"); + if(LocusSb.s_flags.HasFlag(LocusFlags.SB_NFS)) sb.AppendLine("NFS volume"); + if(LocusSb.s_flags.HasFlag(LocusFlags.SB_BYHAND)) sb.AppendLine("Volume inhibits automatic fsck"); + if(LocusSb.s_flags.HasFlag(LocusFlags.SB_NOSUID)) sb.AppendLine("Set-uid/set-gid is disabled"); + if(LocusSb.s_flags.HasFlag(LocusFlags.SB_SYNCW)) sb.AppendLine("Volume uses synchronous writes"); sb.AppendFormat("Volume label: {0}", s_fsmnt).AppendLine(); sb.AppendFormat("Physical volume name: {0}", s_fpack).AppendLine(); sb.AppendFormat("Global File System number: {0}", LocusSb.s_gfs).AppendLine(); diff --git a/DiscImageChef.Filesystems/MicroDOS.cs b/DiscImageChef.Filesystems/MicroDOS.cs index 4f23f6c2..91c22d16 100644 --- a/DiscImageChef.Filesystems/MicroDOS.cs +++ b/DiscImageChef.Filesystems/MicroDOS.cs @@ -56,29 +56,23 @@ namespace DiscImageChef.Filesystems { Name = "MicroDOS file system"; PluginUUID = new Guid("9F9A364A-1A27-48A3-B730-7A7122000324"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("koi8-r"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("koi8-r"); + else CurrentEncoding = encoding; } public MicroDOS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "MicroDOS file system"; PluginUUID = new Guid("9F9A364A-1A27-48A3-B730-7A7122000324"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("koi8-r"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("koi8-r"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((1 + partition.Start) >= partition.End) - return false; + if((1 + partition.Start) >= partition.End) return false; - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; MicroDOSBlock0 block0 = new MicroDOSBlock0(); @@ -91,7 +85,8 @@ namespace DiscImageChef.Filesystems return block0.label == magic && block0.mklabel == magic2; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -106,7 +101,8 @@ namespace DiscImageChef.Filesystems sb.AppendLine("MicroDOS filesystem"); sb.AppendFormat("Volume has {0} blocks ({1} bytes)", block0.blocks, block0.blocks * 512).AppendLine(); - sb.AppendFormat("Volume has {0} blocks used ({1} bytes)", block0.usedBlocks, block0.usedBlocks * 512).AppendLine(); + sb.AppendFormat("Volume has {0} blocks used ({1} bytes)", block0.usedBlocks, block0.usedBlocks * 512) + .AppendLine(); sb.AppendFormat("Volume contains {0} files", block0.files).AppendLine(); sb.AppendFormat("First used block is {0}", block0.firstUsedBlock).AppendLine(); @@ -129,22 +125,19 @@ namespace DiscImageChef.Filesystems struct MicroDOSBlock0 { /// <summary>BK starts booting here</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] - public byte[] bootCode; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] bootCode; /// <summary>Number of files in directory</summary> public ushort files; /// <summary>Total number of blocks in files of the directory</summary> public ushort usedBlocks; /// <summary>Unknown</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 228)] - public byte[] unknown; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 228)] public byte[] unknown; /// <summary>Ownership label (label that shows it belongs to Micro DOS format)</summary> public ushort label; /// <summary>MK-DOS directory format label</summary> public ushort mklabel; /// <summary>Unknown</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] - public byte[] unknown2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] public byte[] unknown2; /// <summary>Disk size in blocks (absolute value for the system unlike NORD, NORTON etc.) that /// doesn't use two fixed values 40 or 80 tracks, but i.e. if you drive works with 76 tracks /// this field will contain an appropriate number of blocks</summary> @@ -152,8 +145,7 @@ namespace DiscImageChef.Filesystems /// <summary> Number of the first file's block. Value is changable</summary> public ushort firstUsedBlock; /// <summary>Unknown</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] unknown3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] unknown3; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -164,8 +156,7 @@ namespace DiscImageChef.Filesystems /// <summary>Directory number (0 - root)</summary> public byte directory; /// <summary>File name 14. symbols in ASCII KOI8</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] filename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] filename; /// <summary>Block number</summary> public ushort blockNo; /// <summary>Length in blocks</summary> diff --git a/DiscImageChef.Filesystems/MinixFS.cs b/DiscImageChef.Filesystems/MinixFS.cs index 84ff2234..cbcd9a9b 100644 --- a/DiscImageChef.Filesystems/MinixFS.cs +++ b/DiscImageChef.Filesystems/MinixFS.cs @@ -74,20 +74,16 @@ namespace DiscImageChef.Filesystems { Name = "Minix Filesystem"; PluginUUID = new Guid("FE248C3B-B727-4AE5-A39F-79EA9A07D4B3"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public MinixFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Minix Filesystem"; PluginUUID = new Guid("FE248C3B-B727-4AE5-A39F-79EA9A07D4B3"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) @@ -101,8 +97,7 @@ namespace DiscImageChef.Filesystems offset = 0x400; } - if((sector + partition.Start) >= partition.End) - return false; + if((sector + partition.Start) >= partition.End) return false; ushort magic; byte[] minix_sb_sector = imagePlugin.ReadSector(sector + partition.Start); @@ -118,17 +113,19 @@ namespace DiscImageChef.Filesystems magic = BitConverter.ToUInt16(minix_sb_sector, 0x010); // Here should reside magic number on Minix v1 & V2 if(magic == MINIX_MAGIC || magic == MINIX_MAGIC2 || magic == MINIX2_MAGIC || magic == MINIX2_MAGIC2 || - magic == MINIX_CIGAM || magic == MINIX_CIGAM2 || magic == MINIX2_CIGAM || magic == MINIX2_CIGAM2) - return true; + magic == MINIX_CIGAM || magic == MINIX_CIGAM2 || magic == MINIX2_CIGAM || + magic == MINIX2_CIGAM2) return true; + magic = BitConverter.ToUInt16(minix_sb_sector, 0x018); // Here should reside magic number on Minix v3 - if(magic == MINIX_MAGIC || magic == MINIX2_MAGIC || magic == MINIX3_MAGIC || - magic == MINIX_CIGAM || magic == MINIX2_CIGAM || magic == MINIX3_CIGAM) - return true; + if(magic == MINIX_MAGIC || magic == MINIX2_MAGIC || magic == MINIX3_MAGIC || magic == MINIX_CIGAM || + magic == MINIX2_CIGAM || magic == MINIX3_CIGAM) return true; + return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -163,7 +160,8 @@ namespace DiscImageChef.Filesystems bool littleEndian = true; - if(magic == MINIX3_MAGIC || magic == MINIX3_CIGAM || magic == MINIX2_MAGIC || magic == MINIX2_CIGAM || magic == MINIX_MAGIC || magic == MINIX_CIGAM) + if(magic == MINIX3_MAGIC || magic == MINIX3_CIGAM || magic == MINIX2_MAGIC || magic == MINIX2_CIGAM || + magic == MINIX_MAGIC || magic == MINIX_CIGAM) { filenamesize = 60; littleEndian = (magic != MINIX3_CIGAM || magic == MINIX2_CIGAM || magic == MINIX_CIGAM); @@ -240,8 +238,7 @@ namespace DiscImageChef.Filesystems littleEndian = false; xmlFSType.Type = "Minix v2"; break; - default: - return; + default: return; } } @@ -252,35 +249,36 @@ namespace DiscImageChef.Filesystems if(littleEndian) { GCHandle handle = GCHandle.Alloc(minix_sb_sector, GCHandleType.Pinned); - mnx_sb = (Minix3SuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Minix3SuperBlock)); + mnx_sb = (Minix3SuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), + typeof(Minix3SuperBlock)); handle.Free(); } - else - mnx_sb = BigEndianMarshal.ByteArrayToStructureBigEndian<Minix3SuperBlock>(minix_sb_sector); + else mnx_sb = BigEndianMarshal.ByteArrayToStructureBigEndian<Minix3SuperBlock>(minix_sb_sector); - if(magic != MINIX3_MAGIC && magic != MINIX3_CIGAM) - mnx_sb.s_blocksize = 1024; + if(magic != MINIX3_MAGIC && magic != MINIX3_CIGAM) mnx_sb.s_blocksize = 1024; sb.AppendLine(minixVersion); sb.AppendFormat("{0} chars in filename", filenamesize).AppendLine(); if(mnx_sb.s_zones > 0) // On V2 - sb.AppendFormat("{0} zones on volume ({1} bytes)", mnx_sb.s_zones, mnx_sb.s_zones * 1024).AppendLine(); + sb.AppendFormat("{0} zones on volume ({1} bytes)", mnx_sb.s_zones, mnx_sb.s_zones * 1024) + .AppendLine(); else - sb.AppendFormat("{0} zones on volume ({1} bytes)", mnx_sb.s_nzones, mnx_sb.s_nzones * 1024).AppendLine(); + sb.AppendFormat("{0} zones on volume ({1} bytes)", mnx_sb.s_nzones, mnx_sb.s_nzones * 1024) + .AppendLine(); sb.AppendFormat("{0} bytes/block", mnx_sb.s_blocksize).AppendLine(); sb.AppendFormat("{0} inodes on volume", mnx_sb.s_ninodes).AppendLine(); - sb.AppendFormat("{0} blocks on inode map ({1} bytes)", mnx_sb.s_imap_blocks, mnx_sb.s_imap_blocks * mnx_sb.s_blocksize).AppendLine(); - sb.AppendFormat("{0} blocks on zone map ({1} bytes)", mnx_sb.s_zmap_blocks, mnx_sb.s_zmap_blocks * mnx_sb.s_blocksize).AppendLine(); + sb.AppendFormat("{0} blocks on inode map ({1} bytes)", mnx_sb.s_imap_blocks, + mnx_sb.s_imap_blocks * mnx_sb.s_blocksize).AppendLine(); + sb.AppendFormat("{0} blocks on zone map ({1} bytes)", mnx_sb.s_zmap_blocks, + mnx_sb.s_zmap_blocks * mnx_sb.s_blocksize).AppendLine(); sb.AppendFormat("First data zone: {0}", mnx_sb.s_firstdatazone).AppendLine(); //sb.AppendFormat("log2 of blocks/zone: {0}", mnx_sb.s_log_zone_size).AppendLine(); // Apparently 0 sb.AppendFormat("{0} bytes maximum per file", mnx_sb.s_max_size).AppendLine(); sb.AppendFormat("On-disk filesystem version: {0}", mnx_sb.s_disk_version).AppendLine(); xmlFSType.ClusterSize = mnx_sb.s_blocksize; - if(mnx_sb.s_zones > 0) - xmlFSType.Clusters = mnx_sb.s_zones; - else - xmlFSType.Clusters = mnx_sb.s_nzones; + if(mnx_sb.s_zones > 0) xmlFSType.Clusters = mnx_sb.s_zones; + else xmlFSType.Clusters = mnx_sb.s_nzones; } else { @@ -289,30 +287,32 @@ namespace DiscImageChef.Filesystems if(littleEndian) { GCHandle handle = GCHandle.Alloc(minix_sb_sector, GCHandleType.Pinned); - mnx_sb = (MinixSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(MinixSuperBlock)); + mnx_sb = (MinixSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), + typeof(MinixSuperBlock)); handle.Free(); } - else - mnx_sb = BigEndianMarshal.ByteArrayToStructureBigEndian<MinixSuperBlock>(minix_sb_sector); + else mnx_sb = BigEndianMarshal.ByteArrayToStructureBigEndian<MinixSuperBlock>(minix_sb_sector); sb.AppendLine(minixVersion); sb.AppendFormat("{0} chars in filename", filenamesize).AppendLine(); if(mnx_sb.s_zones > 0) // On V2 - sb.AppendFormat("{0} zones on volume ({1} bytes)", mnx_sb.s_zones, mnx_sb.s_zones * 1024).AppendLine(); + sb.AppendFormat("{0} zones on volume ({1} bytes)", mnx_sb.s_zones, mnx_sb.s_zones * 1024) + .AppendLine(); else - sb.AppendFormat("{0} zones on volume ({1} bytes)", mnx_sb.s_nzones, mnx_sb.s_nzones * 1024).AppendLine(); + sb.AppendFormat("{0} zones on volume ({1} bytes)", mnx_sb.s_nzones, mnx_sb.s_nzones * 1024) + .AppendLine(); sb.AppendFormat("{0} inodes on volume", mnx_sb.s_ninodes).AppendLine(); - sb.AppendFormat("{0} blocks on inode map ({1} bytes)", mnx_sb.s_imap_blocks, mnx_sb.s_imap_blocks * 1024).AppendLine(); - sb.AppendFormat("{0} blocks on zone map ({1} bytes)", mnx_sb.s_zmap_blocks, mnx_sb.s_zmap_blocks * 1024).AppendLine(); + sb.AppendFormat("{0} blocks on inode map ({1} bytes)", mnx_sb.s_imap_blocks, + mnx_sb.s_imap_blocks * 1024).AppendLine(); + sb.AppendFormat("{0} blocks on zone map ({1} bytes)", mnx_sb.s_zmap_blocks, mnx_sb.s_zmap_blocks * 1024) + .AppendLine(); sb.AppendFormat("First data zone: {0}", mnx_sb.s_firstdatazone).AppendLine(); //sb.AppendFormat("log2 of blocks/zone: {0}", mnx_sb.s_log_zone_size).AppendLine(); // Apparently 0 sb.AppendFormat("{0} bytes maximum per file", mnx_sb.s_max_size).AppendLine(); sb.AppendFormat("Filesystem state: {0:X4}", mnx_sb.s_state).AppendLine(); xmlFSType.ClusterSize = 1024; - if(mnx_sb.s_zones > 0) - xmlFSType.Clusters = mnx_sb.s_zones; - else - xmlFSType.Clusters = mnx_sb.s_nzones; + if(mnx_sb.s_zones > 0) xmlFSType.Clusters = mnx_sb.s_zones; + else xmlFSType.Clusters = mnx_sb.s_nzones; } information = sb.ToString(); } @@ -439,5 +439,4 @@ namespace DiscImageChef.Filesystems return Errno.NotImplemented; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/NILFS2.cs b/DiscImageChef.Filesystems/NILFS2.cs index 47a836a1..ec40a427 100644 --- a/DiscImageChef.Filesystems/NILFS2.cs +++ b/DiscImageChef.Filesystems/NILFS2.cs @@ -85,8 +85,7 @@ namespace DiscImageChef.Filesystems public ushort checkpoint_size; public ushort segment_usage_size; public Guid uuid; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] - public byte[] volume_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] public byte[] volume_name; public uint c_interval; public uint c_block_max; public ulong feature_compat; @@ -108,43 +107,34 @@ namespace DiscImageChef.Filesystems { Name = "NILFS2 Plugin"; PluginUUID = new Guid("35224226-C5CC-48B5-8FFD-3781E91E86B6"); - if(encoding == null) - CurrentEncoding = Encoding.UTF8; - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.UTF8; + else CurrentEncoding = encoding; } public NILFS2(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "NILFS2 Plugin"; PluginUUID = new Guid("35224226-C5CC-48B5-8FFD-3781E91E86B6"); - if(encoding == null) - CurrentEncoding = Encoding.UTF8; - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.UTF8; + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; uint sbAddr = NILFS2_SuperOffset / imagePlugin.GetSectorSize(); - if(sbAddr == 0) - sbAddr = 1; + if(sbAddr == 0) sbAddr = 1; NILFS2_Superblock nilfsSb = new NILFS2_Superblock(); uint sbSize = (uint)(Marshal.SizeOf(nilfsSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(nilfsSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(nilfsSb) % imagePlugin.GetSectorSize() != 0) sbSize++; - if(partition.Start + sbAddr + sbSize >= partition.End) - return false; + if(partition.Start + sbAddr + sbSize >= partition.End) return false; byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize); - if(sector.Length < Marshal.SizeOf(nilfsSb)) - return false; + if(sector.Length < Marshal.SizeOf(nilfsSb)) return false; IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(nilfsSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(nilfsSb)); @@ -154,33 +144,29 @@ namespace DiscImageChef.Filesystems return nilfsSb.magic == NILFS2_Magic; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < 512) - return; + if(imagePlugin.GetSectorSize() < 512) return; uint sbAddr = NILFS2_SuperOffset / imagePlugin.GetSectorSize(); - if(sbAddr == 0) - sbAddr = 1; + if(sbAddr == 0) sbAddr = 1; NILFS2_Superblock nilfsSb = new NILFS2_Superblock(); uint sbSize = (uint)(Marshal.SizeOf(nilfsSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(nilfsSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(nilfsSb) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize); - if(sector.Length < Marshal.SizeOf(nilfsSb)) - return; + if(sector.Length < Marshal.SizeOf(nilfsSb)) return; IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(nilfsSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(nilfsSb)); nilfsSb = (NILFS2_Superblock)Marshal.PtrToStructure(sbPtr, typeof(NILFS2_Superblock)); Marshal.FreeHGlobal(sbPtr); - if(nilfsSb.magic != NILFS2_Magic) - return; + if(nilfsSb.magic != NILFS2_Magic) return; StringBuilder sb = new StringBuilder(); @@ -190,23 +176,23 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} bytes in volume", nilfsSb.dev_size).AppendLine(); sb.AppendFormat("{0} blocks per segment", nilfsSb.blocks_per_segment).AppendLine(); sb.AppendFormat("{0} segments", nilfsSb.nsegments).AppendLine(); - if(nilfsSb.creator_os == 0) - sb.AppendLine("Filesystem created on Linux"); - else - sb.AppendFormat("Creator OS code: {0}", nilfsSb.creator_os).AppendLine(); + if(nilfsSb.creator_os == 0) sb.AppendLine("Filesystem created on Linux"); + else sb.AppendFormat("Creator OS code: {0}", nilfsSb.creator_os).AppendLine(); sb.AppendFormat("{0} bytes per inode", nilfsSb.inode_size).AppendLine(); sb.AppendFormat("Volume UUID: {0}", nilfsSb.uuid).AppendLine(); - sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(nilfsSb.volume_name, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(nilfsSb.volume_name, CurrentEncoding)) + .AppendLine(); sb.AppendFormat("Volume created on {0}", DateHandlers.UNIXUnsignedToDateTime(nilfsSb.ctime)).AppendLine(); - sb.AppendFormat("Volume last mounted on {0}", DateHandlers.UNIXUnsignedToDateTime(nilfsSb.mtime)).AppendLine(); - sb.AppendFormat("Volume last written on {0}", DateHandlers.UNIXUnsignedToDateTime(nilfsSb.wtime)).AppendLine(); + sb.AppendFormat("Volume last mounted on {0}", DateHandlers.UNIXUnsignedToDateTime(nilfsSb.mtime)) + .AppendLine(); + sb.AppendFormat("Volume last written on {0}", DateHandlers.UNIXUnsignedToDateTime(nilfsSb.wtime)) + .AppendLine(); information = sb.ToString(); xmlFSType = new Schemas.FileSystemType(); xmlFSType.Type = "NILFS2 filesystem"; - if(nilfsSb.creator_os == 0) - xmlFSType.SystemIdentifier = "Linux"; + if(nilfsSb.creator_os == 0) xmlFSType.SystemIdentifier = "Linux"; xmlFSType.ClusterSize = 1 << (int)(nilfsSb.log_block_size + 10); xmlFSType.Clusters = (long)nilfsSb.dev_size / xmlFSType.ClusterSize; xmlFSType.VolumeName = StringHandlers.CToString(nilfsSb.volume_name, CurrentEncoding); diff --git a/DiscImageChef.Filesystems/NTFS.cs b/DiscImageChef.Filesystems/NTFS.cs index b1aa2ab3..6dcf954b 100644 --- a/DiscImageChef.Filesystems/NTFS.cs +++ b/DiscImageChef.Filesystems/NTFS.cs @@ -65,8 +65,7 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((2 + partition.Start) >= partition.End) - return false; + if((2 + partition.Start) >= partition.End) return false; byte[] eigth_bytes = new byte[8]; byte fats_no; @@ -78,25 +77,23 @@ namespace DiscImageChef.Filesystems Array.Copy(ntfs_bpb, 0x003, eigth_bytes, 0, 8); oem_name = StringHandlers.CToString(eigth_bytes); - if(oem_name != "NTFS ") - return false; + if(oem_name != "NTFS ") return false; fats_no = ntfs_bpb[0x010]; - if(fats_no != 0) - return false; + if(fats_no != 0) return false; spfat = BitConverter.ToUInt16(ntfs_bpb, 0x016); - if(spfat != 0) - return false; + if(spfat != 0) return false; signature = BitConverter.ToUInt16(ntfs_bpb, 0x1FE); return signature == 0xAA55; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -127,27 +124,27 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("BIOS drive number: 0x{0:X2}", ntfs_bb.drive_no).AppendLine(); // sb.AppendFormat("NT flags: 0x{0:X2}", ntfs_bb.nt_flags).AppendLine(); // sb.AppendFormat("Signature 1: 0x{0:X2}", ntfs_bb.signature1).AppendLine(); - sb.AppendFormat("{0} sectors on volume ({1} bytes)", ntfs_bb.sectors, ntfs_bb.sectors * ntfs_bb.bps).AppendLine(); + sb.AppendFormat("{0} sectors on volume ({1} bytes)", ntfs_bb.sectors, ntfs_bb.sectors * ntfs_bb.bps) + .AppendLine(); sb.AppendFormat("Cluster where $MFT starts: {0}", ntfs_bb.mft_lsn).AppendLine(); sb.AppendFormat("Cluster where $MFTMirr starts: {0}", ntfs_bb.mftmirror_lsn).AppendLine(); if(ntfs_bb.mft_rc_clusters > 0) sb.AppendFormat("{0} clusters per MFT record ({1} bytes)", ntfs_bb.mft_rc_clusters, - ntfs_bb.mft_rc_clusters * ntfs_bb.bps * ntfs_bb.spc).AppendLine(); - else - sb.AppendFormat("{0} bytes per MFT record", 1 << -ntfs_bb.mft_rc_clusters).AppendLine(); + ntfs_bb.mft_rc_clusters * ntfs_bb.bps * ntfs_bb.spc).AppendLine(); + else sb.AppendFormat("{0} bytes per MFT record", 1 << -ntfs_bb.mft_rc_clusters).AppendLine(); if(ntfs_bb.index_blk_cts > 0) sb.AppendFormat("{0} clusters per Index block ({1} bytes)", ntfs_bb.index_blk_cts, - ntfs_bb.index_blk_cts * ntfs_bb.bps * ntfs_bb.spc).AppendLine(); - else - sb.AppendFormat("{0} bytes per Index block", 1 << -ntfs_bb.index_blk_cts).AppendLine(); + ntfs_bb.index_blk_cts * ntfs_bb.bps * ntfs_bb.spc).AppendLine(); + else sb.AppendFormat("{0} bytes per Index block", 1 << -ntfs_bb.index_blk_cts).AppendLine(); sb.AppendFormat("Volume serial number: {0:X16}", ntfs_bb.serial_no).AppendLine(); // sb.AppendFormat("Signature 2: 0x{0:X4}", ntfs_bb.signature2).AppendLine(); xmlFSType = new Schemas.FileSystemType(); - if(ntfs_bb.jump[0] == 0xEB && ntfs_bb.jump[1] > 0x4E && ntfs_bb.jump[1] < 0x80 && ntfs_bb.signature2 == 0xAA55) + if(ntfs_bb.jump[0] == 0xEB && ntfs_bb.jump[1] > 0x4E && ntfs_bb.jump[1] < 0x80 && + ntfs_bb.signature2 == 0xAA55) { xmlFSType.Bootable = true; SHA1Context sha1Ctx = new SHA1Context(); @@ -173,11 +170,9 @@ namespace DiscImageChef.Filesystems { // Start of BIOS Parameter Block /// <summary>0x000, Jump to boot code</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump; /// <summary>0x003, OEM Name, 8 bytes, space-padded, must be "NTFS "</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] oem_name; /// <summary>0x00B, Bytes per sector</summary> public ushort bps; /// <summary>0x00D, Sectors per cluster</summary> @@ -234,8 +229,7 @@ namespace DiscImageChef.Filesystems /// <summary>0x048, Volume serial number</summary> public ulong serial_no; /// <summary>Boot code.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 430)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 430)] public byte[] boot_code; /// <summary>0x1FE, 0xAA55</summary> public ushort signature2; } @@ -300,4 +294,4 @@ namespace DiscImageChef.Filesystems return Errno.NotImplemented; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Nintendo.cs b/DiscImageChef.Filesystems/Nintendo.cs index 0a38d8c5..e0187caf 100644 --- a/DiscImageChef.Filesystems/Nintendo.cs +++ b/DiscImageChef.Filesystems/Nintendo.cs @@ -51,29 +51,23 @@ namespace DiscImageChef.Filesystems { Name = "Nintendo optical filesystems"; PluginUUID = new Guid("4675fcb4-4418-4288-9e4a-33d6a4ac1126"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("shift_jis"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("shift_jis"); + else CurrentEncoding = encoding; } public NintendoPlugin(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Nintendo optical filesystems"; PluginUUID = new Guid("4675fcb4-4418-4288-9e4a-33d6a4ac1126"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("shift_jis"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("shift_jis"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Start != 0) - return false; + if(partition.Start != 0) return false; - if((imagePlugin.GetSectors() * imagePlugin.GetSectorSize()) < 0x50000) - return false; + if((imagePlugin.GetSectors() * imagePlugin.GetSectorSize()) < 0x50000) return false; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -82,13 +76,13 @@ namespace DiscImageChef.Filesystems uint magicGC = BigEndianBitConverter.ToUInt32(header, 0x1C); uint magicWii = BigEndianBitConverter.ToUInt32(header, 0x18); - if(magicGC == 0xC2339F3D || magicWii == 0x5D1C9EA3) - return true; + if(magicGC == 0xC2339F3D || magicWii == 0x5D1C9EA3) return true; return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { StringBuilder sbInformation = new StringBuilder(); information = ""; @@ -104,12 +98,9 @@ namespace DiscImageChef.Filesystems uint magicGC = BigEndianBitConverter.ToUInt32(header, 0x1C); uint magicWii = BigEndianBitConverter.ToUInt32(header, 0x18); - if(magicGC == 0xC2339F3D) - wii = false; - else if(magicWii == 0x5D1C9EA3) - wii = true; - else - return; + if(magicGC == 0xC2339F3D) wii = false; + else if(magicWii == 0x5D1C9EA3) wii = true; + else return; fields.discType = Encoding.ASCII.GetString(header, 0, 1); fields.gameCode = Encoding.ASCII.GetString(header, 1, 2); @@ -151,8 +142,10 @@ namespace DiscImageChef.Filesystems { if((offset1 + i * 8 + 8) < 0x50000) { - fields.firstPartitions[i].offset = BigEndianBitConverter.ToUInt32(header, (int)(offset1 + i * 8 + 0)) << 2; - fields.firstPartitions[i].type = BigEndianBitConverter.ToUInt32(header, (int)(offset1 + i * 8 + 4)); + fields.firstPartitions[i].offset = + BigEndianBitConverter.ToUInt32(header, (int)(offset1 + i * 8 + 0)) << 2; + fields.firstPartitions[i].type = + BigEndianBitConverter.ToUInt32(header, (int)(offset1 + i * 8 + 4)); } } @@ -160,8 +153,10 @@ namespace DiscImageChef.Filesystems { if((offset1 + i * 8 + 8) < 0x50000) { - fields.firstPartitions[i].offset = BigEndianBitConverter.ToUInt32(header, (int)(offset2 + i * 8 + 0)) << 2; - fields.firstPartitions[i].type = BigEndianBitConverter.ToUInt32(header, (int)(offset2 + i * 8 + 4)); + fields.firstPartitions[i].offset = + BigEndianBitConverter.ToUInt32(header, (int)(offset2 + i * 8 + 0)) << 2; + fields.firstPartitions[i].type = + BigEndianBitConverter.ToUInt32(header, (int)(offset2 + i * 8 + 4)); } } @@ -169,8 +164,10 @@ namespace DiscImageChef.Filesystems { if((offset1 + i * 8 + 8) < 0x50000) { - fields.firstPartitions[i].offset = BigEndianBitConverter.ToUInt32(header, (int)(offset3 + i * 8 + 0)) << 2; - fields.firstPartitions[i].type = BigEndianBitConverter.ToUInt32(header, (int)(offset3 + i * 8 + 4)); + fields.firstPartitions[i].offset = + BigEndianBitConverter.ToUInt32(header, (int)(offset3 + i * 8 + 0)) << 2; + fields.firstPartitions[i].type = + BigEndianBitConverter.ToUInt32(header, (int)(offset3 + i * 8 + 4)); } } @@ -178,8 +175,10 @@ namespace DiscImageChef.Filesystems { if((offset1 + i * 8 + 8) < 0x50000) { - fields.firstPartitions[i].offset = BigEndianBitConverter.ToUInt32(header, (int)(offset4 + i * 8 + 0)) << 2; - fields.firstPartitions[i].type = BigEndianBitConverter.ToUInt32(header, (int)(offset4 + i * 8 + 4)); + fields.firstPartitions[i].offset = + BigEndianBitConverter.ToUInt32(header, (int)(offset4 + i * 8 + 0)) << 2; + fields.firstPartitions[i].type = + BigEndianBitConverter.ToUInt32(header, (int)(offset4 + i * 8 + 4)); } } @@ -220,24 +219,33 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("Nintendo plugin", "fstMax = {0}", fields.fstMax); for(int i = 0; i < fields.firstPartitions.Length; i++) { - DicConsole.DebugWriteLine("Nintendo plugin", "firstPartitions[{1}].offset = {0}", fields.firstPartitions[i].offset, i); - DicConsole.DebugWriteLine("Nintendo plugin", "firstPartitions[{1}].type = {0}", fields.firstPartitions[i].type, i); + DicConsole.DebugWriteLine("Nintendo plugin", "firstPartitions[{1}].offset = {0}", + fields.firstPartitions[i].offset, i); + DicConsole.DebugWriteLine("Nintendo plugin", "firstPartitions[{1}].type = {0}", + fields.firstPartitions[i].type, i); } for(int i = 0; i < fields.secondPartitions.Length; i++) { - DicConsole.DebugWriteLine("Nintendo plugin", "secondPartitions[{1}].offset = {0}", fields.secondPartitions[i].offset, i); - DicConsole.DebugWriteLine("Nintendo plugin", "secondPartitions[{1}].type = {0}", fields.secondPartitions[i].type, i); + DicConsole.DebugWriteLine("Nintendo plugin", "secondPartitions[{1}].offset = {0}", + fields.secondPartitions[i].offset, i); + DicConsole.DebugWriteLine("Nintendo plugin", "secondPartitions[{1}].type = {0}", + fields.secondPartitions[i].type, i); } for(int i = 0; i < fields.thirdPartitions.Length; i++) { - DicConsole.DebugWriteLine("Nintendo plugin", "thirdPartitions[{1}].offset = {0}", fields.thirdPartitions[i].offset, i); - DicConsole.DebugWriteLine("Nintendo plugin", "thirdPartitions[{1}].type = {0}", fields.thirdPartitions[i].type, i); + DicConsole.DebugWriteLine("Nintendo plugin", "thirdPartitions[{1}].offset = {0}", + fields.thirdPartitions[i].offset, i); + DicConsole.DebugWriteLine("Nintendo plugin", "thirdPartitions[{1}].type = {0}", + fields.thirdPartitions[i].type, i); } for(int i = 0; i < fields.fourthPartitions.Length; i++) { - DicConsole.DebugWriteLine("Nintendo plugin", "fourthPartitions[{1}].offset = {0}", fields.fourthPartitions[i].offset, i); - DicConsole.DebugWriteLine("Nintendo plugin", "fourthPartitions[{1}].type = {0}", fields.fourthPartitions[i].type, i); + DicConsole.DebugWriteLine("Nintendo plugin", "fourthPartitions[{1}].offset = {0}", + fields.fourthPartitions[i].offset, i); + DicConsole.DebugWriteLine("Nintendo plugin", "fourthPartitions[{1}].type = {0}", + fields.fourthPartitions[i].type, i); } + DicConsole.DebugWriteLine("Nintendo plugin", "region = {0}", fields.region); DicConsole.DebugWriteLine("Nintendo plugin", "japanAge = {0}", fields.japanAge); DicConsole.DebugWriteLine("Nintendo plugin", "usaAge = {0}", fields.usaAge); @@ -250,32 +258,38 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("Nintendo plugin", "koreaAge = {0}", fields.koreaAge); sbInformation.AppendLine("Nintendo optical filesystem"); - if(wii) - sbInformation.AppendLine("Nintendo Wii Optical Disc"); - else - sbInformation.AppendLine("Nintendo GameCube Optical Disc"); + if(wii) sbInformation.AppendLine("Nintendo Wii Optical Disc"); + else sbInformation.AppendLine("Nintendo GameCube Optical Disc"); sbInformation.AppendFormat("Disc ID is {0}", fields.discID).AppendLine(); sbInformation.AppendFormat("Disc is a {0} disc", DiscTypeToString(fields.discType)).AppendLine(); sbInformation.AppendFormat("Disc region is {0}", RegionCodeToString(fields.regionCode)).AppendLine(); sbInformation.AppendFormat("Published by {0}", PublisherCodeToString(fields.publisherCode)).AppendLine(); if(fields.discNumber > 0) sbInformation.AppendFormat("Disc number {0} of a multi-disc set", fields.discNumber + 1).AppendLine(); - if(fields.streaming) - sbInformation.AppendLine("Disc is prepared for audio streaming"); + if(fields.streaming) sbInformation.AppendLine("Disc is prepared for audio streaming"); if(fields.streamBufferSize > 0) - sbInformation.AppendFormat("Audio streaming buffer size is {0} bytes", fields.streamBufferSize).AppendLine(); + sbInformation.AppendFormat("Audio streaming buffer size is {0} bytes", fields.streamBufferSize) + .AppendLine(); sbInformation.AppendFormat("Title: {0}", fields.title).AppendLine(); if(wii) { for(int i = 0; i < fields.firstPartitions.Length; i++) - sbInformation.AppendFormat("First {0} partition starts at sector {1}", PartitionTypeToString(fields.firstPartitions[i].type), fields.firstPartitions[i].offset / 2048).AppendLine(); + sbInformation.AppendFormat("First {0} partition starts at sector {1}", + PartitionTypeToString(fields.firstPartitions[i].type), + fields.firstPartitions[i].offset / 2048).AppendLine(); for(int i = 0; i < fields.secondPartitions.Length; i++) - sbInformation.AppendFormat("Second {0} partition starts at sector {1}", PartitionTypeToString(fields.secondPartitions[i].type), fields.secondPartitions[i].offset / 2048).AppendLine(); + sbInformation.AppendFormat("Second {0} partition starts at sector {1}", + PartitionTypeToString(fields.secondPartitions[i].type), + fields.secondPartitions[i].offset / 2048).AppendLine(); for(int i = 0; i < fields.thirdPartitions.Length; i++) - sbInformation.AppendFormat("Third {0} partition starts at sector {1}", PartitionTypeToString(fields.thirdPartitions[i].type), fields.thirdPartitions[i].offset / 2048).AppendLine(); + sbInformation.AppendFormat("Third {0} partition starts at sector {1}", + PartitionTypeToString(fields.thirdPartitions[i].type), + fields.thirdPartitions[i].offset / 2048).AppendLine(); for(int i = 0; i < fields.fourthPartitions.Length; i++) - sbInformation.AppendFormat("Fourth {0} partition starts at sector {1}", PartitionTypeToString(fields.fourthPartitions[i].type), fields.fourthPartitions[i].offset / 2048).AppendLine(); + sbInformation.AppendFormat("Fourth {0} partition starts at sector {1}", + PartitionTypeToString(fields.fourthPartitions[i].type), + fields.fourthPartitions[i].offset / 2048).AppendLine(); // sbInformation.AppendFormat("Region byte is {0}", fields.region).AppendLine(); if((fields.japanAge & 0x80) != 0x80) @@ -298,16 +312,15 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("Korea age rating is {0}", fields.koreaAge).AppendLine(); } else - sbInformation.AppendFormat("FST starts at {0} and has {1} bytes", fields.fstOff, fields.fstSize).AppendLine(); + sbInformation.AppendFormat("FST starts at {0} and has {1} bytes", fields.fstOff, fields.fstSize) + .AppendLine(); information = sbInformation.ToString(); xmlFSType.Bootable = true; xmlFSType.Clusters = (long)((imagePlugin.GetSectors() * imagePlugin.GetSectorSize()) / 2048); xmlFSType.ClusterSize = 2048; - if(wii) - xmlFSType.Type = "Nintendo Wii filesystem"; - else - xmlFSType.Type = "Nintendo Gamecube filesystem"; + if(wii) xmlFSType.Type = "Nintendo Wii filesystem"; + else xmlFSType.Type = "Nintendo Gamecube filesystem"; xmlFSType.VolumeName = fields.title; xmlFSType.VolumeSerial = fields.discID; } @@ -356,46 +369,27 @@ namespace DiscImageChef.Filesystems { switch(discType) { - case "C": - return "Commodore 64 Virtual Console"; - case "D": - return "Demo"; - case "E": - return "Neo-Geo Virtual Console"; - case "F": - return "NES Virtual Console"; - case "G": - return "Gamecube"; - case "H": - return "Wii channel"; - case "J": - return "Super Nintendo Virtual Console"; - case "L": - return "Master System Virtual Console"; - case "M": - return "Megadrive Virtual Console"; - case "N": - return "Nintendo 64 Virtual Console"; - case "P": - return "Promotional or TurboGrafx Virtual Console"; - case "Q": - return "TurboGrafx CD Virtual Console"; + case "C": return "Commodore 64 Virtual Console"; + case "D": return "Demo"; + case "E": return "Neo-Geo Virtual Console"; + case "F": return "NES Virtual Console"; + case "G": return "Gamecube"; + case "H": return "Wii channel"; + case "J": return "Super Nintendo Virtual Console"; + case "L": return "Master System Virtual Console"; + case "M": return "Megadrive Virtual Console"; + case "N": return "Nintendo 64 Virtual Console"; + case "P": return "Promotional or TurboGrafx Virtual Console"; + case "Q": return "TurboGrafx CD Virtual Console"; case "R": - case "S": - return "Wii"; - case "U": - return "Utility"; - case "W": - return "WiiWare"; - case "X": - return "MSX Virtual Console or WiiWare demo"; + case "S": return "Wii"; + case "U": return "Utility"; + case "W": return "WiiWare"; + case "X": return "MSX Virtual Console or WiiWare demo"; case "0": - case "1": - return "Diagnostic"; - case "4": - return "Wii Backup"; - case "_": - return "WiiFit"; + case "1": return "Diagnostic"; + case "4": return "Wii Backup"; + case "_": return "WiiFit"; } return string.Format("unknown type '{0}'", discType); @@ -405,34 +399,22 @@ namespace DiscImageChef.Filesystems { switch(regionCode) { - case "A": - return "any region"; - case "D": - return "Germany"; + case "A": return "any region"; + case "D": return "Germany"; case "N": - case "E": - return "USA"; - case "F": - return "France"; - case "I": - return "Italy"; - case "J": - return "Japan"; + case "E": return "USA"; + case "F": return "France"; + case "I": return "Italy"; + case "J": return "Japan"; case "K": - case "Q": - return "Korea"; + case "Q": return "Korea"; case "L": case "M": - case "P": - return "PAL"; - case "R": - return "Russia"; - case "S": - return "Spain"; - case "T": - return "Taiwan"; - case "U": - return "Australia"; + case "P": return "PAL"; + case "R": return "Russia"; + case "S": return "Spain"; + case "T": return "Taiwan"; + case "U": return "Australia"; } return string.Format("unknown code '{0}'", regionCode); @@ -442,48 +424,27 @@ namespace DiscImageChef.Filesystems { switch(publisherCode) { - case "01": - return "Nintendo"; - case "08": - return "CAPCOM"; - case "41": - return "Ubisoft"; - case "4F": - return "Eidos"; - case "51": - return "Acclaim"; - case "52": - return "Activision"; - case "5D": - return "Midway"; - case "5G": - return "Hudson"; - case "64": - return "LucasArts"; - case "69": - return "Electronic Arts"; - case "6S": - return "TDK Mediactive"; - case "8P": - return "SEGA"; - case "A4": - return "Mirage Studios"; - case "AF": - return "Namco"; - case "B2": - return "Bandai"; - case "DA": - return "Tomy"; - case "EM": - return "Konami"; - case "70": - return "Atari"; - case "4Q": - return "Disney Interactive"; - case "GD": - return "Square Enix"; - case "7D": - return "Sierra"; + case "01": return "Nintendo"; + case "08": return "CAPCOM"; + case "41": return "Ubisoft"; + case "4F": return "Eidos"; + case "51": return "Acclaim"; + case "52": return "Activision"; + case "5D": return "Midway"; + case "5G": return "Hudson"; + case "64": return "LucasArts"; + case "69": return "Electronic Arts"; + case "6S": return "TDK Mediactive"; + case "8P": return "SEGA"; + case "A4": return "Mirage Studios"; + case "AF": return "Namco"; + case "B2": return "Bandai"; + case "DA": return "Tomy"; + case "EM": return "Konami"; + case "70": return "Atari"; + case "4Q": return "Disney Interactive"; + case "GD": return "Square Enix"; + case "7D": return "Sierra"; } return string.Format("Unknown publisher '{0}'", publisherCode); @@ -493,12 +454,9 @@ namespace DiscImageChef.Filesystems { switch(type) { - case 0: - return "data"; - case 1: - return "update"; - case 2: - return "channel"; + case 0: return "data"; + case 1: return "update"; + case 2: return "channel"; } return string.Format("unknown type {0}", type); @@ -564,5 +522,4 @@ namespace DiscImageChef.Filesystems return Errno.NotImplemented; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ODS.cs b/DiscImageChef.Filesystems/ODS.cs index f4c5886a..02188ab2 100644 --- a/DiscImageChef.Filesystems/ODS.cs +++ b/DiscImageChef.Filesystems/ODS.cs @@ -61,29 +61,23 @@ namespace DiscImageChef.Filesystems { Name = "Files-11 On-Disk Structure"; PluginUUID = new Guid("de20633c-8021-4384-aeb0-83b0df14491f"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } public ODS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Files-11 On-Disk Structure"; PluginUUID = new Guid("de20633c-8021-4384-aeb0-83b0df14491f"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((2 + partition.Start) >= partition.End) - return false; + if((2 + partition.Start) >= partition.End) return false; - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; byte[] magic_b = new byte[12]; string magic; @@ -94,14 +88,12 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("Files-11 plugin", "magic: \"{0}\"", magic); - if(magic == "DECFILE11A " || magic == "DECFILE11B ") - return true; + if(magic == "DECFILE11A " || magic == "DECFILE11B ") return true; // Optical disc if(imagePlugin.ImageInfo.xmlMediaType == ImagePlugins.XmlMediaType.OpticalDisc) { - if(hb_sector.Length < 0x400) - return false; + if(hb_sector.Length < 0x400) return false; hb_sector = imagePlugin.ReadSector(partition.Start); @@ -110,14 +102,14 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("Files-11 plugin", "unaligned magic: \"{0}\"", magic); - if(magic == "DECFILE11A " || magic == "DECFILE11B ") - return true; + if(magic == "DECFILE11A " || magic == "DECFILE11B ") return true; } return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -135,11 +127,10 @@ namespace DiscImageChef.Filesystems // Optical disc if(imagePlugin.ImageInfo.xmlMediaType == ImagePlugins.XmlMediaType.OpticalDisc && - StringHandlers.CToString(homeblock.format) != "DECFILE11A " && - StringHandlers.CToString(homeblock.format) != "DECFILE11B ") + StringHandlers.CToString(homeblock.format) != "DECFILE11A " && + StringHandlers.CToString(homeblock.format) != "DECFILE11B ") { - if(hb_sector.Length < 0x400) - return; + if(hb_sector.Length < 0x400) return; byte[] tmp = imagePlugin.ReadSector(partition.Start); hb_sector = new byte[0x200]; @@ -149,35 +140,51 @@ namespace DiscImageChef.Filesystems homeblock = (ODSHomeBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ODSHomeBlock)); handle.Free(); - if(StringHandlers.CToString(homeblock.format) != "DECFILE11A " && StringHandlers.CToString(homeblock.format) != "DECFILE11B ") - return; + if(StringHandlers.CToString(homeblock.format) != "DECFILE11A " && + StringHandlers.CToString(homeblock.format) != "DECFILE11B ") return; } - if((homeblock.struclev & 0xFF00) != 0x0200 || (homeblock.struclev & 0xFF) != 1 || StringHandlers.CToString(homeblock.format) != "DECFILE11B ") + if((homeblock.struclev & 0xFF00) != 0x0200 || (homeblock.struclev & 0xFF) != 1 || + StringHandlers.CToString(homeblock.format) != "DECFILE11B ") sb.AppendLine("The following information may be incorrect for this volume."); - if(homeblock.resfiles < 5 || homeblock.devtype != 0) - sb.AppendLine("This volume may be corrupted."); + if(homeblock.resfiles < 5 || homeblock.devtype != 0) sb.AppendLine("This volume may be corrupted."); - sb.AppendFormat("Volume format is {0}", StringHandlers.SpacePaddedToString(homeblock.format, CurrentEncoding)).AppendLine(); - sb.AppendFormat("Volume is Level {0} revision {1}", (homeblock.struclev & 0xFF00) >> 8, homeblock.struclev & 0xFF).AppendLine(); - sb.AppendFormat("Lowest structure in the volume is Level {0}, revision {1}", (homeblock.lowstruclev & 0xFF00) >> 8, homeblock.lowstruclev & 0xFF).AppendLine(); - sb.AppendFormat("Highest structure in the volume is Level {0}, revision {1}", (homeblock.highstruclev & 0xFF00) >> 8, homeblock.highstruclev & 0xFF).AppendLine(); - sb.AppendFormat("{0} sectors per cluster ({1} bytes)", homeblock.cluster, homeblock.cluster * 512).AppendLine(); - sb.AppendFormat("This home block is on sector {0} (VBN {1})", homeblock.homelbn, homeblock.homevbn).AppendLine(); - sb.AppendFormat("Secondary home block is on sector {0} (VBN {1})", homeblock.alhomelbn, homeblock.alhomevbn).AppendLine(); - sb.AppendFormat("Volume bitmap starts in sector {0} (VBN {1})", homeblock.ibmaplbn, homeblock.ibmapvbn).AppendLine(); - sb.AppendFormat("Volume bitmap runs for {0} sectors ({1} bytes)", homeblock.ibmapsize, homeblock.ibmapsize * 512).AppendLine(); - sb.AppendFormat("Backup INDEXF.SYS;1 is in sector {0} (VBN {1})", homeblock.altidxlbn, homeblock.altidxvbn).AppendLine(); + sb.AppendFormat("Volume format is {0}", + StringHandlers.SpacePaddedToString(homeblock.format, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Volume is Level {0} revision {1}", (homeblock.struclev & 0xFF00) >> 8, + homeblock.struclev & 0xFF).AppendLine(); + sb.AppendFormat("Lowest structure in the volume is Level {0}, revision {1}", + (homeblock.lowstruclev & 0xFF00) >> 8, homeblock.lowstruclev & 0xFF).AppendLine(); + sb.AppendFormat("Highest structure in the volume is Level {0}, revision {1}", + (homeblock.highstruclev & 0xFF00) >> 8, homeblock.highstruclev & 0xFF).AppendLine(); + sb.AppendFormat("{0} sectors per cluster ({1} bytes)", homeblock.cluster, homeblock.cluster * 512) + .AppendLine(); + sb.AppendFormat("This home block is on sector {0} (VBN {1})", homeblock.homelbn, homeblock.homevbn) + .AppendLine(); + sb.AppendFormat("Secondary home block is on sector {0} (VBN {1})", homeblock.alhomelbn, homeblock.alhomevbn) + .AppendLine(); + sb.AppendFormat("Volume bitmap starts in sector {0} (VBN {1})", homeblock.ibmaplbn, homeblock.ibmapvbn) + .AppendLine(); + sb.AppendFormat("Volume bitmap runs for {0} sectors ({1} bytes)", homeblock.ibmapsize, + homeblock.ibmapsize * 512).AppendLine(); + sb.AppendFormat("Backup INDEXF.SYS;1 is in sector {0} (VBN {1})", homeblock.altidxlbn, homeblock.altidxvbn) + .AppendLine(); sb.AppendFormat("{0} maximum files on the volume", homeblock.maxfiles).AppendLine(); sb.AppendFormat("{0} reserved files", homeblock.resfiles).AppendLine(); - if(homeblock.rvn > 0 && homeblock.setcount > 0 && StringHandlers.CToString(homeblock.strucname) != " ") - sb.AppendFormat("Volume is {0} of {1} in set \"{2}\".", homeblock.rvn, homeblock.setcount, StringHandlers.SpacePaddedToString(homeblock.strucname, CurrentEncoding)).AppendLine(); - sb.AppendFormat("Volume owner is \"{0}\" (ID 0x{1:X8})", StringHandlers.SpacePaddedToString(homeblock.ownername, CurrentEncoding), homeblock.volowner).AppendLine(); - sb.AppendFormat("Volume label: \"{0}\"", StringHandlers.SpacePaddedToString(homeblock.volname, CurrentEncoding)).AppendLine(); + if(homeblock.rvn > 0 && homeblock.setcount > 0 && + StringHandlers.CToString(homeblock.strucname) != " ") + sb.AppendFormat("Volume is {0} of {1} in set \"{2}\".", homeblock.rvn, homeblock.setcount, + StringHandlers.SpacePaddedToString(homeblock.strucname, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Volume owner is \"{0}\" (ID 0x{1:X8})", + StringHandlers.SpacePaddedToString(homeblock.ownername, CurrentEncoding), + homeblock.volowner).AppendLine(); + sb.AppendFormat("Volume label: \"{0}\"", + StringHandlers.SpacePaddedToString(homeblock.volname, CurrentEncoding)).AppendLine(); sb.AppendFormat("Drive serial number: 0x{0:X8}", homeblock.serialnum).AppendLine(); sb.AppendFormat("Volume was created on {0}", DateHandlers.VMSToDateTime(homeblock.credate)).AppendLine(); if(homeblock.revdate > 0) - sb.AppendFormat("Volume was last modified on {0}", DateHandlers.VMSToDateTime(homeblock.revdate)).AppendLine(); + sb.AppendFormat("Volume was last modified on {0}", DateHandlers.VMSToDateTime(homeblock.revdate)) + .AppendLine(); if(homeblock.copydate > 0) sb.AppendFormat("Volume copied on {0}", DateHandlers.VMSToDateTime(homeblock.copydate)).AppendLine(); sb.AppendFormat("Checksums: 0x{0:X4} and 0x{1:X4}", homeblock.checksum1, homeblock.checksum2).AppendLine(); @@ -185,86 +192,49 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Window: {0}", homeblock.window).AppendLine(); sb.AppendFormat("Cached directores: {0}", homeblock.lru_lim).AppendLine(); sb.AppendFormat("Default allocation: {0} blocks", homeblock.extend).AppendLine(); - if((homeblock.volchar & 0x01) == 0x01) - sb.AppendLine("Readings should be verified"); - if((homeblock.volchar & 0x02) == 0x02) - sb.AppendLine("Writings should be verified"); - if((homeblock.volchar & 0x04) == 0x04) - sb.AppendLine("Files should be erased or overwritten when deleted"); - if((homeblock.volchar & 0x08) == 0x08) - sb.AppendLine("Highwater mark is to be disabled"); - if((homeblock.volchar & 0x10) == 0x10) - sb.AppendLine("Classification checks are enabled"); + if((homeblock.volchar & 0x01) == 0x01) sb.AppendLine("Readings should be verified"); + if((homeblock.volchar & 0x02) == 0x02) sb.AppendLine("Writings should be verified"); + if((homeblock.volchar & 0x04) == 0x04) sb.AppendLine("Files should be erased or overwritten when deleted"); + if((homeblock.volchar & 0x08) == 0x08) sb.AppendLine("Highwater mark is to be disabled"); + if((homeblock.volchar & 0x10) == 0x10) sb.AppendLine("Classification checks are enabled"); sb.AppendLine("Volume permissions (r = read, w = write, c = create, d = delete)"); sb.AppendLine("System, owner, group, world"); // System - if((homeblock.protect & 0x1000) == 0x1000) - sb.Append("-"); - else - sb.Append("r"); - if((homeblock.protect & 0x2000) == 0x2000) - sb.Append("-"); - else - sb.Append("w"); - if((homeblock.protect & 0x4000) == 0x4000) - sb.Append("-"); - else - sb.Append("c"); - if((homeblock.protect & 0x8000) == 0x8000) - sb.Append("-"); - else - sb.Append("d"); + if((homeblock.protect & 0x1000) == 0x1000) sb.Append("-"); + else sb.Append("r"); + if((homeblock.protect & 0x2000) == 0x2000) sb.Append("-"); + else sb.Append("w"); + if((homeblock.protect & 0x4000) == 0x4000) sb.Append("-"); + else sb.Append("c"); + if((homeblock.protect & 0x8000) == 0x8000) sb.Append("-"); + else sb.Append("d"); // Owner - if((homeblock.protect & 0x100) == 0x100) - sb.Append("-"); - else - sb.Append("r"); - if((homeblock.protect & 0x200) == 0x200) - sb.Append("-"); - else - sb.Append("w"); - if((homeblock.protect & 0x400) == 0x400) - sb.Append("-"); - else - sb.Append("c"); - if((homeblock.protect & 0x800) == 0x800) - sb.Append("-"); - else - sb.Append("d"); + if((homeblock.protect & 0x100) == 0x100) sb.Append("-"); + else sb.Append("r"); + if((homeblock.protect & 0x200) == 0x200) sb.Append("-"); + else sb.Append("w"); + if((homeblock.protect & 0x400) == 0x400) sb.Append("-"); + else sb.Append("c"); + if((homeblock.protect & 0x800) == 0x800) sb.Append("-"); + else sb.Append("d"); // Group - if((homeblock.protect & 0x10) == 0x10) - sb.Append("-"); - else - sb.Append("r"); - if((homeblock.protect & 0x20) == 0x20) - sb.Append("-"); - else - sb.Append("w"); - if((homeblock.protect & 0x40) == 0x40) - sb.Append("-"); - else - sb.Append("c"); - if((homeblock.protect & 0x80) == 0x80) - sb.Append("-"); - else - sb.Append("d"); + if((homeblock.protect & 0x10) == 0x10) sb.Append("-"); + else sb.Append("r"); + if((homeblock.protect & 0x20) == 0x20) sb.Append("-"); + else sb.Append("w"); + if((homeblock.protect & 0x40) == 0x40) sb.Append("-"); + else sb.Append("c"); + if((homeblock.protect & 0x80) == 0x80) sb.Append("-"); + else sb.Append("d"); // World (other) - if((homeblock.protect & 0x1) == 0x1) - sb.Append("-"); - else - sb.Append("r"); - if((homeblock.protect & 0x2) == 0x2) - sb.Append("-"); - else - sb.Append("w"); - if((homeblock.protect & 0x4) == 0x4) - sb.Append("-"); - else - sb.Append("c"); - if((homeblock.protect & 0x8) == 0x8) - sb.Append("-"); - else - sb.Append("d"); + if((homeblock.protect & 0x1) == 0x1) sb.Append("-"); + else sb.Append("r"); + if((homeblock.protect & 0x2) == 0x2) sb.Append("-"); + else sb.Append("w"); + if((homeblock.protect & 0x4) == 0x4) sb.Append("-"); + else sb.Append("c"); + if((homeblock.protect & 0x8) == 0x8) sb.Append("-"); + else sb.Append("d"); sb.AppendLine(); @@ -359,11 +329,9 @@ namespace DiscImageChef.Filesystems /// <summary>0x058, Last modification date</summary> public ulong revdate; /// <summary>0x060, Minimum security class, 20 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] min_class; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] min_class; /// <summary>0x074, Maximum security class, 20 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] max_class; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] max_class; /// <summary>0x088, File lookup table FID</summary> public ushort filetab_fid1; /// <summary>0x08A, File lookup table FID</summary> @@ -377,22 +345,17 @@ namespace DiscImageChef.Filesystems /// <summary>0x092, Volume copy date (??)</summary> public ulong copydate; /// <summary>0x09A, 302 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 302)] - public byte[] reserved1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 302)] public byte[] reserved1; /// <summary>0x1C8, Physical drive serial number</summary> public uint serialnum; /// <summary>0x1CC, Name of the volume set, 12 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] strucname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] strucname; /// <summary>0x1D8, Volume label, 12 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] volname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] volname; /// <summary>0x1E4, Name of the volume owner, 12 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] ownername; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] ownername; /// <summary>0x1F0, ODS-2 defines it as "DECFILE11B", 12 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] format; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] format; /// <summary>0x1FC, Reserved</summary> public ushort reserved2; /// <summary>0x1FE, Checksum of preceding 255 words (16 bit units)</summary> diff --git a/DiscImageChef.Filesystems/Opera.cs b/DiscImageChef.Filesystems/Opera.cs index caa32173..a6c93fe2 100644 --- a/DiscImageChef.Filesystems/Opera.cs +++ b/DiscImageChef.Filesystems/Opera.cs @@ -65,8 +65,7 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((2 + partition.Start) >= partition.End) - return false; + if((2 + partition.Start) >= partition.End) return false; byte[] sb_sector = imagePlugin.ReadSector(0 + partition.Start); @@ -78,13 +77,13 @@ namespace DiscImageChef.Filesystems Array.Copy(sb_sector, 0x001, sync_bytes, 0, 5); record_version = sb_sector[0x006]; - if(record_type != 1 || record_version != 1) - return false; - return Encoding.ASCII.GetString(sync_bytes) == "ZZZZZ"; + if(record_type != 1 || record_version != 1) return false; + return Encoding.ASCII.GetString(sync_bytes) == "ZZZZZ"; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; StringBuilder SuperBlockMetadata = new StringBuilder(); @@ -95,32 +94,43 @@ namespace DiscImageChef.Filesystems byte[] cString = new byte[32]; sb.sync_bytes = new byte[5]; - - if(sb.record_type != 1 || sb.record_version != 1) - return; - if(Encoding.ASCII.GetString(sb.sync_bytes) != "ZZZZZ") - return; + if(sb.record_type != 1 || sb.record_version != 1) return; + if(Encoding.ASCII.GetString(sb.sync_bytes) != "ZZZZZ") return; SuperBlockMetadata.AppendFormat("Opera filesystem disc.").AppendLine(); - if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_label, CurrentEncoding))) - SuperBlockMetadata.AppendFormat("Volume label: {0}", StringHandlers.CToString(sb.volume_label, CurrentEncoding)).AppendLine(); - if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_comment, CurrentEncoding))) - SuperBlockMetadata.AppendFormat("Volume comment: {0}", StringHandlers.CToString(sb.volume_comment, CurrentEncoding)).AppendLine(); + if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_label, CurrentEncoding))) + SuperBlockMetadata + .AppendFormat("Volume label: {0}", StringHandlers.CToString(sb.volume_label, CurrentEncoding)) + .AppendLine(); + if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_comment, CurrentEncoding))) + SuperBlockMetadata.AppendFormat("Volume comment: {0}", + StringHandlers.CToString(sb.volume_comment, CurrentEncoding)) + .AppendLine(); SuperBlockMetadata.AppendFormat("Volume identifier: 0x{0:X8}", sb.volume_id).AppendLine(); SuperBlockMetadata.AppendFormat("Block size: {0} bytes", sb.block_size).AppendLine(); - if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) + if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || + imagePlugin.GetSectorSize() == 2448) { if(sb.block_size != 2048) - SuperBlockMetadata.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/block", sb.block_size, 2048); + SuperBlockMetadata + .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/block", + sb.block_size, 2048); } else if(imagePlugin.GetSectorSize() != sb.block_size) - SuperBlockMetadata.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/block", sb.block_size, imagePlugin.GetSectorSize()); - SuperBlockMetadata.AppendFormat("Volume size: {0} blocks, {1} bytes", sb.block_count, sb.block_size * sb.block_count).AppendLine(); + SuperBlockMetadata + .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/block", + sb.block_size, imagePlugin.GetSectorSize()); + SuperBlockMetadata + .AppendFormat("Volume size: {0} blocks, {1} bytes", sb.block_count, sb.block_size * sb.block_count) + .AppendLine(); if((ulong)sb.block_count > imagePlugin.GetSectors()) - SuperBlockMetadata.AppendFormat("WARNING: Filesystem indicates {0} blocks while device indicates {1} blocks", sb.block_count, imagePlugin.GetSectors()); + SuperBlockMetadata + .AppendFormat("WARNING: Filesystem indicates {0} blocks while device indicates {1} blocks", + sb.block_count, imagePlugin.GetSectors()); SuperBlockMetadata.AppendFormat("Root directory identifier: 0x{0:X8}", sb.root_dirid).AppendLine(); SuperBlockMetadata.AppendFormat("Root directory block size: {0} bytes", sb.rootdir_bsize).AppendLine(); - SuperBlockMetadata.AppendFormat("Root directory size: {0} blocks, {1} bytes", sb.rootdir_blocks, sb.rootdir_bsize * sb.rootdir_blocks).AppendLine(); + SuperBlockMetadata.AppendFormat("Root directory size: {0} blocks, {1} bytes", sb.rootdir_blocks, + sb.rootdir_bsize * sb.rootdir_blocks).AppendLine(); SuperBlockMetadata.AppendFormat("Last root directory copy: {0}", sb.last_root_copy).AppendLine(); information = SuperBlockMetadata.ToString(); @@ -140,18 +150,15 @@ namespace DiscImageChef.Filesystems /// <summary>0x000, Record type, must be 1</summary> public byte record_type; /// <summary>0x001, 5 bytes, "ZZZZZ"</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] sync_bytes; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] sync_bytes; /// <summary>0x006, Record version, must be 1</summary> public byte record_version; /// <summary>0x007, Volume flags</summary> public byte volume_flags; /// <summary>0x008, 32 bytes, volume comment</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] volume_comment; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] volume_comment; /// <summary>0x028, 32 bytes, volume label</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] volume_label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] volume_label; /// <summary>0x048, Volume ID</summary> public int volume_id; /// <summary>0x04C, Block size in bytes</summary> diff --git a/DiscImageChef.Filesystems/PCEngine.cs b/DiscImageChef.Filesystems/PCEngine.cs index b4312257..aa0ae0ca 100644 --- a/DiscImageChef.Filesystems/PCEngine.cs +++ b/DiscImageChef.Filesystems/PCEngine.cs @@ -50,26 +50,21 @@ namespace DiscImageChef.Filesystems { Name = "PC Engine CD Plugin"; PluginUUID = new Guid("e5ee6d7c-90fa-49bd-ac89-14ef750b8af3"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("shift_jis"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("shift_jis"); + else CurrentEncoding = encoding; } public PCEnginePlugin(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "PC Engine CD Plugin"; PluginUUID = new Guid("e5ee6d7c-90fa-49bd-ac89-14ef750b8af3"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("shift_jis"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("shift_jis"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((2 + partition.Start) >= partition.End) - return false; + if((2 + partition.Start) >= partition.End) return false; byte[] system_descriptor = new byte[23]; byte[] sector = imagePlugin.ReadSector(1 + partition.Start); @@ -79,7 +74,8 @@ namespace DiscImageChef.Filesystems return Encoding.ASCII.GetString(system_descriptor) == "PC Engine CD-ROM SYSTEM"; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; xmlFSType = new Schemas.FileSystemType(); diff --git a/DiscImageChef.Filesystems/PFS.cs b/DiscImageChef.Filesystems/PFS.cs index 0d293fcd..9f7faa97 100644 --- a/DiscImageChef.Filesystems/PFS.cs +++ b/DiscImageChef.Filesystems/PFS.cs @@ -51,20 +51,16 @@ namespace DiscImageChef.Filesystems { Name = "Professional File System"; PluginUUID = new Guid("68DE769E-D957-406A-8AE4-3781CA8CDA77"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } public PFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Professional File System"; PluginUUID = new Guid("68DE769E-D957-406A-8AE4-3781CA8CDA77"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } /// <summary> @@ -117,8 +113,7 @@ namespace DiscImageChef.Filesystems /// <summary> /// Volume label (Pascal string) /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] diskname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] diskname; /// <summary> /// Last reserved block /// </summary> @@ -192,8 +187,7 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Length < 3) - return false; + if(partition.Length < 3) return false; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -201,10 +195,12 @@ namespace DiscImageChef.Filesystems uint magic = BigEndianBitConverter.ToUInt32(sector, 0x00); - return magic == AFS_DISK || magic == PFS2_DISK || magic == PFS_DISK || magic == MUAF_DISK || magic == MUPFS_DISK; + return magic == AFS_DISK || magic == PFS2_DISK || magic == PFS_DISK || magic == MUAF_DISK || + magic == MUPFS_DISK; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { byte[] RootBlockSector = imagePlugin.ReadSector(2 + partition.Start); RootBlock rootBlock = new RootBlock(); @@ -236,15 +232,22 @@ namespace DiscImageChef.Filesystems sbInformation.AppendLine(); - sbInformation.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(rootBlock.diskname, CurrentEncoding)).AppendLine(); - sbInformation.AppendFormat("Volume has {0} free sectors of {1}", rootBlock.blocksfree, rootBlock.diskSize).AppendLine(); - sbInformation.AppendFormat("Volume created on {0}", DateHandlers.AmigaToDateTime(rootBlock.creationday, rootBlock.creationminute, rootBlock.creationtick)).AppendLine(); + sbInformation + .AppendFormat("Volume name: {0}", StringHandlers.PascalToString(rootBlock.diskname, CurrentEncoding)) + .AppendLine(); + sbInformation.AppendFormat("Volume has {0} free sectors of {1}", rootBlock.blocksfree, rootBlock.diskSize) + .AppendLine(); + sbInformation.AppendFormat("Volume created on {0}", + DateHandlers.AmigaToDateTime(rootBlock.creationday, rootBlock.creationminute, + rootBlock.creationtick)).AppendLine(); if(rootBlock.extension > 0) - sbInformation.AppendFormat("Root block extension resides at block {0}", rootBlock.extension).AppendLine(); + sbInformation.AppendFormat("Root block extension resides at block {0}", rootBlock.extension) + .AppendLine(); information = sbInformation.ToString(); - xmlFSType.CreationDate = DateHandlers.AmigaToDateTime(rootBlock.creationday, rootBlock.creationminute, rootBlock.creationtick); + xmlFSType.CreationDate = + DateHandlers.AmigaToDateTime(rootBlock.creationday, rootBlock.creationminute, rootBlock.creationtick); xmlFSType.CreationDateSpecified = true; xmlFSType.FreeClusters = rootBlock.blocksfree; xmlFSType.FreeClustersSpecified = true; diff --git a/DiscImageChef.Filesystems/ProDOS.cs b/DiscImageChef.Filesystems/ProDOS.cs index d0dc2163..c06d9d58 100644 --- a/DiscImageChef.Filesystems/ProDOS.cs +++ b/DiscImageChef.Filesystems/ProDOS.cs @@ -104,23 +104,22 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Length < 3) - return false; + if(partition.Length < 3) return false; // Blocks 0 and 1 are boot code byte[] rootDirectoryKeyBlock = imagePlugin.ReadSector(2 + partition.Start); bool APMFromHDDOnCD = false; - if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || imagePlugin.GetSectorSize() == 2048) + if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || + imagePlugin.GetSectorSize() == 2048) { byte[] tmp = imagePlugin.ReadSectors(partition.Start, 2); - foreach(int offset in new[] { 0, 0x200, 0x400, 0x600, 0x800, 0xA00 }) + foreach(int offset in new[] {0, 0x200, 0x400, 0x600, 0x800, 0xA00}) { if(BitConverter.ToUInt16(tmp, offset) == 0 && - (byte)((tmp[offset + 0x04] & ProDOSStorageTypeMask) >> 4) == RootDirectoryType && - tmp[offset + 0x23] == ProDOSEntryLength && - tmp[offset + 0x24] == ProDOSEntriesPerBlock) + (byte)((tmp[offset + 0x04] & ProDOSStorageTypeMask) >> 4) == RootDirectoryType && + tmp[offset + 0x23] == ProDOSEntryLength && tmp[offset + 0x24] == ProDOSEntriesPerBlock) { Array.Copy(tmp, offset, rootDirectoryKeyBlock, 0, 0x200); APMFromHDDOnCD = true; @@ -131,38 +130,34 @@ namespace DiscImageChef.Filesystems ushort prePointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0); DicConsole.DebugWriteLine("ProDOS plugin", "prePointer = {0}", prePointer); - if(prePointer != 0) - return false; + if(prePointer != 0) return false; byte storage_type = (byte)((rootDirectoryKeyBlock[0x04] & ProDOSStorageTypeMask) >> 4); DicConsole.DebugWriteLine("ProDOS plugin", "storage_type = {0}", storage_type); - if(storage_type != RootDirectoryType) - return false; + if(storage_type != RootDirectoryType) return false; byte entry_length = rootDirectoryKeyBlock[0x23]; DicConsole.DebugWriteLine("ProDOS plugin", "entry_length = {0}", entry_length); - if(entry_length != ProDOSEntryLength) - return false; + if(entry_length != ProDOSEntryLength) return false; byte entries_per_block = rootDirectoryKeyBlock[0x24]; DicConsole.DebugWriteLine("ProDOS plugin", "entries_per_block = {0}", entries_per_block); - if(entries_per_block != ProDOSEntriesPerBlock) - return false; + if(entries_per_block != ProDOSEntriesPerBlock) return false; ushort bit_map_pointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x27); DicConsole.DebugWriteLine("ProDOS plugin", "bit_map_pointer = {0}", bit_map_pointer); - if(bit_map_pointer > partition.End) - return false; + if(bit_map_pointer > partition.End) return false; ushort total_blocks = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x29); - if(APMFromHDDOnCD) - total_blocks /= 4; - - DicConsole.DebugWriteLine("ProDOS plugin", "{0} <= ({1} - {2} + 1)? {3}", total_blocks, partition.End, partition.Start, total_blocks <= (partition.End - partition.Start + 1)); + if(APMFromHDDOnCD) total_blocks /= 4; + + DicConsole.DebugWriteLine("ProDOS plugin", "{0} <= ({1} - {2} + 1)? {3}", total_blocks, partition.End, + partition.Start, total_blocks <= (partition.End - partition.Start + 1)); return total_blocks <= (partition.End - partition.Start + 1); } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { StringBuilder sbInformation = new StringBuilder(); @@ -171,16 +166,16 @@ namespace DiscImageChef.Filesystems bool APMFromHDDOnCD = false; - if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || imagePlugin.GetSectorSize() == 2048) + if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || + imagePlugin.GetSectorSize() == 2048) { byte[] tmp = imagePlugin.ReadSectors(partition.Start, 2); - foreach(int offset in new[] { 0, 0x200, 0x400, 0x600, 0x800, 0xA00 }) + foreach(int offset in new[] {0, 0x200, 0x400, 0x600, 0x800, 0xA00}) { if(BitConverter.ToUInt16(tmp, offset) == 0 && - (byte)((tmp[offset + 0x04] & ProDOSStorageTypeMask) >> 4) == RootDirectoryType && - tmp[offset + 0x23] == ProDOSEntryLength && - tmp[offset + 0x24] == ProDOSEntriesPerBlock) + (byte)((tmp[offset + 0x04] & ProDOSStorageTypeMask) >> 4) == RootDirectoryType && + tmp[offset + 0x23] == ProDOSEntryLength && tmp[offset + 0x24] == ProDOSEntriesPerBlock) { Array.Copy(tmp, offset, rootDirectoryKeyBlockBytes, 0, 0x200); APMFromHDDOnCD = true; @@ -199,7 +194,8 @@ namespace DiscImageChef.Filesystems rootDirectoryKeyBlock.zero = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x00); rootDirectoryKeyBlock.next_pointer = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x02); - rootDirectoryKeyBlock.header.storage_type = (byte)((rootDirectoryKeyBlockBytes[0x04] & ProDOSStorageTypeMask) >> 4); + rootDirectoryKeyBlock.header.storage_type = + (byte)((rootDirectoryKeyBlockBytes[0x04] & ProDOSStorageTypeMask) >> 4); rootDirectoryKeyBlock.header.name_length = (byte)(rootDirectoryKeyBlockBytes[0x04] & ProDOSNameLengthMask); temporal = new byte[rootDirectoryKeyBlock.header.name_length]; Array.Copy(rootDirectoryKeyBlockBytes, 0x05, temporal, 0, rootDirectoryKeyBlock.header.name_length); @@ -219,21 +215,19 @@ namespace DiscImageChef.Filesystems hour = (int)((temp_timestamp & ProDOSHourMask) >> 8); minute = (int)(temp_timestamp & ProDOSMinuteMask); year += 1900; - if(year < 1940) - year += 100; + if(year < 1940) year += 100; DicConsole.DebugWriteLine("ProDOS plugin", "temp_timestamp_left = 0x{0:X4}", temp_timestamp_left); DicConsole.DebugWriteLine("ProDOS plugin", "temp_timestamp_right = 0x{0:X4}", temp_timestamp_right); DicConsole.DebugWriteLine("ProDOS plugin", "temp_timestamp = 0x{0:X8}", temp_timestamp); - DicConsole.DebugWriteLine("ProDOS plugin", "Datetime field year {0}, month {1}, day {2}, hour {3}, minute {4}.", year, month, day, hour, minute); + DicConsole.DebugWriteLine("ProDOS plugin", + "Datetime field year {0}, month {1}, day {2}, hour {3}, minute {4}.", year, + month, day, hour, minute); rootDirectoryKeyBlock.header.creation_time = new DateTime(year, month, day, hour, minute, 0); dateCorrect = true; } - catch(ArgumentOutOfRangeException) - { - dateCorrect = false; - } + catch(ArgumentOutOfRangeException) { dateCorrect = false; } rootDirectoryKeyBlock.header.version = rootDirectoryKeyBlockBytes[0x20]; rootDirectoryKeyBlock.header.min_version = rootDirectoryKeyBlockBytes[0x21]; @@ -246,9 +240,11 @@ namespace DiscImageChef.Filesystems rootDirectoryKeyBlock.header.total_blocks = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x29); if(APMFromHDDOnCD) - sbInformation.AppendLine("ProDOS uses 512 bytes/sector while devices uses 2048 bytes/sector.").AppendLine(); + sbInformation.AppendLine("ProDOS uses 512 bytes/sector while devices uses 2048 bytes/sector.") + .AppendLine(); - if(rootDirectoryKeyBlock.header.version != ProDOSVersion1 || rootDirectoryKeyBlock.header.min_version != ProDOSVersion1) + if(rootDirectoryKeyBlock.header.version != ProDOSVersion1 || + rootDirectoryKeyBlock.header.min_version != ProDOSVersion1) { sbInformation.AppendLine("Warning! Detected unknown ProDOS version ProDOS filesystem."); sbInformation.AppendLine("All of the following information may be incorrect"); @@ -257,21 +253,30 @@ namespace DiscImageChef.Filesystems if(rootDirectoryKeyBlock.header.version == ProDOSVersion1) sbInformation.AppendLine("ProDOS version 1 used to create this volume."); else - sbInformation.AppendFormat("Unknown ProDOS version with field {0} used to create this volume.", rootDirectoryKeyBlock.header.version).AppendLine(); + sbInformation.AppendFormat("Unknown ProDOS version with field {0} used to create this volume.", + rootDirectoryKeyBlock.header.version).AppendLine(); if(rootDirectoryKeyBlock.header.min_version == ProDOSVersion1) sbInformation.AppendLine("ProDOS version 1 at least required for reading this volume."); else - sbInformation.AppendFormat("Unknown ProDOS version with field {0} is at least required for reading this volume.", rootDirectoryKeyBlock.header.min_version).AppendLine(); + sbInformation + .AppendFormat("Unknown ProDOS version with field {0} is at least required for reading this volume.", + rootDirectoryKeyBlock.header.min_version).AppendLine(); sbInformation.AppendFormat("Volume name is {0}", rootDirectoryKeyBlock.header.volume_name).AppendLine(); if(dateCorrect) - sbInformation.AppendFormat("Volume created on {0}", rootDirectoryKeyBlock.header.creation_time).AppendLine(); - sbInformation.AppendFormat("{0} bytes per directory entry", rootDirectoryKeyBlock.header.entry_length).AppendLine(); - sbInformation.AppendFormat("{0} entries per directory block", rootDirectoryKeyBlock.header.entries_per_block).AppendLine(); - sbInformation.AppendFormat("{0} files in root directory", rootDirectoryKeyBlock.header.file_count).AppendLine(); + sbInformation.AppendFormat("Volume created on {0}", rootDirectoryKeyBlock.header.creation_time) + .AppendLine(); + sbInformation.AppendFormat("{0} bytes per directory entry", rootDirectoryKeyBlock.header.entry_length) + .AppendLine(); + sbInformation + .AppendFormat("{0} entries per directory block", rootDirectoryKeyBlock.header.entries_per_block) + .AppendLine(); + sbInformation.AppendFormat("{0} files in root directory", rootDirectoryKeyBlock.header.file_count) + .AppendLine(); sbInformation.AppendFormat("{0} blocks in volume", rootDirectoryKeyBlock.header.total_blocks).AppendLine(); - sbInformation.AppendFormat("Bitmap starts at block {0}", rootDirectoryKeyBlock.header.bit_map_pointer).AppendLine(); + sbInformation.AppendFormat("Bitmap starts at block {0}", rootDirectoryKeyBlock.header.bit_map_pointer) + .AppendLine(); if((rootDirectoryKeyBlock.header.access & ProDOSReadAttribute) == ProDOSReadAttribute) sbInformation.AppendLine("Volume can be read"); @@ -285,7 +290,8 @@ namespace DiscImageChef.Filesystems sbInformation.AppendLine("Volume must be backed up"); if((rootDirectoryKeyBlock.header.access & ProDOSReservedAttributeMask) != 0) - DicConsole.DebugWriteLine("ProDOS plugin", "Reserved attributes are set: {0:X2}", rootDirectoryKeyBlock.header.access); + DicConsole.DebugWriteLine("ProDOS plugin", "Reserved attributes are set: {0:X2}", + rootDirectoryKeyBlock.header.access); information = sbInformation.ToString(); @@ -299,7 +305,8 @@ namespace DiscImageChef.Filesystems xmlFSType.Files = rootDirectoryKeyBlock.header.file_count; xmlFSType.FilesSpecified = true; xmlFSType.Clusters = rootDirectoryKeyBlock.header.total_blocks; - xmlFSType.ClusterSize = (int)(((partition.End - partition.Start) + 1) * imagePlugin.ImageInfo.sectorSize / (ulong)xmlFSType.Clusters); + xmlFSType.ClusterSize = (int)(((partition.End - partition.Start) + 1) * imagePlugin.ImageInfo.sectorSize / + (ulong)xmlFSType.Clusters); xmlFSType.Type = "ProDOS"; return; @@ -676,5 +683,4 @@ namespace DiscImageChef.Filesystems public ushort[] index_block_pointer; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Properties/AssemblyInfo.cs b/DiscImageChef.Filesystems/Properties/AssemblyInfo.cs index e36411ca..06669f98 100644 --- a/DiscImageChef.Filesystems/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Filesystems/Properties/AssemblyInfo.cs @@ -54,5 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Filesystems/QNX4.cs b/DiscImageChef.Filesystems/QNX4.cs index 4190b3c1..dba7c329 100644 --- a/DiscImageChef.Filesystems/QNX4.cs +++ b/DiscImageChef.Filesystems/QNX4.cs @@ -50,8 +50,7 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct QNX4_Inode { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] di_fname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] di_fname; public uint di_size; public QNX4_Extent di_first_xtnt; public uint di_xblk; @@ -72,12 +71,10 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct QNX4_LinkInfo { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] - public byte[] dl_fname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] public byte[] dl_fname; public uint dl_inode_blk; public byte dl_inode_ndx; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] dl_spare; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] dl_spare; public byte dl_status; } @@ -87,13 +84,10 @@ namespace DiscImageChef.Filesystems public uint next_xblk; public uint prev_xblk; public byte num_xtnts; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] spare; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] spare; public uint num_blocks; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 60)] - public QNX4_Extent[] xtnts; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] signature; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 60)] public QNX4_Extent[] xtnts; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] signature; public QNX4_Extent first_xtnt; } @@ -106,7 +100,8 @@ namespace DiscImageChef.Filesystems public QNX4_Inode altBoot; } - readonly byte[] QNX4_RootDir_Fname = { 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + readonly byte[] QNX4_RootDir_Fname = + {0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; public QNX4() { @@ -119,30 +114,24 @@ namespace DiscImageChef.Filesystems { Name = "QNX4 Plugin"; PluginUUID = new Guid("E73A63FA-B5B0-48BF-BF82-DA5F0A8170D2"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public QNX4(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "QNX4 Plugin"; PluginUUID = new Guid("E73A63FA-B5B0-48BF-BF82-DA5F0A8170D2"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Start + 1 >= imagePlugin.GetSectors()) - return false; + if(partition.Start + 1 >= imagePlugin.GetSectors()) return false; byte[] sector = imagePlugin.ReadSector(partition.Start + 1); - if(sector.Length < 512) - return false; + if(sector.Length < 512) return false; QNX4_Superblock qnxSb = new QNX4_Superblock(); IntPtr sbPtr = Marshal.AllocHGlobal(512); @@ -151,39 +140,32 @@ namespace DiscImageChef.Filesystems Marshal.FreeHGlobal(sbPtr); // Check root directory name - if(!QNX4_RootDir_Fname.SequenceEqual(qnxSb.rootDir.di_fname)) - return false; + if(!QNX4_RootDir_Fname.SequenceEqual(qnxSb.rootDir.di_fname)) return false; // Check sizes are multiple of blocks - if(qnxSb.rootDir.di_size % 512 != 0 || - qnxSb.inode.di_size % 512 != 0 || - qnxSb.boot.di_size % 512 != 0 || - qnxSb.altBoot.di_size % 512 != 0) - return false; + if(qnxSb.rootDir.di_size % 512 != 0 || qnxSb.inode.di_size % 512 != 0 || qnxSb.boot.di_size % 512 != 0 || + qnxSb.altBoot.di_size % 512 != 0) return false; // Check extents are not past device if(qnxSb.rootDir.di_first_xtnt.block + partition.Start >= partition.End || qnxSb.inode.di_first_xtnt.block + partition.Start >= partition.End || qnxSb.boot.di_first_xtnt.block + partition.Start >= partition.End || - qnxSb.altBoot.di_first_xtnt.block + partition.Start >= partition.End) - return false; + qnxSb.altBoot.di_first_xtnt.block + partition.Start >= partition.End) return false; // Check inodes are in use - if((qnxSb.rootDir.di_status & 0x01) != 0x01 || - (qnxSb.inode.di_status & 0x01) != 0x01 || - (qnxSb.boot.di_status & 0x01) != 0x01) - return false; + if((qnxSb.rootDir.di_status & 0x01) != 0x01 || (qnxSb.inode.di_status & 0x01) != 0x01 || + (qnxSb.boot.di_status & 0x01) != 0x01) return false; // All hail filesystems without identification marks return true; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; byte[] sector = imagePlugin.ReadSector(partition.Start + 1); - if(sector.Length < 512) - return; + if(sector.Length < 512) return; QNX4_Superblock qnxSb = new QNX4_Superblock(); IntPtr sbPtr = Marshal.AllocHGlobal(512); @@ -266,7 +248,8 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_status = {0}", qnxSb.altBoot.di_status); */ - information = string.Format("QNX4 filesystem\nCreated on {0}\n", DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_ftime)); + information = string.Format("QNX4 filesystem\nCreated on {0}\n", + DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_ftime)); xmlFSType = new Schemas.FileSystemType { diff --git a/DiscImageChef.Filesystems/QNX6.cs b/DiscImageChef.Filesystems/QNX6.cs index 49bab598..6ac72e2f 100644 --- a/DiscImageChef.Filesystems/QNX6.cs +++ b/DiscImageChef.Filesystems/QNX6.cs @@ -44,12 +44,10 @@ namespace DiscImageChef.Filesystems struct QNX6_RootNode { public ulong size; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public uint[] pointers; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public uint[] pointers; public byte levels; public byte mode; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] spare; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] spare; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -63,8 +61,7 @@ namespace DiscImageChef.Filesystems public uint flags; public ushort version1; public ushort version2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] volumeid; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] volumeid; public uint blockSize; public uint numInodes; public uint freeInodes; @@ -83,10 +80,8 @@ namespace DiscImageChef.Filesystems public uint magic; public uint checksum; public ulong serial; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] spare1; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] spare1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] id; public uint blockSize; public uint numInodes; public uint freeInodes; @@ -114,20 +109,16 @@ namespace DiscImageChef.Filesystems { Name = "QNX6 Plugin"; PluginUUID = new Guid("3E610EA2-4D08-4D70-8947-830CD4C74FC0"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public QNX6(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "QNX6 Plugin"; PluginUUID = new Guid("3E610EA2-4D08-4D70-8947-830CD4C74FC0"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) @@ -135,13 +126,11 @@ namespace DiscImageChef.Filesystems uint sectors = QNX6_SuperBlockSize / imagePlugin.GetSectorSize(); uint bootSectors = QNX6_BootBlocksSize / imagePlugin.GetSectorSize(); - if(partition.Start + bootSectors + sectors >= partition.End) - return false; + if(partition.Start + bootSectors + sectors >= partition.End) return false; byte[] audiSector = imagePlugin.ReadSectors(partition.Start, sectors); byte[] sector = imagePlugin.ReadSectors(partition.Start + bootSectors, sectors); - if(sector.Length < QNX6_SuperBlockSize) - return false; + if(sector.Length < QNX6_SuperBlockSize) return false; QNX6_AudiSuperBlock audiSb = new QNX6_AudiSuperBlock(); IntPtr audiPtr = Marshal.AllocHGlobal(Marshal.SizeOf(audiSb)); @@ -158,7 +147,8 @@ namespace DiscImageChef.Filesystems return qnxSb.magic == QNX6_Magic || audiSb.magic == QNX6_Magic; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; StringBuilder sb = new StringBuilder(); @@ -167,8 +157,7 @@ namespace DiscImageChef.Filesystems byte[] audiSector = imagePlugin.ReadSectors(partition.Start, sectors); byte[] sector = imagePlugin.ReadSectors(partition.Start + bootSectors, sectors); - if(sector.Length < QNX6_SuperBlockSize) - return; + if(sector.Length < QNX6_SuperBlockSize) return; QNX6_AudiSuperBlock audiSb = new QNX6_AudiSuperBlock(); IntPtr audiPtr = Marshal.AllocHGlobal(Marshal.SizeOf(audiSb)); @@ -191,8 +180,9 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Serial: 0x{0:X16}", audiSb.checksum).AppendLine(); sb.AppendFormat("{0} bytes per block", audiSb.blockSize).AppendLine(); sb.AppendFormat("{0} inodes free of {1}", audiSb.freeInodes, audiSb.numInodes).AppendLine(); - sb.AppendFormat("{0} blocks ({1} bytes) free of {2} ({3} bytes)", audiSb.freeBlocks, audiSb.freeBlocks * audiSb.blockSize, - audiSb.numBlocks, audiSb.numBlocks * audiSb.blockSize).AppendLine(); + sb.AppendFormat("{0} blocks ({1} bytes) free of {2} ({3} bytes)", audiSb.freeBlocks, + audiSb.freeBlocks * audiSb.blockSize, audiSb.numBlocks, + audiSb.numBlocks * audiSb.blockSize).AppendLine(); xmlFSType = new Schemas.FileSystemType(); xmlFSType.Type = "QNX6 (Audi) filesystem"; @@ -221,8 +211,9 @@ namespace DiscImageChef.Filesystems //sb.AppendFormat("Volume ID: \"{0}\"", CurrentEncoding.GetString(qnxSb.volumeid)).AppendLine(); sb.AppendFormat("{0} bytes per block", qnxSb.blockSize).AppendLine(); sb.AppendFormat("{0} inodes free of {1}", qnxSb.freeInodes, qnxSb.numInodes).AppendLine(); - sb.AppendFormat("{0} blocks ({1} bytes) free of {2} ({3} bytes)", qnxSb.freeBlocks, qnxSb.freeBlocks * qnxSb.blockSize, - qnxSb.numBlocks, qnxSb.numBlocks * qnxSb.blockSize).AppendLine(); + sb.AppendFormat("{0} blocks ({1} bytes) free of {2} ({3} bytes)", qnxSb.freeBlocks, + qnxSb.freeBlocks * qnxSb.blockSize, qnxSb.numBlocks, qnxSb.numBlocks * qnxSb.blockSize) + .AppendLine(); xmlFSType = new Schemas.FileSystemType(); xmlFSType.Type = "QNX6 filesystem"; diff --git a/DiscImageChef.Filesystems/RBF.cs b/DiscImageChef.Filesystems/RBF.cs index 0287238e..f5016fe8 100644 --- a/DiscImageChef.Filesystems/RBF.cs +++ b/DiscImageChef.Filesystems/RBF.cs @@ -48,8 +48,7 @@ namespace DiscImageChef.Filesystems struct RBF_IdSector { /// <summary>Sectors on disk</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] dd_tot; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] dd_tot; /// <summary>Tracks</summary> public byte dd_tks; /// <summary>Bytes in allocation map</summary> @@ -57,8 +56,7 @@ namespace DiscImageChef.Filesystems /// <summary>Sectors per cluster</summary> public ushort dd_bit; /// <summary>LSN of root directory</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] dd_dir; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] dd_dir; /// <summary>Owner ID</summary> public ushort dd_own; /// <summary>Attributes</summary> @@ -72,19 +70,15 @@ namespace DiscImageChef.Filesystems /// <summary>Reserved</summary> public ushort dd_res; /// <summary>LSN of boot file</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] dd_bt; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] dd_bt; /// <summary>Size of boot file</summary> public ushort dd_bsz; /// <summary>Creation date</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] dd_dat; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] dd_dat; /// <summary>Volume name</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] dd_nam; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] dd_nam; /// <summary>Path options</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] dd_opt; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] dd_opt; /// <summary>Reserved</summary> public byte reserved; /// <summary>Magic number</summary> @@ -143,13 +137,11 @@ namespace DiscImageChef.Filesystems /// <summary>Last write time for this structure</summary> public uint rid_mtime; /// <summary>Volume name</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] rid_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] rid_name; /// <summary>Endian flag</summary> public byte rid_endflag; /// <summary>Padding</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] rid_unused2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] rid_unused2; /// <summary>Parity</summary> public uint rid_parity; } @@ -169,49 +161,43 @@ namespace DiscImageChef.Filesystems { Name = "OS-9 Random Block File Plugin"; PluginUUID = new Guid("E864E45B-0B52-4D29-A858-7BDFA9199FB2"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public RBF(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "OS-9 Random Block File Plugin"; PluginUUID = new Guid("E864E45B-0B52-4D29-A858-7BDFA9199FB2"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.GetSectorSize() < 256) - return false; + if(imagePlugin.GetSectorSize() < 256) return false; // Documentation says ID should be sector 0 // I've found that OS-9/X68000 has it on sector 4 // I've read OS-9/Apple2 has it on sector 15 - foreach(ulong location in new[] { 0, 4, 15 }) + foreach(ulong location in new[] {0, 4, 15}) { RBF_IdSector RBFSb = new RBF_IdSector(); uint sbSize = (uint)(Marshal.SizeOf(RBFSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(RBFSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(RBFSb) % imagePlugin.GetSectorSize() != 0) sbSize++; - if(partition.Start + location + sbSize >= imagePlugin.GetSectors()) - break; + if(partition.Start + location + sbSize >= imagePlugin.GetSectors()) break; byte[] sector = imagePlugin.ReadSectors(partition.Start + location, sbSize); - if(sector.Length < Marshal.SizeOf(RBFSb)) - return false; + if(sector.Length < Marshal.SizeOf(RBFSb)) return false; RBFSb = BigEndianMarshal.ByteArrayToStructureBigEndian<RBF_IdSector>(sector); RBF_NewIdSector RBF9000Sb = BigEndianMarshal.ByteArrayToStructureBigEndian<RBF_NewIdSector>(sector); - DicConsole.DebugWriteLine("RBF plugin", "magic at {0} = 0x{1:X8} or 0x{2:X8} (expected 0x{3:X8} or 0x{4:X8})", location, RBFSb.dd_sync, RBF9000Sb.rid_sync, RBF_Sync, RBF_Cnys); + DicConsole.DebugWriteLine("RBF plugin", + "magic at {0} = 0x{1:X8} or 0x{2:X8} (expected 0x{3:X8} or 0x{4:X8})", + location, RBFSb.dd_sync, RBF9000Sb.rid_sync, RBF_Sync, RBF_Cnys); if(RBFSb.dd_sync == RBF_Sync || RBF9000Sb.rid_sync == RBF_Sync || RBF9000Sb.rid_sync == RBF_Cnys) return true; @@ -220,39 +206,36 @@ namespace DiscImageChef.Filesystems return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < 256) - return; + if(imagePlugin.GetSectorSize() < 256) return; RBF_IdSector RBFSb = new RBF_IdSector(); RBF_NewIdSector RBF9000Sb = new RBF_NewIdSector(); - foreach(ulong location in new[] { 0, 4, 15 }) + foreach(ulong location in new[] {0, 4, 15}) { uint sbSize = (uint)(Marshal.SizeOf(RBFSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(RBFSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(RBFSb) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start + location, sbSize); - if(sector.Length < Marshal.SizeOf(RBFSb)) - return; + if(sector.Length < Marshal.SizeOf(RBFSb)) return; RBFSb = BigEndianMarshal.ByteArrayToStructureBigEndian<RBF_IdSector>(sector); RBF9000Sb = BigEndianMarshal.ByteArrayToStructureBigEndian<RBF_NewIdSector>(sector); - DicConsole.DebugWriteLine("RBF plugin", "magic at {0} = 0x{1:X8} or 0x{2:X8} (expected 0x{3:X8} or 0x{4:X8})", location, RBFSb.dd_sync, RBF9000Sb.rid_sync, RBF_Sync, RBF_Cnys); + DicConsole.DebugWriteLine("RBF plugin", + "magic at {0} = 0x{1:X8} or 0x{2:X8} (expected 0x{3:X8} or 0x{4:X8})", + location, RBFSb.dd_sync, RBF9000Sb.rid_sync, RBF_Sync, RBF_Cnys); - if(RBFSb.dd_sync == RBF_Sync || RBF9000Sb.rid_sync == RBF_Sync || RBF9000Sb.rid_sync == RBF_Cnys) - break; + if(RBFSb.dd_sync == RBF_Sync || RBF9000Sb.rid_sync == RBF_Sync || RBF9000Sb.rid_sync == RBF_Cnys) break; } - if(RBFSb.dd_sync != RBF_Sync && RBF9000Sb.rid_sync != RBF_Sync && RBF9000Sb.rid_sync != RBF_Cnys) - return; + if(RBFSb.dd_sync != RBF_Sync && RBF9000Sb.rid_sync != RBF_Sync && RBF9000Sb.rid_sync != RBF_Cnys) return; - if(RBF9000Sb.rid_sync == RBF_Cnys) - RBF9000Sb = BigEndianMarshal.SwapStructureMembersEndian(RBF9000Sb); + if(RBF9000Sb.rid_sync == RBF_Cnys) RBF9000Sb = BigEndianMarshal.SwapStructureMembersEndian(RBF9000Sb); StringBuilder sb = new StringBuilder(); @@ -268,32 +251,29 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} heads", RBF9000Sb.rid_heads).AppendLine(); sb.AppendFormat("{0} bytes per block", RBF9000Sb.rid_blocksize).AppendLine(); // TODO: Convert to flags? - if((RBF9000Sb.rid_format & 0x01) == 0x01) - sb.AppendLine("Disk is double sided"); - else - sb.AppendLine("Disk is single sided"); - if((RBF9000Sb.rid_format & 0x02) == 0x02) - sb.AppendLine("Disk is double density"); - else - sb.AppendLine("Disk is single density"); - if((RBF9000Sb.rid_format & 0x10) == 0x10) - sb.AppendLine("Disk is 384 TPI"); - else if((RBF9000Sb.rid_format & 0x08) == 0x08) - sb.AppendLine("Disk is 192 TPI"); - else if((RBF9000Sb.rid_format & 0x04) == 0x04) - sb.AppendLine("Disk is 96 TPI or 135 TPI"); - else - sb.AppendLine("Disk is 48 TPI"); - sb.AppendFormat("Allocation bitmap descriptor starts at block {0}", RBF9000Sb.rid_bitmap == 0 ? 1 : RBF9000Sb.rid_bitmap).AppendLine(); + if((RBF9000Sb.rid_format & 0x01) == 0x01) sb.AppendLine("Disk is double sided"); + else sb.AppendLine("Disk is single sided"); + if((RBF9000Sb.rid_format & 0x02) == 0x02) sb.AppendLine("Disk is double density"); + else sb.AppendLine("Disk is single density"); + if((RBF9000Sb.rid_format & 0x10) == 0x10) sb.AppendLine("Disk is 384 TPI"); + else if((RBF9000Sb.rid_format & 0x08) == 0x08) sb.AppendLine("Disk is 192 TPI"); + else if((RBF9000Sb.rid_format & 0x04) == 0x04) sb.AppendLine("Disk is 96 TPI or 135 TPI"); + else sb.AppendLine("Disk is 48 TPI"); + sb.AppendFormat("Allocation bitmap descriptor starts at block {0}", + RBF9000Sb.rid_bitmap == 0 ? 1 : RBF9000Sb.rid_bitmap).AppendLine(); if(RBF9000Sb.rid_firstboot > 0) sb.AppendFormat("Debugger descriptor starts at block {0}", RBF9000Sb.rid_firstboot).AppendLine(); if(RBF9000Sb.rid_bootfile > 0) sb.AppendFormat("Boot file descriptor starts at block {0}", RBF9000Sb.rid_bootfile).AppendLine(); sb.AppendFormat("Root directory descriptor starts at block {0}", RBF9000Sb.rid_rootdir).AppendLine(); - sb.AppendFormat("Disk is owned by group {0} user {1}", RBF9000Sb.rid_group, RBF9000Sb.rid_owner).AppendLine(); - sb.AppendFormat("Volume was created on {0}", DateHandlers.UNIXToDateTime(RBF9000Sb.rid_ctime)).AppendLine(); - sb.AppendFormat("Volume's identification block was last written on {0}", DateHandlers.UNIXToDateTime(RBF9000Sb.rid_mtime)).AppendLine(); - sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(RBF9000Sb.rid_name, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Disk is owned by group {0} user {1}", RBF9000Sb.rid_group, RBF9000Sb.rid_owner) + .AppendLine(); + sb.AppendFormat("Volume was created on {0}", DateHandlers.UNIXToDateTime(RBF9000Sb.rid_ctime)) + .AppendLine(); + sb.AppendFormat("Volume's identification block was last written on {0}", + DateHandlers.UNIXToDateTime(RBF9000Sb.rid_mtime)).AppendLine(); + sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(RBF9000Sb.rid_name, CurrentEncoding)) + .AppendLine(); xmlFSType = new Schemas.FileSystemType { @@ -316,34 +296,32 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} tracks", RBFSb.dd_tks).AppendLine(); sb.AppendFormat("{0} sectors per track", RBFSb.dd_spt).AppendLine(); sb.AppendFormat("{0} bytes per sector", 256 << RBFSb.dd_lsnsize).AppendLine(); - sb.AppendFormat("{0} sectors per cluster ({1} bytes)", RBFSb.dd_bit, RBFSb.dd_bit * (256 << RBFSb.dd_lsnsize)).AppendLine(); + sb.AppendFormat("{0} sectors per cluster ({1} bytes)", RBFSb.dd_bit, + RBFSb.dd_bit * (256 << RBFSb.dd_lsnsize)).AppendLine(); // TODO: Convert to flags? - if((RBFSb.dd_fmt & 0x01) == 0x01) - sb.AppendLine("Disk is double sided"); - else - sb.AppendLine("Disk is single sided"); - if((RBFSb.dd_fmt & 0x02) == 0x02) - sb.AppendLine("Disk is double density"); - else - sb.AppendLine("Disk is single density"); - if((RBFSb.dd_fmt & 0x10) == 0x10) - sb.AppendLine("Disk is 384 TPI"); - else if((RBFSb.dd_fmt & 0x08) == 0x08) - sb.AppendLine("Disk is 192 TPI"); - else if((RBFSb.dd_fmt & 0x04) == 0x04) - sb.AppendLine("Disk is 96 TPI or 135 TPI"); - else - sb.AppendLine("Disk is 48 TPI"); - sb.AppendFormat("Allocation bitmap descriptor starts at block {0}", RBFSb.dd_maplsn == 0 ? 1 : RBFSb.dd_maplsn).AppendLine(); + if((RBFSb.dd_fmt & 0x01) == 0x01) sb.AppendLine("Disk is double sided"); + else sb.AppendLine("Disk is single sided"); + if((RBFSb.dd_fmt & 0x02) == 0x02) sb.AppendLine("Disk is double density"); + else sb.AppendLine("Disk is single density"); + if((RBFSb.dd_fmt & 0x10) == 0x10) sb.AppendLine("Disk is 384 TPI"); + else if((RBFSb.dd_fmt & 0x08) == 0x08) sb.AppendLine("Disk is 192 TPI"); + else if((RBFSb.dd_fmt & 0x04) == 0x04) sb.AppendLine("Disk is 96 TPI or 135 TPI"); + else sb.AppendLine("Disk is 48 TPI"); + sb.AppendFormat("Allocation bitmap descriptor starts at block {0}", + RBFSb.dd_maplsn == 0 ? 1 : RBFSb.dd_maplsn).AppendLine(); sb.AppendFormat("{0} bytes in allocation bitmap", RBFSb.dd_map).AppendLine(); if(LSNToUInt32(RBFSb.dd_bt) > 0 && RBFSb.dd_bsz > 0) - sb.AppendFormat("Boot file starts at block {0} and has {1} bytes", LSNToUInt32(RBFSb.dd_bt), RBFSb.dd_bsz).AppendLine(); - sb.AppendFormat("Root directory descriptor starts at block {0}", LSNToUInt32(RBFSb.dd_dir)).AppendLine(); + sb.AppendFormat("Boot file starts at block {0} and has {1} bytes", LSNToUInt32(RBFSb.dd_bt), + RBFSb.dd_bsz).AppendLine(); + sb.AppendFormat("Root directory descriptor starts at block {0}", LSNToUInt32(RBFSb.dd_dir)) + .AppendLine(); sb.AppendFormat("Disk is owned by user {0}", RBFSb.dd_own).AppendLine(); sb.AppendFormat("Volume was created on {0}", DateHandlers.OS9ToDateTime(RBFSb.dd_dat)).AppendLine(); sb.AppendFormat("Volume attributes: {0:X2}", RBFSb.dd_att).AppendLine(); - sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(RBFSb.dd_nam, CurrentEncoding)).AppendLine(); - sb.AppendFormat("Path descriptor options: {0}", StringHandlers.CToString(RBFSb.dd_opt, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(RBFSb.dd_nam, CurrentEncoding)) + .AppendLine(); + sb.AppendFormat("Path descriptor options: {0}", StringHandlers.CToString(RBFSb.dd_opt, CurrentEncoding)) + .AppendLine(); xmlFSType = new Schemas.FileSystemType { @@ -363,8 +341,7 @@ namespace DiscImageChef.Filesystems public static uint LSNToUInt32(byte[] lsn) { - if(lsn == null || lsn.Length != 3) - return 0; + if(lsn == null || lsn.Length != 3) return 0; return (uint)((lsn[0] << 16) + (lsn[1] << 8) + lsn[2]); } diff --git a/DiscImageChef.Filesystems/RT11.cs b/DiscImageChef.Filesystems/RT11.cs index cdb71bb8..74497922 100644 --- a/DiscImageChef.Filesystems/RT11.cs +++ b/DiscImageChef.Filesystems/RT11.cs @@ -53,29 +53,23 @@ namespace DiscImageChef.Filesystems { Name = "RT-11 file system"; PluginUUID = new Guid("DB3E2F98-8F98-463C-8126-E937843DA024"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } public RT11(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "RT-11 file system"; PluginUUID = new Guid("DB3E2F98-8F98-463C-8126-E937843DA024"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((1 + partition.Start) >= partition.End) - return false; + if((1 + partition.Start) >= partition.End) return false; - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; byte[] magic_b = new byte[12]; string magic; @@ -87,7 +81,8 @@ namespace DiscImageChef.Filesystems return magic == "DECRT11A "; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -110,14 +105,17 @@ namespace DiscImageChef.Filesystems * MOV 1,@R0 */ ushort check = 0; - for(int i = 0; i < 512; i += 2) - check += BitConverter.ToUInt16(hb_sector, i); + for(int i = 0; i < 512; i += 2) check += BitConverter.ToUInt16(hb_sector, i); - sb.AppendFormat("Volume format is {0}", StringHandlers.SpacePaddedToString(homeblock.format, CurrentEncoding)).AppendLine(); - sb.AppendFormat("{0} sectors per cluster ({1} bytes)", homeblock.cluster, homeblock.cluster * 512).AppendLine(); + sb.AppendFormat("Volume format is {0}", + StringHandlers.SpacePaddedToString(homeblock.format, CurrentEncoding)).AppendLine(); + sb.AppendFormat("{0} sectors per cluster ({1} bytes)", homeblock.cluster, homeblock.cluster * 512) + .AppendLine(); sb.AppendFormat("First directory segment starts at block {0}", homeblock.rootBlock).AppendLine(); - sb.AppendFormat("Volume owner is \"{0}\"", StringHandlers.SpacePaddedToString(homeblock.ownername, CurrentEncoding)).AppendLine(); - sb.AppendFormat("Volume label: \"{0}\"", StringHandlers.SpacePaddedToString(homeblock.volname, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Volume owner is \"{0}\"", + StringHandlers.SpacePaddedToString(homeblock.ownername, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Volume label: \"{0}\"", + StringHandlers.SpacePaddedToString(homeblock.volname, CurrentEncoding)).AppendLine(); sb.AppendFormat("Checksum: 0x{0:X4} (calculated 0x{1:X4})", homeblock.checksum, check).AppendLine(); byte[] bootBlock = imagePlugin.ReadSector(0); @@ -138,44 +136,32 @@ namespace DiscImageChef.Filesystems struct RT11HomeBlock { /// <summary>Bad block replacement table</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 130)] - public byte[] badBlockTable; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 130)] public byte[] badBlockTable; /// <summary>Unused</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] unused; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] unused; /// <summary>INITIALIZE/RESTORE data area</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 38)] - public byte[] initArea; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 38)] public byte[] initArea; /// <summary>BUP information area</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] - public byte[] bupInformation; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] public byte[] bupInformation; /// <summary>Empty</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 260)] - public byte[] empty; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 260)] public byte[] empty; /// <summary>Reserved</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] reserved1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] reserved1; /// <summary>Reserved</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] reserved2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public byte[] empty2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] reserved2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] empty2; /// <summary>Cluster size</summary> public ushort cluster; /// <summary>Block of the first directory segment</summary> public ushort rootBlock; /// <summary>"V3A" in Radix-50</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] systemVersion; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] systemVersion; /// <summary>Name of the volume, 12 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] volname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] volname; /// <summary>Name of the volume owner, 12 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] ownername; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] ownername; /// <summary>RT11 defines it as "DECRT11A ", 12 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] format; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] format; /// <summary>Unused</summary> public ushort unused2; /// <summary>Checksum of preceding 255 words (16 bit units)</summary> diff --git a/DiscImageChef.Filesystems/Reiser.cs b/DiscImageChef.Filesystems/Reiser.cs index 23bb6c2b..248cbfe8 100644 --- a/DiscImageChef.Filesystems/Reiser.cs +++ b/DiscImageChef.Filesystems/Reiser.cs @@ -65,8 +65,7 @@ namespace DiscImageChef.Filesystems public ushort oid_maxsize; public ushort oid_cursize; public ushort umount_state; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] magic; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] magic; public ushort fs_state; public uint hash_function_code; public ushort tree_height; @@ -76,19 +75,17 @@ namespace DiscImageChef.Filesystems public uint inode_generation; public uint flags; public Guid uuid; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] label; public ushort mnt_count; public ushort max_mnt_count; public uint last_check; public uint check_interval; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 76)] - public byte[] unused; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 76)] public byte[] unused; } - readonly byte[] Reiser35_Magic = { 0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x46, 0x73, 0x00, 0x00 }; - readonly byte[] Reiser36_Magic = { 0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x32, 0x46, 0x73, 0x00 }; - readonly byte[] ReiserJr_Magic = { 0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x33, 0x46, 0x73, 0x00 }; + readonly byte[] Reiser35_Magic = {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x46, 0x73, 0x00, 0x00}; + readonly byte[] Reiser36_Magic = {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x32, 0x46, 0x73, 0x00}; + readonly byte[] ReiserJr_Magic = {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x33, 0x46, 0x73, 0x00}; const uint Reiser_SuperOffset = 0x10000; public Reiser() @@ -102,98 +99,81 @@ namespace DiscImageChef.Filesystems { Name = "Reiser Filesystem Plugin"; PluginUUID = new Guid("1D8CD8B8-27E6-410F-9973-D16409225FBA"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public Reiser(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Reiser Filesystem Plugin"; PluginUUID = new Guid("1D8CD8B8-27E6-410F-9973-D16409225FBA"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; uint sbAddr = Reiser_SuperOffset / imagePlugin.GetSectorSize(); - if(sbAddr == 0) - sbAddr = 1; + if(sbAddr == 0) sbAddr = 1; Reiser_Superblock reiserSb = new Reiser_Superblock(); uint sbSize = (uint)(Marshal.SizeOf(reiserSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(reiserSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(reiserSb) % imagePlugin.GetSectorSize() != 0) sbSize++; - if(partition.Start + sbAddr + sbSize >= partition.End) - return false; + if(partition.Start + sbAddr + sbSize >= partition.End) return false; byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize); - if(sector.Length < Marshal.SizeOf(reiserSb)) - return false; + if(sector.Length < Marshal.SizeOf(reiserSb)) return false; IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(reiserSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(reiserSb)); reiserSb = (Reiser_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Reiser_Superblock)); Marshal.FreeHGlobal(sbPtr); - return Reiser35_Magic.SequenceEqual(reiserSb.magic) || - Reiser36_Magic.SequenceEqual(reiserSb.magic) || - ReiserJr_Magic.SequenceEqual(reiserSb.magic); + return Reiser35_Magic.SequenceEqual(reiserSb.magic) || Reiser36_Magic.SequenceEqual(reiserSb.magic) || + ReiserJr_Magic.SequenceEqual(reiserSb.magic); } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < 512) - return; + if(imagePlugin.GetSectorSize() < 512) return; uint sbAddr = Reiser_SuperOffset / imagePlugin.GetSectorSize(); - if(sbAddr == 0) - sbAddr = 1; + if(sbAddr == 0) sbAddr = 1; Reiser_Superblock reiserSb = new Reiser_Superblock(); uint sbSize = (uint)(Marshal.SizeOf(reiserSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(reiserSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(reiserSb) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize); - if(sector.Length < Marshal.SizeOf(reiserSb)) - return; + if(sector.Length < Marshal.SizeOf(reiserSb)) return; IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(reiserSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(reiserSb)); reiserSb = (Reiser_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Reiser_Superblock)); Marshal.FreeHGlobal(sbPtr); - if(!Reiser35_Magic.SequenceEqual(reiserSb.magic) && - !Reiser36_Magic.SequenceEqual(reiserSb.magic) && - !ReiserJr_Magic.SequenceEqual(reiserSb.magic)) - return; + if(!Reiser35_Magic.SequenceEqual(reiserSb.magic) && !Reiser36_Magic.SequenceEqual(reiserSb.magic) && + !ReiserJr_Magic.SequenceEqual(reiserSb.magic)) return; StringBuilder sb = new StringBuilder(); - if(Reiser35_Magic.SequenceEqual(reiserSb.magic)) - sb.AppendLine("Reiser 3.5 filesystem"); - else if(Reiser36_Magic.SequenceEqual(reiserSb.magic)) - sb.AppendLine("Reiser 3.6 filesystem"); - else if(ReiserJr_Magic.SequenceEqual(reiserSb.magic)) - sb.AppendLine("Reiser Jr. filesystem"); - sb.AppendFormat("Volume has {0} blocks with {1} blocks free", reiserSb.block_count, reiserSb.free_blocks).AppendLine(); + if(Reiser35_Magic.SequenceEqual(reiserSb.magic)) sb.AppendLine("Reiser 3.5 filesystem"); + else if(Reiser36_Magic.SequenceEqual(reiserSb.magic)) sb.AppendLine("Reiser 3.6 filesystem"); + else if(ReiserJr_Magic.SequenceEqual(reiserSb.magic)) sb.AppendLine("Reiser Jr. filesystem"); + sb.AppendFormat("Volume has {0} blocks with {1} blocks free", reiserSb.block_count, reiserSb.free_blocks) + .AppendLine(); sb.AppendFormat("{0} bytes per block", reiserSb.blocksize).AppendLine(); sb.AppendFormat("Root directory resides on block {0}", reiserSb.root_block).AppendLine(); - if(reiserSb.umount_state == 2) - sb.AppendLine("Volume has not been cleanly umounted"); - sb.AppendFormat("Volume last checked on {0}", DateHandlers.UNIXUnsignedToDateTime(reiserSb.last_check)).AppendLine(); + if(reiserSb.umount_state == 2) sb.AppendLine("Volume has not been cleanly umounted"); + sb.AppendFormat("Volume last checked on {0}", DateHandlers.UNIXUnsignedToDateTime(reiserSb.last_check)) + .AppendLine(); if(reiserSb.version >= 2) { sb.AppendFormat("Volume UUID: {0}", reiserSb.uuid).AppendLine(); @@ -203,12 +183,9 @@ namespace DiscImageChef.Filesystems information = sb.ToString(); xmlFSType = new Schemas.FileSystemType(); - if(Reiser35_Magic.SequenceEqual(reiserSb.magic)) - xmlFSType.Type = "Reiser 3.5 filesystem"; - else if(Reiser36_Magic.SequenceEqual(reiserSb.magic)) - xmlFSType.Type = "Reiser 3.6 filesystem"; - else if(ReiserJr_Magic.SequenceEqual(reiserSb.magic)) - xmlFSType.Type = "Reiser Jr. filesystem"; + if(Reiser35_Magic.SequenceEqual(reiserSb.magic)) xmlFSType.Type = "Reiser 3.5 filesystem"; + else if(Reiser36_Magic.SequenceEqual(reiserSb.magic)) xmlFSType.Type = "Reiser 3.6 filesystem"; + else if(ReiserJr_Magic.SequenceEqual(reiserSb.magic)) xmlFSType.Type = "Reiser Jr. filesystem"; xmlFSType.ClusterSize = reiserSb.blocksize; xmlFSType.Clusters = reiserSb.block_count; xmlFSType.FreeClusters = reiserSb.free_blocks; diff --git a/DiscImageChef.Filesystems/Reiser4.cs b/DiscImageChef.Filesystems/Reiser4.cs index 3737b79c..9e1bd0a9 100644 --- a/DiscImageChef.Filesystems/Reiser4.cs +++ b/DiscImageChef.Filesystems/Reiser4.cs @@ -44,16 +44,15 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Reiser4_Superblock { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] magic; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] magic; public ushort diskformat; public ushort blocksize; public Guid uuid; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] label; } - readonly byte[] Reiser4_Magic = { 0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + readonly byte[] Reiser4_Magic = + {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; const uint Reiser4_SuperOffset = 0x10000; public Reiser4() @@ -67,43 +66,34 @@ namespace DiscImageChef.Filesystems { Name = "Reiser4 Filesystem Plugin"; PluginUUID = new Guid("301F2D00-E8D5-4F04-934E-81DFB21D15BA"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public Reiser4(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Reiser4 Filesystem Plugin"; PluginUUID = new Guid("301F2D00-E8D5-4F04-934E-81DFB21D15BA"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; uint sbAddr = Reiser4_SuperOffset / imagePlugin.GetSectorSize(); - if(sbAddr == 0) - sbAddr = 1; + if(sbAddr == 0) sbAddr = 1; Reiser4_Superblock reiserSb = new Reiser4_Superblock(); uint sbSize = (uint)(Marshal.SizeOf(reiserSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(reiserSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(reiserSb) % imagePlugin.GetSectorSize() != 0) sbSize++; - if(partition.Start + sbAddr + sbSize >= partition.End) - return false; + if(partition.Start + sbAddr + sbSize >= partition.End) return false; byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize); - if(sector.Length < Marshal.SizeOf(reiserSb)) - return false; + if(sector.Length < Marshal.SizeOf(reiserSb)) return false; IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(reiserSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(reiserSb)); @@ -113,33 +103,29 @@ namespace DiscImageChef.Filesystems return Reiser4_Magic.SequenceEqual(reiserSb.magic); } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < 512) - return; + if(imagePlugin.GetSectorSize() < 512) return; uint sbAddr = Reiser4_SuperOffset / imagePlugin.GetSectorSize(); - if(sbAddr == 0) - sbAddr = 1; + if(sbAddr == 0) sbAddr = 1; Reiser4_Superblock reiserSb = new Reiser4_Superblock(); uint sbSize = (uint)(Marshal.SizeOf(reiserSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(reiserSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(reiserSb) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize); - if(sector.Length < Marshal.SizeOf(reiserSb)) - return; + if(sector.Length < Marshal.SizeOf(reiserSb)) return; IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(reiserSb)); Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(reiserSb)); reiserSb = (Reiser4_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Reiser4_Superblock)); Marshal.FreeHGlobal(sbPtr); - if(!Reiser4_Magic.SequenceEqual(reiserSb.magic)) - return; + if(!Reiser4_Magic.SequenceEqual(reiserSb.magic)) return; StringBuilder sb = new StringBuilder(); @@ -154,7 +140,8 @@ namespace DiscImageChef.Filesystems xmlFSType = new Schemas.FileSystemType(); xmlFSType.Type = "Reiser 4 filesystem"; xmlFSType.ClusterSize = reiserSb.blocksize; - xmlFSType.Clusters = (long)(((partition.End - partition.Start) * imagePlugin.GetSectorSize()) / reiserSb.blocksize); + xmlFSType.Clusters = + (long)(((partition.End - partition.Start) * imagePlugin.GetSectorSize()) / reiserSb.blocksize); xmlFSType.VolumeName = StringHandlers.CToString(reiserSb.label, CurrentEncoding); xmlFSType.VolumeSerial = reiserSb.uuid.ToString(); } diff --git a/DiscImageChef.Filesystems/SFS.cs b/DiscImageChef.Filesystems/SFS.cs index 537c2611..3cb0b536 100644 --- a/DiscImageChef.Filesystems/SFS.cs +++ b/DiscImageChef.Filesystems/SFS.cs @@ -51,20 +51,16 @@ namespace DiscImageChef.Filesystems { Name = "SmartFileSystem"; PluginUUID = new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } public SFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "SmartFileSystem"; PluginUUID = new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1"); + else CurrentEncoding = encoding; } [Flags] @@ -86,23 +82,19 @@ namespace DiscImageChef.Filesystems public SFSFlags bits; public byte padding1; public ushort padding2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public uint[] reserved1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] reserved1; public ulong firstbyte; public ulong lastbyte; public uint totalblocks; public uint blocksize; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public uint[] reserved2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public uint[] reserved3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] reserved2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public uint[] reserved3; public uint bitmapbase; public uint adminspacecontainer; public uint rootobjectcontainer; public uint extentbnoderoot; public uint objectnoderoot; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public uint[] reserved4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] reserved4; } /// <summary>Identifier for SFS v1</summary> @@ -112,8 +104,7 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Start >= partition.End) - return false; + if(partition.Start >= partition.End) return false; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -124,7 +115,8 @@ namespace DiscImageChef.Filesystems return magic == SFS_MAGIC || magic == SFS2_MAGIC; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { byte[] RootBlockSector = imagePlugin.ReadSector(partition.Start); RootBlock rootBlock = new RootBlock(); @@ -135,16 +127,24 @@ namespace DiscImageChef.Filesystems sbInformation.AppendLine("SmartFileSystem"); sbInformation.AppendFormat("Volume version {0}", rootBlock.version).AppendLine(); - sbInformation.AppendFormat("Volume starts on device byte {0} and ends on byte {1}", rootBlock.firstbyte, rootBlock.lastbyte).AppendLine(); - sbInformation.AppendFormat("Volume has {0} blocks of {1} bytes each", rootBlock.totalblocks, rootBlock.blocksize).AppendLine(); - sbInformation.AppendFormat("Volume created on {0}", DateHandlers.UNIXUnsignedToDateTime(rootBlock.datecreated).AddYears(8)).AppendLine(); + sbInformation.AppendFormat("Volume starts on device byte {0} and ends on byte {1}", rootBlock.firstbyte, + rootBlock.lastbyte).AppendLine(); + sbInformation + .AppendFormat("Volume has {0} blocks of {1} bytes each", rootBlock.totalblocks, rootBlock.blocksize) + .AppendLine(); + sbInformation.AppendFormat("Volume created on {0}", + DateHandlers.UNIXUnsignedToDateTime(rootBlock.datecreated).AddYears(8)) + .AppendLine(); sbInformation.AppendFormat("Bitmap starts in block {0}", rootBlock.bitmapbase).AppendLine(); - sbInformation.AppendFormat("Admin space container starts in block {0}", rootBlock.adminspacecontainer).AppendLine(); - sbInformation.AppendFormat("Root object container starts in block {0}", rootBlock.rootobjectcontainer).AppendLine(); - sbInformation.AppendFormat("Root node of the extent B-tree resides in block {0}", rootBlock.extentbnoderoot).AppendLine(); - sbInformation.AppendFormat("Root node of the object B-tree resides in block {0}", rootBlock.objectnoderoot).AppendLine(); - if(rootBlock.bits.HasFlag(SFSFlags.CaseSensitive)) - sbInformation.AppendLine("Volume is case sensitive"); + sbInformation.AppendFormat("Admin space container starts in block {0}", rootBlock.adminspacecontainer) + .AppendLine(); + sbInformation.AppendFormat("Root object container starts in block {0}", rootBlock.rootobjectcontainer) + .AppendLine(); + sbInformation.AppendFormat("Root node of the extent B-tree resides in block {0}", rootBlock.extentbnoderoot) + .AppendLine(); + sbInformation.AppendFormat("Root node of the object B-tree resides in block {0}", rootBlock.objectnoderoot) + .AppendLine(); + if(rootBlock.bits.HasFlag(SFSFlags.CaseSensitive)) sbInformation.AppendLine("Volume is case sensitive"); if(rootBlock.bits.HasFlag(SFSFlags.RecyledFolder)) sbInformation.AppendLine("Volume moves deleted files to a recycled folder"); information = sbInformation.ToString(); diff --git a/DiscImageChef.Filesystems/SolarFS.cs b/DiscImageChef.Filesystems/SolarFS.cs index 53e0a04f..d62746bb 100644 --- a/DiscImageChef.Filesystems/SolarFS.cs +++ b/DiscImageChef.Filesystems/SolarFS.cs @@ -52,26 +52,21 @@ namespace DiscImageChef.Filesystems { Name = "Solar_OS filesystem"; PluginUUID = new Guid("EA3101C1-E777-4B4F-B5A3-8C57F50F6E65"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public SolarFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Solar_OS filesystem"; PluginUUID = new Guid("EA3101C1-E777-4B4F-B5A3-8C57F50F6E65"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((2 + partition.Start) >= partition.End) - return false; + if((2 + partition.Start) >= partition.End) return false; byte signature; /// <summary>0x29 string fs_type; // "SOL_FS " @@ -84,12 +79,13 @@ namespace DiscImageChef.Filesystems Array.Copy(bpb, 0x35, fs_type_b, 0, 8); fs_type = StringHandlers.CToString(fs_type_b); - if(signature == 0x29 && fs_type == "SOL_FS ") - return true; + if(signature == 0x29 && fs_type == "SOL_FS ") return true; + return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -125,7 +121,8 @@ namespace DiscImageChef.Filesystems Array.Copy(bpb_sector, 0x1B, BPB.unk3, 0, 10); BPB.unk4 = BitConverter.ToUInt32(bpb_sector, 0x26); - DicConsole.DebugWriteLine("SolarFS plugin", "BPB.x86_jump: 0x{0:X2}{1:X2}{2:X2}", BPB.x86_jump[0], BPB.x86_jump[1], BPB.x86_jump[2]); + DicConsole.DebugWriteLine("SolarFS plugin", "BPB.x86_jump: 0x{0:X2}{1:X2}{2:X2}", BPB.x86_jump[0], + BPB.x86_jump[1], BPB.x86_jump[2]); DicConsole.DebugWriteLine("SolarFS plugin", "BPB.OEMName: \"{0}\"", BPB.OEMName); DicConsole.DebugWriteLine("SolarFS plugin", "BPB.bps: {0}", BPB.bps); DicConsole.DebugWriteLine("SolarFS plugin", "BPB.unk1: 0x{0:X2}", BPB.unk1); @@ -136,7 +133,10 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("SolarFS plugin", "BPB.spfat: {0}", BPB.spfat); DicConsole.DebugWriteLine("SolarFS plugin", "BPB.sptrk: {0}", BPB.sptrk); DicConsole.DebugWriteLine("SolarFS plugin", "BPB.heads: {0}", BPB.heads); - DicConsole.DebugWriteLine("SolarFS plugin", "BPB.unk3: 0x{0:X2}{1:X2}{2:X2}{3:X2}{4:X2}{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}", BPB.unk3[0], BPB.unk3[1], BPB.unk3[2], BPB.unk3[3], BPB.unk3[4], BPB.unk3[5], BPB.unk3[6], BPB.unk3[7], BPB.unk3[8], BPB.unk3[9]); + DicConsole.DebugWriteLine("SolarFS plugin", + "BPB.unk3: 0x{0:X2}{1:X2}{2:X2}{3:X2}{4:X2}{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}", + BPB.unk3[0], BPB.unk3[1], BPB.unk3[2], BPB.unk3[3], BPB.unk3[4], BPB.unk3[5], + BPB.unk3[6], BPB.unk3[7], BPB.unk3[8], BPB.unk3[9]); DicConsole.DebugWriteLine("SolarFS plugin", "BPB.signature: 0x{0:X2}", BPB.signature); DicConsole.DebugWriteLine("SolarFS plugin", "BPB.unk4: 0x{0:X8}", BPB.unk4); DicConsole.DebugWriteLine("SolarFS plugin", "BPB.vol_name: \"{0}\"", BPB.vol_name); @@ -145,20 +145,26 @@ namespace DiscImageChef.Filesystems sb.AppendLine("Solar_OS filesystem"); sb.AppendFormat("Media descriptor: 0x{0:X2}", BPB.media).AppendLine(); sb.AppendFormat("{0} bytes per sector", BPB.bps).AppendLine(); - if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) + if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || + imagePlugin.GetSectorSize() == 2448) { if(BPB.bps != imagePlugin.GetSectorSize()) { - sb.AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector", BPB.bps, 2048).AppendLine(); + sb + .AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector", + BPB.bps, 2048).AppendLine(); } } else if(BPB.bps != imagePlugin.GetSectorSize()) { - sb.AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector", BPB.bps, imagePlugin.GetSectorSize()).AppendLine(); + sb + .AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector", + BPB.bps, imagePlugin.GetSectorSize()).AppendLine(); } sb.AppendFormat("{0} sectors on volume ({1} bytes)", BPB.sectors, BPB.sectors * BPB.bps).AppendLine(); if(BPB.sectors > imagePlugin.GetSectors()) - sb.AppendFormat("WARNING: Filesystem describes a {0} sectors volume, bigger than device ({1} sectors)", BPB.sectors, imagePlugin.GetSectors()); + sb.AppendFormat("WARNING: Filesystem describes a {0} sectors volume, bigger than device ({1} sectors)", + BPB.sectors, imagePlugin.GetSectors()); sb.AppendFormat("{0} heads", BPB.heads).AppendLine(); sb.AppendFormat("{0} sectors per track", BPB.sptrk).AppendLine(); sb.AppendFormat("Volume name: {0}", BPB.vol_name).AppendLine(); diff --git a/DiscImageChef.Filesystems/Squash.cs b/DiscImageChef.Filesystems/Squash.cs index 8247716d..265a7a9e 100644 --- a/DiscImageChef.Filesystems/Squash.cs +++ b/DiscImageChef.Filesystems/Squash.cs @@ -51,20 +51,16 @@ namespace DiscImageChef.Filesystems { Name = "Squash filesystem"; PluginUUID = new Guid("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09"); - if(encoding == null) - CurrentEncoding = Encoding.UTF8; - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.UTF8; + else CurrentEncoding = encoding; } public Squash(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Squash filesystem"; PluginUUID = new Guid("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09"); - if(encoding == null) - CurrentEncoding = Encoding.UTF8; - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.UTF8; + else CurrentEncoding = encoding; } enum SquashCompression : ushort @@ -109,8 +105,7 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Start >= partition.End) - return false; + if(partition.Start >= partition.End) return false; byte[] sector = imagePlugin.ReadSector(partition.Start); @@ -119,7 +114,8 @@ namespace DiscImageChef.Filesystems return magic == Squash_MAGIC || magic == Squash_CIGAM; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { byte[] sector = imagePlugin.ReadSector(partition.Start); uint magic = BitConverter.ToUInt32(sector, 0x00); @@ -143,14 +139,13 @@ namespace DiscImageChef.Filesystems StringBuilder sbInformation = new StringBuilder(); sbInformation.AppendLine("Squash file system"); - if(littleEndian) - sbInformation.AppendLine("Little-endian"); - else - sbInformation.AppendLine("Big-endian"); + if(littleEndian) sbInformation.AppendLine("Little-endian"); + else sbInformation.AppendLine("Big-endian"); sbInformation.AppendFormat("Volume version {0}.{1}", sqSb.s_major, sqSb.s_minor).AppendLine(); sbInformation.AppendFormat("Volume has {0} bytes", sqSb.bytes_used).AppendLine(); sbInformation.AppendFormat("Volume has {0} bytes per block", sqSb.block_size).AppendLine(); - sbInformation.AppendFormat("Volume created on {0}", DateHandlers.UNIXUnsignedToDateTime(sqSb.mkfs_time)).AppendLine(); + sbInformation.AppendFormat("Volume created on {0}", DateHandlers.UNIXUnsignedToDateTime(sqSb.mkfs_time)) + .AppendLine(); sbInformation.AppendFormat("Volume has {0} inodes", sqSb.inodes).AppendLine(); switch(sqSb.compression) { @@ -173,7 +168,8 @@ namespace DiscImageChef.Filesystems sbInformation.AppendLine("Volume is compressed using Zstandard"); break; default: - sbInformation.AppendFormat("Volume is compressed using unknown algorithm {0}", sqSb.compression).AppendLine(); + sbInformation.AppendFormat("Volume is compressed using unknown algorithm {0}", sqSb.compression) + .AppendLine(); break; } @@ -183,7 +179,8 @@ namespace DiscImageChef.Filesystems xmlFSType.Type = "Squash file system"; xmlFSType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(sqSb.mkfs_time); xmlFSType.CreationDateSpecified = true; - xmlFSType.Clusters = (long)(((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.sectorSize) / sqSb.block_size); + xmlFSType.Clusters = (long)(((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.sectorSize) / + sqSb.block_size); xmlFSType.ClusterSize = (int)sqSb.block_size; xmlFSType.Files = sqSb.inodes; xmlFSType.FilesSpecified = true; diff --git a/DiscImageChef.Filesystems/Structs.cs b/DiscImageChef.Filesystems/Structs.cs index 13ab4299..76ff2c1c 100644 --- a/DiscImageChef.Filesystems/Structs.cs +++ b/DiscImageChef.Filesystems/Structs.cs @@ -157,26 +157,66 @@ namespace DiscImageChef.Filesystems public FileAttributes Attributes; /// <summary>File creation date in UTC</summary> - public DateTime CreationTimeUtc { get { return crtimeUtc; } set { crtimeUtc = value; } } + public DateTime CreationTimeUtc + { + get { return crtimeUtc; } + set { crtimeUtc = value; } + } /// <summary>File last access date in UTC</summary> - public DateTime AccessTimeUtc { get { return atimeUtc; } set { atimeUtc = value; } } + public DateTime AccessTimeUtc + { + get { return atimeUtc; } + set { atimeUtc = value; } + } /// <summary>File attributes change date in UTC</summary> - public DateTime StatusChangeTimeUtc { get { return ctimeUtc; } set { ctimeUtc = value; } } + public DateTime StatusChangeTimeUtc + { + get { return ctimeUtc; } + set { ctimeUtc = value; } + } /// <summary>File last backup date in UTC</summary> - public DateTime BackupTimeUtc { get { return btimeUtc; } set { btimeUtc = value; } } + public DateTime BackupTimeUtc + { + get { return btimeUtc; } + set { btimeUtc = value; } + } /// <summary>File last modification date in UTC</summary> - public DateTime LastWriteTimeUtc { get { return mtimeUtc; } set { mtimeUtc = value; } } + public DateTime LastWriteTimeUtc + { + get { return mtimeUtc; } + set { mtimeUtc = value; } + } /// <summary>File creation date</summary> - public DateTime CreationTime { get { return crtimeUtc.ToLocalTime(); } set { crtimeUtc = value.ToUniversalTime(); } } + public DateTime CreationTime + { + get { return crtimeUtc.ToLocalTime(); } + set { crtimeUtc = value.ToUniversalTime(); } + } /// <summary>File last access date</summary> - public DateTime AccessTime { get { return atimeUtc.ToLocalTime(); } set { atimeUtc = value.ToUniversalTime(); } } + public DateTime AccessTime + { + get { return atimeUtc.ToLocalTime(); } + set { atimeUtc = value.ToUniversalTime(); } + } /// <summary>File attributes change date</summary> - public DateTime StatusChangeTime { get { return ctimeUtc.ToLocalTime(); } set { ctimeUtc = value.ToUniversalTime(); } } + public DateTime StatusChangeTime + { + get { return ctimeUtc.ToLocalTime(); } + set { ctimeUtc = value.ToUniversalTime(); } + } /// <summary>File last backup date</summary> - public DateTime BackupTime { get { return btimeUtc.ToLocalTime(); } set { btimeUtc = value.ToUniversalTime(); } } + public DateTime BackupTime + { + get { return btimeUtc.ToLocalTime(); } + set { btimeUtc = value.ToUniversalTime(); } + } /// <summary>File last modification date</summary> - public DateTime LastWriteTime { get { return mtimeUtc.ToLocalTime(); } set { mtimeUtc = value.ToUniversalTime(); } } + public DateTime LastWriteTime + { + get { return mtimeUtc.ToLocalTime(); } + set { mtimeUtc = value.ToUniversalTime(); } + } /// <summary>inode number for this file</summary> public ulong Inode; @@ -226,19 +266,13 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Explicit)] public struct FileSystemId { - [FieldOffset(0)] - public bool IsInt; - [FieldOffset(1)] - public bool IsLong; - [FieldOffset(2)] - public bool IsGuid; + [FieldOffset(0)] public bool IsInt; + [FieldOffset(1)] public bool IsLong; + [FieldOffset(2)] public bool IsGuid; - [FieldOffset(3)] - public uint Serial32; - [FieldOffset(3)] - public ulong Serial64; - [FieldOffset(3)] - public Guid uuid; + [FieldOffset(3)] public uint Serial32; + [FieldOffset(3)] public ulong Serial64; + [FieldOffset(3)] public Guid uuid; } /// <summary> @@ -309,4 +343,4 @@ namespace DiscImageChef.Filesystems /// <summary>Not supported</summary> ENOTSUP = NotSupported } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Symbian.cs b/DiscImageChef.Filesystems/Symbian.cs index a17445ac..5b85192f 100644 --- a/DiscImageChef.Filesystems/Symbian.cs +++ b/DiscImageChef.Filesystems/Symbian.cs @@ -364,4 +364,4 @@ namespace DiscImageChef.Plugins } } -*/ +*/ \ No newline at end of file diff --git a/DiscImageChef.Filesystems/SysV.cs b/DiscImageChef.Filesystems/SysV.cs index 33b0f52a..8f062b8a 100644 --- a/DiscImageChef.Filesystems/SysV.cs +++ b/DiscImageChef.Filesystems/SysV.cs @@ -69,26 +69,21 @@ namespace DiscImageChef.Filesystems { Name = "UNIX System V filesystem"; PluginUUID = new Guid("9B8D016A-8561-400E-A12A-A198283C211D"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public SysVfs(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "UNIX System V filesystem"; PluginUUID = new Guid("9B8D016A-8561-400E-A12A-A198283C211D"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((2 + partition.Start) >= partition.End) - return false; + if((2 + partition.Start) >= partition.End) return false; uint magic; string s_fname, s_fpack; @@ -117,27 +112,30 @@ namespace DiscImageChef.Filesystems byte sb_size_in_sectors; - if(imagePlugin.GetSectorSize() <= 0x400) // Check if underlying device sector size is smaller than SuperBlock size + if(imagePlugin.GetSectorSize() <= 0x400 + ) // Check if underlying device sector size is smaller than SuperBlock size sb_size_in_sectors = (byte)(0x400 / imagePlugin.GetSectorSize()); - else - sb_size_in_sectors = 1; // If not a single sector can store it + else sb_size_in_sectors = 1; // If not a single sector can store it - if(partition.End <= (partition.Start + 4 * (ulong)sb_size_in_sectors + sb_size_in_sectors)) // Device must be bigger than SB location + SB size + offset + if(partition.End <= (partition.Start + 4 * (ulong)sb_size_in_sectors + sb_size_in_sectors) + ) // Device must be bigger than SB location + SB size + offset return false; // Sectors in a cylinder int spc = (int)(imagePlugin.ImageInfo.heads * imagePlugin.ImageInfo.sectorsPerTrack); // Superblock can start on 0x000, 0x200, 0x600 and 0x800, not aligned, so we assume 16 (128 bytes/sector) sectors as a safe value - int[] locations = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + int[] locations = + { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // Superblock can also skip one cylinder (for boot) - spc}; + spc + }; foreach(int i in locations) { - if(i + sb_size_in_sectors >= (int)imagePlugin.ImageInfo.sectors) - break; - + if(i + sb_size_in_sectors >= (int)imagePlugin.ImageInfo.sectors) break; + byte[] sb_sector = imagePlugin.ReadSectors((ulong)i + partition.Start, sb_size_in_sectors); magic = BitConverter.ToUInt32(sb_sector, 0x3F8); // XENIX magic location @@ -147,13 +145,11 @@ namespace DiscImageChef.Filesystems magic = BitConverter.ToUInt32(sb_sector, 0x1F8); // System V magic location - if(magic == SYSV_MAGIC || magic == SYSV_CIGAM) - return true; + if(magic == SYSV_MAGIC || magic == SYSV_CIGAM) return true; magic = BitConverter.ToUInt32(sb_sector, 0x1F0); // XENIX 3 magic location - if(magic == XENIX_MAGIC || magic == XENIX_CIGAM) - return true; + if(magic == XENIX_MAGIC || magic == XENIX_CIGAM) return true; byte[] coherent_string = new byte[6]; Array.Copy(sb_sector, 0x1E4, coherent_string, 0, 6); // Coherent UNIX s_fname location @@ -161,20 +157,22 @@ namespace DiscImageChef.Filesystems Array.Copy(sb_sector, 0x1EA, coherent_string, 0, 6); // Coherent UNIX s_fpack location s_fpack = StringHandlers.CToString(coherent_string, CurrentEncoding); - if((s_fname == COH_FNAME && s_fpack == COH_FPACK) || (s_fname == COH_XXXXX && s_fpack == COH_XXXXX) || (s_fname == COH_XXXXS && s_fpack == COH_XXXXN)) - return true; + if((s_fname == COH_FNAME && s_fpack == COH_FPACK) || (s_fname == COH_XXXXX && s_fpack == COH_XXXXX) || + (s_fname == COH_XXXXS && s_fpack == COH_XXXXN)) return true; // Now try to identify 7th edition s_fsize = BitConverter.ToUInt32(sb_sector, 0x002); // 7th edition's s_fsize s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); // 7th edition's s_nfree s_ninode = BitConverter.ToUInt16(sb_sector, 0x0D0); // 7th edition's s_ninode - if(s_fsize > 0 && s_fsize < 0xFFFFFFFF && s_nfree > 0 && s_nfree < 0xFFFF && s_ninode > 0 && s_ninode < 0xFFFF) + if(s_fsize > 0 && s_fsize < 0xFFFFFFFF && s_nfree > 0 && s_nfree < 0xFFFF && s_ninode > 0 && + s_ninode < 0xFFFF) { if((s_fsize & 0xFF) == 0x00 && (s_nfree & 0xFF) == 0x00 && (s_ninode & 0xFF) == 0x00) { // Byteswap - s_fsize = ((s_fsize & 0xFF) << 24) + ((s_fsize & 0xFF00) << 8) + ((s_fsize & 0xFF0000) >> 8) + ((s_fsize & 0xFF000000) >> 24); + s_fsize = ((s_fsize & 0xFF) << 24) + ((s_fsize & 0xFF00) << 8) + ((s_fsize & 0xFF0000) >> 8) + + ((s_fsize & 0xFF000000) >> 24); s_nfree = (ushort)(s_nfree >> 8); s_ninode = (ushort)(s_ninode >> 8); } @@ -183,7 +181,8 @@ namespace DiscImageChef.Filesystems { if(s_fsize < V7_MAXSIZE && s_nfree < V7_NICFREE && s_ninode < V7_NICINOD) { - if((s_fsize * 1024) == ((partition.End - partition.Start) * imagePlugin.GetSectorSize()) || (s_fsize * 512) == ((partition.End - partition.Start) * imagePlugin.GetSectorSize())) + if((s_fsize * 1024) == ((partition.End - partition.Start) * imagePlugin.GetSectorSize()) || + (s_fsize * 512) == ((partition.End - partition.Start) * imagePlugin.GetSectorSize())) return true; } } @@ -193,12 +192,14 @@ namespace DiscImageChef.Filesystems return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; StringBuilder sb = new StringBuilder(); - BigEndianBitConverter.IsLittleEndian = true; // Start in little endian until we know what are we handling here + BigEndianBitConverter.IsLittleEndian = + true; // Start in little endian until we know what are we handling here int start = 0; uint magic; string s_fname, s_fpack; @@ -214,17 +215,20 @@ namespace DiscImageChef.Filesystems byte sb_size_in_sectors; int offset = 0; - if(imagePlugin.GetSectorSize() <= 0x400) // Check if underlying device sector size is smaller than SuperBlock size + if(imagePlugin.GetSectorSize() <= 0x400 + ) // Check if underlying device sector size is smaller than SuperBlock size sb_size_in_sectors = (byte)(0x400 / imagePlugin.GetSectorSize()); - else - sb_size_in_sectors = 1; // If not a single sector can store it + else sb_size_in_sectors = 1; // If not a single sector can store it // Sectors in a cylinder int spc = (int)(imagePlugin.ImageInfo.heads * imagePlugin.ImageInfo.sectorsPerTrack); // Superblock can start on 0x000, 0x200, 0x600 and 0x800, not aligned, so we assume 16 (128 bytes/sector) sectors as a safe value - int[] locations = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + int[] locations = + { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // Superblock can also skip one cylinder (for boot) - spc}; + spc + }; foreach(int i in locations) { @@ -239,11 +243,11 @@ namespace DiscImageChef.Filesystems sysv = true; offset = 0x200; } - else - xenix = true; + else xenix = true; start = i; break; } + if(magic == XENIX_CIGAM || magic == SYSV_CIGAM) { BigEndianBitConverter.IsLittleEndian = false; // Big endian @@ -252,8 +256,7 @@ namespace DiscImageChef.Filesystems sysv = true; offset = 0x200; } - else - xenix = true; + else xenix = true; start = i; break; } @@ -267,6 +270,7 @@ namespace DiscImageChef.Filesystems start = i; break; } + if(magic == XENIX_CIGAM) { BigEndianBitConverter.IsLittleEndian = false; // Big endian @@ -284,6 +288,7 @@ namespace DiscImageChef.Filesystems start = i; break; } + if(magic == SYSV_CIGAM) { BigEndianBitConverter.IsLittleEndian = false; // Big endian @@ -298,7 +303,8 @@ namespace DiscImageChef.Filesystems Array.Copy(sb_sector, 0x1EA, coherent_string, 0, 6); // Coherent UNIX s_fpack location s_fpack = StringHandlers.CToString(coherent_string, CurrentEncoding); - if((s_fname == COH_FNAME && s_fpack == COH_FPACK) || (s_fname == COH_XXXXX && s_fpack == COH_XXXXX) || (s_fname == COH_XXXXS && s_fpack == COH_XXXXN)) + if((s_fname == COH_FNAME && s_fpack == COH_FPACK) || (s_fname == COH_XXXXX && s_fpack == COH_XXXXX) || + (s_fname == COH_XXXXS && s_fpack == COH_XXXXN)) { BigEndianBitConverter.IsLittleEndian = true; // Coherent is in PDP endianness, use helper for that coherent = true; @@ -311,12 +317,14 @@ namespace DiscImageChef.Filesystems s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); // 7th edition's s_nfree s_ninode = BitConverter.ToUInt16(sb_sector, 0x0D0); // 7th edition's s_ninode - if(s_fsize > 0 && s_fsize < 0xFFFFFFFF && s_nfree > 0 && s_nfree < 0xFFFF && s_ninode > 0 && s_ninode < 0xFFFF) + if(s_fsize > 0 && s_fsize < 0xFFFFFFFF && s_nfree > 0 && s_nfree < 0xFFFF && s_ninode > 0 && + s_ninode < 0xFFFF) { if((s_fsize & 0xFF) == 0x00 && (s_nfree & 0xFF) == 0x00 && (s_ninode & 0xFF) == 0x00) { // Byteswap - s_fsize = ((s_fsize & 0xFF) << 24) + ((s_fsize & 0xFF00) << 8) + ((s_fsize & 0xFF0000) >> 8) + ((s_fsize & 0xFF000000) >> 24); + s_fsize = ((s_fsize & 0xFF) << 24) + ((s_fsize & 0xFF00) << 8) + ((s_fsize & 0xFF0000) >> 8) + + ((s_fsize & 0xFF000000) >> 24); s_nfree = (ushort)(s_nfree >> 8); s_ninode = (ushort)(s_ninode >> 8); } @@ -325,7 +333,8 @@ namespace DiscImageChef.Filesystems { if(s_fsize < V7_MAXSIZE && s_nfree < V7_NICFREE && s_ninode < V7_NICINOD) { - if((s_fsize * 1024) == ((partition.End - partition.Start) * imagePlugin.GetSectorSize()) || (s_fsize * 512) == ((partition.End - partition.Start) * imagePlugin.GetSectorSize())) + if((s_fsize * 1024) == ((partition.End - partition.Start) * imagePlugin.GetSectorSize()) || + (s_fsize * 512) == ((partition.End - partition.Start) * imagePlugin.GetSectorSize())) { sys7th = true; BigEndianBitConverter.IsLittleEndian = true; @@ -336,8 +345,8 @@ namespace DiscImageChef.Filesystems } } } - if(!sys7th && !sysv && !coherent && !xenix && !xenix3) - return; + + if(!sys7th && !sysv && !coherent && !xenix && !xenix3) return; xmlFSType = new Schemas.FileSystemType(); @@ -421,33 +430,39 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Unknown s_type value: 0x{0:X8}", xnx_sb.s_type).AppendLine(); break; } - if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) + + if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || + imagePlugin.GetSectorSize() == 2448) { if(bs != 2048) - sb.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", bs, 2048).AppendLine(); + sb + .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", + bs, 2048).AppendLine(); } else { if(bs != imagePlugin.GetSectorSize()) - sb.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", bs, imagePlugin.GetSectorSize()).AppendLine(); + sb + .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", + bs, imagePlugin.GetSectorSize()).AppendLine(); } sb.AppendFormat("{0} zones on volume ({1} bytes)", xnx_sb.s_fsize, xnx_sb.s_fsize * bs).AppendLine(); - sb.AppendFormat("{0} free zones on volume ({1} bytes)", xnx_sb.s_tfree, xnx_sb.s_tfree * bs).AppendLine(); - sb.AppendFormat("{0} free blocks on list ({1} bytes)", xnx_sb.s_nfree, xnx_sb.s_nfree * bs).AppendLine(); - sb.AppendFormat("{0} blocks per cylinder ({1} bytes)", xnx_sb.s_cylblks, xnx_sb.s_cylblks * bs).AppendLine(); + sb.AppendFormat("{0} free zones on volume ({1} bytes)", xnx_sb.s_tfree, xnx_sb.s_tfree * bs) + .AppendLine(); + sb.AppendFormat("{0} free blocks on list ({1} bytes)", xnx_sb.s_nfree, xnx_sb.s_nfree * bs) + .AppendLine(); + sb.AppendFormat("{0} blocks per cylinder ({1} bytes)", xnx_sb.s_cylblks, xnx_sb.s_cylblks * bs) + .AppendLine(); sb.AppendFormat("{0} blocks per gap ({1} bytes)", xnx_sb.s_gapblks, xnx_sb.s_gapblks * bs).AppendLine(); sb.AppendFormat("First data zone: {0}", xnx_sb.s_isize).AppendLine(); sb.AppendFormat("{0} free inodes on volume", xnx_sb.s_tinode).AppendLine(); sb.AppendFormat("{0} free inodes on list", xnx_sb.s_ninode).AppendLine(); - if(xnx_sb.s_flock > 0) - sb.AppendLine("Free block list is locked"); - if(xnx_sb.s_ilock > 0) - sb.AppendLine("inode cache is locked"); - if(xnx_sb.s_fmod > 0) - sb.AppendLine("Superblock is being modified"); - if(xnx_sb.s_ronly > 0) - sb.AppendLine("Volume is mounted read-only"); - sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXToDateTime(xnx_sb.s_time)).AppendLine(); + if(xnx_sb.s_flock > 0) sb.AppendLine("Free block list is locked"); + if(xnx_sb.s_ilock > 0) sb.AppendLine("inode cache is locked"); + if(xnx_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified"); + if(xnx_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only"); + sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXToDateTime(xnx_sb.s_time)) + .AppendLine(); if(xnx_sb.s_time != 0) { xmlFSType.ModificationDate = DateHandlers.UNIXToDateTime(xnx_sb.s_time); @@ -456,8 +471,7 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Volume name: {0}", xnx_sb.s_fname).AppendLine(); xmlFSType.VolumeName = xnx_sb.s_fname; sb.AppendFormat("Pack name: {0}", xnx_sb.s_fpack).AppendLine(); - if(xnx_sb.s_clean == 0x46) - sb.AppendLine("Volume is clean"); + if(xnx_sb.s_clean == 0x46) sb.AppendLine("Volume is clean"); else { sb.AppendLine("Volume is dirty"); @@ -490,12 +504,11 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Unknown s_type value: 0x{0:X8}", sysv_sb.s_type).AppendLine(); break; } + sysv_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x002 + offset); - if(sysv_sb.s_fsize * bs > 0 && sysv_sb.s_fsize * bs == partition.Size) - sysvr4 = false; - else - sysvr4 = true; + if(sysv_sb.s_fsize * bs > 0 && sysv_sb.s_fsize * bs == partition.Size) sysvr4 = false; + else sysvr4 = true; if(sysvr4) { @@ -553,22 +566,23 @@ namespace DiscImageChef.Filesystems xmlFSType.Clusters = sysv_sb.s_fsize; sb.AppendFormat("{0} zones on volume ({1} bytes)", sysv_sb.s_fsize, sysv_sb.s_fsize * bs).AppendLine(); - sb.AppendFormat("{0} free zones on volume ({1} bytes)", sysv_sb.s_tfree, sysv_sb.s_tfree * bs).AppendLine(); - sb.AppendFormat("{0} free blocks on list ({1} bytes)", sysv_sb.s_nfree, sysv_sb.s_nfree * bs).AppendLine(); - sb.AppendFormat("{0} blocks per cylinder ({1} bytes)", sysv_sb.s_cylblks, sysv_sb.s_cylblks * bs).AppendLine(); - sb.AppendFormat("{0} blocks per gap ({1} bytes)", sysv_sb.s_gapblks, sysv_sb.s_gapblks * bs).AppendLine(); + sb.AppendFormat("{0} free zones on volume ({1} bytes)", sysv_sb.s_tfree, sysv_sb.s_tfree * bs) + .AppendLine(); + sb.AppendFormat("{0} free blocks on list ({1} bytes)", sysv_sb.s_nfree, sysv_sb.s_nfree * bs) + .AppendLine(); + sb.AppendFormat("{0} blocks per cylinder ({1} bytes)", sysv_sb.s_cylblks, sysv_sb.s_cylblks * bs) + .AppendLine(); + sb.AppendFormat("{0} blocks per gap ({1} bytes)", sysv_sb.s_gapblks, sysv_sb.s_gapblks * bs) + .AppendLine(); sb.AppendFormat("First data zone: {0}", sysv_sb.s_isize).AppendLine(); sb.AppendFormat("{0} free inodes on volume", sysv_sb.s_tinode).AppendLine(); sb.AppendFormat("{0} free inodes on list", sysv_sb.s_ninode).AppendLine(); - if(sysv_sb.s_flock > 0) - sb.AppendLine("Free block list is locked"); - if(sysv_sb.s_ilock > 0) - sb.AppendLine("inode cache is locked"); - if(sysv_sb.s_fmod > 0) - sb.AppendLine("Superblock is being modified"); - if(sysv_sb.s_ronly > 0) - sb.AppendLine("Volume is mounted read-only"); - sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(sysv_sb.s_time)).AppendLine(); + if(sysv_sb.s_flock > 0) sb.AppendLine("Free block list is locked"); + if(sysv_sb.s_ilock > 0) sb.AppendLine("inode cache is locked"); + if(sysv_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified"); + if(sysv_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only"); + sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(sysv_sb.s_time)) + .AppendLine(); if(sysv_sb.s_time != 0) { xmlFSType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(sysv_sb.s_time); @@ -577,8 +591,7 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Volume name: {0}", sysv_sb.s_fname).AppendLine(); xmlFSType.VolumeName = sysv_sb.s_fname; sb.AppendFormat("Pack name: {0}", sysv_sb.s_fpack).AppendLine(); - if(sysv_sb.s_state == (0x7C269D38 - sysv_sb.s_time)) - sb.AppendLine("Volume is clean"); + if(sysv_sb.s_state == (0x7C269D38 - sysv_sb.s_time)) sb.AppendLine("Volume is clean"); else { sb.AppendLine("Volume is dirty"); @@ -616,22 +629,23 @@ namespace DiscImageChef.Filesystems sb.AppendLine("Coherent UNIX filesystem"); if(imagePlugin.GetSectorSize() != 512) - sb.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", 512, 2048).AppendLine(); + sb + .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", + 512, 2048).AppendLine(); sb.AppendFormat("{0} zones on volume ({1} bytes)", coh_sb.s_fsize, coh_sb.s_fsize * 512).AppendLine(); - sb.AppendFormat("{0} free zones on volume ({1} bytes)", coh_sb.s_tfree, coh_sb.s_tfree * 512).AppendLine(); - sb.AppendFormat("{0} free blocks on list ({1} bytes)", coh_sb.s_nfree, coh_sb.s_nfree * 512).AppendLine(); + sb.AppendFormat("{0} free zones on volume ({1} bytes)", coh_sb.s_tfree, coh_sb.s_tfree * 512) + .AppendLine(); + sb.AppendFormat("{0} free blocks on list ({1} bytes)", coh_sb.s_nfree, coh_sb.s_nfree * 512) + .AppendLine(); sb.AppendFormat("First data zone: {0}", coh_sb.s_isize).AppendLine(); sb.AppendFormat("{0} free inodes on volume", coh_sb.s_tinode).AppendLine(); sb.AppendFormat("{0} free inodes on list", coh_sb.s_ninode).AppendLine(); - if(coh_sb.s_flock > 0) - sb.AppendLine("Free block list is locked"); - if(coh_sb.s_ilock > 0) - sb.AppendLine("inode cache is locked"); - if(coh_sb.s_fmod > 0) - sb.AppendLine("Superblock is being modified"); - if(coh_sb.s_ronly > 0) - sb.AppendLine("Volume is mounted read-only"); - sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(coh_sb.s_time)).AppendLine(); + if(coh_sb.s_flock > 0) sb.AppendLine("Free block list is locked"); + if(coh_sb.s_ilock > 0) sb.AppendLine("inode cache is locked"); + if(coh_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified"); + if(coh_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only"); + sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(coh_sb.s_time)) + .AppendLine(); if(coh_sb.s_time != 0) { xmlFSType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(coh_sb.s_time); @@ -671,22 +685,22 @@ namespace DiscImageChef.Filesystems xmlFSType.Clusters = v7_sb.s_fsize; sb.AppendLine("UNIX 7th Edition filesystem"); if(imagePlugin.GetSectorSize() != 512) - sb.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", 512, 2048).AppendLine(); + sb + .AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", + 512, 2048).AppendLine(); sb.AppendFormat("{0} zones on volume ({1} bytes)", v7_sb.s_fsize, v7_sb.s_fsize * 512).AppendLine(); - sb.AppendFormat("{0} free zones on volume ({1} bytes)", v7_sb.s_tfree, v7_sb.s_tfree * 512).AppendLine(); + sb.AppendFormat("{0} free zones on volume ({1} bytes)", v7_sb.s_tfree, v7_sb.s_tfree * 512) + .AppendLine(); sb.AppendFormat("{0} free blocks on list ({1} bytes)", v7_sb.s_nfree, v7_sb.s_nfree * 512).AppendLine(); sb.AppendFormat("First data zone: {0}", v7_sb.s_isize).AppendLine(); sb.AppendFormat("{0} free inodes on volume", v7_sb.s_tinode).AppendLine(); sb.AppendFormat("{0} free inodes on list", v7_sb.s_ninode).AppendLine(); - if(v7_sb.s_flock > 0) - sb.AppendLine("Free block list is locked"); - if(v7_sb.s_ilock > 0) - sb.AppendLine("inode cache is locked"); - if(v7_sb.s_fmod > 0) - sb.AppendLine("Superblock is being modified"); - if(v7_sb.s_ronly > 0) - sb.AppendLine("Volume is mounted read-only"); - sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(v7_sb.s_time)).AppendLine(); + if(v7_sb.s_flock > 0) sb.AppendLine("Free block list is locked"); + if(v7_sb.s_ilock > 0) sb.AppendLine("inode cache is locked"); + if(v7_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified"); + if(v7_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only"); + sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(v7_sb.s_time)) + .AppendLine(); if(v7_sb.s_time != 0) { xmlFSType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(v7_sb.s_time); diff --git a/DiscImageChef.Filesystems/UCSDPascal/Consts.cs b/DiscImageChef.Filesystems/UCSDPascal/Consts.cs index c488a46a..2ca20358 100644 --- a/DiscImageChef.Filesystems/UCSDPascal/Consts.cs +++ b/DiscImageChef.Filesystems/UCSDPascal/Consts.cs @@ -57,5 +57,4 @@ namespace DiscImageChef.Filesystems.UCSDPascal Secure } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/UCSDPascal/Dir.cs b/DiscImageChef.Filesystems/UCSDPascal/Dir.cs index 02e9bcd5..9f1d0740 100644 --- a/DiscImageChef.Filesystems/UCSDPascal/Dir.cs +++ b/DiscImageChef.Filesystems/UCSDPascal/Dir.cs @@ -40,9 +40,8 @@ namespace DiscImageChef.Filesystems.UCSDPascal { public override Errno ReadDir(string path, ref List<string> contents) { - if(!mounted) - return Errno.AccessDenied; - + if(!mounted) return Errno.AccessDenied; + if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) return Errno.NotSupported; @@ -60,5 +59,4 @@ namespace DiscImageChef.Filesystems.UCSDPascal return Errno.NoError; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/UCSDPascal/File.cs b/DiscImageChef.Filesystems/UCSDPascal/File.cs index 490a3259..3af65303 100644 --- a/DiscImageChef.Filesystems/UCSDPascal/File.cs +++ b/DiscImageChef.Filesystems/UCSDPascal/File.cs @@ -39,20 +39,17 @@ namespace DiscImageChef.Filesystems.UCSDPascal { public override Errno MapBlock(string path, long fileBlock, ref long deviceBlock) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; return Errno.NotImplemented; } public override Errno GetAttributes(string path, ref FileAttributes attributes) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; PascalFileEntry entry; Errno error = GetFileEntry(path, out entry); @@ -68,43 +65,35 @@ namespace DiscImageChef.Filesystems.UCSDPascal public override Errno Read(string path, long offset, long size, ref byte[] buf) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; byte[] file; Errno error; - if(debug && - (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 - || string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0)) + if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || + string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0)) { - if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0) - file = catalogBlocks; - else - file = bootBlocks; + if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0) file = catalogBlocks; + else file = bootBlocks; } else { PascalFileEntry entry; error = GetFileEntry(path, out entry); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; byte[] tmp = device.ReadSectors((ulong)entry.firstBlock, (uint)(entry.lastBlock - entry.firstBlock)); file = new byte[(entry.lastBlock - entry.firstBlock - 1) * device.GetSectorSize() + entry.lastBytes]; Array.Copy(tmp, 0, file, 0, file.Length); } - if(offset >= file.Length) - return Errno.EINVAL; + if(offset >= file.Length) return Errno.EINVAL; - if(size + offset >= file.Length) - size = file.Length - offset; + if(size + offset >= file.Length) size = file.Length - offset; buf = new byte[size]; @@ -115,15 +104,12 @@ namespace DiscImageChef.Filesystems.UCSDPascal public override Errno Stat(string path, ref FileEntryInfo stat) { - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - if(!mounted) - return Errno.AccessDenied; + if(!mounted) return Errno.AccessDenied; - string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - if(pathElements.Length != 1) - return Errno.NotSupported; + string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + if(pathElements.Length != 1) return Errno.NotSupported; if(debug) { @@ -159,8 +145,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal PascalFileEntry entry; Errno error = GetFileEntry(path, out entry); - if(error != Errno.NoError) - return error; + if(error != Errno.NoError) return error; stat = new FileEntryInfo(); stat.Attributes = new FileAttributes(); @@ -185,7 +170,8 @@ namespace DiscImageChef.Filesystems.UCSDPascal foreach(PascalFileEntry ent in fileEntries) { - if(string.Compare(path, StringHandlers.PascalToString(ent.filename, CurrentEncoding), StringComparison.InvariantCultureIgnoreCase) == 0) + if(string.Compare(path, StringHandlers.PascalToString(ent.filename, CurrentEncoding), + StringComparison.InvariantCultureIgnoreCase) == 0) { entry = ent; return Errno.NoError; @@ -195,5 +181,4 @@ namespace DiscImageChef.Filesystems.UCSDPascal return Errno.NoSuchFile; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/UCSDPascal/Info.cs b/DiscImageChef.Filesystems/UCSDPascal/Info.cs index ea173798..a7b4eb8f 100644 --- a/DiscImageChef.Filesystems/UCSDPascal/Info.cs +++ b/DiscImageChef.Filesystems/UCSDPascal/Info.cs @@ -41,8 +41,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal { public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Length < 3) - return false; + if(partition.Length < 3) return false; // Blocks 0 and 1 are boot code byte[] volBlock = imagePlugin.ReadSector(2 + partition.Start); @@ -63,39 +62,34 @@ namespace DiscImageChef.Filesystems.UCSDPascal volEntry.tail = BigEndianBitConverter.ToInt32(volBlock, 0x16); // First block is always 0 (even is it's sector 2) - if(volEntry.firstBlock != 0) - return false; + if(volEntry.firstBlock != 0) return false; // Last volume record block must be after first block, and before end of device - if(volEntry.lastBlock <= volEntry.firstBlock || (ulong)volEntry.lastBlock > imagePlugin.GetSectors() - 2) - return false; + if(volEntry.lastBlock <= volEntry.firstBlock || + (ulong)volEntry.lastBlock > imagePlugin.GetSectors() - 2) return false; // Volume record entry type must be volume or secure - if(volEntry.entryType != PascalFileKind.Volume && volEntry.entryType != PascalFileKind.Secure) - return false; + if(volEntry.entryType != PascalFileKind.Volume && volEntry.entryType != PascalFileKind.Secure) return false; // Volume name is max 7 characters - if(volEntry.volumeName[0] > 7) - return false; + if(volEntry.volumeName[0] > 7) return false; // Volume blocks is equal to volume sectors - if(volEntry.blocks < 0 || (ulong)volEntry.blocks != imagePlugin.GetSectors()) - return false; + if(volEntry.blocks < 0 || (ulong)volEntry.blocks != imagePlugin.GetSectors()) return false; // There can be not less than zero files - if(volEntry.files < 0) - return false; + if(volEntry.files < 0) return false; return true; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { StringBuilder sbInformation = new StringBuilder(); information = ""; - if(imagePlugin.GetSectors() < 3) - return; + if(imagePlugin.GetSectors() < 3) return; // Blocks 0 and 1 are boot code byte[] volBlock = imagePlugin.ReadSector(2 + partition.Start); @@ -116,34 +110,34 @@ namespace DiscImageChef.Filesystems.UCSDPascal volEntry.tail = BigEndianBitConverter.ToInt32(volBlock, 0x16); // First block is always 0 (even is it's sector 2) - if(volEntry.firstBlock != 0) - return; + if(volEntry.firstBlock != 0) return; // Last volume record block must be after first block, and before end of device - if(volEntry.lastBlock <= volEntry.firstBlock || (ulong)volEntry.lastBlock > imagePlugin.GetSectors() - 2) - return; + if(volEntry.lastBlock <= volEntry.firstBlock || + (ulong)volEntry.lastBlock > imagePlugin.GetSectors() - 2) return; // Volume record entry type must be volume or secure - if(volEntry.entryType != PascalFileKind.Volume && volEntry.entryType != PascalFileKind.Secure) - return; + if(volEntry.entryType != PascalFileKind.Volume && volEntry.entryType != PascalFileKind.Secure) return; // Volume name is max 7 characters - if(volEntry.volumeName[0] > 7) - return; + if(volEntry.volumeName[0] > 7) return; // Volume blocks is equal to volume sectors - if(volEntry.blocks < 0 || (ulong)volEntry.blocks != imagePlugin.GetSectors()) - return; + if(volEntry.blocks < 0 || (ulong)volEntry.blocks != imagePlugin.GetSectors()) return; // There can be not less than zero files - if(volEntry.files < 0) - return; + if(volEntry.files < 0) return; - sbInformation.AppendFormat("Volume record spans from block {0} to block {1}", volEntry.firstBlock, volEntry.lastBlock).AppendLine(); - sbInformation.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(volEntry.volumeName, CurrentEncoding)).AppendLine(); + sbInformation.AppendFormat("Volume record spans from block {0} to block {1}", volEntry.firstBlock, + volEntry.lastBlock).AppendLine(); + sbInformation.AppendFormat("Volume name: {0}", + StringHandlers.PascalToString(volEntry.volumeName, CurrentEncoding)) + .AppendLine(); sbInformation.AppendFormat("Volume has {0} blocks", volEntry.blocks).AppendLine(); sbInformation.AppendFormat("Volume has {0} files", volEntry.files).AppendLine(); - sbInformation.AppendFormat("Volume last booted at {0}", DateHandlers.UCSDPascalToDateTime(volEntry.lastBoot)).AppendLine(); + sbInformation + .AppendFormat("Volume last booted at {0}", DateHandlers.UCSDPascalToDateTime(volEntry.lastBoot)) + .AppendLine(); information = sbInformation.ToString(); @@ -159,5 +153,4 @@ namespace DiscImageChef.Filesystems.UCSDPascal return; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/UCSDPascal/Structs.cs b/DiscImageChef.Filesystems/UCSDPascal/Structs.cs index ad545349..587de54b 100644 --- a/DiscImageChef.Filesystems/UCSDPascal/Structs.cs +++ b/DiscImageChef.Filesystems/UCSDPascal/Structs.cs @@ -73,5 +73,4 @@ namespace DiscImageChef.Filesystems.UCSDPascal public short mtime; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/UCSDPascal/Super.cs b/DiscImageChef.Filesystems/UCSDPascal/Super.cs index e7700e2d..8bd1ae6d 100644 --- a/DiscImageChef.Filesystems/UCSDPascal/Super.cs +++ b/DiscImageChef.Filesystems/UCSDPascal/Super.cs @@ -46,8 +46,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal public override Errno Mount(bool debug) { this.debug = debug; - if(device.GetSectors() < 3) - return Errno.InvalidArgument; + if(device.GetSectors() < 3) return Errno.InvalidArgument; // Blocks 0 and 1 are boot code catalogBlocks = device.ReadSector(2); @@ -67,10 +66,10 @@ namespace DiscImageChef.Filesystems.UCSDPascal if(mountedVolEntry.firstBlock != 0 || mountedVolEntry.lastBlock <= mountedVolEntry.firstBlock || (ulong)mountedVolEntry.lastBlock > device.GetSectors() - 2 || - (mountedVolEntry.entryType != PascalFileKind.Volume && mountedVolEntry.entryType != PascalFileKind.Secure) || - mountedVolEntry.volumeName[0] > 7 || mountedVolEntry.blocks < 0 || (ulong)mountedVolEntry.blocks != device.GetSectors() || - mountedVolEntry.files < 0) - return Errno.InvalidArgument; + (mountedVolEntry.entryType != PascalFileKind.Volume && + mountedVolEntry.entryType != PascalFileKind.Secure) || mountedVolEntry.volumeName[0] > 7 || + mountedVolEntry.blocks < 0 || (ulong)mountedVolEntry.blocks != device.GetSectors() || + mountedVolEntry.files < 0) return Errno.InvalidArgument; catalogBlocks = device.ReadSectors(2, (uint)(mountedVolEntry.lastBlock - mountedVolEntry.firstBlock - 2)); int offset = 26; @@ -87,8 +86,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal entry.lastBytes = BigEndianBitConverter.ToInt16(catalogBlocks, offset + 0x16); entry.mtime = BigEndianBitConverter.ToInt16(catalogBlocks, offset + 0x18); - if(entry.filename[0] <= 15 && entry.filename[0] > 0) - fileEntries.Add(entry); + if(entry.filename[0] <= 15 && entry.filename[0] > 0) fileEntries.Add(entry); offset += 26; } @@ -127,11 +125,9 @@ namespace DiscImageChef.Filesystems.UCSDPascal stat.Type = "UCSD Pascal"; stat.FreeBlocks = mountedVolEntry.blocks - (mountedVolEntry.lastBlock - mountedVolEntry.firstBlock); - foreach(PascalFileEntry entry in fileEntries) - stat.FreeBlocks -= (entry.lastBlock - entry.firstBlock); + foreach(PascalFileEntry entry in fileEntries) stat.FreeBlocks -= (entry.lastBlock - entry.firstBlock); return Errno.NotImplemented; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/UCSDPascal/UCSDPascal.cs b/DiscImageChef.Filesystems/UCSDPascal/UCSDPascal.cs index 6181be2e..53b88b6c 100644 --- a/DiscImageChef.Filesystems/UCSDPascal/UCSDPascal.cs +++ b/DiscImageChef.Filesystems/UCSDPascal/UCSDPascal.cs @@ -89,5 +89,4 @@ namespace DiscImageChef.Filesystems.UCSDPascal return Errno.NotSupported; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/UDF.cs b/DiscImageChef.Filesystems/UDF.cs index ec79a243..f4d131e1 100644 --- a/DiscImageChef.Filesystems/UDF.cs +++ b/DiscImageChef.Filesystems/UDF.cs @@ -67,7 +67,11 @@ namespace DiscImageChef.Filesystems CurrentEncoding = Encoding.UTF8; } - readonly byte[] UDF_Magic = { 0x2A, 0x4F, 0x53, 0x54, 0x41, 0x20, 0x55, 0x44, 0x46, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x6C, 0x69, 0x61, 0x6E, 0x74, 0x00, 0x00, 0x00, 0x00 }; + readonly byte[] UDF_Magic = + { + 0x2A, 0x4F, 0x53, 0x54, 0x41, 0x20, 0x55, 0x44, 0x46, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x6C, 0x69, 0x61, 0x6E, + 0x74, 0x00, 0x00, 0x00, 0x00 + }; [Flags] enum EntityFlags : byte @@ -86,13 +90,11 @@ namespace DiscImageChef.Filesystems /// <summary> /// Structure identifier /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 23)] - public byte[] identifier; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 23)] public byte[] identifier; /// <summary> /// Structure data /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] identifierSuffix; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] identifierSuffix; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -147,8 +149,7 @@ namespace DiscImageChef.Filesystems struct CharacterSpecification { public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 63)] - public byte[] information; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 63)] public byte[] information; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -157,8 +158,7 @@ namespace DiscImageChef.Filesystems public DescriptorTag tag; public ExtentDescriptor mainVolumeDescriptorSequenceExtent; public ExtentDescriptor reserveVolumeDescriptorSequenceExtent; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 480)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 480)] public byte[] reserved; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -167,16 +167,14 @@ namespace DiscImageChef.Filesystems public DescriptorTag tag; public uint volumeDescriptorSequenceNumber; public uint primaryVolumeDescriptorNumber; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] volumeIdentifier; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] volumeIdentifier; public ushort volumeSequenceNumber; public ushort maximumVolumeSequenceNumber; public ushort interchangeLevel; public ushort maximumInterchangeLevel; public uint characterSetList; public uint maximumCharacterSetList; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] volumeSetIdentifier; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] volumeSetIdentifier; public CharacterSpecification descriptorCharacterSet; public CharacterSpecification explanatoryCharacterSet; public ExtentDescriptor volumeAbstract; @@ -184,12 +182,10 @@ namespace DiscImageChef.Filesystems public EntityIdentifier applicationIdentifier; public Timestamp recordingDateTime; public EntityIdentifier implementationIdentifier; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] implementationUse; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] implementationUse; public uint predecessorVolumeDescriptorSequenceLocation; public ushort flags; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] public byte[] reserved; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -198,17 +194,14 @@ namespace DiscImageChef.Filesystems public DescriptorTag tag; public uint volumeDescriptorSequenceNumber; public CharacterSpecification descriptorCharacterSet; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] logicalVolumeIdentifier; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] logicalVolumeIdentifier; public uint logicalBlockSize; public EntityIdentifier domainIdentifier; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] logicalVolumeContentsUse; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] logicalVolumeContentsUse; public uint mapTableLength; public uint numberOfPartitionMaps; public EntityIdentifier implementationIdentifier; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] implementationUse; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] implementationUse; public ExtentDescriptor integritySequenceExtent; } @@ -219,8 +212,7 @@ namespace DiscImageChef.Filesystems public Timestamp recordingDateTime; public uint integrityType; public ExtentDescriptor nextIntegrityExtent; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] logicalVolumeContentsUse; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] logicalVolumeContentsUse; public uint numberOfPartitions; public uint lengthOfImplementationUse; // Follows uint[numberOfPartitions] freeSpaceTable; @@ -242,43 +234,49 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { // UDF needs at least that - if(partition.End - partition.Start < 256) - return false; + if(partition.End - partition.Start < 256) return false; // UDF needs at least that - if(imagePlugin.ImageInfo.sectorSize < 512) - return false; + if(imagePlugin.ImageInfo.sectorSize < 512) return false; byte[] sector; AnchorVolumeDescriptorPointer anchor = new AnchorVolumeDescriptorPointer(); // All positions where anchor may reside - ulong[] positions = { 256, 512, partition.End - 256, partition.End }; + ulong[] positions = {256, 512, partition.End - 256, partition.End}; bool anchorFound = false; foreach(ulong position in positions) { - if(position + partition.Start >= partition.End) - continue; - + if(position + partition.Start >= partition.End) continue; + sector = imagePlugin.ReadSector(position); anchor = new AnchorVolumeDescriptorPointer(); IntPtr anchorPtr = Marshal.AllocHGlobal(Marshal.SizeOf(anchor)); Marshal.Copy(sector, 0, anchorPtr, Marshal.SizeOf(anchor)); - anchor = (AnchorVolumeDescriptorPointer)Marshal.PtrToStructure(anchorPtr, typeof(AnchorVolumeDescriptorPointer)); + anchor = + (AnchorVolumeDescriptorPointer)Marshal.PtrToStructure(anchorPtr, + typeof(AnchorVolumeDescriptorPointer)); Marshal.FreeHGlobal(anchorPtr); DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.tagIdentifier = {0}", anchor.tag.tagIdentifier); - DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.descriptorVersion = {0}", anchor.tag.descriptorVersion); + DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.descriptorVersion = {0}", + anchor.tag.descriptorVersion); DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.tagChecksum = 0x{0:X2}", anchor.tag.tagChecksum); DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.reserved = {0}", anchor.tag.reserved); DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.tagSerialNumber = {0}", anchor.tag.tagSerialNumber); - DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.descriptorCrc = 0x{0:X4}", anchor.tag.descriptorCrc); - DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.descriptorCrcLength = {0}", anchor.tag.descriptorCrcLength); + DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.descriptorCrc = 0x{0:X4}", + anchor.tag.descriptorCrc); + DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.descriptorCrcLength = {0}", + anchor.tag.descriptorCrcLength); DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.tagLocation = {0}", anchor.tag.tagLocation); - DicConsole.DebugWriteLine("UDF Plugin", "anchor.mainVolumeDescriptorSequenceExtent.length = {0}", anchor.mainVolumeDescriptorSequenceExtent.length); - DicConsole.DebugWriteLine("UDF Plugin", "anchor.mainVolumeDescriptorSequenceExtent.location = {0}", anchor.mainVolumeDescriptorSequenceExtent.location); - DicConsole.DebugWriteLine("UDF Plugin", "anchor.reserveVolumeDescriptorSequenceExtent.length = {0}", anchor.reserveVolumeDescriptorSequenceExtent.length); - DicConsole.DebugWriteLine("UDF Plugin", "anchor.reserveVolumeDescriptorSequenceExtent.location = {0}", anchor.reserveVolumeDescriptorSequenceExtent.location); + DicConsole.DebugWriteLine("UDF Plugin", "anchor.mainVolumeDescriptorSequenceExtent.length = {0}", + anchor.mainVolumeDescriptorSequenceExtent.length); + DicConsole.DebugWriteLine("UDF Plugin", "anchor.mainVolumeDescriptorSequenceExtent.location = {0}", + anchor.mainVolumeDescriptorSequenceExtent.location); + DicConsole.DebugWriteLine("UDF Plugin", "anchor.reserveVolumeDescriptorSequenceExtent.length = {0}", + anchor.reserveVolumeDescriptorSequenceExtent.length); + DicConsole.DebugWriteLine("UDF Plugin", "anchor.reserveVolumeDescriptorSequenceExtent.location = {0}", + anchor.reserveVolumeDescriptorSequenceExtent.location); if(anchor.tag.tagIdentifier == TagIdentifier.AnchorVolumeDescriptorPointer && anchor.tag.tagLocation == position && @@ -289,21 +287,20 @@ namespace DiscImageChef.Filesystems } } - if(!anchorFound) - return false; + if(!anchorFound) return false; ulong count = 0; while(count < 256) { - sector = imagePlugin.ReadSector(partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location + count); + sector = imagePlugin.ReadSector(partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location + + count); TagIdentifier tagId = (TagIdentifier)BitConverter.ToUInt16(sector, 0); uint location = BitConverter.ToUInt32(sector, 0x0C); if(location == partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location + count) { - if(tagId == TagIdentifier.TerminatingDescriptor) - break; + if(tagId == TagIdentifier.TerminatingDescriptor) break; if(tagId == TagIdentifier.LogicalVolumeDescriptor) { @@ -316,8 +313,7 @@ namespace DiscImageChef.Filesystems return UDF_Magic.SequenceEqual(lvd.domainIdentifier.identifier); } } - else - break; + else break; count++; } @@ -325,7 +321,8 @@ namespace DiscImageChef.Filesystems return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { byte[] sector; @@ -335,7 +332,7 @@ namespace DiscImageChef.Filesystems AnchorVolumeDescriptorPointer anchor = new AnchorVolumeDescriptorPointer(); // All positions where anchor may reside - ulong[] positions = { 256, 512, partition.End - 256, partition.End }; + ulong[] positions = {256, 512, partition.End - 256, partition.End}; foreach(ulong position in positions) { @@ -343,13 +340,14 @@ namespace DiscImageChef.Filesystems anchor = new AnchorVolumeDescriptorPointer(); IntPtr anchorPtr = Marshal.AllocHGlobal(Marshal.SizeOf(anchor)); Marshal.Copy(sector, 0, anchorPtr, Marshal.SizeOf(anchor)); - anchor = (AnchorVolumeDescriptorPointer)Marshal.PtrToStructure(anchorPtr, typeof(AnchorVolumeDescriptorPointer)); + anchor = + (AnchorVolumeDescriptorPointer)Marshal.PtrToStructure(anchorPtr, + typeof(AnchorVolumeDescriptorPointer)); Marshal.FreeHGlobal(anchorPtr); if(anchor.tag.tagIdentifier == TagIdentifier.AnchorVolumeDescriptorPointer && anchor.tag.tagLocation == position && - (anchor.mainVolumeDescriptorSequenceExtent.location + partition.Start) < partition.End) - break; + (anchor.mainVolumeDescriptorSequenceExtent.location + partition.Start) < partition.End) break; } ulong count = 0; @@ -357,18 +355,19 @@ namespace DiscImageChef.Filesystems PrimaryVolumeDescriptor pvd = new PrimaryVolumeDescriptor(); LogicalVolumeDescriptor lvd = new LogicalVolumeDescriptor(); LogicalVolumeIntegrityDescriptor lvid = new LogicalVolumeIntegrityDescriptor(); - LogicalVolumeIntegrityDescriptorImplementationUse lvidiu = new LogicalVolumeIntegrityDescriptorImplementationUse(); + LogicalVolumeIntegrityDescriptorImplementationUse lvidiu = + new LogicalVolumeIntegrityDescriptorImplementationUse(); while(count < 256) { - sector = imagePlugin.ReadSector(partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location + count); + sector = imagePlugin.ReadSector(partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location + + count); TagIdentifier tagId = (TagIdentifier)BitConverter.ToUInt16(sector, 0); uint location = BitConverter.ToUInt32(sector, 0x0C); if(location == partition.Start + anchor.mainVolumeDescriptorSequenceExtent.location + count) { - if(tagId == TagIdentifier.TerminatingDescriptor) - break; + if(tagId == TagIdentifier.TerminatingDescriptor) break; if(tagId == TagIdentifier.LogicalVolumeDescriptor) { @@ -386,8 +385,7 @@ namespace DiscImageChef.Filesystems Marshal.FreeHGlobal(pvdPtr); } } - else - break; + else break; count++; } @@ -395,56 +393,89 @@ namespace DiscImageChef.Filesystems sector = imagePlugin.ReadSector(lvd.integritySequenceExtent.location); IntPtr lvidPtr = Marshal.AllocHGlobal(Marshal.SizeOf(lvid)); Marshal.Copy(sector, 0, lvidPtr, Marshal.SizeOf(lvid)); - lvid = (LogicalVolumeIntegrityDescriptor)Marshal.PtrToStructure(lvidPtr, typeof(LogicalVolumeIntegrityDescriptor)); + lvid = + (LogicalVolumeIntegrityDescriptor) + Marshal.PtrToStructure(lvidPtr, typeof(LogicalVolumeIntegrityDescriptor)); Marshal.FreeHGlobal(lvidPtr); - if(lvid.tag.tagIdentifier == TagIdentifier.LogicalVolumeIntegrityDescriptor && lvid.tag.tagLocation == lvd.integritySequenceExtent.location) + if(lvid.tag.tagIdentifier == TagIdentifier.LogicalVolumeIntegrityDescriptor && + lvid.tag.tagLocation == lvd.integritySequenceExtent.location) { IntPtr lvidiuPtr = Marshal.AllocHGlobal(Marshal.SizeOf(lvidiu)); Marshal.Copy(sector, (int)(lvid.numberOfPartitions * 8 + 80), lvidiuPtr, Marshal.SizeOf(lvidiu)); - lvidiu = (LogicalVolumeIntegrityDescriptorImplementationUse)Marshal.PtrToStructure(lvidiuPtr, typeof(LogicalVolumeIntegrityDescriptorImplementationUse)); + lvidiu = + (LogicalVolumeIntegrityDescriptorImplementationUse)Marshal.PtrToStructure(lvidiuPtr, + typeof( + LogicalVolumeIntegrityDescriptorImplementationUse + )); Marshal.FreeHGlobal(lvidiuPtr); } - else - lvid = new LogicalVolumeIntegrityDescriptor(); + else lvid = new LogicalVolumeIntegrityDescriptor(); - sbInformation.AppendFormat("Volume is number {0} of {1}", pvd.volumeSequenceNumber, pvd.maximumVolumeSequenceNumber).AppendLine(); - sbInformation.AppendFormat("Volume set identifier: {0}", StringHandlers.DecompressUnicode(pvd.volumeSetIdentifier)).AppendLine(); - sbInformation.AppendFormat("Volume name: {0}", StringHandlers.DecompressUnicode(lvd.logicalVolumeIdentifier)).AppendLine(); + sbInformation.AppendFormat("Volume is number {0} of {1}", pvd.volumeSequenceNumber, + pvd.maximumVolumeSequenceNumber).AppendLine(); + sbInformation.AppendFormat("Volume set identifier: {0}", + StringHandlers.DecompressUnicode(pvd.volumeSetIdentifier)).AppendLine(); + sbInformation + .AppendFormat("Volume name: {0}", StringHandlers.DecompressUnicode(lvd.logicalVolumeIdentifier)) + .AppendLine(); sbInformation.AppendFormat("Volume uses {0} bytes per block", lvd.logicalBlockSize).AppendLine(); - sbInformation.AppendFormat("Volume was las written in {0}", ECMAToDateTime(lvid.recordingDateTime)).AppendLine(); + sbInformation.AppendFormat("Volume was las written in {0}", ECMAToDateTime(lvid.recordingDateTime)) + .AppendLine(); sbInformation.AppendFormat("Volume contains {0} partitions", lvid.numberOfPartitions).AppendLine(); - sbInformation.AppendFormat("Volume contains {0} files and {1} directories", lvidiu.files, lvidiu.directories).AppendLine(); - sbInformation.AppendFormat("Volume conforms to {0}", CurrentEncoding.GetString(lvd.domainIdentifier.identifier).TrimEnd(new char[] { '\u0000' })).AppendLine(); - sbInformation.AppendFormat("Volume was last written by: {0}", CurrentEncoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd(new char[]{ '\u0000' })).AppendLine(); - sbInformation.AppendFormat("Volume requires UDF version {0}.{1:X2} to be read", Convert.ToInt32(string.Format("{0}", (lvidiu.minimumReadUDF & 0xFF00) >> 8), 10), - Convert.ToInt32(string.Format("{0}", lvidiu.minimumReadUDF & 0xFF), 10)).AppendLine(); - sbInformation.AppendFormat("Volume requires UDF version {0}.{1:X2} to be written to", Convert.ToInt32(string.Format("{0}", (lvidiu.minimumWriteUDF & 0xFF00) >> 8), 10), - Convert.ToInt32(string.Format("{0}", lvidiu.minimumWriteUDF & 0xFF), 10)).AppendLine(); - sbInformation.AppendFormat("Volume cannot be written by any UDF version higher than {0}.{1:X2}", Convert.ToInt32(string.Format("{0}", (lvidiu.maximumWriteUDF & 0xFF00) >> 8), 10), - Convert.ToInt32(string.Format("{0}", lvidiu.maximumWriteUDF & 0xFF), 10)).AppendLine(); + sbInformation + .AppendFormat("Volume contains {0} files and {1} directories", lvidiu.files, lvidiu.directories) + .AppendLine(); + sbInformation.AppendFormat("Volume conforms to {0}", + CurrentEncoding + .GetString(lvd.domainIdentifier.identifier).TrimEnd(new char[] {'\u0000'})) + .AppendLine(); + sbInformation.AppendFormat("Volume was last written by: {0}", + CurrentEncoding + .GetString(pvd.implementationIdentifier.identifier) + .TrimEnd(new char[] {'\u0000'})).AppendLine(); + sbInformation.AppendFormat("Volume requires UDF version {0}.{1:X2} to be read", + Convert.ToInt32(string.Format("{0}", (lvidiu.minimumReadUDF & 0xFF00) >> 8), 10), + Convert.ToInt32(string.Format("{0}", lvidiu.minimumReadUDF & 0xFF), 10)) + .AppendLine(); + sbInformation.AppendFormat("Volume requires UDF version {0}.{1:X2} to be written to", + Convert.ToInt32(string.Format("{0}", (lvidiu.minimumWriteUDF & 0xFF00) >> 8), + 10), + Convert.ToInt32(string.Format("{0}", lvidiu.minimumWriteUDF & 0xFF), 10)) + .AppendLine(); + sbInformation.AppendFormat("Volume cannot be written by any UDF version higher than {0}.{1:X2}", + Convert.ToInt32(string.Format("{0}", (lvidiu.maximumWriteUDF & 0xFF00) >> 8), + 10), + Convert.ToInt32(string.Format("{0}", lvidiu.maximumWriteUDF & 0xFF), 10)) + .AppendLine(); xmlFSType = new Schemas.FileSystemType(); - xmlFSType.Type = string.Format("UDF v{0}.{1:X2}", Convert.ToInt32(string.Format("{0}", (lvidiu.maximumWriteUDF & 0xFF00) >> 8), 10), - Convert.ToInt32(string.Format("{0}", lvidiu.maximumWriteUDF & 0xFF), 10)); - xmlFSType.ApplicationIdentifier = CurrentEncoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd(new char[] { '\u0000' }); + xmlFSType.Type = string.Format("UDF v{0}.{1:X2}", + Convert.ToInt32(string.Format("{0}", (lvidiu.maximumWriteUDF & 0xFF00) >> 8), + 10), + Convert.ToInt32(string.Format("{0}", lvidiu.maximumWriteUDF & 0xFF), 10)); + xmlFSType.ApplicationIdentifier = CurrentEncoding + .GetString(pvd.implementationIdentifier.identifier).TrimEnd(new char[] {'\u0000'}); xmlFSType.ClusterSize = (int)lvd.logicalBlockSize; - xmlFSType.Clusters = (long)(((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.sectorSize) / (ulong)xmlFSType.ClusterSize); + xmlFSType.Clusters = (long)(((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.sectorSize) / + (ulong)xmlFSType.ClusterSize); xmlFSType.ModificationDate = ECMAToDateTime(lvid.recordingDateTime); xmlFSType.ModificationDateSpecified = true; xmlFSType.Files = lvidiu.files; xmlFSType.FilesSpecified = true; xmlFSType.VolumeName = StringHandlers.DecompressUnicode(lvd.logicalVolumeIdentifier); xmlFSType.VolumeSetIdentifier = StringHandlers.DecompressUnicode(pvd.volumeSetIdentifier); - xmlFSType.SystemIdentifier = CurrentEncoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd(new char[] { '\u0000' }); + xmlFSType.SystemIdentifier = CurrentEncoding + .GetString(pvd.implementationIdentifier.identifier).TrimEnd(new char[] {'\u0000'}); information = sbInformation.ToString(); } static DateTime ECMAToDateTime(Timestamp timestamp) { - return DateHandlers.ECMAToDateTime(timestamp.typeAndZone, timestamp.year, timestamp.month, timestamp.day, timestamp.hour, - timestamp.minute, timestamp.second, timestamp.centiseconds, timestamp.hundredsMicroseconds, + return DateHandlers.ECMAToDateTime(timestamp.typeAndZone, timestamp.year, timestamp.month, timestamp.day, + timestamp.hour, timestamp.minute, timestamp.second, + timestamp.centiseconds, timestamp.hundredsMicroseconds, timestamp.microseconds); } diff --git a/DiscImageChef.Filesystems/UNICOS.cs b/DiscImageChef.Filesystems/UNICOS.cs index 3786e6ba..ec650601 100644 --- a/DiscImageChef.Filesystems/UNICOS.cs +++ b/DiscImageChef.Filesystems/UNICOS.cs @@ -54,17 +54,17 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct nc1ireg_sb { - public ushort i_unused; /* reserved */ - public ushort i_nblk; /* number of blocks */ - public uint i_sblk; /* start block number */ + public ushort i_unused; /* reserved */ + public ushort i_nblk; /* number of blocks */ + public uint i_sblk; /* start block number */ } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct nc1fdev_sb { - public long fd_name; /* Physical device name */ - public uint fd_sblk; /* Start block number */ - public uint fd_nblk; /* Number of blocks */ + public long fd_name; /* Physical device name */ + public uint fd_sblk; /* Start block number */ + public uint fd_nblk; /* Number of blocks */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NC1MAXIREG)] public nc1ireg_sb[] fd_ireg; /* Inode regions */ } @@ -72,64 +72,61 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct UNICOS_Superblock { - public ulong s_magic; /* magic number to indicate file system type */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] s_fname; /* file system name */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] s_fpack; /* file system pack name */ - public dev_t s_dev; /* major/minor device, for verification */ + public ulong s_magic; /* magic number to indicate file system type */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] s_fname; /* file system name */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] s_fpack; /* file system pack name */ + public dev_t s_dev; /* major/minor device, for verification */ - public daddr_t s_fsize; /* size in blocks of entire volume */ - public long s_isize; /* Number of total inodes */ - public long s_bigfile; /* number of bytes at which a file is big */ - public long s_bigunit; /* minimum number of blocks allocated for big files */ - public ulong s_secure; /* security: secure FS label */ - public long s_maxlvl; /* security: maximum security level */ - public long s_minlvl; /* security: minimum security level */ - public long s_valcmp; /* security: valid security compartments */ - public time_t s_time; /* last super block update */ - public blkno_t s_dboff; /* Dynamic block number */ - public ino_t s_root; /* root inode */ - public long s_error; /* Type of file system error detected */ - public blkno_t s_mapoff; /* Start map block number */ - public long s_mapblks; /* Last map block number */ - public long s_nscpys; /* Number of copies of s.b per partition */ - public long s_npart; /* Number of partitions */ - public long s_ifract; /* Ratio of inodes to blocks */ - public extent_t s_sfs; /* SFS only blocks */ - public long s_flag; /* Flag word */ + public daddr_t s_fsize; /* size in blocks of entire volume */ + public long s_isize; /* Number of total inodes */ + public long s_bigfile; /* number of bytes at which a file is big */ + public long s_bigunit; /* minimum number of blocks allocated for big files */ + public ulong s_secure; /* security: secure FS label */ + public long s_maxlvl; /* security: maximum security level */ + public long s_minlvl; /* security: minimum security level */ + public long s_valcmp; /* security: valid security compartments */ + public time_t s_time; /* last super block update */ + public blkno_t s_dboff; /* Dynamic block number */ + public ino_t s_root; /* root inode */ + public long s_error; /* Type of file system error detected */ + public blkno_t s_mapoff; /* Start map block number */ + public long s_mapblks; /* Last map block number */ + public long s_nscpys; /* Number of copies of s.b per partition */ + public long s_npart; /* Number of partitions */ + public long s_ifract; /* Ratio of inodes to blocks */ + public extent_t s_sfs; /* SFS only blocks */ + public long s_flag; /* Flag word */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NC1MAXPART)] - public nc1fdev_sb[] s_part; /* Partition descriptors */ - public long s_iounit; /* Physical block size */ - public long s_numiresblks; /* number of inode reservation blocks */ - /* per region (currently 1) */ - /* 0 = 1*(AU) words, n = (n+1)*(AU) words */ + public nc1fdev_sb[] s_part; /* Partition descriptors */ + public long s_iounit; /* Physical block size */ + public long s_numiresblks; /* number of inode reservation blocks */ + /* per region (currently 1) */ + /* 0 = 1*(AU) words, n = (n+1)*(AU) words */ public long s_priparts; /* bitmap of primary partitions */ public long s_priblock; /* block size of primary partition(s) */ - /* 0 = 1*512 words, n = (n+1)*512 words */ + /* 0 = 1*512 words, n = (n+1)*512 words */ public long s_prinblks; /* number of 512 wds blocks in primary */ public long s_secparts; /* bitmap of secondary partitions */ public long s_secblock; /* block size of secondary partition(s) */ - /* 0 = 1*512 words, n = (n+1)*512 words */ + /* 0 = 1*512 words, n = (n+1)*512 words */ public long s_secnblks; /* number of 512 wds blocks in secondary */ - public long s_sbdbparts; /* bitmap of partitions with file system data */ - /* including super blocks, dynamic block */ - /* and free block bitmaps (only primary */ - /* partitions may contain these) */ - public long s_rootdparts; /* bitmap of partitions with root directory */ - /* (only primary partitions) */ + public long s_sbdbparts; /* bitmap of partitions with file system data */ + /* including super blocks, dynamic block */ + /* and free block bitmaps (only primary */ + /* partitions may contain these) */ + public long s_rootdparts; /* bitmap of partitions with root directory */ + /* (only primary partitions) */ public long s_nudparts; /* bitmap of no-user-data partitions */ - /* (only primary partitions) */ - public long s_nsema; /* SFS: # fs semaphores to allocate */ - public long s_priactive; /* bitmap of primary partitions which contain */ - /* active (up to date) dynamic blocks and */ - /* free block bitmaps. All bits set indicate */ - /* that all primary partitions are active, */ - /* and no kernel manipulation of active flag */ - /* is allowed. */ - public long s_sfs_arbiterid;/* SFS Arbiter ID */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 91)] - public long[] s_fill; /* reserved */ + /* (only primary partitions) */ + public long s_nsema; /* SFS: # fs semaphores to allocate */ + public long s_priactive; /* bitmap of primary partitions which contain */ + /* active (up to date) dynamic blocks and */ + /* free block bitmaps. All bits set indicate */ + /* that all primary partitions are active, */ + /* and no kernel manipulation of active flag */ + /* is allowed. */ + public long s_sfs_arbiterid; /* SFS Arbiter ID */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 91)] public long[] s_fill; /* reserved */ } const ulong UNICOS_Magic = 0x6e6331667331636e; @@ -146,71 +143,60 @@ namespace DiscImageChef.Filesystems { Name = "UNICOS Filesystem Plugin"; PluginUUID = new Guid("61712F04-066C-44D5-A2A0-1E44C66B33F0"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public UNICOS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "UNICOS Filesystem Plugin"; PluginUUID = new Guid("61712F04-066C-44D5-A2A0-1E44C66B33F0"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; UNICOS_Superblock unicosSb = new UNICOS_Superblock(); uint sbSize = (uint)((Marshal.SizeOf(unicosSb)) / imagePlugin.GetSectorSize()); - if((Marshal.SizeOf(unicosSb)) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if((Marshal.SizeOf(unicosSb)) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize); - if(sector.Length < Marshal.SizeOf(unicosSb)) - return false; + if(sector.Length < Marshal.SizeOf(unicosSb)) return false; unicosSb = BigEndianMarshal.ByteArrayToStructureBigEndian<UNICOS_Superblock>(sector); - DicConsole.DebugWriteLine("UNICOS plugin", "magic = 0x{0:X16} (expected 0x{1:X16})", unicosSb.s_magic, UNICOS_Magic); + DicConsole.DebugWriteLine("UNICOS plugin", "magic = 0x{0:X16} (expected 0x{1:X16})", unicosSb.s_magic, + UNICOS_Magic); return unicosSb.s_magic == UNICOS_Magic; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < 512) - return; + if(imagePlugin.GetSectorSize() < 512) return; UNICOS_Superblock unicosSb = new UNICOS_Superblock(); uint sbSize = (uint)((Marshal.SizeOf(unicosSb)) / imagePlugin.GetSectorSize()); - if((Marshal.SizeOf(unicosSb)) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if((Marshal.SizeOf(unicosSb)) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize); - if(sector.Length < Marshal.SizeOf(unicosSb)) - return; + if(sector.Length < Marshal.SizeOf(unicosSb)) return; unicosSb = BigEndianMarshal.ByteArrayToStructureBigEndian<UNICOS_Superblock>(sector); - - if(unicosSb.s_magic != UNICOS_Magic) - return; + if(unicosSb.s_magic != UNICOS_Magic) return; StringBuilder sb = new StringBuilder(); sb.AppendLine("UNICOS filesystem"); - if(unicosSb.s_secure == UNICOS_Secure) - sb.AppendLine("Volume is secure"); + if(unicosSb.s_secure == UNICOS_Secure) sb.AppendLine("Volume is secure"); sb.AppendFormat("Volume contains {0} partitions", unicosSb.s_npart).AppendLine(); sb.AppendFormat("{0} bytes per sector", unicosSb.s_iounit).AppendLine(); sb.AppendLine("4096 bytes per block"); @@ -220,7 +206,8 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Volume last updated on {0}", DateHandlers.UNIXToDateTime(unicosSb.s_time)).AppendLine(); if(unicosSb.s_error > 0) sb.AppendFormat("Volume is dirty, error code = 0x{0:X16}", unicosSb.s_error).AppendLine(); - sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(unicosSb.s_fname, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(unicosSb.s_fname, CurrentEncoding)) + .AppendLine(); information = sb.ToString(); diff --git a/DiscImageChef.Filesystems/UNIXBFS.cs b/DiscImageChef.Filesystems/UNIXBFS.cs index 2d650482..d43c2fe5 100644 --- a/DiscImageChef.Filesystems/UNIXBFS.cs +++ b/DiscImageChef.Filesystems/UNIXBFS.cs @@ -54,26 +54,21 @@ namespace DiscImageChef.Filesystems { Name = "UNIX Boot filesystem"; PluginUUID = new Guid("1E6E0DA6-F7E4-494C-80C6-CB5929E96155"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public BFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "UNIX Boot filesystem"; PluginUUID = new Guid("1E6E0DA6-F7E4-494C-80C6-CB5929E96155"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if((2 + partition.Start) >= partition.End) - return false; + if((2 + partition.Start) >= partition.End) return false; uint magic; @@ -82,7 +77,8 @@ namespace DiscImageChef.Filesystems return magic == BFS_MAGIC; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -115,7 +111,8 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_volume: 0x{0}", bfs_sb.s_volume); sb.AppendLine("UNIX Boot filesystem"); - sb.AppendFormat("Volume goes from byte {0} to byte {1}, for {2} bytes", bfs_sb.s_start, bfs_sb.s_end, bfs_sb.s_end - bfs_sb.s_start).AppendLine(); + sb.AppendFormat("Volume goes from byte {0} to byte {1}, for {2} bytes", bfs_sb.s_start, bfs_sb.s_end, + bfs_sb.s_end - bfs_sb.s_start).AppendLine(); sb.AppendFormat("Filesystem name: {0}", bfs_sb.s_fsname).AppendLine(); sb.AppendFormat("Volume name: {0}", bfs_sb.s_volume).AppendLine(); diff --git a/DiscImageChef.Filesystems/VMfs.cs b/DiscImageChef.Filesystems/VMfs.cs index 48ebdeb1..108c593b 100644 --- a/DiscImageChef.Filesystems/VMfs.cs +++ b/DiscImageChef.Filesystems/VMfs.cs @@ -51,20 +51,16 @@ namespace DiscImageChef.Filesystems { Name = "VMware filesystem"; PluginUUID = new Guid("EE52BDB8-B49C-4122-A3DA-AD21CBE79843"); - if(encoding == null) - CurrentEncoding = Encoding.UTF8; - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.UTF8; + else CurrentEncoding = encoding; } public VMfs(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "VMware filesystem"; PluginUUID = new Guid("EE52BDB8-B49C-4122-A3DA-AD21CBE79843"); - if(encoding == null) - CurrentEncoding = Encoding.UTF8; - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.UTF8; + else CurrentEncoding = encoding; } [Flags] @@ -79,18 +75,13 @@ namespace DiscImageChef.Filesystems { public uint magic; public uint version; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] unknown1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] unknown1; public byte lun; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] unknown2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] - public byte[] name; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 49)] - public byte[] unknown3; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] unknown2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 49)] public byte[] unknown3; public uint size; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] - public byte[] unknown4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] public byte[] unknown4; public Guid uuid; public ulong ctime; public ulong mtime; @@ -104,14 +95,12 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(partition.Start >= partition.End) - return false; + if(partition.Start >= partition.End) return false; ulong vmfsSuperOff = VMfs_Base / imagePlugin.ImageInfo.sectorSize; - if(partition.Start + vmfsSuperOff > partition.End) - return false; - + if(partition.Start + vmfsSuperOff > partition.End) return false; + byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff); uint magic = BitConverter.ToUInt32(sector, 0x00); @@ -119,7 +108,8 @@ namespace DiscImageChef.Filesystems return magic == VMfs_MAGIC; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { ulong vmfsSuperOff = VMfs_Base / imagePlugin.ImageInfo.sectorSize; byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff); @@ -140,11 +130,15 @@ namespace DiscImageChef.Filesystems uint mtimeNanoSecs = (uint)(volInfo.mtime % 1000000); sbInformation.AppendFormat("Volume version {0}", volInfo.version).AppendLine(); - sbInformation.AppendFormat("Volume name {0}", StringHandlers.CToString(volInfo.name, CurrentEncoding)).AppendLine(); + sbInformation.AppendFormat("Volume name {0}", StringHandlers.CToString(volInfo.name, CurrentEncoding)) + .AppendLine(); sbInformation.AppendFormat("Volume size {0} bytes", volInfo.size * 256).AppendLine(); sbInformation.AppendFormat("Volume UUID {0}", volInfo.uuid).AppendLine(); - sbInformation.AppendFormat("Volume created on {0}", DateHandlers.UNIXUnsignedToDateTime(ctimeSecs, ctimeNanoSecs)).AppendLine(); - sbInformation.AppendFormat("Volume last modified on {0}", DateHandlers.UNIXUnsignedToDateTime(mtimeSecs, mtimeNanoSecs)).AppendLine(); + sbInformation + .AppendFormat("Volume created on {0}", DateHandlers.UNIXUnsignedToDateTime(ctimeSecs, ctimeNanoSecs)) + .AppendLine(); + sbInformation.AppendFormat("Volume last modified on {0}", + DateHandlers.UNIXUnsignedToDateTime(mtimeSecs, mtimeNanoSecs)).AppendLine(); information = sbInformation.ToString(); diff --git a/DiscImageChef.Filesystems/VxFS.cs b/DiscImageChef.Filesystems/VxFS.cs index d3a40025..cd6f9685 100644 --- a/DiscImageChef.Filesystems/VxFS.cs +++ b/DiscImageChef.Filesystems/VxFS.cs @@ -51,20 +51,16 @@ namespace DiscImageChef.Filesystems { Name = "Veritas filesystem"; PluginUUID = new Guid("EC372605-7687-453C-8BEA-7E0DFF79CB03"); - if(encoding == null) - CurrentEncoding = Encoding.UTF8; - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.UTF8; + else CurrentEncoding = encoding; } public VxFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Veritas filesystem"; PluginUUID = new Guid("EC372605-7687-453C-8BEA-7E0DFF79CB03"); - if(encoding == null) - CurrentEncoding = Encoding.UTF8; - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.UTF8; + else CurrentEncoding = encoding; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -171,8 +167,7 @@ namespace DiscImageChef.Filesystems /// <summary>number of free inodes</summary> public int vs_ifree; /// <summary>number of free extents by size</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public int[] vs_efree; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public int[] vs_efree; /// <summary>flags ?!?</summary> public int vs_flags; /// <summary>filesystem has been changed</summary> @@ -188,18 +183,15 @@ namespace DiscImageChef.Filesystems /// <summary>last time written - usec</summary> public uint vs_wutime; /// <summary>FS name</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] vs_fname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] vs_fname; /// <summary>FS pack name</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] vs_fpack; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] vs_fpack; /// <summary>log format version</summary> public int vs_logversion; /// <summary>unused</summary> public int __unused5; /// <summary>OLT extent and replica</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public int[] vs_oltext; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public int[] vs_oltext; /// <summary>OLT extent size</summary> public int vs_oltsize; /// <summary>size of inode map</summary> @@ -224,9 +216,8 @@ namespace DiscImageChef.Filesystems { ulong vmfsSuperOff = VxFS_Base / imagePlugin.ImageInfo.sectorSize; - if(partition.Start + vmfsSuperOff >= partition.End) - return false; - + if(partition.Start + vmfsSuperOff >= partition.End) return false; + byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff); uint magic = BitConverter.ToUInt32(sector, 0x00); @@ -234,7 +225,8 @@ namespace DiscImageChef.Filesystems return magic == VxFS_MAGIC; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { ulong vmfsSuperOff = VxFS_Base / imagePlugin.ImageInfo.sectorSize; byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff); @@ -250,15 +242,18 @@ namespace DiscImageChef.Filesystems sbInformation.AppendLine("Veritas file system"); sbInformation.AppendFormat("Volume version {0}", vxSb.vs_version).AppendLine(); - sbInformation.AppendFormat("Volume name {0}", StringHandlers.CToString(vxSb.vs_fname, CurrentEncoding)).AppendLine(); - sbInformation.AppendFormat("Volume has {0} blocks of {1} bytes each", vxSb.vs_bsize, vxSb.vs_size).AppendLine(); + sbInformation.AppendFormat("Volume name {0}", StringHandlers.CToString(vxSb.vs_fname, CurrentEncoding)) + .AppendLine(); + sbInformation.AppendFormat("Volume has {0} blocks of {1} bytes each", vxSb.vs_bsize, vxSb.vs_size) + .AppendLine(); sbInformation.AppendFormat("Volume has {0} inodes per block", vxSb.vs_inopb).AppendLine(); sbInformation.AppendFormat("Volume has {0} free inodes", vxSb.vs_ifree).AppendLine(); sbInformation.AppendFormat("Volume has {0} free blocks", vxSb.vs_free).AppendLine(); - sbInformation.AppendFormat("Volume created on {0}", DateHandlers.UNIXUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime)).AppendLine(); - sbInformation.AppendFormat("Volume last modified on {0}", DateHandlers.UNIXUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime)).AppendLine(); - if(vxSb.vs_clean != 0) - sbInformation.AppendLine("Volume is dirty"); + sbInformation.AppendFormat("Volume created on {0}", + DateHandlers.UNIXUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime)).AppendLine(); + sbInformation.AppendFormat("Volume last modified on {0}", + DateHandlers.UNIXUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime)).AppendLine(); + if(vxSb.vs_clean != 0) sbInformation.AppendLine("Volume is dirty"); information = sbInformation.ToString(); diff --git a/DiscImageChef.Filesystems/XFS.cs b/DiscImageChef.Filesystems/XFS.cs index 29ae3773..083a8055 100644 --- a/DiscImageChef.Filesystems/XFS.cs +++ b/DiscImageChef.Filesystems/XFS.cs @@ -63,8 +63,7 @@ namespace DiscImageChef.Filesystems public ushort sectsize; public ushort inodesize; public ushort inopblock; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] fname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] fname; public byte blocklog; public byte sectlog; public byte inodelog; @@ -116,26 +115,21 @@ namespace DiscImageChef.Filesystems { Name = "XFS Filesystem Plugin"; PluginUUID = new Guid("1D8CD8B8-27E6-410F-9973-D16409225FBA"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public XFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "XFS Filesystem Plugin"; PluginUUID = new Guid("1D8CD8B8-27E6-410F-9973-D16409225FBA"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; // Misaligned if(imagePlugin.ImageInfo.xmlMediaType == ImagePlugins.XmlMediaType.OpticalDisc) @@ -143,58 +137,54 @@ namespace DiscImageChef.Filesystems XFS_Superblock xfsSb = new XFS_Superblock(); uint sbSize = (uint)((Marshal.SizeOf(xfsSb) + 0x400) / imagePlugin.GetSectorSize()); - if((Marshal.SizeOf(xfsSb) + 0x400) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if((Marshal.SizeOf(xfsSb) + 0x400) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize); - if(sector.Length < Marshal.SizeOf(xfsSb)) - return false; + if(sector.Length < Marshal.SizeOf(xfsSb)) return false; byte[] sbpiece = new byte[Marshal.SizeOf(xfsSb)]; - foreach(int location in new[] { 0, 0x200, 0x400 }) + foreach(int location in new[] {0, 0x200, 0x400}) { Array.Copy(sector, location, sbpiece, 0, Marshal.SizeOf(xfsSb)); xfsSb = BigEndianMarshal.ByteArrayToStructureBigEndian<XFS_Superblock>(sbpiece); - DicConsole.DebugWriteLine("XFS plugin", "magic at 0x{0:X3} = 0x{1:X8} (expected 0x{2:X8})", location, xfsSb.magicnum, XFS_Magic); + DicConsole.DebugWriteLine("XFS plugin", "magic at 0x{0:X3} = 0x{1:X8} (expected 0x{2:X8})", + location, xfsSb.magicnum, XFS_Magic); - if(xfsSb.magicnum == XFS_Magic) - return true; + if(xfsSb.magicnum == XFS_Magic) return true; } } else { - foreach(ulong location in new[] { 0, 1, 2 }) + foreach(ulong location in new[] {0, 1, 2}) { XFS_Superblock xfsSb = new XFS_Superblock(); uint sbSize = (uint)(Marshal.SizeOf(xfsSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(xfsSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(xfsSb) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start + location, sbSize); - if(sector.Length < Marshal.SizeOf(xfsSb)) - return false; + if(sector.Length < Marshal.SizeOf(xfsSb)) return false; xfsSb = BigEndianMarshal.ByteArrayToStructureBigEndian<XFS_Superblock>(sector); - DicConsole.DebugWriteLine("XFS plugin", "magic at {0} = 0x{1:X8} (expected 0x{2:X8})", location, xfsSb.magicnum, XFS_Magic); + DicConsole.DebugWriteLine("XFS plugin", "magic at {0} = 0x{1:X8} (expected 0x{2:X8})", location, + xfsSb.magicnum, XFS_Magic); - if(xfsSb.magicnum == XFS_Magic) - return true; + if(xfsSb.magicnum == XFS_Magic) return true; } } return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < 512) - return; + if(imagePlugin.GetSectorSize() < 512) return; XFS_Superblock xfsSb = new XFS_Superblock(); @@ -202,50 +192,45 @@ namespace DiscImageChef.Filesystems if(imagePlugin.ImageInfo.xmlMediaType == ImagePlugins.XmlMediaType.OpticalDisc) { uint sbSize = (uint)((Marshal.SizeOf(xfsSb) + 0x400) / imagePlugin.GetSectorSize()); - if((Marshal.SizeOf(xfsSb) + 0x400) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if((Marshal.SizeOf(xfsSb) + 0x400) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize); - if(sector.Length < Marshal.SizeOf(xfsSb)) - return; + if(sector.Length < Marshal.SizeOf(xfsSb)) return; byte[] sbpiece = new byte[Marshal.SizeOf(xfsSb)]; - foreach(int location in new[] { 0, 0x200, 0x400 }) + foreach(int location in new[] {0, 0x200, 0x400}) { Array.Copy(sector, location, sbpiece, 0, Marshal.SizeOf(xfsSb)); xfsSb = BigEndianMarshal.ByteArrayToStructureBigEndian<XFS_Superblock>(sbpiece); - DicConsole.DebugWriteLine("XFS plugin", "magic at 0x{0:X3} = 0x{1:X8} (expected 0x{2:X8})", location, xfsSb.magicnum, XFS_Magic); + DicConsole.DebugWriteLine("XFS plugin", "magic at 0x{0:X3} = 0x{1:X8} (expected 0x{2:X8})", + location, xfsSb.magicnum, XFS_Magic); - if(xfsSb.magicnum == XFS_Magic) - break; + if(xfsSb.magicnum == XFS_Magic) break; } } else { - foreach(ulong location in new[] { 0, 1, 2 }) + foreach(ulong location in new[] {0, 1, 2}) { uint sbSize = (uint)(Marshal.SizeOf(xfsSb) / imagePlugin.GetSectorSize()); - if(Marshal.SizeOf(xfsSb) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if(Marshal.SizeOf(xfsSb) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start + location, sbSize); - if(sector.Length < Marshal.SizeOf(xfsSb)) - return; + if(sector.Length < Marshal.SizeOf(xfsSb)) return; xfsSb = BigEndianMarshal.ByteArrayToStructureBigEndian<XFS_Superblock>(sector); - DicConsole.DebugWriteLine("XFS plugin", "magic at {0} = 0x{1:X8} (expected 0x{2:X8})", location, xfsSb.magicnum, XFS_Magic); + DicConsole.DebugWriteLine("XFS plugin", "magic at {0} = 0x{1:X8} (expected 0x{2:X8})", location, + xfsSb.magicnum, XFS_Magic); - if(xfsSb.magicnum == XFS_Magic) - break; + if(xfsSb.magicnum == XFS_Magic) break; } } - if(xfsSb.magicnum != XFS_Magic) - return; + if(xfsSb.magicnum != XFS_Magic) return; StringBuilder sb = new StringBuilder(); @@ -258,8 +243,7 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} blocks per allocation group", xfsSb.agblocks).AppendLine(); sb.AppendFormat("{0} allocation groups in volume", xfsSb.agcount).AppendLine(); sb.AppendFormat("{0} inodes in volume, {1} free", xfsSb.icount, xfsSb.ifree).AppendLine(); - if(xfsSb.inprogress > 0) - sb.AppendLine("fsck in progress"); + if(xfsSb.inprogress > 0) sb.AppendLine("fsck in progress"); sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(xfsSb.fname, CurrentEncoding)).AppendLine(); sb.AppendFormat("Volume UUID: {0}", xfsSb.uuid).AppendLine(); diff --git a/DiscImageChef.Filesystems/ZFS.cs b/DiscImageChef.Filesystems/ZFS.cs index 98f2f062..b8271a54 100644 --- a/DiscImageChef.Filesystems/ZFS.cs +++ b/DiscImageChef.Filesystems/ZFS.cs @@ -64,8 +64,7 @@ namespace DiscImageChef.Filesystems struct ZIO_Checksum { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public ulong[] word; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public ulong[] word; } /// <summary> @@ -74,8 +73,7 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZIO_Empty { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 472)] - public byte[] empty; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 472)] public byte[] empty; public ulong magic; public ZIO_Checksum checksum; } @@ -175,8 +173,7 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct DVA { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public ulong[] word; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public ulong[] word; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -185,8 +182,7 @@ namespace DiscImageChef.Filesystems /// <summary> /// Data virtual address /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public DVA[] dataVirtualAddress; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public DVA[] dataVirtualAddress; /// <summary> /// Block properties /// </summary> @@ -251,8 +247,7 @@ namespace DiscImageChef.Filesystems public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; byte[] sector; ulong magic; @@ -261,26 +256,24 @@ namespace DiscImageChef.Filesystems { sector = imagePlugin.ReadSector(partition.Start + 31); magic = BitConverter.ToUInt64(sector, 0x1D8); - if(magic == ZEC_Magic || magic == ZEC_Cigam) - return true; + if(magic == ZEC_Magic || magic == ZEC_Cigam) return true; } if(partition.Start + 16 < partition.End) { sector = imagePlugin.ReadSector(partition.Start + 16); magic = BitConverter.ToUInt64(sector, 0x1D8); - if(magic == ZEC_Magic || magic == ZEC_Cigam) - return true; + if(magic == ZEC_Magic || magic == ZEC_Cigam) return true; } return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < 512) - return; + if(imagePlugin.GetSectorSize() < 512) return; byte[] sector; ulong magic; @@ -293,16 +286,14 @@ namespace DiscImageChef.Filesystems { sector = imagePlugin.ReadSector(partition.Start + 31); magic = BitConverter.ToUInt64(sector, 0x1D8); - if(magic == ZEC_Magic || magic == ZEC_Cigam) - nvlistOff = 32; + if(magic == ZEC_Magic || magic == ZEC_Cigam) nvlistOff = 32; } if(partition.Start + 16 < partition.End) { sector = imagePlugin.ReadSector(partition.Start + 16); magic = BitConverter.ToUInt64(sector, 0x1D8); - if(magic == ZEC_Magic || magic == ZEC_Cigam) - nvlistOff = 17; + if(magic == ZEC_Magic || magic == ZEC_Cigam) nvlistOff = 17; } StringBuilder sb = new StringBuilder(); @@ -311,10 +302,8 @@ namespace DiscImageChef.Filesystems nvlist = imagePlugin.ReadSectors(partition.Start + nvlistOff, nvlistLen); Dictionary<string, NVS_Item> decodedNvList; - if(!DecodeNvList(nvlist, out decodedNvList)) - sb.AppendLine("Could not decode nvlist"); - else - sb.AppendLine(PrintNvList(decodedNvList)); + if(!DecodeNvList(nvlist, out decodedNvList)) sb.AppendLine("Could not decode nvlist"); + else sb.AppendLine(PrintNvList(decodedNvList)); information = sb.ToString(); @@ -322,8 +311,7 @@ namespace DiscImageChef.Filesystems xmlFSType = new Schemas.FileSystemType(); xmlFSType.Type = "ZFS filesystem"; - if(decodedNvList.TryGetValue("name", out tmpObj)) - xmlFSType.VolumeName = (string)tmpObj.value; + if(decodedNvList.TryGetValue("name", out tmpObj)) xmlFSType.VolumeName = (string)tmpObj.value; if(decodedNvList.TryGetValue("guid", out tmpObj)) xmlFSType.VolumeSerial = string.Format("{0}", (ulong)tmpObj.value); if(decodedNvList.TryGetValue("pool_guid", out tmpObj)) @@ -341,16 +329,15 @@ namespace DiscImageChef.Filesystems } // TODO: Decode native nvlist - static bool DecodeNvList(byte[] nvlist, out Dictionary<string, NVS_Item> decodedNvList, bool xdr, bool littleEndian) + static bool DecodeNvList(byte[] nvlist, out Dictionary<string, NVS_Item> decodedNvList, bool xdr, + bool littleEndian) { decodedNvList = new Dictionary<string, NVS_Item>(); - if(nvlist == null || nvlist.Length < 16) - return false; + if(nvlist == null || nvlist.Length < 16) return false; int offset = 0; - if(!xdr) - return false; + if(!xdr) return false; BigEndianBitConverter.IsLittleEndian = littleEndian; @@ -365,16 +352,14 @@ namespace DiscImageChef.Filesystems item.encodedSize = BigEndianBitConverter.ToUInt32(nvlist, offset); // Finished - if(item.encodedSize == 0) - break; - + if(item.encodedSize == 0) break; + offset += 4; item.decodedSize = BigEndianBitConverter.ToUInt32(nvlist, offset); offset += 4; nameLength = BigEndianBitConverter.ToUInt32(nvlist, offset); offset += 4; - if(nameLength % 4 > 0) - nameLength += 4 - (nameLength % 4); + if(nameLength % 4 > 0) nameLength += 4 - (nameLength % 4); nameBytes = new byte[nameLength]; Array.Copy(nvlist, offset, nameBytes, 0, nameLength); item.name = StringHandlers.CToString(nameBytes); @@ -404,6 +389,7 @@ namespace DiscImageChef.Filesystems boolArray[i] = temp > 0; offset += 4; } + item.value = boolArray; } else @@ -412,6 +398,7 @@ namespace DiscImageChef.Filesystems item.value = (temp > 0); offset += 4; } + break; case NVS_DataTypes.DATA_TYPE_BYTE: case NVS_DataTypes.DATA_TYPE_BYTE_ARRAY: @@ -422,8 +409,7 @@ namespace DiscImageChef.Filesystems byte[] byteArray = new byte[item.elements]; Array.Copy(nvlist, offset, byteArray, 0, item.elements); offset += (int)item.elements; - if(item.elements % 4 > 0) - offset += 4 - (int)(item.elements % 4); + if(item.elements % 4 > 0) offset += 4 - (int)(item.elements % 4); item.value = byteArray; } else @@ -442,6 +428,7 @@ namespace DiscImageChef.Filesystems doubleArray[i] = temp; offset += 8; } + item.value = doubleArray; } else @@ -449,6 +436,7 @@ namespace DiscImageChef.Filesystems item.value = BigEndianBitConverter.ToDouble(nvlist, offset); offset += 8; } + break; case NVS_DataTypes.DATA_TYPE_HRTIME: if(item.elements > 1) @@ -456,17 +444,21 @@ namespace DiscImageChef.Filesystems DateTime[] hrtimeArray = new DateTime[item.elements]; for(int i = 0; i < item.elements; i++) { - DateTime temp = DateHandlers.UNIXHrTimeToDateTime(BigEndianBitConverter.ToUInt64(nvlist, offset)); + DateTime temp = + DateHandlers.UNIXHrTimeToDateTime(BigEndianBitConverter.ToUInt64(nvlist, offset)); hrtimeArray[i] = temp; offset += 8; } + item.value = hrtimeArray; } else { - item.value = DateHandlers.UNIXHrTimeToDateTime(BigEndianBitConverter.ToUInt64(nvlist, offset)); + item.value = + DateHandlers.UNIXHrTimeToDateTime(BigEndianBitConverter.ToUInt64(nvlist, offset)); offset += 8; } + break; case NVS_DataTypes.DATA_TYPE_INT16: case NVS_DataTypes.DATA_TYPE_INT16_ARRAY: @@ -479,6 +471,7 @@ namespace DiscImageChef.Filesystems shortArray[i] = temp; offset += 4; } + item.value = shortArray; } else @@ -486,6 +479,7 @@ namespace DiscImageChef.Filesystems item.value = BigEndianBitConverter.ToInt16(nvlist, offset); offset += 4; } + break; case NVS_DataTypes.DATA_TYPE_INT32: case NVS_DataTypes.DATA_TYPE_INT32_ARRAY: @@ -498,6 +492,7 @@ namespace DiscImageChef.Filesystems intArray[i] = temp; offset += 4; } + item.value = intArray; } else @@ -505,6 +500,7 @@ namespace DiscImageChef.Filesystems item.value = BigEndianBitConverter.ToInt32(nvlist, offset); offset += 4; } + break; case NVS_DataTypes.DATA_TYPE_INT64: case NVS_DataTypes.DATA_TYPE_INT64_ARRAY: @@ -517,6 +513,7 @@ namespace DiscImageChef.Filesystems longArray[i] = temp; offset += 8; } + item.value = longArray; } else @@ -524,6 +521,7 @@ namespace DiscImageChef.Filesystems item.value = BigEndianBitConverter.ToInt64(nvlist, offset); offset += 8; } + break; case NVS_DataTypes.DATA_TYPE_INT8: case NVS_DataTypes.DATA_TYPE_INT8_ARRAY: @@ -536,15 +534,16 @@ namespace DiscImageChef.Filesystems sbyteArray[i] = temp; offset++; } + item.value = sbyteArray; - if(sbyteArray.Length % 4 > 0) - offset += 4 - sbyteArray.Length % 4; + if(sbyteArray.Length % 4 > 0) offset += 4 - sbyteArray.Length % 4; } else { item.value = BigEndianBitConverter.ToInt64(nvlist, offset); offset += 4; } + break; case NVS_DataTypes.DATA_TYPE_STRING: case NVS_DataTypes.DATA_TYPE_STRING_ARRAY: @@ -559,9 +558,9 @@ namespace DiscImageChef.Filesystems Array.Copy(nvlist, offset, strBytes, 0, strLength); stringArray[i] = StringHandlers.CToString(strBytes); offset += (int)strLength; - if(strLength % 4 > 0) - offset += 4 - (int)(strLength % 4); + if(strLength % 4 > 0) offset += 4 - (int)(strLength % 4); } + item.value = stringArray; } else @@ -572,9 +571,9 @@ namespace DiscImageChef.Filesystems Array.Copy(nvlist, offset, strBytes, 0, strLength); item.value = StringHandlers.CToString(strBytes); offset += (int)strLength; - if(strLength % 4 > 0) - offset += 4 - (int)(strLength % 4); + if(strLength % 4 > 0) offset += 4 - (int)(strLength % 4); } + break; case NVS_DataTypes.DATA_TYPE_UINT16: case NVS_DataTypes.DATA_TYPE_UINT16_ARRAY: @@ -587,6 +586,7 @@ namespace DiscImageChef.Filesystems ushortArray[i] = temp; offset += 4; } + item.value = ushortArray; } else @@ -594,6 +594,7 @@ namespace DiscImageChef.Filesystems item.value = BigEndianBitConverter.ToUInt16(nvlist, offset); offset += 4; } + break; case NVS_DataTypes.DATA_TYPE_UINT32: case NVS_DataTypes.DATA_TYPE_UINT32_ARRAY: @@ -606,6 +607,7 @@ namespace DiscImageChef.Filesystems uintArray[i] = temp; offset += 4; } + item.value = uintArray; } else @@ -613,6 +615,7 @@ namespace DiscImageChef.Filesystems item.value = BigEndianBitConverter.ToUInt32(nvlist, offset); offset += 4; } + break; case NVS_DataTypes.DATA_TYPE_UINT64: case NVS_DataTypes.DATA_TYPE_UINT64_ARRAY: @@ -625,6 +628,7 @@ namespace DiscImageChef.Filesystems ulongArray[i] = temp; offset += 8; } + item.value = ulongArray; } else @@ -632,18 +636,16 @@ namespace DiscImageChef.Filesystems item.value = BigEndianBitConverter.ToUInt64(nvlist, offset); offset += 8; } + break; case NVS_DataTypes.DATA_TYPE_NVLIST: - if(item.elements > 1) - goto default; + if(item.elements > 1) goto default; byte[] subListBytes = new byte[item.encodedSize - (offset - currOff)]; Array.Copy(nvlist, offset, subListBytes, 0, subListBytes.Length); Dictionary<string, NVS_Item> subList; - if(DecodeNvList(subListBytes, out subList, xdr, littleEndian)) - item.value = subList; - else - goto default; + if(DecodeNvList(subListBytes, out subList, xdr, littleEndian)) item.value = subList; + else goto default; offset = (int)(currOff + item.encodedSize); break; default: @@ -681,8 +683,8 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) sb.AppendFormat("{0}[{1}] = {2}", item.name, i, ((bool[])item.value)[i]).AppendLine(); } - else - sb.AppendFormat("{0} = {1}", item.name, (bool)item.value).AppendLine(); + else sb.AppendFormat("{0} = {1}", item.name, (bool)item.value).AppendLine(); + break; case NVS_DataTypes.DATA_TYPE_BYTE: case NVS_DataTypes.DATA_TYPE_BYTE_ARRAY: @@ -693,8 +695,8 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) sb.AppendFormat("{0}[{1}] = {2}", item.name, i, ((byte[])item.value)[i]).AppendLine(); } - else - sb.AppendFormat("{0} = {1}", item.name, (byte)item.value).AppendLine(); + else sb.AppendFormat("{0} = {1}", item.name, (byte)item.value).AppendLine(); + break; case NVS_DataTypes.DATA_TYPE_DOUBLE: if(item.elements > 1) @@ -702,17 +704,18 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) sb.AppendFormat("{0}[{1}] = {2}", item.name, i, ((double[])item.value)[i]).AppendLine(); } - else - sb.AppendFormat("{0} = {1}", item.name, (double)item.value).AppendLine(); + else sb.AppendFormat("{0} = {1}", item.name, (double)item.value).AppendLine(); + break; case NVS_DataTypes.DATA_TYPE_HRTIME: if(item.elements > 1) { for(int i = 0; i < item.elements; i++) - sb.AppendFormat("{0}[{1}] = {2}", item.name, i, ((DateTime[])item.value)[i]).AppendLine(); + sb.AppendFormat("{0}[{1}] = {2}", item.name, i, ((DateTime[])item.value)[i]) + .AppendLine(); } - else - sb.AppendFormat("{0} = {1}", item.name, (DateTime)item.value).AppendLine(); + else sb.AppendFormat("{0} = {1}", item.name, (DateTime)item.value).AppendLine(); + break; case NVS_DataTypes.DATA_TYPE_INT16: case NVS_DataTypes.DATA_TYPE_INT16_ARRAY: @@ -721,8 +724,8 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) sb.AppendFormat("{0}[{1}] = {2}", item.name, i, ((short[])item.value)[i]).AppendLine(); } - else - sb.AppendFormat("{0} = {1}", item.name, (short)item.value).AppendLine(); + else sb.AppendFormat("{0} = {1}", item.name, (short)item.value).AppendLine(); + break; case NVS_DataTypes.DATA_TYPE_INT32: case NVS_DataTypes.DATA_TYPE_INT32_ARRAY: @@ -731,8 +734,8 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) sb.AppendFormat("{0}[{1}] = {2}", item.name, i, ((int[])item.value)[i]).AppendLine(); } - else - sb.AppendFormat("{0} = {1}", item.name, (int)item.value).AppendLine(); + else sb.AppendFormat("{0} = {1}", item.name, (int)item.value).AppendLine(); + break; case NVS_DataTypes.DATA_TYPE_INT64: case NVS_DataTypes.DATA_TYPE_INT64_ARRAY: @@ -741,8 +744,8 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) sb.AppendFormat("{0}[{1}] = {2}", item.name, i, ((long[])item.value)[i]).AppendLine(); } - else - sb.AppendFormat("{0} = {1}", item.name, (long)item.value).AppendLine(); + else sb.AppendFormat("{0} = {1}", item.name, (long)item.value).AppendLine(); + break; case NVS_DataTypes.DATA_TYPE_INT8: case NVS_DataTypes.DATA_TYPE_INT8_ARRAY: @@ -751,8 +754,8 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) sb.AppendFormat("{0}[{1}] = {2}", item.name, i, ((sbyte[])item.value)[i]).AppendLine(); } - else - sb.AppendFormat("{0} = {1}", item.name, (sbyte)item.value).AppendLine(); + else sb.AppendFormat("{0} = {1}", item.name, (sbyte)item.value).AppendLine(); + break; case NVS_DataTypes.DATA_TYPE_STRING: case NVS_DataTypes.DATA_TYPE_STRING_ARRAY: @@ -761,8 +764,8 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) sb.AppendFormat("{0}[{1}] = {2}", item.name, i, ((string[])item.value)[i]).AppendLine(); } - else - sb.AppendFormat("{0} = {1}", item.name, (string)item.value).AppendLine(); + else sb.AppendFormat("{0} = {1}", item.name, (string)item.value).AppendLine(); + break; case NVS_DataTypes.DATA_TYPE_UINT16: case NVS_DataTypes.DATA_TYPE_UINT16_ARRAY: @@ -771,8 +774,8 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) sb.AppendFormat("{0}[{1}] = {2}", item.name, i, ((ushort[])item.value)[i]).AppendLine(); } - else - sb.AppendFormat("{0} = {1}", item.name, (ushort)item.value).AppendLine(); + else sb.AppendFormat("{0} = {1}", item.name, (ushort)item.value).AppendLine(); + break; case NVS_DataTypes.DATA_TYPE_UINT32: case NVS_DataTypes.DATA_TYPE_UINT32_ARRAY: @@ -781,8 +784,8 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) sb.AppendFormat("{0}[{1}] = {2}", item.name, i, ((uint[])item.value)[i]).AppendLine(); } - else - sb.AppendFormat("{0} = {1}", item.name, (uint)item.value).AppendLine(); + else sb.AppendFormat("{0} = {1}", item.name, (uint)item.value).AppendLine(); + break; case NVS_DataTypes.DATA_TYPE_UINT64: case NVS_DataTypes.DATA_TYPE_UINT64_ARRAY: @@ -791,23 +794,26 @@ namespace DiscImageChef.Filesystems for(int i = 0; i < item.elements; i++) sb.AppendFormat("{0}[{1}] = {2}", item.name, i, ((ulong[])item.value)[i]).AppendLine(); } - else - sb.AppendFormat("{0} = {1}", item.name, (ulong)item.value).AppendLine(); + else sb.AppendFormat("{0} = {1}", item.name, (ulong)item.value).AppendLine(); + break; case NVS_DataTypes.DATA_TYPE_NVLIST: if(item.elements == 1) - sb.AppendFormat("{0} =\n{1}", item.name, PrintNvList((Dictionary<string, NVS_Item>)item.value)).AppendLine(); + sb.AppendFormat("{0} =\n{1}", item.name, + PrintNvList((Dictionary<string, NVS_Item>)item.value)).AppendLine(); else - sb.AppendFormat("{0} = {1} elements nvlist[], unable to print", item.name, item.elements).AppendLine(); + sb.AppendFormat("{0} = {1} elements nvlist[], unable to print", item.name, item.elements) + .AppendLine(); break; default: if(item.elements > 1) { for(int i = 0; i < item.elements; i++) - sb.AppendFormat("{0}[{1}] = Unknown data type {2}", item.name, i, item.dataType).AppendLine(); + sb.AppendFormat("{0}[{1}] = Unknown data type {2}", item.name, i, item.dataType) + .AppendLine(); } - else - sb.AppendFormat("{0} = Unknown data type {1}", item.name, item.dataType).AppendLine(); + else sb.AppendFormat("{0} = Unknown data type {1}", item.name, item.dataType).AppendLine(); + break; } } diff --git a/DiscImageChef.Filesystems/dump.cs b/DiscImageChef.Filesystems/dump.cs index f1b8ce76..d989ed98 100644 --- a/DiscImageChef.Filesystems/dump.cs +++ b/DiscImageChef.Filesystems/dump.cs @@ -150,35 +150,31 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct s_spcl { - public int c_type; /* record type (see below) */ - public int c_date; /* date of this dump */ - public int c_ddate; /* date of previous dump */ - public int c_volume; /* dump volume number */ - public int c_tapea; /* logical block of this record */ - public uint c_inumber; /* number of inode */ - public int c_magic; /* magic number (see above) */ - public int c_checksum; /* record checksum */ - public dinode c_dinode; /* ownership and mode of inode */ - public int c_count; /* number of valid c_addr entries */ + public int c_type; /* record type (see below) */ + public int c_date; /* date of this dump */ + public int c_ddate; /* date of previous dump */ + public int c_volume; /* dump volume number */ + public int c_tapea; /* logical block of this record */ + public uint c_inumber; /* number of inode */ + public int c_magic; /* magic number (see above) */ + public int c_checksum; /* record checksum */ + public dinode c_dinode; /* ownership and mode of inode */ + public int c_count; /* number of valid c_addr entries */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = TP_NINDIR)] - public byte[] c_addr; /* 1 => data; 0 => hole in inode */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = LBLSIZE)] - public byte[] c_label; /* dump label */ - public int c_level; /* level of this dump */ + public byte[] c_addr; /* 1 => data; 0 => hole in inode */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = LBLSIZE)] public byte[] c_label; /* dump label */ + public int c_level; /* level of this dump */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)] public byte[] c_filesys; /* name of dumpped file system */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)] - public byte[] c_dev; /* name of dumpped device */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)] - public byte[] c_host; /* name of dumpped host */ - public int c_flags; /* additional information */ - public int c_firstrec; /* first record on volume */ - public long c_ndate; /* date of this dump */ - public long c_nddate; /* date of previous dump */ - public long c_ntapea; /* logical block of this record */ - public long c_nfirstrec; /* first record on volume */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public int[] c_spare; /* reserved for future uses */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)] public byte[] c_dev; /* name of dumpped device */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)] public byte[] c_host; /* name of dumpped host */ + public int c_flags; /* additional information */ + public int c_firstrec; /* first record on volume */ + public long c_ndate; /* date of this dump */ + public long c_nddate; /* date of previous dump */ + public long c_ntapea; /* logical block of this record */ + public long c_nfirstrec; /* first record on volume */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public int[] c_spare; /* reserved for future uses */ } const int NDADDR = 12; @@ -187,27 +183,27 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct dinode { - public ushort di_mode; /* 0: IFMT, permissions; see below. */ - public short di_nlink; /* 2: File link count. */ - public int inumber; /* 4: Lfs: inode number. */ - public ulong di_size; /* 8: File byte count. */ - public int di_atime; /* 16: Last access time. */ - public int di_atimensec; /* 20: Last access time. */ - public int di_mtime; /* 24: Last modified time. */ - public int di_mtimensec; /* 28: Last modified time. */ - public int di_ctime; /* 32: Last inode change time. */ - public int di_ctimensec; /* 36: Last inode change time. */ + public ushort di_mode; /* 0: IFMT, permissions; see below. */ + public short di_nlink; /* 2: File link count. */ + public int inumber; /* 4: Lfs: inode number. */ + public ulong di_size; /* 8: File byte count. */ + public int di_atime; /* 16: Last access time. */ + public int di_atimensec; /* 20: Last access time. */ + public int di_mtime; /* 24: Last modified time. */ + public int di_mtimensec; /* 28: Last modified time. */ + public int di_ctime; /* 32: Last inode change time. */ + public int di_ctimensec; /* 36: Last inode change time. */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDADDR)] - public ufs_daddr_t[] di_db; /* 40: Direct disk blocks. */ + public ufs_daddr_t[] di_db; /* 40: Direct disk blocks. */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NIADDR)] - public ufs_daddr_t[] di_ib; /* 88: Indirect disk blocks. */ - public uint di_flags; /* 100: Status flags (chflags). */ - public uint di_blocks; /* 104: Blocks actually held. */ - public int di_gen; /* 108: Generation number. */ - public uint di_uid; /* 112: File owner. */ - public uint di_gid; /* 116: File group. */ + public ufs_daddr_t[] di_ib; /* 88: Indirect disk blocks. */ + public uint di_flags; /* 100: Status flags (chflags). */ + public uint di_blocks; /* 104: Blocks actually held. */ + public int di_gen; /* 108: Generation number. */ + public uint di_uid; /* 112: File owner. */ + public uint di_gid; /* 116: File group. */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public int[] di_spare; /* 120: Reserved; currently unused */ + public int[] di_spare; /* 120: Reserved; currently unused */ } public dump() @@ -221,42 +217,34 @@ namespace DiscImageChef.Filesystems { Name = "dump(8) Plugin"; PluginUUID = new Guid("E53B4D28-C858-4800-B092-DDAE80D361B9"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public dump(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "dump(8) Plugin"; PluginUUID = new Guid("E53B4D28-C858-4800-B092-DDAE80D361B9"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; // It should be start of a tape or floppy or file - if(partition.Start != 0) - return false; + if(partition.Start != 0) return false; spcl16 oldHdr = new spcl16(); spcl_aix aixHdr = new spcl_aix(); s_spcl newHdr = new s_spcl(); uint sbSize = (uint)((Marshal.SizeOf(newHdr)) / imagePlugin.GetSectorSize()); - if((Marshal.SizeOf(newHdr)) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if((Marshal.SizeOf(newHdr)) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize); - if(sector.Length < Marshal.SizeOf(newHdr)) - return false; + if(sector.Length < Marshal.SizeOf(newHdr)) return false; IntPtr oldPtr = Marshal.AllocHGlobal(Marshal.SizeOf(oldHdr)); Marshal.Copy(sector, 0, oldPtr, Marshal.SizeOf(oldHdr)); @@ -278,31 +266,27 @@ namespace DiscImageChef.Filesystems DicConsole.DebugWriteLine("dump(8) plugin", "new magic = 0x{0:X8}", newHdr.c_magic); return oldHdr.c_magic == OFS_MAGIC || aixHdr.c_magic == XIX_MAGIC || aixHdr.c_magic == XIX_CIGAM || - newHdr.c_magic == OFS_MAGIC || newHdr.c_magic == NFS_MAGIC || - newHdr.c_magic == OFS_CIGAM || newHdr.c_magic == NFS_CIGAM || - newHdr.c_magic == UFS2_MAGIC || newHdr.c_magic == UFS2_CIGAM; + newHdr.c_magic == OFS_MAGIC || newHdr.c_magic == NFS_MAGIC || newHdr.c_magic == OFS_CIGAM || + newHdr.c_magic == NFS_CIGAM || newHdr.c_magic == UFS2_MAGIC || newHdr.c_magic == UFS2_CIGAM; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; - if(imagePlugin.GetSectorSize() < 512) - return; + if(imagePlugin.GetSectorSize() < 512) return; - if(partition.Start != 0) - return; + if(partition.Start != 0) return; spcl16 oldHdr = new spcl16(); spcl_aix aixHdr = new spcl_aix(); s_spcl newHdr = new s_spcl(); uint sbSize = (uint)((Marshal.SizeOf(newHdr)) / imagePlugin.GetSectorSize()); - if((Marshal.SizeOf(newHdr)) % imagePlugin.GetSectorSize() != 0) - sbSize++; + if((Marshal.SizeOf(newHdr)) % imagePlugin.GetSectorSize() != 0) sbSize++; byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize); - if(sector.Length < Marshal.SizeOf(newHdr)) - return; + if(sector.Length < Marshal.SizeOf(newHdr)) return; IntPtr oldPtr = Marshal.AllocHGlobal(Marshal.SizeOf(oldHdr)); Marshal.Copy(sector, 0, oldPtr, Marshal.SizeOf(oldHdr)); @@ -323,14 +307,12 @@ namespace DiscImageChef.Filesystems bool useAix = false; bool useNew = false; - if(newHdr.c_magic == OFS_MAGIC || newHdr.c_magic == NFS_MAGIC || - newHdr.c_magic == OFS_CIGAM || newHdr.c_magic == NFS_CIGAM || - newHdr.c_magic == UFS2_MAGIC || newHdr.c_magic == UFS2_CIGAM) + if(newHdr.c_magic == OFS_MAGIC || newHdr.c_magic == NFS_MAGIC || newHdr.c_magic == OFS_CIGAM || + newHdr.c_magic == NFS_CIGAM || newHdr.c_magic == UFS2_MAGIC || newHdr.c_magic == UFS2_CIGAM) { useNew = true; - if(newHdr.c_magic == OFS_CIGAM || newHdr.c_magic == NFS_CIGAM || - newHdr.c_magic == UFS2_CIGAM) + if(newHdr.c_magic == OFS_CIGAM || newHdr.c_magic == NFS_CIGAM || newHdr.c_magic == UFS2_CIGAM) newHdr = BigEndianMarshal.ByteArrayToStructureBigEndian<s_spcl>(sector); } else if(aixHdr.c_magic == XIX_MAGIC || aixHdr.c_magic == XIX_CIGAM) @@ -356,11 +338,7 @@ namespace DiscImageChef.Filesystems StringBuilder sb = new StringBuilder(); - xmlFSType = new Schemas.FileSystemType - { - ClusterSize = 1024, - Clusters = (long)(partition.Size / 1024) - }; + xmlFSType = new Schemas.FileSystemType {ClusterSize = 1024, Clusters = (long)(partition.Size / 1024)}; if(useOld) { @@ -436,14 +414,11 @@ namespace DiscImageChef.Filesystems } string str = StringHandlers.CToString(newHdr.c_filesys); - if(!string.IsNullOrEmpty(str)) - sb.AppendFormat("Dumped filesystem name: {0}", str).AppendLine(); + if(!string.IsNullOrEmpty(str)) sb.AppendFormat("Dumped filesystem name: {0}", str).AppendLine(); str = StringHandlers.CToString(newHdr.c_dev); - if(!string.IsNullOrEmpty(str)) - sb.AppendFormat("Dumped device: {0}", str).AppendLine(); + if(!string.IsNullOrEmpty(str)) sb.AppendFormat("Dumped device: {0}", str).AppendLine(); str = StringHandlers.CToString(newHdr.c_host); - if(!string.IsNullOrEmpty(str)) - sb.AppendFormat("Dump hostname: {0}", str).AppendLine(); + if(!string.IsNullOrEmpty(str)) sb.AppendFormat("Dump hostname: {0}", str).AppendLine(); } information = sb.ToString(); diff --git a/DiscImageChef.Filesystems/exFAT.cs b/DiscImageChef.Filesystems/exFAT.cs index 83c475bc..285f9951 100644 --- a/DiscImageChef.Filesystems/exFAT.cs +++ b/DiscImageChef.Filesystems/exFAT.cs @@ -54,30 +54,24 @@ namespace DiscImageChef.Filesystems { Name = "Microsoft Extended File Allocation Table"; PluginUUID = new Guid("8271D088-1533-4CB3-AC28-D802B68BB95C"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public exFAT(ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Microsoft Extended File Allocation Table"; PluginUUID = new Guid("8271D088-1533-4CB3-AC28-D802B68BB95C"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugin imagePlugin, Partition partition) { - if((12 + partition.Start) >= partition.End) - return false; + if((12 + partition.Start) >= partition.End) return false; byte[] vbrSector = imagePlugin.ReadSector(0 + partition.Start); - if(vbrSector.Length < 512) - return false; + if(vbrSector.Length < 512) return false; VolumeBootRecord vbr = new VolumeBootRecord(); IntPtr vbrPtr = Marshal.AllocHGlobal(512); @@ -118,21 +112,23 @@ namespace DiscImageChef.Filesystems sb.AppendLine("Microsoft exFAT"); sb.AppendFormat("Partition offset: {0}", vbr.offset).AppendLine(); - sb.AppendFormat("Volume has {0} sectors of {1} bytes each for a total of {2} bytes", vbr.sectors, 1 << vbr.sectorShift, vbr.sectors * (ulong)(1 << vbr.sectorShift)).AppendLine(); - sb.AppendFormat("Volume uses clusters of {0} sectors ({1} bytes) each", 1 << vbr.clusterShift, (1 << vbr.sectorShift) * (1 << vbr.clusterShift)).AppendLine(); - sb.AppendFormat("First FAT starts at sector {0} and runs for {1} sectors", vbr.fatOffset, vbr.fatLength).AppendLine(); + sb.AppendFormat("Volume has {0} sectors of {1} bytes each for a total of {2} bytes", vbr.sectors, + 1 << vbr.sectorShift, vbr.sectors * (ulong)(1 << vbr.sectorShift)).AppendLine(); + sb.AppendFormat("Volume uses clusters of {0} sectors ({1} bytes) each", 1 << vbr.clusterShift, + (1 << vbr.sectorShift) * (1 << vbr.clusterShift)).AppendLine(); + sb.AppendFormat("First FAT starts at sector {0} and runs for {1} sectors", vbr.fatOffset, vbr.fatLength) + .AppendLine(); sb.AppendFormat("Volume uses {0} FATs", vbr.fats).AppendLine(); - sb.AppendFormat("Cluster heap starts at sector {0}, contains {1} clusters and is {2}% used", vbr.clusterHeapOffset, vbr.clusterHeapLength, vbr.heapUsage).AppendLine(); + sb.AppendFormat("Cluster heap starts at sector {0}, contains {1} clusters and is {2}% used", + vbr.clusterHeapOffset, vbr.clusterHeapLength, vbr.heapUsage).AppendLine(); sb.AppendFormat("Root directory starts at cluster {0}", vbr.rootDirectoryCluster).AppendLine(); - sb.AppendFormat("Filesystem revision is {0}.{1:D2}", (vbr.revision & 0xFF00) >> 8, (vbr.revision & 0xFF)).AppendLine(); + sb.AppendFormat("Filesystem revision is {0}.{1:D2}", (vbr.revision & 0xFF00) >> 8, (vbr.revision & 0xFF)) + .AppendLine(); sb.AppendFormat("Volume serial number: {0:X8}", vbr.volumeSerial).AppendLine(); sb.AppendFormat("BIOS drive is {0:X2}h", vbr.drive).AppendLine(); - if(vbr.flags.HasFlag(VolumeFlags.SecondFATActive)) - sb.AppendLine("2nd FAT is in use"); - if(vbr.flags.HasFlag(VolumeFlags.VolumeDirty)) - sb.AppendLine("Volume is dirty"); - if(vbr.flags.HasFlag(VolumeFlags.MediaFailure)) - sb.AppendLine("Underlying media presented errors"); + if(vbr.flags.HasFlag(VolumeFlags.SecondFATActive)) sb.AppendLine("2nd FAT is in use"); + if(vbr.flags.HasFlag(VolumeFlags.VolumeDirty)) sb.AppendLine("Volume is dirty"); + if(vbr.flags.HasFlag(VolumeFlags.MediaFailure)) sb.AppendLine("Underlying media presented errors"); int count = 1; foreach(OemParameter parameter in parametersTable.parameters) @@ -164,7 +160,7 @@ namespace DiscImageChef.Filesystems information = sb.ToString(); } - readonly byte[] Signature = { 0x45, 0x58, 0x46, 0x41, 0x54, 0x20, 0x20, 0x20 }; + readonly byte[] Signature = {0x45, 0x58, 0x46, 0x41, 0x54, 0x20, 0x20, 0x20}; readonly Guid OEM_FLASH_PARAMETER_GUID = new Guid("0A0C7E46-3399-4021-90C8-FA6D389C4BA2"); [Flags] @@ -179,12 +175,9 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct VolumeBootRecord { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] signature; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 53)] - public byte[] zero; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] jump; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] signature; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 53)] public byte[] zero; public ulong offset; public ulong sectors; public uint fatOffset; @@ -200,10 +193,8 @@ namespace DiscImageChef.Filesystems public byte fats; public byte drive; public byte heapUsage; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 53)] - public byte[] reserved; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 53)] - public byte[] bootCode; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 53)] public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 53)] public byte[] bootCode; public ushort bootSignature; } @@ -218,25 +209,20 @@ namespace DiscImageChef.Filesystems public uint programTime; public uint readCycleTime; public uint writeCycleTime; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] reserved; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct OemParameterTable { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public OemParameter[] parameters; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] padding; - + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public OemParameter[] parameters; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] padding; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ChecksumSector { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public uint[] checksum; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public uint[] checksum; } public override Errno GetAttributes(string path, ref FileAttributes attributes) @@ -299,5 +285,4 @@ namespace DiscImageChef.Filesystems throw new NotImplementedException(); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ext2FS.cs b/DiscImageChef.Filesystems/ext2FS.cs index 1da8a442..22c17c65 100644 --- a/DiscImageChef.Filesystems/ext2FS.cs +++ b/DiscImageChef.Filesystems/ext2FS.cs @@ -54,20 +54,16 @@ namespace DiscImageChef.Filesystems { Name = "Linux extended Filesystem 2, 3 and 4"; PluginUUID = new Guid("6AA91B88-150B-4A7B-AD56-F84FB2DF4184"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public ext2FS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Linux extended Filesystem 2, 3 and 4"; PluginUUID = new Guid("6AA91B88-150B-4A7B-AD56-F84FB2DF4184"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) @@ -75,13 +71,11 @@ namespace DiscImageChef.Filesystems ulong sbSector = sbPos / imagePlugin.GetSectorSize(); uint sbOff = sbPos % imagePlugin.GetSectorSize(); - if((sbSector + partition.Start) >= partition.End) - return false; + if((sbSector + partition.Start) >= partition.End) return false; int sb_size_in_bytes = Marshal.SizeOf(typeof(ext2FSSuperBlock)); uint sb_size_in_sectors = (uint)(sb_size_in_bytes / imagePlugin.GetSectorSize()); - if(sb_size_in_bytes % imagePlugin.GetSectorSize() > 0) - sb_size_in_sectors++; + if(sb_size_in_bytes % imagePlugin.GetSectorSize() > 0) sb_size_in_sectors++; byte[] sb_sector = imagePlugin.ReadSectors(sbSector + partition.Start, sb_size_in_sectors); byte[] sb = new byte[sb_size_in_bytes]; @@ -89,12 +83,13 @@ namespace DiscImageChef.Filesystems ushort magic = BitConverter.ToUInt16(sb, 0x038); - if(magic == ext2FSMagic || magic == ext2OldFSMagic) - return true; + if(magic == ext2FSMagic || magic == ext2OldFSMagic) return true; + return false; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; @@ -111,8 +106,7 @@ namespace DiscImageChef.Filesystems int sb_size_in_bytes = Marshal.SizeOf(typeof(ext2FSSuperBlock)); uint sb_size_in_sectors = (uint)(sb_size_in_bytes / imagePlugin.GetSectorSize()); - if(sb_size_in_bytes % imagePlugin.GetSectorSize() > 0) - sb_size_in_sectors++; + if(sb_size_in_bytes % imagePlugin.GetSectorSize() > 0) sb_size_in_sectors++; ulong sbSector = sbPos / imagePlugin.GetSectorSize(); uint sbOff = sbPos % imagePlugin.GetSectorSize(); @@ -134,17 +128,19 @@ namespace DiscImageChef.Filesystems } else if(supblk.magic == ext2FSMagic) { - ext3 |= (supblk.ftr_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) == EXT3_FEATURE_COMPAT_HAS_JOURNAL || (supblk.ftr_incompat & EXT3_FEATURE_INCOMPAT_RECOVER) == EXT3_FEATURE_INCOMPAT_RECOVER || (supblk.ftr_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) == EXT3_FEATURE_INCOMPAT_JOURNAL_DEV; + ext3 |= (supblk.ftr_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) == EXT3_FEATURE_COMPAT_HAS_JOURNAL || + (supblk.ftr_incompat & EXT3_FEATURE_INCOMPAT_RECOVER) == EXT3_FEATURE_INCOMPAT_RECOVER || + (supblk.ftr_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) == EXT3_FEATURE_INCOMPAT_JOURNAL_DEV; if((supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_HUGE_FILE) == EXT4_FEATURE_RO_COMPAT_HUGE_FILE || - (supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) == EXT4_FEATURE_RO_COMPAT_GDT_CSUM || - (supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_DIR_NLINK) == EXT4_FEATURE_RO_COMPAT_DIR_NLINK || - (supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE) == EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE || - (supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_64BIT) == EXT4_FEATURE_INCOMPAT_64BIT || - (supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_MMP) == EXT4_FEATURE_INCOMPAT_MMP || - (supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_FLEX_BG) == EXT4_FEATURE_INCOMPAT_FLEX_BG || - (supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_EA_INODE) == EXT4_FEATURE_INCOMPAT_EA_INODE || - (supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_DIRDATA) == EXT4_FEATURE_INCOMPAT_DIRDATA) + (supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) == EXT4_FEATURE_RO_COMPAT_GDT_CSUM || + (supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_DIR_NLINK) == EXT4_FEATURE_RO_COMPAT_DIR_NLINK || + (supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE) == EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE || + (supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_64BIT) == EXT4_FEATURE_INCOMPAT_64BIT || + (supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_MMP) == EXT4_FEATURE_INCOMPAT_MMP || + (supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_FLEX_BG) == EXT4_FEATURE_INCOMPAT_FLEX_BG || + (supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_EA_INODE) == EXT4_FEATURE_INCOMPAT_EA_INODE || + (supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_DIRDATA) == EXT4_FEATURE_INCOMPAT_DIRDATA) { ext3 = false; ext4 = true; @@ -201,12 +197,12 @@ namespace DiscImageChef.Filesystems if(supblk.mkfs_t > 0) { - sb.AppendFormat("Volume was created on {0} for {1}", DateHandlers.UNIXUnsignedToDateTime(supblk.mkfs_t), ext_os).AppendLine(); + sb.AppendFormat("Volume was created on {0} for {1}", DateHandlers.UNIXUnsignedToDateTime(supblk.mkfs_t), + ext_os).AppendLine(); xmlFSType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(supblk.mkfs_t); xmlFSType.CreationDateSpecified = true; } - else - sb.AppendFormat("Volume was created for {0}", ext_os).AppendLine(); + else sb.AppendFormat("Volume was created for {0}", ext_os).AppendLine(); byte[] temp_lo, temp_hi; byte[] temp_bytes = new byte[8]; @@ -260,54 +256,62 @@ namespace DiscImageChef.Filesystems if(supblk.block_size == 0) // Then it is 1024 bytes supblk.block_size = 1024; - sb.AppendFormat("Volume has {0} blocks of {1} bytes, for a total of {2} bytes", blocks, 1024 << (int)supblk.block_size, blocks * (ulong)(1024 << (int)supblk.block_size)).AppendLine(); + sb.AppendFormat("Volume has {0} blocks of {1} bytes, for a total of {2} bytes", blocks, + 1024 << (int)supblk.block_size, blocks * (ulong)(1024 << (int)supblk.block_size)) + .AppendLine(); xmlFSType.Clusters = (long)blocks; xmlFSType.ClusterSize = 1024 << (int)supblk.block_size; if(supblk.mount_t > 0 || supblk.mount_c > 0) { if(supblk.mount_t > 0) - sb.AppendFormat("Last mounted on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.mount_t)).AppendLine(); + sb.AppendFormat("Last mounted on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.mount_t)) + .AppendLine(); if(supblk.max_mount_c != -1) - sb.AppendFormat("Volume has been mounted {0} times of a maximum of {1} mounts before checking", supblk.mount_c, supblk.max_mount_c).AppendLine(); + sb.AppendFormat("Volume has been mounted {0} times of a maximum of {1} mounts before checking", + supblk.mount_c, supblk.max_mount_c).AppendLine(); else - sb.AppendFormat("Volume has been mounted {0} times with no maximum no. of mounts before checking", supblk.mount_c).AppendLine(); + sb.AppendFormat("Volume has been mounted {0} times with no maximum no. of mounts before checking", + supblk.mount_c).AppendLine(); if(!string.IsNullOrEmpty(StringHandlers.CToString(supblk.last_mount_dir, CurrentEncoding))) - sb.AppendFormat("Last mounted on: \"{0}\"", StringHandlers.CToString(supblk.last_mount_dir, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Last mounted on: \"{0}\"", + StringHandlers.CToString(supblk.last_mount_dir, CurrentEncoding)).AppendLine(); if(!string.IsNullOrEmpty(StringHandlers.CToString(supblk.mount_options, CurrentEncoding))) - sb.AppendFormat("Last used mount options were: {0}", StringHandlers.CToString(supblk.mount_options, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Last used mount options were: {0}", + StringHandlers.CToString(supblk.mount_options, CurrentEncoding)).AppendLine(); } else { sb.AppendLine("Volume has never been mounted"); if(supblk.max_mount_c != -1) sb.AppendFormat("Volume can be mounted {0} times before checking", supblk.max_mount_c).AppendLine(); - else - sb.AppendLine("Volume has no maximum no. of mounts before checking"); + else sb.AppendLine("Volume has no maximum no. of mounts before checking"); } if(supblk.check_t > 0) { if(supblk.check_inv > 0) - sb.AppendFormat("Last checked on {0} (should check every {1} seconds)", DateHandlers.UNIXUnsignedToDateTime(supblk.check_t), supblk.check_inv).AppendLine(); + sb.AppendFormat("Last checked on {0} (should check every {1} seconds)", + DateHandlers.UNIXUnsignedToDateTime(supblk.check_t), supblk.check_inv).AppendLine(); else - sb.AppendFormat("Last checked on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.check_t)).AppendLine(); + sb.AppendFormat("Last checked on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.check_t)) + .AppendLine(); } else { if(supblk.check_inv > 0) - sb.AppendFormat("Volume has never been checked (should check every {0})", supblk.check_inv).AppendLine(); - else - sb.AppendLine("Volume has never been checked"); + sb.AppendFormat("Volume has never been checked (should check every {0})", supblk.check_inv) + .AppendLine(); + else sb.AppendLine("Volume has never been checked"); } if(supblk.write_t > 0) { - sb.AppendFormat("Last written on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.write_t)).AppendLine(); + sb.AppendFormat("Last written on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.write_t)) + .AppendLine(); xmlFSType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(supblk.write_t); xmlFSType.ModificationDateSpecified = true; } - else - sb.AppendLine("Volume has never been written"); + else sb.AppendLine("Volume has never been written"); xmlFSType.Dirty = true; switch(supblk.state) @@ -329,7 +333,8 @@ namespace DiscImageChef.Filesystems if(!string.IsNullOrEmpty(StringHandlers.CToString(supblk.volume_name, CurrentEncoding))) { - sb.AppendFormat("Volume name: \"{0}\"", StringHandlers.CToString(supblk.volume_name, CurrentEncoding)).AppendLine(); + sb.AppendFormat("Volume name: \"{0}\"", StringHandlers.CToString(supblk.volume_name, CurrentEncoding)) + .AppendLine(); xmlFSType.VolumeName = StringHandlers.CToString(supblk.volume_name, CurrentEncoding); } @@ -345,7 +350,8 @@ namespace DiscImageChef.Filesystems sb.AppendLine("On errors, filesystem should panic"); break; default: - sb.AppendFormat("On errors filesystem will do an unknown thing ({0})", supblk.err_behaviour).AppendLine(); + sb.AppendFormat("On errors filesystem will do an unknown thing ({0})", supblk.err_behaviour) + .AppendLine(); break; } @@ -364,15 +370,14 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} reserved and {1} free blocks", reserved, free).AppendLine(); xmlFSType.FreeClusters = (long)free; xmlFSType.FreeClustersSpecified = true; - sb.AppendFormat("{0} inodes with {1} free inodes ({2}%)", supblk.inodes, supblk.free_inodes, supblk.free_inodes * 100 / supblk.inodes).AppendLine(); - if(supblk.first_inode > 0) - sb.AppendFormat("First inode is {0}", supblk.first_inode).AppendLine(); - if(supblk.frag_size > 0) - sb.AppendFormat("{0} bytes per fragment", supblk.frag_size).AppendLine(); + sb.AppendFormat("{0} inodes with {1} free inodes ({2}%)", supblk.inodes, supblk.free_inodes, + supblk.free_inodes * 100 / supblk.inodes).AppendLine(); + if(supblk.first_inode > 0) sb.AppendFormat("First inode is {0}", supblk.first_inode).AppendLine(); + if(supblk.frag_size > 0) sb.AppendFormat("{0} bytes per fragment", supblk.frag_size).AppendLine(); if(supblk.blocks_per_grp > 0 && supblk.flags_per_grp > 0 && supblk.inodes_per_grp > 0) - sb.AppendFormat("{0} blocks, {1} flags and {2} inodes per group", supblk.blocks_per_grp, supblk.flags_per_grp, supblk.inodes_per_grp).AppendLine(); - if(supblk.first_block > 0) - sb.AppendFormat("{0} is first data block", supblk.first_block).AppendLine(); + sb.AppendFormat("{0} blocks, {1} flags and {2} inodes per group", supblk.blocks_per_grp, + supblk.flags_per_grp, supblk.inodes_per_grp).AppendLine(); + if(supblk.first_block > 0) sb.AppendFormat("{0} is first data block", supblk.first_block).AppendLine(); sb.AppendFormat("Default UID: {0}, GID: {1}", supblk.default_uid, supblk.default_gid).AppendLine(); if(supblk.block_group_no > 0) sb.AppendFormat("Block group number is {0}", supblk.block_group_no).AppendLine(); @@ -380,47 +385,55 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Group descriptor size is {0} bytes", supblk.desc_grp_size).AppendLine(); if(supblk.first_meta_bg > 0) sb.AppendFormat("First metablock group is {0}", supblk.first_meta_bg).AppendLine(); - if(supblk.raid_stride > 0) - sb.AppendFormat("RAID stride: {0}", supblk.raid_stride).AppendLine(); + if(supblk.raid_stride > 0) sb.AppendFormat("RAID stride: {0}", supblk.raid_stride).AppendLine(); if(supblk.raid_stripe_width > 0) sb.AppendFormat("{0} blocks on all data disks", supblk.raid_stripe_width).AppendLine(); if(supblk.mmp_interval > 0 && supblk.mmp_block > 0) - sb.AppendFormat("{0} seconds for multi-mount protection wait, on block {1}", supblk.mmp_interval, supblk.mmp_block).AppendLine(); + sb.AppendFormat("{0} seconds for multi-mount protection wait, on block {1}", supblk.mmp_interval, + supblk.mmp_block).AppendLine(); if(supblk.flex_bg_grp_size > 0) sb.AppendFormat("{0} Flexible block group size", supblk.flex_bg_grp_size).AppendLine(); if(supblk.hash_seed_1 > 0 && supblk.hash_seed_2 > 0 && supblk.hash_seed_3 > 0 && supblk.hash_seed_4 > 0) - sb.AppendFormat("Hash seed: {0:X8}{1:X8}{2:X8}{3:X8}, version {4}", supblk.hash_seed_1, supblk.hash_seed_2, supblk.hash_seed_3, supblk.hash_seed_4, supblk.hash_version).AppendLine(); + sb.AppendFormat("Hash seed: {0:X8}{1:X8}{2:X8}{3:X8}, version {4}", supblk.hash_seed_1, + supblk.hash_seed_2, supblk.hash_seed_3, supblk.hash_seed_4, supblk.hash_version) + .AppendLine(); if((supblk.ftr_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) == EXT3_FEATURE_COMPAT_HAS_JOURNAL || - (supblk.ftr_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) == EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) + (supblk.ftr_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) == EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) { sb.AppendLine("Volume is journaled"); if(supblk.journal_uuid != Guid.Empty) sb.AppendFormat("Journal UUID: {0}", supblk.journal_uuid).AppendLine(); sb.AppendFormat("Journal has inode {0}", supblk.journal_inode).AppendLine(); - if((supblk.ftr_compat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) == EXT3_FEATURE_INCOMPAT_JOURNAL_DEV && supblk.journal_dev > 0) - sb.AppendFormat("Journal is on device {0}", supblk.journal_dev).AppendLine(); + if((supblk.ftr_compat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) == EXT3_FEATURE_INCOMPAT_JOURNAL_DEV && + supblk.journal_dev > 0) sb.AppendFormat("Journal is on device {0}", supblk.journal_dev).AppendLine(); if(supblk.jnl_backup_type > 0) sb.AppendFormat("Journal backup type: {0}", supblk.jnl_backup_type).AppendLine(); if(supblk.last_orphan > 0) sb.AppendFormat("Last orphaned inode is {0}", supblk.last_orphan).AppendLine(); - else - sb.AppendLine("There are no orphaned inodes"); + else sb.AppendLine("There are no orphaned inodes"); } if(ext4) { if(supblk.snapshot_id > 0) - sb.AppendFormat("Active snapshot has ID {0}, on inode {1}, with {2} blocks reserved, list starting on block {3}", supblk.snapshot_id, - supblk.snapshot_inum, supblk.snapshot_blocks, supblk.snapshot_list).AppendLine(); + sb + .AppendFormat("Active snapshot has ID {0}, on inode {1}, with {2} blocks reserved, list starting on block {3}", + supblk.snapshot_id, supblk.snapshot_inum, supblk.snapshot_blocks, + supblk.snapshot_list).AppendLine(); if(supblk.error_count > 0) { sb.AppendFormat("{0} errors registered", supblk.error_count).AppendLine(); - sb.AppendFormat("First error occurred on {0}, last on {1}", DateHandlers.UNIXUnsignedToDateTime(supblk.first_error_t), DateHandlers.UNIXUnsignedToDateTime(supblk.last_error_t)).AppendLine(); - sb.AppendFormat("First error inode is {0}, last is {1}", supblk.first_error_inode, supblk.last_error_inode).AppendLine(); - sb.AppendFormat("First error block is {0}, last is {1}", supblk.first_error_block, supblk.last_error_block).AppendLine(); - sb.AppendFormat("First error function is \"{0}\", last is \"{1}\"", supblk.first_error_func, supblk.last_error_func).AppendLine(); + sb.AppendFormat("First error occurred on {0}, last on {1}", + DateHandlers.UNIXUnsignedToDateTime(supblk.first_error_t), + DateHandlers.UNIXUnsignedToDateTime(supblk.last_error_t)).AppendLine(); + sb.AppendFormat("First error inode is {0}, last is {1}", supblk.first_error_inode, + supblk.last_error_inode).AppendLine(); + sb.AppendFormat("First error block is {0}, last is {1}", supblk.first_error_block, + supblk.last_error_block).AppendLine(); + sb.AppendFormat("First error function is \"{0}\", last is \"{1}\"", supblk.first_error_func, + supblk.last_error_func).AppendLine(); } } @@ -431,8 +444,7 @@ namespace DiscImageChef.Filesystems sb.AppendLine("Unsigned directory hash is in use"); if((supblk.flags & EXT2_FLAGS_TEST_FILESYS) == EXT2_FLAGS_TEST_FILESYS) sb.AppendLine("Volume is testing development code"); - if((supblk.flags & 0xFFFFFFF8) != 0) - sb.AppendFormat("Unknown set flags: {0:X8}", supblk.flags); + if((supblk.flags & 0xFFFFFFF8) != 0) sb.AppendFormat("Unknown set flags: {0:X8}", supblk.flags); sb.AppendLine(); @@ -443,8 +455,7 @@ namespace DiscImageChef.Filesystems sb.AppendLine("(bsdgroups): Emulate BSD behaviour when creating new files"); if((supblk.default_mnt_opts & EXT2_DEFM_XATTR_USER) == EXT2_DEFM_XATTR_USER) sb.AppendLine("(user_xattr): Enable user-specified extended attributes"); - if((supblk.default_mnt_opts & EXT2_DEFM_ACL) == EXT2_DEFM_ACL) - sb.AppendLine("(acl): Enable POSIX ACLs"); + if((supblk.default_mnt_opts & EXT2_DEFM_ACL) == EXT2_DEFM_ACL) sb.AppendLine("(acl): Enable POSIX ACLs"); if((supblk.default_mnt_opts & EXT2_DEFM_UID16) == EXT2_DEFM_UID16) sb.AppendLine("(uid16): Disable 32bit UIDs and GIDs"); if((supblk.default_mnt_opts & EXT3_DEFM_JMODE_DATA) == EXT3_DEFM_JMODE_DATA) @@ -611,11 +622,9 @@ namespace DiscImageChef.Filesystems /// <summary>0x068, 16 bytes, UUID</summary> public Guid uuid; /// <summary>0x078, 16 bytes, volume name</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] volume_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] volume_name; /// <summary>0x088, 64 bytes, where last mounted</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] last_mount_dir; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] last_mount_dir; /// <summary>0x0C8, Usage bitmap algorithm, for compression</summary> public uint algo_usage_bmp; /// <summary>0x0CC, Block to try to preallocate</summary> @@ -659,8 +668,7 @@ namespace DiscImageChef.Filesystems public uint mkfs_t; /// <summary>Backup of the journal inode</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public uint[] jnl_blocks; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] public uint[] jnl_blocks; // Following 3 fields are valid if EXT4_FEATURE_COMPAT_64BIT is set /// <summary>0x14C, High 32bits of blocks no.</summary> @@ -713,8 +721,7 @@ namespace DiscImageChef.Filesystems /// <summary>0x19C, block involved of first error</summary> public ulong first_error_block; /// <summary>0x1A0, 32 bytes, function where the error happened</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] first_error_func; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] first_error_func; /// <summary>0x1B0, line number where error happened</summary> public uint first_error_line; /// <summary>0x1B4, time of most recent error</summary> @@ -726,13 +733,11 @@ namespace DiscImageChef.Filesystems /// <summary>0x1C0, block involved of last error</summary> public ulong last_error_block; /// <summary>0x1C8, 32 bytes, function where the error happened</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] last_error_func; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] last_error_func; // End of optional error-handling features // 0x1D8, 64 bytes, last used mount options</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] mount_options; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] mount_options; /// <summary>Inode for user quota</summary> public uint usr_quota_inum; @@ -741,14 +746,11 @@ namespace DiscImageChef.Filesystems /// <summary>Overhead clusters in volume</summary> public uint overhead_clusters; /// <summary>Groups with sparse_super2 SBs</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public uint[] backup_bgs; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] backup_bgs; /// <summary>Encryption algorithms in use</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] encrypt_algos; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] encrypt_algos; /// <summary>Salt used for string2key algorithm</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] encrypt_pw_salt; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] encrypt_pw_salt; /// <summary>Inode number of lost+found</summary> public uint lpf_inum; /// <summary>Inode number for tracking project quota</summary> @@ -756,8 +758,7 @@ namespace DiscImageChef.Filesystems /// <summary>crc32c(uuid) if csum_seed is set</summary> public uint checksum_seed; /// <summary>Reserved</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 98)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 98)] public byte[] reserved; /// <summary>crc32c(superblock)</summary> public uint checksum; } diff --git a/DiscImageChef.Filesystems/extFS.cs b/DiscImageChef.Filesystems/extFS.cs index cda1f51d..82241416 100644 --- a/DiscImageChef.Filesystems/extFS.cs +++ b/DiscImageChef.Filesystems/extFS.cs @@ -53,32 +53,26 @@ namespace DiscImageChef.Filesystems { Name = "Linux extended Filesystem"; PluginUUID = new Guid("076CB3A2-08C2-4D69-BC8A-FCAA2E502BE2"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public extFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding) { Name = "Linux extended Filesystem"; PluginUUID = new Guid("076CB3A2-08C2-4D69-BC8A-FCAA2E502BE2"); - if(encoding == null) - CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); - else - CurrentEncoding = encoding; + if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15"); + else CurrentEncoding = encoding; } public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) { - if(imagePlugin.GetSectorSize() < 512) - return false; - + if(imagePlugin.GetSectorSize() < 512) return false; + ulong sbSector = sbPos / imagePlugin.GetSectorSize(); uint sbOff = sbPos % imagePlugin.GetSectorSize(); - if((sbSector + partition.Start) >= partition.End) - return false; + if((sbSector + partition.Start) >= partition.End) return false; byte[] sb_sector = imagePlugin.ReadSector(sbSector + partition.Start); byte[] sb = new byte[512]; @@ -89,20 +83,19 @@ namespace DiscImageChef.Filesystems return magic == extFSMagic; } - public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, + out string information) { information = ""; StringBuilder sb = new StringBuilder(); - if(imagePlugin.GetSectorSize() < 512) - return; + if(imagePlugin.GetSectorSize() < 512) return; ulong sbSector = sbPos / imagePlugin.GetSectorSize(); uint sbOff = sbPos % imagePlugin.GetSectorSize(); - if((sbSector + partition.Start) >= partition.End) - return; + if((sbSector + partition.Start) >= partition.End) return; byte[] sblock = imagePlugin.ReadSector(sbSector + partition.Start); byte[] sb_sector = new byte[512]; @@ -123,7 +116,8 @@ namespace DiscImageChef.Filesystems sb.AppendLine("ext filesystem"); sb.AppendFormat("{0} zones on volume", ext_sb.zones); sb.AppendFormat("{0} free blocks ({1} bytes)", ext_sb.freecountblk, ext_sb.freecountblk * 1024); - sb.AppendFormat("{0} inodes on volume, {1} free ({2}%)", ext_sb.inodes, ext_sb.freecountind, ext_sb.freecountind * 100 / ext_sb.inodes); + sb.AppendFormat("{0} inodes on volume, {1} free ({2}%)", ext_sb.inodes, ext_sb.freecountind, + ext_sb.freecountind * 100 / ext_sb.inodes); sb.AppendFormat("First free inode is {0}", ext_sb.firstfreeind); sb.AppendFormat("First free block is {0}", ext_sb.firstfreeblk); sb.AppendFormat("First data zone is {0}", ext_sb.firstdatazone); diff --git a/DiscImageChef.Filesystems/packages.config b/DiscImageChef.Filesystems/packages.config index 481ea355..4a1b16f1 100644 --- a/DiscImageChef.Filesystems/packages.config +++ b/DiscImageChef.Filesystems/packages.config @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> + <packages> - <package id="Claunia.Encoding" version="1.2.9.1" targetFramework="net40" /> + <package id="Claunia.Encoding" version="1.2.9.1" targetFramework="net40" /> </packages> \ No newline at end of file diff --git a/DiscImageChef.Filters/AppleDouble.cs b/DiscImageChef.Filters/AppleDouble.cs index 4b5dbfc8..4715b93f 100644 --- a/DiscImageChef.Filters/AppleDouble.cs +++ b/DiscImageChef.Filters/AppleDouble.cs @@ -64,8 +64,7 @@ namespace DiscImageChef.Filters { public uint magic; public uint version; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] homeFilesystem; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] homeFilesystem; public ushort entries; } @@ -126,12 +125,18 @@ namespace DiscImageChef.Filters const uint AppleDoubleVersion = 0x00010000; const uint AppleDoubleVersion2 = 0x00020000; - readonly byte[] MacintoshHome = { 0x4D, 0x61, 0x63, 0x69, 0x6E, 0x74, 0x6F, 0x73, 0x68, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; - readonly byte[] ProDOSHome = { 0x50, 0x72, 0x6F, 0x44, 0x4F, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; - readonly byte[] DOSHome = { 0x4D, 0x53, 0x2D, 0x44, 0x4F, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; - readonly byte[] UNIXHome = { 0x55, 0x6E, 0x69, 0x78, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; - readonly byte[] VMXHome = { 0x56, 0x41, 0x58, 0x20, 0x56, 0x4D, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; - readonly byte[] OSXHome = { 0x4D, 0x61, 0x63, 0x20, 0x4F, 0x53, 0x20, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; + readonly byte[] MacintoshHome = + {0x4D, 0x61, 0x63, 0x69, 0x6E, 0x74, 0x6F, 0x73, 0x68, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; + readonly byte[] ProDOSHome = + {0x50, 0x72, 0x6F, 0x44, 0x4F, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; + readonly byte[] DOSHome = + {0x4D, 0x53, 0x2D, 0x44, 0x4F, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; + readonly byte[] UNIXHome = + {0x55, 0x6E, 0x69, 0x78, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; + readonly byte[] VMXHome = + {0x56, 0x41, 0x58, 0x20, 0x56, 0x4D, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; + readonly byte[] OSXHome = + {0x4D, 0x61, 0x63, 0x20, 0x4F, 0x53, 0x20, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; AppleDoubleEntry dataFork; AppleDoubleEntry rsrcFork; @@ -205,10 +210,10 @@ namespace DiscImageChef.Filters public override Stream GetResourceForkStream() { - if(rsrcFork.length == 0) - return null; + if(rsrcFork.length == 0) return null; - return new OffsetStream(headerPath, FileMode.Open, FileAccess.Read, rsrcFork.offset, rsrcFork.offset + rsrcFork.length - 1); + return new OffsetStream(headerPath, FileMode.Open, FileAccess.Read, rsrcFork.offset, + rsrcFork.offset + rsrcFork.length - 1); } public override bool HasResourceFork() @@ -270,8 +275,8 @@ namespace DiscImageChef.Filters prodosStream.Read(prodos_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(prodos_b); prodosStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) - return true; + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) return true; } } @@ -285,8 +290,8 @@ namespace DiscImageChef.Filters unixStream.Read(unix_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(unix_b); unixStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) - return true; + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) return true; } } @@ -300,8 +305,8 @@ namespace DiscImageChef.Filters dosStream.Read(dos_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(dos_b); dosStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) - return true; + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) return true; } } @@ -315,8 +320,8 @@ namespace DiscImageChef.Filters doslStream.Read(dosl_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(dosl_b); doslStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) - return true; + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) return true; } } @@ -330,8 +335,8 @@ namespace DiscImageChef.Filters netatalkStream.Read(netatalk_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(netatalk_b); netatalkStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) - return true; + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) return true; } } @@ -345,8 +350,8 @@ namespace DiscImageChef.Filters daveStream.Read(dave_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(dave_b); daveStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) - return true; + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) return true; } } @@ -360,8 +365,8 @@ namespace DiscImageChef.Filters osxStream.Read(osx_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(osx_b); osxStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) - return true; + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) return true; } } @@ -375,8 +380,8 @@ namespace DiscImageChef.Filters unarStream.Read(unar_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(unar_b); unarStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) - return true; + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) return true; } } @@ -442,7 +447,8 @@ namespace DiscImageChef.Filters prodosStream.Read(prodos_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(prodos_b); prodosStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) headerPath = ProDosAppleDouble; } } @@ -457,7 +463,8 @@ namespace DiscImageChef.Filters unixStream.Read(unix_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(unix_b); unixStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) headerPath = UNIXAppleDouble; } } @@ -472,7 +479,8 @@ namespace DiscImageChef.Filters dosStream.Read(dos_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(dos_b); dosStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) headerPath = DOSAppleDouble; } } @@ -487,7 +495,8 @@ namespace DiscImageChef.Filters doslStream.Read(dosl_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(dosl_b); doslStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) headerPath = DOSAppleDoubleLower; } } @@ -502,7 +511,8 @@ namespace DiscImageChef.Filters netatalkStream.Read(netatalk_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(netatalk_b); netatalkStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) headerPath = NetatalkAppleDouble; } } @@ -517,7 +527,8 @@ namespace DiscImageChef.Filters daveStream.Read(dave_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(dave_b); daveStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) headerPath = DAVEAppleDouble; } } @@ -532,7 +543,8 @@ namespace DiscImageChef.Filters osxStream.Read(osx_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(osx_b); osxStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) headerPath = OSXAppleDouble; } } @@ -547,7 +559,8 @@ namespace DiscImageChef.Filters unarStream.Read(unar_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleHeader>(unar_b); unarStream.Close(); - if(header.magic == AppleDoubleMagic && (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) + if(header.magic == AppleDoubleMagic && + (header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2)) headerPath = UnArAppleDouble; } } @@ -580,7 +593,8 @@ namespace DiscImageChef.Filters fs.Seek(entry.offset, SeekOrigin.Begin); byte[] dates_b = new byte[16]; fs.Read(dates_b, 0, 16); - AppleDoubleFileDates dates = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleFileDates>(dates_b); + AppleDoubleFileDates dates = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleFileDates>(dates_b); creationTime = DateHandlers.AppleDoubleToDateTime(dates.creationDate); lastWriteTime = DateHandlers.AppleDoubleToDateTime(dates.modificationDate); break; @@ -590,26 +604,31 @@ namespace DiscImageChef.Filters fs.Read(finfo, 0, finfo.Length); if(MacintoshHome.SequenceEqual(header.homeFilesystem)) { - AppleDoubleMacFileInfo macinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleMacFileInfo>(finfo); + AppleDoubleMacFileInfo macinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleMacFileInfo>(finfo); creationTime = DateHandlers.MacToDateTime(macinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(macinfo.modificationDate); } else if(ProDOSHome.SequenceEqual(header.homeFilesystem)) { - AppleDoubleProDOSFileInfo prodosinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleProDOSFileInfo>(finfo); + AppleDoubleProDOSFileInfo prodosinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleProDOSFileInfo>(finfo); creationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(prodosinfo.modificationDate); } else if(UNIXHome.SequenceEqual(header.homeFilesystem)) { - AppleDoubleUNIXFileInfo unixinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleUNIXFileInfo>(finfo); + AppleDoubleUNIXFileInfo unixinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleUNIXFileInfo>(finfo); creationTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.creationDate); lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.modificationDate); } else if(DOSHome.SequenceEqual(header.homeFilesystem)) { - AppleDoubleDOSFileInfo dosinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleDOSFileInfo>(finfo); - lastWriteTime = DateHandlers.DOSToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); + AppleDoubleDOSFileInfo dosinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleDOSFileInfo>(finfo); + lastWriteTime = + DateHandlers.DOSToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); } break; case AppleDoubleEntryID.ResourceFork: @@ -632,4 +651,4 @@ namespace DiscImageChef.Filters basePath = path; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filters/AppleSingle.cs b/DiscImageChef.Filters/AppleSingle.cs index b4e6033e..d7bcd062 100644 --- a/DiscImageChef.Filters/AppleSingle.cs +++ b/DiscImageChef.Filters/AppleSingle.cs @@ -64,8 +64,7 @@ namespace DiscImageChef.Filters { public uint magic; public uint version; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] homeFilesystem; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] homeFilesystem; public ushort entries; } @@ -126,12 +125,18 @@ namespace DiscImageChef.Filters const uint AppleSingleVersion = 0x00010000; const uint AppleSingleVersion2 = 0x00020000; - readonly byte[] MacintoshHome = { 0x4D, 0x61, 0x63, 0x69, 0x6E, 0x74, 0x6F, 0x73, 0x68, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; - readonly byte[] ProDOSHome = { 0x50, 0x72, 0x6F, 0x44, 0x4F, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; - readonly byte[] DOSHome = { 0x4D, 0x53, 0x2D, 0x44, 0x4F, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; - readonly byte[] UNIXHome = { 0x55, 0x6E, 0x69, 0x78, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; - readonly byte[] VMSHome = { 0x56, 0x41, 0x58, 0x20, 0x56, 0x4D, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; - readonly byte[] OSXHome = { 0x4D, 0x61, 0x63, 0x20, 0x4F, 0x53, 0x20, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; + readonly byte[] MacintoshHome = + {0x4D, 0x61, 0x63, 0x69, 0x6E, 0x74, 0x6F, 0x73, 0x68, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; + readonly byte[] ProDOSHome = + {0x50, 0x72, 0x6F, 0x44, 0x4F, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; + readonly byte[] DOSHome = + {0x4D, 0x53, 0x2D, 0x44, 0x4F, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; + readonly byte[] UNIXHome = + {0x55, 0x6E, 0x69, 0x78, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; + readonly byte[] VMSHome = + {0x56, 0x41, 0x58, 0x20, 0x56, 0x4D, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; + readonly byte[] OSXHome = + {0x4D, 0x61, 0x63, 0x20, 0x4F, 0x53, 0x20, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; AppleSingleEntry dataFork; AppleSingleEntry rsrcFork; @@ -152,8 +157,7 @@ namespace DiscImageChef.Filters public override void Close() { bytes = null; - if(stream != null) - stream.Close(); + if(stream != null) stream.Close(); isBytes = false; isStream = false; isPath = false; @@ -177,15 +181,13 @@ namespace DiscImageChef.Filters public override Stream GetDataForkStream() { - if(dataFork.length == 0) - return null; + if(dataFork.length == 0) return null; - if(isBytes) - return new OffsetStream(bytes, dataFork.offset, dataFork.offset + dataFork.length - 1); - if(isStream) - return new OffsetStream(stream, dataFork.offset, dataFork.offset + dataFork.length - 1); + if(isBytes) return new OffsetStream(bytes, dataFork.offset, dataFork.offset + dataFork.length - 1); + if(isStream) return new OffsetStream(stream, dataFork.offset, dataFork.offset + dataFork.length - 1); if(isPath) - return new OffsetStream(basePath, FileMode.Open, FileAccess.Read, dataFork.offset, dataFork.offset + dataFork.length - 1); + return new OffsetStream(basePath, FileMode.Open, FileAccess.Read, dataFork.offset, + dataFork.offset + dataFork.length - 1); return null; } @@ -222,15 +224,13 @@ namespace DiscImageChef.Filters public override Stream GetResourceForkStream() { - if(rsrcFork.length == 0) - return null; + if(rsrcFork.length == 0) return null; - if(isBytes) - return new OffsetStream(bytes, rsrcFork.offset, rsrcFork.offset + rsrcFork.length - 1); - if(isStream) - return new OffsetStream(stream, rsrcFork.offset, rsrcFork.offset + rsrcFork.length - 1); + if(isBytes) return new OffsetStream(bytes, rsrcFork.offset, rsrcFork.offset + rsrcFork.length - 1); + if(isStream) return new OffsetStream(stream, rsrcFork.offset, rsrcFork.offset + rsrcFork.length - 1); if(isPath) - return new OffsetStream(basePath, FileMode.Open, FileAccess.Read, rsrcFork.offset, rsrcFork.offset + rsrcFork.length - 1); + return new OffsetStream(basePath, FileMode.Open, FileAccess.Read, rsrcFork.offset, + rsrcFork.offset + rsrcFork.length - 1); return null; } @@ -242,41 +242,41 @@ namespace DiscImageChef.Filters public override bool Identify(byte[] buffer) { - if(buffer == null || buffer.Length < 26) - return false; + if(buffer == null || buffer.Length < 26) return false; byte[] hdr_b = new byte[26]; Array.Copy(buffer, 0, hdr_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleHeader>(hdr_b); - return header.magic == AppleSingleMagic && (header.version == AppleSingleVersion || header.version == AppleSingleVersion2); + return header.magic == AppleSingleMagic && + (header.version == AppleSingleVersion || header.version == AppleSingleVersion2); } public override bool Identify(Stream stream) { - if(stream == null || stream.Length < 26) - return false; + if(stream == null || stream.Length < 26) return false; byte[] hdr_b = new byte[26]; stream.Seek(0, SeekOrigin.Begin); stream.Read(hdr_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleHeader>(hdr_b); - return header.magic == AppleSingleMagic && (header.version == AppleSingleVersion || header.version == AppleSingleVersion2); + return header.magic == AppleSingleMagic && + (header.version == AppleSingleVersion || header.version == AppleSingleVersion2); } public override bool Identify(string path) { FileStream fstream = new FileStream(path, FileMode.Open, FileAccess.Read); - if(fstream == null || fstream.Length < 26) - return false; + if(fstream == null || fstream.Length < 26) return false; byte[] hdr_b = new byte[26]; fstream.Read(hdr_b, 0, 26); header = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleHeader>(hdr_b); fstream.Close(); - return header.magic == AppleSingleMagic && (header.version == AppleSingleVersion || header.version == AppleSingleVersion2); + return header.magic == AppleSingleMagic && + (header.version == AppleSingleVersion || header.version == AppleSingleVersion2); } public override bool IsOpened() @@ -314,7 +314,8 @@ namespace DiscImageChef.Filters ms.Seek(entry.offset, SeekOrigin.Begin); byte[] dates_b = new byte[16]; ms.Read(dates_b, 0, 16); - AppleSingleFileDates dates = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleFileDates>(dates_b); + AppleSingleFileDates dates = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleFileDates>(dates_b); creationTime = DateHandlers.AppleDoubleToDateTime(dates.creationDate); lastWriteTime = DateHandlers.AppleDoubleToDateTime(dates.modificationDate); break; @@ -324,26 +325,31 @@ namespace DiscImageChef.Filters ms.Read(finfo, 0, finfo.Length); if(MacintoshHome.SequenceEqual(header.homeFilesystem)) { - AppleSingleMacFileInfo macinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleMacFileInfo>(finfo); + AppleSingleMacFileInfo macinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleMacFileInfo>(finfo); creationTime = DateHandlers.MacToDateTime(macinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(macinfo.modificationDate); } else if(ProDOSHome.SequenceEqual(header.homeFilesystem)) { - AppleSingleProDOSFileInfo prodosinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleProDOSFileInfo>(finfo); + AppleSingleProDOSFileInfo prodosinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleProDOSFileInfo>(finfo); creationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(prodosinfo.modificationDate); } else if(UNIXHome.SequenceEqual(header.homeFilesystem)) { - AppleSingleUNIXFileInfo unixinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleUNIXFileInfo>(finfo); + AppleSingleUNIXFileInfo unixinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleUNIXFileInfo>(finfo); creationTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.creationDate); lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.modificationDate); } else if(DOSHome.SequenceEqual(header.homeFilesystem)) { - AppleSingleDOSFileInfo dosinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleDOSFileInfo>(finfo); - lastWriteTime = DateHandlers.DOSToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); + AppleSingleDOSFileInfo dosinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleDOSFileInfo>(finfo); + lastWriteTime = + DateHandlers.DOSToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); } break; case AppleSingleEntryID.ResourceFork: @@ -387,7 +393,8 @@ namespace DiscImageChef.Filters stream.Seek(entry.offset, SeekOrigin.Begin); byte[] dates_b = new byte[16]; stream.Read(dates_b, 0, 16); - AppleSingleFileDates dates = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleFileDates>(dates_b); + AppleSingleFileDates dates = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleFileDates>(dates_b); creationTime = DateHandlers.MacToDateTime(dates.creationDate); lastWriteTime = DateHandlers.MacToDateTime(dates.modificationDate); break; @@ -397,26 +404,31 @@ namespace DiscImageChef.Filters stream.Read(finfo, 0, finfo.Length); if(MacintoshHome.SequenceEqual(header.homeFilesystem)) { - AppleSingleMacFileInfo macinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleMacFileInfo>(finfo); + AppleSingleMacFileInfo macinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleMacFileInfo>(finfo); creationTime = DateHandlers.MacToDateTime(macinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(macinfo.modificationDate); } else if(ProDOSHome.SequenceEqual(header.homeFilesystem)) { - AppleSingleProDOSFileInfo prodosinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleProDOSFileInfo>(finfo); + AppleSingleProDOSFileInfo prodosinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleProDOSFileInfo>(finfo); creationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(prodosinfo.modificationDate); } else if(UNIXHome.SequenceEqual(header.homeFilesystem)) { - AppleSingleUNIXFileInfo unixinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleUNIXFileInfo>(finfo); + AppleSingleUNIXFileInfo unixinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleUNIXFileInfo>(finfo); creationTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.creationDate); lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.modificationDate); } else if(DOSHome.SequenceEqual(header.homeFilesystem)) { - AppleSingleDOSFileInfo dosinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleDOSFileInfo>(finfo); - lastWriteTime = DateHandlers.DOSToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); + AppleSingleDOSFileInfo dosinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleDOSFileInfo>(finfo); + lastWriteTime = + DateHandlers.DOSToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); } break; case AppleSingleEntryID.ResourceFork: @@ -461,7 +473,8 @@ namespace DiscImageChef.Filters fs.Seek(entry.offset, SeekOrigin.Begin); byte[] dates_b = new byte[16]; fs.Read(dates_b, 0, 16); - AppleSingleFileDates dates = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleFileDates>(dates_b); + AppleSingleFileDates dates = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleFileDates>(dates_b); creationTime = DateHandlers.MacToDateTime(dates.creationDate); lastWriteTime = DateHandlers.MacToDateTime(dates.modificationDate); break; @@ -471,26 +484,31 @@ namespace DiscImageChef.Filters fs.Read(finfo, 0, finfo.Length); if(MacintoshHome.SequenceEqual(header.homeFilesystem)) { - AppleSingleMacFileInfo macinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleMacFileInfo>(finfo); + AppleSingleMacFileInfo macinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleMacFileInfo>(finfo); creationTime = DateHandlers.MacToDateTime(macinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(macinfo.modificationDate); } else if(ProDOSHome.SequenceEqual(header.homeFilesystem)) { - AppleSingleProDOSFileInfo prodosinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleProDOSFileInfo>(finfo); + AppleSingleProDOSFileInfo prodosinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleProDOSFileInfo>(finfo); creationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate); lastWriteTime = DateHandlers.MacToDateTime(prodosinfo.modificationDate); } else if(UNIXHome.SequenceEqual(header.homeFilesystem)) { - AppleSingleUNIXFileInfo unixinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleUNIXFileInfo>(finfo); + AppleSingleUNIXFileInfo unixinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleUNIXFileInfo>(finfo); creationTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.creationDate); lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.modificationDate); } else if(DOSHome.SequenceEqual(header.homeFilesystem)) { - AppleSingleDOSFileInfo dosinfo = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleDOSFileInfo>(finfo); - lastWriteTime = DateHandlers.DOSToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); + AppleSingleDOSFileInfo dosinfo = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleDOSFileInfo>(finfo); + lastWriteTime = + DateHandlers.DOSToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); } break; case AppleSingleEntryID.ResourceFork: @@ -505,5 +523,4 @@ namespace DiscImageChef.Filters basePath = path; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filters/BZip2.cs b/DiscImageChef.Filters/BZip2.cs index a1f9a5c4..2387a9e2 100644 --- a/DiscImageChef.Filters/BZip2.cs +++ b/DiscImageChef.Filters/BZip2.cs @@ -55,8 +55,7 @@ namespace DiscImageChef.Filters public override void Close() { - if(dataStream != null) - dataStream.Close(); + if(dataStream != null) dataStream.Close(); dataStream = null; basePath = null; opened = false; @@ -94,11 +93,13 @@ namespace DiscImageChef.Filters if(buffer.Length > 512) { // Check it is not an UDIF - if(buffer[buffer.Length - 512] == 0x6B && buffer[buffer.Length - 511] == 0x6F && buffer[buffer.Length - 510] == 0x6C && buffer[buffer.Length - 509] == 0x79) - return false; + if(buffer[buffer.Length - 512] == 0x6B && buffer[buffer.Length - 511] == 0x6F && + buffer[buffer.Length - 510] == 0x6C && buffer[buffer.Length - 509] == 0x79) return false; } + return true; } + return false; } @@ -118,11 +119,12 @@ namespace DiscImageChef.Filters stream.Read(buffer, 0, 4); stream.Seek(0, SeekOrigin.Begin); // Check it is not an UDIF - if(buffer[0] == 0x6B && buffer[1] == 0x6F && buffer[2] == 0x6C && buffer[3] == 0x79) - return false; + if(buffer[0] == 0x6B && buffer[1] == 0x6F && buffer[2] == 0x6C && buffer[3] == 0x79) return false; } + return true; } + return false; } @@ -137,7 +139,8 @@ namespace DiscImageChef.Filters stream.Read(buffer, 0, 4); stream.Seek(0, SeekOrigin.Begin); - if(buffer[0] == 0x42 && buffer[1] == 0x5A && buffer[2] == 0x68 && buffer[3] >= 0x31 && buffer[3] <= 0x39) + if(buffer[0] == 0x42 && buffer[1] == 0x5A && buffer[2] == 0x68 && buffer[3] >= 0x31 && buffer[3] <= 0x39 + ) { if(stream.Length > 512) { @@ -148,6 +151,7 @@ namespace DiscImageChef.Filters if(buffer[0] == 0x6B && buffer[1] == 0x6F && buffer[2] == 0x6C && buffer[3] == 0x79) return false; } + return true; } } @@ -220,12 +224,12 @@ namespace DiscImageChef.Filters public override string GetFilename() { - if(basePath == null) - return null; + if(basePath == null) return null; if(basePath.EndsWith(".bz2", StringComparison.InvariantCultureIgnoreCase)) return basePath.Substring(0, basePath.Length - 4); if(basePath.EndsWith(".bzip2", StringComparison.InvariantCultureIgnoreCase)) return basePath.Substring(0, basePath.Length - 6); + return basePath; } diff --git a/DiscImageChef.Filters/Filter.cs b/DiscImageChef.Filters/Filter.cs index 765c3d10..12c6dade 100644 --- a/DiscImageChef.Filters/Filter.cs +++ b/DiscImageChef.Filters/Filter.cs @@ -40,9 +40,7 @@ namespace DiscImageChef.Filters public string Name; public Guid UUID; - protected Filter() - { - } + protected Filter() { } /// <summary> /// Closes all opened streams. @@ -169,5 +167,4 @@ namespace DiscImageChef.Filters /// <param name="buffer">Buffer.</param> public abstract void Open(byte[] buffer); } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filters/Filters.cs b/DiscImageChef.Filters/Filters.cs index 3a402320..95391ca1 100644 --- a/DiscImageChef.Filters/Filters.cs +++ b/DiscImageChef.Filters/Filters.cs @@ -59,10 +59,7 @@ namespace DiscImageChef.Filters } } } - catch(Exception exception) - { - DicConsole.ErrorWriteLine("Exception {0}", exception); - } + catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); } } } @@ -76,23 +73,21 @@ namespace DiscImageChef.Filters { if(filter.Identify(path)) { - Filter foundFilter = (Filter)filter.GetType().GetConstructor(Type.EmptyTypes).Invoke(new object[] { }); + Filter foundFilter = + (Filter)filter.GetType().GetConstructor(Type.EmptyTypes).Invoke(new object[] { }); foundFilter.Open(path); - if(foundFilter.IsOpened()) - return foundFilter; + if(foundFilter.IsOpened()) return foundFilter; } } - else - noFilter = filter; + else noFilter = filter; } if(noFilter.Identify(path)) { noFilter.Open(path); - if(noFilter.IsOpened()) - return noFilter; + if(noFilter.IsOpened()) return noFilter; } return noFilter; @@ -103,5 +98,4 @@ namespace DiscImageChef.Filters return filtersList; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filters/ForcedSeekStream.cs b/DiscImageChef.Filters/ForcedSeekStream.cs index 2cb50cf3..fb47391d 100644 --- a/DiscImageChef.Filters/ForcedSeekStream.cs +++ b/DiscImageChef.Filters/ForcedSeekStream.cs @@ -60,8 +60,7 @@ namespace DiscImageChef.Filters baseStream = (T)Activator.CreateInstance(typeof(T), parameters); backFile = Path.GetTempFileName(); backStream = new FileStream(backFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None); - if(length == 0) - CalculateLength(); + if(length == 0) CalculateLength(); } /// <summary> @@ -100,53 +99,34 @@ namespace DiscImageChef.Filters public override bool CanRead { - get - { - return baseStream.CanRead; - } + get { return baseStream.CanRead; } } public override bool CanSeek { - get - { - return true; - } + get { return true; } } public override bool CanWrite { - get - { - return false; - } + get { return false; } } public override long Length { - get - { - return streamLength; - } + get { return streamLength; } } public override long Position { - get - { - return backStream.Position; - } + get { return backStream.Position; } - set - { - SetPosition(value); - } + set { SetPosition(value); } } void SetPosition(long position) { - if(position == backStream.Position) - return; + if(position == backStream.Position) return; if(position < backStream.Length) { @@ -205,15 +185,14 @@ namespace DiscImageChef.Filters switch(origin) { case SeekOrigin.Begin: - if(offset < 0) - throw new IOException("Cannot seek before stream start."); + if(offset < 0) throw new IOException("Cannot seek before stream start."); + SetPosition(offset); break; case SeekOrigin.End: - if(offset > 0) - throw new IOException("Cannot seek after stream end."); - if(streamLength == 0) - CalculateLength(); + if(offset > 0) throw new IOException("Cannot seek after stream end."); + + if(streamLength == 0) CalculateLength(); SetPosition(streamLength + offset); break; default: @@ -236,17 +215,14 @@ namespace DiscImageChef.Filters public override void Close() { - if(backStream!=null) - backStream.Close(); + if(backStream != null) backStream.Close(); File.Delete(backFile); } ~ForcedSeekStream() { - if(backStream != null) - backStream.Close(); + if(backStream != null) backStream.Close(); File.Delete(backFile); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filters/GZip.cs b/DiscImageChef.Filters/GZip.cs index 5bd84f46..0fc49f8f 100644 --- a/DiscImageChef.Filters/GZip.cs +++ b/DiscImageChef.Filters/GZip.cs @@ -54,8 +54,7 @@ namespace DiscImageChef.Filters public override void Close() { - if(dataStream != null) - dataStream.Close(); + if(dataStream != null) dataStream.Close(); dataStream = null; basePath = null; opened = false; @@ -225,12 +224,12 @@ namespace DiscImageChef.Filters public override string GetFilename() { - if(basePath == null) - return null; + if(basePath == null) return null; if(basePath.EndsWith(".gz", StringComparison.InvariantCultureIgnoreCase)) return basePath.Substring(0, basePath.Length - 3); if(basePath.EndsWith(".gzip", StringComparison.InvariantCultureIgnoreCase)) return basePath.Substring(0, basePath.Length - 5); + return basePath; } diff --git a/DiscImageChef.Filters/LZip.cs b/DiscImageChef.Filters/LZip.cs index 98e64f38..76fbed73 100644 --- a/DiscImageChef.Filters/LZip.cs +++ b/DiscImageChef.Filters/LZip.cs @@ -55,8 +55,7 @@ namespace DiscImageChef.Filters public override void Close() { - if(dataStream != null) - dataStream.Close(); + if(dataStream != null) dataStream.Close(); dataStream = null; basePath = null; opened = false; @@ -89,7 +88,8 @@ namespace DiscImageChef.Filters public override bool Identify(byte[] buffer) { - return buffer[0] == 0x4C && buffer[1] == 0x5A && buffer[2] == 0x49 && buffer[3] == 0x50 && buffer[4] == 0x01; + return buffer[0] == 0x4C && buffer[1] == 0x5A && buffer[2] == 0x49 && buffer[3] == 0x50 && + buffer[4] == 0x01; } public override bool Identify(Stream stream) @@ -100,7 +100,8 @@ namespace DiscImageChef.Filters stream.Read(buffer, 0, 5); stream.Seek(0, SeekOrigin.Begin); - return buffer[0] == 0x4C && buffer[1] == 0x5A && buffer[2] == 0x49 && buffer[3] == 0x50 && buffer[4] == 0x01; + return buffer[0] == 0x4C && buffer[1] == 0x5A && buffer[2] == 0x49 && buffer[3] == 0x50 && + buffer[4] == 0x01; } public override bool Identify(string path) @@ -114,7 +115,8 @@ namespace DiscImageChef.Filters stream.Read(buffer, 0, 5); stream.Seek(0, SeekOrigin.Begin); - return buffer[0] == 0x4C && buffer[1] == 0x5A && buffer[2] == 0x49 && buffer[3] == 0x50 && buffer[4] == 0x01; + return buffer[0] == 0x4C && buffer[1] == 0x5A && buffer[2] == 0x49 && buffer[3] == 0x50 && + buffer[4] == 0x01; } return false; @@ -127,7 +129,8 @@ namespace DiscImageChef.Filters creationTime = DateTime.UtcNow; lastWriteTime = creationTime; decompressedSize = BitConverter.ToInt64(buffer, buffer.Length - 16); - innerStream = new ForcedSeekStream<LZipStream>(decompressedSize, dataStream, CompressionMode.Decompress, false); + innerStream = + new ForcedSeekStream<LZipStream>(decompressedSize, dataStream, CompressionMode.Decompress, false); opened = true; } @@ -138,11 +141,12 @@ namespace DiscImageChef.Filters creationTime = DateTime.UtcNow; lastWriteTime = creationTime; byte[] tmp = new byte[8]; - dataStream.Seek(-16 ,SeekOrigin.End); + dataStream.Seek(-16, SeekOrigin.End); dataStream.Read(tmp, 0, 8); decompressedSize = BitConverter.ToInt64(tmp, 0); dataStream.Seek(0, SeekOrigin.Begin); - innerStream = new ForcedSeekStream<LZipStream>(decompressedSize, dataStream, CompressionMode.Decompress, false); + innerStream = + new ForcedSeekStream<LZipStream>(decompressedSize, dataStream, CompressionMode.Decompress, false); opened = true; } @@ -162,7 +166,8 @@ namespace DiscImageChef.Filters dataStream.Read(tmp, 0, 8); decompressedSize = BitConverter.ToInt64(tmp, 0); dataStream.Seek(0, SeekOrigin.Begin); - innerStream = new ForcedSeekStream<LZipStream>(decompressedSize, dataStream, CompressionMode.Decompress, false); + innerStream = + new ForcedSeekStream<LZipStream>(decompressedSize, dataStream, CompressionMode.Decompress, false); opened = true; } @@ -193,12 +198,12 @@ namespace DiscImageChef.Filters public override string GetFilename() { - if(basePath == null) - return null; + if(basePath == null) return null; if(basePath.EndsWith(".lz", StringComparison.InvariantCultureIgnoreCase)) return basePath.Substring(0, basePath.Length - 3); if(basePath.EndsWith(".lzip", StringComparison.InvariantCultureIgnoreCase)) return basePath.Substring(0, basePath.Length - 5); + return basePath; } diff --git a/DiscImageChef.Filters/MacBinary.cs b/DiscImageChef.Filters/MacBinary.cs index 16cb7dfb..50141e1a 100644 --- a/DiscImageChef.Filters/MacBinary.cs +++ b/DiscImageChef.Filters/MacBinary.cs @@ -50,8 +50,7 @@ namespace DiscImageChef.Filters /// <summary> /// 0x01, Str63 Pascal filename /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] filename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] filename; /// <summary> /// 0x41, File type /// </summary> @@ -112,6 +111,7 @@ namespace DiscImageChef.Filters /// 0x65, Low byte of Finder flags /// </summary> public byte finderFlags2; + #region MacBinary III /// <summary> /// 0x66, magic identifier, "mBIN" @@ -126,6 +126,7 @@ namespace DiscImageChef.Filters /// </summary> public byte fdXFlags; #endregion MacBinary III + /// <summary> /// 0x6C, unused /// </summary> @@ -134,6 +135,7 @@ namespace DiscImageChef.Filters /// 0x74, Total unpacked files /// </summary> public uint totalPackedFiles; + #region MacBinary II /// <summary> /// 0x78, Length of secondary header @@ -152,6 +154,7 @@ namespace DiscImageChef.Filters /// </summary> public short crc; #endregion MacBinary II + /// <summary> /// 0x7E, Reserved for computer type and OS ID /// </summary> @@ -180,8 +183,7 @@ namespace DiscImageChef.Filters public override void Close() { bytes = null; - if(stream != null) - stream.Close(); + if(stream != null) stream.Close(); isBytes = false; isStream = false; isPath = false; @@ -205,15 +207,13 @@ namespace DiscImageChef.Filters public override Stream GetDataForkStream() { - if(header.dataLength == 0) - return null; + if(header.dataLength == 0) return null; - if(isBytes) - return new OffsetStream(bytes, dataForkOff, dataForkOff + header.dataLength - 1); - if(isStream) - return new OffsetStream(stream, dataForkOff, dataForkOff + header.dataLength - 1); + if(isBytes) return new OffsetStream(bytes, dataForkOff, dataForkOff + header.dataLength - 1); + if(isStream) return new OffsetStream(stream, dataForkOff, dataForkOff + header.dataLength - 1); if(isPath) - return new OffsetStream(basePath, FileMode.Open, FileAccess.Read, dataForkOff, dataForkOff + header.dataLength - 1); + return new OffsetStream(basePath, FileMode.Open, FileAccess.Read, dataForkOff, + dataForkOff + header.dataLength - 1); return null; } @@ -250,15 +250,13 @@ namespace DiscImageChef.Filters public override Stream GetResourceForkStream() { - if(header.resourceLength == 0) - return null; + if(header.resourceLength == 0) return null; - if(isBytes) - return new OffsetStream(bytes, rsrcForkOff, rsrcForkOff + header.resourceLength - 1); - if(isStream) - return new OffsetStream(stream, rsrcForkOff, rsrcForkOff + header.resourceLength - 1); + if(isBytes) return new OffsetStream(bytes, rsrcForkOff, rsrcForkOff + header.resourceLength - 1); + if(isStream) return new OffsetStream(stream, rsrcForkOff, rsrcForkOff + header.resourceLength - 1); if(isPath) - return new OffsetStream(basePath, FileMode.Open, FileAccess.Read, rsrcForkOff, rsrcForkOff + header.resourceLength - 1); + return new OffsetStream(basePath, FileMode.Open, FileAccess.Read, rsrcForkOff, + rsrcForkOff + header.resourceLength - 1); return null; } @@ -270,47 +268,47 @@ namespace DiscImageChef.Filters public override bool Identify(byte[] buffer) { - if(buffer == null || buffer.Length < 128) - return false; + if(buffer == null || buffer.Length < 128) return false; byte[] hdr_b = new byte[128]; Array.Copy(buffer, 0, hdr_b, 0, 128); header = BigEndianMarshal.ByteArrayToStructureBigEndian<MacBinaryHeader>(hdr_b); - return header.magic == MacBinaryMagic || (header.version == 0 && header.filename[0] > 0 && header.filename[0] < 64 && - header.zero1 == 0 && header.zero2 == 0 && header.reserved == 0 && ( - header.dataLength > 0 || header.resourceLength > 0)); + return header.magic == MacBinaryMagic || (header.version == 0 && header.filename[0] > 0 && + header.filename[0] < 64 && header.zero1 == 0 && + header.zero2 == 0 && header.reserved == 0 && + (header.dataLength > 0 || header.resourceLength > 0)); } public override bool Identify(Stream stream) { - if(stream == null || stream.Length < 128) - return false; + if(stream == null || stream.Length < 128) return false; byte[] hdr_b = new byte[128]; stream.Seek(0, SeekOrigin.Begin); stream.Read(hdr_b, 0, 128); header = BigEndianMarshal.ByteArrayToStructureBigEndian<MacBinaryHeader>(hdr_b); - return header.magic == MacBinaryMagic || (header.version == 0 && header.filename[0] > 0 && header.filename[0] < 64 && - header.zero1 == 0 && header.zero2 == 0 && header.reserved == 0 && ( - header.dataLength > 0 || header.resourceLength > 0)); + return header.magic == MacBinaryMagic || (header.version == 0 && header.filename[0] > 0 && + header.filename[0] < 64 && header.zero1 == 0 && + header.zero2 == 0 && header.reserved == 0 && + (header.dataLength > 0 || header.resourceLength > 0)); } public override bool Identify(string path) { FileStream fstream = new FileStream(path, FileMode.Open, FileAccess.Read); - if(fstream == null || fstream.Length < 128) - return false; + if(fstream == null || fstream.Length < 128) return false; byte[] hdr_b = new byte[128]; fstream.Read(hdr_b, 0, 128); header = BigEndianMarshal.ByteArrayToStructureBigEndian<MacBinaryHeader>(hdr_b); fstream.Close(); - return header.magic == MacBinaryMagic || (header.version == 0 && header.filename[0] > 0 && header.filename[0] < 64 && - header.zero1 == 0 && header.zero2 == 0 && header.reserved == 0 && ( - header.dataLength > 0 || header.resourceLength > 0)); + return header.magic == MacBinaryMagic || (header.version == 0 && header.filename[0] > 0 && + header.filename[0] < 64 && header.zero1 == 0 && + header.zero2 == 0 && header.reserved == 0 && + (header.dataLength > 0 || header.resourceLength > 0)); } public override bool IsOpened() @@ -329,12 +327,10 @@ namespace DiscImageChef.Filters uint blocks = 1; blocks += (uint)(header.secondaryHeaderLength / 128); - if(header.secondaryHeaderLength % 128 > 0) - blocks++; + if(header.secondaryHeaderLength % 128 > 0) blocks++; dataForkOff = blocks * 128; blocks += header.dataLength / 128; - if(header.dataLength % 128 > 0) - blocks++; + if(header.dataLength % 128 > 0) blocks++; rsrcForkOff = blocks * 128; filename = StringHandlers.PascalToString(header.filename, Encoding.GetEncoding("macintosh")); @@ -357,12 +353,10 @@ namespace DiscImageChef.Filters uint blocks = 1; blocks += (uint)(header.secondaryHeaderLength / 128); - if(header.secondaryHeaderLength % 128 > 0) - blocks++; + if(header.secondaryHeaderLength % 128 > 0) blocks++; dataForkOff = blocks * 128; blocks += header.dataLength / 128; - if(header.dataLength % 128 > 0) - blocks++; + if(header.dataLength % 128 > 0) blocks++; rsrcForkOff = blocks * 128; filename = StringHandlers.PascalToString(header.filename, Encoding.GetEncoding("macintosh")); @@ -386,12 +380,10 @@ namespace DiscImageChef.Filters uint blocks = 1; blocks += (uint)(header.secondaryHeaderLength / 128); - if(header.secondaryHeaderLength % 128 > 0) - blocks++; + if(header.secondaryHeaderLength % 128 > 0) blocks++; dataForkOff = blocks * 128; blocks += header.dataLength / 128; - if(header.dataLength % 128 > 0) - blocks++; + if(header.dataLength % 128 > 0) blocks++; rsrcForkOff = blocks * 128; filename = StringHandlers.PascalToString(header.filename, Encoding.GetEncoding("macintosh")); @@ -404,4 +396,4 @@ namespace DiscImageChef.Filters basePath = path; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filters/OffsetStream.cs b/DiscImageChef.Filters/OffsetStream.cs index 45b41f34..fb405314 100644 --- a/DiscImageChef.Filters/OffsetStream.cs +++ b/DiscImageChef.Filters/OffsetStream.cs @@ -48,291 +48,247 @@ namespace DiscImageChef.Filters public OffsetStream(Stream stream, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = stream; - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } - public OffsetStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, long start, long end) + public OffsetStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, + FileOptions options, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new FileStream(path, mode, access, share, bufferSize, options); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } public OffsetStream(SafeFileHandle handle, FileAccess access, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new FileStream(handle, access); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } public OffsetStream(SafeFileHandle handle, FileAccess access, int bufferSize, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new FileStream(handle, access, bufferSize); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } - public OffsetStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync, long start, long end) + public OffsetStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync, long start, + long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new FileStream(handle, access, bufferSize, isAsync); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } - public OffsetStream(string path, FileMode mode, FileSystemRights rights, FileShare share, int bufferSize, FileOptions options, long start, long end) + public OffsetStream(string path, FileMode mode, FileSystemRights rights, FileShare share, int bufferSize, + FileOptions options, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new FileStream(path, mode, rights, share, bufferSize, options); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } - public OffsetStream(string path, FileMode mode, FileSystemRights rights, FileShare share, int bufferSize, FileOptions options, FileSecurity fileSecurity, long start, long end) + public OffsetStream(string path, FileMode mode, FileSystemRights rights, FileShare share, int bufferSize, + FileOptions options, FileSecurity fileSecurity, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new FileStream(path, mode, rights, share, bufferSize, options, fileSecurity); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } - public OffsetStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool useAsync, long start, long end) + public OffsetStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, + bool useAsync, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new FileStream(path, mode, access, share, bufferSize, useAsync); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } - public OffsetStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, long start, long end) + public OffsetStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, long start, + long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new FileStream(path, mode, access, share, bufferSize); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } public OffsetStream(string path, FileMode mode, FileAccess access, FileShare share, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new FileStream(path, mode, access, share); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } public OffsetStream(string path, FileMode mode, FileAccess access, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new FileStream(path, mode, access); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } public OffsetStream(string path, FileMode mode, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new FileStream(path, mode); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } - public OffsetStream(byte[] buffer, int index, int count, bool writable, bool publiclyVisible, long start, long end) + public OffsetStream(byte[] buffer, int index, int count, bool writable, bool publiclyVisible, long start, + long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new MemoryStream(buffer, index, count, writable, publiclyVisible); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } public OffsetStream(byte[] buffer, int index, int count, bool writable, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new MemoryStream(buffer, index, count, writable); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } public OffsetStream(byte[] buffer, int index, int count, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new MemoryStream(buffer, index, count); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } public OffsetStream(byte[] buffer, bool writable, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new MemoryStream(buffer, writable); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } public OffsetStream(byte[] buffer, long start, long end) { - if(start < 0) - throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); + if(start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Start can't be a negative number."); - if(end < 0) - throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); + if(end < 0) throw new ArgumentOutOfRangeException(nameof(end), "End can't be a negative number."); streamStart = start; streamEnd = end; baseStream = new MemoryStream(buffer); - if(end > baseStream.Length) - throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); + if(end > baseStream.Length) throw new ArgumentOutOfRangeException(nameof(end), "End is after stream end."); } ~OffsetStream() @@ -343,64 +299,48 @@ namespace DiscImageChef.Filters public override bool CanRead { - get - { - return baseStream.CanRead; - } + get { return baseStream.CanRead; } } public override bool CanSeek { - get - { - return baseStream.CanSeek; - } + get { return baseStream.CanSeek; } } public override bool CanWrite { - get - { - return baseStream.CanWrite; - } + get { return baseStream.CanWrite; } } public override long Length { - get - { - return streamEnd - streamStart + 1; - } + get { return streamEnd - streamStart + 1; } } public override long Position { - get - { - return baseStream.Position - streamStart; - } + get { return baseStream.Position - streamStart; } set { - if(value + streamStart > streamEnd) - throw new IOException("Cannot set position past stream end."); + if(value + streamStart > streamEnd) throw new IOException("Cannot set position past stream end."); baseStream.Position = value; } } - public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) + public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, + object state) { - if(baseStream.Position + count > streamEnd) - throw new IOException("Cannot read past stream end."); + if(baseStream.Position + count > streamEnd) throw new IOException("Cannot read past stream end."); return baseStream.BeginRead(buffer, offset, count, callback, state); } - public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) + public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, + object state) { - if(baseStream.Position + count > streamEnd) - throw new IOException("Cannot write past stream end."); + if(baseStream.Position + count > streamEnd) throw new IOException("Cannot write past stream end."); return baseStream.BeginWrite(buffer, offset, count, callback, state); } @@ -433,8 +373,7 @@ namespace DiscImageChef.Filters public override void WriteByte(byte value) { - if(baseStream.Position + 1 > streamEnd) - throw new IOException("Cannot write past stream end."); + if(baseStream.Position + 1 > streamEnd) throw new IOException("Cannot write past stream end."); baseStream.WriteByte(value); } @@ -446,8 +385,7 @@ namespace DiscImageChef.Filters public override int Read(byte[] buffer, int offset, int count) { - if(baseStream.Position + count > streamEnd + 1) - throw new IOException("Cannot read past stream end."); + if(baseStream.Position + count > streamEnd + 1) throw new IOException("Cannot read past stream end."); return baseStream.Read(buffer, offset, count); } @@ -457,16 +395,17 @@ namespace DiscImageChef.Filters switch(origin) { case SeekOrigin.Begin: - if(offset + streamStart > streamEnd) - throw new IOException("Cannot seek past stream end."); + if(offset + streamStart > streamEnd) throw new IOException("Cannot seek past stream end."); + return baseStream.Seek(offset + streamStart, SeekOrigin.Begin) - streamStart; case SeekOrigin.End: if(offset - (baseStream.Length - streamEnd) < streamStart) throw new IOException("Cannot seek before stream start."); + return baseStream.Seek(offset - (baseStream.Length - streamEnd), SeekOrigin.End) - streamStart; default: - if(offset + baseStream.Position > streamEnd) - throw new IOException("Cannot seek past stream end."); + if(offset + baseStream.Position > streamEnd) throw new IOException("Cannot seek past stream end."); + return baseStream.Seek(offset, SeekOrigin.Current) - streamStart; } } @@ -478,11 +417,9 @@ namespace DiscImageChef.Filters public override void Write(byte[] buffer, int offset, int count) { - if(baseStream.Position + count > streamEnd) - throw new IOException("Cannot write past stream end."); + if(baseStream.Position + count > streamEnd) throw new IOException("Cannot write past stream end."); baseStream.Write(buffer, offset, count); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filters/PCExchange.cs b/DiscImageChef.Filters/PCExchange.cs index 9652616e..59c2f232 100644 --- a/DiscImageChef.Filters/PCExchange.cs +++ b/DiscImageChef.Filters/PCExchange.cs @@ -52,8 +52,7 @@ namespace DiscImageChef.Filters /// Name in Macintosh. If PCExchange version supports FAT's LFN they are the same. /// Illegal characters for FAT get substituted with '_' both here and in FAT's LFN entry. /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] macName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] macName; /// <summary> /// File type /// </summary> @@ -77,8 +76,7 @@ namespace DiscImageChef.Filters /// <summary> /// Unknown, all bytes are empty but last, except in volume's label entry /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] - public byte[] unknown1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] public byte[] unknown1; /// <summary> /// File's creation date /// </summary> @@ -100,8 +98,7 @@ namespace DiscImageChef.Filters /// Name as in FAT entry (not LFN). /// Resource fork file is always using this name, never LFN. /// </summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] dosName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] dosName; /// <summary> /// Unknown, flags? /// </summary> @@ -203,18 +200,17 @@ namespace DiscImageChef.Filters { string parentFolder = Path.GetDirectoryName(path); - if(!File.Exists(Path.Combine(parentFolder, FinderInfo))) - return false; + if(!File.Exists(Path.Combine(parentFolder, FinderInfo))) return false; - if(!Directory.Exists(Path.Combine(parentFolder, Resources))) - return false; + if(!Directory.Exists(Path.Combine(parentFolder, Resources))) return false; string baseFilename = Path.GetFileName(path); bool dataFound = false; bool rsrcFound = false; - FileStream finderDatStream = new FileStream(Path.Combine(parentFolder, FinderInfo), FileMode.Open, FileAccess.Read); + FileStream finderDatStream = + new FileStream(Path.Combine(parentFolder, FinderInfo), FileMode.Open, FileAccess.Read); while(finderDatStream.Position + 0x5C <= finderDatStream.Length) { @@ -228,16 +224,18 @@ namespace DiscImageChef.Filters byte[] tmpDosExt_b = new byte[3]; Array.Copy(datEntry.dosName, 0, tmpDosName_b, 0, 8); Array.Copy(datEntry.dosName, 8, tmpDosExt_b, 0, 3); - string dosName = (Encoding.ASCII.GetString(tmpDosName_b).Trim() + "." + Encoding.ASCII.GetString(tmpDosExt_b).Trim()); + string dosName = (Encoding.ASCII.GetString(tmpDosName_b).Trim() + "." + + Encoding.ASCII.GetString(tmpDosExt_b).Trim()); string dosNameLow = dosName.ToLower(CultureInfo.CurrentCulture); if(baseFilename == macName || baseFilename == dosName || baseFilename == dosNameLow) { - dataFound |= File.Exists(Path.Combine(parentFolder, macName)) || File.Exists(Path.Combine(parentFolder, dosName)) || - File.Exists(Path.Combine(parentFolder, dosNameLow)); + dataFound |= File.Exists(Path.Combine(parentFolder, macName)) || + File.Exists(Path.Combine(parentFolder, dosName)) || + File.Exists(Path.Combine(parentFolder, dosNameLow)); rsrcFound |= File.Exists(Path.Combine(parentFolder, Resources, dosName)) || - File.Exists(Path.Combine(parentFolder, Resources, dosNameLow)); + File.Exists(Path.Combine(parentFolder, Resources, dosNameLow)); break; } @@ -268,7 +266,8 @@ namespace DiscImageChef.Filters string parentFolder = Path.GetDirectoryName(path); string baseFilename = Path.GetFileName(path); - FileStream finderDatStream = new FileStream(Path.Combine(parentFolder, FinderInfo), FileMode.Open, FileAccess.Read); + FileStream finderDatStream = + new FileStream(Path.Combine(parentFolder, FinderInfo), FileMode.Open, FileAccess.Read); while(finderDatStream.Position + 0x5C <= finderDatStream.Length) { @@ -281,26 +280,24 @@ namespace DiscImageChef.Filters byte[] tmpDosExt_b = new byte[3]; Array.Copy(datEntry.dosName, 0, tmpDosName_b, 0, 8); Array.Copy(datEntry.dosName, 8, tmpDosExt_b, 0, 3); - string dosName = (Encoding.ASCII.GetString(tmpDosName_b).Trim() + "." + Encoding.ASCII.GetString(tmpDosExt_b).Trim()); + string dosName = (Encoding.ASCII.GetString(tmpDosName_b).Trim() + "." + + Encoding.ASCII.GetString(tmpDosExt_b).Trim()); string dosNameLow = dosName.ToLower(CultureInfo.CurrentCulture); if(baseFilename == macName || baseFilename == dosName || baseFilename == dosNameLow) { - if(File.Exists(Path.Combine(parentFolder, macName))) - dataPath = Path.Combine(parentFolder, macName); + if(File.Exists(Path.Combine(parentFolder, macName))) dataPath = Path.Combine(parentFolder, macName); else if(File.Exists(Path.Combine(parentFolder, dosName))) dataPath = Path.Combine(parentFolder, dosName); else if(File.Exists(Path.Combine(parentFolder, dosNameLow))) dataPath = Path.Combine(parentFolder, dosNameLow); - else - dataPath = null; + else dataPath = null; if(File.Exists(Path.Combine(parentFolder, Resources, dosName))) rsrcPath = Path.Combine(parentFolder, Resources, dosName); else if(File.Exists(Path.Combine(parentFolder, Resources, dosNameLow))) rsrcPath = Path.Combine(parentFolder, Resources, dosNameLow); - else - rsrcPath = null; + else rsrcPath = null; lastWriteTime = DateHandlers.MacToDateTime(datEntry.modificationDate); creationTime = DateHandlers.MacToDateTime(datEntry.creationDate); @@ -318,4 +315,4 @@ namespace DiscImageChef.Filters finderDatStream.Close(); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Filters/Properties/AssemblyInfo.cs b/DiscImageChef.Filters/Properties/AssemblyInfo.cs index d4c1416e..282a4de7 100644 --- a/DiscImageChef.Filters/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Filters/Properties/AssemblyInfo.cs @@ -54,5 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Filters/XZ.cs b/DiscImageChef.Filters/XZ.cs index c71a1c85..baa38793 100644 --- a/DiscImageChef.Filters/XZ.cs +++ b/DiscImageChef.Filters/XZ.cs @@ -54,8 +54,7 @@ namespace DiscImageChef.Filters public override void Close() { - if(dataStream != null) - dataStream.Close(); + if(dataStream != null) dataStream.Close(); dataStream = null; basePath = null; opened = false; @@ -88,7 +87,9 @@ namespace DiscImageChef.Filters public override bool Identify(byte[] buffer) { - return buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A && buffer[3] == 0x58 && buffer[4] == 0x5A && buffer[5] == 0x00 && buffer[buffer.Length - 2] == 0x59 && buffer[buffer.Length - 1] == 0x5A; + return buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A && buffer[3] == 0x58 && + buffer[4] == 0x5A && buffer[5] == 0x00 && buffer[buffer.Length - 2] == 0x59 && + buffer[buffer.Length - 1] == 0x5A; } public override bool Identify(Stream stream) @@ -102,7 +103,8 @@ namespace DiscImageChef.Filters stream.Read(footer, 0, 2); stream.Seek(0, SeekOrigin.Begin); - return buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A && buffer[3] == 0x58 && buffer[4] == 0x5A && buffer[5] == 0x00 && footer[0] == 0x59 && footer[1] == 0x5A; + return buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A && buffer[3] == 0x58 && + buffer[4] == 0x5A && buffer[5] == 0x00 && footer[0] == 0x59 && footer[1] == 0x5A; } public override bool Identify(string path) @@ -120,7 +122,8 @@ namespace DiscImageChef.Filters stream.Read(footer, 0, 2); stream.Seek(0, SeekOrigin.Begin); - return buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A && buffer[3] == 0x58 && buffer[4] == 0x5A && buffer[5] == 0x00 && footer[0] == 0x59 && footer[1] == 0x5A; + return buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A && buffer[3] == 0x58 && + buffer[4] == 0x5A && buffer[5] == 0x00 && footer[0] == 0x59 && footer[1] == 0x5A; } return false; @@ -155,19 +158,16 @@ namespace DiscImageChef.Filters int Decode(byte[] buf, int size_max, ref ulong num) { - if(size_max == 0) - return 0; + if(size_max == 0) return 0; - if(size_max > 9) - size_max = 9; + if(size_max > 9) size_max = 9; num = (ulong)(buf[0] & 0x7F); int i = 0; while((buf[i++] & 0x80) == 0x80) { - if(i >= size_max || buf[i] == 0x00) - return 0; + if(i >= size_max || buf[i] == 0x00) return 0; num |= (ulong)(buf[i] & 0x7F) << (i * 7); } @@ -240,12 +240,12 @@ namespace DiscImageChef.Filters public override string GetFilename() { - if(basePath == null) - return null; + if(basePath == null) return null; if(basePath.EndsWith(".xz", StringComparison.InvariantCultureIgnoreCase)) return basePath.Substring(0, basePath.Length - 3); if(basePath.EndsWith(".xzip", StringComparison.InvariantCultureIgnoreCase)) return basePath.Substring(0, basePath.Length - 5); + return basePath; } diff --git a/DiscImageChef.Filters/ZZZNoFilter.cs b/DiscImageChef.Filters/ZZZNoFilter.cs index a20953f8..fc8e15fc 100644 --- a/DiscImageChef.Filters/ZZZNoFilter.cs +++ b/DiscImageChef.Filters/ZZZNoFilter.cs @@ -51,8 +51,7 @@ namespace DiscImageChef.Filters public override void Close() { - if(dataStream != null) - dataStream.Close(); + if(dataStream != null) dataStream.Close(); dataStream = null; basePath = null; opened = false; @@ -167,5 +166,4 @@ namespace DiscImageChef.Filters return opened; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Filters/packages.config b/DiscImageChef.Filters/packages.config index c324435a..42d35f89 100644 --- a/DiscImageChef.Filters/packages.config +++ b/DiscImageChef.Filters/packages.config @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> + <packages> - <package id="SharpCompress" version="0.19.2" targetFramework="net40" /> + <package id="SharpCompress" version="0.19.2" targetFramework="net40" /> </packages> \ No newline at end of file diff --git a/DiscImageChef.Helpers/ArrayFill.cs b/DiscImageChef.Helpers/ArrayFill.cs index 6cc52325..733a3513 100644 --- a/DiscImageChef.Helpers/ArrayFill.cs +++ b/DiscImageChef.Helpers/ArrayFill.cs @@ -34,15 +34,12 @@ namespace DiscImageChef public static void ArrayFill<T>(T[] destinationArray, T value) { // if called with a single value, wrap the value in an array and call the main function - ArrayFill(destinationArray, new T[] { value }); + ArrayFill(destinationArray, new T[] {value}); } public static void ArrayFill<T>(T[] destinationArray, T[] value) { - if(destinationArray == null) - { - throw new ArgumentNullException(nameof(destinationArray)); - } + if(destinationArray == null) { throw new ArgumentNullException(nameof(destinationArray)); } if(value.Length > destinationArray.Length) { @@ -71,11 +68,9 @@ namespace DiscImageChef public static string ByteArrayToHex(byte[] array, bool upper) { StringBuilder sb = new StringBuilder(); - for(long i = 0; i < array.LongLength; i++) - sb.AppendFormat("{0:x2}", array[i]); + for(long i = 0; i < array.LongLength; i++) sb.AppendFormat("{0:x2}", array[i]); return upper ? sb.ToString().ToUpper() : sb.ToString(); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/ArrayIsEmpty.cs b/DiscImageChef.Helpers/ArrayIsEmpty.cs index 41df2074..b83f8b10 100644 --- a/DiscImageChef.Helpers/ArrayIsEmpty.cs +++ b/DiscImageChef.Helpers/ArrayIsEmpty.cs @@ -36,27 +36,20 @@ namespace DiscImageChef { public static bool ArrayIsNullOrWhiteSpace(byte[] array) { - if(array == null) - return true; + if(array == null) return true; - foreach(byte b in array) - if(b != 0x00 && b != 0x20) - return false; + foreach(byte b in array) if(b != 0x00 && b != 0x20) return false; return true; } public static bool ArrayIsNullOrEmpty(byte[] array) { - if(array == null) - return true; + if(array == null) return true; - foreach(byte b in array) - if(b != 0x00) - return false; + foreach(byte b in array) if(b != 0x00) return false; return true; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/BigEndianBitConverter.cs b/DiscImageChef.Helpers/BigEndianBitConverter.cs index 91a995da..46d0706f 100644 --- a/DiscImageChef.Helpers/BigEndianBitConverter.cs +++ b/DiscImageChef.Helpers/BigEndianBitConverter.cs @@ -48,6 +48,7 @@ namespace DiscImageChef /// architecture. ///</summary> public static bool IsLittleEndian { get; set; } + // should default to false, which is what we want for Empire /// <summary> /// Converts the specified double-precision floating point number to a 64-bit @@ -362,7 +363,9 @@ namespace DiscImageChef ///</summary> public static short ToInt16(byte[] value, int startIndex) { - return !IsLittleEndian ? BitConverter.ToInt16(value, startIndex) : BitConverter.ToInt16(value.Reverse().ToArray(), value.Length - sizeof(short) - startIndex); + return !IsLittleEndian + ? BitConverter.ToInt16(value, startIndex) + : BitConverter.ToInt16(value.Reverse().ToArray(), value.Length - sizeof(short) - startIndex); } /// @@ -393,7 +396,9 @@ namespace DiscImageChef ///</summary> public static int ToInt32(byte[] value, int startIndex) { - return !IsLittleEndian ? BitConverter.ToInt32(value, startIndex) : BitConverter.ToInt32(value.Reverse().ToArray(), value.Length - sizeof(int) - startIndex); + return !IsLittleEndian + ? BitConverter.ToInt32(value, startIndex) + : BitConverter.ToInt32(value.Reverse().ToArray(), value.Length - sizeof(int) - startIndex); } /// @@ -424,7 +429,9 @@ namespace DiscImageChef ///</summary> public static long ToInt64(byte[] value, int startIndex) { - return !IsLittleEndian ? BitConverter.ToInt64(value, startIndex) : BitConverter.ToInt64(value.Reverse().ToArray(), value.Length - sizeof(long) - startIndex); + return !IsLittleEndian + ? BitConverter.ToInt64(value, startIndex) + : BitConverter.ToInt64(value.Reverse().ToArray(), value.Length - sizeof(long) - startIndex); } /// @@ -456,7 +463,9 @@ namespace DiscImageChef ///</summary> public static float ToSingle(byte[] value, int startIndex) { - return !IsLittleEndian ? BitConverter.ToSingle(value, startIndex) : BitConverter.ToSingle(value.Reverse().ToArray(), value.Length - sizeof(float) - startIndex); + return !IsLittleEndian + ? BitConverter.ToSingle(value, startIndex) + : BitConverter.ToSingle(value.Reverse().ToArray(), value.Length - sizeof(float) - startIndex); } /// @@ -507,7 +516,9 @@ namespace DiscImageChef ///</summary> public static string ToString(byte[] value, int startIndex) { - return !IsLittleEndian ? BitConverter.ToString(value, startIndex) : BitConverter.ToString(value.Reverse().ToArray(), startIndex); + return !IsLittleEndian + ? BitConverter.ToString(value, startIndex) + : BitConverter.ToString(value.Reverse().ToArray(), startIndex); } /// @@ -545,7 +556,9 @@ namespace DiscImageChef ///</summary> public static string ToString(byte[] value, int startIndex, int length) { - return !IsLittleEndian ? BitConverter.ToString(value, startIndex, length) : BitConverter.ToString(value.Reverse().ToArray(), startIndex, length); + return !IsLittleEndian + ? BitConverter.ToString(value, startIndex, length) + : BitConverter.ToString(value.Reverse().ToArray(), startIndex, length); } /// @@ -575,7 +588,9 @@ namespace DiscImageChef ///</summary> public static ushort ToUInt16(byte[] value, int startIndex) { - return !IsLittleEndian ? BitConverter.ToUInt16(value, startIndex) : BitConverter.ToUInt16(value.Reverse().ToArray(), value.Length - sizeof(ushort) - startIndex); + return !IsLittleEndian + ? BitConverter.ToUInt16(value, startIndex) + : BitConverter.ToUInt16(value.Reverse().ToArray(), value.Length - sizeof(ushort) - startIndex); } /// @@ -606,7 +621,9 @@ namespace DiscImageChef ///</summary> public static uint ToUInt32(byte[] value, int startIndex) { - return !IsLittleEndian ? BitConverter.ToUInt32(value, startIndex) : BitConverter.ToUInt32(value.Reverse().ToArray(), value.Length - sizeof(uint) - startIndex); + return !IsLittleEndian + ? BitConverter.ToUInt32(value, startIndex) + : BitConverter.ToUInt32(value.Reverse().ToArray(), value.Length - sizeof(uint) - startIndex); } /// @@ -637,18 +654,17 @@ namespace DiscImageChef ///</summary> public static ulong ToUInt64(byte[] value, int startIndex) { - return !IsLittleEndian ? BitConverter.ToUInt64(value, startIndex) : BitConverter.ToUInt64(value.Reverse().ToArray(), value.Length - sizeof(ulong) - startIndex); + return !IsLittleEndian + ? BitConverter.ToUInt64(value, startIndex) + : BitConverter.ToUInt64(value.Reverse().ToArray(), value.Length - sizeof(ulong) - startIndex); } public static Guid ToGuid(byte[] value, int startIndex) { - return new Guid(ToUInt32(value, 0 + startIndex), - ToUInt16(value, 4 + startIndex), - ToUInt16(value, 6 + startIndex), - value[8 + startIndex + 0], value[8 + startIndex + 1], - value[8 + startIndex + 2], value[8 + startIndex + 3], - value[8 + startIndex + 5], value[8 + startIndex + 5], - value[8 + startIndex + 6], value[8 + startIndex + 7]); + return new Guid(ToUInt32(value, 0 + startIndex), ToUInt16(value, 4 + startIndex), + ToUInt16(value, 6 + startIndex), value[8 + startIndex + 0], value[8 + startIndex + 1], + value[8 + startIndex + 2], value[8 + startIndex + 3], value[8 + startIndex + 5], + value[8 + startIndex + 5], value[8 + startIndex + 6], value[8 + startIndex + 7]); } } } \ No newline at end of file diff --git a/DiscImageChef.Helpers/BigEndianMarshal.cs b/DiscImageChef.Helpers/BigEndianMarshal.cs index 548a35bd..84fadb93 100644 --- a/DiscImageChef.Helpers/BigEndianMarshal.cs +++ b/DiscImageChef.Helpers/BigEndianMarshal.cs @@ -124,8 +124,8 @@ namespace DiscImageChef fi.SetValueDirect(__makeref(str), BitConverter.ToDouble(dbl_r, 0)); } } + return str; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/CHS.cs b/DiscImageChef.Helpers/CHS.cs index 34e4cebc..86966914 100644 --- a/DiscImageChef.Helpers/CHS.cs +++ b/DiscImageChef.Helpers/CHS.cs @@ -36,7 +36,9 @@ namespace DiscImageChef.Helpers { public static uint ToLBA(uint cyl, uint head, uint sector, uint maxHead, uint maxSector) { - return maxHead == 0 || maxSector == 0 ? (cyl * 16 + head) * 63 + sector - 1 : (cyl * maxHead + head) * maxSector + sector - 1; + return maxHead == 0 || maxSector == 0 + ? (cyl * 16 + head) * 63 + sector - 1 + : (cyl * maxHead + head) * maxSector + sector - 1; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/CompareBytes.cs b/DiscImageChef.Helpers/CompareBytes.cs index 9712b01e..776fffa3 100644 --- a/DiscImageChef.Helpers/CompareBytes.cs +++ b/DiscImageChef.Helpers/CompareBytes.cs @@ -34,7 +34,8 @@ namespace DiscImageChef { public static partial class ArrayHelpers { - public static void CompareBytes(out bool different, out bool sameSize, byte[] compareArray1, byte[] compareArray2) + public static void CompareBytes(out bool different, out bool sameSize, byte[] compareArray1, + byte[] compareArray2) { different = false; sameSize = true; @@ -50,8 +51,7 @@ namespace DiscImageChef sameSize = false; leastBytes = compareArray2.LongLength; } - else - leastBytes = compareArray1.LongLength; + else leastBytes = compareArray1.LongLength; for(long i = 0; i < leastBytes; i++) { @@ -63,4 +63,4 @@ namespace DiscImageChef } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/CountBits.cs b/DiscImageChef.Helpers/CountBits.cs index 0a377d6f..29a153fb 100644 --- a/DiscImageChef.Helpers/CountBits.cs +++ b/DiscImageChef.Helpers/CountBits.cs @@ -41,4 +41,4 @@ namespace DiscImageChef.Helpers return (int)((((number + (number >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/DateHandlers.cs b/DiscImageChef.Helpers/DateHandlers.cs index 5399d6ca..87160d81 100644 --- a/DiscImageChef.Helpers/DateHandlers.cs +++ b/DiscImageChef.Helpers/DateHandlers.cs @@ -99,55 +99,58 @@ namespace DiscImageChef fourcharvalue[1] = VDDateTime[1]; fourcharvalue[2] = VDDateTime[2]; fourcharvalue[3] = VDDateTime[3]; - DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "year = \"{0}\"", StringHandlers.CToString(fourcharvalue, Encoding.ASCII)); - if(!int.TryParse(StringHandlers.CToString(fourcharvalue, Encoding.ASCII), out year)) - year = 0; + DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "year = \"{0}\"", + StringHandlers.CToString(fourcharvalue, Encoding.ASCII)); + if(!int.TryParse(StringHandlers.CToString(fourcharvalue, Encoding.ASCII), out year)) year = 0; // year = Convert.ToInt32(StringHandlers.CToString(fourcharvalue, Encoding.ASCII)); twocharvalue[0] = VDDateTime[4]; twocharvalue[1] = VDDateTime[5]; - DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "month = \"{0}\"", StringHandlers.CToString(twocharvalue, Encoding.ASCII)); - if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out month)) - month = 0; + DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "month = \"{0}\"", + StringHandlers.CToString(twocharvalue, Encoding.ASCII)); + if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out month)) month = 0; // month = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII)); twocharvalue[0] = VDDateTime[6]; twocharvalue[1] = VDDateTime[7]; - DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "day = \"{0}\"", StringHandlers.CToString(twocharvalue, Encoding.ASCII)); - if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out day)) - day = 0; + DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "day = \"{0}\"", + StringHandlers.CToString(twocharvalue, Encoding.ASCII)); + if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out day)) day = 0; // day = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII)); twocharvalue[0] = VDDateTime[8]; twocharvalue[1] = VDDateTime[9]; - DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hour = \"{0}\"", StringHandlers.CToString(twocharvalue, Encoding.ASCII)); - if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out hour)) - hour = 0; + DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hour = \"{0}\"", + StringHandlers.CToString(twocharvalue, Encoding.ASCII)); + if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out hour)) hour = 0; // hour = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII)); twocharvalue[0] = VDDateTime[10]; twocharvalue[1] = VDDateTime[11]; - DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "minute = \"{0}\"", StringHandlers.CToString(twocharvalue, Encoding.ASCII)); - if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out minute)) - minute = 0; + DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "minute = \"{0}\"", + StringHandlers.CToString(twocharvalue, Encoding.ASCII)); + if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out minute)) minute = 0; // minute = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII)); twocharvalue[0] = VDDateTime[12]; twocharvalue[1] = VDDateTime[13]; - DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "second = \"{0}\"", StringHandlers.CToString(twocharvalue, Encoding.ASCII)); - if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out second)) - second = 0; + DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "second = \"{0}\"", + StringHandlers.CToString(twocharvalue, Encoding.ASCII)); + if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out second)) second = 0; // second = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII)); twocharvalue[0] = VDDateTime[14]; twocharvalue[1] = VDDateTime[15]; - DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hundredths = \"{0}\"", StringHandlers.CToString(twocharvalue, Encoding.ASCII)); - if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out hundredths)) - hundredths = 0; + DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hundredths = \"{0}\"", + StringHandlers.CToString(twocharvalue, Encoding.ASCII)); + if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out hundredths)) hundredths = 0; // hundredths = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII)); - DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "decodedDT = new DateTime({0}, {1}, {2}, {3}, {4}, {5}, {6}, DateTimeKind.Unspecified);", year, month, day, hour, minute, second, hundredths * 10); - DateTime decodedDT = new DateTime(year, month, day, hour, minute, second, hundredths * 10, DateTimeKind.Unspecified); + DicConsole.DebugWriteLine("ISO9600ToDateTime handler", + "decodedDT = new DateTime({0}, {1}, {2}, {3}, {4}, {5}, {6}, DateTimeKind.Unspecified);", + year, month, day, hour, minute, second, hundredths * 10); + DateTime decodedDT = new DateTime(year, month, day, hour, minute, second, hundredths * 10, + DateTimeKind.Unspecified); return decodedDT; } @@ -172,7 +175,9 @@ namespace DiscImageChef int day = (dateRecord & 0x01F0) >> 4; int month = (dateRecord & 0x000F); - DicConsole.DebugWriteLine("UCSDPascalToDateTime handler", "dateRecord = 0x{0:X4}, year = {1}, month = {2}, day = {3}", dateRecord, year, month, day); + DicConsole.DebugWriteLine("UCSDPascalToDateTime handler", + "dateRecord = 0x{0:X4}, year = {1}, month = {2}, day = {3}", dateRecord, year, + month, day); return new DateTime(year, month, day); } @@ -185,18 +190,15 @@ namespace DiscImageChef int minute = (time & 0x7E0) >> 5; int second = (time & 0x1F) * 2; - DicConsole.DebugWriteLine("DOSToDateTime handler", "date = 0x{0:X4}, year = {1}, month = {2}, day = {3}", date, year, month, day); - DicConsole.DebugWriteLine("DOSToDateTime handler", "time = 0x{0:X4}, hour = {1}, minute = {2}, second = {3}", time, hour, minute, second); + DicConsole.DebugWriteLine("DOSToDateTime handler", "date = 0x{0:X4}, year = {1}, month = {2}, day = {3}", + date, year, month, day); + DicConsole.DebugWriteLine("DOSToDateTime handler", + "time = 0x{0:X4}, hour = {1}, minute = {2}, second = {3}", time, hour, minute, + second); DateTime dosdate; - try - { - dosdate = new DateTime(year, month, day, hour, minute, second); - } - catch(ArgumentOutOfRangeException) - { - dosdate = new DateTime(1980, 1, 1, 0, 0, 0); - } + try { dosdate = new DateTime(year, month, day, hour, minute, second); } + catch(ArgumentOutOfRangeException) { dosdate = new DateTime(1980, 1, 1, 0, 0, 0); } return dosdate; } @@ -219,7 +221,9 @@ namespace DiscImageChef return AppleDoubleEpoch.AddSeconds(AppleDoubleTimeStamp); } - public static DateTime ECMAToDateTime(ushort typeAndTimeZone, short year, byte month, byte day, byte hour, byte minute, byte second, byte centiseconds, byte hundredsOfMicroseconds, byte microseconds) + public static DateTime ECMAToDateTime(ushort typeAndTimeZone, short year, byte month, byte day, byte hour, + byte minute, byte second, byte centiseconds, byte hundredsOfMicroseconds, + byte microseconds) { byte specification = (byte)((typeAndTimeZone & 0xF000) >> 12); long ticks = (long)centiseconds * 100000 + (long)hundredsOfMicroseconds * 1000 + (long)microseconds * 10; @@ -229,20 +233,16 @@ namespace DiscImageChef ushort preOffset = (ushort)(typeAndTimeZone & 0xFFF); short offset; - if((preOffset & 0x800) == 0x800) - { - offset = (short)(preOffset | 0xF000); - } - else - offset = (short)(preOffset & 0x7FF); + if((preOffset & 0x800) == 0x800) { offset = (short)(preOffset | 0xF000); } + else offset = (short)(preOffset & 0x7FF); if(offset == -2047) return new DateTime(year, month, day, hour, minute, second, DateTimeKind.Unspecified).AddTicks(ticks); - if(offset < -1440 || offset > 1440) - offset = 0; + if(offset < -1440 || offset > 1440) offset = 0; - return new DateTimeOffset(year, month, day, hour, minute, second, new TimeSpan(0, offset, 0)).AddTicks(ticks).DateTime; + return new DateTimeOffset(year, month, day, hour, minute, second, new TimeSpan(0, offset, 0)) + .AddTicks(ticks).DateTime; } public static DateTime UNIXHrTimeToDateTime(ulong HRTimeStamp) @@ -252,27 +252,24 @@ namespace DiscImageChef public static DateTime OS9ToDateTime(byte[] date) { - if(date == null || (date.Length != 3 && date.Length != 5)) - return DateTime.MinValue; + if(date == null || (date.Length != 3 && date.Length != 5)) return DateTime.MinValue; DateTime os9date; try { - os9date = date.Length == 5 ? new DateTime(1900 + date[0], date[1], date[2], date[3], date[4], 0) : new DateTime(1900 + date[0], date[1], date[2], 0, 0, 0); - } - catch(ArgumentOutOfRangeException) - { - os9date = new DateTime(1900, 0, 0, 0, 0, 0); + os9date = date.Length == 5 + ? new DateTime(1900 + date[0], date[1], date[2], date[3], date[4], 0) + : new DateTime(1900 + date[0], date[1], date[2], 0, 0, 0); } + catch(ArgumentOutOfRangeException) { os9date = new DateTime(1900, 0, 0, 0, 0, 0); } return os9date; } public static DateTime LifToDateTime(byte[] date) { - if(date == null || date.Length != 6) - return new DateTime(1970, 1, 1, 0, 0, 0); + if(date == null || date.Length != 6) return new DateTime(1970, 1, 1, 0, 0, 0); return LifToDateTime(date[0], date[1], date[2], date[3], date[4], date[5]); } @@ -288,18 +285,12 @@ namespace DiscImageChef int ihour = (hour >> 4) * 10 + (hour & 0xF); int isecond = (second >> 4) * 10 + (second & 0xF); - if(iyear >= 70) - iyear += 1900; - else - iyear += 2000; + if(iyear >= 70) iyear += 1900; + else iyear += 2000; return new DateTime(iyear, imonth, iday, ihour, iminute, isecond); } - catch(ArgumentOutOfRangeException) - { - return new DateTime(1970, 1, 1, 0, 0, 0); - } + catch(ArgumentOutOfRangeException) { return new DateTime(1970, 1, 1, 0, 0, 0); } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/EndianAwareBinaryReader.cs b/DiscImageChef.Helpers/EndianAwareBinaryReader.cs index 194ad7f2..b0d6366f 100644 --- a/DiscImageChef.Helpers/EndianAwareBinaryReader.cs +++ b/DiscImageChef.Helpers/EndianAwareBinaryReader.cs @@ -41,86 +41,76 @@ namespace DiscImageChef { readonly byte[] buffer = new byte[8]; - public EndianAwareBinaryReader(Stream input, Encoding encoding, bool isLittleEndian) - : base(input, encoding) + public EndianAwareBinaryReader(Stream input, Encoding encoding, bool isLittleEndian) : base(input, encoding) { IsLittleEndian = isLittleEndian; } - public EndianAwareBinaryReader(Stream input, bool isLittleEndian) - : this(input, Encoding.UTF8, isLittleEndian) - { - } + public EndianAwareBinaryReader(Stream input, bool isLittleEndian) : + this(input, Encoding.UTF8, isLittleEndian) { } - public bool IsLittleEndian - { - get; - set; - } + public bool IsLittleEndian { get; set; } public override double ReadDouble() { - if(IsLittleEndian) - return base.ReadDouble(); + if(IsLittleEndian) return base.ReadDouble(); + FillMyBuffer(8); return BitConverter.ToDouble(buffer.Take(8).Reverse().ToArray(), 0); } public override short ReadInt16() { - if(IsLittleEndian) - return base.ReadInt16(); + if(IsLittleEndian) return base.ReadInt16(); + FillMyBuffer(2); return BitConverter.ToInt16(buffer.Take(2).Reverse().ToArray(), 0); - } public override int ReadInt32() { - if(IsLittleEndian) - return base.ReadInt32(); + if(IsLittleEndian) return base.ReadInt32(); + FillMyBuffer(4); return BitConverter.ToInt32(buffer.Take(4).Reverse().ToArray(), 0); - } public override long ReadInt64() { - if(IsLittleEndian) - return base.ReadInt64(); + if(IsLittleEndian) return base.ReadInt64(); + FillMyBuffer(8); return BitConverter.ToInt64(buffer.Take(8).Reverse().ToArray(), 0); - } public override float ReadSingle() { - if(IsLittleEndian) - return base.ReadSingle(); + if(IsLittleEndian) return base.ReadSingle(); + FillMyBuffer(4); return BitConverter.ToSingle(buffer.Take(4).Reverse().ToArray(), 0); } public override ushort ReadUInt16() { - if(IsLittleEndian) - return base.ReadUInt16(); + if(IsLittleEndian) return base.ReadUInt16(); + FillMyBuffer(2); return BitConverter.ToUInt16(buffer.Take(2).Reverse().ToArray(), 0); } public override uint ReadUInt32() { - if(IsLittleEndian) - return base.ReadUInt32(); + if(IsLittleEndian) return base.ReadUInt32(); + FillMyBuffer(4); return BitConverter.ToUInt32(buffer.Take(4).Reverse().ToArray(), 0); } public override ulong ReadUInt64() { - if(IsLittleEndian) - return base.ReadUInt64(); + if(IsLittleEndian) return base.ReadUInt64(); + FillMyBuffer(8); return BitConverter.ToUInt64(buffer.Take(8).Reverse().ToArray(), 0); } @@ -132,10 +122,8 @@ namespace DiscImageChef if(numBytes == 1) { num2 = BaseStream.ReadByte(); - if(num2 == -1) - { - throw new EndOfStreamException("Attempted to read past the end of the stream."); - } + if(num2 == -1) { throw new EndOfStreamException("Attempted to read past the end of the stream."); } + buffer[0] = (byte)num2; } else @@ -143,10 +131,8 @@ namespace DiscImageChef do { num2 = BaseStream.Read(buffer, offset, numBytes - offset); - if(num2 == 0) - { - throw new EndOfStreamException("Attempted to read past the end of the stream."); - } + if(num2 == 0) { throw new EndOfStreamException("Attempted to read past the end of the stream."); } + offset += num2; } while(offset < numBytes); diff --git a/DiscImageChef.Helpers/Extents/ExtentsByte.cs b/DiscImageChef.Helpers/Extents/ExtentsByte.cs index 0d948ac5..59a38066 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsByte.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsByte.cs @@ -50,7 +50,10 @@ namespace Extents backend = list.OrderBy(t => t.Item1).ToList(); } - public int Count { get { return backend.Count; } } + public int Count + { + get { return backend.Count; } + } public void Add(byte item) { @@ -61,8 +64,7 @@ namespace 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) @@ -74,8 +76,7 @@ namespace Extents removeTwo = backend[i - 1]; itemToAdd = new Tuple<byte, byte>(backend[i - 1].Item1, backend[i].Item2); } - else - itemToAdd = new Tuple<byte, byte>(item, backend[i].Item2); + else itemToAdd = new Tuple<byte, byte>(item, backend[i].Item2); break; } @@ -90,8 +91,7 @@ namespace Extents removeTwo = backend[i + 1]; itemToAdd = new Tuple<byte, byte>(backend[i].Item1, backend[i + 1].Item2); } - else - itemToAdd = new Tuple<byte, byte>(backend[i].Item1, item); + else itemToAdd = new Tuple<byte, byte>(backend[i].Item1, item); break; } @@ -103,8 +103,7 @@ namespace Extents backend.Remove(removeTwo); backend.Add(itemToAdd); } - else - backend.Add(new Tuple<byte, byte>(item, item)); + else backend.Add(new Tuple<byte, byte>(item, item)); // Sort backend = backend.OrderBy(t => t.Item1).ToList(); @@ -118,21 +117,17 @@ namespace Extents public void Add(byte start, byte end, bool run) { 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); } public bool Contains(byte item) { - foreach(Tuple<byte, byte> extent in backend) - if(item >= extent.Item1 && item <= extent.Item2) - return true; + foreach(Tuple<byte, byte> extent in backend) if(item >= extent.Item1 && item <= extent.Item2) return true; + return false; } @@ -183,14 +178,11 @@ namespace Extents } // 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(); @@ -214,7 +206,8 @@ namespace Extents return true; } } + return false; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/Extents/ExtentsInt.cs b/DiscImageChef.Helpers/Extents/ExtentsInt.cs index 6e6842f3..bbdab8ab 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsInt.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsInt.cs @@ -50,7 +50,10 @@ namespace Extents backend = list.OrderBy(t => t.Item1).ToList(); } - public int Count { get { return backend.Count; } } + public int Count + { + get { return backend.Count; } + } public void Add(int item) { @@ -61,8 +64,7 @@ namespace 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) @@ -74,8 +76,7 @@ namespace Extents removeTwo = backend[i - 1]; itemToAdd = new Tuple<int, int>(backend[i - 1].Item1, backend[i].Item2); } - else - itemToAdd = new Tuple<int, int>(item, backend[i].Item2); + else itemToAdd = new Tuple<int, int>(item, backend[i].Item2); break; } @@ -90,8 +91,7 @@ namespace Extents removeTwo = backend[i + 1]; itemToAdd = new Tuple<int, int>(backend[i].Item1, backend[i + 1].Item2); } - else - itemToAdd = new Tuple<int, int>(backend[i].Item1, item); + else itemToAdd = new Tuple<int, int>(backend[i].Item1, item); break; } @@ -103,8 +103,7 @@ namespace Extents backend.Remove(removeTwo); backend.Add(itemToAdd); } - else - backend.Add(new Tuple<int, int>(item, item)); + else backend.Add(new Tuple<int, int>(item, item)); // Sort backend = backend.OrderBy(t => t.Item1).ToList(); @@ -118,21 +117,17 @@ namespace Extents public void Add(int start, int end, bool run) { 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); } public bool Contains(int item) { - foreach(Tuple<int, int> extent in backend) - if(item >= extent.Item1 && item <= extent.Item2) - return true; + foreach(Tuple<int, int> extent in backend) if(item >= extent.Item1 && item <= extent.Item2) return true; + return false; } @@ -183,14 +178,11 @@ namespace Extents } // 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(); @@ -214,7 +206,8 @@ namespace Extents return true; } } + return false; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/Extents/ExtentsLong.cs b/DiscImageChef.Helpers/Extents/ExtentsLong.cs index c139ee24..b29e5363 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsLong.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsLong.cs @@ -50,7 +50,10 @@ namespace Extents backend = list.OrderBy(t => t.Item1).ToList(); } - public int Count { get { return backend.Count; } } + public int Count + { + get { return backend.Count; } + } public void Add(long item) { @@ -61,8 +64,7 @@ namespace 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) @@ -74,8 +76,7 @@ namespace Extents removeTwo = backend[i - 1]; itemToAdd = new Tuple<long, long>(backend[i - 1].Item1, backend[i].Item2); } - else - itemToAdd = new Tuple<long, long>(item, backend[i].Item2); + else itemToAdd = new Tuple<long, long>(item, backend[i].Item2); break; } @@ -90,8 +91,7 @@ namespace Extents removeTwo = backend[i + 1]; itemToAdd = new Tuple<long, long>(backend[i].Item1, backend[i + 1].Item2); } - else - itemToAdd = new Tuple<long, long>(backend[i].Item1, item); + else itemToAdd = new Tuple<long, long>(backend[i].Item1, item); break; } @@ -103,8 +103,7 @@ namespace Extents backend.Remove(removeTwo); backend.Add(itemToAdd); } - else - backend.Add(new Tuple<long, long>(item, item)); + else backend.Add(new Tuple<long, long>(item, item)); // Sort backend = backend.OrderBy(t => t.Item1).ToList(); @@ -118,21 +117,17 @@ namespace Extents public void Add(long start, long end, bool run) { 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); } public bool Contains(long item) { - foreach(Tuple<long, long> extent in backend) - if(item >= extent.Item1 && item <= extent.Item2) - return true; + foreach(Tuple<long, long> extent in backend) if(item >= extent.Item1 && item <= extent.Item2) return true; + return false; } @@ -183,14 +178,11 @@ namespace Extents } // 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(); @@ -214,7 +206,8 @@ namespace Extents return true; } } + return false; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/Extents/ExtentsSByte.cs b/DiscImageChef.Helpers/Extents/ExtentsSByte.cs index b67a2c3c..df33ce34 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsSByte.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsSByte.cs @@ -50,7 +50,10 @@ namespace Extents backend = list.OrderBy(t => t.Item1).ToList(); } - public int Count { get { return backend.Count; } } + public int Count + { + get { return backend.Count; } + } public void Add(sbyte item) { @@ -61,8 +64,7 @@ namespace 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) @@ -74,8 +76,7 @@ namespace Extents removeTwo = backend[i - 1]; itemToAdd = new Tuple<sbyte, sbyte>(backend[i - 1].Item1, backend[i].Item2); } - else - itemToAdd = new Tuple<sbyte, sbyte>(item, backend[i].Item2); + else itemToAdd = new Tuple<sbyte, sbyte>(item, backend[i].Item2); break; } @@ -90,8 +91,7 @@ namespace Extents removeTwo = backend[i + 1]; itemToAdd = new Tuple<sbyte, sbyte>(backend[i].Item1, backend[i + 1].Item2); } - else - itemToAdd = new Tuple<sbyte, sbyte>(backend[i].Item1, item); + else itemToAdd = new Tuple<sbyte, sbyte>(backend[i].Item1, item); break; } @@ -103,8 +103,7 @@ namespace Extents backend.Remove(removeTwo); backend.Add(itemToAdd); } - else - backend.Add(new Tuple<sbyte, sbyte>(item, item)); + else backend.Add(new Tuple<sbyte, sbyte>(item, item)); // Sort backend = backend.OrderBy(t => t.Item1).ToList(); @@ -118,21 +117,17 @@ namespace Extents public void Add(sbyte start, sbyte end, bool run) { 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); } public bool Contains(sbyte item) { - foreach(Tuple<sbyte, sbyte> extent in backend) - if(item >= extent.Item1 && item <= extent.Item2) - return true; + foreach(Tuple<sbyte, sbyte> extent in backend) if(item >= extent.Item1 && item <= extent.Item2) return true; + return false; } @@ -183,14 +178,11 @@ namespace Extents } // 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(); @@ -214,7 +206,8 @@ namespace Extents return true; } } + return false; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/Extents/ExtentsShort.cs b/DiscImageChef.Helpers/Extents/ExtentsShort.cs index 62065c87..943e4a55 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsShort.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsShort.cs @@ -50,7 +50,10 @@ namespace Extents backend = list.OrderBy(t => t.Item1).ToList(); } - public int Count { get { return backend.Count; } } + public int Count + { + get { return backend.Count; } + } public void Add(short item) { @@ -61,8 +64,7 @@ namespace 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) @@ -74,8 +76,7 @@ namespace Extents removeTwo = backend[i - 1]; itemToAdd = new Tuple<short, short>(backend[i - 1].Item1, backend[i].Item2); } - else - itemToAdd = new Tuple<short, short>(item, backend[i].Item2); + else itemToAdd = new Tuple<short, short>(item, backend[i].Item2); break; } @@ -90,8 +91,7 @@ namespace Extents removeTwo = backend[i + 1]; itemToAdd = new Tuple<short, short>(backend[i].Item1, backend[i + 1].Item2); } - else - itemToAdd = new Tuple<short, short>(backend[i].Item1, item); + else itemToAdd = new Tuple<short, short>(backend[i].Item1, item); break; } @@ -103,8 +103,7 @@ namespace Extents backend.Remove(removeTwo); backend.Add(itemToAdd); } - else - backend.Add(new Tuple<short, short>(item, item)); + else backend.Add(new Tuple<short, short>(item, item)); // Sort backend = backend.OrderBy(t => t.Item1).ToList(); @@ -118,21 +117,17 @@ namespace Extents public void Add(short start, short end, bool run) { 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); } public bool Contains(short item) { - foreach(Tuple<short, short> extent in backend) - if(item >= extent.Item1 && item <= extent.Item2) - return true; + foreach(Tuple<short, short> extent in backend) if(item >= extent.Item1 && item <= extent.Item2) return true; + return false; } @@ -183,14 +178,11 @@ namespace Extents } // 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(); @@ -214,7 +206,8 @@ namespace Extents return true; } } + return false; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/Extents/ExtentsUInt.cs b/DiscImageChef.Helpers/Extents/ExtentsUInt.cs index 197eadfc..ccda61f8 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsUInt.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsUInt.cs @@ -50,7 +50,10 @@ namespace Extents backend = list.OrderBy(t => t.Item1).ToList(); } - public int Count { get { return backend.Count; } } + public int Count + { + get { return backend.Count; } + } public void Add(uint item) { @@ -61,8 +64,7 @@ namespace 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) @@ -74,8 +76,7 @@ namespace Extents removeTwo = backend[i - 1]; itemToAdd = new Tuple<uint, uint>(backend[i - 1].Item1, backend[i].Item2); } - else - itemToAdd = new Tuple<uint, uint>(item, backend[i].Item2); + else itemToAdd = new Tuple<uint, uint>(item, backend[i].Item2); break; } @@ -90,8 +91,7 @@ namespace Extents removeTwo = backend[i + 1]; itemToAdd = new Tuple<uint, uint>(backend[i].Item1, backend[i + 1].Item2); } - else - itemToAdd = new Tuple<uint, uint>(backend[i].Item1, item); + else itemToAdd = new Tuple<uint, uint>(backend[i].Item1, item); break; } @@ -103,8 +103,7 @@ namespace Extents backend.Remove(removeTwo); backend.Add(itemToAdd); } - else - backend.Add(new Tuple<uint, uint>(item, item)); + else backend.Add(new Tuple<uint, uint>(item, item)); // Sort backend = backend.OrderBy(t => t.Item1).ToList(); @@ -118,21 +117,17 @@ namespace Extents public void Add(uint start, uint end, bool run) { 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); } public bool Contains(uint item) { - foreach(Tuple<uint, uint> extent in backend) - if(item >= extent.Item1 && item <= extent.Item2) - return true; + foreach(Tuple<uint, uint> extent in backend) if(item >= extent.Item1 && item <= extent.Item2) return true; + return false; } @@ -183,14 +178,11 @@ namespace Extents } // 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(); @@ -214,7 +206,8 @@ namespace Extents return true; } } + return false; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/Extents/ExtentsULong.cs b/DiscImageChef.Helpers/Extents/ExtentsULong.cs index f8aa0685..76a242ac 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsULong.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsULong.cs @@ -50,7 +50,10 @@ namespace Extents backend = list.OrderBy(t => t.Item1).ToList(); } - public int Count { get { return backend.Count; } } + public int Count + { + get { return backend.Count; } + } public void Add(ulong item) { @@ -61,8 +64,7 @@ namespace 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) @@ -74,8 +76,7 @@ namespace Extents removeTwo = backend[i - 1]; itemToAdd = new Tuple<ulong, ulong>(backend[i - 1].Item1, backend[i].Item2); } - else - itemToAdd = new Tuple<ulong, ulong>(item, backend[i].Item2); + else itemToAdd = new Tuple<ulong, ulong>(item, backend[i].Item2); break; } @@ -90,8 +91,7 @@ namespace Extents removeTwo = backend[i + 1]; itemToAdd = new Tuple<ulong, ulong>(backend[i].Item1, backend[i + 1].Item2); } - else - itemToAdd = new Tuple<ulong, ulong>(backend[i].Item1, item); + else itemToAdd = new Tuple<ulong, ulong>(backend[i].Item1, item); break; } @@ -103,8 +103,7 @@ namespace Extents backend.Remove(removeTwo); backend.Add(itemToAdd); } - else - backend.Add(new Tuple<ulong, ulong>(item, item)); + else backend.Add(new Tuple<ulong, ulong>(item, item)); // Sort backend = backend.OrderBy(t => t.Item1).ToList(); @@ -118,21 +117,17 @@ namespace Extents public void Add(ulong start, ulong end, bool run) { 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); } public bool Contains(ulong item) { - foreach(Tuple<ulong, ulong> extent in backend) - if(item >= extent.Item1 && item <= extent.Item2) - return true; + foreach(Tuple<ulong, ulong> extent in backend) if(item >= extent.Item1 && item <= extent.Item2) return true; + return false; } @@ -183,14 +178,11 @@ namespace Extents } // 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(); @@ -214,7 +206,8 @@ namespace Extents return true; } } + return false; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/Extents/ExtentsUShort.cs b/DiscImageChef.Helpers/Extents/ExtentsUShort.cs index 27b936f6..d8720d39 100644 --- a/DiscImageChef.Helpers/Extents/ExtentsUShort.cs +++ b/DiscImageChef.Helpers/Extents/ExtentsUShort.cs @@ -50,7 +50,10 @@ namespace Extents backend = list.OrderBy(t => t.Item1).ToList(); } - public int Count { get { return backend.Count; } } + public int Count + { + get { return backend.Count; } + } public void Add(ushort item) { @@ -61,8 +64,7 @@ namespace 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) @@ -74,8 +76,7 @@ namespace Extents removeTwo = backend[i - 1]; itemToAdd = new Tuple<ushort, ushort>(backend[i - 1].Item1, backend[i].Item2); } - else - itemToAdd = new Tuple<ushort, ushort>(item, backend[i].Item2); + else itemToAdd = new Tuple<ushort, ushort>(item, backend[i].Item2); break; } @@ -90,8 +91,7 @@ namespace Extents removeTwo = backend[i + 1]; itemToAdd = new Tuple<ushort, ushort>(backend[i].Item1, backend[i + 1].Item2); } - else - itemToAdd = new Tuple<ushort, ushort>(backend[i].Item1, item); + else itemToAdd = new Tuple<ushort, ushort>(backend[i].Item1, item); break; } @@ -103,8 +103,7 @@ namespace Extents backend.Remove(removeTwo); backend.Add(itemToAdd); } - else - backend.Add(new Tuple<ushort, ushort>(item, item)); + else backend.Add(new Tuple<ushort, ushort>(item, item)); // Sort backend = backend.OrderBy(t => t.Item1).ToList(); @@ -118,21 +117,18 @@ namespace Extents public void Add(ushort start, ushort end, bool run) { 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); } public bool Contains(ushort item) { foreach(Tuple<ushort, ushort> extent in backend) - if(item >= extent.Item1 && item <= extent.Item2) - return true; + if(item >= extent.Item1 && item <= extent.Item2) return true; + return false; } @@ -183,14 +179,11 @@ namespace Extents } // 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(); @@ -214,7 +207,8 @@ namespace Extents return true; } } + return false; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/PrintHex.cs b/DiscImageChef.Helpers/PrintHex.cs index 01ffed38..e5e8046a 100644 --- a/DiscImageChef.Helpers/PrintHex.cs +++ b/DiscImageChef.Helpers/PrintHex.cs @@ -75,14 +75,13 @@ namespace DiscImageChef counter = 0; subcounter = 0; } - else - counter++; + else counter++; } + sb.AppendLine(); sb.AppendLine(); return sb.ToString(); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/Properties/AssemblyInfo.cs b/DiscImageChef.Helpers/Properties/AssemblyInfo.cs index c93539f7..c6eb046f 100644 --- a/DiscImageChef.Helpers/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Helpers/Properties/AssemblyInfo.cs @@ -54,5 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Helpers/StringHandlers.cs b/DiscImageChef.Helpers/StringHandlers.cs index d2bebcda..09e42989 100644 --- a/DiscImageChef.Helpers/StringHandlers.cs +++ b/DiscImageChef.Helpers/StringHandlers.cs @@ -55,8 +55,7 @@ namespace DiscImageChef /// <param name="encoding">Encoding.</param> public static string CToString(byte[] CString, Encoding encoding, bool twoBytes = false, int start = 0) { - if(CString == null) - return null; + if(CString == null) return null; int len = 0; @@ -71,11 +70,10 @@ namespace DiscImageChef len++; break; } - // if((i + 1) == CString.Length) -// break; + // if((i + 1) == CString.Length) + // break; } - else - break; + else break; } len++; @@ -105,17 +103,15 @@ namespace DiscImageChef /// <param name="encoding">Encoding.</param> public static string PascalToString(byte[] PascalString, Encoding encoding, int start = 0) { - if(PascalString == null) - return null; + if(PascalString == null) return null; byte length = PascalString[start]; int len = 0; for(int i = start + 1; i < length + 1 && i < PascalString.Length; i++) { - if(PascalString[i] == 0) - break; - + if(PascalString[i] == 0) break; + len++; } @@ -143,15 +139,13 @@ namespace DiscImageChef /// <param name="encoding">Encoding.</param> public static string SpacePaddedToString(byte[] SpacePaddedString, Encoding encoding, int start = 0) { - if(SpacePaddedString == null) - return null; + if(SpacePaddedString == null) return null; int len = start; for(int i = SpacePaddedString.Length; i >= start; i--) { - if(i == start) - return ""; + if(i == start) return ""; if(SpacePaddedString[i - 1] != 0x20) { @@ -174,21 +168,16 @@ namespace DiscImageChef byte compId = dstring[0]; string temp = ""; - if(compId != 8 && compId != 16) - return null; + if(compId != 8 && compId != 16) return null; for(int byteIndex = 1; byteIndex < dstring.Length;) { - if(compId == 16) - unicode = (ushort)(dstring[byteIndex++] << 8); - else - unicode = 0; + if(compId == 16) unicode = (ushort)(dstring[byteIndex++] << 8); + else unicode = 0; - if(byteIndex < dstring.Length) - unicode |= dstring[byteIndex++]; + if(byteIndex < dstring.Length) unicode |= dstring[byteIndex++]; - if(unicode == 0) - break; + if(unicode == 0) break; temp += Encoding.Unicode.GetString(System.BitConverter.GetBytes(unicode)); } @@ -196,5 +185,4 @@ namespace DiscImageChef return temp; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Helpers/Swapping.cs b/DiscImageChef.Helpers/Swapping.cs index da3a9f44..cfca315b 100644 --- a/DiscImageChef.Helpers/Swapping.cs +++ b/DiscImageChef.Helpers/Swapping.cs @@ -138,4 +138,4 @@ namespace DiscImageChef return (x << 16) | ((x >> 16) & 0xFFFF); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Interop/DetectOS.cs b/DiscImageChef.Interop/DetectOS.cs index ba525388..095d1b7a 100644 --- a/DiscImageChef.Interop/DetectOS.cs +++ b/DiscImageChef.Interop/DetectOS.cs @@ -54,28 +54,23 @@ namespace DiscImageChef.Interop /// <summary> /// System name /// </summary> - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string sysname; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string sysname; /// <summary> /// Node name /// </summary> - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string nodename; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string nodename; /// <summary> /// Release level /// </summary> - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string release; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string release; /// <summary> /// Version level /// </summary> - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string version; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string version; /// <summary> /// Hardware level /// </summary> - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string machine; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string machine; } [DllImport("libc", SetLastError = true)] @@ -86,8 +81,7 @@ namespace DiscImageChef.Interop public static PlatformID GetRealPlatformID() { - if((int)Environment.OSVersion.Platform < 4 || - (int)Environment.OSVersion.Platform == 5) + if((int)Environment.OSVersion.Platform < 4 || (int)Environment.OSVersion.Platform == 5) { return (PlatformID)((int)Environment.OSVersion.Platform); } @@ -95,108 +89,89 @@ namespace DiscImageChef.Interop utsname unixname; int error = uname(out unixname); if(error != 0) - throw new Exception(string.Format("Unhandled exception calling uname: {0}", Marshal.GetLastWin32Error())); + throw new Exception(string.Format("Unhandled exception calling uname: {0}", + Marshal.GetLastWin32Error())); switch(unixname.sysname) { // TODO: Differentiate Linux, Android, Tizen case "Linux": - { + { #if __ANDROID__ return PlatformID.Android; #else - return PlatformID.Linux; + return PlatformID.Linux; #endif - } + } case "Darwin": + { + int osx_error; + + IntPtr pLen = Marshal.AllocHGlobal(sizeof(int)); + osx_error = OSX_sysctlbyname("hw.machine", IntPtr.Zero, pLen, IntPtr.Zero, 0); + if(osx_error != 0) { - int osx_error; + Marshal.FreeHGlobal(pLen); - IntPtr pLen = Marshal.AllocHGlobal(sizeof(int)); - osx_error = OSX_sysctlbyname("hw.machine", IntPtr.Zero, pLen, IntPtr.Zero, 0); - if(osx_error != 0) - { - Marshal.FreeHGlobal(pLen); - - throw new Exception(string.Format("Unhandled exception calling uname: {0}", Marshal.GetLastWin32Error())); - } - - int length = Marshal.ReadInt32(pLen); - IntPtr pStr = Marshal.AllocHGlobal(length); - osx_error = OSX_sysctlbyname("hw.machine", pStr, pLen, IntPtr.Zero, 0); - if(osx_error != 0) - { - Marshal.FreeHGlobal(pStr); - Marshal.FreeHGlobal(pLen); - - throw new Exception(string.Format("Unhandled exception calling uname: {0}", Marshal.GetLastWin32Error())); - } - - string machine = Marshal.PtrToStringAnsi(pStr); + throw new Exception(string.Format("Unhandled exception calling uname: {0}", + Marshal.GetLastWin32Error())); + } + int length = Marshal.ReadInt32(pLen); + IntPtr pStr = Marshal.AllocHGlobal(length); + osx_error = OSX_sysctlbyname("hw.machine", pStr, pLen, IntPtr.Zero, 0); + if(osx_error != 0) + { Marshal.FreeHGlobal(pStr); Marshal.FreeHGlobal(pLen); - if(machine.StartsWith("iPad", StringComparison.Ordinal) || - machine.StartsWith("iPod", StringComparison.Ordinal) || - machine.StartsWith("iPhone", StringComparison.Ordinal)) - return PlatformID.iOS; - - return PlatformID.MacOSX; + throw new Exception(string.Format("Unhandled exception calling uname: {0}", + Marshal.GetLastWin32Error())); } - case "GNU": - return PlatformID.Hurd; + + string machine = Marshal.PtrToStringAnsi(pStr); + + Marshal.FreeHGlobal(pStr); + Marshal.FreeHGlobal(pLen); + + if(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 "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 "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 "UWIN-W7": return PlatformID.Win32NT; default: - { - 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; + { + 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; - return PlatformID.Unknown; - } + return PlatformID.Unknown; + } } } @@ -225,21 +200,24 @@ namespace DiscImageChef.Interop case PlatformID.MacOSX: if(Environment.OSVersion.Version.Major == 1) { - if(Environment.OSVersion.Version.Minor == 3) - return "10.0"; - if(Environment.OSVersion.Version.Minor == 4) - return "10.1"; + if(Environment.OSVersion.Version.Minor == 3) return "10.0"; + if(Environment.OSVersion.Version.Minor == 4) return "10.1"; + goto default; } - return string.Format("10.{0}.{1}", Environment.OSVersion.Version.Major - 4, Environment.OSVersion.Version.Minor); + + return string.Format("10.{0}.{1}", Environment.OSVersion.Version.Major - 4, + Environment.OSVersion.Version.Minor); case PlatformID.Win32NT: // 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), "KERNEL32.DLL")).ProductVersion; - return environ; - default: + return FileVersionInfo + .GetVersionInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), + "KERNEL32.DLL")).ProductVersion; + return environ; + default: return environ; } } @@ -247,123 +225,76 @@ namespace DiscImageChef.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.Linux: - return "Linux"; + 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: return "Linux"; case PlatformID.MacOSX: if(!string.IsNullOrEmpty(version)) { - string[] pieces = version.Split(new [] { '.' }); + string[] pieces = version.Split(new[] {'.'}); if(pieces.Length >= 2 && int.TryParse(pieces[1], out int minor)) { - if(minor >= 12) - return "macOS"; - if(minor >= 8) - return "OS X"; + if(minor >= 12) return "macOS"; + if(minor >= 8) return "OS X"; + return "Mac OS X"; } } + 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"; + 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"; + 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.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"; + 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(); + 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(); } } } diff --git a/DiscImageChef.Interop/Properties/AssemblyInfo.cs b/DiscImageChef.Interop/Properties/AssemblyInfo.cs index 4cbcce9d..c2683b24 100644 --- a/DiscImageChef.Interop/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Interop/Properties/AssemblyInfo.cs @@ -60,5 +60,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Metadata/DeviceReport.cs b/DiscImageChef.Metadata/DeviceReport.cs index 4b314987..b73f0a3d 100644 --- a/DiscImageChef.Metadata/DeviceReport.cs +++ b/DiscImageChef.Metadata/DeviceReport.cs @@ -76,7 +76,6 @@ namespace DiscImageChef.Metadata public class ataType { - public string AdditionalPID { get; set; } public Identify.TransferMode APIOSupported { get; set; } public ushort ATAPIByteCount { get; set; } @@ -1045,5 +1044,4 @@ namespace DiscImageChef.Metadata public byte[] SCR { get; set; } public byte[] ExtendedCSD { get; set; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Metadata/Dimensions.cs b/DiscImageChef.Metadata/Dimensions.cs index 7afe4595..6daca6e1 100644 --- a/DiscImageChef.Metadata/Dimensions.cs +++ b/DiscImageChef.Metadata/Dimensions.cs @@ -909,10 +909,8 @@ namespace DiscImageChef.Metadata return dmns; #endregion Apple Hard Disks - default: - return null; + default: return null; } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Metadata/ExtentsConverter.cs b/DiscImageChef.Metadata/ExtentsConverter.cs index d2152ae2..e8e3e71a 100644 --- a/DiscImageChef.Metadata/ExtentsConverter.cs +++ b/DiscImageChef.Metadata/ExtentsConverter.cs @@ -41,29 +41,26 @@ namespace DiscImageChef.Metadata { public static ExtentType[] ToMetadata(ExtentsULong extents) { - if(extents == null) - return null; - + if(extents == null) return null; + Tuple<ulong, ulong>[] 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<Tuple<ulong, ulong>> tuples = new List<Tuple<ulong, ulong>>(); - foreach(ExtentType extent in extents) - tuples.Add(new Tuple<ulong, ulong>(extent.Start, extent.End)); + foreach(ExtentType extent in extents) tuples.Add(new Tuple<ulong, ulong>(extent.Start, extent.End)); return new ExtentsULong(tuples); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Metadata/MediaType.cs b/DiscImageChef.Metadata/MediaType.cs index 0946ff59..372468c2 100644 --- a/DiscImageChef.Metadata/MediaType.cs +++ b/DiscImageChef.Metadata/MediaType.cs @@ -1826,5 +1826,4 @@ namespace DiscImageChef.Metadata } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Metadata/Properties/AssemblyInfo.cs b/DiscImageChef.Metadata/Properties/AssemblyInfo.cs index 47216224..8c8e009b 100644 --- a/DiscImageChef.Metadata/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Metadata/Properties/AssemblyInfo.cs @@ -54,5 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Metadata/Resume.cs b/DiscImageChef.Metadata/Resume.cs index cc14bd47..e5cc8792 100644 --- a/DiscImageChef.Metadata/Resume.cs +++ b/DiscImageChef.Metadata/Resume.cs @@ -41,17 +41,13 @@ namespace DiscImageChef.Metadata [XmlRoot("DicResume", Namespace = "", IsNullable = false)] public class Resume { - [XmlElement(DataType = "dateTime")] - public DateTime CreationDate; - [XmlElement(DataType = "dateTime")] - public DateTime LastWriteDate; + [XmlElement(DataType = "dateTime")] public DateTime CreationDate; + [XmlElement(DataType = "dateTime")] public DateTime LastWriteDate; public bool Removable; public ulong LastBlock; public ulong NextBlock; - [XmlArrayItem("DumpTry")] - public List<DumpHardwareType> Tries; - [XmlArrayItem("Block")] - public List<ulong> BadBlocks; + [XmlArrayItem("DumpTry")] public List<DumpHardwareType> Tries; + [XmlArrayItem("Block")] public List<ulong> BadBlocks; } -} +} \ No newline at end of file diff --git a/DiscImageChef.Metadata/Statistics.cs b/DiscImageChef.Metadata/Statistics.cs index c0de1ffe..0c734a6a 100644 --- a/DiscImageChef.Metadata/Statistics.cs +++ b/DiscImageChef.Metadata/Statistics.cs @@ -121,16 +121,13 @@ namespace DiscImageChef.Metadata public class ChecksumStats { - [XmlAttribute] - public string algorithm; - [XmlText] - public double Value; + [XmlAttribute] public string algorithm; + [XmlText] public double Value; } public class BenchmarkStats { - [XmlElement("Checksum")] - public List<ChecksumStats> Checksum; + [XmlElement("Checksum")] public List<ChecksumStats> Checksum; public double Entropy; public double All; public double Sequential; @@ -140,12 +137,9 @@ namespace DiscImageChef.Metadata public class MediaStats { - [XmlAttribute] - public bool real; - [XmlAttribute] - public string type; - [XmlText] - public long Value; + [XmlAttribute] public bool real; + [XmlAttribute] public string type; + [XmlText] public long Value; } public class DeviceStats @@ -155,8 +149,7 @@ namespace DiscImageChef.Metadata public string Revision { get; set; } public string Bus { get; set; } - [XmlIgnore] - public bool ManufacturerSpecified; + [XmlIgnore] public bool ManufacturerSpecified; } public class NameValueStats @@ -176,4 +169,4 @@ namespace DiscImageChef.Metadata [XmlText] public long Value { get; set; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Partitions/Acorn.cs b/DiscImageChef.Partitions/Acorn.cs index e2e02256..447a5fdb 100644 --- a/DiscImageChef.Partitions/Acorn.cs +++ b/DiscImageChef.Partitions/Acorn.cs @@ -63,18 +63,14 @@ namespace DiscImageChef.PartPlugins ulong sbSector; // RISC OS always checks for the partition on 0. Afaik no emulator chains it. - if(sectorOffset != 0) - return false; + if(sectorOffset != 0) return false; - if(imagePlugin.GetSectorSize() > ADFS_SB_POS) - sbSector = 0; - else - sbSector = ADFS_SB_POS / imagePlugin.GetSectorSize(); + if(imagePlugin.GetSectorSize() > ADFS_SB_POS) sbSector = 0; + else sbSector = ADFS_SB_POS / imagePlugin.GetSectorSize(); byte[] sector = imagePlugin.ReadSector(sbSector); - if(sector.Length < 512) - return false; + if(sector.Length < 512) return false; AcornBootBlock bootBlock = new AcornBootBlock(); IntPtr bbPtr = Marshal.AllocHGlobal(512); @@ -83,15 +79,13 @@ namespace DiscImageChef.PartPlugins Marshal.FreeHGlobal(bbPtr); int checksum = 0; - for(int i = 0; i < 0x1FF; i++) - checksum = ((checksum & 0xFF) + (checksum >> 8) + sector[i]); + for(int i = 0; i < 0x1FF; i++) checksum = ((checksum & 0xFF) + (checksum >> 8) + sector[i]); int heads = bootBlock.discRecord.heads + ((bootBlock.discRecord.lowsector >> 6) & 1); int secCyl = bootBlock.discRecord.spt * heads; int mapSector = bootBlock.startCylinder * secCyl; - if((ulong)mapSector >= imagePlugin.GetSectors()) - return false; + if((ulong)mapSector >= imagePlugin.GetSectors()) return false; byte[] map = imagePlugin.ReadSector((ulong)mapSector); @@ -102,7 +96,9 @@ namespace DiscImageChef.PartPlugins Partition part = new Partition { Size = (ulong)bootBlock.discRecord.disc_size_high * 0x100000000 + bootBlock.discRecord.disc_size, - Length = ((ulong)bootBlock.discRecord.disc_size_high * 0x100000000 + bootBlock.discRecord.disc_size) / imagePlugin.ImageInfo.sectorSize, + Length = + ((ulong)bootBlock.discRecord.disc_size_high * 0x100000000 + bootBlock.discRecord.disc_size) / + imagePlugin.ImageInfo.sectorSize, Type = "ADFS", Name = StringHandlers.CToString(bootBlock.discRecord.disc_name, Encoding.GetEncoding("iso-8859-1")) }; @@ -191,23 +187,20 @@ namespace DiscImageChef.PartPlugins public uint root; public uint disc_size; public ushort disc_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] disc_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] disc_name; public uint disc_type; public uint disc_size_high; public byte flags; public byte nzones_high; public uint format_version; public uint root_size; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] reserved; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AcornBootBlock { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x1C0)] - public byte[] spare; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x1C0)] public byte[] spare; public DiscRecord discRecord; public byte flags; public ushort startCylinder; @@ -217,10 +210,8 @@ namespace DiscImageChef.PartPlugins [StructLayout(LayoutKind.Sequential, Pack = 1)] struct LinuxTable { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 42)] - public LinuxEntry[] entries; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] padding; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 42)] public LinuxEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] padding; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -236,8 +227,7 @@ namespace DiscImageChef.PartPlugins { public uint magic; public uint date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public RiscIxEntry[] partitions; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public RiscIxEntry[] partitions; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -246,8 +236,7 @@ namespace DiscImageChef.PartPlugins public uint start; public uint length; public uint one; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] name; } } } \ No newline at end of file diff --git a/DiscImageChef.Partitions/AppleMap.cs b/DiscImageChef.Partitions/AppleMap.cs index 4b4383fa..87b31b54 100644 --- a/DiscImageChef.Partitions/AppleMap.cs +++ b/DiscImageChef.Partitions/AppleMap.cs @@ -57,19 +57,17 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("36405F8D-4F1A-07F5-209C-223D735D6D22"); } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions, ulong sectorOffset) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, + out List<CommonTypes.Partition> partitions, ulong sectorOffset) { uint sector_size; - if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) - sector_size = 2048; - else - sector_size = imagePlugin.GetSectorSize(); + if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) sector_size = 2048; + else sector_size = imagePlugin.GetSectorSize(); partitions = new List<CommonTypes.Partition>(); - if(sectorOffset + 2 >= imagePlugin.GetSectors()) - return false; + if(sectorOffset + 2 >= imagePlugin.GetSectors()) return false; byte[] ddm_sector = imagePlugin.ReadSector(sectorOffset); AppleDriverDescriptorMap ddm; @@ -83,9 +81,8 @@ namespace DiscImageChef.PartPlugins ddm_sector = tmp; max_drivers = 29; } - else if(sector_size < 256) - return false; - + else if(sector_size < 256) return false; + ddm = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDriverDescriptorMap>(ddm_sector); DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbSig = 0x{0:X4}", ddm.sbSig); @@ -108,13 +105,15 @@ namespace DiscImageChef.PartPlugins byte[] tmp = new byte[8]; Array.Copy(ddm_sector, 18 + i * 8, tmp, 0, 8); ddm.sbMap[i] = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDriverEntry>(tmp); - DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbMap[{1}].ddBlock = {0}", ddm.sbMap[i].ddBlock, i); - DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbMap[{1}].ddSize = {0}", ddm.sbMap[i].ddSize, i); - DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbMap[{1}].ddType = {0}", ddm.sbMap[i].ddType, i); + DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbMap[{1}].ddBlock = {0}", + ddm.sbMap[i].ddBlock, i); + DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbMap[{1}].ddSize = {0}", ddm.sbMap[i].ddSize, + i); + DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbMap[{1}].ddType = {0}", ddm.sbMap[i].ddType, + i); + + if(ddm.sbMap[i].ddSize == 0) continue; - if(ddm.sbMap[i].ddSize == 0) - continue; - CommonTypes.Partition part = new CommonTypes.Partition() { Size = (ulong)(ddm.sbMap[i].ddSize * 512), @@ -125,8 +124,7 @@ namespace DiscImageChef.PartPlugins Type = "Apple_Driver" }; - if((ddm.sbMap[i].ddSize * 512) % sector_size > 0) - part.Length++; + if((ddm.sbMap[i].ddSize * 512) % sector_size > 0) part.Length++; partitions.Add(part); @@ -136,24 +134,29 @@ namespace DiscImageChef.PartPlugins } byte[] part_sector = imagePlugin.ReadSector(1 + sectorOffset); - AppleOldDevicePartitionMap old_map = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleOldDevicePartitionMap>(part_sector); + AppleOldDevicePartitionMap old_map = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleOldDevicePartitionMap>(part_sector); // This is the easy one, no sector size mixing if(old_map.pdSig == APM_MAGIC_OLD) { - for(int i = 2; i < part_sector.Length; i+=12) + for(int i = 2; i < part_sector.Length; i += 12) { byte[] tmp = new byte[12]; Array.Copy(part_sector, i, tmp, 0, 12); - AppleMapOldPartitionEntry old_entry = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleMapOldPartitionEntry>(tmp); - DicConsole.DebugWriteLine("AppleMap Plugin", "old_map.sbMap[{1}].pdStart = {0}", old_entry.pdStart, (i - 2) / 12); - DicConsole.DebugWriteLine("AppleMap Plugin", "old_map.sbMap[{1}].pdSize = {0}", old_entry.pdSize, (i - 2) / 12); - DicConsole.DebugWriteLine("AppleMap Plugin", "old_map.sbMap[{1}].pdFSID = 0x{0:X8}", old_entry.pdFSID, (i - 2) / 12); + AppleMapOldPartitionEntry old_entry = + BigEndianMarshal.ByteArrayToStructureBigEndian<AppleMapOldPartitionEntry>(tmp); + DicConsole.DebugWriteLine("AppleMap Plugin", "old_map.sbMap[{1}].pdStart = {0}", old_entry.pdStart, + (i - 2) / 12); + DicConsole.DebugWriteLine("AppleMap Plugin", "old_map.sbMap[{1}].pdSize = {0}", old_entry.pdSize, + (i - 2) / 12); + DicConsole.DebugWriteLine("AppleMap Plugin", "old_map.sbMap[{1}].pdFSID = 0x{0:X8}", + old_entry.pdFSID, (i - 2) / 12); if(old_entry.pdSize == 0 && old_entry.pdFSID == 0) { - if(old_entry.pdStart == 0) - break; + if(old_entry.pdStart == 0) break; + continue; } @@ -167,10 +170,8 @@ namespace DiscImageChef.PartPlugins Scheme = Name }; - if(old_entry.pdFSID == HFS_MAGIC_OLD) - part.Type = "Apple_HFS"; - else - part.Type = string.Format("0x{0:X8}", old_entry.pdFSID); + if(old_entry.pdFSID == HFS_MAGIC_OLD) part.Type = "Apple_HFS"; + else part.Type = string.Format("0x{0:X8}", old_entry.pdFSID); partitions.Add(part); @@ -190,7 +191,7 @@ namespace DiscImageChef.PartPlugins if(sector_size > 512) { byte[] tmp = new byte[512]; - Array.Copy(ddm_sector, 512, tmp, 0, 512); + Array.Copy(ddm_sector, 512, tmp, 0, 512); entry = BigEndianMarshal.ByteArrayToStructureBigEndian<AppleMapPartitionEntry>(tmp); // Check for a partition entry that's 512-byte aligned if(entry.signature == APM_MAGIC) @@ -212,8 +213,7 @@ namespace DiscImageChef.PartPlugins skip_ddm = sector_size; sectors_to_read = entry_count + 2; } - else - return partitions.Count > 0; + else return partitions.Count > 0; } } else @@ -227,8 +227,7 @@ namespace DiscImageChef.PartPlugins skip_ddm = sector_size; sectors_to_read = entry_count + 2; } - else - return partitions.Count > 0; + else return partitions.Count > 0; } byte[] entries = imagePlugin.ReadSectors(sectorOffset, sectors_to_read); @@ -253,19 +252,29 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].entries = {1}", i, entry.entries); DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].start = {1}", i, entry.start); DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].sectors = {1}", i, entry.sectors); - DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].name = \"{1}\"", i, StringHandlers.CToString(entry.name)); - DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].type = \"{1}\"", i, StringHandlers.CToString(entry.type)); - DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].first_data_block = {1}", i, entry.first_data_block); + DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].name = \"{1}\"", i, + StringHandlers.CToString(entry.name)); + DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].type = \"{1}\"", i, + StringHandlers.CToString(entry.type)); + DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].first_data_block = {1}", i, + entry.first_data_block); DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].data_sectors = {1}", i, entry.data_sectors); - DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].flags = {1}", i, (AppleMapFlags)entry.flags); - DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].first_boot_block = {1}", i, entry.first_boot_block); + DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].flags = {1}", i, + (AppleMapFlags)entry.flags); + DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].first_boot_block = {1}", i, + entry.first_boot_block); DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].boot_size = {1}", i, entry.boot_size); - DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].load_address = 0x{1:X8}", i, entry.load_address); - DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].load_address2 = 0x{1:X8}", i, entry.load_address2); - DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].entry_point = 0x{1:X8}", i, entry.entry_point); - DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].entry_point2 = 0x{1:X8}", i, entry.entry_point2); + DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].load_address = 0x{1:X8}", i, + entry.load_address); + DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].load_address2 = 0x{1:X8}", i, + entry.load_address2); + DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].entry_point = 0x{1:X8}", i, + entry.entry_point); + DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].entry_point2 = 0x{1:X8}", i, + entry.entry_point2); DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].checksum = 0x{1:X8}", i, entry.checksum); - DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].processor = \"{1}\"", i, StringHandlers.CToString(entry.processor)); + DicConsole.DebugWriteLine("AppleMap Plugin", "dpme[{0}].processor = \"{1}\"", i, + StringHandlers.CToString(entry.processor)); AppleMapFlags flags = (AppleMapFlags)entry.flags; @@ -287,22 +296,17 @@ namespace DiscImageChef.PartPlugins Scheme = Name }; sb.AppendLine("Partition flags:"); - if(flags.HasFlag(AppleMapFlags.Valid)) - sb.AppendLine("Partition is valid."); - if(flags.HasFlag(AppleMapFlags.Allocated)) - sb.AppendLine("Partition entry is allocated."); - if(flags.HasFlag(AppleMapFlags.InUse)) - sb.AppendLine("Partition is in use."); - if(flags.HasFlag(AppleMapFlags.Bootable)) - sb.AppendLine("Partition is bootable."); - if(flags.HasFlag(AppleMapFlags.Readable)) - sb.AppendLine("Partition is readable."); - if(flags.HasFlag(AppleMapFlags.Writable)) - sb.AppendLine("Partition is writable."); + if(flags.HasFlag(AppleMapFlags.Valid)) sb.AppendLine("Partition is valid."); + if(flags.HasFlag(AppleMapFlags.Allocated)) sb.AppendLine("Partition entry is allocated."); + if(flags.HasFlag(AppleMapFlags.InUse)) sb.AppendLine("Partition is in use."); + if(flags.HasFlag(AppleMapFlags.Bootable)) sb.AppendLine("Partition is bootable."); + if(flags.HasFlag(AppleMapFlags.Readable)) sb.AppendLine("Partition is readable."); + if(flags.HasFlag(AppleMapFlags.Writable)) sb.AppendLine("Partition is writable."); if(flags.HasFlag(AppleMapFlags.Bootable)) { - sb.AppendFormat("First boot sector: {0}", (entry.first_boot_block * entry_size) / sector_size).AppendLine(); + sb.AppendFormat("First boot sector: {0}", + (entry.first_boot_block * entry_size) / sector_size).AppendLine(); sb.AppendFormat("Boot is {0} bytes.", entry.boot_size).AppendLine(); sb.AppendFormat("Boot load address: 0x{0:X8}", entry.load_address).AppendLine(); sb.AppendFormat("Boot entry point: 0x{0:X8}", entry.entry_point).AppendLine(); @@ -314,7 +318,8 @@ namespace DiscImageChef.PartPlugins } _partition.Description = sb.ToString(); - if(_partition.Start < imagePlugin.ImageInfo.sectors && _partition.End < imagePlugin.ImageInfo.sectors) + if(_partition.Start < imagePlugin.ImageInfo.sectors && + _partition.End < imagePlugin.ImageInfo.sectors) { partitions.Add(_partition); sequence++; @@ -322,14 +327,18 @@ namespace DiscImageChef.PartPlugins // Some CD and DVDs end with an Apple_Free that expands beyond the disc size... else if(_partition.Start < imagePlugin.ImageInfo.sectors) { - DicConsole.DebugWriteLine("AppleMap Plugin", "Cutting last partition end ({0}) to media size ({1})", _partition.End, imagePlugin.ImageInfo.sectors - 1); + DicConsole.DebugWriteLine("AppleMap Plugin", + "Cutting last partition end ({0}) to media size ({1})", + _partition.End, imagePlugin.ImageInfo.sectors - 1); _partition.Length = imagePlugin.ImageInfo.sectors - _partition.Start; partitions.Add(_partition); sequence++; } else { - DicConsole.DebugWriteLine("AppleMap Plugin", "Not adding partition becaus start ({0}) is outside media size ({1})", _partition.Start, imagePlugin.ImageInfo.sectors - 1); + DicConsole.DebugWriteLine("AppleMap Plugin", + "Not adding partition becaus start ({0}) is outside media size ({1})", + _partition.Start, imagePlugin.ImageInfo.sectors - 1); } } } @@ -356,8 +365,7 @@ namespace DiscImageChef.PartPlugins /// <summary>Number of entries of the driver descriptor</summary> public ushort sbDrvrCount; /// <summary>Entries of the driver descriptor</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 61)] - public AppleDriverEntry[] sbMap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 61)] public AppleDriverEntry[] sbMap; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -377,8 +385,7 @@ namespace DiscImageChef.PartPlugins /// <summary>Signature <see cref="APM_MAGIC_OLD"/></summary> public ushort pdSig; /// <summary>Entries of the driver descriptor</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 42)] - public AppleMapOldPartitionEntry[] pdMap; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 42)] public AppleMapOldPartitionEntry[] pdMap; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -421,7 +428,6 @@ namespace DiscImageChef.PartPlugins Reserved = 0xBFFFFC00, } - [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct AppleMapPartitionEntry { @@ -436,11 +442,9 @@ namespace DiscImageChef.PartPlugins /// <summary>Number of sectos of the partition</summary> public uint sectors; /// <summary>Partition name, 32 bytes, null-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] name; /// <summary>Partition type. 32 bytes, null-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] type; /// <summary>First sector of the data area</summary> public uint first_data_block; /// <summary>Number of sectors of the data area</summary> @@ -462,11 +466,9 @@ namespace DiscImageChef.PartPlugins /// <summary>Boot code checksum</summary> public uint checksum; /// <summary>Processor type, 16 bytes, null-padded</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] processor; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] processor; /// <summary>Boot arguments</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public uint[] boot_arguments; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public uint[] boot_arguments; } } } \ No newline at end of file diff --git a/DiscImageChef.Partitions/Apricot.cs b/DiscImageChef.Partitions/Apricot.cs index 12831163..6055bdda 100644 --- a/DiscImageChef.Partitions/Apricot.cs +++ b/DiscImageChef.Partitions/Apricot.cs @@ -41,15 +41,20 @@ namespace DiscImageChef.PartPlugins { public class Apricot : PartPlugin { - readonly string[] operatingSystemCodes = { "Invalid", "MS-DOS", "UCSD Pascal", "CP/M", "Concurrent CP/M" }; - readonly string[] bootTypeCodes = { "Non-bootable", "Apricot & XI RAM BIOS", "Generic ROM BIOS", "Apricot & XI ROM BIOS", "Apricot Portable ROM BIOS", "Apricot F1 ROM BIOS" }; - readonly string[] diskTypeCodes = { "MF1DD 70-track", "MF1DD", "MF2DD", "Winchester 5M", "Winchester 10M", "Winchester 20M" }; - readonly string[] printDevices = { "Parallel", "Serial" }; - readonly int[] lineModes = { 256, 200 }; - readonly int[] lineWidths = { 80, 40 }; - readonly int[] baudRates = { 50, 75, 110, 134, 150, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 19200 }; - readonly double[] stopBits = { 1, 1.5, 2 }; - readonly string[] parityTypes = { "None", "Odd", "Even", "Mark", "Space" }; + readonly string[] operatingSystemCodes = {"Invalid", "MS-DOS", "UCSD Pascal", "CP/M", "Concurrent CP/M"}; + readonly string[] bootTypeCodes = + { + "Non-bootable", "Apricot & XI RAM BIOS", "Generic ROM BIOS", "Apricot & XI ROM BIOS", + "Apricot Portable ROM BIOS", "Apricot F1 ROM BIOS" + }; + readonly string[] diskTypeCodes = + {"MF1DD 70-track", "MF1DD", "MF2DD", "Winchester 5M", "Winchester 10M", "Winchester 20M"}; + readonly string[] printDevices = {"Parallel", "Serial"}; + readonly int[] lineModes = {256, 200}; + readonly int[] lineWidths = {80, 40}; + readonly int[] baudRates = {50, 75, 110, 134, 150, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 19200}; + readonly double[] stopBits = {1, 1.5, 2}; + readonly string[] parityTypes = {"None", "Odd", "Even", "Mark", "Space"}; public Apricot() { @@ -62,13 +67,11 @@ namespace DiscImageChef.PartPlugins partitions = new List<Partition>(); // I think Apricot can't chain partitions so. - if(sectorOffset != 0) - return false; + if(sectorOffset != 0) return false; byte[] sector = imagePlugin.ReadSector(0); - if(sector.Length < 512) - return false; + if(sector.Length < 512) return false; ApricotLabel label = new ApricotLabel(); IntPtr lblPtr = Marshal.AllocHGlobal(512); @@ -79,14 +82,21 @@ namespace DiscImageChef.PartPlugins // Not much to check but... ulong deviceSectors = imagePlugin.GetSectors(); ulong deviceSizeAccordingToLabel = label.cylinders * label.heads * label.spt; - if(label.operatingSystem > 4 || label.bootType > 5 || label.partitionCount > 8 || deviceSizeAccordingToLabel > deviceSectors || label.firstDataBlock > deviceSectors) - return false; + if(label.operatingSystem > 4 || label.bootType > 5 || label.partitionCount > 8 || + deviceSizeAccordingToLabel > deviceSectors || label.firstDataBlock > deviceSectors) return false; - DicConsole.DebugWriteLine("Apricot partitions", "label.version = \"{0}\"", StringHandlers.CToString(label.version)); - DicConsole.DebugWriteLine("Apricot partitions", "label.operatingSystem = {0} ({1})", label.operatingSystem, label.operatingSystem < operatingSystemCodes.Length ? operatingSystemCodes[label.operatingSystem] : "Unknown"); + DicConsole.DebugWriteLine("Apricot partitions", "label.version = \"{0}\"", + StringHandlers.CToString(label.version)); + DicConsole.DebugWriteLine("Apricot partitions", "label.operatingSystem = {0} ({1})", label.operatingSystem, + label.operatingSystem < operatingSystemCodes.Length + ? operatingSystemCodes[label.operatingSystem] + : "Unknown"); DicConsole.DebugWriteLine("Apricot partitions", "label.writeProtected = {0}", label.writeProtected); DicConsole.DebugWriteLine("Apricot partitions", "label.copyProtected = {0}", label.copyProtected); - DicConsole.DebugWriteLine("Apricot partitions", "label.bootType = {0} ({1})", label.bootType, label.bootType < bootTypeCodes.Length ? bootTypeCodes[label.bootType] : "Unknown"); + DicConsole.DebugWriteLine("Apricot partitions", "label.bootType = {0} ({1})", label.bootType, + label.bootType < bootTypeCodes.Length + ? bootTypeCodes[label.bootType] + : "Unknown"); DicConsole.DebugWriteLine("Apricot partitions", "label.partitionCount = {0}", label.partitionCount); DicConsole.DebugWriteLine("Apricot partitions", "label.winchester = {0}", label.winchester); DicConsole.DebugWriteLine("Apricot partitions", "label.sectorSize = {0}", label.sectorSize); @@ -98,14 +108,18 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Apricot partitions", "label.bootLocation = {0}", label.bootLocation); DicConsole.DebugWriteLine("Apricot partitions", "label.bootSize = {0}", label.bootSize); DicConsole.DebugWriteLine("Apricot partitions", "label.bootAddress = 0x{0:X8}", label.bootAddress); - DicConsole.DebugWriteLine("Apricot partitions", "label.bootOffset:label.bootSegment = {0:X4}:{1:X4}", label.bootOffset, label.bootSegment); + DicConsole.DebugWriteLine("Apricot partitions", "label.bootOffset:label.bootSegment = {0:X4}:{1:X4}", + label.bootOffset, label.bootSegment); DicConsole.DebugWriteLine("Apricot partitions", "label.firstDataBlock = {0}", label.firstDataBlock); DicConsole.DebugWriteLine("Apricot partitions", "label.generation = {0}", label.generation); DicConsole.DebugWriteLine("Apricot partitions", "label.copyCount = {0}", label.copyCount); DicConsole.DebugWriteLine("Apricot partitions", "label.maxCopies = {0}", label.maxCopies); - DicConsole.DebugWriteLine("Apricot partitions", "label.serialNumber = \"{0}\"", StringHandlers.CToString(label.serialNumber)); - DicConsole.DebugWriteLine("Apricot partitions", "label.partNumber = \"{0}\"", StringHandlers.CToString(label.partNumber)); - DicConsole.DebugWriteLine("Apricot partitions", "label.copyright = \"{0}\"", StringHandlers.CToString(label.copyright)); + DicConsole.DebugWriteLine("Apricot partitions", "label.serialNumber = \"{0}\"", + StringHandlers.CToString(label.serialNumber)); + DicConsole.DebugWriteLine("Apricot partitions", "label.partNumber = \"{0}\"", + StringHandlers.CToString(label.partNumber)); + DicConsole.DebugWriteLine("Apricot partitions", "label.copyright = \"{0}\"", + StringHandlers.CToString(label.copyright)); DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.bps = {0}", label.mainBPB.bps); DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.spc = {0}", label.mainBPB.spc); DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.rsectors = {0}", label.mainBPB.rsectors); @@ -114,14 +128,24 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.sectors = {0}", label.mainBPB.sectors); DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.media = {0}", label.mainBPB.media); DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.spfat = {0}", label.mainBPB.spfat); - DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.diskType = {0} ({1})", label.mainBPB.diskType, label.mainBPB.diskType < diskTypeCodes.Length ? diskTypeCodes[label.mainBPB.diskType] : "Unknown"); - DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.startSector = {0}", label.mainBPB.startSector); - DicConsole.DebugWriteLine("Apricot partitions", "label.fontName = \"{0}\"", StringHandlers.CToString(label.fontName)); - DicConsole.DebugWriteLine("Apricot partitions", "label.keyboardName = \"{0}\"", StringHandlers.CToString(label.keyboardName)); + DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.diskType = {0} ({1})", + label.mainBPB.diskType, + label.mainBPB.diskType < diskTypeCodes.Length + ? diskTypeCodes[label.mainBPB.diskType] + : "Unknown"); + DicConsole.DebugWriteLine("Apricot partitions", "label.mainBPB.startSector = {0}", + label.mainBPB.startSector); + DicConsole.DebugWriteLine("Apricot partitions", "label.fontName = \"{0}\"", + StringHandlers.CToString(label.fontName)); + DicConsole.DebugWriteLine("Apricot partitions", "label.keyboardName = \"{0}\"", + StringHandlers.CToString(label.keyboardName)); DicConsole.DebugWriteLine("Apricot partitions", "label.biosMajorVersion = {0}", label.biosMajorVersion); DicConsole.DebugWriteLine("Apricot partitions", "label.biosMinorVersion = {0}", label.biosMinorVersion); DicConsole.DebugWriteLine("Apricot partitions", "label.diagnosticsFlag = {0}", label.diagnosticsFlag); - DicConsole.DebugWriteLine("Apricot partitions", "label.prnDevice = {0} ({1})", label.prnDevice, label.prnDevice < printDevices.Length ? printDevices[label.prnDevice] : "Unknown"); + DicConsole.DebugWriteLine("Apricot partitions", "label.prnDevice = {0} ({1})", label.prnDevice, + label.prnDevice < printDevices.Length + ? printDevices[label.prnDevice] + : "Unknown"); DicConsole.DebugWriteLine("Apricot partitions", "label.bellVolume = {0}", label.bellVolume); DicConsole.DebugWriteLine("Apricot partitions", "label.enableCache = {0}", label.enableCache); DicConsole.DebugWriteLine("Apricot partitions", "label.enableGraphics = {0}", label.enableGraphics); @@ -136,18 +160,28 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Apricot partitions", "label.autorepeatLeadIn = {0}", label.autorepeatLeadIn); DicConsole.DebugWriteLine("Apricot partitions", "label.autorepeatInterval = {0}", label.autorepeatInterval); DicConsole.DebugWriteLine("Apricot partitions", "label.microscreenMode = {0}", label.microscreenMode); - DicConsole.DebugWriteLine("Apricot partitions", "label.spareKeyboard is null? = {0}", ArrayHelpers.ArrayIsNullOrEmpty(label.spareKeyboard)); - DicConsole.DebugWriteLine("Apricot partitions", "label.lineMode = {0} ({1} lines)", label.lineMode, label.lineMode < lineModes.Length ? lineModes[label.lineMode] : 0); - DicConsole.DebugWriteLine("Apricot partitions", "label.lineWidth = {0} ({1} columns)", label.lineWidth, label.lineWidth < lineWidths.Length ? lineWidths[label.lineWidth] : 0); + DicConsole.DebugWriteLine("Apricot partitions", "label.spareKeyboard is null? = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(label.spareKeyboard)); + DicConsole.DebugWriteLine("Apricot partitions", "label.lineMode = {0} ({1} lines)", label.lineMode, + label.lineMode < lineModes.Length ? lineModes[label.lineMode] : 0); + DicConsole.DebugWriteLine("Apricot partitions", "label.lineWidth = {0} ({1} columns)", label.lineWidth, + label.lineWidth < lineWidths.Length ? lineWidths[label.lineWidth] : 0); DicConsole.DebugWriteLine("Apricot partitions", "label.imageOff = {0}", label.imageOff); - DicConsole.DebugWriteLine("Apricot partitions", "label.spareScreen is null? = {0}", ArrayHelpers.ArrayIsNullOrEmpty(label.spareScreen)); - DicConsole.DebugWriteLine("Apricot partitions", "label.txBaudRate = {0} ({1} bps)", label.txBaudRate, label.txBaudRate < baudRates.Length ? baudRates[label.txBaudRate] : 0); - DicConsole.DebugWriteLine("Apricot partitions", "label.rxBaudRate = {0} ({1} bps)", label.rxBaudRate, label.rxBaudRate < baudRates.Length ? baudRates[label.rxBaudRate] : 0); + DicConsole.DebugWriteLine("Apricot partitions", "label.spareScreen is null? = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(label.spareScreen)); + DicConsole.DebugWriteLine("Apricot partitions", "label.txBaudRate = {0} ({1} bps)", label.txBaudRate, + label.txBaudRate < baudRates.Length ? baudRates[label.txBaudRate] : 0); + DicConsole.DebugWriteLine("Apricot partitions", "label.rxBaudRate = {0} ({1} bps)", label.rxBaudRate, + label.rxBaudRate < baudRates.Length ? baudRates[label.rxBaudRate] : 0); DicConsole.DebugWriteLine("Apricot partitions", "label.txBits = {0}", label.txBits); DicConsole.DebugWriteLine("Apricot partitions", "label.rxBits = {0}", label.rxBits); - DicConsole.DebugWriteLine("Apricot partitions", "label.stopBits = {0} ({1} bits)", label.stopBits, label.stopBits < stopBits.Length ? stopBits[label.stopBits] : 0); + DicConsole.DebugWriteLine("Apricot partitions", "label.stopBits = {0} ({1} bits)", label.stopBits, + label.stopBits < stopBits.Length ? stopBits[label.stopBits] : 0); DicConsole.DebugWriteLine("Apricot partitions", "label.parityCheck = {0}", label.parityCheck); - DicConsole.DebugWriteLine("Apricot partitions", "label.parityType = {0} ({1})", label.parityType, label.parityType < parityTypes.Length ? parityTypes[label.parityType] : "Unknown"); + DicConsole.DebugWriteLine("Apricot partitions", "label.parityType = {0} ({1})", label.parityType, + label.parityType < parityTypes.Length + ? parityTypes[label.parityType] + : "Unknown"); DicConsole.DebugWriteLine("Apricot partitions", "label.txXonXoff = {0}", label.txXonXoff); DicConsole.DebugWriteLine("Apricot partitions", "label.rxXonXoff = {0}", label.rxXonXoff); DicConsole.DebugWriteLine("Apricot partitions", "label.xonCharacter = {0}", label.xonCharacter); @@ -158,39 +192,59 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Apricot partitions", "label.nullsAfterCr = {0}", label.nullsAfterCr); DicConsole.DebugWriteLine("Apricot partitions", "label.nullsAfterFF = {0}", label.nullsAfterFF); DicConsole.DebugWriteLine("Apricot partitions", "label.lfAfterCRSerial = {0}", label.lfAfterCRSerial); - DicConsole.DebugWriteLine("Apricot partitions", "label.biosErrorReportSerial = {0}", label.biosErrorReportSerial); - DicConsole.DebugWriteLine("Apricot partitions", "label.spareSerial is null? = {0}", ArrayHelpers.ArrayIsNullOrEmpty(label.spareSerial)); + DicConsole.DebugWriteLine("Apricot partitions", "label.biosErrorReportSerial = {0}", + label.biosErrorReportSerial); + DicConsole.DebugWriteLine("Apricot partitions", "label.spareSerial is null? = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(label.spareSerial)); DicConsole.DebugWriteLine("Apricot partitions", "label.lfAfterCrParallel = {0}", label.lfAfterCrParallel); DicConsole.DebugWriteLine("Apricot partitions", "label.selectLine = {0}", label.selectLine); DicConsole.DebugWriteLine("Apricot partitions", "label.paperEmpty = {0}", label.paperEmpty); DicConsole.DebugWriteLine("Apricot partitions", "label.faultLine = {0}", label.faultLine); - DicConsole.DebugWriteLine("Apricot partitions", "label.biosErrorReportParallel = {0}", label.biosErrorReportParallel); - DicConsole.DebugWriteLine("Apricot partitions", "label.spareParallel is null? = {0}", ArrayHelpers.ArrayIsNullOrEmpty(label.spareParallel)); - DicConsole.DebugWriteLine("Apricot partitions", "label.spareWinchester is null? = {0}", ArrayHelpers.ArrayIsNullOrEmpty(label.spareWinchester)); + DicConsole.DebugWriteLine("Apricot partitions", "label.biosErrorReportParallel = {0}", + label.biosErrorReportParallel); + DicConsole.DebugWriteLine("Apricot partitions", "label.spareParallel is null? = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(label.spareParallel)); + DicConsole.DebugWriteLine("Apricot partitions", "label.spareWinchester is null? = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(label.spareWinchester)); DicConsole.DebugWriteLine("Apricot partitions", "label.parkingEnabled = {0}", label.parkingEnabled); DicConsole.DebugWriteLine("Apricot partitions", "label.formatProtection = {0}", label.formatProtection); - DicConsole.DebugWriteLine("Apricot partitions", "label.spareRamDisk is null? = {0}", ArrayHelpers.ArrayIsNullOrEmpty(label.spareRamDisk)); + DicConsole.DebugWriteLine("Apricot partitions", "label.spareRamDisk is null? = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(label.spareRamDisk)); for(int i = 0; i < 32; i++) DicConsole.DebugWriteLine("Apricot partitions", "label.badBlocks[{1}] = {0}", label.badBlocks[i], i); for(int i = 0; i < 8; i++) { - DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].bps = {0}", label.partitions[i].bps, i); - DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].spc = {0}", label.partitions[i].spc, i); - DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].rsectors = {0}", label.partitions[i].rsectors, i); - DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].fats_no = {0}", label.partitions[i].fats_no, i); - DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].root_ent = {0}", label.partitions[i].root_ent, i); - DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].sectors = {0}", label.partitions[i].sectors, i); - DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].media = {0}", label.partitions[i].media, i); - DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].spfat = {0}", label.partitions[i].spfat, i); - DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].diskType = {0} ({2})", label.partitions[i].diskType, i, label.partitions[i].diskType < diskTypeCodes.Length ? diskTypeCodes[label.partitions[i].diskType] : "Unknown"); - DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].startSector = {0}", label.partitions[i].startSector, i); + DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].bps = {0}", + label.partitions[i].bps, i); + DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].spc = {0}", + label.partitions[i].spc, i); + DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].rsectors = {0}", + label.partitions[i].rsectors, i); + DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].fats_no = {0}", + label.partitions[i].fats_no, i); + DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].root_ent = {0}", + label.partitions[i].root_ent, i); + DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].sectors = {0}", + label.partitions[i].sectors, i); + DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].media = {0}", + label.partitions[i].media, i); + DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].spfat = {0}", + label.partitions[i].spfat, i); + DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].diskType = {0} ({2})", + label.partitions[i].diskType, i, + label.partitions[i].diskType < diskTypeCodes.Length + ? diskTypeCodes[label.partitions[i].diskType] + : "Unknown"); + DicConsole.DebugWriteLine("Apricot partitions", "label.partitions[{1}].startSector = {0}", + label.partitions[i].startSector, i); } - DicConsole.DebugWriteLine("Apricot partitions", "label.spare is null? = {0}", ArrayHelpers.ArrayIsNullOrEmpty(label.spare)); + + DicConsole.DebugWriteLine("Apricot partitions", "label.spare is null? = {0}", + ArrayHelpers.ArrayIsNullOrEmpty(label.spare)); DicConsole.DebugWriteLine("Apricot partitions", "label.cpmDoubleSided = {0}", label.cpmDoubleSided); // Only hard disks can contain partitions - if(!label.winchester) - return false; + if(!label.winchester) return false; for(byte i = 0; i < label.partitionCount; i++) { @@ -204,8 +258,7 @@ namespace DiscImageChef.PartPlugins Scheme = Name, Offset = (ulong)(label.partitions[i].startSector * label.sectorSize) }; - if(part.Start < deviceSectors && part.End < deviceSectors) - partitions.Add(part); + if(part.Start < deviceSectors && part.End < deviceSectors) partitions.Add(part); } return partitions.Count > 0; @@ -216,23 +269,19 @@ namespace DiscImageChef.PartPlugins public struct ApricotLabel { /// <summary>Version of format which created disk</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] version; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] version; /// <summary>Operating system.</summary> public byte operatingSystem; /// <summary>Software write protection.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool writeProtected; + [MarshalAs(UnmanagedType.U1)] public bool writeProtected; /// <summary>Copy protected.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool copyProtected; + [MarshalAs(UnmanagedType.U1)] public bool copyProtected; /// <summary>Boot type.</summary> public byte bootType; /// <summary>Partitions.</summary> public byte partitionCount; /// <summary>Is hard disk?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool winchester; + [MarshalAs(UnmanagedType.U1)] public bool winchester; /// <summary>Sector size.</summary> public ushort sectorSize; /// <summary>Sectors per track.</summary> @@ -264,39 +313,31 @@ namespace DiscImageChef.PartPlugins /// <summary>Maximum number of copies.</summary> public ushort maxCopies; /// <summary>Serial number.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] serialNumber; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] serialNumber; /// <summary>Part number.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] partNumber; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] partNumber; /// <summary>Copyright.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public byte[] copyright; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] copyright; /// <summary>BPB for whole disk.</summary> public ApricotParameterBlock mainBPB; /// <summary>Name of FONT file.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] fontName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] fontName; /// <summary>Name of KEYBOARD file.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] keyboardName; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] keyboardName; /// <summary>Minor BIOS version.</summary> public byte biosMinorVersion; /// <summary>Major BIOS version.</summary> public byte biosMajorVersion; /// <summary>Diagnostics enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool diagnosticsFlag; + [MarshalAs(UnmanagedType.U1)] public bool diagnosticsFlag; /// <summary>Printer device.</summary> public byte prnDevice; /// <summary>Bell volume.</summary> public byte bellVolume; /// <summary>Cache enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool enableCache; + [MarshalAs(UnmanagedType.U1)] public bool enableCache; /// <summary>Graphics enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool enableGraphics; + [MarshalAs(UnmanagedType.U1)] public bool enableGraphics; /// <summary>Length in sectors of DOS.</summary> public byte dosLength; /// <summary>Length in sectors of FONT file.</summary> @@ -312,8 +353,7 @@ namespace DiscImageChef.PartPlugins /// <summary>Keyboard click volume.</summary> public byte keyboardVolume; /// <summary>Auto-repeat enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool autorepeat; + [MarshalAs(UnmanagedType.U1)] public bool autorepeat; /// <summary>Auto-repeat lead-in.</summary> public byte autorepeatLeadIn; /// <summary>Auto-repeat interval.</summary> @@ -321,18 +361,15 @@ namespace DiscImageChef.PartPlugins /// <summary>Microscreen mode.</summary> public byte microscreenMode; /// <summary>Spare area for keyboard values expansion.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] spareKeyboard; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] spareKeyboard; /// <summary>Screen line mode.</summary> public byte lineMode; /// <summary>Screen line width.</summary> public byte lineWidth; /// <summary>Screen disabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool imageOff; + [MarshalAs(UnmanagedType.U1)] public bool imageOff; /// <summary>Spare area for screen values expansion.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] - public byte[] spareScreen; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] public byte[] spareScreen; /// <summary>TX baud rate.</summary> public byte txBaudRate; /// <summary>RX baud rate.</summary> @@ -344,16 +381,13 @@ namespace DiscImageChef.PartPlugins /// <summary>Stop bits.</summary> public byte stopBits; /// <summary>Parity enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool parityCheck; + [MarshalAs(UnmanagedType.U1)] public bool parityCheck; /// <summary>Parity type.</summary> public byte parityType; /// <summary>Xon/Xoff enabled on TX.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool txXonXoff; + [MarshalAs(UnmanagedType.U1)] public bool txXonXoff; /// <summary>Xon/Xoff enabled on RX.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool rxXonXoff; + [MarshalAs(UnmanagedType.U1)] public bool rxXonXoff; /// <summary>Xon character.</summary> public byte xonCharacter; /// <summary>Xoff character.</summary> @@ -361,63 +395,45 @@ namespace DiscImageChef.PartPlugins /// <summary>Xon/Xoff buffer on RX.</summary> public ushort rxXonXoffBuffer; /// <summary>DTR/DSR enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool dtrDsr; + [MarshalAs(UnmanagedType.U1)] public bool dtrDsr; /// <summary>CTS/RTS enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool ctsRts; + [MarshalAs(UnmanagedType.U1)] public bool ctsRts; /// <summary>NULLs after CR.</summary> public byte nullsAfterCr; /// <summary>NULLs after 0xFF.</summary> public byte nullsAfterFF; /// <summary>Send LF after CR in serial port.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool lfAfterCRSerial; + [MarshalAs(UnmanagedType.U1)] public bool lfAfterCRSerial; /// <summary>BIOS error report in serial port.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool biosErrorReportSerial; + [MarshalAs(UnmanagedType.U1)] public bool biosErrorReportSerial; /// <summary>Spare area for serial port values expansion.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] - public byte[] spareSerial; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] public byte[] spareSerial; /// <summary>Send LF after CR in parallel port.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool lfAfterCrParallel; + [MarshalAs(UnmanagedType.U1)] public bool lfAfterCrParallel; /// <summary>Select line supported?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool selectLine; + [MarshalAs(UnmanagedType.U1)] public bool selectLine; /// <summary>Paper empty supported?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool paperEmpty; + [MarshalAs(UnmanagedType.U1)] public bool paperEmpty; /// <summary>Fault line supported?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool faultLine; + [MarshalAs(UnmanagedType.U1)] public bool faultLine; /// <summary>BIOS error report in parallel port.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool biosErrorReportParallel; + [MarshalAs(UnmanagedType.U1)] public bool biosErrorReportParallel; /// <summary>Spare area for parallel port values expansion.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] spareParallel; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] spareParallel; /// <summary>Spare area for Winchester values expansion.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public byte[] spareWinchester; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] spareWinchester; /// <summary>Parking enabled?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool parkingEnabled; + [MarshalAs(UnmanagedType.U1)] public bool parkingEnabled; /// <summary>Format protection?.</summary> - [MarshalAs(UnmanagedType.U1)] - public bool formatProtection; + [MarshalAs(UnmanagedType.U1)] public bool formatProtection; /// <summary>Spare area for RAM disk values expansion.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] spareRamDisk; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] spareRamDisk; /// <summary>List of bad blocks.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public ushort[] badBlocks; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public ushort[] badBlocks; /// <summary>Array of partition BPBs.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public ApricotParameterBlock[] partitions; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public ApricotParameterBlock[] partitions; /// <summary>Spare area.</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 63)] - public byte[] spare; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 63)] public byte[] spare; /// <summary>CP/M double side indicator?.</summary> public bool cpmDoubleSided; } diff --git a/DiscImageChef.Partitions/Atari.cs b/DiscImageChef.Partitions/Atari.cs index 3480750d..369141f0 100644 --- a/DiscImageChef.Partitions/Atari.cs +++ b/DiscImageChef.Partitions/Atari.cs @@ -58,12 +58,12 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("d1dd0f24-ec39-4c4d-9072-be31919a3b5e"); } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions, ulong sectorOffset) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, + out List<CommonTypes.Partition> partitions, ulong sectorOffset) { partitions = new List<CommonTypes.Partition>(); - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -106,20 +106,28 @@ namespace DiscImageChef.PartPlugins for(int i = 0; i < 8; i++) { - DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].flag = 0x{1:X2}", i, (table.icdEntries[i].type & 0xFF000000) >> 24); - DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].type = 0x{1:X6}", i, (table.icdEntries[i].type & 0x00FFFFFF)); - DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].start = {1}", i, table.icdEntries[i].start); - DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].length = {1}", i, table.icdEntries[i].length); + DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].flag = 0x{1:X2}", i, + (table.icdEntries[i].type & 0xFF000000) >> 24); + DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].type = 0x{1:X6}", i, + (table.icdEntries[i].type & 0x00FFFFFF)); + DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].start = {1}", i, + table.icdEntries[i].start); + DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].length = {1}", i, + table.icdEntries[i].length); } DicConsole.DebugWriteLine("Atari partition plugin", "table.size = {0}", table.size); for(int i = 0; i < 4; i++) { - DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].flag = 0x{1:X2}", i, (table.entries[i].type & 0xFF000000) >> 24); - DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].type = 0x{1:X6}", i, (table.entries[i].type & 0x00FFFFFF)); - DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].start = {1}", i, table.entries[i].start); - DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].length = {1}", i, table.entries[i].length); + DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].flag = 0x{1:X2}", i, + (table.entries[i].type & 0xFF000000) >> 24); + DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].type = 0x{1:X6}", i, + (table.entries[i].type & 0x00FFFFFF)); + DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].start = {1}", i, + table.entries[i].start); + DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].length = {1}", i, + table.entries[i].length); } DicConsole.DebugWriteLine("Atari partition plugin", "table.badStart = {0}", table.badStart); @@ -132,21 +140,20 @@ namespace DiscImageChef.PartPlugins { uint type = table.entries[i].type & 0x00FFFFFF; - if(type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux || - type == TypeSwap || type == TypeRAW || type == TypeNetBSD || - type == TypeNetBSDSwap || type == TypeSysV || type == TypeMac || - type == TypeMinix || type == TypeMinix2) + if(type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux || type == TypeSwap || + type == TypeRAW || type == TypeNetBSD || type == TypeNetBSDSwap || type == TypeSysV || + type == TypeMac || type == TypeMinix || type == TypeMinix2) { validTable = true; if(table.entries[i].start <= imagePlugin.GetSectors()) { if((table.entries[i].start + table.entries[i].length) > imagePlugin.GetSectors()) - DicConsole.DebugWriteLine("Atari partition plugin", "WARNING: End of partition goes beyond device size"); + DicConsole.DebugWriteLine("Atari partition plugin", + "WARNING: End of partition goes beyond device size"); ulong sectorSize = imagePlugin.GetSectorSize(); - if(sectorSize == 2448 || sectorSize == 2352) - sectorSize = 2048; + if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048; byte[] partType = new byte[3]; partType[0] = (byte)((type & 0xFF0000) >> 16); @@ -215,9 +222,12 @@ namespace DiscImageChef.PartPlugins for(int j = 0; j < 4; j++) { - extendedTable.entries[j].type = BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 0); - extendedTable.entries[j].start = BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 4); - extendedTable.entries[j].length = BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 8); + extendedTable.entries[j].type = + BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 0); + extendedTable.entries[j].start = + BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 4); + extendedTable.entries[j].length = + BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 8); } for(int j = 0; j < 4; j++) @@ -225,19 +235,20 @@ namespace DiscImageChef.PartPlugins uint extendedType = extendedTable.entries[j].type & 0x00FFFFFF; if(extendedType == TypeGEMDOS || extendedType == TypeBigGEMDOS || extendedType == TypeLinux || - extendedType == TypeSwap || extendedType == TypeRAW || extendedType == TypeNetBSD || - extendedType == TypeNetBSDSwap || extendedType == TypeSysV || extendedType == TypeMac || - extendedType == TypeMinix || extendedType == TypeMinix2) + extendedType == TypeSwap || extendedType == TypeRAW || extendedType == TypeNetBSD || + extendedType == TypeNetBSDSwap || extendedType == TypeSysV || extendedType == TypeMac || + extendedType == TypeMinix || extendedType == TypeMinix2) { validTable = true; if(extendedTable.entries[j].start <= imagePlugin.GetSectors()) { - if((extendedTable.entries[j].start + extendedTable.entries[j].length) > imagePlugin.GetSectors()) - DicConsole.DebugWriteLine("Atari partition plugin", "WARNING: End of partition goes beyond device size"); + if((extendedTable.entries[j].start + extendedTable.entries[j].length) > + imagePlugin.GetSectors()) + DicConsole.DebugWriteLine("Atari partition plugin", + "WARNING: End of partition goes beyond device size"); ulong sectorSize = imagePlugin.GetSectorSize(); - if(sectorSize == 2448 || sectorSize == 2352) - sectorSize = 2048; + if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048; byte[] partType = new byte[3]; partType[0] = (byte)((extendedType & 0xFF0000) >> 16); @@ -307,19 +318,18 @@ namespace DiscImageChef.PartPlugins { uint type = table.icdEntries[i].type & 0x00FFFFFF; - if(type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux || - type == TypeSwap || type == TypeRAW || type == TypeNetBSD || - type == TypeNetBSDSwap || type == TypeSysV || type == TypeMac || - type == TypeMinix || type == TypeMinix2) + if(type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux || type == TypeSwap || + type == TypeRAW || type == TypeNetBSD || type == TypeNetBSDSwap || type == TypeSysV || + type == TypeMac || type == TypeMinix || type == TypeMinix2) { if(table.icdEntries[i].start <= imagePlugin.GetSectors()) { if((table.icdEntries[i].start + table.icdEntries[i].length) > imagePlugin.GetSectors()) - DicConsole.DebugWriteLine("Atari partition plugin", "WARNING: End of partition goes beyond device size"); + DicConsole.DebugWriteLine("Atari partition plugin", + "WARNING: End of partition goes beyond device size"); ulong sectorSize = imagePlugin.GetSectorSize(); - if(sectorSize == 2448 || sectorSize == 2352) - sectorSize = 2048; + if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048; byte[] partType = new byte[3]; partType[0] = (byte)((type & 0xFF0000) >> 16); diff --git a/DiscImageChef.Partitions/BSD.cs b/DiscImageChef.Partitions/BSD.cs index f21101f2..346ce8a6 100644 --- a/DiscImageChef.Partitions/BSD.cs +++ b/DiscImageChef.Partitions/BSD.cs @@ -45,9 +45,9 @@ namespace DiscImageChef.PartPlugins public const uint DISKMAGIC = 0x82564557; public const uint DISKCIGAM = 0x57455682; /// <summary>Known sector locations for BSD disklabel</summary> - readonly ulong[] labelLocations = { 0, 1, 2, 9 }; + readonly ulong[] labelLocations = {0, 1, 2, 9}; /// <summary>Known byte offsets for BSD disklabel</summary> - readonly uint[] labelOffsets = { 0, 9, 64, 128, 516 }; + readonly uint[] labelOffsets = {0, 9, 64, 128, 516}; /// <summary>Maximum size of a disklabel with 22 partitions</summary> const uint maxLabelSize = 500; @@ -61,8 +61,7 @@ namespace DiscImageChef.PartPlugins { partitions = new List<Partition>(); uint run = (maxLabelSize + labelOffsets.Last()) / imagePlugin.GetSectorSize(); - if((maxLabelSize + labelOffsets.Last()) % imagePlugin.GetSectorSize() > 0) - run++; + if((maxLabelSize + labelOffsets.Last()) % imagePlugin.GetSectorSize() > 0) run++; byte[] sector; DiskLabel dl = new DiskLabel(); @@ -70,8 +69,7 @@ namespace DiscImageChef.PartPlugins foreach(ulong location in labelLocations) { - if(location + run + sectorOffset >= imagePlugin.GetSectors()) - return false; + if(location + run + sectorOffset >= imagePlugin.GetSectors()) return false; byte[] tmp = imagePlugin.ReadSectors(location + sectorOffset, run); foreach(uint offset in labelOffsets) @@ -79,7 +77,9 @@ namespace DiscImageChef.PartPlugins sector = new byte[maxLabelSize]; Array.Copy(tmp, offset, sector, 0, maxLabelSize); dl = GetDiskLabel(sector); - DicConsole.DebugWriteLine("BSD plugin", "dl.magic on sector {0} at offset {1} = 0x{2:X8} (expected 0x{3:X8})", location + sectorOffset, offset, dl.d_magic, DISKMAGIC); + DicConsole.DebugWriteLine("BSD plugin", + "dl.magic on sector {0} at offset {1} = 0x{2:X8} (expected 0x{3:X8})", + location + sectorOffset, offset, dl.d_magic, DISKMAGIC); if((dl.d_magic == DISKMAGIC && dl.d_magic2 == DISKMAGIC) || (dl.d_magic == DISKCIGAM && dl.d_magic2 == DISKCIGAM)) { @@ -88,15 +88,12 @@ namespace DiscImageChef.PartPlugins } } - if(found) - break; + if(found) break; } - if(!found) - return false; + if(!found) return false; - if(dl.d_magic == DISKCIGAM && dl.d_magic2 == DISKCIGAM) - dl = SwapDiskLabel(dl); + if(dl.d_magic == DISKCIGAM && dl.d_magic2 == DISKCIGAM) dl = SwapDiskLabel(dl); DicConsole.DebugWriteLine("BSD plugin", "dl.d_type = {0}", dl.d_type); DicConsole.DebugWriteLine("BSD plugin", "dl.d_subtype = {0}", dl.d_subtype); @@ -139,9 +136,11 @@ namespace DiscImageChef.PartPlugins for(int i = 0; i < dl.d_npartitions && i < 22; i++) { - DicConsole.DebugWriteLine("BSD plugin", "dl.d_partitions[i].p_offset = {0}", dl.d_partitions[i].p_offset); + DicConsole.DebugWriteLine("BSD plugin", "dl.d_partitions[i].p_offset = {0}", + dl.d_partitions[i].p_offset); DicConsole.DebugWriteLine("BSD plugin", "dl.d_partitions[i].p_size = {0}", dl.d_partitions[i].p_size); - DicConsole.DebugWriteLine("BSD plugin", "dl.d_partitions[i].p_fstype = {0} ({1})", dl.d_partitions[i].p_fstype, fsTypeToString(dl.d_partitions[i].p_fstype)); + DicConsole.DebugWriteLine("BSD plugin", "dl.d_partitions[i].p_fstype = {0} ({1})", + dl.d_partitions[i].p_fstype, fsTypeToString(dl.d_partitions[i].p_fstype)); Partition part = new Partition { Start = ((dl.d_partitions[i].p_offset * dl.d_secsize) / imagePlugin.GetSectorSize()), @@ -155,8 +154,7 @@ namespace DiscImageChef.PartPlugins if(dl.d_partitions[i].p_fstype != fsType.Unused) { // Crude and dirty way to know if the disklabel is relative to its parent partition... - if(dl.d_partitions[i].p_offset < sectorOffset && !addSectorOffset) - addSectorOffset = true; + if(dl.d_partitions[i].p_offset < sectorOffset && !addSectorOffset) addSectorOffset = true; if(addSectorOffset) { @@ -331,11 +329,9 @@ namespace DiscImageChef.PartPlugins /// <summary>Disk subtype</summary> public ushort d_subtype; /// <summary>Type name</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] d_typename; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] d_typename; /// <summary>Pack identifier</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] d_packname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] d_packname; /// <summary>Bytes per sector</summary> public uint d_secsize; /// <summary>Sectors per track</summary> @@ -369,8 +365,7 @@ namespace DiscImageChef.PartPlugins /// <summary><see cref="dFlags"/></summary> public dFlags d_flags; /// <summary>Drive-specific information</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public uint[] d_drivedata; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public uint[] d_drivedata; /// <summary>Reserved</summary> [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] /// <summary></summary> @@ -386,8 +381,7 @@ namespace DiscImageChef.PartPlugins /// <summary>Maximum size of superblock in bytes</summary> public uint d_sbsize; /// <summary>Partitions</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] - public BSDPartition[] d_partitions; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] public BSDPartition[] d_partitions; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -411,65 +405,36 @@ namespace DiscImageChef.PartPlugins { switch(typ) { - case fsType.Unused: - return "Unused entry"; - case fsType.Swap: - return "Swap partition"; - case fsType.V6: - return "UNIX 6th Edition"; - case fsType.V7: - return "UNIX 7th Edition"; - case fsType.SystemV: - return "UNIX System V"; - case fsType.V7_1K: - return "UNIX 7th Edition with 1K blocks"; - case fsType.V8: - return "UNIX 8th Edition with 4K blocks"; - case fsType.BSDFFS: - return "4.2BSD Fast File System"; - case fsType.BSDLFS: - return "4.4LFS"; - case fsType.HPFS: - return "HPFS"; - case fsType.ISO9660: - return "ISO9660"; + case fsType.Unused: return "Unused entry"; + case fsType.Swap: return "Swap partition"; + case fsType.V6: return "UNIX 6th Edition"; + case fsType.V7: return "UNIX 7th Edition"; + case fsType.SystemV: return "UNIX System V"; + case fsType.V7_1K: return "UNIX 7th Edition with 1K blocks"; + case fsType.V8: return "UNIX 8th Edition with 4K blocks"; + case fsType.BSDFFS: return "4.2BSD Fast File System"; + case fsType.BSDLFS: return "4.4LFS"; + case fsType.HPFS: return "HPFS"; + case fsType.ISO9660: return "ISO9660"; case fsType.Boot: - case fsType.SysVBoot: - return "Boot"; - case fsType.AFFS: - return "Amiga FFS"; - case fsType.HFS: - return "Apple HFS"; - case fsType.ADVfs: - return "Digital Advanced File System"; - case fsType.LSMpublic: - return "Digital LSM Public Region"; - case fsType.LSMprivate: - return "Digital LSM Private Region"; - case fsType.LSMsimple: - return "Digital LSM Simple Disk"; - case fsType.CCD: - return "Concatenated disk"; - case fsType.JFS2: - return "IBM JFS2"; - case fsType.HAMMER: - return "Hammer"; - case fsType.HAMMER2: - return "Hammer2"; - case fsType.UDF: - return "UDF"; - case fsType.EFS: - return "EFS"; - case fsType.ZFS: - return "ZFS"; - case fsType.NANDFS: - return "FreeBSD nandfs"; - case fsType.MSDOS: - return "FAT"; - case fsType.Other: - return "Other or unknown"; - default: - return "Unknown"; + case fsType.SysVBoot: return "Boot"; + case fsType.AFFS: return "Amiga FFS"; + case fsType.HFS: return "Apple HFS"; + case fsType.ADVfs: return "Digital Advanced File System"; + case fsType.LSMpublic: return "Digital LSM Public Region"; + case fsType.LSMprivate: return "Digital LSM Private Region"; + case fsType.LSMsimple: return "Digital LSM Simple Disk"; + case fsType.CCD: return "Concatenated disk"; + case fsType.JFS2: return "IBM JFS2"; + case fsType.HAMMER: return "Hammer"; + case fsType.HAMMER2: return "Hammer2"; + case fsType.UDF: return "UDF"; + case fsType.EFS: return "EFS"; + case fsType.ZFS: return "ZFS"; + case fsType.NANDFS: return "FreeBSD nandfs"; + case fsType.MSDOS: return "FAT"; + case fsType.Other: return "Other or unknown"; + default: return "Unknown"; } } @@ -484,10 +449,8 @@ namespace DiscImageChef.PartPlugins public static DiskLabel SwapDiskLabel(DiskLabel disklabel) { DiskLabel dl = BigEndianMarshal.SwapStructureMembersEndian(disklabel); - for(int i = 0; i < dl.d_drivedata.Length; i++) - dl.d_drivedata[i] = Swapping.Swap(dl.d_drivedata[i]); - for(int i = 0; i < dl.d_spare.Length; i++) - dl.d_spare[i] = Swapping.Swap(dl.d_spare[i]); + for(int i = 0; i < dl.d_drivedata.Length; i++) dl.d_drivedata[i] = Swapping.Swap(dl.d_drivedata[i]); + for(int i = 0; i < dl.d_spare.Length; i++) dl.d_spare[i] = Swapping.Swap(dl.d_spare[i]); for(int i = 0; i < dl.d_partitions.Length; i++) dl.d_partitions[i] = BigEndianMarshal.SwapStructureMembersEndian(dl.d_partitions[i]); diff --git a/DiscImageChef.Partitions/DEC.cs b/DiscImageChef.Partitions/DEC.cs index 8eb136d7..ea194153 100644 --- a/DiscImageChef.Partitions/DEC.cs +++ b/DiscImageChef.Partitions/DEC.cs @@ -53,12 +53,10 @@ namespace DiscImageChef.PartPlugins { partitions = new List<Partition>(); - if(31 + sectorOffset >= imagePlugin.GetSectors()) - return false; + if(31 + sectorOffset >= imagePlugin.GetSectors()) return false; byte[] sector = imagePlugin.ReadSector(31 + sectorOffset); - if(sector.Length < 512) - return false; + if(sector.Length < 512) return false; DECLabel table = new DECLabel(); IntPtr tablePtr = Marshal.AllocHGlobal(512); @@ -66,8 +64,7 @@ namespace DiscImageChef.PartPlugins table = (DECLabel)Marshal.PtrToStructure(tablePtr, typeof(DECLabel)); Marshal.FreeHGlobal(tablePtr); - if(table.pt_magic != PT_MAGIC || table.pt_valid != PT_VALID) - return false; + if(table.pt_magic != PT_MAGIC || table.pt_valid != PT_VALID) return false; ulong counter = 0; @@ -95,12 +92,10 @@ namespace DiscImageChef.PartPlugins [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DECLabel { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 440)] - public byte[] padding; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 440)] public byte[] padding; public int pt_magic; public int pt_valid; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public DECPartition[] pt_part; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public DECPartition[] pt_part; } [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/DiscImageChef.Partitions/DragonFlyBSD.cs b/DiscImageChef.Partitions/DragonFlyBSD.cs index d2d5e7c4..5e329ca2 100644 --- a/DiscImageChef.Partitions/DragonFlyBSD.cs +++ b/DiscImageChef.Partitions/DragonFlyBSD.cs @@ -52,15 +52,12 @@ namespace DiscImageChef.PartPlugins { partitions = new List<Partition>(); uint nSectors = 2048 / imagePlugin.GetSectorSize(); - if(2048 % imagePlugin.GetSectorSize() > 0) - nSectors++; + if(2048 % imagePlugin.GetSectorSize() > 0) nSectors++; - if(sectorOffset + nSectors >= imagePlugin.GetSectors()) - return false; + if(sectorOffset + nSectors >= imagePlugin.GetSectors()) return false; byte[] sectors = imagePlugin.ReadSectors(sectorOffset, nSectors); - if(sectors.Length < 2048) - return false; + if(sectors.Length < 2048) return false; Disklabel64 disklabel = new Disklabel64(); IntPtr labelPtr = Marshal.AllocHGlobal(2048); @@ -68,8 +65,7 @@ namespace DiscImageChef.PartPlugins disklabel = (Disklabel64)Marshal.PtrToStructure(labelPtr, typeof(Disklabel64)); Marshal.FreeHGlobal(labelPtr); - if(disklabel.d_magic != 0xC4464C59) - return false; + if(disklabel.d_magic != 0xC4464C59) return false; ulong counter = 0; @@ -86,13 +82,10 @@ namespace DiscImageChef.PartPlugins Scheme = Name }; - if((entry.p_bsize % imagePlugin.GetSectorSize()) > 0) - part.Length++; + if((entry.p_bsize % imagePlugin.GetSectorSize()) > 0) part.Length++; - if((BSD.fsType)entry.p_fstype == BSD.fsType.Other) - part.Type = entry.p_type_uuid.ToString(); - else - part.Type = BSD.fsTypeToString((BSD.fsType)entry.p_fstype); + if((BSD.fsType)entry.p_fstype == BSD.fsType.Other) part.Type = entry.p_type_uuid.ToString(); + else part.Type = BSD.fsTypeToString((BSD.fsType)entry.p_fstype); if(entry.p_bsize > 0 && entry.p_boffset > 0) { partitions.Add(part); @@ -106,8 +99,7 @@ namespace DiscImageChef.PartPlugins [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Disklabel64 { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] - public byte[] d_reserved0; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] d_reserved0; public uint d_magic; public uint d_crc; public uint d_align; @@ -118,12 +110,9 @@ namespace DiscImageChef.PartPlugins public ulong d_pbase; public ulong d_pstop; public ulong d_abase; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] d_packname; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] d_reserved; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public Partition64[] d_partitions; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] d_packname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] d_reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public Partition64[] d_partitions; } [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/DiscImageChef.Partitions/GPT.cs b/DiscImageChef.Partitions/GPT.cs index 3083e5c4..3fa02eb9 100644 --- a/DiscImageChef.Partitions/GPT.cs +++ b/DiscImageChef.Partitions/GPT.cs @@ -48,13 +48,13 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("CBC9D281-C1D0-44E8-9038-4D66FD2678AB"); } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions, ulong sectorOffset) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, + out List<CommonTypes.Partition> partitions, ulong sectorOffset) { partitions = new List<CommonTypes.Partition>(); - if(sectorOffset + 2 >= imagePlugin.GetSectors()) - return false; - + if(sectorOffset + 2 >= imagePlugin.GetSectors()) return false; + byte[] hdrBytes = imagePlugin.ReadSector(1 + sectorOffset); GptHeader hdr; @@ -78,11 +78,9 @@ namespace DiscImageChef.PartPlugins hdrBytes = real; misaligned = true; } - else - return false; + else return false; } - else - return false; + else return false; } try @@ -91,10 +89,7 @@ namespace DiscImageChef.PartPlugins hdr = (GptHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(GptHeader)); handle.Free(); } - catch - { - return false; - } + catch { return false; } DicConsole.DebugWriteLine("GPT Plugin", "hdr.revision = 0x{0:X8}", hdr.revision); DicConsole.DebugWriteLine("GPT Plugin", "hdr.headerSize = {0}", hdr.headerSize); @@ -110,11 +105,9 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("GPT Plugin", "hdr.entriesSize = {0}", hdr.entriesSize); DicConsole.DebugWriteLine("GPT Plugin", "hdr.entriesCrc = 0x{0:X8}", hdr.entriesCrc); - if(hdr.signature != GptMagic) - return false; + if(hdr.signature != GptMagic) return false; - if(hdr.myLBA != 1 + sectorOffset) - return false; + if(hdr.myLBA != 1 + sectorOffset) return false; uint divisor, modulo, sectorSize; @@ -132,8 +125,7 @@ namespace DiscImageChef.PartPlugins } uint totalEntriesSectors = (hdr.entries * hdr.entriesSize) / imagePlugin.GetSectorSize(); - if((hdr.entries * hdr.entriesSize) % imagePlugin.GetSectorSize() > 0) - totalEntriesSectors++; + if((hdr.entries * hdr.entriesSize) % imagePlugin.GetSectorSize() > 0) totalEntriesSectors++; byte[] temp = imagePlugin.ReadSectors(hdr.entryLBA / divisor, totalEntriesSectors + modulo); byte[] entriesBytes = new byte[temp.Length - (modulo * 512)]; @@ -152,14 +144,11 @@ namespace DiscImageChef.PartPlugins entries.Add(entry); } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - catch -#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body - { - } + catch { } +#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body } - if(entries.Count == 0) - return false; + if(entries.Count == 0) return false; ulong pseq = 0; @@ -174,8 +163,8 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("GPT Plugin", "entry.attributes = 0x{0:X16}", entry.attributes); DicConsole.DebugWriteLine("GPT Plugin", "entry.name = {0}", entry.name); - if((entry.startLBA / divisor) > imagePlugin.GetSectors() || (entry.endLBA / divisor) > imagePlugin.GetSectors()) - return false; + if((entry.startLBA / divisor) > imagePlugin.GetSectors() || + (entry.endLBA / divisor) > imagePlugin.GetSectors()) return false; CommonTypes.Partition part = new CommonTypes.Partition { @@ -202,202 +191,106 @@ namespace DiscImageChef.PartPlugins string strType = type.ToString().ToUpperInvariant(); switch(strType) { - case "024DEE41-33E7-11D3-9D69-0008C781F39F": - return "MBR scheme"; - case "C12A7328-F81F-11D2-BA4B-00A0C93EC93B": - return "EFI System"; - case "21686148-6449-6E6F-744E-656564454649": - return "BIOS Boot"; - case "D3BFE2DE-3DAF-11DF-BA40-E3A556D89593": - return "Intel Fast Flash (iFFS)"; - case "F4019732-066E-4E12-8273-346C5641494F": - return "Sony boot"; - case "BFBFAFE7-A34F-448A-9A5B-6213EB736C22": - return "Lenovo boot"; - case "E3C9E316-0B5C-4DB8-817D-F92DF00215AE": - return "Microsoft Reserved (MSR)"; - case "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7": - return "Microsoft Basic data"; - case "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3": - return "Logical Disk Manager (LDM) metadata"; - case "AF9B60A0-1431-4F62-BC68-3311714A69AD": - return "Logical Disk Manager data"; - case "DE94BBA4-06D1-4D40-A16A-BFD50179D6AC": - return "Windows Recovery Environment"; - case "37AFFC90-EF7D-4E96-91C3-2D7AE055B174": - return "IBM General Parallel File System (GPFS)"; - case "E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D": - return "Windows Storage Spaces"; - case "75894C1E-3AEB-11D3-B7C1-7B03A0000000": - return "HP-UX Data"; - case "E2A1E728-32E3-11D6-A682-7B03A0000000": - return "HP-UX Service"; - case "0FC63DAF-8483-4772-8E79-3D69D8477DE4": - return "Linux filesystem"; - case "A19D880F-05FC-4D3B-A006-743F0F84911E": - return "Linux RAID"; - case "44479540-F297-41B2-9AF7-D131D5F0458A": - return "Linux Root (x86)"; - case "4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709": - return "Linux Root (x86-64)"; - case "69DAD710-2CE4-4E3C-B16C-21A1D49ABED3": - return "Linux Root (32-bit ARM)"; - case "B921B045-1DF0-41C3-AF44-4C6F280D3FAE": - return "Linux Root (64-bit ARM/AArch64)"; - case "0657FD6D-A4AB-43C4-84E5-0933C84B4F4F": - return "Linux Swap"; - case "E6D6D379-F507-44C2-A23C-238F2A3DF928": - return "Logical Volume Manager (LVM)"; - case "933AC7E1-2EB4-4F13-B844-0E14E2AEF915": - return "Linux /home"; - case "3B8F8425-20E0-4F3B-907F-1A25A76F98E8": - return "Linux /srv"; - case "7FFEC5C9-2D00-49B7-8941-3EA10A5586B7": - return "Plain dm-crypt"; - case "CA7D7CCB-63ED-4C53-861C-1742536059CC": - return "LUKS"; - case "8DA63339-0007-60C0-C436-083AC8230908": - return "Linux Reserved"; - case "83BD6B9D-7F41-11DC-BE0B-001560B84F0F": - return "FreeBSD Boot"; - case "516E7CB4-6ECF-11D6-8FF8-00022D09712B": - return "FreeBSD Data"; - case "516E7CB5-6ECF-11D6-8FF8-00022D09712B": - return "FreeBSD Swap"; - case "516E7CB6-6ECF-11D6-8FF8-00022D09712B": - return "FreeBSD UFS"; - case "516E7CB7-6ECF-11D6-8FF8-00022D09712B": - return "FreeBSD UFS2"; - case "516E7CB8-6ECF-11D6-8FF8-00022D09712B": - return "FreeBSD Vinum"; - case "516E7CBA-6ECF-11D6-8FF8-00022D09712B": - return "FreeBSD ZFS"; - case "74BA7DD9-A689-11E1-BD04-00E081286ACF": - return "FreeBSD nandfs"; - case "48465300-0000-11AA-AA11-00306543ECAC": - return "Apple HFS"; - case "55465300-0000-11AA-AA11-00306543ECAC": - return "Apple UFS"; - case "52414944-0000-11AA-AA11-00306543ECAC": - return "Apple RAID"; - case "52414944-5F4F-11AA-AA11-00306543ECAC": - return "Apple RAID, offline"; - case "426F6F74-0000-11AA-AA11-00306543ECAC": - return "Apple Boot"; - case "4C616265-6C00-11AA-AA11-00306543ECAC": - return "Apple Label"; - case "5265636F-7665-11AA-AA11-00306543ECAC": - return "Apple TV Recovery"; - case "53746F72-6167-11AA-AA11-00306543ECAC": - return "Apple Core Storage"; - case "6A82CB45-1DD2-11B2-99A6-080020736631": - return "Solaris Boot"; - case "6A85CF4D-1DD2-11B2-99A6-080020736631": - return "Solaris Root"; - case "6A87C46F-1DD2-11B2-99A6-080020736631": - return "Solaris Swap"; - case "6A8B642B-1DD2-11B2-99A6-080020736631": - return "Solaris Backup"; - case "6A898CC3-1DD2-11B2-99A6-080020736631": - return "Solaris /usr or Apple ZFS"; - case "6A8EF2E9-1DD2-11B2-99A6-080020736631": - return "Solaris /var"; - case "6A90BA39-1DD2-11B2-99A6-080020736631": - return "Solaris /home"; - case "6A9283A5-1DD2-11B2-99A6-080020736631": - return "Solaris Alternate sector"; + case "024DEE41-33E7-11D3-9D69-0008C781F39F": return "MBR scheme"; + case "C12A7328-F81F-11D2-BA4B-00A0C93EC93B": return "EFI System"; + case "21686148-6449-6E6F-744E-656564454649": return "BIOS Boot"; + case "D3BFE2DE-3DAF-11DF-BA40-E3A556D89593": return "Intel Fast Flash (iFFS)"; + case "F4019732-066E-4E12-8273-346C5641494F": return "Sony boot"; + case "BFBFAFE7-A34F-448A-9A5B-6213EB736C22": return "Lenovo boot"; + case "E3C9E316-0B5C-4DB8-817D-F92DF00215AE": return "Microsoft Reserved (MSR)"; + case "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7": return "Microsoft Basic data"; + case "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3": return "Logical Disk Manager (LDM) metadata"; + case "AF9B60A0-1431-4F62-BC68-3311714A69AD": return "Logical Disk Manager data"; + case "DE94BBA4-06D1-4D40-A16A-BFD50179D6AC": return "Windows Recovery Environment"; + case "37AFFC90-EF7D-4E96-91C3-2D7AE055B174": return "IBM General Parallel File System (GPFS)"; + case "E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D": return "Windows Storage Spaces"; + case "75894C1E-3AEB-11D3-B7C1-7B03A0000000": return "HP-UX Data"; + case "E2A1E728-32E3-11D6-A682-7B03A0000000": return "HP-UX Service"; + case "0FC63DAF-8483-4772-8E79-3D69D8477DE4": return "Linux filesystem"; + case "A19D880F-05FC-4D3B-A006-743F0F84911E": return "Linux RAID"; + case "44479540-F297-41B2-9AF7-D131D5F0458A": return "Linux Root (x86)"; + case "4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709": return "Linux Root (x86-64)"; + case "69DAD710-2CE4-4E3C-B16C-21A1D49ABED3": return "Linux Root (32-bit ARM)"; + case "B921B045-1DF0-41C3-AF44-4C6F280D3FAE": return "Linux Root (64-bit ARM/AArch64)"; + case "0657FD6D-A4AB-43C4-84E5-0933C84B4F4F": return "Linux Swap"; + case "E6D6D379-F507-44C2-A23C-238F2A3DF928": return "Logical Volume Manager (LVM)"; + case "933AC7E1-2EB4-4F13-B844-0E14E2AEF915": return "Linux /home"; + case "3B8F8425-20E0-4F3B-907F-1A25A76F98E8": return "Linux /srv"; + case "7FFEC5C9-2D00-49B7-8941-3EA10A5586B7": return "Plain dm-crypt"; + case "CA7D7CCB-63ED-4C53-861C-1742536059CC": return "LUKS"; + case "8DA63339-0007-60C0-C436-083AC8230908": return "Linux Reserved"; + case "83BD6B9D-7F41-11DC-BE0B-001560B84F0F": return "FreeBSD Boot"; + case "516E7CB4-6ECF-11D6-8FF8-00022D09712B": return "FreeBSD Data"; + case "516E7CB5-6ECF-11D6-8FF8-00022D09712B": return "FreeBSD Swap"; + case "516E7CB6-6ECF-11D6-8FF8-00022D09712B": return "FreeBSD UFS"; + case "516E7CB7-6ECF-11D6-8FF8-00022D09712B": return "FreeBSD UFS2"; + case "516E7CB8-6ECF-11D6-8FF8-00022D09712B": return "FreeBSD Vinum"; + case "516E7CBA-6ECF-11D6-8FF8-00022D09712B": return "FreeBSD ZFS"; + case "74BA7DD9-A689-11E1-BD04-00E081286ACF": return "FreeBSD nandfs"; + case "48465300-0000-11AA-AA11-00306543ECAC": return "Apple HFS"; + case "55465300-0000-11AA-AA11-00306543ECAC": return "Apple UFS"; + case "52414944-0000-11AA-AA11-00306543ECAC": return "Apple RAID"; + case "52414944-5F4F-11AA-AA11-00306543ECAC": return "Apple RAID, offline"; + case "426F6F74-0000-11AA-AA11-00306543ECAC": return "Apple Boot"; + case "4C616265-6C00-11AA-AA11-00306543ECAC": return "Apple Label"; + case "5265636F-7665-11AA-AA11-00306543ECAC": return "Apple TV Recovery"; + case "53746F72-6167-11AA-AA11-00306543ECAC": return "Apple Core Storage"; + case "6A82CB45-1DD2-11B2-99A6-080020736631": return "Solaris Boot"; + case "6A85CF4D-1DD2-11B2-99A6-080020736631": return "Solaris Root"; + case "6A87C46F-1DD2-11B2-99A6-080020736631": return "Solaris Swap"; + case "6A8B642B-1DD2-11B2-99A6-080020736631": return "Solaris Backup"; + case "6A898CC3-1DD2-11B2-99A6-080020736631": return "Solaris /usr or Apple ZFS"; + case "6A8EF2E9-1DD2-11B2-99A6-080020736631": return "Solaris /var"; + case "6A90BA39-1DD2-11B2-99A6-080020736631": return "Solaris /home"; + case "6A9283A5-1DD2-11B2-99A6-080020736631": return "Solaris Alternate sector"; case "6A945A3B-1DD2-11B2-99A6-080020736631": case "6A9630D1-1DD2-11B2-99A6-080020736631": case "6A980767-1DD2-11B2-99A6-080020736631": case "6A96237F-1DD2-11B2-99A6-080020736631": - case "6A8D2AC7-1DD2-11B2-99A6-080020736631": - return "Solaris Reserved"; - case "49F48D32-B10E-11DC-B99B-0019D1879648": - return "NetBSD Swap"; - case "49F48D5A-B10E-11DC-B99B-0019D1879648": - return "NetBSD FFS"; - case "49F48D82-B10E-11DC-B99B-0019D1879648": - return "NetBSD LFS"; - case "49F48DAA-B10E-11DC-B99B-0019D1879648": - return "NetBSD RAID"; - case "2DB519C4-B10F-11DC-B99B-0019D1879648": - return "NetBSD Concatenated"; - case "2DB519EC-B10F-11DC-B99B-0019D1879648": - return "NetBSD Encrypted"; - case "FE3A2A5D-4F32-41A7-B725-ACCC3285A309": - return "ChromeOS kernel"; - case "3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC": - return "ChromeOS rootfs"; - case "2E0A753D-9E48-43B0-8337-B15192CB1B5E": - return "ChromeOS future use"; - case "42465331-3BA3-10F1-802A-4861696B7521": - return "Haiku BFS"; - case "85D5E45E-237C-11E1-B4B3-E89A8F7FC3A7": - return "MidnightBSD Boot"; - case "85D5E45A-237C-11E1-B4B3-E89A8F7FC3A7": - return "MidnightBSD Data"; - case "85D5E45B-237C-11E1-B4B3-E89A8F7FC3A7": - return "MidnightBSD Swap"; - case "0394EF8B-237E-11E1-B4B3-E89A8F7FC3A7": - return "MidnightBSD UFS"; - case "85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7": - return "MidnightBSD Vinum"; - case "85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7": - return "MidnightBSD ZFS"; - case "45B0969E-9B03-4F30-B4C6-B4B80CEFF106": - return "Ceph Journal"; - case "45B0969E-9B03-4F30-B4C6-5EC00CEFF106": - return "Ceph dm-crypt Encrypted Journal"; - case "4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D": - return "Ceph OSD"; - case "4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D": - return "Ceph dm-crypt OSD"; - case "89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE": - return "Ceph disk in creation"; - case "89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE": - return "Ceph dm-crypt disk in creation"; - case "824CC7A0-36A8-11E3-890A-952519AD3F61": - return "OpenBSD Data"; - case "CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1": - return "QNX Power-safe (QNX6)"; - case "C91818F9-8025-47AF-89D2-F030D7000C2C": - return "Plan 9"; - case "9D275380-40AD-11DB-BF97-000C2911D1B8": - return "VMware vmkcore (coredump)"; - case "AA31E02A-400F-11DB-9590-000C2911D1B8": - return "VMware VMFS"; - case "9198EFFC-31C0-11DB-8F78-000C2911D1B8": - return "VMware Reserved"; - case "7412F7D5-A156-4B13-81DC-867174929325": - return "ONIE boot"; - case "D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149": - return "ONIE config"; - case "9E1A2D38-C612-4316-AA26-8B49521E5A8B": - return "PowerPC PReP boot"; - case "0311FC50-01CA-4725-AD77-9ADBB20ACE98": - return "Acronis Secure Zone"; - case "7C3457EF-0000-11AA-AA11-00306543ECAC": - return "Apple File System"; - case "9D087404-1CA5-11DC-8817-01301BB8A9F5": - return "DragonflyBSD Label"; - case "9D58FDBD-1CA5-11DC-8817-01301BB8A9F5": - return "DragonflyBSD Swap"; - case "9D94CE7C-1CA5-11DC-8817-01301BB8A9F5": - return "DragonflyBSD UFS"; - case "9DD4478F-1CA5-11DC-8817-01301BB8A9F5": - return "DragonflyBSD Vinum"; - case "DBD5211B-1CA5-11DC-8817-01301BB8A9F5": - return "DragonflyBSD CCD"; - case "3D48CE54-1D16-11DC-8817-01301BB8A9F5": - return "DragonflyBSD Label"; - case "BD215AB2-1D16-11DC-8696-01301BB8A9F5": - return "DragonflyBSD Legacy"; - case "61DC63AC-6E38-11DC-8513-01301BB8A9F5": - return "DragonflyBSD Hammer"; - case "5CBB9AD1-862D-11DC-A94D-01301BB8A9F5": - return "DragonflyBSD Hammer2"; - default: - return ""; + case "6A8D2AC7-1DD2-11B2-99A6-080020736631": return "Solaris Reserved"; + case "49F48D32-B10E-11DC-B99B-0019D1879648": return "NetBSD Swap"; + case "49F48D5A-B10E-11DC-B99B-0019D1879648": return "NetBSD FFS"; + case "49F48D82-B10E-11DC-B99B-0019D1879648": return "NetBSD LFS"; + case "49F48DAA-B10E-11DC-B99B-0019D1879648": return "NetBSD RAID"; + case "2DB519C4-B10F-11DC-B99B-0019D1879648": return "NetBSD Concatenated"; + case "2DB519EC-B10F-11DC-B99B-0019D1879648": return "NetBSD Encrypted"; + case "FE3A2A5D-4F32-41A7-B725-ACCC3285A309": return "ChromeOS kernel"; + case "3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC": return "ChromeOS rootfs"; + case "2E0A753D-9E48-43B0-8337-B15192CB1B5E": return "ChromeOS future use"; + case "42465331-3BA3-10F1-802A-4861696B7521": return "Haiku BFS"; + case "85D5E45E-237C-11E1-B4B3-E89A8F7FC3A7": return "MidnightBSD Boot"; + case "85D5E45A-237C-11E1-B4B3-E89A8F7FC3A7": return "MidnightBSD Data"; + case "85D5E45B-237C-11E1-B4B3-E89A8F7FC3A7": return "MidnightBSD Swap"; + case "0394EF8B-237E-11E1-B4B3-E89A8F7FC3A7": return "MidnightBSD UFS"; + case "85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7": return "MidnightBSD Vinum"; + case "85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7": return "MidnightBSD ZFS"; + case "45B0969E-9B03-4F30-B4C6-B4B80CEFF106": return "Ceph Journal"; + case "45B0969E-9B03-4F30-B4C6-5EC00CEFF106": return "Ceph dm-crypt Encrypted Journal"; + case "4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D": return "Ceph OSD"; + case "4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D": return "Ceph dm-crypt OSD"; + case "89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE": return "Ceph disk in creation"; + case "89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE": return "Ceph dm-crypt disk in creation"; + case "824CC7A0-36A8-11E3-890A-952519AD3F61": return "OpenBSD Data"; + case "CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1": return "QNX Power-safe (QNX6)"; + case "C91818F9-8025-47AF-89D2-F030D7000C2C": return "Plan 9"; + case "9D275380-40AD-11DB-BF97-000C2911D1B8": return "VMware vmkcore (coredump)"; + case "AA31E02A-400F-11DB-9590-000C2911D1B8": return "VMware VMFS"; + case "9198EFFC-31C0-11DB-8F78-000C2911D1B8": return "VMware Reserved"; + case "7412F7D5-A156-4B13-81DC-867174929325": return "ONIE boot"; + case "D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149": return "ONIE config"; + case "9E1A2D38-C612-4316-AA26-8B49521E5A8B": return "PowerPC PReP boot"; + case "0311FC50-01CA-4725-AD77-9ADBB20ACE98": return "Acronis Secure Zone"; + case "7C3457EF-0000-11AA-AA11-00306543ECAC": return "Apple File System"; + case "9D087404-1CA5-11DC-8817-01301BB8A9F5": return "DragonflyBSD Label"; + case "9D58FDBD-1CA5-11DC-8817-01301BB8A9F5": return "DragonflyBSD Swap"; + case "9D94CE7C-1CA5-11DC-8817-01301BB8A9F5": return "DragonflyBSD UFS"; + case "9DD4478F-1CA5-11DC-8817-01301BB8A9F5": return "DragonflyBSD Vinum"; + case "DBD5211B-1CA5-11DC-8817-01301BB8A9F5": return "DragonflyBSD CCD"; + case "3D48CE54-1D16-11DC-8817-01301BB8A9F5": return "DragonflyBSD Label"; + case "BD215AB2-1D16-11DC-8696-01301BB8A9F5": return "DragonflyBSD Legacy"; + case "61DC63AC-6E38-11DC-8513-01301BB8A9F5": return "DragonflyBSD Hammer"; + case "5CBB9AD1-862D-11DC-A94D-01301BB8A9F5": return "DragonflyBSD Hammer2"; + default: return ""; } } @@ -428,9 +321,7 @@ namespace DiscImageChef.PartPlugins public ulong startLBA; public ulong endLBA; public ulong attributes; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 36)] - public string name; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 36)] public string name; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Partitions/Human68k.cs b/DiscImageChef.Partitions/Human68k.cs index e00dd1ca..70f2d487 100644 --- a/DiscImageChef.Partitions/Human68k.cs +++ b/DiscImageChef.Partitions/Human68k.cs @@ -59,8 +59,7 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Human68k plugin", "sectorSize = {0}", imagePlugin.GetSectorSize()); - if(sectorOffset + 4 >= imagePlugin.GetSectors()) - return false; + if(sectorOffset + 4 >= imagePlugin.GetSectors()) return false; switch(imagePlugin.GetSectorSize()) { @@ -76,16 +75,14 @@ namespace DiscImageChef.PartPlugins sector = imagePlugin.ReadSector(2 + sectorOffset); sectsPerUnit = 1; break; - default: - return false; + default: return false; } X68kTable table = BigEndianMarshal.ByteArrayToStructureBigEndian<X68kTable>(sector); DicConsole.DebugWriteLine("Human68k plugin", "table.magic = {0:X4}", table.magic); - if(table.magic != X68kMagic) - return false; + if(table.magic != X68kMagic) return false; for(int i = 0; i < table.entries.Length; i++) table.entries[i] = BigEndianMarshal.SwapStructureMembersEndian(table.entries[i]); @@ -98,10 +95,12 @@ namespace DiscImageChef.PartPlugins foreach(X68kEntry entry in table.entries) { - DicConsole.DebugWriteLine("Human68k plugin", "entry.name = {0}", StringHandlers.CToString(entry.name, Encoding.GetEncoding(932))); + DicConsole.DebugWriteLine("Human68k plugin", "entry.name = {0}", + StringHandlers.CToString(entry.name, Encoding.GetEncoding(932))); DicConsole.DebugWriteLine("Human68k plugin", "entry.stateStart = {0}", entry.stateStart); DicConsole.DebugWriteLine("Human68k plugin", "entry.length = {0}", entry.length); - DicConsole.DebugWriteLine("Human68k plugin", "sectsPerUnit = {0} {1}", sectsPerUnit, imagePlugin.GetSectorSize()); + DicConsole.DebugWriteLine("Human68k plugin", "sectsPerUnit = {0} {1}", sectsPerUnit, + imagePlugin.GetSectorSize()); Partition part = new Partition { @@ -130,15 +129,13 @@ namespace DiscImageChef.PartPlugins public uint size; public uint size2; public uint unknown; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public X68kEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public X68kEntry[] entries; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct X68kEntry { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] name; public uint stateStart; public uint length; } diff --git a/DiscImageChef.Partitions/MBR.cs b/DiscImageChef.Partitions/MBR.cs index d0b6c2d8..529a92be 100644 --- a/DiscImageChef.Partitions/MBR.cs +++ b/DiscImageChef.Partitions/MBR.cs @@ -50,14 +50,14 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("5E8A34E8-4F1A-59E6-4BF7-7EA647063A76"); } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions, ulong sectorOffset) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, + out List<CommonTypes.Partition> partitions, ulong sectorOffset) { ulong counter = 0; partitions = new List<CommonTypes.Partition>(); - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; uint sectorSize = imagePlugin.GetSectorSize(); // Divider of sector size in MBR between real sector size @@ -72,19 +72,28 @@ namespace DiscImageChef.PartPlugins byte[] sector = imagePlugin.ReadSector(sectorOffset); GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned); - MasterBootRecord mbr = (MasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(MasterBootRecord)); - TimedMasterBootRecord mbr_time = (TimedMasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(TimedMasterBootRecord)); - SerializedMasterBootRecord mbr_serial = (SerializedMasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SerializedMasterBootRecord)); - ModernMasterBootRecord mbr_modern = (ModernMasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ModernMasterBootRecord)); - NecMasterBootRecord mbr_nec = (NecMasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(NecMasterBootRecord)); - DiskManagerMasterBootRecord mbr_ontrack = (DiskManagerMasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DiskManagerMasterBootRecord)); + MasterBootRecord mbr = + (MasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(MasterBootRecord)); + TimedMasterBootRecord mbr_time = + (TimedMasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), + typeof(TimedMasterBootRecord)); + SerializedMasterBootRecord mbr_serial = + (SerializedMasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), + typeof(SerializedMasterBootRecord)); + ModernMasterBootRecord mbr_modern = + (ModernMasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), + typeof(ModernMasterBootRecord)); + NecMasterBootRecord mbr_nec = + (NecMasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(NecMasterBootRecord)); + DiskManagerMasterBootRecord mbr_ontrack = + (DiskManagerMasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), + typeof(DiskManagerMasterBootRecord)); handle.Free(); DicConsole.DebugWriteLine("MBR plugin", "xmlmedia = {0}", imagePlugin.ImageInfo.xmlMediaType); DicConsole.DebugWriteLine("MBR plugin", "mbr.magic = {0:X4}", mbr.magic); - if(mbr.magic != MBR_Magic) - return false; // Not MBR + if(mbr.magic != MBR_Magic) return false; // Not MBR byte[] hdrBytes = imagePlugin.ReadSector(1 + sectorOffset); @@ -92,26 +101,21 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("MBR Plugin", "gpt.signature = 0x{0:X16}", signature); - if(signature == GptMagic) - return false; + if(signature == GptMagic) return false; if(signature != GptMagic && imagePlugin.ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) { hdrBytes = imagePlugin.ReadSector(sectorOffset); signature = BitConverter.ToUInt64(hdrBytes, 512); DicConsole.DebugWriteLine("MBR Plugin", "gpt.signature @ 0x200 = 0x{0:X16}", signature); - if(signature == GptMagic) - return false; + if(signature == GptMagic) return false; } MBRPartitionEntry[] entries; - if(mbr_ontrack.dm_magic == DM_Magic) - entries = mbr_ontrack.entries; - else if(mbr_nec.nec_magic == NEC_Magic) - entries = mbr_nec.entries; - else - entries = mbr.entries; + if(mbr_ontrack.dm_magic == DM_Magic) entries = mbr_ontrack.entries; + else if(mbr_nec.nec_magic == NEC_Magic) entries = mbr_nec.entries; + else entries = mbr.entries; foreach(MBRPartitionEntry entry in entries) { @@ -128,30 +132,35 @@ namespace DiscImageChef.PartPlugins bool extended = false; bool minix = false; - if(entry.status != 0x00 && entry.status != 0x80) - return false; // Maybe a FAT filesystem + if(entry.status != 0x00 && entry.status != 0x80) return false; // Maybe a FAT filesystem + valid &= entry.type != 0x00; - if(entry.type == 0x05 || entry.type == 0x0F || entry.type == 0x15 || entry.type == 0x1F || entry.type == 0x85 || - entry.type == 0x91 || entry.type == 0x9B || entry.type == 0xC5 || entry.type == 0xCF || entry.type == 0xD5) + if(entry.type == 0x05 || entry.type == 0x0F || entry.type == 0x15 || entry.type == 0x1F || + entry.type == 0x85 || entry.type == 0x91 || entry.type == 0x9B || entry.type == 0xC5 || + entry.type == 0xCF || entry.type == 0xD5) { valid = false; extended = true; // Extended partition } minix |= entry.type == 0x81 || entry.type == 0x80; // MINIX partition - valid &= entry.lba_start != 0 || entry.lba_sectors != 0 || entry.start_cylinder != 0 || entry.start_head != 0 || entry.start_sector != 0 || entry.end_cylinder != 0 || entry.end_head != 0 || entry.end_sector != 0; + valid &= entry.lba_start != 0 || entry.lba_sectors != 0 || entry.start_cylinder != 0 || + entry.start_head != 0 || entry.start_sector != 0 || entry.end_cylinder != 0 || + entry.end_head != 0 || entry.end_sector != 0; if(entry.lba_start == 0 && entry.lba_sectors == 0 && valid) { - lba_start = Helpers.CHS.ToLBA(start_cylinder, entry.start_head, start_sector, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack); - lba_sectors = Helpers.CHS.ToLBA(end_cylinder, entry.end_head, entry.end_sector, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack) - lba_start; + lba_start = Helpers.CHS.ToLBA(start_cylinder, entry.start_head, start_sector, + imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack); + lba_sectors = Helpers.CHS.ToLBA(end_cylinder, entry.end_head, entry.end_sector, + imagePlugin.ImageInfo.heads, + imagePlugin.ImageInfo.sectorsPerTrack) - lba_start; } // For optical media lba_start /= divider; lba_sectors /= divider; - if(minix && lba_start == sectorOffset) - minix = false; + if(minix && lba_start == sectorOffset) minix = false; if(lba_start > imagePlugin.GetSectors()) { @@ -181,24 +190,23 @@ namespace DiscImageChef.PartPlugins if(valid && minix) // Let's mix the fun { - if(GetMinix(imagePlugin, lba_start, divider, sectorOffset, sectorSize, out List<Partition> mnx_parts)) - partitions.AddRange(mnx_parts); - else - minix = false; + if(GetMinix(imagePlugin, lba_start, divider, sectorOffset, sectorSize, + out List<Partition> mnx_parts)) partitions.AddRange(mnx_parts); + else minix = false; } if(valid && !minix) { CommonTypes.Partition part = new CommonTypes.Partition(); - if((lba_start > 0 || imagePlugin.ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) && lba_sectors > 0) + if((lba_start > 0 || imagePlugin.ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) && + lba_sectors > 0) { part.Start = lba_start + sectorOffset; part.Length = lba_sectors; part.Offset = part.Start * sectorSize; part.Size = part.Length * sectorSize; } - else - valid = false; + else valid = false; if(valid) { @@ -226,13 +234,14 @@ namespace DiscImageChef.PartPlugins sector = imagePlugin.ReadSector(lba_start); handle = GCHandle.Alloc(sector, GCHandleType.Pinned); - ExtendedBootRecord ebr = (ExtendedBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ExtendedBootRecord)); + ExtendedBootRecord ebr = + (ExtendedBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), + typeof(ExtendedBootRecord)); handle.Free(); DicConsole.DebugWriteLine("MBR plugin", "ebr.magic == MBR_Magic = {0}", ebr.magic == MBR_Magic); - if(ebr.magic != MBR_Magic) - break; + if(ebr.magic != MBR_Magic) break; ulong next_start = 0; @@ -240,7 +249,8 @@ namespace DiscImageChef.PartPlugins { bool ext_valid = true; start_sector = (byte)(ebr_entry.start_sector & 0x3F); - start_cylinder = (ushort)(((ebr_entry.start_sector & 0xC0) << 2) | ebr_entry.start_cylinder); + start_cylinder = + (ushort)(((ebr_entry.start_sector & 0xC0) << 2) | ebr_entry.start_cylinder); end_sector = (byte)(ebr_entry.end_sector & 0x3F); end_cylinder = (ushort)(((ebr_entry.end_sector & 0xC0) << 2) | ebr_entry.end_cylinder); ulong ext_start = ebr_entry.lba_start; @@ -261,12 +271,19 @@ namespace DiscImageChef.PartPlugins // Let's start the fun... ext_valid &= ebr_entry.status == 0x00 || ebr_entry.status == 0x80; ext_valid &= ebr_entry.type != 0x00; - ext_valid &= ebr_entry.lba_start != 0 || ebr_entry.lba_sectors != 0 || ebr_entry.start_cylinder != 0 || ebr_entry.start_head != 0 || - ebr_entry.start_sector != 0 || ebr_entry.end_cylinder != 0 || ebr_entry.end_head != 0 || ebr_entry.end_sector != 0; + ext_valid &= ebr_entry.lba_start != 0 || ebr_entry.lba_sectors != 0 || + ebr_entry.start_cylinder != 0 || ebr_entry.start_head != 0 || + ebr_entry.start_sector != 0 || ebr_entry.end_cylinder != 0 || + ebr_entry.end_head != 0 || ebr_entry.end_sector != 0; if(ebr_entry.lba_start == 0 && ebr_entry.lba_sectors == 0 && ext_valid) { - ext_start = Helpers.CHS.ToLBA(start_cylinder, ebr_entry.start_head, start_sector, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack); - ext_sectors = Helpers.CHS.ToLBA(end_cylinder, ebr_entry.end_head, ebr_entry.end_sector, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack) - ext_start; + ext_start = Helpers.CHS.ToLBA(start_cylinder, ebr_entry.start_head, start_sector, + imagePlugin.ImageInfo.heads, + imagePlugin.ImageInfo.sectorsPerTrack); + ext_sectors = + Helpers.CHS.ToLBA(end_cylinder, ebr_entry.end_head, ebr_entry.end_sector, + imagePlugin.ImageInfo.heads, + imagePlugin.ImageInfo.sectorsPerTrack) - ext_start; } ext_minix |= (ebr_entry.type == 0x81 || ebr_entry.type == 0x80); @@ -277,8 +294,10 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("MBR plugin", "ext_start {0}", ext_start); DicConsole.DebugWriteLine("MBR plugin", "ext_sectors {0}", ext_sectors); - if(ebr_entry.type == 0x05 || ebr_entry.type == 0x0F || ebr_entry.type == 0x15 || ebr_entry.type == 0x1F || ebr_entry.type == 0x85 || - ebr_entry.type == 0x91 || ebr_entry.type == 0x9B || ebr_entry.type == 0xC5 || ebr_entry.type == 0xCF || ebr_entry.type == 0xD5) + if(ebr_entry.type == 0x05 || ebr_entry.type == 0x0F || ebr_entry.type == 0x15 || + ebr_entry.type == 0x1F || ebr_entry.type == 0x85 || ebr_entry.type == 0x91 || + ebr_entry.type == 0x9B || ebr_entry.type == 0xC5 || ebr_entry.type == 0xCF || + ebr_entry.type == 0xD5) { ext_valid = false; next_start = chain_start + ext_start; @@ -293,10 +312,9 @@ namespace DiscImageChef.PartPlugins if(ext_valid && ext_minix) // Let's mix the fun { - if(GetMinix(imagePlugin, lba_start, divider, sectorOffset, sectorSize, out List<Partition> mnx_parts)) - partitions.AddRange(mnx_parts); - else - ext_minix = false; + if(GetMinix(imagePlugin, lba_start, divider, sectorOffset, sectorSize, + out List<Partition> mnx_parts)) partitions.AddRange(mnx_parts); + else ext_minix = false; } if(ext_valid && !ext_minix) @@ -309,8 +327,7 @@ namespace DiscImageChef.PartPlugins part.Offset = part.Start * sectorSize; part.Size = part.Length * sectorSize; } - else - ext_valid = false; + else ext_valid = false; if(ext_valid) { @@ -338,20 +355,21 @@ namespace DiscImageChef.PartPlugins return partitions.Count != 0; } - static bool GetMinix(ImagePlugin imagePlugin, ulong start, ulong divider, ulong sectorOffset, uint sectorSize, out List<Partition> partitions) + static bool GetMinix(ImagePlugin imagePlugin, ulong start, ulong divider, ulong sectorOffset, uint sectorSize, + out List<Partition> partitions) { partitions = new List<Partition>(); byte[] sector = imagePlugin.ReadSector(start); GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned); - ExtendedBootRecord mnx = (ExtendedBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ExtendedBootRecord)); + ExtendedBootRecord mnx = + (ExtendedBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ExtendedBootRecord)); handle.Free(); DicConsole.DebugWriteLine("MBR plugin", "mnx.magic == MBR_Magic = {0}", mnx.magic == MBR_Magic); - if(mnx.magic != MBR_Magic) - return false; + if(mnx.magic != MBR_Magic) return false; bool any_mnx = false; @@ -378,12 +396,16 @@ namespace DiscImageChef.PartPlugins mnx_valid &= mnx_entry.status == 0x00 || mnx_entry.status == 0x80; mnx_valid &= mnx_entry.type == 0x81 || mnx_entry.type == 0x80; - mnx_valid &= mnx_entry.lba_start != 0 || mnx_entry.lba_sectors != 0 || mnx_entry.start_cylinder != 0 || mnx_entry.start_head != 0 || - mnx_entry.start_sector != 0 || mnx_entry.end_cylinder != 0 || mnx_entry.end_head != 0 || mnx_entry.end_sector != 0; + mnx_valid &= mnx_entry.lba_start != 0 || mnx_entry.lba_sectors != 0 || mnx_entry.start_cylinder != 0 || + mnx_entry.start_head != 0 || mnx_entry.start_sector != 0 || mnx_entry.end_cylinder != 0 || + mnx_entry.end_head != 0 || mnx_entry.end_sector != 0; if(mnx_entry.lba_start == 0 && mnx_entry.lba_sectors == 0 && mnx_valid) { - mnx_start = Helpers.CHS.ToLBA(start_cylinder, mnx_entry.start_head, start_sector, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack); - mnx_sectors = Helpers.CHS.ToLBA(end_cylinder, mnx_entry.end_head, mnx_entry.end_sector, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack) - mnx_start; + mnx_start = Helpers.CHS.ToLBA(start_cylinder, mnx_entry.start_head, start_sector, + imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack); + mnx_sectors = Helpers.CHS.ToLBA(end_cylinder, mnx_entry.end_head, mnx_entry.end_sector, + imagePlugin.ImageInfo.heads, + imagePlugin.ImageInfo.sectorsPerTrack) - mnx_start; } // For optical media @@ -403,8 +425,7 @@ namespace DiscImageChef.PartPlugins part.Offset = part.Start * sectorSize; part.Size = part.Length * sectorSize; } - else - mnx_valid = false; + else mnx_valid = false; if(mnx_valid) { @@ -422,13 +443,15 @@ namespace DiscImageChef.PartPlugins return any_mnx; } - static readonly string[] MBRTypes = { + static readonly string[] MBRTypes = + { // 0x00 "Empty", "FAT12", "XENIX root", "XENIX /usr", // 0x04 "FAT16 < 32 MiB", "Extended", "FAT16", "IFS (HPFS/NTFS)", // 0x08 - "AIX boot, OS/2, Commodore DOS", "AIX data, Coherent, QNX", "Coherent swap, OPUS, OS/2 Boot Manager", "FAT32", + "AIX boot, OS/2, Commodore DOS", "AIX data, Coherent, QNX", "Coherent swap, OPUS, OS/2 Boot Manager", + "FAT32", // 0x0C "FAT32 (LBA)", "Unknown", "FAT16 (LBA)", "Extended (LBA)", // 0x10 @@ -526,11 +549,13 @@ namespace DiscImageChef.PartPlugins // 0xC8 "DR-DOS reserved", "DR-DOS reserved", "DR-DOS reserved", "DR-DOS secured FAT32", // 0xCC - "DR-DOS secured FAT32 (LBA)", "DR-DOS reserved", "DR-DOS secured FAT16 (LBA)", "DR-DOS secured extended (LBA)", + "DR-DOS secured FAT32 (LBA)", "DR-DOS reserved", "DR-DOS secured FAT16 (LBA)", + "DR-DOS secured extended (LBA)", // 0xD0 "Multiuser DOS secured FAT12", "Multiuser DOS secured FAT12", "Unknown", "Unknown", // 0xD4 - "Multiuser DOS secured FAT16 < 32 MiB", "Multiuser DOS secured extended", "Multiuser DOS secured FAT16", "Unknown", + "Multiuser DOS secured FAT16 < 32 MiB", "Multiuser DOS secured extended", "Multiuser DOS secured FAT16", + "Unknown", // 0xD8 "CP/M", "Unknown", "Filesystem-less data", "CP/M, CCP/M, CTOS", // 0xDC @@ -566,11 +591,9 @@ namespace DiscImageChef.PartPlugins public struct MasterBootRecord { /// <summary>Boot code</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 446)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 446)] public byte[] boot_code; /// <summary>Partitions</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public MBRPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public MBRPartitionEntry[] entries; /// <summary><see cref="MBR_Magic"/></summary> public ushort magic; } @@ -580,11 +603,9 @@ namespace DiscImageChef.PartPlugins public struct ExtendedBootRecord { /// <summary>Boot code, almost always unused</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 446)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 446)] public byte[] boot_code; /// <summary>Partitions or pointers</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public MBRPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public MBRPartitionEntry[] entries; /// <summary><see cref="MBR_Magic"/></summary> public ushort magic; } @@ -593,8 +614,7 @@ namespace DiscImageChef.PartPlugins public struct TimedMasterBootRecord { /// <summary>Boot code</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 218)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 218)] public byte[] boot_code; /// <summary>Set to 0</summary> public ushort zero; /// <summary>Original physical drive</summary> @@ -606,11 +626,9 @@ namespace DiscImageChef.PartPlugins /// <summary>Disk timestamp, hours</summary> public byte hours; /// <summary>Boot code, continuation</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 222)] - public byte[] boot_code2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 222)] public byte[] boot_code2; /// <summary>Partitions</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public MBRPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public MBRPartitionEntry[] entries; /// <summary><see cref="MBR_Magic"/></summary> public ushort magic; } @@ -619,15 +637,13 @@ namespace DiscImageChef.PartPlugins public struct SerializedMasterBootRecord { /// <summary>Boot code</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 440)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 440)] public byte[] boot_code; /// <summary>Disk serial number</summary> public uint serial; /// <summary>Set to 0</summary> public ushort zero; /// <summary>Partitions</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public MBRPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public MBRPartitionEntry[] entries; /// <summary><see cref="MBR_Magic"/></summary> public ushort magic; } @@ -636,8 +652,7 @@ namespace DiscImageChef.PartPlugins public struct ModernMasterBootRecord { /// <summary>Boot code</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 218)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 218)] public byte[] boot_code; /// <summary>Set to 0</summary> public ushort zero; /// <summary>Original physical drive</summary> @@ -649,15 +664,13 @@ namespace DiscImageChef.PartPlugins /// <summary>Disk timestamp, hours</summary> public byte hours; /// <summary>Boot code, continuation</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 216)] - public byte[] boot_code2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 216)] public byte[] boot_code2; /// <summary>Disk serial number</summary> public uint serial; /// <summary>Set to 0</summary> public ushort zero2; /// <summary>Partitions</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public MBRPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public MBRPartitionEntry[] entries; /// <summary><see cref="MBR_Magic"/></summary> public ushort magic; } @@ -666,13 +679,11 @@ namespace DiscImageChef.PartPlugins public struct NecMasterBootRecord { /// <summary>Boot code</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 380)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 380)] public byte[] boot_code; /// <summary><see cref="NEC_Magic"/></summary> public ushort nec_magic; /// <summary>Partitions</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public MBRPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public MBRPartitionEntry[] entries; /// <summary><see cref="MBR_Magic"/></summary> public ushort magic; } @@ -681,13 +692,11 @@ namespace DiscImageChef.PartPlugins public struct DiskManagerMasterBootRecord { /// <summary>Boot code</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] - public byte[] boot_code; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] public byte[] boot_code; /// <summary><see cref="DM_Magic"/></summary> public ushort dm_magic; /// <summary>Partitions</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public MBRPartitionEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public MBRPartitionEntry[] entries; /// <summary><see cref="MBR_Magic"/></summary> public ushort magic; } diff --git a/DiscImageChef.Partitions/NeXT.cs b/DiscImageChef.Partitions/NeXT.cs index 4fd21af6..ec8fdcdf 100644 --- a/DiscImageChef.Partitions/NeXT.cs +++ b/DiscImageChef.Partitions/NeXT.cs @@ -50,6 +50,7 @@ namespace DiscImageChef.PartPlugins const ushort disktabStart = 0xB4; // 180 const ushort disktabEntrySize = 0x2C; + // 44 public NeXTDisklabel() { @@ -57,7 +58,8 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9"); } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions, ulong sectorOffset) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, + out List<CommonTypes.Partition> partitions, ulong sectorOffset) { bool magic_found = false; byte[] label_sector; @@ -65,10 +67,8 @@ namespace DiscImageChef.PartPlugins uint magic; uint sector_size; - if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) - sector_size = 2048; - else - sector_size = imagePlugin.GetSectorSize(); + if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) sector_size = 2048; + else sector_size = imagePlugin.GetSectorSize(); partitions = new List<CommonTypes.Partition>(); @@ -76,11 +76,10 @@ namespace DiscImageChef.PartPlugins ulong label_position = 0; - foreach(ulong i in new ulong[]{0, 4, 15, 16}) + foreach(ulong i in new ulong[] {0, 4, 15, 16}) { - if(i + sectorOffset >= imagePlugin.GetSectors()) - break; - + if(i + sectorOffset >= imagePlugin.GetSectors()) break; + label_sector = imagePlugin.ReadSector(i + sectorOffset); magic = BigEndianBitConverter.ToUInt32(label_sector, 0x00); if(magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3) @@ -91,12 +90,10 @@ namespace DiscImageChef.PartPlugins } } - if(!magic_found) - return false; + if(!magic_found) return false; uint sectors_to_read = 7680 / imagePlugin.ImageInfo.sectorSize; - if(7680 % imagePlugin.ImageInfo.sectorSize > 0) - sectors_to_read++; + if(7680 % imagePlugin.ImageInfo.sectorSize > 0) sectors_to_read++; label_sector = imagePlugin.ReadSectors(label_position, sectors_to_read); @@ -109,11 +106,14 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_version = 0x{0:X8}", label.dl_version); DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_label_blkno = {0}", label.dl_label_blkno); DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_size = {0}", label.dl_size); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_label = \"{0}\"", StringHandlers.CToString(label.dl_label)); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_label = \"{0}\"", + StringHandlers.CToString(label.dl_label)); DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_flags = {0}", label.dl_flags); DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_tag = 0x{0:X8}", label.dl_tag); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_name = \"{0}\"", StringHandlers.CToString(label.dl_dt.d_name)); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_type = \"{0}\"", StringHandlers.CToString(label.dl_dt.d_type)); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_name = \"{0}\"", + StringHandlers.CToString(label.dl_dt.d_name)); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_type = \"{0}\"", + StringHandlers.CToString(label.dl_dt.d_type)); DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_secsize = {0}", label.dl_dt.d_secsize); DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_ntracks = {0}", label.dl_dt.d_ntracks); DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_nsectors = {0}", label.dl_dt.d_nsectors); @@ -125,10 +125,14 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_ag_size = {0}", label.dl_dt.d_ag_size); DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_ag_alts = {0}", label.dl_dt.d_ag_alts); DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_ag_off = {0}", label.dl_dt.d_ag_off); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_boot0_blkno[0] = {0}", label.dl_dt.d_boot0_blkno[0]); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_boot0_blkno[1] = {0}", label.dl_dt.d_boot0_blkno[1]); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_bootfile = \"{0}\"", StringHandlers.CToString(label.dl_dt.d_bootfile)); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_hostname = \"{0}\"", StringHandlers.CToString(label.dl_dt.d_hostname)); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_boot0_blkno[0] = {0}", + label.dl_dt.d_boot0_blkno[0]); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_boot0_blkno[1] = {0}", + label.dl_dt.d_boot0_blkno[1]); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_bootfile = \"{0}\"", + StringHandlers.CToString(label.dl_dt.d_bootfile)); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_hostname = \"{0}\"", + StringHandlers.CToString(label.dl_dt.d_hostname)); DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_rootpartition = {0}", label.dl_dt.d_rootpartition); DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_rwpartition = {0}", label.dl_dt.d_rwpartition); @@ -137,32 +141,47 @@ namespace DiscImageChef.PartPlugins byte[] part_b = new byte[44]; Array.Copy(label_sector, 44 + 146 + 44 * i, part_b, 0, 44); label.dl_dt.d_partitions[i] = BigEndianMarshal.ByteArrayToStructureBigEndian<NeXTEntry>(part_b); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_base = {1}", i, label.dl_dt.d_partitions[i].p_base); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_size = {1}", i, label.dl_dt.d_partitions[i].p_size); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_bsize = {1}", i, label.dl_dt.d_partitions[i].p_bsize); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_fsize = {1}", i, label.dl_dt.d_partitions[i].p_fsize); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_opt = {1}", i, label.dl_dt.d_partitions[i].p_opt); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_cpg = {1}", i, label.dl_dt.d_partitions[i].p_cpg); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_density = {1}", i, label.dl_dt.d_partitions[i].p_density); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_minfree = {1}", i, label.dl_dt.d_partitions[i].p_minfree); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_newfs = {1}", i, label.dl_dt.d_partitions[i].p_newfs); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_mountpt = \"{1}\"", i, StringHandlers.CToString(label.dl_dt.d_partitions[i].p_mountpt)); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_automnt = {1}", i, label.dl_dt.d_partitions[i].p_automnt); - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_type = \"{1}\"", i, StringHandlers.CToString(label.dl_dt.d_partitions[i].p_type)); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_base = {1}", i, + label.dl_dt.d_partitions[i].p_base); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_size = {1}", i, + label.dl_dt.d_partitions[i].p_size); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_bsize = {1}", i, + label.dl_dt.d_partitions[i].p_bsize); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_fsize = {1}", i, + label.dl_dt.d_partitions[i].p_fsize); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_opt = {1}", i, + label.dl_dt.d_partitions[i].p_opt); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_cpg = {1}", i, + label.dl_dt.d_partitions[i].p_cpg); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_density = {1}", i, + label.dl_dt.d_partitions[i].p_density); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_minfree = {1}", i, + label.dl_dt.d_partitions[i].p_minfree); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_newfs = {1}", i, + label.dl_dt.d_partitions[i].p_newfs); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_mountpt = \"{1}\"", i, + StringHandlers.CToString(label.dl_dt.d_partitions[i].p_mountpt)); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_automnt = {1}", i, + label.dl_dt.d_partitions[i].p_automnt); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_type = \"{1}\"", i, + StringHandlers.CToString(label.dl_dt.d_partitions[i].p_type)); - if(label.dl_dt.d_partitions[i].p_size > 0 && label.dl_dt.d_partitions[i].p_base >= 0 && label.dl_dt.d_partitions[i].p_bsize >= 0) + if(label.dl_dt.d_partitions[i].p_size > 0 && label.dl_dt.d_partitions[i].p_base >= 0 && + label.dl_dt.d_partitions[i].p_bsize >= 0) { StringBuilder sb = new StringBuilder(); CommonTypes.Partition part = new CommonTypes.Partition() { Size = (ulong)(label.dl_dt.d_partitions[i].p_size * label.dl_dt.d_secsize), - Offset = (ulong)((label.dl_dt.d_partitions[i].p_base + label.dl_dt.d_front) * label.dl_dt.d_secsize), + Offset = + (ulong)((label.dl_dt.d_partitions[i].p_base + label.dl_dt.d_front) * label.dl_dt.d_secsize), Type = StringHandlers.CToString(label.dl_dt.d_partitions[i].p_type), Sequence = (ulong)i, Name = StringHandlers.CToString(label.dl_dt.d_partitions[i].p_mountpt), Length = (ulong)((label.dl_dt.d_partitions[i].p_size * label.dl_dt.d_secsize) / sector_size), - Start = (ulong)(((label.dl_dt.d_partitions[i].p_base + label.dl_dt.d_front) * label.dl_dt.d_secsize) / sector_size), + Start = (ulong)(((label.dl_dt.d_partitions[i].p_base + label.dl_dt.d_front) * + label.dl_dt.d_secsize) / sector_size), Scheme = Name }; @@ -171,20 +190,19 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("NeXT Plugin", "Partition bigger than device, reducing..."); part.Length = imagePlugin.ImageInfo.sectors - part.Start; part.Size = part.Length * sector_size; - DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_size = {1}", i, part.Length); + DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_size = {1}", i, + part.Length); } sb.AppendFormat("{0} bytes per block", label.dl_dt.d_partitions[i].p_bsize).AppendLine(); sb.AppendFormat("{0} bytes per fragment", label.dl_dt.d_partitions[i].p_fsize).AppendLine(); - if(label.dl_dt.d_partitions[i].p_opt == 's') - sb.AppendLine("Space optimized"); - else if(label.dl_dt.d_partitions[i].p_opt == 't') - sb.AppendLine("Time optimized"); - else - sb.AppendFormat("Unknown optimization {0:X2}", label.dl_dt.d_partitions[i].p_opt).AppendLine(); + if(label.dl_dt.d_partitions[i].p_opt == 's') sb.AppendLine("Space optimized"); + else if(label.dl_dt.d_partitions[i].p_opt == 't') sb.AppendLine("Time optimized"); + else sb.AppendFormat("Unknown optimization {0:X2}", label.dl_dt.d_partitions[i].p_opt).AppendLine(); sb.AppendFormat("{0} cylinders per group", label.dl_dt.d_partitions[i].p_cpg).AppendLine(); sb.AppendFormat("{0} bytes per inode", label.dl_dt.d_partitions[i].p_density).AppendLine(); - sb.AppendFormat("{0}% of space must be free at minimum", label.dl_dt.d_partitions[i].p_minfree).AppendLine(); + sb.AppendFormat("{0}% of space must be free at minimum", label.dl_dt.d_partitions[i].p_minfree) + .AppendLine(); if(label.dl_dt.d_partitions[i].p_newfs != 1) sb.AppendLine("Filesystem should be formatted at start"); if(label.dl_dt.d_partitions[i].p_automnt == 1) @@ -212,8 +230,7 @@ namespace DiscImageChef.PartPlugins /// <summary>Device size in blocks</summary> public int dl_size; /// <summary>Device name</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] - public byte[] dl_label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] dl_label; /// <summary>Device flags</summary> public uint dl_flags; /// <summary>Device tag</summary> @@ -237,8 +254,7 @@ namespace DiscImageChef.PartPlugins /// <summary>Device size in blocks</summary> public int dl_size; /// <summary>Device name</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] - public byte[] dl_label; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] dl_label; /// <summary>Device flags</summary> public uint dl_flags; /// <summary>Device tag</summary> @@ -246,8 +262,7 @@ namespace DiscImageChef.PartPlugins /// <summary>Device info and partitions</summary> public NeXTDiskTab dl_dt; /// <summary>Bad sector table</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1670)] - public int[] dl_bad; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1670)] public int[] dl_bad; /// <summary>Checksum</summary> public ushort dl_checksum; } @@ -259,11 +274,9 @@ namespace DiscImageChef.PartPlugins public struct NeXTDiskTab { /// <summary>Drive name</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] - public byte[] d_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] d_name; /// <summary>Drive type</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] - public byte[] d_type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] d_type; /// <summary>Sector size</summary> public int d_secsize; /// <summary>tracks/cylinder</summary> @@ -287,21 +300,17 @@ namespace DiscImageChef.PartPlugins /// <summary>sector offset to first alternate</summary> public short d_ag_off; /// <summary>"blk 0" boot locations</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public int[] d_boot0_blkno; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public int[] d_boot0_blkno; /// <summary>default bootfile</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] - public byte[] d_bootfile; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] d_bootfile; /// <summary>host name</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] d_hostname; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] d_hostname; /// <summary>root partition</summary> public byte d_rootpartition; /// <summary>r/w partition</summary> public byte d_rwpartition; /// <summary>partitions</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public NeXTEntry[] d_partitions; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public NeXTEntry[] d_partitions; } /// <summary> @@ -329,13 +338,11 @@ namespace DiscImageChef.PartPlugins /// <summary>Should newfs be run on first start?</summary> public byte p_newfs; /// <summary>Mount point or empty if mount where you want</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] p_mountpt; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] p_mountpt; /// <summary>Should automount</summary> public byte p_automnt; /// <summary>Filesystem type, always "4.3BSD"?</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] p_type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] p_type; } } } \ No newline at end of file diff --git a/DiscImageChef.Partitions/PC98.cs b/DiscImageChef.Partitions/PC98.cs index e9452600..19cc49f9 100644 --- a/DiscImageChef.Partitions/PC98.cs +++ b/DiscImageChef.Partitions/PC98.cs @@ -54,13 +54,11 @@ namespace DiscImageChef.PartPlugins { partitions = new List<Partition>(); - if(sectorOffset != 0) - return false; + if(sectorOffset != 0) return false; byte[] bootSector = imagePlugin.ReadSector(0); byte[] sector = imagePlugin.ReadSector(1); - if(bootSector[bootSector.Length-2] != 0x55 || bootSector[bootSector.Length - 1] != 0xAA) - return false; + if(bootSector[bootSector.Length - 2] != 0x55 || bootSector[bootSector.Length - 1] != 0xAA) return false; PC98Table table = new PC98Table(); IntPtr tablePtr = Marshal.AllocHGlobal(256); @@ -85,28 +83,29 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_esect = {0}", entry.dp_esect); DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_ehd = {0}", entry.dp_ehd); DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_ecyl = {0}", entry.dp_ecyl); - DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_name = \"{0}\"", StringHandlers.CToString(entry.dp_name, Encoding.GetEncoding(932))); + DicConsole.DebugWriteLine("PC98 plugin", "entry.dp_name = \"{0}\"", + StringHandlers.CToString(entry.dp_name, Encoding.GetEncoding(932))); - if(entry.dp_scyl != entry.dp_ecyl && - entry.dp_ecyl > 0 && + if(entry.dp_scyl != entry.dp_ecyl && entry.dp_ecyl > 0 && entry.dp_scyl <= imagePlugin.ImageInfo.cylinders && - entry.dp_ecyl <= imagePlugin.ImageInfo.cylinders && - entry.dp_shd <= imagePlugin.ImageInfo.heads && + entry.dp_ecyl <= imagePlugin.ImageInfo.cylinders && entry.dp_shd <= imagePlugin.ImageInfo.heads && entry.dp_ehd <= imagePlugin.ImageInfo.heads && entry.dp_ssect <= imagePlugin.ImageInfo.sectorsPerTrack && entry.dp_esect <= imagePlugin.ImageInfo.sectorsPerTrack) { - Partition part = new Partition { - Start = Helpers.CHS.ToLBA(entry.dp_scyl, entry.dp_shd, (uint)(entry.dp_ssect + 1), imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack), + Start = Helpers.CHS.ToLBA(entry.dp_scyl, entry.dp_shd, (uint)(entry.dp_ssect + 1), + imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack), Type = DecodePC98Sid(entry.dp_sid), Name = StringHandlers.CToString(entry.dp_name, Encoding.GetEncoding(932)).Trim(), Sequence = counter, Scheme = Name }; part.Offset = part.Start * imagePlugin.GetSectorSize(); - part.Length = Helpers.CHS.ToLBA(entry.dp_ecyl, entry.dp_ehd, (uint)(entry.dp_esect + 1), imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack) - part.Start; + part.Length = Helpers.CHS.ToLBA(entry.dp_ecyl, entry.dp_ehd, (uint)(entry.dp_esect + 1), + imagePlugin.ImageInfo.heads, + imagePlugin.ImageInfo.sectorsPerTrack) - part.Start; part.Size = part.Length * imagePlugin.GetSectorSize(); DicConsole.DebugWriteLine("PC98 plugin", "part.Start = {0}", part.Start); @@ -117,10 +116,8 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("PC98 plugin", "part.Length = {0}", part.Length); DicConsole.DebugWriteLine("PC98 plugin", "part.Size = {0}", part.Size); - if(((entry.dp_mid & 0x20) == 0x20 || (entry.dp_mid & 0x44) == 0x44) && - part.Start < imagePlugin.ImageInfo.sectors && - part.End <= imagePlugin.ImageInfo.sectors) + part.Start < imagePlugin.ImageInfo.sectors && part.End <= imagePlugin.ImageInfo.sectors) { partitions.Add(part); counter++; @@ -135,36 +132,26 @@ namespace DiscImageChef.PartPlugins { switch(sid & 0x7F) { - case 0x01: - return "FAT12"; - case 0x04: - return "PC-UX"; - case 0x06: - return "N88-BASIC(86)"; + case 0x01: return "FAT12"; + case 0x04: return "PC-UX"; + case 0x06: return "N88-BASIC(86)"; // Supposedly for FAT16 < 32 MiB, seen in bigger partitions case 0x11: - case 0x21: - return "FAT16"; + case 0x21: return "FAT16"; case 0x28: case 0x41: - case 0x48: - return "Windows Volume Set"; - case 0x44: - return "FreeBSD"; - case 0x61: - return "FAT32"; - case 0x62: - return "Linux"; - default: - return "Unknown"; + case 0x48: return "Windows Volume Set"; + case 0x44: return "FreeBSD"; + case 0x61: return "FAT32"; + case 0x62: return "Linux"; + default: return "Unknown"; } } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PC98Table { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public PC98Partition[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public PC98Partition[] entries; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -189,8 +176,7 @@ namespace DiscImageChef.PartPlugins public byte dp_esect; public byte dp_ehd; public ushort dp_ecyl; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] dp_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] dp_name; } } } \ No newline at end of file diff --git a/DiscImageChef.Partitions/PartPlugin.cs b/DiscImageChef.Partitions/PartPlugin.cs index f986f272..07299f41 100644 --- a/DiscImageChef.Partitions/PartPlugin.cs +++ b/DiscImageChef.Partitions/PartPlugin.cs @@ -46,9 +46,7 @@ namespace DiscImageChef.PartPlugins /// <summary>Plugin UUID.</summary> public Guid PluginUUID; - protected PartPlugin() - { - } + protected PartPlugin() { } /// <summary> /// Interprets a partitioning scheme. @@ -57,6 +55,7 @@ namespace DiscImageChef.PartPlugins /// <param name="imagePlugin">Disk image.</param> /// <param name="partitions">Returns list of partitions.</param> /// <param name="sectorOffset">At which sector to start searching for the partition scheme.</param> - public abstract bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions, ulong sectorOffset); + public abstract bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, + out List<CommonTypes.Partition> partitions, ulong sectorOffset); } } \ No newline at end of file diff --git a/DiscImageChef.Partitions/Plan9.cs b/DiscImageChef.Partitions/Plan9.cs index 1dd766fa..8374c90f 100644 --- a/DiscImageChef.Partitions/Plan9.cs +++ b/DiscImageChef.Partitions/Plan9.cs @@ -49,12 +49,12 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("F0BF4FFC-056E-4E7C-8B65-4EAEE250ADD9"); } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<Partition> partitions, ulong sectorOffset) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<Partition> partitions, + ulong sectorOffset) { partitions = new List<Partition>(); - if(sectorOffset + 2 >= imagePlugin.GetSectors()) - return false; + if(sectorOffset + 2 >= imagePlugin.GetSectors()) return false; byte[] sector = imagePlugin.ReadSector(sectorOffset + 1); // While all of Plan9 is supposedly UTF-8, it uses ASCII strcmp for reading its partition table @@ -62,17 +62,13 @@ namespace DiscImageChef.PartPlugins foreach(string part in really) { - if(part.Length < 5 || part.Substring(0, 5) != "part ") - break; + if(part.Length < 5 || part.Substring(0, 5) != "part ") break; - string[] tokens = part.Split(new[] { ' ' }); + string[] tokens = part.Split(new[] {' '}); - if(tokens.Length != 4) - break; + if(tokens.Length != 4) break; - if(!ulong.TryParse(tokens[2], out ulong start) || - !ulong.TryParse(tokens[3], out ulong end)) - break; + if(!ulong.TryParse(tokens[2], out ulong start) || !ulong.TryParse(tokens[3], out ulong end)) break; Partition _part = new Partition { @@ -88,7 +84,7 @@ namespace DiscImageChef.PartPlugins partitions.Add(_part); } - return partitions.Count>0; + return partitions.Count > 0; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Partitions/Properties/AssemblyInfo.cs b/DiscImageChef.Partitions/Properties/AssemblyInfo.cs index f19bce8e..dee083f7 100644 --- a/DiscImageChef.Partitions/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Partitions/Properties/AssemblyInfo.cs @@ -54,5 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Partitions/RDB.cs b/DiscImageChef.Partitions/RDB.cs index b6db38d2..d6532b35 100644 --- a/DiscImageChef.Partitions/RDB.cs +++ b/DiscImageChef.Partitions/RDB.cs @@ -889,7 +889,8 @@ namespace DiscImageChef.PartPlugins public byte[] loadData; } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions, ulong sectorOffset) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, + out List<CommonTypes.Partition> partitions, ulong sectorOffset) { partitions = new List<CommonTypes.Partition>(); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -898,16 +899,15 @@ namespace DiscImageChef.PartPlugins while(RDBBlock < 16 && !foundRDB) { - if(imagePlugin.GetSectors() <= RDBBlock) - return false; + if(imagePlugin.GetSectors() <= RDBBlock) return false; + + if(RDBBlock + sectorOffset >= imagePlugin.GetSectors()) break; - if(RDBBlock + sectorOffset >= imagePlugin.GetSectors()) - break; - byte[] tmpSector = imagePlugin.ReadSector(RDBBlock + sectorOffset); uint magic = BigEndianBitConverter.ToUInt32(tmpSector, 0); - DicConsole.DebugWriteLine("Amiga RDB plugin", "Possible magic at block {0} is 0x{1:X8}", RDBBlock, magic); + DicConsole.DebugWriteLine("Amiga RDB plugin", "Possible magic at block {0} is 0x{1:X8}", RDBBlock, + magic); if(magic == RigidDiskBlockMagic) { @@ -920,8 +920,7 @@ namespace DiscImageChef.PartPlugins RDBBlock++; } - if(!foundRDB) - return false; + if(!foundRDB) return false; RDBBlock += sectorOffset; @@ -1067,13 +1066,13 @@ namespace DiscImageChef.PartPlugins nextBlock = RDB.badblock_ptr; while(nextBlock != 0xFFFFFFFF) { - DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a BadBlock block", nextBlock); + DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a BadBlock block", + nextBlock); sector = imagePlugin.ReadSector(nextBlock); uint magic = BigEndianBitConverter.ToUInt32(sector, 0); - if(magic != BadBlockListMagic) - break; + if(magic != BadBlockListMagic) break; DicConsole.DebugWriteLine("Amiga RDB plugin", "Found BadBlock block"); @@ -1090,7 +1089,8 @@ namespace DiscImageChef.PartPlugins chainEntry.blockPairs = new BadBlockEntry[entries]; DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.magic = 0x{0:X8}", chainEntry.magic); - DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.size = {0} longs, {1} bytes", chainEntry.size, chainEntry.size * 4); + DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.size = {0} longs, {1} bytes", chainEntry.size, + chainEntry.size * 4); DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.checksum = 0x{0:X8}", chainEntry.checksum); DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.targetID = {0}", chainEntry.targetID); DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.next_ptr = {0}", chainEntry.next_ptr); @@ -1099,10 +1099,11 @@ namespace DiscImageChef.PartPlugins for(ulong i = 0; i < entries; i++) { chainEntry.blockPairs[i].badBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 0)); - chainEntry.blockPairs[i].goodBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 4)); + chainEntry.blockPairs[i].goodBlock = + BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 4)); DicConsole.DebugWriteLine("Amiga RDB plugin", "Bad block at {0} replaced with good block at {1}", - chainEntry.blockPairs[i].badBlock, chainEntry.blockPairs[i].goodBlock); + chainEntry.blockPairs[i].badBlock, chainEntry.blockPairs[i].goodBlock); } BadBlockChain.Add(chainEntry); @@ -1114,13 +1115,13 @@ namespace DiscImageChef.PartPlugins nextBlock = RDB.partition_ptr; while(nextBlock != 0xFFFFFFFF) { - DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a PartitionEntry block", nextBlock + sectorOffset); + DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a PartitionEntry block", + nextBlock + sectorOffset); sector = imagePlugin.ReadSector(nextBlock + sectorOffset); uint magic = BigEndianBitConverter.ToUInt32(sector, 0); - if(magic != PartitionBlockMagic) - break; + if(magic != PartitionBlockMagic) break; DicConsole.DebugWriteLine("Amiga RDB plugin", "Found PartitionEntry block"); @@ -1151,7 +1152,6 @@ namespace DiscImageChef.PartPlugins reserved15 = BigEndianBitConverter.ToUInt32(sector, 0x74), reserved16 = BigEndianBitConverter.ToUInt32(sector, 0x78), reserved17 = BigEndianBitConverter.ToUInt32(sector, 0x7C), - dosEnvVec = new DOSEnvironmentVector { size = BigEndianBitConverter.ToUInt32(sector, 0x80), @@ -1182,7 +1182,8 @@ namespace DiscImageChef.PartPlugins partEntry.driveName = StringHandlers.PascalToString(driveName, Encoding.GetEncoding("iso-8859-1")); DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.magic = 0x{0:X8}", partEntry.magic); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.size = {0} longs, {1} bytes", partEntry.size, partEntry.size * 4); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.size = {0} longs, {1} bytes", partEntry.size, + partEntry.size * 4); DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.checksum = 0x{0:X8}", partEntry.checksum); DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.targetID = {0}", partEntry.targetID); DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.next_ptr = {0}", partEntry.next_ptr); @@ -1208,26 +1209,44 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved16 = 0x{0:X8}", partEntry.reserved16); DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved17 = 0x{0:X8}", partEntry.reserved17); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.size = {0} longs, {1} bytes", partEntry.dosEnvVec.size, partEntry.dosEnvVec.size * 4); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.block_size = {0} longs, {1} bytes", partEntry.dosEnvVec.block_size, partEntry.dosEnvVec.block_size * 4); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.sec_org = 0x{0:X8}", partEntry.dosEnvVec.sec_org); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.surfaces = {0}", partEntry.dosEnvVec.surfaces); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.size = {0} longs, {1} bytes", + partEntry.dosEnvVec.size, partEntry.dosEnvVec.size * 4); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.block_size = {0} longs, {1} bytes", + partEntry.dosEnvVec.block_size, partEntry.dosEnvVec.block_size * 4); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.sec_org = 0x{0:X8}", + partEntry.dosEnvVec.sec_org); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.surfaces = {0}", + partEntry.dosEnvVec.surfaces); DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.spb = {0}", partEntry.dosEnvVec.spb); DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.bpt = {0}", partEntry.dosEnvVec.bpt); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.reservedblocks = {0}", partEntry.dosEnvVec.reservedblocks); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.prealloc = {0}", partEntry.dosEnvVec.prealloc); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.interleave = {0}", partEntry.dosEnvVec.interleave); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.lowCylinder = {0}", partEntry.dosEnvVec.lowCylinder); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.highCylinder = {0}", partEntry.dosEnvVec.highCylinder); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.numBuffer = {0}", partEntry.dosEnvVec.numBuffer); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.bufMemType = {0}", partEntry.dosEnvVec.bufMemType); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.maxTransfer = {0}", partEntry.dosEnvVec.maxTransfer); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.Mask = 0x{0:X8}", partEntry.dosEnvVec.Mask); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.bootPriority = {0}", partEntry.dosEnvVec.bootPriority); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.dosType = {0}", AmigaDOSTypeToString(partEntry.dosEnvVec.dosType, true)); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.baud = {0}", partEntry.dosEnvVec.baud); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.control = 0x{0:X8}", partEntry.dosEnvVec.control); - DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.bootBlocks = {0}", partEntry.dosEnvVec.bootBlocks); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.reservedblocks = {0}", + partEntry.dosEnvVec.reservedblocks); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.prealloc = {0}", + partEntry.dosEnvVec.prealloc); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.interleave = {0}", + partEntry.dosEnvVec.interleave); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.lowCylinder = {0}", + partEntry.dosEnvVec.lowCylinder); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.highCylinder = {0}", + partEntry.dosEnvVec.highCylinder); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.numBuffer = {0}", + partEntry.dosEnvVec.numBuffer); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.bufMemType = {0}", + partEntry.dosEnvVec.bufMemType); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.maxTransfer = {0}", + partEntry.dosEnvVec.maxTransfer); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.Mask = 0x{0:X8}", + partEntry.dosEnvVec.Mask); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.bootPriority = {0}", + partEntry.dosEnvVec.bootPriority); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.dosType = {0}", + AmigaDOSTypeToString(partEntry.dosEnvVec.dosType, true)); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.baud = {0}", + partEntry.dosEnvVec.baud); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.control = 0x{0:X8}", + partEntry.dosEnvVec.control); + DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.bootBlocks = {0}", + partEntry.dosEnvVec.bootBlocks); PartitionEntries.Add(partEntry); nextBlock = partEntry.next_ptr; @@ -1239,13 +1258,13 @@ namespace DiscImageChef.PartPlugins nextBlock = RDB.fsheader_ptr; while(nextBlock != 0xFFFFFFFF) { - DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a FileSystemHeader block", nextBlock); + DicConsole.DebugWriteLine("Amiga RDB plugin", + "Going to block {0} in search of a FileSystemHeader block", nextBlock); sector = imagePlugin.ReadSector(nextBlock); uint magic = BigEndianBitConverter.ToUInt32(sector, 0); - if(magic != FilesystemHeaderMagic) - break; + if(magic != FilesystemHeaderMagic) break; DicConsole.DebugWriteLine("Amiga RDB plugin", "Found FileSystemHeader block"); @@ -1277,7 +1296,8 @@ namespace DiscImageChef.PartPlugins }; DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.magic = 0x{0:X8}", FSHD.magic); - DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.size = {0} longs, {1} bytes", FSHD.size, FSHD.size * 4); + DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.size = {0} longs, {1} bytes", FSHD.size, + FSHD.size * 4); DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.checksum = 0x{0:X8}", FSHD.checksum); DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.targetID = {0}", FSHD.targetID); DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.next_ptr = {0}", FSHD.next_ptr); @@ -1285,7 +1305,8 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.reserved1 = 0x{0:X8}", FSHD.reserved1); DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.reserved2 = 0x{0:X8}", FSHD.reserved2); DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dosType = {0}", AmigaDOSTypeToString(FSHD.dosType)); - DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.version = {0:D2}.{1:D2} (0x{2:X8})", (FSHD.version & 0xFFFF0000) >> 16, FSHD.version & 0xFFFF, FSHD.version); + DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.version = {0:D2}.{1:D2} (0x{2:X8})", + (FSHD.version & 0xFFFF0000) >> 16, FSHD.version & 0xFFFF, FSHD.version); DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.patchFlags = 0x{0:X8}", FSHD.patchFlags); DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.type = {0}", FSHD.dnode.type); @@ -1296,7 +1317,8 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.priority = {0}", FSHD.dnode.priority); DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.startup = {0}", FSHD.dnode.startup); DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.seglist_ptr = {0}", FSHD.dnode.seglist_ptr); - DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.global_vec = 0x{0:X8}", FSHD.dnode.global_vec); + DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.global_vec = 0x{0:X8}", + FSHD.dnode.global_vec); nextBlock = FSHD.dnode.seglist_ptr; bool thereAreLoadSegments = false; @@ -1304,13 +1326,13 @@ namespace DiscImageChef.PartPlugins sha1Ctx.Init(); while(nextBlock != 0xFFFFFFFF) { - DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a LoadSegment block", nextBlock); + DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a LoadSegment block", + nextBlock); sector = imagePlugin.ReadSector(nextBlock); uint magicSeg = BigEndianBitConverter.ToUInt32(sector, 0); - if(magicSeg != LoadSegMagic) - break; + if(magicSeg != LoadSegMagic) break; DicConsole.DebugWriteLine("Amiga RDB plugin", "Found LoadSegment block"); @@ -1325,7 +1347,8 @@ namespace DiscImageChef.PartPlugins Array.Copy(sector, 0x14, loadSeg.loadData, 0, (loadSeg.size - 5) * 4); DicConsole.DebugWriteLine("Amiga RDB plugin", "loadSeg.magic = 0x{0:X8}", loadSeg.magic); - DicConsole.DebugWriteLine("Amiga RDB plugin", "loadSeg.size = {0} longs, {1} bytes", loadSeg.size, loadSeg.size * 4); + DicConsole.DebugWriteLine("Amiga RDB plugin", "loadSeg.size = {0} longs, {1} bytes", loadSeg.size, + loadSeg.size * 4); DicConsole.DebugWriteLine("Amiga RDB plugin", "loadSeg.checksum = 0x{0:X8}", loadSeg.checksum); DicConsole.DebugWriteLine("Amiga RDB plugin", "loadSeg.targetID = {0}", loadSeg.targetID); DicConsole.DebugWriteLine("Amiga RDB plugin", "loadSeg.next_ptr = {0}", loadSeg.next_ptr); @@ -1335,6 +1358,7 @@ namespace DiscImageChef.PartPlugins sha1Ctx.Update(loadSeg.loadData); } + if(thereAreLoadSegments) { string loadSegSHA1 = sha1Ctx.End(); @@ -1353,8 +1377,11 @@ namespace DiscImageChef.PartPlugins Description = AmigaDOSTypeToDescriptionString(RDBEntry.dosEnvVec.dosType), Name = RDBEntry.driveName, Sequence = sequence, - Length = (RDBEntry.dosEnvVec.highCylinder + 1 - RDBEntry.dosEnvVec.lowCylinder) * RDBEntry.dosEnvVec.surfaces * RDBEntry.dosEnvVec.bpt, - Start = RDBEntry.dosEnvVec.lowCylinder * RDBEntry.dosEnvVec.surfaces * RDBEntry.dosEnvVec.bpt + sectorOffset, + Length = + (RDBEntry.dosEnvVec.highCylinder + 1 - RDBEntry.dosEnvVec.lowCylinder) * + RDBEntry.dosEnvVec.surfaces * RDBEntry.dosEnvVec.bpt, + Start = RDBEntry.dosEnvVec.lowCylinder * RDBEntry.dosEnvVec.surfaces * RDBEntry.dosEnvVec.bpt + + sectorOffset, Type = AmigaDOSTypeToString(RDBEntry.dosEnvVec.dosType), Scheme = Name }; @@ -1372,126 +1399,93 @@ namespace DiscImageChef.PartPlugins { switch(AmigaDOSType) { - - case TypeIDOFS: - return "Amiga Original File System"; - case TypeIDFFS: - return "Amiga Fast File System"; - case TypeIDOFSi: - return "Amiga Original File System with international characters"; - case TypeIDFFSi: - return "Amiga Fast File System with international characters"; - case TypeIDOFSc: - return "Amiga Original File System with directory cache"; - case TypeIDFFSc: - return "Amiga Fast File System with directory cache"; - case TypeIDOFS2: - return "Amiga Original File System with long filenames"; - case TypeIDFFS2: - return "Amiga Fast File System with long filenames"; - case TypeIDAMIXSysV: - return "Amiga UNIX System V filesystem"; - case TypeIDAMIXBoot: - return "Amiga UNIX boot filesystem"; - case TypeIDAMIXFFS: - return "Amiga UNIX BSD filesystem"; - case TypeIDAMIXReserved: - return "Amiga UNIX Reserved partition (swap)"; + case TypeIDOFS: return "Amiga Original File System"; + case TypeIDFFS: return "Amiga Fast File System"; + case TypeIDOFSi: return "Amiga Original File System with international characters"; + case TypeIDFFSi: return "Amiga Fast File System with international characters"; + case TypeIDOFSc: return "Amiga Original File System with directory cache"; + case TypeIDFFSc: return "Amiga Fast File System with directory cache"; + case TypeIDOFS2: return "Amiga Original File System with long filenames"; + case TypeIDFFS2: return "Amiga Fast File System with long filenames"; + case TypeIDAMIXSysV: return "Amiga UNIX System V filesystem"; + case TypeIDAMIXBoot: return "Amiga UNIX boot filesystem"; + case TypeIDAMIXFFS: return "Amiga UNIX BSD filesystem"; + case TypeIDAMIXReserved: return "Amiga UNIX Reserved partition (swap)"; case TypeIDPFS: case TypeIDPFS2: case TypeIDPFSm: - case TypeIDAFS: - return "ProfessionalFileSystem"; - case TypeIDSFS: - return "SmartFileSystem v1"; - case TypeIDSFS2: - return "SmartFileSystem v2"; - case TypeIDJXFS: - return "JXFS"; - case TypeIDCrossDOS: - return "FAT, as set by CrossDOS"; - case TypeIDCrossMac: - return "HFS, as set by CrossMac"; - case TypeIDBFFS: - return "4.2UFS, for BFFS"; - case TypeIDmuOFS: - return "Amiga Original File System with multi-user patches"; - case TypeIDmuFFS: - return "Amiga Fast File System with multi-user patches"; + case TypeIDAFS: return "ProfessionalFileSystem"; + case TypeIDSFS: return "SmartFileSystem v1"; + case TypeIDSFS2: return "SmartFileSystem v2"; + case TypeIDJXFS: return "JXFS"; + case TypeIDCrossDOS: return "FAT, as set by CrossDOS"; + case TypeIDCrossMac: return "HFS, as set by CrossMac"; + case TypeIDBFFS: return "4.2UFS, for BFFS"; + case TypeIDmuOFS: return "Amiga Original File System with multi-user patches"; + case TypeIDmuFFS: return "Amiga Fast File System with multi-user patches"; case TypeIDmuOFSi: return "Amiga Original File System with international characters and multi-user patches"; - case TypeIDmuFFSi: - return "Amiga Fast File System with international characters and multi-user patches"; - case TypeIDmuOFSc: - return "Amiga Original File System with directory cache and multi-user patches"; - case TypeIDmuFFSc: - return "Amiga Fast File System with directory cache and multi-user patches"; - case TypeIDOldBSDUnused: - return "BSD unused"; - case TypeIDOldBSDSwap: - return "BSD swap"; - case TypeIDOldBSD42FFS: - return "BSD 4.2 FFS"; - case TypeIDOldBSD44LFS: - return "BSD 4.4 LFS"; - case TypeIDNetBSDRootUnused: - return "NetBSD unused root partition"; - case TypeIDNetBSDRoot42FFS: - return "NetBSD 4.2 FFS root partition"; - case TypeIDNetBSDRoot44LFS: - return "NetBSD 4.4 LFS root partition"; - case TypeIDNetBSDUserUnused: - return "NetBSD unused user partition"; - case TypeIDNetBSDUser42FFS: - return "NetBSD 4.2 FFS user partition"; - case TypeIDNetBSDUser44LFS: - return "NetBSD 4.4 LFS user partition"; - case TypeIDNetBSDSwap: - return "NetBSD swap partition"; - case TypeIDLinux: - return "Linux filesystem partition"; - case TypeIDLinuxSwap: - return "Linux swap partition"; + case TypeIDmuFFSi: return "Amiga Fast File System with international characters and multi-user patches"; + case TypeIDmuOFSc: return "Amiga Original File System with directory cache and multi-user patches"; + case TypeIDmuFFSc: return "Amiga Fast File System with directory cache and multi-user patches"; + case TypeIDOldBSDUnused: return "BSD unused"; + case TypeIDOldBSDSwap: return "BSD swap"; + case TypeIDOldBSD42FFS: return "BSD 4.2 FFS"; + case TypeIDOldBSD44LFS: return "BSD 4.4 LFS"; + case TypeIDNetBSDRootUnused: return "NetBSD unused root partition"; + case TypeIDNetBSDRoot42FFS: return "NetBSD 4.2 FFS root partition"; + case TypeIDNetBSDRoot44LFS: return "NetBSD 4.4 LFS root partition"; + case TypeIDNetBSDUserUnused: return "NetBSD unused user partition"; + case TypeIDNetBSDUser42FFS: return "NetBSD 4.2 FFS user partition"; + case TypeIDNetBSDUser44LFS: return "NetBSD 4.4 LFS user partition"; + case TypeIDNetBSDSwap: return "NetBSD swap partition"; + case TypeIDLinux: return "Linux filesystem partition"; + case TypeIDLinuxSwap: return "Linux swap partition"; case TypeIDRaidFrame: - case TypeIDRaidFrame0: - return "RaidFrame partition"; + case TypeIDRaidFrame0: return "RaidFrame partition"; default: - { - if((AmigaDOSType & TypeIDOFS) == TypeIDOFS) - return string.Format("Unknown Amiga DOS filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); + { + if((AmigaDOSType & TypeIDOFS) == TypeIDOFS) + return string.Format("Unknown Amiga DOS filesystem type {0}", + AmigaDOSTypeToString(AmigaDOSType)); - if((AmigaDOSType & TypeIDAMIXSysV) == TypeIDAMIXSysV) - return string.Format("Unknown Amiga UNIX filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); + if((AmigaDOSType & TypeIDAMIXSysV) == TypeIDAMIXSysV) + return string.Format("Unknown Amiga UNIX filesystem type {0}", + AmigaDOSTypeToString(AmigaDOSType)); - if((AmigaDOSType & 0x50465300) == 0x50465300 || - (AmigaDOSType & 0x41465300) == 0x41465300) - return string.Format("Unknown ProfessionalFileSystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); + if((AmigaDOSType & 0x50465300) == 0x50465300 || (AmigaDOSType & 0x41465300) == 0x41465300) + return string.Format("Unknown ProfessionalFileSystem type {0}", + AmigaDOSTypeToString(AmigaDOSType)); - if((AmigaDOSType & TypeIDSFS) == TypeIDSFS) - return string.Format("Unknown SmartFileSystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); + if((AmigaDOSType & TypeIDSFS) == TypeIDSFS) + return string.Format("Unknown SmartFileSystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); - if((AmigaDOSType & TypeIDmuOFS) == TypeIDmuOFS) - return string.Format("Unknown Amiga DOS multi-user filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); + if((AmigaDOSType & TypeIDmuOFS) == TypeIDmuOFS) + return string.Format("Unknown Amiga DOS multi-user filesystem type {0}", + AmigaDOSTypeToString(AmigaDOSType)); - if((AmigaDOSType & TypeIDOldBSDUnused) == TypeIDOldBSDUnused) - return string.Format("Unknown BSD filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); + if((AmigaDOSType & TypeIDOldBSDUnused) == TypeIDOldBSDUnused) + return string.Format("Unknown BSD filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); - if((AmigaDOSType & TypeIDNetBSDRootUnused) == TypeIDNetBSDRootUnused) - return string.Format("Unknown NetBSD root filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); + if((AmigaDOSType & TypeIDNetBSDRootUnused) == TypeIDNetBSDRootUnused) + return string.Format("Unknown NetBSD root filesystem type {0}", + AmigaDOSTypeToString(AmigaDOSType)); - if((AmigaDOSType & TypeIDNetBSDUserUnused) == TypeIDNetBSDUserUnused) - return string.Format("Unknown NetBSD user filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); + if((AmigaDOSType & TypeIDNetBSDUserUnused) == TypeIDNetBSDUserUnused) + return string.Format("Unknown NetBSD user filesystem type {0}", + AmigaDOSTypeToString(AmigaDOSType)); - if((AmigaDOSType & TypeIDNetBSDSwap) == TypeIDNetBSDSwap) - return string.Format("Unknown NetBSD swap filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); + if((AmigaDOSType & TypeIDNetBSDSwap) == TypeIDNetBSDSwap) + return string.Format("Unknown NetBSD swap filesystem type {0}", + AmigaDOSTypeToString(AmigaDOSType)); - if((AmigaDOSType & TypeIDLinux) == TypeIDLinux || - (AmigaDOSType & TypeIDLinuxSwap) == TypeIDLinuxSwap) - return string.Format("Unknown Linux filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); + if((AmigaDOSType & TypeIDLinux) == TypeIDLinux || + (AmigaDOSType & TypeIDLinuxSwap) == TypeIDLinuxSwap) + return string.Format("Unknown Linux filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); - return string.Format("Unknown partition type {0}", AmigaDOSTypeToString(AmigaDOSType)); - } + return string.Format("Unknown partition type {0}", AmigaDOSTypeToString(AmigaDOSType)); + } } } @@ -1511,7 +1505,9 @@ namespace DiscImageChef.PartPlugins textPartString = Encoding.ASCII.GetString(textPart); - return quoted ? string.Format("\"{0}\\{1}\"", textPartString, AmigaDOSType & 0xFF) : string.Format("{0}\\{1}", textPartString, AmigaDOSType & 0xFF); + return quoted + ? string.Format("\"{0}\\{1}\"", textPartString, AmigaDOSType & 0xFF) + : string.Format("{0}\\{1}", textPartString, AmigaDOSType & 0xFF); } } } \ No newline at end of file diff --git a/DiscImageChef.Partitions/RioKarma.cs b/DiscImageChef.Partitions/RioKarma.cs index d887d67d..c580ae90 100644 --- a/DiscImageChef.Partitions/RioKarma.cs +++ b/DiscImageChef.Partitions/RioKarma.cs @@ -54,8 +54,7 @@ namespace DiscImageChef.PartPlugins partitions = new List<Partition>(); byte[] sector = imagePlugin.ReadSector(sectorOffset); - if(sector.Length < 512) - return false; + if(sector.Length < 512) return false; RioKarmaTable table = new RioKarmaTable(); IntPtr tablePtr = Marshal.AllocHGlobal(512); @@ -63,8 +62,7 @@ namespace DiscImageChef.PartPlugins table = (RioKarmaTable)Marshal.PtrToStructure(tablePtr, typeof(RioKarmaTable)); Marshal.FreeHGlobal(tablePtr); - if(table.magic != KarmaMagic) - return false; + if(table.magic != KarmaMagic) return false; ulong counter = 0; @@ -93,12 +91,9 @@ namespace DiscImageChef.PartPlugins [StructLayout(LayoutKind.Sequential, Pack = 1)] struct RioKarmaTable { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 270)] - public byte[] reserved; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public RioKarmaEntry[] entries; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 208)] - public byte[] padding; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 270)] public byte[] reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public RioKarmaEntry[] entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 208)] public byte[] padding; public ushort magic; } @@ -107,8 +102,7 @@ namespace DiscImageChef.PartPlugins { public uint reserved; public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] reserved2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] reserved2; public uint offset; public uint size; } diff --git a/DiscImageChef.Partitions/SGI.cs b/DiscImageChef.Partitions/SGI.cs index 4fd0beb9..7c63ac68 100644 --- a/DiscImageChef.Partitions/SGI.cs +++ b/DiscImageChef.Partitions/SGI.cs @@ -54,39 +54,46 @@ namespace DiscImageChef.PartPlugins partitions = new List<Partition>(); byte[] sector = imagePlugin.ReadSector(sectorOffset); - if(sector.Length < 512) - return false; + if(sector.Length < 512) return false; SGILabel dvh = BigEndianMarshal.ByteArrayToStructureBigEndian<SGILabel>(sector); for(int i = 0; i < dvh.volume.Length; i++) dvh.volume[i] = BigEndianMarshal.SwapStructureMembersEndian(dvh.volume[i]); for(int i = 0; i < dvh.partitions.Length; i++) dvh.partitions[i] = BigEndianMarshal.SwapStructureMembersEndian(dvh.partitions[i]); + dvh.device_params = BigEndianMarshal.SwapStructureMembersEndian(dvh.device_params); - DicConsole.DebugWriteLine("SGIVH plugin", "dvh.magic = 0x{0:X8} (should be 0x{1:X8})", dvh.magic, SGI_MAGIC); + DicConsole.DebugWriteLine("SGIVH plugin", "dvh.magic = 0x{0:X8} (should be 0x{1:X8})", dvh.magic, + SGI_MAGIC); - if(dvh.magic != SGI_MAGIC) - return false; + if(dvh.magic != SGI_MAGIC) return false; DicConsole.DebugWriteLine("SGIVH plugin", "dvh.root_part_num = {0}", dvh.root_part_num); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.swap_part_num = {0}", dvh.swap_part_num); - DicConsole.DebugWriteLine("SGIVH plugin", "dvh.boot_file = \"{0}\"", StringHandlers.CToString(dvh.boot_file)); + DicConsole.DebugWriteLine("SGIVH plugin", "dvh.boot_file = \"{0}\"", + StringHandlers.CToString(dvh.boot_file)); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_skew = {0}", dvh.device_params.dp_skew); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_gap1 = {0}", dvh.device_params.dp_gap1); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_gap2 = {0}", dvh.device_params.dp_gap2); - DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_spares_cyl = {0}", dvh.device_params.dp_spares_cyl); + DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_spares_cyl = {0}", + dvh.device_params.dp_spares_cyl); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_cyls = {0}", dvh.device_params.dp_cyls); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_shd0 = {0}", dvh.device_params.dp_shd0); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_trks0 = {0}", dvh.device_params.dp_trks0); - DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_ctq_depth = {0}", dvh.device_params.dp_ctq_depth); + DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_ctq_depth = {0}", + dvh.device_params.dp_ctq_depth); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_cylshi = {0}", dvh.device_params.dp_cylshi); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_secs = {0}", dvh.device_params.dp_secs); - DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_secbytes = {0}", dvh.device_params.dp_secbytes); - DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_interleave = {0}", dvh.device_params.dp_interleave); + DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_secbytes = {0}", + dvh.device_params.dp_secbytes); + DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_interleave = {0}", + dvh.device_params.dp_interleave); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_flags = {0}", dvh.device_params.dp_flags); - DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_datarate = {0}", dvh.device_params.dp_datarate); - DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_nretries = {0}", dvh.device_params.dp_nretries); + DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_datarate = {0}", + dvh.device_params.dp_datarate); + DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_nretries = {0}", + dvh.device_params.dp_nretries); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_mspw = {0}", dvh.device_params.dp_mspw); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_xgap1 = {0}", dvh.device_params.dp_xgap1); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_xsync = {0}", dvh.device_params.dp_xsync); @@ -99,23 +106,28 @@ namespace DiscImageChef.PartPlugins for(int i = 0; i < dvh.partitions.Length; i++) { - DicConsole.DebugWriteLine("SGIVH plugin", "dvh.partitions[{0}].num_blocks = {1}", i, dvh.partitions[i].num_blocks); - DicConsole.DebugWriteLine("SGIVH plugin", "dvh.partitions[{0}].first_block = {1}", i, dvh.partitions[i].first_block); + DicConsole.DebugWriteLine("SGIVH plugin", "dvh.partitions[{0}].num_blocks = {1}", i, + dvh.partitions[i].num_blocks); + DicConsole.DebugWriteLine("SGIVH plugin", "dvh.partitions[{0}].first_block = {1}", i, + dvh.partitions[i].first_block); // TODO: Solve big endian marshal with enumerations dvh.partitions[i].type = (SGIType)Swapping.Swap((uint)dvh.partitions[i].type); DicConsole.DebugWriteLine("SGIVH plugin", "dvh.partitions[{0}].type = {1}", i, dvh.partitions[i].type); Partition part = new Partition { - Start = (dvh.partitions[i].first_block * dvh.device_params.dp_secbytes) / imagePlugin.GetSectorSize(), + Start = + (dvh.partitions[i].first_block * dvh.device_params.dp_secbytes) / imagePlugin.GetSectorSize(), Offset = (dvh.partitions[i].first_block * dvh.device_params.dp_secbytes), - Length = (dvh.partitions[i].num_blocks * dvh.device_params.dp_secbytes) / imagePlugin.GetSectorSize(), + Length = + (dvh.partitions[i].num_blocks * dvh.device_params.dp_secbytes) / imagePlugin.GetSectorSize(), Size = (dvh.partitions[i].num_blocks * dvh.device_params.dp_secbytes), Type = TypeToString(dvh.partitions[i].type), Sequence = counter, Scheme = Name }; - if(part.Size > 0 && dvh.partitions[i].type != SGIType.Header && dvh.partitions[i].type != SGIType.Volume) + if(part.Size > 0 && dvh.partitions[i].type != SGIType.Header && dvh.partitions[i].type != SGIType.Volume + ) { partitions.Add(part); counter++; @@ -135,16 +147,13 @@ namespace DiscImageChef.PartPlugins /// <summary></summary> public short swap_part_num; /// <summary></summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] boot_file; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] boot_file; /// <summary></summary> public SGIDeviceParameters device_params; /// <summary></summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] - public SGIVolume[] volume; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public SGIVolume[] volume; /// <summary></summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public SGIPartition[] partitions; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public SGIPartition[] partitions; /// <summary></summary> public uint csum; /// <summary></summary> @@ -155,8 +164,7 @@ namespace DiscImageChef.PartPlugins struct SGIVolume { /// <summary></summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] name; /// <summary></summary> public uint block_num; /// <summary></summary> @@ -188,44 +196,27 @@ namespace DiscImageChef.PartPlugins { switch(typ) { - case SGIType.Header: - return "Volume header"; - case SGIType.TrkRepl: - return "Track replacements"; - case SGIType.SecRepl: - return "Sector replacements"; - case SGIType.Swap: - return "Raw data (swap)"; - case SGIType.Bsd: - return "4.2BSD Fast File System"; - case SGIType.SystemV: - return "UNIX System V"; - case SGIType.Volume: - return "Whole device"; - case SGIType.EFS: - return "EFS"; - case SGIType.Lvol: - return "Logical volume"; - case SGIType.Rlvol: - return "Raw logical volume"; - case SGIType.XFS: - return "XFS"; - case SGIType.Xlvol: - return "XFS log device"; - case SGIType.Rxlvol: - return "XLV volume"; - case SGIType.Xvm: - return "SGI XVM"; - case SGIType.LinuxSwap: - return "Linux swap"; - case SGIType.Linux: - return "Linux"; - case SGIType.LinuxRAID: - return "Linux RAID"; - default: - return "Unknown"; + case SGIType.Header: return "Volume header"; + case SGIType.TrkRepl: return "Track replacements"; + case SGIType.SecRepl: return "Sector replacements"; + case SGIType.Swap: return "Raw data (swap)"; + case SGIType.Bsd: return "4.2BSD Fast File System"; + case SGIType.SystemV: return "UNIX System V"; + case SGIType.Volume: return "Whole device"; + case SGIType.EFS: return "EFS"; + case SGIType.Lvol: return "Logical volume"; + case SGIType.Rlvol: return "Raw logical volume"; + case SGIType.XFS: return "XFS"; + case SGIType.Xlvol: return "XFS log device"; + case SGIType.Rxlvol: return "XLV volume"; + case SGIType.Xvm: return "SGI XVM"; + case SGIType.LinuxSwap: return "Linux swap"; + case SGIType.Linux: return "Linux"; + case SGIType.LinuxRAID: return "Linux RAID"; + default: return "Unknown"; } } + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SGIPartition { diff --git a/DiscImageChef.Partitions/Sun.cs b/DiscImageChef.Partitions/Sun.cs index 21d858d0..49b6d246 100644 --- a/DiscImageChef.Partitions/Sun.cs +++ b/DiscImageChef.Partitions/Sun.cs @@ -60,12 +60,10 @@ namespace DiscImageChef.PartPlugins /// <summary>Size of padding in SunOS disk label</summary> const int LEN_DKL_PAD = DK_LABEL_SIZE - (LEN_DKL_ASCII + NDKMAP * 8 + 14 * 2); /// <summary>Size of padding in Solaris disk label with 8 partitions</summary> - const int LEN_DKL_PAD8 = DK_LABEL_SIZE - (LEN_DKL_ASCII + - 136 + // sizeof(dk_vtoc8) - (NDKMAP * 8) + 14 * 2 + 2 * 2); - const int LEN_DKL_PAD16 = DK_LABEL_SIZE - - (456 + // sizeof(dk_vtoc16) - 4 * 4 + 12 * 2 + 2 * 2); + const int LEN_DKL_PAD8 = DK_LABEL_SIZE - (LEN_DKL_ASCII + 136 + // sizeof(dk_vtoc8) + (NDKMAP * 8) + 14 * 2 + 2 * 2); + const int LEN_DKL_PAD16 = DK_LABEL_SIZE - (456 + // sizeof(dk_vtoc16) + 4 * 4 + 12 * 2 + 2 * 2); public enum SunTag : ushort { @@ -108,16 +106,15 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("50F35CC4-8375-4445-8DCB-1BA550C931A3"); } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions, ulong sectorOffset) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, + out List<CommonTypes.Partition> partitions, ulong sectorOffset) { partitions = new List<CommonTypes.Partition>(); - if(imagePlugin.GetSectorSize() < 512) - return false; + if(imagePlugin.GetSectorSize() < 512) return false; + + if(sectorOffset + 2 >= imagePlugin.GetSectors()) return false; - if(sectorOffset + 2 >= imagePlugin.GetSectors()) - return false; - bool useDkl = false, useDkl8 = false, useDkl16 = false; byte[] sunSector = imagePlugin.ReadSector(sectorOffset); @@ -132,15 +129,11 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_sanity = 0x{0:X8}", dkl8.dkl_vtoc.v_sanity); DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_sanity = 0x{0:X8}", dkl16.dkl_vtoc.v_sanity); - if(dkl.dkl_magic == DKL_MAGIC || dkl.dkl_magic == DKL_CIGAM) { - if(dkl16.dkl_vtoc.v_sanity == VTOC_SANE || dkl16.dkl_vtoc.v_sanity == VTOC_ENAS) - useDkl16 = true; - else if(dkl8.dkl_vtoc.v_sanity == VTOC_SANE || dkl8.dkl_vtoc.v_sanity == VTOC_ENAS) - useDkl8 = true; - else - useDkl = true; + if(dkl16.dkl_vtoc.v_sanity == VTOC_SANE || dkl16.dkl_vtoc.v_sanity == VTOC_ENAS) useDkl16 = true; + else if(dkl8.dkl_vtoc.v_sanity == VTOC_SANE || dkl8.dkl_vtoc.v_sanity == VTOC_ENAS) useDkl8 = true; + else useDkl = true; } if(!useDkl && !useDkl8 && !useDkl16) @@ -155,30 +148,24 @@ namespace DiscImageChef.PartPlugins if(dkl.dkl_magic == DKL_MAGIC || dkl.dkl_magic == DKL_CIGAM) { - if(dkl16.dkl_vtoc.v_sanity == VTOC_SANE || dkl16.dkl_vtoc.v_sanity == VTOC_ENAS) - useDkl16 = true; - else if(dkl8.dkl_vtoc.v_sanity == VTOC_SANE || dkl8.dkl_vtoc.v_sanity == VTOC_ENAS) - useDkl8 = true; - else - useDkl = true; + if(dkl16.dkl_vtoc.v_sanity == VTOC_SANE || dkl16.dkl_vtoc.v_sanity == VTOC_ENAS) useDkl16 = true; + else if(dkl8.dkl_vtoc.v_sanity == VTOC_SANE || dkl8.dkl_vtoc.v_sanity == VTOC_ENAS) useDkl8 = true; + else useDkl = true; } } - if(!useDkl && !useDkl8 && !useDkl16) - return false; + if(!useDkl && !useDkl8 && !useDkl16) return false; - if(useDkl16 && dkl16.dkl_magic == DKL_CIGAM) - dkl16 = SwapDiskLabel(dkl16); - else if(useDkl8 && dkl8.dkl_magic == DKL_CIGAM) - dkl8 = SwapDiskLabel(dkl8); - else if(useDkl && dkl.dkl_magic == DKL_CIGAM) - dkl = SwapDiskLabel(dkl); + if(useDkl16 && dkl16.dkl_magic == DKL_CIGAM) dkl16 = SwapDiskLabel(dkl16); + else if(useDkl8 && dkl8.dkl_magic == DKL_CIGAM) dkl8 = SwapDiskLabel(dkl8); + else if(useDkl && dkl.dkl_magic == DKL_CIGAM) dkl = SwapDiskLabel(dkl); if(useDkl) { ulong sectorsPerCylinder = (ulong)(dkl.dkl_nsect * dkl.dkl_nhead); - DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_asciilabel = \"{0}\"", StringHandlers.CToString(dkl.dkl_asciilabel)); + DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_asciilabel = \"{0}\"", + StringHandlers.CToString(dkl.dkl_asciilabel)); DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_rpm = {0}", dkl.dkl_rpm); DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_pcyl = {0}", dkl.dkl_pcyl); DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_apc = {0}", dkl.dkl_apc); @@ -193,9 +180,12 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_ppart = {0}", dkl.dkl_ppart); for(int i = 0; i < NDKMAP; i++) { - DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_map[{0}].dkl_cylno = {1}", i, dkl.dkl_map[i].dkl_cylno); - DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_map[{0}].dkl_nblk = {1}", i, dkl.dkl_map[i].dkl_nblk); + DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_map[{0}].dkl_cylno = {1}", i, + dkl.dkl_map[i].dkl_cylno); + DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_map[{0}].dkl_nblk = {1}", i, + dkl.dkl_map[i].dkl_nblk); } + DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_magic = 0x{0:X4}", dkl.dkl_magic); DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_cksum = 0x{0:X4}", dkl.dkl_cksum); DicConsole.DebugWriteLine("Sun plugin", "sectorsPerCylinder = {0}", sectorsPerCylinder); @@ -209,8 +199,10 @@ namespace DiscImageChef.PartPlugins Size = (ulong)dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE, Length = (ulong)((dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE) / imagePlugin.GetSectorSize()), Sequence = (ulong)i, - Offset = ((ulong)dkl.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * DK_LABEL_SIZE, - Start = (((ulong)dkl.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * DK_LABEL_SIZE) / imagePlugin.GetSectorSize(), + Offset = + ((ulong)dkl.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * DK_LABEL_SIZE, + Start = (((ulong)dkl.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * + DK_LABEL_SIZE) / imagePlugin.GetSectorSize(), Type = "SunOS partition", Scheme = Name }; @@ -223,9 +215,11 @@ namespace DiscImageChef.PartPlugins { ulong sectorsPerCylinder = (ulong)(dkl8.dkl_nsect * dkl8.dkl_nhead); - DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_asciilabel = \"{0}\"", StringHandlers.CToString(dkl8.dkl_asciilabel)); + DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_asciilabel = \"{0}\"", + StringHandlers.CToString(dkl8.dkl_asciilabel)); DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_version = {0}", dkl8.dkl_vtoc.v_version); - DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_volume = \"{0}\"", StringHandlers.CToString(dkl8.dkl_vtoc.v_volume)); + DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_volume = \"{0}\"", + StringHandlers.CToString(dkl8.dkl_vtoc.v_volume)); DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_nparts = {0}", dkl8.dkl_vtoc.v_nparts); DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_sanity = 0x{0:X8}", dkl8.dkl_vtoc.v_sanity); DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_write_reinstruct = {0}", dkl8.dkl_write_reinstruct); @@ -244,23 +238,28 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_obs4 = {0}", dkl8.dkl_obs4); for(int i = 0; i < NDKMAP; i++) { - DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_map[{0}].dkl_cylno = {1}", i, dkl8.dkl_map[i].dkl_cylno); - DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_map[{0}].dkl_nblk = {1}", i, dkl8.dkl_map[i].dkl_nblk); - DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_part[{0}].p_tag = {1} ({2})", i, dkl8.dkl_vtoc.v_part[i].p_tag, (ushort)dkl8.dkl_vtoc.v_part[i].p_tag); - DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_part[{0}].p_flag = {1} ({2})", i, dkl8.dkl_vtoc.v_part[i].p_flag, (ushort)dkl8.dkl_vtoc.v_part[i].p_flag); - DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_timestamp[{0}] = {1}", i, DateHandlers.UNIXToDateTime(dkl8.dkl_vtoc.v_timestamp[i])); + DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_map[{0}].dkl_cylno = {1}", i, + dkl8.dkl_map[i].dkl_cylno); + DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_map[{0}].dkl_nblk = {1}", i, + dkl8.dkl_map[i].dkl_nblk); + DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_part[{0}].p_tag = {1} ({2})", i, + dkl8.dkl_vtoc.v_part[i].p_tag, (ushort)dkl8.dkl_vtoc.v_part[i].p_tag); + DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_part[{0}].p_flag = {1} ({2})", i, + dkl8.dkl_vtoc.v_part[i].p_flag, (ushort)dkl8.dkl_vtoc.v_part[i].p_flag); + DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_timestamp[{0}] = {1}", i, + DateHandlers.UNIXToDateTime(dkl8.dkl_vtoc.v_timestamp[i])); } + DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_magic = 0x{0:X4}", dkl8.dkl_magic); DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_cksum = 0x{0:X4}", dkl8.dkl_cksum); DicConsole.DebugWriteLine("Sun plugin", "sectorsPerCylinder = {0}", sectorsPerCylinder); - if(dkl8.dkl_vtoc.v_nparts > NDKMAP) - return false; + if(dkl8.dkl_vtoc.v_nparts > NDKMAP) return false; for(int i = 0; i < dkl8.dkl_vtoc.v_nparts; i++) { - if(dkl8.dkl_map[i].dkl_nblk > 0 && - dkl8.dkl_vtoc.v_part[i].p_tag != SunTag.SunEmpty && dkl8.dkl_vtoc.v_part[i].p_tag != SunTag.SunWholeDisk) + if(dkl8.dkl_map[i].dkl_nblk > 0 && dkl8.dkl_vtoc.v_part[i].p_tag != SunTag.SunEmpty && + dkl8.dkl_vtoc.v_part[i].p_tag != SunTag.SunWholeDisk) { CommonTypes.Partition part = new CommonTypes.Partition { @@ -268,13 +267,18 @@ namespace DiscImageChef.PartPlugins Size = (ulong)dkl8.dkl_map[i].dkl_nblk * DK_LABEL_SIZE, Length = (ulong)((dkl8.dkl_map[i].dkl_nblk * DK_LABEL_SIZE) / imagePlugin.GetSectorSize()), Sequence = (ulong)i, - Offset = ((ulong)dkl8.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * DK_LABEL_SIZE, - Start = (((ulong)dkl8.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * DK_LABEL_SIZE) / imagePlugin.GetSectorSize(), + Offset = + ((ulong)dkl8.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * DK_LABEL_SIZE, + Start = + (((ulong)dkl8.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * + DK_LABEL_SIZE) / imagePlugin.GetSectorSize(), Type = SunIdToString(dkl8.dkl_vtoc.v_part[i].p_tag), Scheme = Name }; if(dkl8.dkl_vtoc.v_timestamp[i] != 0) - part.Description += string.Format("\nPartition timestamped on {0}", DateHandlers.UNIXToDateTime(dkl8.dkl_vtoc.v_timestamp[i])); + part.Description += string.Format("\nPartition timestamped on {0}", + DateHandlers + .UNIXToDateTime(dkl8.dkl_vtoc.v_timestamp[i])); if(part.Start < imagePlugin.GetSectors() && part.End <= imagePlugin.GetSectors()) partitions.Add(part); @@ -285,10 +289,12 @@ namespace DiscImageChef.PartPlugins { DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_sanity = 0x{0:X8}", dkl16.dkl_vtoc.v_sanity); DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_version = {0}", dkl16.dkl_vtoc.v_version); - DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_volume = \"{0}\"", StringHandlers.CToString(dkl16.dkl_vtoc.v_volume)); + DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_volume = \"{0}\"", + StringHandlers.CToString(dkl16.dkl_vtoc.v_volume)); DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_sectorsz = {0}", dkl16.dkl_vtoc.v_sectorsz); DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_nparts = {0}", dkl16.dkl_vtoc.v_nparts); - DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_asciilabel = \"{0}\"", StringHandlers.CToString(dkl16.dkl_vtoc.v_asciilabel)); + DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_asciilabel = \"{0}\"", + StringHandlers.CToString(dkl16.dkl_vtoc.v_asciilabel)); DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_pcyl = {0}", dkl16.dkl_pcyl); DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_ncyl = {0}", dkl16.dkl_ncyl); DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_acyl = {0}", dkl16.dkl_acyl); @@ -303,44 +309,55 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_read_reinstruct = {0}", dkl16.dkl_read_reinstruct); for(int i = 0; i < NDKMAP16; i++) { - DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_part[{0}].p_start = {1}", i, dkl16.dkl_vtoc.v_part[i].p_start); - DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_part[{0}].p_size = {1}", i, dkl16.dkl_vtoc.v_part[i].p_size); - DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_part[{0}].p_tag = {1} ({2})", i, dkl16.dkl_vtoc.v_part[i].p_tag, (ushort)dkl16.dkl_vtoc.v_part[i].p_tag); - DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_part[{0}].p_flag = {1} ({2})", i, dkl16.dkl_vtoc.v_part[i].p_flag, (ushort)dkl16.dkl_vtoc.v_part[i].p_flag); - DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_timestamp[{0}] = {1}", i, DateHandlers.UNIXToDateTime(dkl16.dkl_vtoc.v_timestamp[i])); + DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_part[{0}].p_start = {1}", i, + dkl16.dkl_vtoc.v_part[i].p_start); + DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_part[{0}].p_size = {1}", i, + dkl16.dkl_vtoc.v_part[i].p_size); + DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_part[{0}].p_tag = {1} ({2})", i, + dkl16.dkl_vtoc.v_part[i].p_tag, (ushort)dkl16.dkl_vtoc.v_part[i].p_tag); + DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_part[{0}].p_flag = {1} ({2})", i, + dkl16.dkl_vtoc.v_part[i].p_flag, (ushort)dkl16.dkl_vtoc.v_part[i].p_flag); + DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_timestamp[{0}] = {1}", i, + DateHandlers.UNIXToDateTime(dkl16.dkl_vtoc.v_timestamp[i])); } + DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_magic = 0x{0:X4}", dkl16.dkl_magic); DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_cksum = 0x{0:X4}", dkl16.dkl_cksum); - if(dkl16.dkl_vtoc.v_nparts > NDKMAP16) - return false; + if(dkl16.dkl_vtoc.v_nparts > NDKMAP16) return false; for(int i = 0; i < dkl16.dkl_vtoc.v_nparts; i++) { - if(dkl16.dkl_vtoc.v_part[i].p_size > 0 && - dkl16.dkl_vtoc.v_part[i].p_tag != SunTag.SunEmpty && dkl16.dkl_vtoc.v_part[i].p_tag != SunTag.SunWholeDisk) + if(dkl16.dkl_vtoc.v_part[i].p_size > 0 && dkl16.dkl_vtoc.v_part[i].p_tag != SunTag.SunEmpty && + dkl16.dkl_vtoc.v_part[i].p_tag != SunTag.SunWholeDisk) { CommonTypes.Partition part = new CommonTypes.Partition { Description = SunFlagsToString(dkl16.dkl_vtoc.v_part[i].p_flag), Size = (ulong)dkl16.dkl_vtoc.v_part[i].p_size * dkl16.dkl_vtoc.v_sectorsz, - Length = (ulong)((dkl16.dkl_vtoc.v_part[i].p_size * dkl16.dkl_vtoc.v_sectorsz) / imagePlugin.GetSectorSize()), + Length = + (ulong)((dkl16.dkl_vtoc.v_part[i].p_size * dkl16.dkl_vtoc.v_sectorsz) / + imagePlugin.GetSectorSize()), Sequence = (ulong)i, - Offset = ((ulong)dkl16.dkl_vtoc.v_part[i].p_start + sectorOffset) * dkl16.dkl_vtoc.v_sectorsz, - Start = (((ulong)dkl16.dkl_vtoc.v_part[i].p_start + sectorOffset) * dkl16.dkl_vtoc.v_sectorsz) / imagePlugin.GetSectorSize(), + Offset = + ((ulong)dkl16.dkl_vtoc.v_part[i].p_start + sectorOffset) * dkl16.dkl_vtoc.v_sectorsz, + Start = + (((ulong)dkl16.dkl_vtoc.v_part[i].p_start + sectorOffset) * dkl16.dkl_vtoc.v_sectorsz) / + imagePlugin.GetSectorSize(), Type = SunIdToString(dkl16.dkl_vtoc.v_part[i].p_tag), Scheme = Name }; if(dkl16.dkl_vtoc.v_timestamp[i] != 0) - part.Description += string.Format("\nPartition timestamped on {0}", DateHandlers.UNIXToDateTime(dkl16.dkl_vtoc.v_timestamp[i])); + part.Description += string.Format("\nPartition timestamped on {0}", + DateHandlers + .UNIXToDateTime(dkl16.dkl_vtoc.v_timestamp[i])); if(part.Start < imagePlugin.GetSectors() && part.End <= imagePlugin.GetSectors()) partitions.Add(part); } } } - return - partitions.Count > 0; + return partitions.Count > 0; } static dk_label SwapDiskLabel(dk_label label) @@ -400,10 +417,8 @@ namespace DiscImageChef.PartPlugins public static string SunFlagsToString(SunFlags flags) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); - if(flags.HasFlag(SunFlags.NoMount)) - sb.AppendLine("Unmountable"); - if(flags.HasFlag(SunFlags.ReadOnly)) - sb.AppendLine("Read-only"); + if(flags.HasFlag(SunFlags.NoMount)) sb.AppendLine("Unmountable"); + if(flags.HasFlag(SunFlags.ReadOnly)) sb.AppendLine("Read-only"); return sb.ToString(); } @@ -411,56 +426,31 @@ namespace DiscImageChef.PartPlugins { switch(id) { - case SunTag.Linux: - return "Linux"; - case SunTag.LinuxRaid: - return "Linux RAID"; - case SunTag.LinuxSwap: - return "Linux swap"; - case SunTag.LVM: - return "LVM"; - case SunTag.SunBoot: - return "Sun boot"; - case SunTag.SunEmpty: - return "Empty"; - case SunTag.SunHome: - return "Sun /home"; - case SunTag.SunRoot: - return "Sun /"; - case SunTag.SunStand: - return "Sun /stand"; - case SunTag.SunSwap: - return "Sun swap"; - case SunTag.SunUsr: - return "Sun /usr"; - case SunTag.SunVar: - return "Sun /var"; - case SunTag.SunWholeDisk: - return "Whole disk"; - case SunTag.SunAlt: - return "Replacement sectors"; - case SunTag.SunCache: - return "Sun cachefs"; - case SunTag.SunReserved: - return "Reserved for SMI"; - case SunTag.VxVmPublic: - return "Veritas public"; - case SunTag.VxVmPrivate: - return "Veritas private"; - case SunTag.NetBSD: - return "NetBSD"; - case SunTag.FreeBSD_Swap: - return "FreeBSD swap"; - case SunTag.FreeBSD_UFS: - return "FreeBSD"; - case SunTag.FreeBSD_Vinum: - return "Vinum"; - case SunTag.FreeBSD_ZFS: - return "FreeBSD ZFS"; - case SunTag.FreeBSD_NANDFS: - return "FreeBSD nandfs"; - default: - return "Unknown"; + case SunTag.Linux: return "Linux"; + case SunTag.LinuxRaid: return "Linux RAID"; + case SunTag.LinuxSwap: return "Linux swap"; + case SunTag.LVM: return "LVM"; + case SunTag.SunBoot: return "Sun boot"; + case SunTag.SunEmpty: return "Empty"; + case SunTag.SunHome: return "Sun /home"; + case SunTag.SunRoot: return "Sun /"; + case SunTag.SunStand: return "Sun /stand"; + case SunTag.SunSwap: return "Sun swap"; + case SunTag.SunUsr: return "Sun /usr"; + case SunTag.SunVar: return "Sun /var"; + case SunTag.SunWholeDisk: return "Whole disk"; + case SunTag.SunAlt: return "Replacement sectors"; + case SunTag.SunCache: return "Sun cachefs"; + case SunTag.SunReserved: return "Reserved for SMI"; + case SunTag.VxVmPublic: return "Veritas public"; + case SunTag.VxVmPrivate: return "Veritas private"; + case SunTag.NetBSD: return "NetBSD"; + case SunTag.FreeBSD_Swap: return "FreeBSD swap"; + case SunTag.FreeBSD_UFS: return "FreeBSD"; + case SunTag.FreeBSD_Vinum: return "Vinum"; + case SunTag.FreeBSD_ZFS: return "FreeBSD ZFS"; + case SunTag.FreeBSD_NANDFS: return "FreeBSD nandfs"; + default: return "Unknown"; } } @@ -479,11 +469,9 @@ namespace DiscImageChef.PartPlugins struct dk_label { /// <summary>Informative string</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_ASCII)] - public byte[] dkl_asciilabel; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_ASCII)] public byte[] dkl_asciilabel; /// <summary>Padding</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_PAD)] - public byte[] dkl_pad; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_PAD)] public byte[] dkl_pad; /// <summary>rotations per minute</summary> public ushort dkl_rpm; /// <summary># physical cylinders</summary> @@ -509,8 +497,7 @@ namespace DiscImageChef.PartPlugins /// <summary>physical partition #</summary> public ushort dkl_ppart; /// <summary>Logical partitions</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)] - public dk_map[] dkl_map; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)] public dk_map[] dkl_map; /// <summary>identifies this label format</summary> public ushort dkl_magic; /// <summary>xor checksum of sector</summary> @@ -547,65 +534,53 @@ namespace DiscImageChef.PartPlugins /// <summary> layout version</summary> public uint v_version; /// <summary> volume name</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_VVOL)] - public byte[] v_volume; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_VVOL)] public byte[] v_volume; /// <summary> number of partitions </summary> public ushort v_nparts; /// <summary> partition hdrs, sec 2</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)] - public dk_map2[] v_part; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)] public dk_map2[] v_part; /// <summary>Alignment</summary> public ushort padding; /// <summary> info needed by mboot</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public uint[] v_bootinfo; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] v_bootinfo; /// <summary> to verify vtoc sanity</summary> public uint v_sanity; /// <summary> free space</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public uint[] v_reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public uint[] v_reserved; /// <summary> partition timestamp</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)] - public int[] v_timestamp; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)] public int[] v_timestamp; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct dk_vtoc16 { /// <summary>info needed by mboot</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public uint[] v_bootinfo; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] v_bootinfo; /// <summary>to verify vtoc sanity</summary> public uint v_sanity; /// <summary>layout version</summary> public uint v_version; /// <summary>volume name</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_VVOL)] - public byte[] v_volume; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_VVOL)] public byte[] v_volume; /// <summary>sector size in bytes</summary> public ushort v_sectorsz; /// <summary>number of partitions</summary> public ushort v_nparts; /// <summary>free space</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public uint[] v_reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public uint[] v_reserved; /// <summary>partition headers</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP16)] - public dkl_partition[] v_part; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP16)] public dkl_partition[] v_part; /// <summary>partition timestamp</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP16)] - public int[] v_timestamp; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP16)] public int[] v_timestamp; /// <summary>for compatibility</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_ASCII)] - public byte[] v_asciilabel; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_ASCII)] public byte[] v_asciilabel; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct dk_label8 { /// <summary>for compatibility</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_ASCII)] - public byte[] dkl_asciilabel; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_ASCII)] public byte[] dkl_asciilabel; /// <summary>vtoc inclusions from AT&T SVr4</summary> public dk_vtoc8 dkl_vtoc; /// <summary># sectors to skip, writes</summary> @@ -613,8 +588,7 @@ namespace DiscImageChef.PartPlugins /// <summary># sectors to skip, reads</summary> public ushort dkl_read_reinstruct; /// <summary>unused part of 512 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_PAD8)] - public byte[] dkl_pad; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_PAD8)] public byte[] dkl_pad; /// <summary>rotations per minute</summary> public ushort dkl_rpm; /// <summary># physical cylinders</summary> @@ -640,8 +614,7 @@ namespace DiscImageChef.PartPlugins /// <summary>obsolete</summary> public ushort dkl_obs4; /// <summary>logical partition headers</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)] - public dk_map[] dkl_map; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)] public dk_map[] dkl_map; /// <summary>identifies this label format</summary> public ushort dkl_magic; /// <summary>xor checksum of sector</summary> @@ -678,11 +651,9 @@ namespace DiscImageChef.PartPlugins /// <summary># sectors to skip, reads </summary> public ushort dkl_read_reinstruct; /// <summary>for compatible expansion</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public ushort[] dkl_extra; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public ushort[] dkl_extra; /// <summary>unused part of 512 bytes</summary> - [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_PAD16)] - public byte[] dkl_pad; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_PAD16)] public byte[] dkl_pad; /// <summary>identifies this label format</summary> public ushort dkl_magic; /// <summary>xor checksum of sector</summary> diff --git a/DiscImageChef.Partitions/UNIX.cs b/DiscImageChef.Partitions/UNIX.cs index 09b7da37..2d7fb54b 100644 --- a/DiscImageChef.Partitions/UNIX.cs +++ b/DiscImageChef.Partitions/UNIX.cs @@ -54,8 +54,7 @@ namespace DiscImageChef.PartPlugins partitions = new List<Partition>(); Partition[] parts = new Partition[0]; - if(sectorOffset != 0) - return false; + if(sectorOffset != 0) return false; switch(imagePlugin.ImageInfo.mediaType) { @@ -115,184 +114,1340 @@ namespace DiscImageChef.PartPlugins case MediaType.RP06: parts = RP06; break; - default: - return false; + default: return false; } - for(int i = 0; i < parts.Length; i++) - parts[i].Scheme = ""; + for(int i = 0; i < parts.Length; i++) parts[i].Scheme = ""; partitions = parts.ToList(); return partitions.Count > 0; } - readonly Partition[] RA60 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 9600, Start = 0, Size = 4915200, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 20000, Start = 9600, Size = 10240000, Offset = 4915200, Sequence = 1 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 29600, Size = 102400, Offset = 15155200, Sequence = 2 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 6000, Start = 29800, Size = 3072000, Offset = 15257600, Sequence = 2 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 363376, Start = 35800, Size = 186048512, Offset = 18329600, Sequence = 3 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 181688, Start = 35800, Size = 93024256, Offset = 18329600, Sequence = 4 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 181688, Start = 217488, Size = 93024256, Offset = 111353856, Sequence = 5 }, - new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 1000, Start = 399176, Size = 512000, Offset = 204378112, Sequence = 8 }, + readonly Partition[] RA60 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 9600, + Start = 0, + Size = 4915200, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 20000, + Start = 9600, + Size = 10240000, + Offset = 4915200, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 200, + Start = 29600, + Size = 102400, + Offset = 15155200, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 6000, + Start = 29800, + Size = 3072000, + Offset = 15257600, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 363376, + Start = 35800, + Size = 186048512, + Offset = 18329600, + Sequence = 3 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 181688, + Start = 35800, + Size = 93024256, + Offset = 18329600, + Sequence = 4 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 181688, + Start = 217488, + Size = 93024256, + Offset = 111353856, + Sequence = 5 + }, + new Partition + { + Description = null, + Name = "maintenance area", + Type = "maintenance", + Length = 1000, + Start = 399176, + Size = 512000, + Offset = 204378112, + Sequence = 8 + }, }; - readonly Partition[] RA80 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 9600, Start = 0, Size = 4915200, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 20000, Start = 9600, Size = 10240000, Offset = 4915200, Sequence = 1 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 29600, Size = 102400, Offset = 15155200, Sequence = 2 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 6000, Start = 29800, Size = 3072000, Offset = 15257600, Sequence = 2 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 200412, Start = 35800, Size = 102610944, Offset = 18329600, Sequence = 3 }, - new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 1000, Start = 236212, Size = 512000, Offset = 120940544, Sequence = 8 }, + readonly Partition[] RA80 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 9600, + Start = 0, + Size = 4915200, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 20000, + Start = 9600, + Size = 10240000, + Offset = 4915200, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 200, + Start = 29600, + Size = 102400, + Offset = 15155200, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 6000, + Start = 29800, + Size = 3072000, + Offset = 15257600, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 200412, + Start = 35800, + Size = 102610944, + Offset = 18329600, + Sequence = 3 + }, + new Partition + { + Description = null, + Name = "maintenance area", + Type = "maintenance", + Length = 1000, + Start = 236212, + Size = 512000, + Offset = 120940544, + Sequence = 8 + }, }; - readonly Partition[] RA81 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 9600, Start = 0, Size = 4915200, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 20000, Start = 9600, Size = 10240000, Offset = 4915200, Sequence = 1 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 29600, Size = 102400, Offset = 15155200, Sequence = 2 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 6000, Start = 29800, Size = 3072000, Offset = 15257600, Sequence = 2 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 854272, Start = 35800, Size = 437387264, Offset = 18329600, Sequence = 3 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 181688, Start = 35800, Size = 93024256, Offset = 18329600, Sequence = 4 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 181688, Start = 217488, Size = 93024256, Offset = 111353856, Sequence = 5 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 490896, Start = 399176, Size = 251338752, Offset = 204378112, Sequence = 6 }, - new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 1000, Start = 890072, Size = 512000, Offset = 455716864, Sequence = 8 }, + readonly Partition[] RA81 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 9600, + Start = 0, + Size = 4915200, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 20000, + Start = 9600, + Size = 10240000, + Offset = 4915200, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 200, + Start = 29600, + Size = 102400, + Offset = 15155200, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 6000, + Start = 29800, + Size = 3072000, + Offset = 15257600, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 854272, + Start = 35800, + Size = 437387264, + Offset = 18329600, + Sequence = 3 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 181688, + Start = 35800, + Size = 93024256, + Offset = 18329600, + Sequence = 4 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 181688, + Start = 217488, + Size = 93024256, + Offset = 111353856, + Sequence = 5 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 490896, + Start = 399176, + Size = 251338752, + Offset = 204378112, + Sequence = 6 + }, + new Partition + { + Description = null, + Name = "maintenance area", + Type = "maintenance", + Length = 1000, + Start = 890072, + Size = 512000, + Offset = 455716864, + Sequence = 8 + }, }; - readonly Partition[] RC25 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 9000, Start = 0, Size = 4608000, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 9000, Size = 102400, Offset = 4608000, Sequence = 2 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 4000, Start = 9200, Size = 2048000, Offset = 4710400, Sequence = 2 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 37600, Start = 13200, Size = 19251200, Offset = 6758400, Sequence = 3 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 12000, Start = 13200, Size = 6144000, Offset = 6758400, Sequence = 4 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 25600, Start = 25200, Size = 13107200, Offset = 6758400, Sequence = 5 }, - new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 102, Start = 890072, Size = 50800, Offset = 26009600, Sequence = 8 }, + readonly Partition[] RC25 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 9000, + Start = 0, + Size = 4608000, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 200, + Start = 9000, + Size = 102400, + Offset = 4608000, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 4000, + Start = 9200, + Size = 2048000, + Offset = 4710400, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 37600, + Start = 13200, + Size = 19251200, + Offset = 6758400, + Sequence = 3 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 12000, + Start = 13200, + Size = 6144000, + Offset = 6758400, + Sequence = 4 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 25600, + Start = 25200, + Size = 13107200, + Offset = 6758400, + Sequence = 5 + }, + new Partition + { + Description = null, + Name = "maintenance area", + Type = "maintenance", + Length = 102, + Start = 890072, + Size = 50800, + Offset = 26009600, + Sequence = 8 + }, }; - readonly Partition[] RD31 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 9700, Start = 0, Size = 4966400, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 9700, Size = 51200, Offset = 4966400, Sequence = 5 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3000, Start = 9800, Size = 1536000, Offset = 5017600, Sequence = 5 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 28728, Start = 12800, Size = 14708736, Offset = 6553600, Sequence = 6 }, - new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 32, Start = 41528, Size = 16384, Offset = 21262336, Sequence = 8 }, + readonly Partition[] RD31 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 9700, + Start = 0, + Size = 4966400, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 100, + Start = 9700, + Size = 51200, + Offset = 4966400, + Sequence = 5 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 3000, + Start = 9800, + Size = 1536000, + Offset = 5017600, + Sequence = 5 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 28728, + Start = 12800, + Size = 14708736, + Offset = 6553600, + Sequence = 6 + }, + new Partition + { + Description = null, + Name = "maintenance area", + Type = "maintenance", + Length = 32, + Start = 41528, + Size = 16384, + Offset = 21262336, + Sequence = 8 + }, }; - readonly Partition[] RD32 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 9700, Start = 0, Size = 4966400, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 17300, Start = 9700, Size = 102400, Offset = 4966400, Sequence = 1 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 27000, Size = 51200, Offset = 13824000, Sequence = 2 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3000, Start = 27100, Size = 1536000, Offset = 13875200, Sequence = 2 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 53072, Start = 30100, Size = 27172864, Offset = 15411200, Sequence = 3 }, - new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 32, Start = 83172, Size = 16384, Offset = 42584064, Sequence = 8 }, + readonly Partition[] RD32 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 9700, + Start = 0, + Size = 4966400, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 17300, + Start = 9700, + Size = 102400, + Offset = 4966400, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 100, + Start = 27000, + Size = 51200, + Offset = 13824000, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 3000, + Start = 27100, + Size = 1536000, + Offset = 13875200, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 53072, + Start = 30100, + Size = 27172864, + Offset = 15411200, + Sequence = 3 + }, + new Partition + { + Description = null, + Name = "maintenance area", + Type = "maintenance", + Length = 32, + Start = 83172, + Size = 16384, + Offset = 42584064, + Sequence = 8 + }, }; - readonly Partition[] RD51 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 7460, Start = 0, Size = 4608000, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 40, Start = 0, Size = 20480, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 2200, Start = 0, Size = 1126400, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 11868, Start = 9700, Size = 6076416, Offset = 6758400, Sequence = 4 }, - new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 32, Start = 21568, Size = 16384, Offset = 11042816, Sequence = 8 }, + readonly Partition[] RD51 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 7460, + Start = 0, + Size = 4608000, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 40, + Start = 0, + Size = 20480, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 2200, + Start = 0, + Size = 1126400, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 11868, + Start = 9700, + Size = 6076416, + Offset = 6758400, + Sequence = 4 + }, + new Partition + { + Description = null, + Name = "maintenance area", + Type = "maintenance", + Length = 32, + Start = 21568, + Size = 16384, + Offset = 11042816, + Sequence = 8 + }, }; - readonly Partition[] RD52 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 9700, Start = 0, Size = 4966400, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 17300, Start = 9700, Size = 8857600, Offset = 4966400, Sequence = 1 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 27000, Size = 51200, Offset = 13824000, Sequence = 2 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3000, Start = 27100, Size = 1536000, Offset = 13875200, Sequence = 2 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 30348, Start = 30100, Size = 15538176, Offset = 15411200, Sequence = 3 }, - new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 32, Start = 60448, Size = 16384, Offset = 30949376, Sequence = 8 }, + readonly Partition[] RD52 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 9700, + Start = 0, + Size = 4966400, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 17300, + Start = 9700, + Size = 8857600, + Offset = 4966400, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 100, + Start = 27000, + Size = 51200, + Offset = 13824000, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 3000, + Start = 27100, + Size = 1536000, + Offset = 13875200, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 30348, + Start = 30100, + Size = 15538176, + Offset = 15411200, + Sequence = 3 + }, + new Partition + { + Description = null, + Name = "maintenance area", + Type = "maintenance", + Length = 32, + Start = 60448, + Size = 16384, + Offset = 30949376, + Sequence = 8 + }, }; - readonly Partition[] RD53 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 9700, Start = 0, Size = 4966400, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 17300, Start = 9700, Size = 8857600, Offset = 4966400, Sequence = 1 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 27000, Size = 51200, Offset = 13824000, Sequence = 2 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3000, Start = 27100, Size = 1536000, Offset = 13875200, Sequence = 2 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 108540, Start = 30100, Size = 55572480, Offset = 15411200, Sequence = 3 }, - new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 32, Start = 138640, Size = 16384, Offset = 70983680, Sequence = 8 }, + readonly Partition[] RD53 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 9700, + Start = 0, + Size = 4966400, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 17300, + Start = 9700, + Size = 8857600, + Offset = 4966400, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 100, + Start = 27000, + Size = 51200, + Offset = 13824000, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 3000, + Start = 27100, + Size = 1536000, + Offset = 13875200, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 108540, + Start = 30100, + Size = 55572480, + Offset = 15411200, + Sequence = 3 + }, + new Partition + { + Description = null, + Name = "maintenance area", + Type = "maintenance", + Length = 32, + Start = 138640, + Size = 16384, + Offset = 70983680, + Sequence = 8 + }, }; - readonly Partition[] RD54 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 9700, Start = 0, Size = 4966400, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 17300, Start = 9700, Size = 8857600, Offset = 4966400, Sequence = 1 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 27000, Size = 51200, Offset = 13824000, Sequence = 2 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3000, Start = 27100, Size = 1536000, Offset = 13875200, Sequence = 2 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 281068, Start = 30100, Size = 143906816, Offset = 15411200, Sequence = 3 }, - new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 32, Start = 311168, Size = 16384, Offset = 159318016, Sequence = 8 }, + readonly Partition[] RD54 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 9700, + Start = 0, + Size = 4966400, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 17300, + Start = 9700, + Size = 8857600, + Offset = 4966400, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 100, + Start = 27000, + Size = 51200, + Offset = 13824000, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 3000, + Start = 27100, + Size = 1536000, + Offset = 13875200, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 281068, + Start = 30100, + Size = 143906816, + Offset = 15411200, + Sequence = 3 + }, + new Partition + { + Description = null, + Name = "maintenance area", + Type = "maintenance", + Length = 32, + Start = 311168, + Size = 16384, + Offset = 159318016, + Sequence = 8 + }, }; - readonly Partition[] RK06 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 7920, Start = 0, Size = 4055040, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 7920, Size = 51200, Offset = 4055040, Sequence = 1 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 2936, Start = 8020, Size = 1503232, Offset = 4106240, Sequence = 1 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 16126, Start = 10956, Size = 8256512, Offset = 5609472, Sequence = 2 }, - new Partition{ Description = null, Name = "bad sector file", Type = "bad", Length = 44, Start = 27082, Size = 22528, Offset = 13865984, Sequence = 8 }, + readonly Partition[] RK06 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 7920, + Start = 0, + Size = 4055040, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 100, + Start = 7920, + Size = 51200, + Offset = 4055040, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 2936, + Start = 8020, + Size = 1503232, + Offset = 4106240, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 16126, + Start = 10956, + Size = 8256512, + Offset = 5609472, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "bad sector file", + Type = "bad", + Length = 44, + Start = 27082, + Size = 22528, + Offset = 13865984, + Sequence = 8 + }, }; - readonly Partition[] RK07 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 7920, Start = 0, Size = 4055040, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 7920, Size = 51200, Offset = 4055040, Sequence = 1 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 2936, Start = 8020, Size = 1503232, Offset = 4106240, Sequence = 1 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 42790, Start = 10956, Size = 21908480, Offset = 5609472, Sequence = 3 }, - new Partition{ Description = null, Name = "bad sector file", Type = "bad", Length = 44, Start = 53746, Size = 22528, Offset = 27517952, Sequence = 8 }, + readonly Partition[] RK07 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 7920, + Start = 0, + Size = 4055040, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 100, + Start = 7920, + Size = 51200, + Offset = 4055040, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 2936, + Start = 8020, + Size = 1503232, + Offset = 4106240, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 42790, + Start = 10956, + Size = 21908480, + Offset = 5609472, + Sequence = 3 + }, + new Partition + { + Description = null, + Name = "bad sector file", + Type = "bad", + Length = 44, + Start = 53746, + Size = 22528, + Offset = 27517952, + Sequence = 8 + }, }; - readonly Partition[] RP02 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 8400, Start = 0, Size = 4300800, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 8400, Size = 51200, Offset = 4300800, Sequence = 1 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3100, Start = 8500, Size = 1587200, Offset = 4352000, Sequence = 1 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 28400, Start = 11600, Size = 14540800, Offset = 5939200, Sequence = 2 }, + readonly Partition[] RP02 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 8400, + Start = 0, + Size = 4300800, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 100, + Start = 8400, + Size = 51200, + Offset = 4300800, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 3100, + Start = 8500, + Size = 1587200, + Offset = 4352000, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 28400, + Start = 11600, + Size = 14540800, + Offset = 5939200, + Sequence = 2 + }, }; - readonly Partition[] RP03 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 8400, Start = 0, Size = 4300800, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 8400, Size = 51200, Offset = 4300800, Sequence = 1 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3100, Start = 8500, Size = 1587200, Offset = 4352000, Sequence = 1 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 68400, Start = 11600, Size = 35020800, Offset = 5939200, Sequence = 2 }, + readonly Partition[] RP03 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 8400, + Start = 0, + Size = 4300800, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 100, + Start = 8400, + Size = 51200, + Offset = 4300800, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 3100, + Start = 8500, + Size = 1587200, + Offset = 4352000, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 68400, + Start = 11600, + Size = 35020800, + Offset = 5939200, + Sequence = 2 + }, }; - readonly Partition[] RP04 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 9614, Start = 0, Size = 4922368, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 20064, Start = 9614, Size = 10272768, Offset = 4922368, Sequence = 1 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 29678, Size = 102400, Offset = 15195136, Sequence = 2 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 6070, Start = 29878, Size = 1587200, Offset = 15297536, Sequence = 2 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 135806, Start = 35948, Size = 69532672, Offset = 18405376, Sequence = 3 }, - new Partition{ Description = null, Name = "bad sector file", Type = "bad", Length = 44, Start = 171754, Size = 22528, Offset = 87938048, Sequence = 8 }, + readonly Partition[] RP04 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 9614, + Start = 0, + Size = 4922368, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 20064, + Start = 9614, + Size = 10272768, + Offset = 4922368, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 200, + Start = 29678, + Size = 102400, + Offset = 15195136, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 6070, + Start = 29878, + Size = 1587200, + Offset = 15297536, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 135806, + Start = 35948, + Size = 69532672, + Offset = 18405376, + Sequence = 3 + }, + new Partition + { + Description = null, + Name = "bad sector file", + Type = "bad", + Length = 44, + Start = 171754, + Size = 22528, + Offset = 87938048, + Sequence = 8 + }, }; - readonly Partition[] RP06 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 9614, Start = 0, Size = 4922368, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 20064, Start = 9614, Size = 10272768, Offset = 4922368, Sequence = 1 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 29678, Size = 102400, Offset = 15195136, Sequence = 2 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 6070, Start = 29878, Size = 1587200, Offset = 15297536, Sequence = 2 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 135806, Start = 35948, Size = 69532672, Offset = 18405376, Sequence = 3 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 304678, Start = 35948, Size = 155995136, Offset = 18405376, Sequence = 4 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 166828, Start = 171798, Size = 85415936, Offset = 87960576, Sequence = 5 }, - new Partition{ Description = null, Name = "bad sector file", Type = "bad", Length = 44, Start = 340626, Size = 22528, Offset = 174400512, Sequence = 8 }, + readonly Partition[] RP06 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 9614, + Start = 0, + Size = 4922368, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 20064, + Start = 9614, + Size = 10272768, + Offset = 4922368, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 200, + Start = 29678, + Size = 102400, + Offset = 15195136, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 6070, + Start = 29878, + Size = 1587200, + Offset = 15297536, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 135806, + Start = 35948, + Size = 69532672, + Offset = 18405376, + Sequence = 3 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 304678, + Start = 35948, + Size = 155995136, + Offset = 18405376, + Sequence = 4 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 166828, + Start = 171798, + Size = 85415936, + Offset = 87960576, + Sequence = 5 + }, + new Partition + { + Description = null, + Name = "bad sector file", + Type = "bad", + Length = 44, + Start = 340626, + Size = 22528, + Offset = 174400512, + Sequence = 8 + }, }; - readonly Partition[] RM02 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 9120, Start = 0, Size = 4669440, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 9120, Size = 102400, Offset = 4669440, Sequence = 1 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 5400, Start = 9320, Size = 2764800, Offset = 2764800, Sequence = 1 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 5600, Start = 29120, Size = 2867200, Offset = 14909440, Sequence = 2 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 96896, Start = 34720, Size = 49610752, Offset = 17776640, Sequence = 3 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 32160, Start = 34720, Size = 16465920, Offset = 17776640, Sequence = 4 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 32160, Start = 66880, Size = 16465920, Offset = 34242560, Sequence = 5 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 32576, Start = 99040, Size = 16678912, Offset = 50708480, Sequence = 6 }, - new Partition{ Description = null, Name = "bad sector file", Type = "bad", Length = 64, Start = 131616, Size = 32768, Offset = 67387392, Sequence = 8 }, + readonly Partition[] RM02 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 9120, + Start = 0, + Size = 4669440, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 200, + Start = 9120, + Size = 102400, + Offset = 4669440, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 5400, + Start = 9320, + Size = 2764800, + Offset = 2764800, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 5600, + Start = 29120, + Size = 2867200, + Offset = 14909440, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 96896, + Start = 34720, + Size = 49610752, + Offset = 17776640, + Sequence = 3 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 32160, + Start = 34720, + Size = 16465920, + Offset = 17776640, + Sequence = 4 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 32160, + Start = 66880, + Size = 16465920, + Offset = 34242560, + Sequence = 5 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 32576, + Start = 99040, + Size = 16678912, + Offset = 50708480, + Sequence = 6 + }, + new Partition + { + Description = null, + Name = "bad sector file", + Type = "bad", + Length = 64, + Start = 131616, + Size = 32768, + Offset = 67387392, + Sequence = 8 + }, }; - readonly Partition[] RM05 = { - new Partition{ Description = null, Name = "/", Type = "data", Length = 10336, Start = 0, Size = 5292032, Offset = 0, Sequence = 0 }, - new Partition{ Description = null, Name = "/usr", Type = "data", Length = 21280, Start = 10336, Size = 10895360, Offset = 5292032, Sequence = 1 }, - new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 31616, Size = 102400, Offset = 16187392, Sequence = 2 }, - new Partition{ Description = null, Name = "swap", Type = "swap", Length = 6388, Start = 31816, Size = 3270656, Offset = 16289792, Sequence = 2 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 462016, Start = 38304, Size = 236552192, Offset = 19611648, Sequence = 3 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 153824, Start = 38304, Size = 78757888, Offset = 19611648, Sequence = 4 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 153824, Start = 192128, Size = 78757888, Offset = 98369536, Sequence = 5 }, - new Partition{ Description = null, Name = "user", Type = "data", Length = 154368, Start = 192128, Size = 79036416, Offset = 98369536, Sequence = 6 }, - new Partition{ Description = null, Name = "bad sector file", Type = "bad", Length = 64, Start = 421312, Size = 32768, Offset = 215711744, Sequence = 8 }, + readonly Partition[] RM05 = + { + new Partition + { + Description = null, + Name = "/", + Type = "data", + Length = 10336, + Start = 0, + Size = 5292032, + Offset = 0, + Sequence = 0 + }, + new Partition + { + Description = null, + Name = "/usr", + Type = "data", + Length = 21280, + Start = 10336, + Size = 10895360, + Offset = 5292032, + Sequence = 1 + }, + new Partition + { + Description = null, + Name = "error log", + Type = "errorlog", + Length = 200, + Start = 31616, + Size = 102400, + Offset = 16187392, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "swap", + Type = "swap", + Length = 6388, + Start = 31816, + Size = 3270656, + Offset = 16289792, + Sequence = 2 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 462016, + Start = 38304, + Size = 236552192, + Offset = 19611648, + Sequence = 3 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 153824, + Start = 38304, + Size = 78757888, + Offset = 19611648, + Sequence = 4 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 153824, + Start = 192128, + Size = 78757888, + Offset = 98369536, + Sequence = 5 + }, + new Partition + { + Description = null, + Name = "user", + Type = "data", + Length = 154368, + Start = 192128, + Size = 79036416, + Offset = 98369536, + Sequence = 6 + }, + new Partition + { + Description = null, + Name = "bad sector file", + Type = "bad", + Length = 64, + Start = 421312, + Size = 32768, + Offset = 215711744, + Sequence = 8 + }, }; } -} +} \ No newline at end of file diff --git a/DiscImageChef.Partitions/VTOC.cs b/DiscImageChef.Partitions/VTOC.cs index 00ae5a3a..50225cfc 100644 --- a/DiscImageChef.Partitions/VTOC.cs +++ b/DiscImageChef.Partitions/VTOC.cs @@ -46,7 +46,7 @@ namespace DiscImageChef.PartPlugins const uint PD_CIGAM = 0x0D605ECA; const uint VTOC_ENAS = 0xEEDE0D60; const int V_NUMPAR = 16; - const uint XPDVERS = 3; /* 1st version of extended pdinfo */ + const uint XPDVERS = 3; /* 1st version of extended pdinfo */ public VTOC() { @@ -66,12 +66,12 @@ namespace DiscImageChef.PartPlugins foreach(ulong i in new ulong[] {0, 1, 8, 29}) { - if(i + sectorOffset >= imagePlugin.GetSectors()) - break; - + if(i + sectorOffset >= imagePlugin.GetSectors()) break; + pdsector = imagePlugin.ReadSector(i + sectorOffset); magic = BitConverter.ToUInt32(pdsector, 4); - DicConsole.DebugWriteLine("VTOC plugin", "sanity at {0} is 0x{1:X8} (should be 0x{2:X8} or 0x{3:X8})", i + sectorOffset, magic, PD_MAGIC, PD_CIGAM); + DicConsole.DebugWriteLine("VTOC plugin", "sanity at {0} is 0x{1:X8} (should be 0x{2:X8} or 0x{3:X8})", + i + sectorOffset, magic, PD_MAGIC, PD_CIGAM); if(magic == PD_MAGIC || magic == PD_CIGAM) { magic_found = true; @@ -80,8 +80,7 @@ namespace DiscImageChef.PartPlugins } } - if(!magic_found) - return false; + if(!magic_found) return false; PDInfo pd; PDInfoOld pdold; @@ -101,7 +100,8 @@ namespace DiscImageChef.PartPlugins } DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.driveid = {0}", pd.driveid); - DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.sanity = 0x{0:X8} (should be 0x{1:X8})", pd.sanity, PD_MAGIC); + DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.sanity = 0x{0:X8} (should be 0x{1:X8})", pd.sanity, + PD_MAGIC); DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.version = {0}", pd.version); DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.serial = \"{0}\"", StringHandlers.CToString(pd.serial)); DicConsole.DebugWriteLine("VTOC plugin", "pdinfo.cyls = {0}", pd.cyls); @@ -208,11 +208,12 @@ namespace DiscImageChef.PartPlugins { DicConsole.DebugWriteLine("VTOC plugin", "Searching for VTOC on relative byte {0}", pd.vtoc_ptr); ulong rel_sec_ptr = pd.vtoc_ptr / imagePlugin.GetSectorSize(); - uint rel_sec_off =pd.vtoc_ptr % imagePlugin.GetSectorSize(); + uint rel_sec_off = pd.vtoc_ptr % imagePlugin.GetSectorSize(); uint sec_count = (rel_sec_off + pd.vtoc_len) / imagePlugin.GetSectorSize(); - if((rel_sec_off + pd.vtoc_len) % imagePlugin.GetSectorSize() > 0) - sec_count++; - DicConsole.DebugWriteLine("VTOC plugin", "Going to read {0} sectors from sector {1}, getting VTOC from byte {2}", sec_count, rel_sec_ptr + sectorOffset, rel_sec_off); + if((rel_sec_off + pd.vtoc_len) % imagePlugin.GetSectorSize() > 0) sec_count++; + DicConsole.DebugWriteLine("VTOC plugin", + "Going to read {0} sectors from sector {1}, getting VTOC from byte {2}", + sec_count, rel_sec_ptr + sectorOffset, rel_sec_off); if(rel_sec_ptr + sectorOffset + sec_count >= imagePlugin.GetSectors()) { DicConsole.DebugWriteLine("VTOC plugin", "Going to read past device size, aborting..."); @@ -258,34 +259,47 @@ namespace DiscImageChef.PartPlugins if(useOld) { - DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_sanity = 0x{0:X8} (should be 0x{1:X8})", vtocOld.v_sanity, VTOC_SANE); + DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_sanity = 0x{0:X8} (should be 0x{1:X8})", + vtocOld.v_sanity, VTOC_SANE); DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_version = {0}", vtocOld.v_version); - DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_volume = \"{0}\"", StringHandlers.CToString(vtocOld.v_volume)); + DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_volume = \"{0}\"", + StringHandlers.CToString(vtocOld.v_volume)); DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_sectorsz = {0}", vtocOld.v_sectorsz); DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_nparts = {0}", vtocOld.v_nparts); for(int i = 0; i < V_NUMPAR; i++) { - DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_part[{0}].p_tag = {1} ({2})", i, vtocOld.v_part[i].p_tag, (ushort)vtocOld.v_part[i].p_tag); - DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_part[{0}].p_flag = {1} ({2})", i, vtocOld.v_part[i].p_flag, (ushort)vtocOld.v_part[i].p_flag); - DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_part[{0}].p_start = {1}", i, vtocOld.v_part[i].p_start); - DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_part[{0}].p_size = {1}", i, vtocOld.v_part[i].p_size); - DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.timestamp[{0}] = {1}", i, DateHandlers.UNIXToDateTime(vtocOld.timestamp[i])); + DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_part[{0}].p_tag = {1} ({2})", i, + vtocOld.v_part[i].p_tag, (ushort)vtocOld.v_part[i].p_tag); + DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_part[{0}].p_flag = {1} ({2})", i, + vtocOld.v_part[i].p_flag, (ushort)vtocOld.v_part[i].p_flag); + DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_part[{0}].p_start = {1}", i, + vtocOld.v_part[i].p_start); + DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_part[{0}].p_size = {1}", i, + vtocOld.v_part[i].p_size); + DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.timestamp[{0}] = {1}", i, + DateHandlers.UNIXToDateTime(vtocOld.timestamp[i])); } } else { - DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_sanity = 0x{0:X8} (should be 0x{1:X8})", vtoc.v_sanity, VTOC_SANE); + DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_sanity = 0x{0:X8} (should be 0x{1:X8})", vtoc.v_sanity, + VTOC_SANE); DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_version = {0}", vtoc.v_version); - DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_volume = \"{0}\"", StringHandlers.CToString(vtoc.v_volume)); + DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_volume = \"{0}\"", + StringHandlers.CToString(vtoc.v_volume)); DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_pad = {0}", vtoc.v_pad); DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_nparts = {0}", vtoc.v_nparts); for(int i = 0; i < V_NUMPAR; i++) { - DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_part[{0}].p_tag = {1} ({2})", i, vtoc.v_part[i].p_tag, (ushort)vtoc.v_part[i].p_tag); - DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_part[{0}].p_flag = {1} ({2})", i, vtoc.v_part[i].p_flag, (ushort)vtoc.v_part[i].p_flag); - DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_part[{0}].p_start = {1}", i, vtoc.v_part[i].p_start); + DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_part[{0}].p_tag = {1} ({2})", i, + vtoc.v_part[i].p_tag, (ushort)vtoc.v_part[i].p_tag); + DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_part[{0}].p_flag = {1} ({2})", i, + vtoc.v_part[i].p_flag, (ushort)vtoc.v_part[i].p_flag); + DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_part[{0}].p_start = {1}", i, + vtoc.v_part[i].p_start); DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_part[{0}].p_size = {1}", i, vtoc.v_part[i].p_size); - DicConsole.DebugWriteLine("VTOC plugin", "vtoc.timestamp[{0}] = {1}", i, DateHandlers.UNIXToDateTime(vtoc.timestamp[i])); + DicConsole.DebugWriteLine("VTOC plugin", "vtoc.timestamp[{0}] = {1}", i, + DateHandlers.UNIXToDateTime(vtoc.timestamp[i])); } } @@ -340,23 +354,17 @@ namespace DiscImageChef.PartPlugins part.Offset += sectorOffset * imagePlugin.GetSectorSize(); } - if(parts[i].p_flag.HasFlag(pFlag.V_VALID)) - info += " (valid)"; - if(parts[i].p_flag.HasFlag(pFlag.V_UNMNT)) - info += " (unmountable)"; - if(parts[i].p_flag.HasFlag(pFlag.V_OPEN)) - info += " (open)"; - if(parts[i].p_flag.HasFlag(pFlag.V_REMAP)) - info += " (alternate sector mapping)"; - if(parts[i].p_flag.HasFlag(pFlag.V_RONLY)) - info += " (read-only)"; + if(parts[i].p_flag.HasFlag(pFlag.V_VALID)) info += " (valid)"; + if(parts[i].p_flag.HasFlag(pFlag.V_UNMNT)) info += " (unmountable)"; + if(parts[i].p_flag.HasFlag(pFlag.V_OPEN)) info += " (open)"; + if(parts[i].p_flag.HasFlag(pFlag.V_REMAP)) info += " (alternate sector mapping)"; + if(parts[i].p_flag.HasFlag(pFlag.V_RONLY)) info += " (read-only)"; if(timestamps[i] != 0) info += string.Format(" created on {0}", DateHandlers.UNIXToDateTime(timestamps[i])); part.Description = "UNIX slice" + info + "."; - if(part.End < imagePlugin.GetSectors()) - partitions.Add(part); + if(part.End < imagePlugin.GetSectors()) partitions.Add(part); } } @@ -366,68 +374,65 @@ namespace DiscImageChef.PartPlugins [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct PDInfo { - public uint driveid; /*identifies the device type*/ - public uint sanity; /*verifies device sanity*/ - public uint version; /*version number*/ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] serial; /*serial number of the device*/ - public uint cyls; /*number of cylinders per drive*/ - public uint tracks; /*number tracks per cylinder*/ - public uint sectors; /*number sectors per track*/ - public uint bytes; /*number of bytes per sector*/ - public uint logicalst; /*sector address of logical sector 0*/ - public uint errlogst; /*sector address of error log area*/ - public uint errlogsz; /*size in bytes of error log area*/ - public uint mfgst; /*sector address of mfg. defect info*/ - public uint mfgsz; /*size in bytes of mfg. defect info*/ - public uint defectst; /*sector address of the defect map*/ - public uint defectsz; /*size in bytes of defect map*/ - public uint relno; /*number of relocation areas*/ - public uint relst; /*sector address of relocation area*/ - public uint relsz; /*size in sectors of relocation area*/ - public uint relnext; /*address of next avail reloc sector*/ - /* the previous items are left intact from AT&T's 3b2 pdinfo. Following - are added for the 80386 port */ - public uint vtoc_ptr; /*byte offset of vtoc block*/ - public ushort vtoc_len; /*byte length of vtoc block*/ - public ushort vtoc_pad; /* pad for 16-bit machine alignment */ - public uint alt_ptr; /*byte offset of alternates table*/ - public ushort alt_len; /*byte length of alternates table*/ - /* new in version 3 */ - public uint pcyls; /*physical cylinders per drive*/ - public uint ptracks; /*physical tracks per cylinder*/ - public uint psectors; /*physical sectors per track*/ - public uint pbytes; /*physical bytes per sector*/ - public uint secovhd; /*sector overhead bytes per sector*/ - public ushort interleave; /*interleave factor*/ - public ushort skew; /*skew factor*/ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public uint[] pad; /*space for more stuff*/ + public uint driveid; /*identifies the device type*/ + public uint sanity; /*verifies device sanity*/ + public uint version; /*version number*/ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] serial; /*serial number of the device*/ + public uint cyls; /*number of cylinders per drive*/ + public uint tracks; /*number tracks per cylinder*/ + public uint sectors; /*number sectors per track*/ + public uint bytes; /*number of bytes per sector*/ + public uint logicalst; /*sector address of logical sector 0*/ + public uint errlogst; /*sector address of error log area*/ + public uint errlogsz; /*size in bytes of error log area*/ + public uint mfgst; /*sector address of mfg. defect info*/ + public uint mfgsz; /*size in bytes of mfg. defect info*/ + public uint defectst; /*sector address of the defect map*/ + public uint defectsz; /*size in bytes of defect map*/ + public uint relno; /*number of relocation areas*/ + public uint relst; /*sector address of relocation area*/ + public uint relsz; /*size in sectors of relocation area*/ + public uint relnext; /*address of next avail reloc sector*/ + /* the previous items are left intact from AT&T's 3b2 pdinfo. Following + are added for the 80386 port */ + public uint vtoc_ptr; /*byte offset of vtoc block*/ + public ushort vtoc_len; /*byte length of vtoc block*/ + public ushort vtoc_pad; /* pad for 16-bit machine alignment */ + public uint alt_ptr; /*byte offset of alternates table*/ + public ushort alt_len; /*byte length of alternates table*/ + /* new in version 3 */ + public uint pcyls; /*physical cylinders per drive*/ + public uint ptracks; /*physical tracks per cylinder*/ + public uint psectors; /*physical sectors per track*/ + public uint pbytes; /*physical bytes per sector*/ + public uint secovhd; /*sector overhead bytes per sector*/ + public ushort interleave; /*interleave factor*/ + public ushort skew; /*skew factor*/ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public uint[] pad; /*space for more stuff*/ } [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct PDInfoOld { - public uint driveid; /*identifies the device type*/ - public uint sanity; /*verifies device sanity*/ - public uint version; /*version number*/ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] serial; /*serial number of the device*/ - public uint cyls; /*number of cylinders per drive*/ - public uint tracks; /*number tracks per cylinder*/ - public uint sectors; /*number sectors per track*/ - public uint bytes; /*number of bytes per sector*/ - public uint logicalst; /*sector address of logical sector 0*/ - public uint errlogst; /*sector address of error log area*/ - public uint errlogsz; /*size in bytes of error log area*/ - public uint mfgst; /*sector address of mfg. defect info*/ - public uint mfgsz; /*size in bytes of mfg. defect info*/ - public uint defectst; /*sector address of the defect map*/ - public uint defectsz; /*size in bytes of defect map*/ - public uint relno; /*number of relocation areas*/ - public uint relst; /*sector address of relocation area*/ - public uint relsz; /*size in sectors of relocation area*/ - public uint relnext; /*address of next avail reloc sector*/ + public uint driveid; /*identifies the device type*/ + public uint sanity; /*verifies device sanity*/ + public uint version; /*version number*/ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] serial; /*serial number of the device*/ + public uint cyls; /*number of cylinders per drive*/ + public uint tracks; /*number tracks per cylinder*/ + public uint sectors; /*number sectors per track*/ + public uint bytes; /*number of bytes per sector*/ + public uint logicalst; /*sector address of logical sector 0*/ + public uint errlogst; /*sector address of error log area*/ + public uint errlogsz; /*size in bytes of error log area*/ + public uint mfgst; /*sector address of mfg. defect info*/ + public uint mfgsz; /*size in bytes of mfg. defect info*/ + public uint defectst; /*sector address of the defect map*/ + public uint defectsz; /*size in bytes of defect map*/ + public uint relno; /*number of relocation areas*/ + public uint relst; /*sector address of relocation area*/ + public uint relsz; /*size in sectors of relocation area*/ + public uint relnext; /*address of next avail reloc sector*/ public uint allcstrt; /*start of the allocatable disk*/ public uint allcend; /*end of allocatable disk*/ } @@ -435,46 +440,37 @@ namespace DiscImageChef.PartPlugins [StructLayout(LayoutKind.Sequential, Pack = 1)] struct vtocold { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public uint[] v_bootinfo; /*info needed by mboot*/ - public uint v_sanity; /*to verify vtoc sanity*/ - public uint v_version; /*layout version*/ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] v_volume; /*volume name*/ - public ushort v_sectorsz; /*sector size in bytes*/ - public ushort v_nparts; /*number of partitions*/ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public uint[] v_reserved; /*free space*/ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = V_NUMPAR)] - public partition[] v_part; /*partition headers*/ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = V_NUMPAR)] - public int[] timestamp; /* SCSI time stamp */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] v_bootinfo; /*info needed by mboot*/ + public uint v_sanity; /*to verify vtoc sanity*/ + public uint v_version; /*layout version*/ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] v_volume; /*volume name*/ + public ushort v_sectorsz; /*sector size in bytes*/ + public ushort v_nparts; /*number of partitions*/ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public uint[] v_reserved; /*free space*/ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = V_NUMPAR)] public partition[] v_part; /*partition headers*/ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = V_NUMPAR)] public int[] timestamp; /* SCSI time stamp */ } [StructLayout(LayoutKind.Sequential, Pack = 1)] -struct vtoc + struct vtoc { - public uint v_sanity; /*to verify vtoc sanity*/ - public uint v_version; /*layout version*/ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] v_volume; /*volume name*/ - public ushort v_nparts; /*number of partitions*/ - public ushort v_pad; /*pad for 286 compiler*/ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public uint[] v_reserved; /*free space*/ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = V_NUMPAR)] - public partition[] v_part; /*partition headers*/ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = V_NUMPAR)] - public int[] timestamp; /* SCSI time stamp */ + public uint v_sanity; /*to verify vtoc sanity*/ + public uint v_version; /*layout version*/ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] v_volume; /*volume name*/ + public ushort v_nparts; /*number of partitions*/ + public ushort v_pad; /*pad for 286 compiler*/ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public uint[] v_reserved; /*free space*/ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = V_NUMPAR)] public partition[] v_part; /*partition headers*/ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = V_NUMPAR)] public int[] timestamp; /* SCSI time stamp */ } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct partition { - public pTag p_tag; /*ID tag of partition*/ - public pFlag p_flag; /*permision flags*/ - public int p_start; /*start sector no of partition*/ - public int p_size; /*# of blocks in partition*/ + public pTag p_tag; /*ID tag of partition*/ + public pFlag p_flag; /*permision flags*/ + public int p_start; /*start sector no of partition*/ + public int p_size; /*# of blocks in partition*/ }; public enum pTag : ushort @@ -529,54 +525,36 @@ struct vtoc enum pFlag : ushort { /* Partition permission flags */ - V_UNMNT = 0x01, /* Unmountable partition */ - V_RONLY = 0x10, /* Read only */ - V_REMAP = 0x20, /* do alternate sector mapping */ - V_OPEN = 0x100, /* Partition open (for driver use) */ - V_VALID = 0x200, /* Partition is valid to use */ - V_VOMASK = 0x300 /* mask for open and valid */ + V_UNMNT = 0x01, /* Unmountable partition */ + V_RONLY = 0x10, /* Read only */ + V_REMAP = 0x20, /* do alternate sector mapping */ + V_OPEN = 0x100, /* Partition open (for driver use) */ + V_VALID = 0x200, /* Partition is valid to use */ + V_VOMASK = 0x300 /* mask for open and valid */ } public static string decodeUNIXTAG(pTag type, bool isNew) { switch(type) { - case pTag.V_UNUSED: - return "Unused"; - case pTag.V_BOOT: - return "Boot"; - case pTag.V_ROOT: - return "/"; - case pTag.V_SWAP: - return "Swap"; - case pTag.V_USER: - return "/usr"; - case pTag.V_BACKUP: - return "Whole disk"; - case pTag.V_STAND_OLD: - return isNew ? "Stand" : "Alternate sector space"; - case pTag.V_VAR_OLD: - return isNew ? "/var" : "non UNIX"; - case pTag.V_HOME_OLD: - return isNew ? "/home" : "Alternate track space"; - case pTag.V_ALTSCTR_OLD: - return isNew ? "Alternate sector track" : "Stand"; - case pTag.V_CACHE: - return isNew ? "Cache" : "/var"; - case pTag.V_RESERVED: - return isNew ? "Reserved" : "/home"; - case pTag.V_DUMP: - return "dump"; - case pTag.V_ALTSCTR: - return "Alternate sector track"; - case pTag.V_VMPUBLIC: - return "volume mgt public partition"; - case pTag.V_VMPRIVATE: - return "volume mgt private partition"; - default: - return string.Format("Unknown TAG: 0x{0:X4}", type); + case pTag.V_UNUSED: return "Unused"; + case pTag.V_BOOT: return "Boot"; + case pTag.V_ROOT: return "/"; + case pTag.V_SWAP: return "Swap"; + case pTag.V_USER: return "/usr"; + case pTag.V_BACKUP: return "Whole disk"; + case pTag.V_STAND_OLD: return isNew ? "Stand" : "Alternate sector space"; + case pTag.V_VAR_OLD: return isNew ? "/var" : "non UNIX"; + case pTag.V_HOME_OLD: return isNew ? "/home" : "Alternate track space"; + case pTag.V_ALTSCTR_OLD: return isNew ? "Alternate sector track" : "Stand"; + case pTag.V_CACHE: return isNew ? "Cache" : "/var"; + case pTag.V_RESERVED: return isNew ? "Reserved" : "/home"; + case pTag.V_DUMP: return "dump"; + case pTag.V_ALTSCTR: return "Alternate sector track"; + case pTag.V_VMPUBLIC: return "volume mgt public partition"; + case pTag.V_VMPRIVATE: return "volume mgt private partition"; + default: return string.Format("Unknown TAG: 0x{0:X4}", type); } } - } } \ No newline at end of file diff --git a/DiscImageChef.Partitions/XENIX.cs b/DiscImageChef.Partitions/XENIX.cs index 40d1380b..68a2c06b 100644 --- a/DiscImageChef.Partitions/XENIX.cs +++ b/DiscImageChef.Partitions/XENIX.cs @@ -58,8 +58,7 @@ namespace DiscImageChef.PartPlugins { partitions = new List<Partition>(); - if(42 + sectorOffset >= imagePlugin.GetSectors()) - return false; + if(42 + sectorOffset >= imagePlugin.GetSectors()) return false; byte[] tblsector = imagePlugin.ReadSector(42 + sectorOffset); @@ -67,30 +66,33 @@ namespace DiscImageChef.PartPlugins partable xnxtbl = (partable)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(partable)); handle.Free(); - DicConsole.DebugWriteLine("XENIX plugin", "xnxtbl.p_magic = 0x{0:X4} (should be 0x{1:X4})", xnxtbl.p_magic, PAMAGIC); + DicConsole.DebugWriteLine("XENIX plugin", "xnxtbl.p_magic = 0x{0:X4} (should be 0x{1:X4})", xnxtbl.p_magic, + PAMAGIC); - if(xnxtbl.p_magic != PAMAGIC) - return false; + if(xnxtbl.p_magic != PAMAGIC) return false; for(int i = 0; i < MAXPARTS; i++) { DicConsole.DebugWriteLine("XENIX plugin", "xnxtbl.p[{0}].p_off = {1}", i, xnxtbl.p[i].p_off); DicConsole.DebugWriteLine("XENIX plugin", "xnxtbl.p[{0}].p_size = {1}", i, xnxtbl.p[i].p_size); - if(xnxtbl.p[i].p_size >0) + if(xnxtbl.p[i].p_size > 0) { Partition part = new Partition { - Start = ((ulong)((xnxtbl.p[i].p_off + XENIX_OFFSET) * XENIX_BSIZE) / imagePlugin.GetSectorSize()) + sectorOffset, + Start = + ((ulong)((xnxtbl.p[i].p_off + XENIX_OFFSET) * XENIX_BSIZE) / imagePlugin.GetSectorSize()) + + sectorOffset, Length = (ulong)(xnxtbl.p[i].p_size * XENIX_BSIZE) / imagePlugin.GetSectorSize(), - Offset = (ulong)((xnxtbl.p[i].p_off + XENIX_OFFSET) * XENIX_BSIZE) + (imagePlugin.GetSectorSize() * sectorOffset), + Offset = + (ulong)((xnxtbl.p[i].p_off + XENIX_OFFSET) * XENIX_BSIZE) + + (imagePlugin.GetSectorSize() * sectorOffset), Size = (ulong)(xnxtbl.p[i].p_size * XENIX_BSIZE), Sequence = (ulong)i, Type = "XENIX", Scheme = Name }; - if(part.End < imagePlugin.GetSectors()) - partitions.Add(part); + if(part.End < imagePlugin.GetSectors()) partitions.Add(part); } } @@ -100,16 +102,15 @@ namespace DiscImageChef.PartPlugins [StructLayout(LayoutKind.Sequential, Pack = 1)] struct partable { - public ushort p_magic; /* magic number validity indicator */ - [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAXPARTS)] - public partition[] p; /*partition headers*/ + public ushort p_magic; /* magic number validity indicator */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAXPARTS)] public partition[] p; /*partition headers*/ } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct partition { - public int p_off; /*start 1K block no of partition*/ - public int p_size; /*# of 1K blocks in partition*/ + public int p_off; /*start 1K block no of partition*/ + public int p_size; /*# of 1K blocks in partition*/ } } } \ No newline at end of file diff --git a/DiscImageChef.Partitions/Xbox.cs b/DiscImageChef.Partitions/Xbox.cs index 70be6360..f54150fe 100644 --- a/DiscImageChef.Partitions/Xbox.cs +++ b/DiscImageChef.Partitions/Xbox.cs @@ -82,16 +82,16 @@ namespace DiscImageChef.PartPlugins partitions = new List<Partition>(); // Xbox partitions always start on 0 - if(sectorOffset != 0) - return false; + if(sectorOffset != 0) return false; byte[] sector = imagePlugin.ReadSector(0); - if(sector.Length < 512) - return false; + if(sector.Length < 512) return false; - Xbox360DevKitPartitionTable table = BigEndianMarshal.ByteArrayToStructureBigEndian<Xbox360DevKitPartitionTable>(sector); + Xbox360DevKitPartitionTable table = + BigEndianMarshal.ByteArrayToStructureBigEndian<Xbox360DevKitPartitionTable>(sector); - if(table.magic == Xbox360DevKitMagic && table.contentOff + table.contentLen <= imagePlugin.ImageInfo.sectors && + if(table.magic == Xbox360DevKitMagic && + table.contentOff + table.contentLen <= imagePlugin.ImageInfo.sectors && table.dashboardOff + table.dashboardLen <= imagePlugin.ImageInfo.sectors) { Partition contentPart = new Partition @@ -145,7 +145,8 @@ namespace DiscImageChef.PartPlugins Partition dataPart = new Partition { Description = "Data volume", - Size = (ulong)imagePlugin.ImageInfo.sectors * imagePlugin.ImageInfo.sectorSize - MemoryUnitDataOff, + Size = + (ulong)imagePlugin.ImageInfo.sectors * imagePlugin.ImageInfo.sectorSize - MemoryUnitDataOff, Length = imagePlugin.ImageInfo.sectors - sysCachePart.Length, Sequence = 2, Offset = MemoryUnitDataOff, diff --git a/DiscImageChef.Server/App_Start/Ata.cs b/DiscImageChef.Server/App_Start/Ata.cs index 52a62c83..6a309fc0 100644 --- a/DiscImageChef.Server/App_Start/Ata.cs +++ b/DiscImageChef.Server/App_Start/Ata.cs @@ -39,7 +39,9 @@ namespace DiscImageChef.Server.App_Start { public static class Ata { - public static void Report(ataType ataReport, bool cfa, bool atapi, ref bool removable, ref List<string> ataOneValue, ref Dictionary<string, string> ataTwoValue, ref testedMediaType[] testedMedia) + public static void Report(ataType ataReport, bool cfa, bool atapi, ref bool removable, + ref List<string> ataOneValue, ref Dictionary<string, string> ataTwoValue, + ref testedMediaType[] testedMedia) { string tmpString; uint logicalsectorsize = 0; @@ -51,29 +53,36 @@ namespace DiscImageChef.Server.App_Start if(ataReport.AdditionalPIDSpecified && !string.IsNullOrEmpty(ataReport.AdditionalPID)) ataTwoValue.Add("Additional product ID", ataReport.AdditionalPID); - bool ata1 = false, ata2 = false, ata3 = false, ata4 = false, ata5 = false, ata6 = false, ata7 = false, acs = false, acs2 = false, acs3 = false, acs4 = false; + bool ata1 = false, + ata2 = false, + ata3 = false, + ata4 = false, + ata5 = false, + ata6 = false, + ata7 = false, + acs = false, + acs2 = false, + acs3 = false, + acs4 = false; - if(ataReport.MajorVersionSpecified && ((ushort)ataReport.MajorVersion == 0x0000 || (ushort)ataReport.MajorVersion == 0xFFFF)) + if(ataReport.MajorVersionSpecified && + ((ushort)ataReport.MajorVersion == 0x0000 || (ushort)ataReport.MajorVersion == 0xFFFF)) { // Obsolete in ATA-2, if present, device supports ATA-1 if(ataReport.GeneralConfigurationSpecified) ata1 |= ataReport.GeneralConfiguration.HasFlag(GeneralConfigurationBit.FastIDE) || - ataReport.GeneralConfiguration.HasFlag(GeneralConfigurationBit.SlowIDE) || - ataReport.GeneralConfiguration.HasFlag(GeneralConfigurationBit.UltraFastIDE); + ataReport.GeneralConfiguration.HasFlag(GeneralConfigurationBit.SlowIDE) || + ataReport.GeneralConfiguration.HasFlag(GeneralConfigurationBit.UltraFastIDE); ata2 |= ataReport.ExtendedIdentifySpecified; - if(!ata1 && !ata2 && !atapi && !cfa) - ata2 = true; + if(!ata1 && !ata2 && !atapi && !cfa) ata2 = true; ata4 |= atapi; ata3 |= cfa; - if(cfa && ata1) - ata1 = false; - if(cfa && ata2) - ata2 = false; - + if(cfa && ata1) ata1 = false; + if(cfa && ata2) ata2 = false; } else { @@ -100,81 +109,69 @@ namespace DiscImageChef.Server.App_Start { tmpString += "ATA-1 "; maxatalevel = 1; - if(minatalevel > 1) - minatalevel = 1; + if(minatalevel > 1) minatalevel = 1; } if(ata2) { tmpString += "ATA-2 "; maxatalevel = 2; - if(minatalevel > 2) - minatalevel = 2; + if(minatalevel > 2) minatalevel = 2; } if(ata3) { tmpString += "ATA-3 "; maxatalevel = 3; - if(minatalevel > 3) - minatalevel = 3; + if(minatalevel > 3) minatalevel = 3; } if(ata4) { tmpString += "ATA/ATAPI-4 "; maxatalevel = 4; - if(minatalevel > 4) - minatalevel = 4; + if(minatalevel > 4) minatalevel = 4; } if(ata5) { tmpString += "ATA/ATAPI-5 "; maxatalevel = 5; - if(minatalevel > 5) - minatalevel = 5; + if(minatalevel > 5) minatalevel = 5; } if(ata6) { tmpString += "ATA/ATAPI-6 "; maxatalevel = 6; - if(minatalevel > 6) - minatalevel = 6; + if(minatalevel > 6) minatalevel = 6; } if(ata7) { tmpString += "ATA/ATAPI-7 "; maxatalevel = 7; - if(minatalevel > 7) - minatalevel = 7; + if(minatalevel > 7) minatalevel = 7; } if(acs) { tmpString += "ATA8-ACS "; maxatalevel = 8; - if(minatalevel > 8) - minatalevel = 8; + if(minatalevel > 8) minatalevel = 8; } if(acs2) { tmpString += "ATA8-ACS2 "; maxatalevel = 9; - if(minatalevel > 9) - minatalevel = 9; + if(minatalevel > 9) minatalevel = 9; } if(acs3) { tmpString += "ATA8-ACS3 "; maxatalevel = 10; - if(minatalevel > 10) - minatalevel = 10; + if(minatalevel > 10) minatalevel = 10; } if(acs4) { tmpString += "ATA8-ACS4 "; maxatalevel = 11; - if(minatalevel > 11) - minatalevel = 11; + if(minatalevel > 11) minatalevel = 11; } - if(tmpString != "") - ataTwoValue.Add("Supported ATA versions", tmpString); + if(tmpString != "") ataTwoValue.Add("Supported ATA versions", tmpString); if(maxatalevel >= 3 && ataReport.MinorVersionSpecified) { @@ -326,6 +323,7 @@ namespace DiscImageChef.Server.App_Start tmpString = string.Format("Unknown ATA revision 0x{0:X4}", ataReport.MinorVersion); break; } + ataTwoValue.Add("Maximum ATA revision supported", tmpString); } @@ -335,34 +333,26 @@ namespace DiscImageChef.Server.App_Start switch((ataReport.TransportMajorVersion & 0xF000) >> 12) { case 0x0: - if((ataReport.TransportMajorVersion & 0x0002) == 0x0002) - tmpString += "ATA/ATAPI-7 "; - if((ataReport.TransportMajorVersion & 0x0001) == 0x0001) - tmpString += "ATA8-APT "; + if((ataReport.TransportMajorVersion & 0x0002) == 0x0002) tmpString += "ATA/ATAPI-7 "; + if((ataReport.TransportMajorVersion & 0x0001) == 0x0001) tmpString += "ATA8-APT "; ataTwoValue.Add("Parallel ATA device", tmpString); break; case 0x1: - if((ataReport.TransportMajorVersion & 0x0001) == 0x0001) - tmpString += "ATA8-AST "; - if((ataReport.TransportMajorVersion & 0x0002) == 0x0002) - tmpString += "SATA 1.0a "; - if((ataReport.TransportMajorVersion & 0x0004) == 0x0004) - tmpString += "SATA II Extensions "; - if((ataReport.TransportMajorVersion & 0x0008) == 0x0008) - tmpString += "SATA 2.5 "; - if((ataReport.TransportMajorVersion & 0x0010) == 0x0010) - tmpString += "SATA 2.6 "; - if((ataReport.TransportMajorVersion & 0x0020) == 0x0020) - tmpString += "SATA 3.0 "; - if((ataReport.TransportMajorVersion & 0x0040) == 0x0040) - tmpString += "SATA 3.1 "; + if((ataReport.TransportMajorVersion & 0x0001) == 0x0001) tmpString += "ATA8-AST "; + if((ataReport.TransportMajorVersion & 0x0002) == 0x0002) tmpString += "SATA 1.0a "; + if((ataReport.TransportMajorVersion & 0x0004) == 0x0004) tmpString += "SATA II Extensions "; + if((ataReport.TransportMajorVersion & 0x0008) == 0x0008) tmpString += "SATA 2.5 "; + if((ataReport.TransportMajorVersion & 0x0010) == 0x0010) tmpString += "SATA 2.6 "; + if((ataReport.TransportMajorVersion & 0x0020) == 0x0020) tmpString += "SATA 3.0 "; + if((ataReport.TransportMajorVersion & 0x0040) == 0x0040) tmpString += "SATA 3.1 "; ataTwoValue.Add("Serial ATA device: ", tmpString); break; case 0xE: ataTwoValue.Add("SATA Express device", "No version"); break; default: - ataTwoValue.Add("Unknown transport type", string.Format("0x{0:X1}", (ataReport.TransportMajorVersion & 0xF000) >> 12)); + ataTwoValue.Add("Unknown transport type", + string.Format("0x{0:X1}", (ataReport.TransportMajorVersion & 0xF000) >> 12)); break; } } @@ -436,7 +426,8 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add("ATAPI Unknown or no device type"); break; default: - ataOneValue.Add(string.Format("ATAPI Unknown device type field value 0x{0:X2}", ((ushort)ataReport.GeneralConfiguration & 0x1F00) >> 8)); + ataOneValue.Add(string.Format("ATAPI Unknown device type field value 0x{0:X2}", + ((ushort)ataReport.GeneralConfiguration & 0x1F00) >> 8)); break; } @@ -453,7 +444,8 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add("Device shall set DRQ within 50 µs of receiving PACKET"); break; default: - ataOneValue.Add(string.Format("Unknown ATAPI DRQ behaviour code {0}", ((ushort)ataReport.GeneralConfiguration & 0x60) >> 5)); + ataOneValue.Add(string.Format("Unknown ATAPI DRQ behaviour code {0}", + ((ushort)ataReport.GeneralConfiguration & 0x60) >> 5)); break; } @@ -467,10 +459,10 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add("ATAPI device uses 16 byte command packet"); break; default: - ataOneValue.Add(string.Format("Unknown ATAPI packet size code {0}", (ushort)ataReport.GeneralConfiguration & 0x03)); + ataOneValue.Add(string.Format("Unknown ATAPI packet size code {0}", + (ushort)ataReport.GeneralConfiguration & 0x03)); break; } - } else if(!cfa && ataReport.GeneralConfigurationSpecified) { @@ -520,48 +512,56 @@ namespace DiscImageChef.Server.App_Start } } - if(ataReport.SpecificConfigurationSpecified && - (ushort)ataReport.SpecificConfiguration != 0x0000 && - (ushort)ataReport.SpecificConfiguration != 0xFFFF) + if(ataReport.SpecificConfigurationSpecified && (ushort)ataReport.SpecificConfiguration != 0x0000 && + (ushort)ataReport.SpecificConfiguration != 0xFFFF) { switch(ataReport.SpecificConfiguration) { case SpecificConfigurationEnum.RequiresSetIncompleteResponse: - ataOneValue.Add("Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete."); + ataOneValue + .Add("Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete."); break; case SpecificConfigurationEnum.RequiresSetCompleteResponse: - ataOneValue.Add("Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is complete."); + ataOneValue + .Add("Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is complete."); break; case SpecificConfigurationEnum.NotRequiresSetIncompleteResponse: - ataOneValue.Add("Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete."); + ataOneValue + .Add("Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete."); break; case SpecificConfigurationEnum.NotRequiresSetCompleteResponse: - ataOneValue.Add("Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is complete."); + ataOneValue + .Add("Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is complete."); break; default: - ataOneValue.Add(string.Format("Unknown device specific configuration 0x{0:X4}", (ushort)ataReport.SpecificConfiguration)); + ataOneValue.Add(string.Format("Unknown device specific configuration 0x{0:X4}", + (ushort)ataReport.SpecificConfiguration)); break; } } // Obsolete since ATA-2, however, it is yet used in ATA-8 devices - if(ataReport.BufferSizeSpecified && ataReport.BufferTypeSpecified && - ataReport.BufferSize != 0x0000 && ataReport.BufferSize != 0xFFFF && - ataReport.BufferType != 0x0000 && ataReport.BufferType != 0xFFFF) + if(ataReport.BufferSizeSpecified && ataReport.BufferTypeSpecified && ataReport.BufferSize != 0x0000 && + ataReport.BufferSize != 0xFFFF && ataReport.BufferType != 0x0000 && ataReport.BufferType != 0xFFFF) { switch(ataReport.BufferType) { case 1: - ataOneValue.Add(string.Format("{0} KiB of single ported single sector buffer", (ataReport.BufferSize * logicalsectorsize) / 1024)); + ataOneValue.Add(string.Format("{0} KiB of single ported single sector buffer", + (ataReport.BufferSize * logicalsectorsize) / 1024)); break; case 2: - ataOneValue.Add(string.Format("{0} KiB of dual ported multi sector buffer", (ataReport.BufferSize * logicalsectorsize) / 1024)); + ataOneValue.Add(string.Format("{0} KiB of dual ported multi sector buffer", + (ataReport.BufferSize * logicalsectorsize) / 1024)); break; case 3: - ataOneValue.Add(string.Format("{0} KiB of dual ported multi sector buffer with read caching", (ataReport.BufferSize * logicalsectorsize) / 1024)); + ataOneValue.Add(string.Format("{0} KiB of dual ported multi sector buffer with read caching", + (ataReport.BufferSize * logicalsectorsize) / 1024)); break; default: - ataOneValue.Add(string.Format("{0} KiB of unknown type {1} buffer", (ataReport.BufferSize * logicalsectorsize) / 1024, ataReport.BufferType)); + ataOneValue.Add(string.Format("{0} KiB of unknown type {1} buffer", + (ataReport.BufferSize * logicalsectorsize) / 1024, + ataReport.BufferType)); break; } } @@ -575,15 +575,14 @@ namespace DiscImageChef.Server.App_Start { if(ataReport.Capabilities.HasFlag(CapabilitiesBit.CanDisableIORDY)) ataOneValue.Add("IORDY is supported and can be disabled"); - else - ataOneValue.Add("IORDY is supported"); + else ataOneValue.Add("IORDY is supported"); } - if(ataReport.Capabilities.HasFlag(CapabilitiesBit.DMASupport)) - ataOneValue.Add("DMA is supported"); + if(ataReport.Capabilities.HasFlag(CapabilitiesBit.DMASupport)) ataOneValue.Add("DMA is supported"); if(ataReport.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment1) || - ataReport.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment0)) + ataReport.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment0)) { - ataOneValue.Add(string.Format("Long Physical Alignment setting is {0}", (ushort)ataReport.Capabilities & 0x03)); + ataOneValue.Add(string.Format("Long Physical Alignment setting is {0}", + (ushort)ataReport.Capabilities & 0x03)); } if(atapi) { @@ -601,7 +600,7 @@ namespace DiscImageChef.Server.App_Start if(ataReport.Capabilities2Specified) { if(ataReport.Capabilities2.HasFlag(CapabilitiesBit2.MustBeSet) && - !ataReport.Capabilities2.HasFlag(CapabilitiesBit2.MustBeClear)) + !ataReport.Capabilities2.HasFlag(CapabilitiesBit2.MustBeClear)) { if(ataReport.Capabilities2.HasFlag(CapabilitiesBit2.SpecificStandbyTimer)) ataOneValue.Add("Device indicates a specific minimum standby timer value"); @@ -612,8 +611,11 @@ namespace DiscImageChef.Server.App_Start { if(ataReport.Capabilities3.HasFlag(CapabilitiesBit3.MultipleValid)) { - ataOneValue.Add(string.Format("A maximum of {0} sectors can be transferred per interrupt on READ/WRITE MULTIPLE", ataReport.MultipleSectorNumber)); - ataOneValue.Add(string.Format("Device supports setting a maximum of {0} sectors", ataReport.MultipleMaxSectors)); + ataOneValue + .Add(string.Format("A maximum of {0} sectors can be transferred per interrupt on READ/WRITE MULTIPLE", + ataReport.MultipleSectorNumber)); + ataOneValue.Add(string.Format("Device supports setting a maximum of {0} sectors", + ataReport.MultipleMaxSectors)); } } @@ -635,38 +637,14 @@ namespace DiscImageChef.Server.App_Start { tmpString = ""; - if(ataReport.APIOSupported.HasFlag(TransferMode.Mode0)) - { - tmpString += "PIO0 "; - } - if(ataReport.APIOSupported.HasFlag(TransferMode.Mode1)) - { - tmpString += "PIO1 "; - } - if(ataReport.APIOSupported.HasFlag(TransferMode.Mode2)) - { - tmpString += "PIO2 "; - } - if(ataReport.APIOSupported.HasFlag(TransferMode.Mode3)) - { - tmpString += "PIO3 "; - } - if(ataReport.APIOSupported.HasFlag(TransferMode.Mode4)) - { - tmpString += "PIO4 "; - } - if(ataReport.APIOSupported.HasFlag(TransferMode.Mode5)) - { - tmpString += "PIO5 "; - } - if(ataReport.APIOSupported.HasFlag(TransferMode.Mode6)) - { - tmpString += "PIO6 "; - } - if(ataReport.APIOSupported.HasFlag(TransferMode.Mode7)) - { - tmpString += "PIO7 "; - } + if(ataReport.APIOSupported.HasFlag(TransferMode.Mode0)) { tmpString += "PIO0 "; } + if(ataReport.APIOSupported.HasFlag(TransferMode.Mode1)) { tmpString += "PIO1 "; } + if(ataReport.APIOSupported.HasFlag(TransferMode.Mode2)) { tmpString += "PIO2 "; } + if(ataReport.APIOSupported.HasFlag(TransferMode.Mode3)) { tmpString += "PIO3 "; } + if(ataReport.APIOSupported.HasFlag(TransferMode.Mode4)) { tmpString += "PIO4 "; } + if(ataReport.APIOSupported.HasFlag(TransferMode.Mode5)) { tmpString += "PIO5 "; } + if(ataReport.APIOSupported.HasFlag(TransferMode.Mode6)) { tmpString += "PIO6 "; } + if(ataReport.APIOSupported.HasFlag(TransferMode.Mode7)) { tmpString += "PIO7 "; } ataTwoValue.Add("Advanced PIO", tmpString); } @@ -835,18 +813,18 @@ namespace DiscImageChef.Server.App_Start if(ataReport.MinMDMACycleTime != 0 && ataReport.RecommendedMDMACycleTime != 0) { - ataOneValue.Add(string.Format("At minimum {0} ns. transfer cycle time per word in MDMA, " + - "{1} ns. recommended", ataReport.MinMDMACycleTime, ataReport.RecommendedMDMACycleTime)); + ataOneValue.Add(string.Format("At minimum {0} ns. transfer cycle time per word in MDMA, " + "{1} ns. recommended", + ataReport.MinMDMACycleTime, ataReport.RecommendedMDMACycleTime)); } if(ataReport.MinPIOCycleTimeNoFlow != 0) { - ataOneValue.Add(string.Format("At minimum {0} ns. transfer cycle time per word in PIO, " + - "without flow control", ataReport.MinPIOCycleTimeNoFlow)); + ataOneValue.Add(string.Format("At minimum {0} ns. transfer cycle time per word in PIO, " + "without flow control", + ataReport.MinPIOCycleTimeNoFlow)); } if(ataReport.MinPIOCycleTimeFlow != 0) { - ataOneValue.Add(string.Format("At minimum {0} ns. transfer cycle time per word in PIO, " + - "with IORDY flow control", ataReport.MinPIOCycleTimeFlow)); + ataOneValue.Add(string.Format("At minimum {0} ns. transfer cycle time per word in PIO, " + "with IORDY flow control", + ataReport.MinPIOCycleTimeFlow)); } if(ataReport.MaxQueueDepth != 0) @@ -857,14 +835,15 @@ namespace DiscImageChef.Server.App_Start if(atapi) { if(ataReport.PacketBusRelease != 0) - ataOneValue.Add(string.Format("{0} ns. typical to release bus from receipt of PACKET", ataReport.PacketBusRelease)); + ataOneValue.Add(string.Format("{0} ns. typical to release bus from receipt of PACKET", + ataReport.PacketBusRelease)); if(ataReport.ServiceBusyClear != 0) - ataOneValue.Add(string.Format("{0} ns. typical to clear BSY bit from receipt of SERVICE", ataReport.ServiceBusyClear)); + ataOneValue.Add(string.Format("{0} ns. typical to clear BSY bit from receipt of SERVICE", + ataReport.ServiceBusyClear)); } - if(ataReport.TransportMajorVersionSpecified && - (((ataReport.TransportMajorVersion & 0xF000) >> 12) == 0x1 || - ((ataReport.TransportMajorVersion & 0xF000) >> 12) == 0xE)) + if(ataReport.TransportMajorVersionSpecified && (((ataReport.TransportMajorVersion & 0xF000) >> 12) == 0x1 || + ((ataReport.TransportMajorVersion & 0xF000) >> 12) == 0xE)) { if(!ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear)) { @@ -882,7 +861,8 @@ namespace DiscImageChef.Server.App_Start } if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.PowerReceipt)) { - ataOneValue.Add(string.Format("Receipt of host initiated power management requests is supported")); + ataOneValue + .Add(string.Format("Receipt of host initiated power management requests is supported")); } if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.PHYEventCounter)) { @@ -890,11 +870,13 @@ namespace DiscImageChef.Server.App_Start } if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.HostSlumbTrans)) { - ataOneValue.Add(string.Format("Supports host automatic partial to slumber transitions is supported")); + ataOneValue + .Add(string.Format("Supports host automatic partial to slumber transitions is supported")); } if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.DevSlumbTrans)) { - ataOneValue.Add(string.Format("Supports device automatic partial to slumber transitions is supported")); + ataOneValue + .Add(string.Format("Supports device automatic partial to slumber transitions is supported")); } if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQ)) { @@ -911,11 +893,12 @@ namespace DiscImageChef.Server.App_Start } } - if(ataReport.SATACapabilities2Specified && !ataReport.SATACapabilities2.HasFlag(SATACapabilitiesBit2.Clear)) + if(ataReport.SATACapabilities2Specified && + !ataReport.SATACapabilities2.HasFlag(SATACapabilitiesBit2.Clear)) { if(ataReport.SATACapabilitiesSpecified && - !ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear) && - ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQ)) + !ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear) && + ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQ)) { if(ataReport.SATACapabilities2.HasFlag(SATACapabilitiesBit2.NCQMgmt)) { @@ -935,7 +918,8 @@ namespace DiscImageChef.Server.App_Start } if(ataReport.SATACapabilities2.HasFlag(SATACapabilitiesBit2.DevAttSlimline)) { - ataOneValue.Add(string.Format("ATAPI device supports attention on slimline connected devices")); + ataOneValue + .Add(string.Format("ATAPI device supports attention on slimline connected devices")); } } } @@ -943,7 +927,8 @@ namespace DiscImageChef.Server.App_Start if(ataReport.InterseekDelay != 0x0000 && ataReport.InterseekDelay != 0xFFFF) { - ataOneValue.Add(string.Format("{0} microseconds of interseek delay for ISO-7779 accoustic testing", ataReport.InterseekDelay)); + ataOneValue.Add(string.Format("{0} microseconds of interseek delay for ISO-7779 accoustic testing", + ataReport.InterseekDelay)); } if((ushort)ataReport.DeviceFormFactor != 0x0000 && (ushort)ataReport.DeviceFormFactor != 0xFFFF) @@ -966,7 +951,8 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add("Device nominal size is smaller than 1.8\""); break; default: - ataOneValue.Add(string.Format("Device nominal size field value {0} is unknown", ataReport.DeviceFormFactor)); + ataOneValue.Add(string.Format("Device nominal size field value {0} is unknown", + ataReport.DeviceFormFactor)); break; } } @@ -987,174 +973,154 @@ namespace DiscImageChef.Server.App_Start if((ataReport.CFAPowerMode & 0x1000) == 0x1000) ataOneValue.Add("CompactFlash power mode 1 is disabled"); - ataOneValue.Add(string.Format("CompactFlash device uses a maximum of {0} mA", (ataReport.CFAPowerMode & 0x0FFF))); + ataOneValue.Add(string.Format("CompactFlash device uses a maximum of {0} mA", + (ataReport.CFAPowerMode & 0x0FFF))); } } - if(ataReport.CommandSetSpecified || ataReport.CommandSet2Specified || ataReport.CommandSet3Specified || ataReport.CommandSet4Specified || ataReport.CommandSet5Specified) - ataOneValue.Add("<i>Command set and features:</i>"); + if(ataReport.CommandSetSpecified || ataReport.CommandSet2Specified || ataReport.CommandSet3Specified || + ataReport.CommandSet4Specified || + ataReport.CommandSet5Specified) ataOneValue.Add("<i>Command set and features:</i>"); if(ataReport.CommandSetSpecified) { if(ataReport.CommandSet.HasFlag(CommandSetBit.Nop)) { if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.Nop) && ataReport.EnabledCommandSetSpecified) ataOneValue.Add("NOP is supported and enabled"); - else - ataOneValue.Add("NOP is supported"); + else ataOneValue.Add("NOP is supported"); } if(ataReport.CommandSet.HasFlag(CommandSetBit.ReadBuffer)) { - if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.ReadBuffer) && ataReport.EnabledCommandSetSpecified) - ataOneValue.Add("READ BUFFER is supported and enabled"); - else - ataOneValue.Add("READ BUFFER is supported"); + if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.ReadBuffer) && + ataReport.EnabledCommandSetSpecified) ataOneValue.Add("READ BUFFER is supported and enabled"); + else ataOneValue.Add("READ BUFFER is supported"); } if(ataReport.CommandSet.HasFlag(CommandSetBit.WriteBuffer)) { - if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.WriteBuffer) && ataReport.EnabledCommandSetSpecified) - ataOneValue.Add("WRITE BUFFER is supported and enabled"); - else - ataOneValue.Add("WRITE BUFFER is supported"); - + if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.WriteBuffer) && + ataReport.EnabledCommandSetSpecified) ataOneValue.Add("WRITE BUFFER is supported and enabled"); + else ataOneValue.Add("WRITE BUFFER is supported"); } if(ataReport.CommandSet.HasFlag(CommandSetBit.HPA)) { if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.HPA) && ataReport.EnabledCommandSetSpecified) ataOneValue.Add("Host Protected Area is supported and enabled"); - else - ataOneValue.Add("Host Protected Area is supported"); - + else ataOneValue.Add("Host Protected Area is supported"); } if(ataReport.CommandSet.HasFlag(CommandSetBit.DeviceReset)) { - if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.DeviceReset) && ataReport.EnabledCommandSetSpecified) - ataOneValue.Add("DEVICE RESET is supported and enabled"); - else - ataOneValue.Add("DEVICE RESET is supported"); - + if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.DeviceReset) && + ataReport.EnabledCommandSetSpecified) ataOneValue.Add("DEVICE RESET is supported and enabled"); + else ataOneValue.Add("DEVICE RESET is supported"); } if(ataReport.CommandSet.HasFlag(CommandSetBit.Service)) { - if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.Service) && ataReport.EnabledCommandSetSpecified) + if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.Service) && + ataReport.EnabledCommandSetSpecified) ataOneValue.Add("SERVICE interrupt is supported and enabled"); - else - ataOneValue.Add("SERVICE interrupt is supported"); - + else ataOneValue.Add("SERVICE interrupt is supported"); } if(ataReport.CommandSet.HasFlag(CommandSetBit.Release)) { - if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.Release) && ataReport.EnabledCommandSetSpecified) - ataOneValue.Add("Release is supported and enabled"); - else - ataOneValue.Add("Release is supported"); - + if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.Release) && + ataReport.EnabledCommandSetSpecified) ataOneValue.Add("Release is supported and enabled"); + else ataOneValue.Add("Release is supported"); } if(ataReport.CommandSet.HasFlag(CommandSetBit.LookAhead)) { - if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.LookAhead) && ataReport.EnabledCommandSetSpecified) + if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.LookAhead) && + ataReport.EnabledCommandSetSpecified) ataOneValue.Add("Look-ahead read is supported and enabled"); - else - ataOneValue.Add("Look-ahead read is supported"); - + else ataOneValue.Add("Look-ahead read is supported"); } if(ataReport.CommandSet.HasFlag(CommandSetBit.WriteCache)) { - if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.WriteCache) && ataReport.EnabledCommandSetSpecified) - ataOneValue.Add("Write cache is supported and enabled"); - else - ataOneValue.Add("Write cache is supported"); - + if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.WriteCache) && + ataReport.EnabledCommandSetSpecified) ataOneValue.Add("Write cache is supported and enabled"); + else ataOneValue.Add("Write cache is supported"); } if(ataReport.CommandSet.HasFlag(CommandSetBit.Packet)) { - if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.Packet) && ataReport.EnabledCommandSetSpecified) - ataOneValue.Add("PACKET is supported and enabled"); - else - ataOneValue.Add("PACKET is supported"); - + if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.Packet) && ataReport.EnabledCommandSetSpecified + ) ataOneValue.Add("PACKET is supported and enabled"); + else ataOneValue.Add("PACKET is supported"); } if(ataReport.CommandSet.HasFlag(CommandSetBit.PowerManagement)) { - if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.PowerManagement) && ataReport.EnabledCommandSetSpecified) + if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.PowerManagement) && + ataReport.EnabledCommandSetSpecified) ataOneValue.Add("Power management is supported and enabled"); - else - ataOneValue.Add("Power management is supported"); - + else ataOneValue.Add("Power management is supported"); } if(ataReport.CommandSet.HasFlag(CommandSetBit.RemovableMedia)) { - if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.RemovableMedia) && ataReport.EnabledCommandSetSpecified) + if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.RemovableMedia) && + ataReport.EnabledCommandSetSpecified) ataOneValue.Add("Removable media feature set is supported and enabled"); - else - ataOneValue.Add("Removable media feature set is supported"); - + else ataOneValue.Add("Removable media feature set is supported"); } if(ataReport.CommandSet.HasFlag(CommandSetBit.SecurityMode)) { - if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.SecurityMode) && ataReport.EnabledCommandSetSpecified) - ataOneValue.Add("Security mode is supported and enabled"); - else - ataOneValue.Add("Security mode is supported"); - + if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.SecurityMode) && + ataReport.EnabledCommandSetSpecified) ataOneValue.Add("Security mode is supported and enabled"); + else ataOneValue.Add("Security mode is supported"); } if(ataReport.Capabilities.HasFlag(CapabilitiesBit.LBASupport)) ataOneValue.Add("28-bit LBA is supported"); } if(ataReport.CommandSet2Specified && ataReport.CommandSet2.HasFlag(CommandSetBit2.MustBeSet) && - !ataReport.CommandSet2.HasFlag(CommandSetBit2.MustBeClear)) + !ataReport.CommandSet2.HasFlag(CommandSetBit2.MustBeClear)) { if(ataReport.CommandSet2.HasFlag(CommandSetBit2.LBA48)) { - if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.LBA48) && ataReport.EnabledCommandSet2Specified) - ataOneValue.Add("48-bit LBA is supported and enabled"); - else - ataOneValue.Add("48-bit LBA is supported"); + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.LBA48) && + ataReport.EnabledCommandSet2Specified) ataOneValue.Add("48-bit LBA is supported and enabled"); + else ataOneValue.Add("48-bit LBA is supported"); } if(ataReport.CommandSet2.HasFlag(CommandSetBit2.FlushCache)) { - if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCache) && ataReport.EnabledCommandSet2Specified) - ataOneValue.Add("FLUSH CACHE is supported and enabled"); - else - ataOneValue.Add("FLUSH CACHE is supported"); + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCache) && + ataReport.EnabledCommandSet2Specified) ataOneValue.Add("FLUSH CACHE is supported and enabled"); + else ataOneValue.Add("FLUSH CACHE is supported"); } if(ataReport.CommandSet2.HasFlag(CommandSetBit2.FlushCacheExt)) { - if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCacheExt) && ataReport.EnabledCommandSet2Specified) + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCacheExt) && + ataReport.EnabledCommandSet2Specified) ataOneValue.Add("FLUSH CACHE EXT is supported and enabled"); - else - ataOneValue.Add("FLUSH CACHE EXT is supported"); + else ataOneValue.Add("FLUSH CACHE EXT is supported"); } if(ataReport.CommandSet2.HasFlag(CommandSetBit2.DCO)) { - if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.DCO) && ataReport.EnabledCommandSet2Specified) - ataOneValue.Add("Device Configuration Overlay feature set is supported and enabled"); - else - ataOneValue.Add("Device Configuration Overlay feature set is supported"); + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.DCO) && ataReport.EnabledCommandSet2Specified + ) ataOneValue.Add("Device Configuration Overlay feature set is supported and enabled"); + else ataOneValue.Add("Device Configuration Overlay feature set is supported"); } if(ataReport.CommandSet2.HasFlag(CommandSetBit2.AAM)) { - if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.AAM) && ataReport.EnabledCommandSet2Specified) + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.AAM) && ataReport.EnabledCommandSet2Specified + ) { - ataOneValue.Add(string.Format("Automatic Acoustic Management is supported and enabled with value {0} (vendor recommends {1}", - ataReport.CurrentAAM, ataReport.RecommendedAAM)); + ataOneValue + .Add(string.Format("Automatic Acoustic Management is supported and enabled with value {0} (vendor recommends {1}", + ataReport.CurrentAAM, ataReport.RecommendedAAM)); } - else - ataOneValue.Add("Automatic Acoustic Management is supported"); + else ataOneValue.Add("Automatic Acoustic Management is supported"); } if(ataReport.CommandSet2.HasFlag(CommandSetBit2.SetMax)) { - if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.SetMax) && ataReport.EnabledCommandSet2Specified) + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.SetMax) && + ataReport.EnabledCommandSet2Specified) ataOneValue.Add("SET MAX security extension is supported and enabled"); - else - ataOneValue.Add("SET MAX security extension is supported"); + else ataOneValue.Add("SET MAX security extension is supported"); } if(ataReport.CommandSet2.HasFlag(CommandSetBit2.AddressOffsetReservedAreaBoot)) { - if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.AddressOffsetReservedAreaBoot) && ataReport.EnabledCommandSet2Specified) + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.AddressOffsetReservedAreaBoot) && + ataReport.EnabledCommandSet2Specified) ataOneValue.Add("Address Offset Reserved Area Boot is supported and enabled"); - else - ataOneValue.Add("Address Offset Reserved Area Boot is supported"); + else ataOneValue.Add("Address Offset Reserved Area Boot is supported"); } if(ataReport.CommandSet2.HasFlag(CommandSetBit2.SetFeaturesRequired)) { @@ -1162,45 +1128,47 @@ namespace DiscImageChef.Server.App_Start } if(ataReport.CommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby)) { - if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby) && ataReport.EnabledCommandSet2Specified) + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby) && + ataReport.EnabledCommandSet2Specified) ataOneValue.Add("Power-up in standby is supported and enabled"); - else - ataOneValue.Add("Power-up in standby is supported"); + else ataOneValue.Add("Power-up in standby is supported"); } if(ataReport.CommandSet2.HasFlag(CommandSetBit2.RemovableNotification)) { - if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.RemovableNotification) && ataReport.EnabledCommandSet2Specified) + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.RemovableNotification) && + ataReport.EnabledCommandSet2Specified) ataOneValue.Add("Removable Media Status Notification is supported and enabled"); - else - ataOneValue.Add("Removable Media Status Notification is supported"); + else ataOneValue.Add("Removable Media Status Notification is supported"); } if(ataReport.CommandSet2.HasFlag(CommandSetBit2.APM)) { - if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.APM) && ataReport.EnabledCommandSet2Specified) - ataOneValue.Add(string.Format("Advanced Power Management is supported and enabled with value {0}", ataReport.CurrentAPM)); - else - ataOneValue.Add("Advanced Power Management is supported"); + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.APM) && ataReport.EnabledCommandSet2Specified + ) + ataOneValue + .Add(string.Format("Advanced Power Management is supported and enabled with value {0}", + ataReport.CurrentAPM)); + else ataOneValue.Add("Advanced Power Management is supported"); } if(ataReport.CommandSet2.HasFlag(CommandSetBit2.CompactFlash)) { - if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.CompactFlash) && ataReport.EnabledCommandSet2Specified) + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.CompactFlash) && + ataReport.EnabledCommandSet2Specified) ataOneValue.Add("CompactFlash feature set is supported and enabled"); - else - ataOneValue.Add("CompactFlash feature set is supported"); + else ataOneValue.Add("CompactFlash feature set is supported"); } if(ataReport.CommandSet2.HasFlag(CommandSetBit2.RWQueuedDMA)) { - if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.RWQueuedDMA) && ataReport.EnabledCommandSet2Specified) + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.RWQueuedDMA) && + ataReport.EnabledCommandSet2Specified) ataOneValue.Add("READ DMA QUEUED and WRITE DMA QUEUED are supported and enabled"); - else - ataOneValue.Add("READ DMA QUEUED and WRITE DMA QUEUED are supported"); + else ataOneValue.Add("READ DMA QUEUED and WRITE DMA QUEUED are supported"); } if(ataReport.CommandSet2.HasFlag(CommandSetBit2.DownloadMicrocode)) { - if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.DownloadMicrocode) && ataReport.EnabledCommandSet2Specified) + if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.DownloadMicrocode) && + ataReport.EnabledCommandSet2Specified) ataOneValue.Add("DOWNLOAD MICROCODE is supported and enabled"); - else - ataOneValue.Add("DOWNLOAD MICROCODE is supported"); + else ataOneValue.Add("DOWNLOAD MICROCODE is supported"); } } @@ -1208,37 +1176,35 @@ namespace DiscImageChef.Server.App_Start { if(ataReport.EnabledCommandSet.HasFlag(CommandSetBit.SMART) && ataReport.EnabledCommandSetSpecified) ataOneValue.Add("S.M.A.R.T. is supported and enabled"); - else - ataOneValue.Add("S.M.A.R.T. is supported"); + else ataOneValue.Add("S.M.A.R.T. is supported"); } - if(ataReport.SCTCommandTransport.HasFlag(SCTCommandTransportBit.Supported) && ataReport.SCTCommandTransportSpecified) - ataOneValue.Add("S.M.A.R.T. Command Transport is supported"); + if(ataReport.SCTCommandTransport.HasFlag(SCTCommandTransportBit.Supported) && + ataReport.SCTCommandTransportSpecified) ataOneValue.Add("S.M.A.R.T. Command Transport is supported"); - if(ataReport.CommandSet3Specified && - ataReport.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && - !ataReport.CommandSet3.HasFlag(CommandSetBit3.MustBeClear)) + if(ataReport.CommandSet3Specified && ataReport.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && + !ataReport.CommandSet3.HasFlag(CommandSetBit3.MustBeClear)) { if(ataReport.CommandSet3.HasFlag(CommandSetBit3.SMARTSelfTest)) { - if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTSelfTest) && ataReport.EnabledCommandSet3Specified) + if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTSelfTest) && + ataReport.EnabledCommandSet3Specified) ataOneValue.Add("S.M.A.R.T. self-testing is supported and enabled"); - else - ataOneValue.Add("S.M.A.R.T. self-testing is supported"); + else ataOneValue.Add("S.M.A.R.T. self-testing is supported"); } if(ataReport.CommandSet3.HasFlag(CommandSetBit3.SMARTLog)) { - if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTLog) && ataReport.EnabledCommandSet3Specified) + if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTLog) && + ataReport.EnabledCommandSet3Specified) ataOneValue.Add("S.M.A.R.T. error logging is supported and enabled"); - else - ataOneValue.Add("S.M.A.R.T. error logging is supported"); + else ataOneValue.Add("S.M.A.R.T. error logging is supported"); } if(ataReport.CommandSet3.HasFlag(CommandSetBit3.IdleImmediate)) { - if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.IdleImmediate) && ataReport.EnabledCommandSet3Specified) + if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.IdleImmediate) && + ataReport.EnabledCommandSet3Specified) ataOneValue.Add("IDLE IMMEDIATE with UNLOAD FEATURE is supported and enabled"); - else - ataOneValue.Add("IDLE IMMEDIATE with UNLOAD FEATURE is supported"); + else ataOneValue.Add("IDLE IMMEDIATE with UNLOAD FEATURE is supported"); } if(ataReport.CommandSet3.HasFlag(CommandSetBit3.WriteURG)) { @@ -1254,125 +1220,120 @@ namespace DiscImageChef.Server.App_Start } if(ataReport.CommandSet3.HasFlag(CommandSetBit3.FUAWriteQ)) { - if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWriteQ) && ataReport.EnabledCommandSet3Specified) + if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWriteQ) && + ataReport.EnabledCommandSet3Specified) ataOneValue.Add("WRITE DMA QUEUED FUA EXT is supported and enabled"); - else - ataOneValue.Add("WRITE DMA QUEUED FUA EXT is supported"); + else ataOneValue.Add("WRITE DMA QUEUED FUA EXT is supported"); } if(ataReport.CommandSet3.HasFlag(CommandSetBit3.FUAWrite)) { - if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWrite) && ataReport.EnabledCommandSet3Specified) + if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWrite) && + ataReport.EnabledCommandSet3Specified) ataOneValue.Add("WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported and enabled"); - else - ataOneValue.Add("WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported"); + else ataOneValue.Add("WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported"); } if(ataReport.CommandSet3.HasFlag(CommandSetBit3.GPL)) { - if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.GPL) && ataReport.EnabledCommandSet3Specified) - ataOneValue.Add("General Purpose Logging is supported and enabled"); - else - ataOneValue.Add("General Purpose Logging is supported"); + if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.GPL) && ataReport.EnabledCommandSet3Specified + ) ataOneValue.Add("General Purpose Logging is supported and enabled"); + else ataOneValue.Add("General Purpose Logging is supported"); } if(ataReport.CommandSet3.HasFlag(CommandSetBit3.Streaming)) { - if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.Streaming) && ataReport.EnabledCommandSet3Specified) + if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.Streaming) && + ataReport.EnabledCommandSet3Specified) ataOneValue.Add("Streaming feature set is supported and enabled"); - else - ataOneValue.Add("Streaming feature set is supported"); + else ataOneValue.Add("Streaming feature set is supported"); } if(ataReport.CommandSet3.HasFlag(CommandSetBit3.MCPT) && ataReport.EnabledCommandSet3Specified) { if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.MCPT)) ataOneValue.Add("Media Card Pass Through command set is supported and enabled"); - else - ataOneValue.Add("Media Card Pass Through command set is supported"); + else ataOneValue.Add("Media Card Pass Through command set is supported"); } if(ataReport.CommandSet3.HasFlag(CommandSetBit3.MediaSerial) && ataReport.EnabledCommandSet3Specified) { if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.MediaSerial)) ataOneValue.Add("Media Serial is supported and valid"); - else - ataOneValue.Add("Media Serial is supported"); + else ataOneValue.Add("Media Serial is supported"); } } - if(ataReport.CommandSet4Specified && - ataReport.CommandSet4.HasFlag(CommandSetBit4.MustBeSet) && - !ataReport.CommandSet4.HasFlag(CommandSetBit4.MustBeClear)) + if(ataReport.CommandSet4Specified && ataReport.CommandSet4.HasFlag(CommandSetBit4.MustBeSet) && + !ataReport.CommandSet4.HasFlag(CommandSetBit4.MustBeClear)) { if(ataReport.CommandSet4.HasFlag(CommandSetBit4.DSN)) { - if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.DSN) && ataReport.EnabledCommandSet4Specified) - ataOneValue.Add("DSN feature set is supported and enabled"); - else - ataOneValue.Add("DSN feature set is supported"); + if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.DSN) && ataReport.EnabledCommandSet4Specified + ) ataOneValue.Add("DSN feature set is supported and enabled"); + else ataOneValue.Add("DSN feature set is supported"); } if(ataReport.CommandSet4.HasFlag(CommandSetBit4.AMAC)) { - if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.AMAC) && ataReport.EnabledCommandSet4Specified) + if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.AMAC) && + ataReport.EnabledCommandSet4Specified) ataOneValue.Add("Accessible Max Address Configuration is supported and enabled"); - else - ataOneValue.Add("Accessible Max Address Configuration is supported"); + else ataOneValue.Add("Accessible Max Address Configuration is supported"); } if(ataReport.CommandSet4.HasFlag(CommandSetBit4.ExtPowerCond)) { - if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtPowerCond) && ataReport.EnabledCommandSet4Specified) + if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtPowerCond) && + ataReport.EnabledCommandSet4Specified) ataOneValue.Add("Extended Power Conditions are supported and enabled"); - else - ataOneValue.Add("Extended Power Conditions are supported"); + else ataOneValue.Add("Extended Power Conditions are supported"); } if(ataReport.CommandSet4.HasFlag(CommandSetBit4.ExtStatusReport)) { - if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtStatusReport) && ataReport.EnabledCommandSet4Specified) + if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtStatusReport) && + ataReport.EnabledCommandSet4Specified) ataOneValue.Add("Extended Status Reporting is supported and enabled"); - else - ataOneValue.Add("Extended Status Reporting is supported"); + else ataOneValue.Add("Extended Status Reporting is supported"); } if(ataReport.CommandSet4.HasFlag(CommandSetBit4.FreeFallControl)) { - if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.FreeFallControl) && ataReport.EnabledCommandSet4Specified) + if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.FreeFallControl) && + ataReport.EnabledCommandSet4Specified) ataOneValue.Add("Free-fall control feature set is supported and enabled"); - else - ataOneValue.Add("Free-fall control feature set is supported"); + else ataOneValue.Add("Free-fall control feature set is supported"); } if(ataReport.CommandSet4.HasFlag(CommandSetBit4.SegmentedDownloadMicrocode)) { - if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.SegmentedDownloadMicrocode) && ataReport.EnabledCommandSet4Specified) + if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.SegmentedDownloadMicrocode) && + ataReport.EnabledCommandSet4Specified) ataOneValue.Add("Segmented feature in DOWNLOAD MICROCODE is supported and enabled"); - else - ataOneValue.Add("Segmented feature in DOWNLOAD MICROCODE is supported"); + else ataOneValue.Add("Segmented feature in DOWNLOAD MICROCODE is supported"); } if(ataReport.CommandSet4.HasFlag(CommandSetBit4.RWDMAExtGpl)) { - if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.RWDMAExtGpl) && ataReport.EnabledCommandSet4Specified) + if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.RWDMAExtGpl) && + ataReport.EnabledCommandSet4Specified) ataOneValue.Add("READ/WRITE DMA EXT GPL are supported and enabled"); - else - ataOneValue.Add("READ/WRITE DMA EXT GPL are supported"); + else ataOneValue.Add("READ/WRITE DMA EXT GPL are supported"); } if(ataReport.CommandSet4.HasFlag(CommandSetBit4.WriteUnc)) { - if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.WriteUnc) && ataReport.EnabledCommandSet4Specified) + if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.WriteUnc) && + ataReport.EnabledCommandSet4Specified) ataOneValue.Add("WRITE UNCORRECTABLE is supported and enabled"); - else - ataOneValue.Add("WRITE UNCORRECTABLE is supported"); + else ataOneValue.Add("WRITE UNCORRECTABLE is supported"); } if(ataReport.CommandSet4.HasFlag(CommandSetBit4.WRV)) { - if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV) && ataReport.EnabledCommandSet4Specified) - ataOneValue.Add("Write/Read/Verify is supported and enabled"); - else - ataOneValue.Add("Write/Read/Verify is supported"); - ataOneValue.Add(string.Format("{0} sectors for Write/Read/Verify mode 2", ataReport.WRVSectorCountMode2)); - ataOneValue.Add(string.Format("{0} sectors for Write/Read/Verify mode 3", ataReport.WRVSectorCountMode3)); - if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV) && ataReport.EnabledCommandSet4Specified) - ataOneValue.Add(string.Format("Current Write/Read/Verify mode: {0}", ataReport.WRVMode)); + if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV) && ataReport.EnabledCommandSet4Specified + ) ataOneValue.Add("Write/Read/Verify is supported and enabled"); + else ataOneValue.Add("Write/Read/Verify is supported"); + ataOneValue.Add(string.Format("{0} sectors for Write/Read/Verify mode 2", + ataReport.WRVSectorCountMode2)); + ataOneValue.Add(string.Format("{0} sectors for Write/Read/Verify mode 3", + ataReport.WRVSectorCountMode3)); + if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV) && ataReport.EnabledCommandSet4Specified + ) ataOneValue.Add(string.Format("Current Write/Read/Verify mode: {0}", ataReport.WRVMode)); } if(ataReport.CommandSet4.HasFlag(CommandSetBit4.DT1825)) { - if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.DT1825) && ataReport.EnabledCommandSet4Specified) - ataOneValue.Add("DT1825 is supported and enabled"); - else - ataOneValue.Add("DT1825 is supported"); + if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.DT1825) && + ataReport.EnabledCommandSet4Specified) ataOneValue.Add("DT1825 is supported and enabled"); + else ataOneValue.Add("DT1825 is supported"); } } @@ -1443,10 +1404,7 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add("Device's write cache is non-volatile"); } if(ataReport.CommandSet5.HasFlag(CommandSetBit5.ZonedBit0) || - ataReport.CommandSet5.HasFlag(CommandSetBit5.ZonedBit1)) - { - ataOneValue.Add("Device is zoned"); - } + ataReport.CommandSet5.HasFlag(CommandSetBit5.ZonedBit1)) { ataOneValue.Add("Device is zoned"); } } if(ataReport.Capabilities3Specified) @@ -1456,8 +1414,7 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add("Sanitize feature set is supported"); if(ataReport.Capabilities3.HasFlag(CapabilitiesBit3.SanitizeCommands)) ataOneValue.Add("Sanitize commands are specified by ACS-3 or higher"); - else - ataOneValue.Add("Sanitize commands are specified by ACS-2"); + else ataOneValue.Add("Sanitize commands are specified by ACS-2"); if(ataReport.Capabilities3.HasFlag(CapabilitiesBit3.SanitizeAntifreeze)) ataOneValue.Add("SANITIZE ANTIFREEZE LOCK EXT is supported"); @@ -1467,14 +1424,13 @@ namespace DiscImageChef.Server.App_Start if(!ata1 && maxatalevel >= 8 && ataReport.TrustedComputingSpecified) { if(ataReport.TrustedComputing.HasFlag(TrustedComputingBit.Set) && - !ataReport.TrustedComputing.HasFlag(TrustedComputingBit.Clear) && - ataReport.TrustedComputing.HasFlag(TrustedComputingBit.TrustedComputing)) + !ataReport.TrustedComputing.HasFlag(TrustedComputingBit.Clear) && + ataReport.TrustedComputing.HasFlag(TrustedComputingBit.TrustedComputing)) ataOneValue.Add("Trusted Computing feature set is supported"); } - if(ataReport.TransportMajorVersionSpecified && - (((ataReport.TransportMajorVersion & 0xF000) >> 12) == 0x1 || - ((ataReport.TransportMajorVersion & 0xF000) >> 12) == 0xE)) + if(ataReport.TransportMajorVersionSpecified && (((ataReport.TransportMajorVersion & 0xF000) >> 12) == 0x1 || + ((ataReport.TransportMajorVersion & 0xF000) >> 12) == 0xE)) { if(ataReport.SATACapabilitiesSpecified) { @@ -1500,58 +1456,59 @@ namespace DiscImageChef.Server.App_Start { if(ataReport.SATAFeatures.HasFlag(SATAFeaturesBit.NonZeroBufferOffset)) { - if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.NonZeroBufferOffset) && ataReport.EnabledSATAFeaturesSpecified) + if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.NonZeroBufferOffset) && + ataReport.EnabledSATAFeaturesSpecified) ataOneValue.Add("Non-zero buffer offsets are supported and enabled"); - else - ataOneValue.Add("Non-zero buffer offsets are supported"); + else ataOneValue.Add("Non-zero buffer offsets are supported"); } if(ataReport.SATAFeatures.HasFlag(SATAFeaturesBit.DMASetup)) { - if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.DMASetup) && ataReport.EnabledSATAFeaturesSpecified) + if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.DMASetup) && + ataReport.EnabledSATAFeaturesSpecified) ataOneValue.Add("DMA Setup auto-activation is supported and enabled"); - else - ataOneValue.Add("DMA Setup auto-activation is supported"); + else ataOneValue.Add("DMA Setup auto-activation is supported"); } if(ataReport.SATAFeatures.HasFlag(SATAFeaturesBit.InitPowerMgmt)) { - if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InitPowerMgmt) && ataReport.EnabledSATAFeaturesSpecified) + if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InitPowerMgmt) && + ataReport.EnabledSATAFeaturesSpecified) ataOneValue.Add("Device-initiated power management is supported and enabled"); - else - ataOneValue.Add("Device-initiated power management is supported"); + else ataOneValue.Add("Device-initiated power management is supported"); } if(ataReport.SATAFeatures.HasFlag(SATAFeaturesBit.InOrderData)) { - if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InOrderData) && ataReport.EnabledSATAFeaturesSpecified) + if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InOrderData) && + ataReport.EnabledSATAFeaturesSpecified) ataOneValue.Add("In-order data delivery is supported and enabled"); - else - ataOneValue.Add("In-order data delivery is supported"); + else ataOneValue.Add("In-order data delivery is supported"); } if(!atapi) { if(ataReport.SATAFeatures.HasFlag(SATAFeaturesBit.HardwareFeatureControl)) { - if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.HardwareFeatureControl) && ataReport.EnabledSATAFeaturesSpecified) + if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.HardwareFeatureControl) && + ataReport.EnabledSATAFeaturesSpecified) ataOneValue.Add("Hardware Feature Control is supported and enabled"); - else - ataOneValue.Add("Hardware Feature Control is supported"); + else ataOneValue.Add("Hardware Feature Control is supported"); } } if(atapi) { - if(ataReport.SATAFeatures.HasFlag(SATAFeaturesBit.AsyncNotification) && ataReport.EnabledSATAFeaturesSpecified) + if(ataReport.SATAFeatures.HasFlag(SATAFeaturesBit.AsyncNotification) && + ataReport.EnabledSATAFeaturesSpecified) { - if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.AsyncNotification) && ataReport.EnabledSATAFeaturesSpecified) - ataOneValue.Add("Asynchronous notification is supported"); - else + if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.AsyncNotification) && + ataReport.EnabledSATAFeaturesSpecified) ataOneValue.Add("Asynchronous notification is supported"); + else ataOneValue.Add("Asynchronous notification is supported"); } } if(ataReport.SATAFeatures.HasFlag(SATAFeaturesBit.SettingsPreserve)) { - if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.SettingsPreserve) && ataReport.EnabledSATAFeaturesSpecified) - ataOneValue.Add("Software Settings Preservation is supported"); - else + if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.SettingsPreserve) && + ataReport.EnabledSATAFeaturesSpecified) ataOneValue.Add("Software Settings Preservation is supported"); + else ataOneValue.Add("Software Settings Preservation is supported"); } if(ataReport.SATAFeatures.HasFlag(SATAFeaturesBit.NCQAutoSense)) { @@ -1578,7 +1535,8 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add("TRIM is supported"); if(ataReport.DataSetMgmtSizeSpecified && ataReport.DataSetMgmtSize > 0) { - ataOneValue.Add(string.Format("DATA SET MANAGEMENT can receive a maximum of {0} blocks of 512 bytes", ataReport.DataSetMgmtSize)); + ataOneValue.Add(string.Format("DATA SET MANAGEMENT can receive a maximum of {0} blocks of 512 bytes", + ataReport.DataSetMgmtSize)); } if(ataReport.SecurityStatusSpecified && ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Supported)) @@ -1589,51 +1547,51 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add("Security is enabled"); if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Locked)) ataOneValue.Add("Security is locked"); - else - ataOneValue.Add("Security is not locked"); + else ataOneValue.Add("Security is not locked"); if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Frozen)) ataOneValue.Add("Security is frozen"); - else - ataOneValue.Add("Security is not frozen"); + else ataOneValue.Add("Security is not frozen"); if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Expired)) ataOneValue.Add("Security count has expired"); - else - ataOneValue.Add("Security count has notexpired"); + else ataOneValue.Add("Security count has notexpired"); if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Maximum)) ataOneValue.Add("Security level is maximum"); - else - ataOneValue.Add("Security level is high"); + else ataOneValue.Add("Security level is high"); } - else - ataOneValue.Add("Security is not enabled"); + else ataOneValue.Add("Security is not enabled"); if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced)) ataOneValue.Add("Supports enhanced security erase"); ataOneValue.Add(string.Format("{0} minutes to complete secure erase", ataReport.SecurityEraseTime * 2)); if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced)) - ataOneValue.Add(string.Format("{0} minutes to complete enhanced secure erase", ataReport.EnhancedSecurityEraseTime * 2)); + ataOneValue.Add(string.Format("{0} minutes to complete enhanced secure erase", + ataReport.EnhancedSecurityEraseTime * 2)); - ataOneValue.Add(string.Format("Master password revision code: {0}", ataReport.MasterPasswordRevisionCode)); + ataOneValue.Add(string.Format("Master password revision code: {0}", + ataReport.MasterPasswordRevisionCode)); } - if(ataReport.CommandSet3Specified && - ataReport.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && -!ataReport.CommandSet3.HasFlag(CommandSetBit3.MustBeClear) && -ataReport.CommandSet3.HasFlag(CommandSetBit3.Streaming)) + if(ataReport.CommandSet3Specified && ataReport.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && + !ataReport.CommandSet3.HasFlag(CommandSetBit3.MustBeClear) && + ataReport.CommandSet3.HasFlag(CommandSetBit3.Streaming)) { ataOneValue.Add("<i>Streaming:</i>"); ataOneValue.Add(string.Format("Minimum request size is {0}", ataReport.StreamMinReqSize)); - ataOneValue.Add(string.Format("Streaming transfer time in PIO is {0}", ataReport.StreamTransferTimePIO)); - ataOneValue.Add(string.Format("Streaming transfer time in DMA is {0}", ataReport.StreamTransferTimeDMA)); + ataOneValue.Add(string.Format("Streaming transfer time in PIO is {0}", + ataReport.StreamTransferTimePIO)); + ataOneValue.Add(string.Format("Streaming transfer time in DMA is {0}", + ataReport.StreamTransferTimeDMA)); ataOneValue.Add(string.Format("Streaming access latency is {0}", ataReport.StreamAccessLatency)); - ataOneValue.Add(string.Format("Streaming performance granularity is {0}", ataReport.StreamPerformanceGranularity)); + ataOneValue.Add(string.Format("Streaming performance granularity is {0}", + ataReport.StreamPerformanceGranularity)); } - if(ataReport.SCTCommandTransportSpecified && ataReport.SCTCommandTransport.HasFlag(SCTCommandTransportBit.Supported)) + if(ataReport.SCTCommandTransportSpecified && + ataReport.SCTCommandTransport.HasFlag(SCTCommandTransportBit.Supported)) { ataOneValue.Add("<i>S.M.A.R.T. Command Transport (SCT):</i>"); if(ataReport.SCTCommandTransport.HasFlag(SCTCommandTransportBit.LongSectorAccess)) @@ -1656,12 +1614,12 @@ ataReport.CommandSet3.HasFlag(CommandSetBit3.Streaming)) { if((ataReport.NVCacheCaps & 0x0002) == 0x0002) ataOneValue.Add("Power mode feature set is supported and enabled"); - else - ataOneValue.Add("Power mode feature set is supported"); + else ataOneValue.Add("Power mode feature set is supported"); ataOneValue.Add(string.Format("Version {0}", (ataReport.NVCacheCaps & 0x0F00) >> 8)); } - ataOneValue.Add(string.Format("Non-Volatile Cache is {0} bytes", ataReport.NVCacheSize * logicalsectorsize)); + ataOneValue.Add(string.Format("Non-Volatile Cache is {0} bytes", + ataReport.NVCacheSize * logicalsectorsize)); } if(ataReport.ReadCapabilities != null) @@ -1676,102 +1634,165 @@ ataReport.CommandSet3.HasFlag(CommandSetBit3.Streaming)) if(ataReport.ReadCapabilities.NominalRotationRate == 0x0001) ataOneValue.Add("Device does not rotate."); else - ataOneValue.Add(string.Format("Device rotates at {0} rpm", ataReport.ReadCapabilities.NominalRotationRate)); + ataOneValue.Add(string.Format("Device rotates at {0} rpm", + ataReport.ReadCapabilities.NominalRotationRate)); } if(!atapi) { if(ataReport.ReadCapabilities.BlockSizeSpecified) { - ataTwoValue.Add("Logical sector size", string.Format("{0} bytes", ataReport.ReadCapabilities.BlockSize)); + ataTwoValue.Add("Logical sector size", + string.Format("{0} bytes", ataReport.ReadCapabilities.BlockSize)); logicalsectorsize = ataReport.ReadCapabilities.BlockSize; } if(ataReport.ReadCapabilities.PhysicalBlockSizeSpecified) - ataTwoValue.Add("Physical sector size", string.Format("{0} bytes", ataReport.ReadCapabilities.PhysicalBlockSize)); + ataTwoValue.Add("Physical sector size", + string.Format("{0} bytes", ataReport.ReadCapabilities.PhysicalBlockSize)); if(ataReport.ReadCapabilities.LongBlockSizeSpecified) - ataTwoValue.Add("READ LONG sector size", string.Format("{0} bytes", ataReport.ReadCapabilities.LongBlockSize)); - + ataTwoValue.Add("READ LONG sector size", + string.Format("{0} bytes", ataReport.ReadCapabilities.LongBlockSize)); if(ataReport.ReadCapabilities.BlockSizeSpecified && ataReport.ReadCapabilities.PhysicalBlockSizeSpecified && (ataReport.ReadCapabilities.BlockSize != ataReport.ReadCapabilities.PhysicalBlockSize) && - (ataReport.ReadCapabilities.LogicalAlignment & 0x8000) == 0x0000 && - (ataReport.ReadCapabilities.LogicalAlignment & 0x4000) == 0x4000) + (ataReport.ReadCapabilities.LogicalAlignment & 0x8000) == 0x0000 && + (ataReport.ReadCapabilities.LogicalAlignment & 0x4000) == 0x4000) { - ataOneValue.Add(string.Format("Logical sector starts at offset {0} from physical sector", ataReport.ReadCapabilities.LogicalAlignment & 0x3FFF)); + ataOneValue.Add(string.Format("Logical sector starts at offset {0} from physical sector", + ataReport.ReadCapabilities.LogicalAlignment & 0x3FFF)); } - if(ataReport.ReadCapabilities.CHS != null && - ataReport.ReadCapabilities.CurrentCHS != null) + if(ataReport.ReadCapabilities.CHS != null && ataReport.ReadCapabilities.CurrentCHS != null) { - int currentSectors = ataReport.ReadCapabilities.CurrentCHS.Cylinders * ataReport.ReadCapabilities.CurrentCHS.Heads * ataReport.ReadCapabilities.CurrentCHS.Sectors; - ataTwoValue.Add("Cylinders", string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Cylinders, ataReport.ReadCapabilities.CurrentCHS.Cylinders)); - ataTwoValue.Add("Heads", string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Heads, ataReport.ReadCapabilities.CurrentCHS.Heads)); - ataTwoValue.Add("Sectors per track", string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Sectors, ataReport.ReadCapabilities.CurrentCHS.Sectors)); - ataTwoValue.Add("Sectors addressable in CHS mode", string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Cylinders * ataReport.ReadCapabilities.CHS.Heads * ataReport.ReadCapabilities.CHS.Sectors, - currentSectors)); - ataTwoValue.Add("Device size in CHS mode", string.Format("{0} bytes, {1} Mb, {2:F2} MiB", (ulong)currentSectors * logicalsectorsize, - ((ulong)currentSectors * logicalsectorsize) / 1000 / 1000, (double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024)); + int currentSectors = ataReport.ReadCapabilities.CurrentCHS.Cylinders * + ataReport.ReadCapabilities.CurrentCHS.Heads * + ataReport.ReadCapabilities.CurrentCHS.Sectors; + ataTwoValue.Add("Cylinders", + string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Cylinders, + ataReport.ReadCapabilities.CurrentCHS.Cylinders)); + ataTwoValue.Add("Heads", + string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Heads, + ataReport.ReadCapabilities.CurrentCHS.Heads)); + ataTwoValue.Add("Sectors per track", + string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Sectors, + ataReport.ReadCapabilities.CurrentCHS.Sectors)); + ataTwoValue.Add("Sectors addressable in CHS mode", + string.Format("{0} max., {1} current", + ataReport.ReadCapabilities.CHS.Cylinders * + ataReport.ReadCapabilities.CHS.Heads * + ataReport.ReadCapabilities.CHS.Sectors, currentSectors)); + ataTwoValue.Add("Device size in CHS mode", + string.Format("{0} bytes, {1} Mb, {2:F2} MiB", + (ulong)currentSectors * logicalsectorsize, + ((ulong)currentSectors * logicalsectorsize) / 1000 / 1000, + (double)((ulong)currentSectors * logicalsectorsize) / 1024 / + 1024)); } else if(ataReport.ReadCapabilities.CHS != null) { - int currentSectors = ataReport.ReadCapabilities.CHS.Cylinders * ataReport.ReadCapabilities.CHS.Heads * ataReport.ReadCapabilities.CHS.Sectors; + int currentSectors = ataReport.ReadCapabilities.CHS.Cylinders * + ataReport.ReadCapabilities.CHS.Heads * + ataReport.ReadCapabilities.CHS.Sectors; ataTwoValue.Add("Cylinders", string.Format("{0}", ataReport.ReadCapabilities.CHS.Cylinders)); ataTwoValue.Add("Heads", string.Format("{0}", ataReport.ReadCapabilities.CHS.Heads)); - ataTwoValue.Add("Sectors per track", string.Format("{0}", ataReport.ReadCapabilities.CHS.Sectors)); + ataTwoValue.Add("Sectors per track", + string.Format("{0}", ataReport.ReadCapabilities.CHS.Sectors)); ataTwoValue.Add("Sectors addressable in CHS mode", string.Format("{0}", currentSectors)); - ataTwoValue.Add("Device size in CHS mode", string.Format("{0} bytes, {1} Mb, {2:F2} MiB", (ulong)currentSectors * logicalsectorsize, - ((ulong)currentSectors * logicalsectorsize) / 1000 / 1000, (double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024)); + ataTwoValue.Add("Device size in CHS mode", + string.Format("{0} bytes, {1} Mb, {2:F2} MiB", + (ulong)currentSectors * logicalsectorsize, + ((ulong)currentSectors * logicalsectorsize) / 1000 / 1000, + (double)((ulong)currentSectors * logicalsectorsize) / 1024 / + 1024)); } if(ataReport.ReadCapabilities.LBASectorsSpecified) { - ataTwoValue.Add("Sectors addressable in sectors in 28-bit LBA mode", string.Format("{0}", ataReport.ReadCapabilities.LBASectors)); + ataTwoValue.Add("Sectors addressable in sectors in 28-bit LBA mode", + string.Format("{0}", ataReport.ReadCapabilities.LBASectors)); if((((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024) > 1000000) { - ataTwoValue.Add("Device size in 28-bit LBA mode", string.Format("{0} bytes, {1} Tb, {2:F2} TiB", (ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize, - ((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1000 / 1000 / 1000 / 1000, (double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024)); + ataTwoValue.Add("Device size in 28-bit LBA mode", + string.Format("{0} bytes, {1} Tb, {2:F2} TiB", + (ulong)ataReport.ReadCapabilities.LBASectors * + logicalsectorsize, + ((ulong)ataReport.ReadCapabilities.LBASectors * + logicalsectorsize) / 1000 / 1000 / 1000 / 1000, + (double)((ulong)ataReport.ReadCapabilities.LBASectors * + logicalsectorsize) / 1024 / 1024 / 1024 / 1024)); } - else if((((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024) > 1000) + else if((((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024) > + 1000) { - ataTwoValue.Add("Device size in 28-bit LBA mode", string.Format("{0} bytes, {1} Gb, {2:F2} GiB", (ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize, - ((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1000 / 1000 / 1000, (double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024)); + ataTwoValue.Add("Device size in 28-bit LBA mode", + string.Format("{0} bytes, {1} Gb, {2:F2} GiB", + (ulong)ataReport.ReadCapabilities.LBASectors * + logicalsectorsize, + ((ulong)ataReport.ReadCapabilities.LBASectors * + logicalsectorsize) / 1000 / 1000 / 1000, + (double)((ulong)ataReport.ReadCapabilities.LBASectors * + logicalsectorsize) / 1024 / 1024 / 1024)); } else { - ataTwoValue.Add("Device size in 28-bit LBA mode", string.Format("{0} bytes, {1} Mb, {2:F2} MiB", (ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize, - ((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1000 / 1000, (double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024)); + ataTwoValue.Add("Device size in 28-bit LBA mode", + string.Format("{0} bytes, {1} Mb, {2:F2} MiB", + (ulong)ataReport.ReadCapabilities.LBASectors * + logicalsectorsize, + ((ulong)ataReport.ReadCapabilities.LBASectors * + logicalsectorsize) / 1000 / 1000, + (double)((ulong)ataReport.ReadCapabilities.LBASectors * + logicalsectorsize) / 1024 / 1024)); } } if(ataReport.ReadCapabilities.LBA48SectorsSpecified) { - ataTwoValue.Add("Sectors addressable in sectors in 48-bit LBA mode", string.Format("{0}", ataReport.ReadCapabilities.LBA48Sectors)); + ataTwoValue.Add("Sectors addressable in sectors in 48-bit LBA mode", + string.Format("{0}", ataReport.ReadCapabilities.LBA48Sectors)); if(((ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024) > 1000000) { - ataTwoValue.Add("Device size in 48-bit LBA mode", string.Format("{0} bytes, {1} Tb, {2:F2} TiB", ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize, - (ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1000 / 1000 / 1000 / 1000, (double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024)); + ataTwoValue.Add("Device size in 48-bit LBA mode", + string.Format("{0} bytes, {1} Tb, {2:F2} TiB", + ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize, + (ataReport.ReadCapabilities.LBA48Sectors * + logicalsectorsize) / 1000 / 1000 / 1000 / 1000, + (double)(ataReport.ReadCapabilities.LBA48Sectors * + logicalsectorsize) / 1024 / 1024 / 1024 / 1024)); } else if(((ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024) > 1000) { - ataTwoValue.Add("Device size in 48-bit LBA mode", string.Format("{0} bytes, {1} Gb, {2:F2} GiB", ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize, - (ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1000 / 1000 / 1000, (double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024)); + ataTwoValue.Add("Device size in 48-bit LBA mode", + string.Format("{0} bytes, {1} Gb, {2:F2} GiB", + ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize, + (ataReport.ReadCapabilities.LBA48Sectors * + logicalsectorsize) / 1000 / 1000 / 1000, + (double)(ataReport.ReadCapabilities.LBA48Sectors * + logicalsectorsize) / 1024 / 1024 / 1024)); } else { - ataTwoValue.Add("Device size in 48-bit LBA mode", string.Format("{0} bytes, {1} Mb, {2:F2} MiB", ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize, - (ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1000 / 1000, (double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024)); + ataTwoValue.Add("Device size in 48-bit LBA mode", + string.Format("{0} bytes, {1} Mb, {2:F2} MiB", + ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize, + (ataReport.ReadCapabilities.LBA48Sectors * + logicalsectorsize) / 1000 / 1000, + (double)(ataReport.ReadCapabilities.LBA48Sectors * + logicalsectorsize) / 1024 / 1024)); } } if(ata1 || cfa) { if(ataReport.ReadCapabilities.UnformattedBPT > 0) - ataTwoValue.Add("Bytes per unformatted track", string.Format("{0}", ataReport.ReadCapabilities.UnformattedBPT)); + ataTwoValue.Add("Bytes per unformatted track", + string.Format("{0}", ataReport.ReadCapabilities.UnformattedBPT)); if(ataReport.ReadCapabilities.UnformattedBPS > 0) - ataTwoValue.Add("Bytes per unformatted sector", string.Format("{0}", ataReport.ReadCapabilities.UnformattedBPS)); + ataTwoValue.Add("Bytes per unformatted sector", + string.Format("{0}", ataReport.ReadCapabilities.UnformattedBPS)); } } @@ -1787,7 +1808,7 @@ ataReport.CommandSet3.HasFlag(CommandSetBit3.Streaming)) ataOneValue.Add("Device supports READ LONG command in CHS mode"); if(ataReport.ReadCapabilities.SupportsReadLongRetry) ataOneValue.Add("Device supports READ LONG RETRY command in CHS mode"); - + if(ataReport.ReadCapabilities.SupportsReadLba) ataOneValue.Add("Device supports READ SECTOR(S) command in 28-bit LBA mode"); if(ataReport.ReadCapabilities.SupportsReadRetryLba) @@ -1806,13 +1827,11 @@ ataReport.CommandSet3.HasFlag(CommandSetBit3.Streaming)) if(ataReport.ReadCapabilities.SupportsReadDmaLba48) ataOneValue.Add("Device supports READ DMA command in 48-bit LBA mode"); - if(ataReport.ReadCapabilities.SupportsSeek) - ataOneValue.Add("Device supports SEEK command in CHS mode"); + if(ataReport.ReadCapabilities.SupportsSeek) ataOneValue.Add("Device supports SEEK command in CHS mode"); if(ataReport.ReadCapabilities.SupportsSeekLba) ataOneValue.Add("Device supports SEEK command in 28-bit LBA mode"); } - else - testedMedia = ataReport.RemovableMedias; + else testedMedia = ataReport.RemovableMedias; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/App_Start/ScsiEvpd.cs b/DiscImageChef.Server/App_Start/ScsiEvpd.cs index ceafa672..593b6a03 100644 --- a/DiscImageChef.Server/App_Start/ScsiEvpd.cs +++ b/DiscImageChef.Server/App_Start/ScsiEvpd.cs @@ -42,28 +42,19 @@ namespace DiscImageChef.Server.App_Start foreach(pageType evpd in pages) { string decoded; - if(evpd.page >= 0x01 && evpd.page <= 0x7F) - decoded = Decoders.SCSI.EVPD.DecodeASCIIPage(evpd.value); - else if(evpd.page == 0x81) - decoded = Decoders.SCSI.EVPD.PrettifyPage_81(evpd.value); - else if(evpd.page == 0x82) - decoded = Decoders.SCSI.EVPD.DecodePage82(evpd.value); - else if(evpd.page == 0x83) - decoded = Decoders.SCSI.EVPD.PrettifyPage_83(evpd.value); - else if(evpd.page == 0x84) - decoded = Decoders.SCSI.EVPD.PrettifyPage_84(evpd.value); - else if(evpd.page == 0x85) - decoded = Decoders.SCSI.EVPD.PrettifyPage_85(evpd.value); - else if(evpd.page == 0x86) - decoded = Decoders.SCSI.EVPD.PrettifyPage_86(evpd.value); - else if(evpd.page == 0x89) - decoded = Decoders.SCSI.EVPD.PrettifyPage_89(evpd.value); - else if(evpd.page == 0xB0) - decoded = Decoders.SCSI.EVPD.PrettifyPage_B0(evpd.value); + if(evpd.page >= 0x01 && evpd.page <= 0x7F) decoded = Decoders.SCSI.EVPD.DecodeASCIIPage(evpd.value); + else if(evpd.page == 0x81) decoded = Decoders.SCSI.EVPD.PrettifyPage_81(evpd.value); + else if(evpd.page == 0x82) decoded = Decoders.SCSI.EVPD.DecodePage82(evpd.value); + else if(evpd.page == 0x83) decoded = Decoders.SCSI.EVPD.PrettifyPage_83(evpd.value); + else if(evpd.page == 0x84) decoded = Decoders.SCSI.EVPD.PrettifyPage_84(evpd.value); + else if(evpd.page == 0x85) decoded = Decoders.SCSI.EVPD.PrettifyPage_85(evpd.value); + else if(evpd.page == 0x86) decoded = Decoders.SCSI.EVPD.PrettifyPage_86(evpd.value); + else if(evpd.page == 0x89) decoded = Decoders.SCSI.EVPD.PrettifyPage_89(evpd.value); + else if(evpd.page == 0xB0) decoded = Decoders.SCSI.EVPD.PrettifyPage_B0(evpd.value); else if(evpd.page == 0xB2) - decoded = string.Format("TapeAlert Supported Flags Bitmap: 0x{0:X16}<br/>", Decoders.SCSI.EVPD.DecodePageB2(evpd.value)); - else if(evpd.page == 0xB4) - decoded = Decoders.SCSI.EVPD.DecodePageB4(evpd.value); + decoded = string.Format("TapeAlert Supported Flags Bitmap: 0x{0:X16}<br/>", + Decoders.SCSI.EVPD.DecodePageB2(evpd.value)); + else if(evpd.page == 0xB4) decoded = Decoders.SCSI.EVPD.DecodePageB4(evpd.value); else if(evpd.page == 0xC0 && vendor.Trim() == "quantum") decoded = Decoders.SCSI.EVPD.PrettifyPage_C0_Quantum(evpd.value); else if(evpd.page == 0xC0 && vendor.Trim() == "seagate") @@ -74,22 +65,21 @@ namespace DiscImageChef.Server.App_Start decoded = Decoders.SCSI.EVPD.PrettifyPage_C1_IBM(evpd.value); else if((evpd.page == 0xC0 || evpd.page == 0xC1) && vendor.Trim() == "certance") decoded = Decoders.SCSI.EVPD.PrettifyPage_C0_C1_Certance(evpd.value); - else if((evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5 || evpd.page == 0xC6) && + else if((evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5 || + evpd.page == 0xC6) && vendor.Trim() == "certance") decoded = Decoders.SCSI.EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(evpd.value); - else if((evpd.page == 0xC0 || evpd.page == 0xC1 || evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5) && - vendor.Trim() == "hp") - decoded = Decoders.SCSI.EVPD.PrettifyPage_C0_to_C5_HP(evpd.value); + else if((evpd.page == 0xC0 || evpd.page == 0xC1 || evpd.page == 0xC2 || evpd.page == 0xC3 || + evpd.page == 0xC4 || evpd.page == 0xC5) && + vendor.Trim() == "hp") decoded = Decoders.SCSI.EVPD.PrettifyPage_C0_to_C5_HP(evpd.value); else if(evpd.page == 0xDF && vendor.Trim() == "certance") decoded = Decoders.SCSI.EVPD.PrettifyPage_DF_Certance(evpd.value); - else - decoded = "Undecoded"; + else decoded = "Undecoded"; + + if(!string.IsNullOrEmpty(decoded)) decoded = decoded.Replace("\n", "<br/>"); - if(!string.IsNullOrEmpty(decoded)) - decoded = decoded.Replace("\n", "<br/>"); - evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), decoded); } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/App_Start/ScsiInquiry.cs b/DiscImageChef.Server/App_Start/ScsiInquiry.cs index 5a50dd26..13967c6d 100644 --- a/DiscImageChef.Server/App_Start/ScsiInquiry.cs +++ b/DiscImageChef.Server/App_Start/ScsiInquiry.cs @@ -57,7 +57,8 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device is connected but unsupported."); break; default: - scsiOneValue.Add(string.Format("Vendor value {0} set in Peripheral Qualifier field.", inquiry.PeripheralQualifier)); + scsiOneValue.Add(string.Format("Vendor value {0} set in Peripheral Qualifier field.", + inquiry.PeripheralQualifier)); break; } @@ -133,7 +134,8 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Unknown or no device type"); break; default: - scsiOneValue.Add(string.Format("Unknown device type field value 0x{0:X2}", inquiry.PeripheralDeviceType)); + scsiOneValue.Add(string.Format("Unknown device type field value 0x{0:X2}", + inquiry.PeripheralDeviceType)); break; } @@ -161,7 +163,9 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device claims to comply with ANSI X3.408:2005 (SPC-4)"); break; default: - scsiOneValue.Add(string.Format("Device claims to comply with unknown SCSI ANSI standard value 0x{0:X2})", inquiry.ANSIVersion)); + scsiOneValue + .Add(string.Format("Device claims to comply with unknown SCSI ANSI standard value 0x{0:X2})", + inquiry.ANSIVersion)); break; } @@ -174,7 +178,9 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device claims to comply ECMA-111: Small Computer System Interface SCSI"); break; default: - scsiOneValue.Add(string.Format("Device claims to comply with unknown SCSI ECMA standard value 0x{0:X2})", inquiry.ECMAVersion)); + scsiOneValue + .Add(string.Format("Device claims to comply with unknown SCSI ECMA standard value 0x{0:X2})", + inquiry.ECMAVersion)); break; } @@ -187,62 +193,39 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device claims to comply with ISO/IEC 9316:1995"); break; default: - scsiOneValue.Add(string.Format("Device claims to comply with unknown SCSI ISO/IEC standard value 0x{0:X2})", inquiry.ISOVersion)); + scsiOneValue + .Add(string.Format("Device claims to comply with unknown SCSI ISO/IEC standard value 0x{0:X2})", + inquiry.ISOVersion)); break; } - if(inquiry.Removable) - scsiOneValue.Add("Device is removable"); - if(inquiry.AERCSupported) - scsiOneValue.Add("Device supports Asynchronous Event Reporting Capability"); - if(inquiry.TerminateTaskSupported) - scsiOneValue.Add("Device supports TERMINATE TASK command"); - if(inquiry.NormalACA) - scsiOneValue.Add("Device supports setting Normal ACA"); - if(inquiry.HierarchicalLUN) - scsiOneValue.Add("Device supports LUN hierarchical addressing"); - if(inquiry.StorageArrayController) - scsiOneValue.Add("Device contains an embedded storage array controller"); - if(inquiry.AccessControlCoordinator) - scsiOneValue.Add("Device contains an Access Control Coordinator"); - if(inquiry.ThirdPartyCopy) - scsiOneValue.Add("Device supports third-party copy commands"); - if(inquiry.Protection) - scsiOneValue.Add("Device supports protection information"); - if(inquiry.BasicQueueing) - scsiOneValue.Add("Device supports basic queueing"); - if(inquiry.EnclosureServices) - scsiOneValue.Add("Device contains an embedded enclosure services component"); - if(inquiry.MultiPortDevice) - scsiOneValue.Add("Multi-port device"); - if(inquiry.MediumChanger) - scsiOneValue.Add("Device contains or is attached to a medium changer"); - if(inquiry.ACKRequests) - scsiOneValue.Add("Device supports request and acknowledge handshakes"); - if(inquiry.Address32) - scsiOneValue.Add("Device supports 32-bit wide SCSI addresses"); - if(inquiry.Address16) - scsiOneValue.Add("Device supports 16-bit wide SCSI addresses"); - if(inquiry.RelativeAddressing) - scsiOneValue.Add("Device supports relative addressing"); - if(inquiry.WideBus32) - scsiOneValue.Add("Device supports 32-bit wide data transfers"); - if(inquiry.WideBus16) - scsiOneValue.Add("Device supports 16-bit wide data transfers"); - if(inquiry.SyncTransfer) - scsiOneValue.Add("Device supports synchronous data transfer"); - if(inquiry.LinkedCommands) - scsiOneValue.Add("Device supports linked commands"); + if(inquiry.Removable) scsiOneValue.Add("Device is removable"); + if(inquiry.AERCSupported) scsiOneValue.Add("Device supports Asynchronous Event Reporting Capability"); + if(inquiry.TerminateTaskSupported) scsiOneValue.Add("Device supports TERMINATE TASK command"); + if(inquiry.NormalACA) scsiOneValue.Add("Device supports setting Normal ACA"); + if(inquiry.HierarchicalLUN) scsiOneValue.Add("Device supports LUN hierarchical addressing"); + if(inquiry.StorageArrayController) scsiOneValue.Add("Device contains an embedded storage array controller"); + if(inquiry.AccessControlCoordinator) scsiOneValue.Add("Device contains an Access Control Coordinator"); + if(inquiry.ThirdPartyCopy) scsiOneValue.Add("Device supports third-party copy commands"); + if(inquiry.Protection) scsiOneValue.Add("Device supports protection information"); + if(inquiry.BasicQueueing) scsiOneValue.Add("Device supports basic queueing"); + if(inquiry.EnclosureServices) scsiOneValue.Add("Device contains an embedded enclosure services component"); + if(inquiry.MultiPortDevice) scsiOneValue.Add("Multi-port device"); + if(inquiry.MediumChanger) scsiOneValue.Add("Device contains or is attached to a medium changer"); + if(inquiry.ACKRequests) scsiOneValue.Add("Device supports request and acknowledge handshakes"); + if(inquiry.Address32) scsiOneValue.Add("Device supports 32-bit wide SCSI addresses"); + if(inquiry.Address16) scsiOneValue.Add("Device supports 16-bit wide SCSI addresses"); + if(inquiry.RelativeAddressing) scsiOneValue.Add("Device supports relative addressing"); + if(inquiry.WideBus32) scsiOneValue.Add("Device supports 32-bit wide data transfers"); + if(inquiry.WideBus16) scsiOneValue.Add("Device supports 16-bit wide data transfers"); + if(inquiry.SyncTransfer) scsiOneValue.Add("Device supports synchronous data transfer"); + if(inquiry.LinkedCommands) scsiOneValue.Add("Device supports linked commands"); if(inquiry.TranferDisable) scsiOneValue.Add("Device supports CONTINUE TASK and TARGET TRANSFER DISABLE commands"); - if(inquiry.QAS) - scsiOneValue.Add("Device supports Quick Arbitration and Selection"); - if(inquiry.TaggedCommandQueue) - scsiOneValue.Add("Device supports TCQ queue"); - if(inquiry.IUS) - scsiOneValue.Add("Device supports information unit transfers"); - if(inquiry.SoftReset) - scsiOneValue.Add("Device implements RESET as a soft reset"); + if(inquiry.QAS) scsiOneValue.Add("Device supports Quick Arbitration and Selection"); + if(inquiry.TaggedCommandQueue) scsiOneValue.Add("Device supports TCQ queue"); + if(inquiry.IUS) scsiOneValue.Add("Device supports information unit transfers"); + if(inquiry.SoftReset) scsiOneValue.Add("Device implements RESET as a soft reset"); switch((TGPSValues)inquiry.AsymmetricalLUNAccess) { @@ -259,7 +242,8 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device supports implicit and explicit assymetrical access"); break; default: - scsiOneValue.Add(string.Format("Unknown value in TPGS field 0x{0:X2}", inquiry.AsymmetricalLUNAccess)); + scsiOneValue.Add(string.Format("Unknown value in TPGS field 0x{0:X2}", + inquiry.AsymmetricalLUNAccess)); break; } @@ -278,7 +262,8 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device supports ST and DT clocking"); break; default: - scsiOneValue.Add(string.Format("Unknown value in SPI clocking field 0x{0:X2}", inquiry.SPIClocking)); + scsiOneValue.Add(string.Format("Unknown value in SPI clocking field 0x{0:X2}", + inquiry.SPIClocking)); break; } @@ -289,8 +274,7 @@ namespace DiscImageChef.Server.App_Start switch(VersionDescriptor) { case 0xFFFF: - case 0x0000: - break; + case 0x0000: break; case 0x0020: scsiOneValue.Add("Device complies with SAM (no version claimed)"); break; @@ -418,10 +402,12 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device complies with SES ANSI INCITS 305-1998"); break; case 0x01DD: - scsiOneValue.Add("Device complies with SES T10/1212 revision 08b w/ Amendment ANSI INCITS.305/AM1-2000"); + scsiOneValue + .Add("Device complies with SES T10/1212 revision 08b w/ Amendment ANSI INCITS.305/AM1-2000"); break; case 0x01DE: - scsiOneValue.Add("Device complies with SES ANSI INCITS 305-1998 w/ Amendment ANSI INCITS.305/AM1-2000"); + scsiOneValue + .Add("Device complies with SES ANSI INCITS 305-1998 w/ Amendment ANSI INCITS.305/AM1-2000"); break; case 0x01E0: scsiOneValue.Add("Device complies with SCC-2 (no version claimed)"); @@ -757,7 +743,8 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device complies with MMC-6 ANSI INCITS 468-2010"); break; case 0x04E7: - scsiOneValue.Add("Device complies with MMC-6 ANSI INCITS 468-2010 + MMC-6/AM1 ANSI INCITS 468-2010/AM 1"); + scsiOneValue + .Add("Device complies with MMC-6 ANSI INCITS 468-2010 + MMC-6/AM1 ANSI INCITS 468-2010/AM 1"); break; case 0x0500: scsiOneValue.Add("Device complies with ADC-3 (no version claimed)"); @@ -949,7 +936,8 @@ namespace DiscImageChef.Server.App_Start case 0x097D: case 0x097E: case 0x097F: - scsiOneValue.Add(string.Format("Device complies with iSCSI revision {0}", VersionDescriptor & 0x1F)); + scsiOneValue.Add(string.Format("Device complies with iSCSI revision {0}", + VersionDescriptor & 0x1F)); break; case 0x0980: scsiOneValue.Add("Device complies with SBP-3 (no version claimed)"); @@ -1042,10 +1030,12 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device complies with SPI ANSI INCITS 253-1995"); break; case 0x0ABB: - scsiOneValue.Add("Device complies with SPI T10/0855-D revision 15a with SPI Amnd revision 3a"); + scsiOneValue + .Add("Device complies with SPI T10/0855-D revision 15a with SPI Amnd revision 3a"); break; case 0x0ABC: - scsiOneValue.Add("Device complies with SPI ANSI INCITS 253-1995 with SPI Amnd ANSI INCITS 253/AM1-1998"); + scsiOneValue + .Add("Device complies with SPI ANSI INCITS 253-1995 with SPI Amnd ANSI INCITS 253/AM1-1998"); break; case 0x0AC0: scsiOneValue.Add("Device complies with Fast-20 (no version claimed)"); @@ -1186,7 +1176,8 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device complies with SAS-2.1 ANSI INCITS 478-2011"); break; case 0x0C4F: - scsiOneValue.Add("Device complies with SAS-2.1 ANSI INCITS 478-2011 w/ Amnd 1 ANSI INCITS 478/AM1-2014"); + scsiOneValue + .Add("Device complies with SAS-2.1 ANSI INCITS 478-2011 w/ Amnd 1 ANSI INCITS 478/AM1-2014"); break; case 0x0C52: scsiOneValue.Add("Device complies with SAS-2.1 ISO/IEC 14776-153"); @@ -1213,7 +1204,8 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device complies with FC-PH ANSI INCITS 230-1994"); break; case 0x0D3C: - scsiOneValue.Add("Device complies with FC-PH ANSI INCITS 230-1994 with Amnd 1 ANSI INCITS 230/AM1-1996"); + scsiOneValue + .Add("Device complies with FC-PH ANSI INCITS 230-1994 with Amnd 1 ANSI INCITS 230/AM1-1996"); break; case 0x0D40: scsiOneValue.Add("Device complies with FC-AL (no version claimed)"); @@ -1228,7 +1220,8 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device complies with FC-AL-2 T11/1133-D revision 7.0"); break; case 0x0D63: - scsiOneValue.Add("Device complies with FC-AL-2 ANSI INCITS 332-1999 with AM1-2003 & AM2-2006"); + scsiOneValue + .Add("Device complies with FC-AL-2 ANSI INCITS 332-1999 with AM1-2003 & AM2-2006"); break; case 0x0D64: scsiOneValue.Add("Device complies with FC-AL-2 ANSI INCITS 332-1999 with Amnd 2 AM2-2006"); @@ -1285,7 +1278,8 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device complies with FC-FS-2 ANSI INCITS 242-2007"); break; case 0x0E03: - scsiOneValue.Add("Device complies with FC-FS-2 ANSI INCITS 242-2007 with AM1 ANSI INCITS 242/AM1-2007"); + scsiOneValue + .Add("Device complies with FC-FS-2 ANSI INCITS 242-2007 with AM1 ANSI INCITS 242/AM1-2007"); break; case 0x0E20: scsiOneValue.Add("Device complies with FC-LS (no version claimed)"); @@ -1342,7 +1336,8 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device complies with FC 10GFC ISO/IEC 14165-116 with AM1"); break; case 0x0EA6: - scsiOneValue.Add("Device complies with FC 10GFC ANSI INCITS 364-2003 with AM1 ANSI INCITS 364/AM1-2007"); + scsiOneValue + .Add("Device complies with FC 10GFC ANSI INCITS 364-2003 with AM1 ANSI INCITS 364/AM1-2007"); break; case 0x0EC0: scsiOneValue.Add("Device complies with FC-SP-2 (no version claimed)"); @@ -1522,19 +1517,23 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device complies with ATA/ATAPI-8 ATA8-AAM (no version claimed)"); break; case 0x1621: - scsiOneValue.Add("Device complies with ATA/ATAPI-8 ATA8-APT Parallel Transport (no version claimed)"); + scsiOneValue + .Add("Device complies with ATA/ATAPI-8 ATA8-APT Parallel Transport (no version claimed)"); break; case 0x1622: - scsiOneValue.Add("Device complies with ATA/ATAPI-8 ATA8-AST Serial Transport (no version claimed)"); + scsiOneValue + .Add("Device complies with ATA/ATAPI-8 ATA8-AST Serial Transport (no version claimed)"); break; case 0x1623: - scsiOneValue.Add("Device complies with ATA/ATAPI-8 ATA8-ACS ATA/ATAPI Command Set (no version claimed)"); + scsiOneValue + .Add("Device complies with ATA/ATAPI-8 ATA8-ACS ATA/ATAPI Command Set (no version claimed)"); break; case 0x1628: scsiOneValue.Add("Device complies with ATA/ATAPI-8 ATA8-AAM ANSI INCITS 451-2008"); break; case 0x162A: - scsiOneValue.Add("Device complies with ATA/ATAPI-8 ATA8-ACS ANSI INCITS 452-2009 w/ Amendment 1"); + scsiOneValue + .Add("Device complies with ATA/ATAPI-8 ATA8-ACS ANSI INCITS 452-2009 w/ Amendment 1"); break; case 0x1728: scsiOneValue.Add("Device complies with Universal Serial Bus Specification, Revision 1.1"); @@ -1543,7 +1542,8 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device complies with Universal Serial Bus Specification, Revision 2.0"); break; case 0x1730: - scsiOneValue.Add("Device complies with USB Mass Storage Class Bulk-Only Transport, Revision 1.0"); + scsiOneValue + .Add("Device complies with USB Mass Storage Class Bulk-Only Transport, Revision 1.0"); break; case 0x1740: scsiOneValue.Add("Device complies with UAS (no version claimed)"); @@ -1624,7 +1624,8 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device complies with SPL ANSI INCITS 476-2011"); break; case 0x20A8: - scsiOneValue.Add("Device complies with SPL ANSI INCITS 476-2011 + SPL AM1 INCITS 476/AM1 2012"); + scsiOneValue + .Add("Device complies with SPL ANSI INCITS 476-2011 + SPL AM1 INCITS 476/AM1 2012"); break; case 0x20AA: scsiOneValue.Add("Device complies with SPL ISO/IEC 14776-261:2012"); @@ -1696,12 +1697,14 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device complies with IEEE 1667-2009"); break; default: - scsiOneValue.Add(string.Format("Device complies with unknown standard code 0x{0:X4}", VersionDescriptor)); + scsiOneValue.Add(string.Format("Device complies with unknown standard code 0x{0:X4}", + VersionDescriptor)); break; } } } + return scsiOneValue; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs b/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs index ad5a3849..1b51e253 100644 --- a/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs +++ b/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs @@ -42,142 +42,85 @@ namespace DiscImageChef.Server.App_Start { if(ftr.SupportsAACS && ftr.AACSVersionSpecified) mmcOneValue.Add(string.Format("Drive supports AACS version {0}", ftr.AACSVersion)); - else if(ftr.SupportsAACS) - mmcOneValue.Add("Drive supports AACS"); - if(ftr.AGIDsSpecified) - mmcOneValue.Add(string.Format("Drive supports {0} AGIDs concurrently", ftr.AGIDs)); + else if(ftr.SupportsAACS) mmcOneValue.Add("Drive supports AACS"); + if(ftr.AGIDsSpecified) mmcOneValue.Add(string.Format("Drive supports {0} AGIDs concurrently", ftr.AGIDs)); if(ftr.CanGenerateBindingNonce) { mmcOneValue.Add("Drive supports generating the binding nonce"); if(ftr.BindingNonceBlocksSpecified) - mmcOneValue.Add(string.Format("{0} media blocks are required for the binding nonce", ftr.BindingNonceBlocks)); + mmcOneValue.Add(string.Format("{0} media blocks are required for the binding nonce", + ftr.BindingNonceBlocks)); } if(ftr.BlocksPerReadableUnit > 1) mmcOneValue.Add(string.Format("{0} logical blocks per media writable unit", ftr.BlocksPerReadableUnit)); - if(ftr.BufferUnderrunFreeInDVD) - mmcOneValue.Add("Drive supports zero loss linking writing DVDs"); - if(ftr.BufferUnderrunFreeInSAO) - mmcOneValue.Add("Drive supports zero loss linking in Session at Once Mode"); - if(ftr.BufferUnderrunFreeInTAO) - mmcOneValue.Add("Drive supports zero loss linking in Track at Once Mode"); - if(ftr.CanAudioScan) - mmcOneValue.Add("Drive supports the SCAN command"); - if(ftr.CanEject) - mmcOneValue.Add("Drive can eject media"); - if(ftr.CanEraseSector) - mmcOneValue.Add("Drive supports media that require erasing before writing"); - if(ftr.CanExpandBDRESpareArea) - mmcOneValue.Add("Drive can expand the spare area on a formatted BD-RE disc"); - if(ftr.CanFormat) - mmcOneValue.Add("Drive can format media into logical blocks"); - if(ftr.CanFormatBDREWithoutSpare) - mmcOneValue.Add("Drive can format BD-RE with no spares allocated"); - if(ftr.CanFormatQCert) - mmcOneValue.Add("Drive can format BD-RE discs with quick certification"); - if(ftr.CanFormatCert) - mmcOneValue.Add("Drive can format BD-RE discs with full certification"); - if(ftr.CanFormatFRF) - mmcOneValue.Add("Drive can fast re-format BD-RE discs"); - if(ftr.CanFormatRRM) - mmcOneValue.Add("Drive can format BD-R discs with RRM format"); - if(ftr.CanLoad) - mmcOneValue.Add("Drive can load media"); - if(ftr.CanMuteSeparateChannels) - mmcOneValue.Add("Drive is able to mute channels separately"); - if(ftr.CanOverwriteSAOTrack) - mmcOneValue.Add("Drive can overwrite a SAO track with another in CD-RWs"); - if(ftr.CanOverwriteTAOTrack) - mmcOneValue.Add("Drive can overwrite a TAO track with another in CD-RWs"); - if(ftr.CanPlayCDAudio) - mmcOneValue.Add("Drive has an analogue audio output"); - if(ftr.CanPseudoOverwriteBDR) - mmcOneValue.Add("Drive can write BD-R on Pseudo-OVerwrite SRM mode"); - if(ftr.CanReadAllDualR) - mmcOneValue.Add("Drive can read DVD-R DL from all recording modes"); - if(ftr.CanReadAllDualRW) - mmcOneValue.Add("Drive can read DVD-RW DL from all recording modes"); - if(ftr.CanReadBD) - mmcOneValue.Add("Drive can read BD-ROM"); - if(ftr.CanReadBDR) - mmcOneValue.Add("Drive can read BD-R Ver.1"); - if(ftr.CanReadBDRE1) - mmcOneValue.Add("Drive can read BD-RE Ver.1"); - if(ftr.CanReadBDRE2) - mmcOneValue.Add("Drive can read BD-RE Ver.2"); - if(ftr.CanReadBDROM) - mmcOneValue.Add("Drive can read BD-ROM Ver.1"); - if(ftr.CanReadBluBCA) - mmcOneValue.Add("Drive can read BD's Burst Cutting Area"); - if(ftr.CanReadCD) - mmcOneValue.Add("Drive can read CD-ROM"); + if(ftr.BufferUnderrunFreeInDVD) mmcOneValue.Add("Drive supports zero loss linking writing DVDs"); + if(ftr.BufferUnderrunFreeInSAO) mmcOneValue.Add("Drive supports zero loss linking in Session at Once Mode"); + if(ftr.BufferUnderrunFreeInTAO) mmcOneValue.Add("Drive supports zero loss linking in Track at Once Mode"); + if(ftr.CanAudioScan) mmcOneValue.Add("Drive supports the SCAN command"); + if(ftr.CanEject) mmcOneValue.Add("Drive can eject media"); + if(ftr.CanEraseSector) mmcOneValue.Add("Drive supports media that require erasing before writing"); + if(ftr.CanExpandBDRESpareArea) mmcOneValue.Add("Drive can expand the spare area on a formatted BD-RE disc"); + if(ftr.CanFormat) mmcOneValue.Add("Drive can format media into logical blocks"); + if(ftr.CanFormatBDREWithoutSpare) mmcOneValue.Add("Drive can format BD-RE with no spares allocated"); + if(ftr.CanFormatQCert) mmcOneValue.Add("Drive can format BD-RE discs with quick certification"); + if(ftr.CanFormatCert) mmcOneValue.Add("Drive can format BD-RE discs with full certification"); + if(ftr.CanFormatFRF) mmcOneValue.Add("Drive can fast re-format BD-RE discs"); + if(ftr.CanFormatRRM) mmcOneValue.Add("Drive can format BD-R discs with RRM format"); + if(ftr.CanLoad) mmcOneValue.Add("Drive can load media"); + if(ftr.CanMuteSeparateChannels) mmcOneValue.Add("Drive is able to mute channels separately"); + if(ftr.CanOverwriteSAOTrack) mmcOneValue.Add("Drive can overwrite a SAO track with another in CD-RWs"); + if(ftr.CanOverwriteTAOTrack) mmcOneValue.Add("Drive can overwrite a TAO track with another in CD-RWs"); + if(ftr.CanPlayCDAudio) mmcOneValue.Add("Drive has an analogue audio output"); + if(ftr.CanPseudoOverwriteBDR) mmcOneValue.Add("Drive can write BD-R on Pseudo-OVerwrite SRM mode"); + if(ftr.CanReadAllDualR) mmcOneValue.Add("Drive can read DVD-R DL from all recording modes"); + if(ftr.CanReadAllDualRW) mmcOneValue.Add("Drive can read DVD-RW DL from all recording modes"); + if(ftr.CanReadBD) mmcOneValue.Add("Drive can read BD-ROM"); + if(ftr.CanReadBDR) mmcOneValue.Add("Drive can read BD-R Ver.1"); + if(ftr.CanReadBDRE1) mmcOneValue.Add("Drive can read BD-RE Ver.1"); + if(ftr.CanReadBDRE2) mmcOneValue.Add("Drive can read BD-RE Ver.2"); + if(ftr.CanReadBDROM) mmcOneValue.Add("Drive can read BD-ROM Ver.1"); + if(ftr.CanReadBluBCA) mmcOneValue.Add("Drive can read BD's Burst Cutting Area"); + if(ftr.CanReadCD) mmcOneValue.Add("Drive can read CD-ROM"); if(ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW) mmcOneValue.Add("Drive can read and write CD-MRW and DVD+MRW"); else if(ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW) mmcOneValue.Add("Drive can read and write DVD+MRW"); else if(ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW) mmcOneValue.Add("Drive and read DVD+MRW and read and write CD-MRW"); - else if(ftr.CanWriteCDMRW) - mmcOneValue.Add("Drive can read and write CD-MRW"); - else if(ftr.CanReadDVDPlusMRW) - mmcOneValue.Add("Drive can read CD-MRW and DVD+MRW"); - else if(ftr.CanReadCDMRW) - mmcOneValue.Add("Drive can read CD-MRW"); - if(ftr.CanReadCPRM_MKB) - mmcOneValue.Add("Drive supports reading Media Key Block of CPRM"); - if(ftr.CanReadDDCD) - mmcOneValue.Add("Drive can read DDCDs"); - if(ftr.CanReadDVD) - mmcOneValue.Add("Drive can read DVD"); - if(ftr.CanWriteDVDPlusRW) - mmcOneValue.Add("Drive can read and write DVD+RW"); - else if(ftr.CanReadDVDPlusRW) - mmcOneValue.Add("Drive can read DVD+RW"); - if(ftr.CanWriteDVDPlusR) - mmcOneValue.Add("Drive can read and write DVD+R"); - else if(ftr.CanReadDVDPlusR) - mmcOneValue.Add("Drive can read DVD+R"); - if(ftr.CanWriteDVDPlusRDL) - mmcOneValue.Add("Drive can read and write DVD+R DL"); - else if(ftr.CanReadDVDPlusRDL) - mmcOneValue.Add("Drive can read DVD+R DL"); - if(ftr.CanReadDriveAACSCertificate) - mmcOneValue.Add("Drive supports reading the Drive Certificate"); + else if(ftr.CanWriteCDMRW) mmcOneValue.Add("Drive can read and write CD-MRW"); + else if(ftr.CanReadDVDPlusMRW) mmcOneValue.Add("Drive can read CD-MRW and DVD+MRW"); + else if(ftr.CanReadCDMRW) mmcOneValue.Add("Drive can read CD-MRW"); + if(ftr.CanReadCPRM_MKB) mmcOneValue.Add("Drive supports reading Media Key Block of CPRM"); + if(ftr.CanReadDDCD) mmcOneValue.Add("Drive can read DDCDs"); + if(ftr.CanReadDVD) mmcOneValue.Add("Drive can read DVD"); + if(ftr.CanWriteDVDPlusRW) mmcOneValue.Add("Drive can read and write DVD+RW"); + else if(ftr.CanReadDVDPlusRW) mmcOneValue.Add("Drive can read DVD+RW"); + if(ftr.CanWriteDVDPlusR) mmcOneValue.Add("Drive can read and write DVD+R"); + else if(ftr.CanReadDVDPlusR) mmcOneValue.Add("Drive can read DVD+R"); + if(ftr.CanWriteDVDPlusRDL) mmcOneValue.Add("Drive can read and write DVD+R DL"); + else if(ftr.CanReadDVDPlusRDL) mmcOneValue.Add("Drive can read DVD+R DL"); + if(ftr.CanReadDriveAACSCertificate) mmcOneValue.Add("Drive supports reading the Drive Certificate"); if(ftr.CanReadHDDVD && ftr.CanReadHDDVDR && ftr.CanReadHDDVDRAM) mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW, HD DVD-R and HD DVD-RAM"); else if(ftr.CanReadHDDVD && ftr.CanReadHDDVDR) mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-R"); else if(ftr.CanReadHDDVD && ftr.CanReadHDDVDRAM) mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-RAM"); - else if(ftr.CanReadHDDVD) - mmcOneValue.Add("Drive can read HD DVD-ROM and HD DVD-RW"); - if(ftr.CanReadLeadInCDText) - mmcOneValue.Add("Drive can return CD-Text from Lead-In"); - if(ftr.CanReadOldBDR) - mmcOneValue.Add("Drive can read BD-R pre-1.0"); - if(ftr.CanReadOldBDRE) - mmcOneValue.Add("Drive can read BD-RE pre-1.0"); - if(ftr.CanReadOldBDROM) - mmcOneValue.Add("Drive can read BD-ROM pre-1.0"); - if(ftr.CanReadSpareAreaInformation) - mmcOneValue.Add("Drive can return Spare Area Information"); - if(ftr.CanReportDriveSerial) - mmcOneValue.Add("Drive is to report drive serial number"); - if(ftr.CanReportMediaSerial) - mmcOneValue.Add("Drive is to read media serial number"); - if(ftr.CanTestWriteDDCDR) - mmcOneValue.Add("Drive can do a test writing with DDCD-R"); - if(ftr.CanTestWriteDVD) - mmcOneValue.Add("Drive can do a test writing with DVDs"); - if(ftr.CanTestWriteInSAO) - mmcOneValue.Add("Drive can do a test writing in Session at Once Mode"); - if(ftr.CanTestWriteInTAO) - mmcOneValue.Add("Drive can do a test writing in Track at Once Mode"); - if(ftr.CanUpgradeFirmware) - mmcOneValue.Add("Drive supports Microcode Upgrade"); - if(ftr.ErrorRecoveryPage) - mmcOneValue.Add("Drive shall report Read/Write Error Recovery mode page"); - if(ftr.Locked) - mmcOneValue.Add("Drive can lock media"); + else if(ftr.CanReadHDDVD) mmcOneValue.Add("Drive can read HD DVD-ROM and HD DVD-RW"); + if(ftr.CanReadLeadInCDText) mmcOneValue.Add("Drive can return CD-Text from Lead-In"); + if(ftr.CanReadOldBDR) mmcOneValue.Add("Drive can read BD-R pre-1.0"); + if(ftr.CanReadOldBDRE) mmcOneValue.Add("Drive can read BD-RE pre-1.0"); + if(ftr.CanReadOldBDROM) mmcOneValue.Add("Drive can read BD-ROM pre-1.0"); + if(ftr.CanReadSpareAreaInformation) mmcOneValue.Add("Drive can return Spare Area Information"); + if(ftr.CanReportDriveSerial) mmcOneValue.Add("Drive is to report drive serial number"); + if(ftr.CanReportMediaSerial) mmcOneValue.Add("Drive is to read media serial number"); + if(ftr.CanTestWriteDDCDR) mmcOneValue.Add("Drive can do a test writing with DDCD-R"); + if(ftr.CanTestWriteDVD) mmcOneValue.Add("Drive can do a test writing with DVDs"); + if(ftr.CanTestWriteInSAO) mmcOneValue.Add("Drive can do a test writing in Session at Once Mode"); + if(ftr.CanTestWriteInTAO) mmcOneValue.Add("Drive can do a test writing in Track at Once Mode"); + if(ftr.CanUpgradeFirmware) mmcOneValue.Add("Drive supports Microcode Upgrade"); + if(ftr.ErrorRecoveryPage) mmcOneValue.Add("Drive shall report Read/Write Error Recovery mode page"); + if(ftr.Locked) mmcOneValue.Add("Drive can lock media"); if(ftr.LogicalBlockSize > 0) mmcOneValue.Add(string.Format("{0} bytes per logical block", ftr.LogicalBlockSize)); if(ftr.MultiRead) @@ -216,69 +159,47 @@ namespace DiscImageChef.Server.App_Start mmcOneValue.Add("Drive uses a vendor unique interface"); break; default: - mmcOneValue.Add(string.Format("Drive uses an unknown interface with code {0}", (uint)ftr.PhysicalInterfaceStandard)); + mmcOneValue.Add(string.Format("Drive uses an unknown interface with code {0}", + (uint)ftr.PhysicalInterfaceStandard)); break; } - if(ftr.PreventJumper) - mmcOneValue.Add("Drive power ups locked"); - if(ftr.SupportsBusEncryption) - mmcOneValue.Add("Drive supports bus encryption"); - if(ftr.CanWriteBD) - mmcOneValue.Add("Drive can write BD-R or BD-RE"); - if(ftr.CanWriteBDR) - mmcOneValue.Add("Drive can write BD-R Ver.1"); - if(ftr.CanWriteBDRE1) - mmcOneValue.Add("Drive can write BD-RE Ver.1"); - if(ftr.CanWriteBDRE2) - mmcOneValue.Add("Drive can write BD-RE Ver.2"); - if(ftr.CanWriteBusEncryptedBlocks) - mmcOneValue.Add("Drive supports writing with bus encryption"); - if(ftr.CanWriteCDRW) - mmcOneValue.Add("Drive can write CD-RW"); - if(ftr.CanWriteCDRWCAV) - mmcOneValue.Add("Drive can write High-Speed CD-RW"); - if(ftr.CanWriteCDSAO && !ftr.CanWriteRaw) - mmcOneValue.Add("Drive can write CDs in Session at Once Mode:"); - else if(!ftr.CanWriteCDSAO && ftr.CanWriteRaw) - mmcOneValue.Add("Drive can write CDs in raw Mode:"); + if(ftr.PreventJumper) mmcOneValue.Add("Drive power ups locked"); + if(ftr.SupportsBusEncryption) mmcOneValue.Add("Drive supports bus encryption"); + if(ftr.CanWriteBD) mmcOneValue.Add("Drive can write BD-R or BD-RE"); + if(ftr.CanWriteBDR) mmcOneValue.Add("Drive can write BD-R Ver.1"); + if(ftr.CanWriteBDRE1) mmcOneValue.Add("Drive can write BD-RE Ver.1"); + if(ftr.CanWriteBDRE2) mmcOneValue.Add("Drive can write BD-RE Ver.2"); + if(ftr.CanWriteBusEncryptedBlocks) mmcOneValue.Add("Drive supports writing with bus encryption"); + if(ftr.CanWriteCDRW) mmcOneValue.Add("Drive can write CD-RW"); + if(ftr.CanWriteCDRWCAV) mmcOneValue.Add("Drive can write High-Speed CD-RW"); + if(ftr.CanWriteCDSAO && !ftr.CanWriteRaw) mmcOneValue.Add("Drive can write CDs in Session at Once Mode:"); + else if(!ftr.CanWriteCDSAO && ftr.CanWriteRaw) mmcOneValue.Add("Drive can write CDs in raw Mode:"); else if(ftr.CanWriteCDSAO && ftr.CanWriteRaw) mmcOneValue.Add("Drive can write CDs in Session at Once and in Raw Modes:"); - if(ftr.CanWriteCDTAO) - mmcOneValue.Add("Drive can write CDs in Track at Once Mode:"); - if(ftr.CanWriteCSSManagedDVD) - mmcOneValue.Add("Drive can write CSS managed DVDs"); - if(ftr.CanWriteDDCDR) - mmcOneValue.Add("Drive supports writing DDCD-R"); - if(ftr.CanWriteDDCDRW) - mmcOneValue.Add("Drive supports writing DDCD-RW"); - if(ftr.CanWriteDVDPlusRWDL) - mmcOneValue.Add("Drive can read and write DVD+RW DL"); - else if(ftr.CanReadDVDPlusRWDL) - mmcOneValue.Add("Drive can read DVD+RW DL"); + if(ftr.CanWriteCDTAO) mmcOneValue.Add("Drive can write CDs in Track at Once Mode:"); + if(ftr.CanWriteCSSManagedDVD) mmcOneValue.Add("Drive can write CSS managed DVDs"); + if(ftr.CanWriteDDCDR) mmcOneValue.Add("Drive supports writing DDCD-R"); + if(ftr.CanWriteDDCDRW) mmcOneValue.Add("Drive supports writing DDCD-RW"); + if(ftr.CanWriteDVDPlusRWDL) mmcOneValue.Add("Drive can read and write DVD+RW DL"); + else if(ftr.CanReadDVDPlusRWDL) mmcOneValue.Add("Drive can read DVD+RW DL"); if(ftr.CanWriteDVDR && ftr.CanWriteDVDRW && ftr.CanWriteDVDRDL) mmcOneValue.Add("Drive supports writing DVD-R, DVD-RW and DVD-R DL"); else if(ftr.CanWriteDVDR && ftr.CanWriteDVDRDL) mmcOneValue.Add("Drive supports writing DVD-R and DVD-R DL"); - else if(ftr.CanWriteDVDR && ftr.CanWriteDVDRW) - mmcOneValue.Add("Drive supports writing DVD-R and DVD-RW"); - else if(ftr.CanWriteDVDR) - mmcOneValue.Add("Drive supports writing DVD-R"); + else if(ftr.CanWriteDVDR && ftr.CanWriteDVDRW) mmcOneValue.Add("Drive supports writing DVD-R and DVD-RW"); + else if(ftr.CanWriteDVDR) mmcOneValue.Add("Drive supports writing DVD-R"); if(ftr.CanWriteHDDVDR && ftr.CanWriteHDDVDRAM) mmcOneValue.Add("Drive can write HD DVD-RW, HD DVD-R and HD DVD-RAM"); - else if(ftr.CanWriteHDDVDR) - mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-R"); - else if(ftr.CanWriteHDDVDRAM) - mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-RAM"); + else if(ftr.CanWriteHDDVDR) mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-R"); + else if(ftr.CanWriteHDDVDRAM) mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-RAM"); // TODO: Write HD DVD-RW /* else mmcOneValue.Add("Drive can write HD DVD-RW"); */ - if(ftr.CanWriteOldBDR) - mmcOneValue.Add("Drive can write BD-R pre-1.0"); - if(ftr.CanWriteOldBDRE) - mmcOneValue.Add("Drive can write BD-RE pre-1.0"); + if(ftr.CanWriteOldBDR) mmcOneValue.Add("Drive can write BD-R pre-1.0"); + if(ftr.CanWriteOldBDRE) mmcOneValue.Add("Drive can write BD-RE pre-1.0"); if(ftr.CanWriteRWSubchannelInTAO) { mmcOneValue.Add("Drive can write user provided data in the R-W subchannels in Track at Once Mode"); @@ -295,8 +216,7 @@ namespace DiscImageChef.Server.App_Start { mmcOneValue.Add("Drive contains an embedded changer"); - if(ftr.ChangerIsSideChangeCapable) - mmcOneValue.Add("Drive can change disc side"); + if(ftr.ChangerIsSideChangeCapable) mmcOneValue.Add("Drive can change disc side"); if(ftr.ChangerSupportsDiscPresent) mmcOneValue.Add("Drive is able to report slots contents after a reset or change"); @@ -304,24 +224,17 @@ namespace DiscImageChef.Server.App_Start } if(ftr.SupportsCSS && ftr.CSSVersionSpecified) mmcOneValue.Add(string.Format("Drive supports DVD CSS/CPPM version {0}", ftr.CSSVersion)); - else if(ftr.SupportsCSS) - mmcOneValue.Add("Drive supports DVD CSS/CPRM"); + else if(ftr.SupportsCSS) mmcOneValue.Add("Drive supports DVD CSS/CPRM"); if(ftr.SupportsCPRM && ftr.CPRMVersionSpecified) mmcOneValue.Add(string.Format("Drive supports DVD CPPM version {0}", ftr.CPRMVersion)); - else if(ftr.SupportsCPRM) - mmcOneValue.Add("Drive supports DVD CPRM"); - if(ftr.DBML) - mmcOneValue.Add("Drive reports Device Busy Class events during medium loading/unloading"); - if(ftr.DVDMultiRead) - mmcOneValue.Add("Drive conforms to DVD Multi Drive Read-only Specifications"); + else if(ftr.SupportsCPRM) mmcOneValue.Add("Drive supports DVD CPRM"); + if(ftr.DBML) mmcOneValue.Add("Drive reports Device Busy Class events during medium loading/unloading"); + if(ftr.DVDMultiRead) mmcOneValue.Add("Drive conforms to DVD Multi Drive Read-only Specifications"); if(ftr.FirmwareDateSpecified) mmcOneValue.Add(string.Format("Drive firmware is dated {0}", ftr.FirmwareDate)); - if(ftr.SupportsC2) - mmcOneValue.Add("Drive supports C2 Error Pointers"); - if(ftr.SupportsDAP) - mmcOneValue.Add("Drive supports the DAP bit in the READ CD and READ CD MSF commands"); - if(ftr.SupportsDeviceBusyEvent) - mmcOneValue.Add("Drive supports Device Busy events"); + if(ftr.SupportsC2) mmcOneValue.Add("Drive supports C2 Error Pointers"); + if(ftr.SupportsDAP) mmcOneValue.Add("Drive supports the DAP bit in the READ CD and READ CD MSF commands"); + if(ftr.SupportsDeviceBusyEvent) mmcOneValue.Add("Drive supports Device Busy events"); switch(ftr.LoadingMechanismType) { @@ -341,26 +254,21 @@ namespace DiscImageChef.Server.App_Start mmcOneValue.Add("Drive is a changer using cartridges"); break; default: - mmcOneValue.Add(string.Format("Drive uses unknown loading mechanism type {0}", ftr.LoadingMechanismType)); + mmcOneValue.Add(string.Format("Drive uses unknown loading mechanism type {0}", + ftr.LoadingMechanismType)); break; } - if(ftr.SupportsHybridDiscs) - mmcOneValue.Add("Drive is able to access Hybrid discs"); + if(ftr.SupportsHybridDiscs) mmcOneValue.Add("Drive is able to access Hybrid discs"); if(ftr.SupportsModePage1Ch) mmcOneValue.Add("Drive supports the Informational Exceptions Control mode page 1Ch"); if(ftr.SupportsOSSC) mmcOneValue.Add("Drive supports the Trusted Computing Group Optical Security Subsystem Class"); - if(ftr.SupportsPWP) - mmcOneValue.Add("Drive supports set/release of PWP status"); - if(ftr.SupportsSWPP) - mmcOneValue.Add("Drive supports the SWPP bit of the Timeout and Protect mode page"); - if(ftr.SupportsSecurDisc) - mmcOneValue.Add("Drive supports SecurDisc"); - if(ftr.SupportsSeparateVolume) - mmcOneValue.Add("Drive supports separate volume per channel"); - if(ftr.SupportsVCPS) - mmcOneValue.Add("Drive supports VCPS"); + if(ftr.SupportsPWP) mmcOneValue.Add("Drive supports set/release of PWP status"); + if(ftr.SupportsSWPP) mmcOneValue.Add("Drive supports the SWPP bit of the Timeout and Protect mode page"); + if(ftr.SupportsSecurDisc) mmcOneValue.Add("Drive supports SecurDisc"); + if(ftr.SupportsSeparateVolume) mmcOneValue.Add("Drive supports separate volume per channel"); + if(ftr.SupportsVCPS) mmcOneValue.Add("Drive supports VCPS"); if(ftr.VolumeLevelsSpecified) mmcOneValue.Add(string.Format("Drive has {0} volume levels", ftr.VolumeLevels + 1)); if(ftr.SupportsWriteProtectPAC) @@ -372,4 +280,4 @@ namespace DiscImageChef.Server.App_Start mmcOneValue.Add(""); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/App_Start/ScsiMmcMode.cs b/DiscImageChef.Server/App_Start/ScsiMmcMode.cs index 7248a167..0120ffea 100644 --- a/DiscImageChef.Server/App_Start/ScsiMmcMode.cs +++ b/DiscImageChef.Server/App_Start/ScsiMmcMode.cs @@ -39,29 +39,19 @@ namespace DiscImageChef.Server.App_Start { public static void Report(mmcModeType mode, ref List<string> mmcOneValue) { - if(mode.PlaysAudio) - mmcOneValue.Add("Drive can play audio"); - if(mode.ReadsMode2Form1) - mmcOneValue.Add("Drive can read sectors in Mode 2 Form 1 format"); - if(mode.ReadsMode2Form2) - mmcOneValue.Add("Drive can read sectors in Mode 2 Form 2 format"); - if(mode.SupportsMultiSession) - mmcOneValue.Add("Drive supports multi-session discs and/or Photo-CD"); + if(mode.PlaysAudio) mmcOneValue.Add("Drive can play audio"); + if(mode.ReadsMode2Form1) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 1 format"); + if(mode.ReadsMode2Form2) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 2 format"); + if(mode.SupportsMultiSession) mmcOneValue.Add("Drive supports multi-session discs and/or Photo-CD"); - if(mode.CDDACommand) - mmcOneValue.Add("Drive can read digital audio"); - if(mode.AccurateCDDA) - mmcOneValue.Add("Drive can continue from streaming loss"); - if(mode.ReadsSubchannel) - mmcOneValue.Add("Drive can read uncorrected and interleaved R-W subchannels"); + if(mode.CDDACommand) mmcOneValue.Add("Drive can read digital audio"); + if(mode.AccurateCDDA) mmcOneValue.Add("Drive can continue from streaming loss"); + if(mode.ReadsSubchannel) mmcOneValue.Add("Drive can read uncorrected and interleaved R-W subchannels"); if(mode.ReadsDeinterlavedSubchannel) mmcOneValue.Add("Drive can read, deinterleave and correct R-W subchannels"); - if(mode.ReturnsC2Pointers) - mmcOneValue.Add("Drive supports C2 pointers"); - if(mode.ReadsUPC) - mmcOneValue.Add("Drive can read Media Catalogue Number"); - if(mode.ReadsISRC) - mmcOneValue.Add("Drive can read ISRC"); + if(mode.ReturnsC2Pointers) mmcOneValue.Add("Drive supports C2 pointers"); + if(mode.ReadsUPC) mmcOneValue.Add("Drive can read Media Catalogue Number"); + if(mode.ReadsISRC) mmcOneValue.Add("Drive can read ISRC"); switch(mode.LoadingMechanismType) { @@ -81,39 +71,32 @@ namespace DiscImageChef.Server.App_Start mmcOneValue.Add("Drive is a changer using cartridges"); break; default: - mmcOneValue.Add(string.Format("Drive uses unknown loading mechanism type {0}", mode.LoadingMechanismType)); + mmcOneValue.Add(string.Format("Drive uses unknown loading mechanism type {0}", + mode.LoadingMechanismType)); break; } - if(mode.CanLockMedia) - mmcOneValue.Add("Drive can lock media"); + if(mode.CanLockMedia) mmcOneValue.Add("Drive can lock media"); if(mode.PreventJumperStatus) { mmcOneValue.Add("Drive power ups locked"); - if(mode.LockStatus) - mmcOneValue.Add("Drive is locked, media cannot be ejected or inserted"); - else - mmcOneValue.Add("Drive is not locked, media can be ejected and inserted"); + if(mode.LockStatus) mmcOneValue.Add("Drive is locked, media cannot be ejected or inserted"); + else mmcOneValue.Add("Drive is not locked, media can be ejected and inserted"); } else { if(mode.LockStatus) mmcOneValue.Add("Drive is locked, media cannot be ejected, but if empty, can be inserted"); - else - mmcOneValue.Add("Drive is not locked, media can be ejected and inserted"); + else mmcOneValue.Add("Drive is not locked, media can be ejected and inserted"); } - if(mode.CanEject) - mmcOneValue.Add("Drive can eject media"); + if(mode.CanEject) mmcOneValue.Add("Drive can eject media"); - if(mode.SeparateChannelMute) - mmcOneValue.Add("Each channel can be muted independently"); - if(mode.SeparateChannelVolume) - mmcOneValue.Add("Each channel's volume can be controlled independently"); + if(mode.SeparateChannelMute) mmcOneValue.Add("Each channel can be muted independently"); + if(mode.SeparateChannelVolume) mmcOneValue.Add("Each channel's volume can be controlled independently"); if(mode.SupportedVolumeLevels > 0) mmcOneValue.Add(string.Format("Drive supports {0} volume levels", mode.SupportedVolumeLevels)); - if(mode.BufferSize > 0) - mmcOneValue.Add(string.Format("Drive has {0} Kbyte of buffer", mode.BufferSize)); + if(mode.BufferSize > 0) mmcOneValue.Add(string.Format("Drive has {0} Kbyte of buffer", mode.BufferSize)); if(mode.MaximumSpeed > 0) mmcOneValue.Add(string.Format("Drive's maximum reading speed is {0} Kbyte/sec.", mode.MaximumSpeed)); if(mode.CurrentSpeed > 0) @@ -121,97 +104,86 @@ namespace DiscImageChef.Server.App_Start if(mode.ReadsCDR) { - if(mode.WritesCDR) - mmcOneValue.Add("Drive can read and write CD-R"); - else - mmcOneValue.Add("Drive can read CD-R"); + if(mode.WritesCDR) mmcOneValue.Add("Drive can read and write CD-R"); + else mmcOneValue.Add("Drive can read CD-R"); - if(mode.ReadsPacketCDR) - mmcOneValue.Add("Drive supports reading CD-R packet media"); + if(mode.ReadsPacketCDR) mmcOneValue.Add("Drive supports reading CD-R packet media"); } if(mode.ReadsCDRW) { - if(mode.WritesCDRW) - mmcOneValue.Add("Drive can read and write CD-RW"); - else - mmcOneValue.Add("Drive can read CD-RW"); + if(mode.WritesCDRW) mmcOneValue.Add("Drive can read and write CD-RW"); + else mmcOneValue.Add("Drive can read CD-RW"); } - if(mode.ReadsDVDROM) - mmcOneValue.Add("Drive can read DVD-ROM"); + if(mode.ReadsDVDROM) mmcOneValue.Add("Drive can read DVD-ROM"); if(mode.ReadsDVDR) { - if(mode.WritesDVDR) - mmcOneValue.Add("Drive can read and write DVD-R"); - else - mmcOneValue.Add("Drive can read DVD-R"); + if(mode.WritesDVDR) mmcOneValue.Add("Drive can read and write DVD-R"); + else mmcOneValue.Add("Drive can read DVD-R"); } if(mode.ReadsDVDRAM) { - if(mode.WritesDVDRAM) - mmcOneValue.Add("Drive can read and write DVD-RAM"); - else - mmcOneValue.Add("Drive can read DVD-RAM"); + if(mode.WritesDVDRAM) mmcOneValue.Add("Drive can read and write DVD-RAM"); + else mmcOneValue.Add("Drive can read DVD-RAM"); } - if(mode.CompositeAudioVideo) - mmcOneValue.Add("Drive can deliver a composite audio and video data stream"); - if(mode.DigitalPort1) - mmcOneValue.Add("Drive supports IEC-958 digital output on port 1"); - if(mode.DigitalPort2) - mmcOneValue.Add("Drive supports IEC-958 digital output on port 2"); + if(mode.CompositeAudioVideo) mmcOneValue.Add("Drive can deliver a composite audio and video data stream"); + if(mode.DigitalPort1) mmcOneValue.Add("Drive supports IEC-958 digital output on port 1"); + if(mode.DigitalPort2) mmcOneValue.Add("Drive supports IEC-958 digital output on port 2"); if(mode.DeterministicSlotChanger) mmcOneValue.Add("Drive contains a changer that can report the exact contents of the slots"); if(mode.CurrentWriteSpeedSelected > 0) { if(mode.RotationControlSelected == 0) - mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec. in CLV mode", mode.CurrentWriteSpeedSelected)); + mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec. in CLV mode", + mode.CurrentWriteSpeedSelected)); else if(mode.RotationControlSelected == 1) - mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec. in pure CAV mode", mode.CurrentWriteSpeedSelected)); + mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec. in pure CAV mode", + mode.CurrentWriteSpeedSelected)); } else { if(mode.MaximumWriteSpeed > 0) - mmcOneValue.Add(string.Format("Drive's maximum writing speed is {0} Kbyte/sec.", mode.MaximumWriteSpeed)); + mmcOneValue.Add(string.Format("Drive's maximum writing speed is {0} Kbyte/sec.", + mode.MaximumWriteSpeed)); if(mode.CurrentWriteSpeed > 0) - mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec.", mode.CurrentWriteSpeed)); + mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec.", + mode.CurrentWriteSpeed)); } if(mode.WriteSpeedPerformanceDescriptors != null) { - foreach(Decoders.SCSI.Modes.ModePage_2A_WriteDescriptor descriptor in mode.WriteSpeedPerformanceDescriptors) + foreach(Decoders.SCSI.Modes.ModePage_2A_WriteDescriptor descriptor in + mode.WriteSpeedPerformanceDescriptors) { if(descriptor.WriteSpeed > 0) { if(descriptor.RotationControl == 0) - mmcOneValue.Add(string.Format("Drive supports writing at {0} Kbyte/sec. in CLV mode", descriptor.WriteSpeed)); + mmcOneValue.Add(string.Format("Drive supports writing at {0} Kbyte/sec. in CLV mode", + descriptor.WriteSpeed)); else if(descriptor.RotationControl == 1) - mmcOneValue.Add(string.Format("Drive supports writing at is {0} Kbyte/sec. in pure CAV mode", descriptor.WriteSpeed)); + mmcOneValue + .Add(string.Format("Drive supports writing at is {0} Kbyte/sec. in pure CAV mode", + descriptor.WriteSpeed)); } } } - if(mode.TestWrite) - mmcOneValue.Add("Drive supports test writing"); + if(mode.TestWrite) mmcOneValue.Add("Drive supports test writing"); - if(mode.ReadsBarcode) - mmcOneValue.Add("Drive can read barcode"); + if(mode.ReadsBarcode) mmcOneValue.Add("Drive can read barcode"); - if(mode.ReadsBothSides) - mmcOneValue.Add("Drive can read both sides of a disc"); - if(mode.LeadInPW) - mmcOneValue.Add("Drive an read raw R-W subchannel from the Lead-In"); + if(mode.ReadsBothSides) mmcOneValue.Add("Drive can read both sides of a disc"); + if(mode.LeadInPW) mmcOneValue.Add("Drive an read raw R-W subchannel from the Lead-In"); - if(mode.CSSandCPPMSupported) - mmcOneValue.Add("Drive supports DVD CSS and/or DVD CPPM"); + if(mode.CSSandCPPMSupported) mmcOneValue.Add("Drive supports DVD CSS and/or DVD CPPM"); - if(mode.BufferUnderRunProtection) - mmcOneValue.Add("Drive supports buffer under-run free recording"); + if(mode.BufferUnderRunProtection) mmcOneValue.Add("Drive supports buffer under-run free recording"); mmcOneValue.Sort(); mmcOneValue.Add(""); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/App_Start/ScsiModeSense.cs b/DiscImageChef.Server/App_Start/ScsiModeSense.cs index 9d9b509f..45aa18bc 100644 --- a/DiscImageChef.Server/App_Start/ScsiModeSense.cs +++ b/DiscImageChef.Server/App_Start/ScsiModeSense.cs @@ -38,12 +38,12 @@ namespace DiscImageChef.Server.App_Start { public static class ScsiModeSense { - public static void Report(modeType modeSense, string vendor, PeripheralDeviceTypes deviceType, ref List<string> scsiOneValue, ref Dictionary<string, string> modePages) + public static void Report(modeType modeSense, string vendor, PeripheralDeviceTypes deviceType, + ref List<string> scsiOneValue, ref Dictionary<string, string> modePages) { if(modeSense.MediumTypeSpecified) scsiOneValue.Add(string.Format("Medium type is {0:X2}h", modeSense.MediumType)); - if(modeSense.WriteProtected) - scsiOneValue.Add("Device is write protected."); + if(modeSense.WriteProtected) scsiOneValue.Add("Device is write protected."); if(modeSense.BlockDescriptors != null) { foreach(blockDescriptorType descriptor in modeSense.BlockDescriptors) @@ -51,14 +51,12 @@ namespace DiscImageChef.Server.App_Start if(descriptor.BlocksSpecified && descriptor.BlockLengthSpecified) scsiOneValue.Add(string.Format("Density code {0:X2}h has {1} blocks of {2} bytes each", descriptor.Density, descriptor.Blocks, descriptor.BlockLength)); - else - scsiOneValue.Add(string.Format("Density code {0:X2}h", descriptor.Density)); + else scsiOneValue.Add(string.Format("Density code {0:X2}h", descriptor.Density)); } } - if(modeSense.DPOandFUA) - scsiOneValue.Add("Drive supports DPO and FUA bits"); - if(modeSense.BlankCheckEnabled) - scsiOneValue.Add("Blank checking during write is enabled"); + + if(modeSense.DPOandFUA) scsiOneValue.Add("Drive supports DPO and FUA bits"); + if(modeSense.BlankCheckEnabled) scsiOneValue.Add("Blank checking during write is enabled"); if(modeSense.BufferedModeSpecified) { switch(modeSense.BufferedMode) @@ -85,327 +83,340 @@ namespace DiscImageChef.Server.App_Start switch(page.page) { case 0x00: + { + if(deviceType == PeripheralDeviceTypes.MultiMediaDevice && page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_00_SFF(page.value)); + else { - if(deviceType == PeripheralDeviceTypes.MultiMediaDevice && page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_00_SFF(page.value)); + if(page.subpage != 0) + modePages + .Add(string.Format("MODE page {0:X2}h subpage {1:X2}h", page.page, page.subpage), + "Unknown vendor mode page"); else - { - if(page.subpage != 0) - modePages.Add(string.Format("MODE page {0:X2}h subpage {1:X2}h", page.page, page.subpage), "Unknown vendor mode page"); - else - modePages.Add(string.Format("MODE page {0:X2}h", page.page), "Unknown vendor mode page"); - } - break; + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + "Unknown vendor mode page"); } + break; + } case 0x01: + { + if(page.subpage == 0) { - if(page.subpage == 0) - { - if(deviceType == PeripheralDeviceTypes.MultiMediaDevice) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_01_MMC(page.value)); - else - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_01(page.value)); - } + if(deviceType == PeripheralDeviceTypes.MultiMediaDevice) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_01_MMC(page.value)); else - goto default; - - break; + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_01(page.value)); } + else goto default; + + break; + } case 0x02: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_02(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_02(page.value)); + else goto default; - break; - } + break; + } case 0x03: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_03(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_03(page.value)); + else goto default; - break; - } + break; + } case 0x04: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_04(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_04(page.value)); + else goto default; - break; - } + break; + } case 0x05: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_05(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_05(page.value)); + else goto default; - break; - } + break; + } case 0x06: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_06(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_06(page.value)); + else goto default; - break; - } + break; + } case 0x07: + { + if(page.subpage == 0) { - if(page.subpage == 0) - { - if(deviceType == PeripheralDeviceTypes.MultiMediaDevice) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_07_MMC(page.value)); - else - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_07(page.value)); - } + if(deviceType == PeripheralDeviceTypes.MultiMediaDevice) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_07_MMC(page.value)); else - goto default; - - break; + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_07(page.value)); } + else goto default; + + break; + } case 0x08: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_08(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_08(page.value)); + else goto default; - break; - } + break; + } case 0x0A: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_0A(page.value)); - else if(page.subpage == 1) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_0A_S01(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_0A(page.value)); + else if(page.subpage == 1) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_0A_S01(page.value)); + else goto default; - break; - } + break; + } case 0x0B: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_0B(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_0B(page.value)); + else goto default; - break; - } + break; + } case 0x0D: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_0D(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_0D(page.value)); + else goto default; - break; - } + break; + } case 0x0E: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_0E(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_0E(page.value)); + else goto default; - break; - } + break; + } case 0x0F: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_0F(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_0F(page.value)); + else goto default; - break; - } + break; + } case 0x10: + { + if(page.subpage == 0) { - if(page.subpage == 0) - { - if(deviceType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_10_SSC(page.value)); - else - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_10(page.value)); - } + if(deviceType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_10_SSC(page.value)); else - goto default; - - break; + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_10(page.value)); } + else goto default; + + break; + } case 0x11: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_11(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_11(page.value)); + else goto default; - break; - } + break; + } case 0x12: case 0x13: case 0x14: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_12_13_14(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_12_13_14(page.value)); + else goto default; - break; - } + break; + } case 0x1A: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_1A(page.value)); - else if(page.subpage == 1) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_1A_S01(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_1A(page.value)); + else if(page.subpage == 1) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_1A_S01(page.value)); + else goto default; - break; - } + break; + } case 0x1B: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_1B(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_1B(page.value)); + else goto default; - break; - } + break; + } case 0x1C: + { + if(page.subpage == 0) { - if(page.subpage == 0) - { - if(deviceType == PeripheralDeviceTypes.MultiMediaDevice) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_1C_SFF(page.value)); - else - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_1C(page.value)); - } - else if(page.subpage == 1) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_1C_S01(page.value)); + if(deviceType == PeripheralDeviceTypes.MultiMediaDevice) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_1C_SFF(page.value)); else - goto default; - - break; + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_1C(page.value)); } + else if(page.subpage == 1) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_1C_S01(page.value)); + else goto default; + + break; + } case 0x1D: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_1D(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_1D(page.value)); + else goto default; - break; - } + break; + } case 0x21: - { - if(vendor == "CERTANCE") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyCertanceModePage_21(page.value)); - else - goto default; + { + if(vendor == "CERTANCE") + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyCertanceModePage_21(page.value)); + else goto default; - break; - } + break; + } case 0x22: - { - if(vendor == "CERTANCE") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyCertanceModePage_22(page.value)); - else - goto default; + { + if(vendor == "CERTANCE") + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyCertanceModePage_22(page.value)); + else goto default; - break; - } + break; + } case 0x24: - { - if(vendor == "IBM") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyIBMModePage_24(page.value)); - else - goto default; + { + if(vendor == "IBM") + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyIBMModePage_24(page.value)); + else goto default; - break; - } + break; + } case 0x2A: - { - if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_2A(page.value)); - else - goto default; + { + if(page.subpage == 0) + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyModePage_2A(page.value)); + else goto default; - break; - } + break; + } case 0x2F: - { - if(vendor == "IBM") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyIBMModePage_2F(page.value)); - else - goto default; + { + if(vendor == "IBM") + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyIBMModePage_2F(page.value)); + else goto default; - break; - } + break; + } case 0x30: - { - if(Modes.IsAppleModePage_30(page.value)) - modePages.Add("MODE page 30h", "Drive identifies as an Apple OEM drive"); - else - goto default; + { + if(Modes.IsAppleModePage_30(page.value)) + modePages.Add("MODE page 30h", "Drive identifies as an Apple OEM drive"); + else goto default; - break; - } + break; + } case 0x3B: - { - if(vendor == "HP") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyHPModePage_3B(page.value)); - else - goto default; + { + if(vendor == "HP") + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyHPModePage_3B(page.value)); + else goto default; - break; - } + break; + } case 0x3C: - { - if(vendor == "HP") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyHPModePage_3C(page.value)); - else - goto default; + { + if(vendor == "HP") + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyHPModePage_3C(page.value)); + else goto default; - break; - } + break; + } case 0x3D: - { - if(vendor == "IBM") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyIBMModePage_3D(page.value)); - else if(vendor == "HP") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyHPModePage_3D(page.value)); - else - goto default; + { + if(vendor == "IBM") + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyIBMModePage_3D(page.value)); + else if(vendor == "HP") + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyHPModePage_3D(page.value)); + else goto default; - break; - } + break; + } case 0x3E: - { - if(vendor == "FUJITSU") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyFujitsuModePage_3E(page.value)); - else if(vendor == "HP") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyHPModePage_3E(page.value)); - else - goto default; + { + if(vendor == "FUJITSU") + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyFujitsuModePage_3E(page.value)); + else if(vendor == "HP") + modePages.Add(string.Format("MODE page {0:X2}h", page.page), + Modes.PrettifyHPModePage_3E(page.value)); + else goto default; - break; - } + break; + } default: - { - if(page.subpage != 0) - modePages.Add(string.Format("MODE page {0:X2}h subpage {1:X2}h", page.page, page.subpage), "Unknown mode page"); - else - modePages.Add(string.Format("MODE page {0:X2}h", page.page), "Unknown mode page"); - } + { + if(page.subpage != 0) + modePages + .Add(string.Format("MODE page {0:X2}h subpage {1:X2}h", page.page, page.subpage), + "Unknown mode page"); + else modePages.Add(string.Format("MODE page {0:X2}h", page.page), "Unknown mode page"); + } break; } } @@ -413,13 +424,12 @@ namespace DiscImageChef.Server.App_Start Dictionary<string, string> newModePages = new Dictionary<string, string>(); foreach(KeyValuePair<string, string> kvp in modePages) { - if(string.IsNullOrWhiteSpace(kvp.Value)) - newModePages.Add(kvp.Key, "Undecoded"); - else - newModePages.Add(kvp.Key, kvp.Value.Replace("\n", "<br/>")); + if(string.IsNullOrWhiteSpace(kvp.Value)) newModePages.Add(kvp.Key, "Undecoded"); + else newModePages.Add(kvp.Key, kvp.Value.Replace("\n", "<br/>")); } + modePages = newModePages; } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/App_Start/SscTestedMedia.cs b/DiscImageChef.Server/App_Start/SscTestedMedia.cs index 07268cad..4f8a59df 100644 --- a/DiscImageChef.Server/App_Start/SscTestedMedia.cs +++ b/DiscImageChef.Server/App_Start/SscTestedMedia.cs @@ -43,14 +43,14 @@ namespace DiscImageChef.Server.App_Start { if(!string.IsNullOrWhiteSpace(media.MediumTypeName)) { - mediaOneValue.Add(string.Format("<i>Information for medium named \"{0}\"</i>", media.MediumTypeName)); + mediaOneValue.Add(string.Format("<i>Information for medium named \"{0}\"</i>", + media.MediumTypeName)); if(media.MediumTypeSpecified) mediaOneValue.Add(string.Format("Medium type code: {0:X2}h", media.MediumType)); } else if(media.MediumTypeSpecified) mediaOneValue.Add(string.Format("<i>Information for medium type {0:X2}h</i>", media.MediumType)); - else - mediaOneValue.Add("<i>Information for unknown medium type</i>"); + else mediaOneValue.Add("<i>Information for unknown medium type</i>"); if(!string.IsNullOrWhiteSpace(media.Manufacturer)) mediaOneValue.Add(string.Format("Medium manufactured by: {0}", media.Manufacturer)); @@ -59,13 +59,11 @@ namespace DiscImageChef.Server.App_Start if(media.DensitySpecified) mediaOneValue.Add(string.Format("Medium has density code {0:X2}h", media.Density)); - if(media.CanReadMediaSerial) - mediaOneValue.Add("Drive can read medium serial number."); - if(media.MediaIsRecognized) - mediaOneValue.Add("DiscImageChef recognizes this medium."); + if(media.CanReadMediaSerial) mediaOneValue.Add("Drive can read medium serial number."); + if(media.MediaIsRecognized) mediaOneValue.Add("DiscImageChef recognizes this medium."); mediaOneValue.Add(""); } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/App_Start/TestedMedia.cs b/DiscImageChef.Server/App_Start/TestedMedia.cs index 0ada1bd4..7fd4d694 100644 --- a/DiscImageChef.Server/App_Start/TestedMedia.cs +++ b/DiscImageChef.Server/App_Start/TestedMedia.cs @@ -43,20 +43,19 @@ namespace DiscImageChef.Server.App_Start { if(!string.IsNullOrWhiteSpace(testedMedia.MediumTypeName)) { - mediaOneValue.Add(string.Format("<i>Information for medium named \"{0}\"</i>", testedMedia.MediumTypeName)); + mediaOneValue.Add(string.Format("<i>Information for medium named \"{0}\"</i>", + testedMedia.MediumTypeName)); if(testedMedia.MediumTypeSpecified) mediaOneValue.Add(string.Format("Medium type code: {0:X2}h", testedMedia.MediumType)); } else if(testedMedia.MediumTypeSpecified) - mediaOneValue.Add(string.Format("<i>Information for medium type {0:X2}h</i>", testedMedia.MediumType)); - else - mediaOneValue.Add("<i>Information for unknown medium type</i>"); + mediaOneValue.Add(string.Format("<i>Information for medium type {0:X2}h</i>", + testedMedia.MediumType)); + else mediaOneValue.Add("<i>Information for unknown medium type</i>"); + + if(testedMedia.MediaIsRecognized) mediaOneValue.Add("Drive recognizes this medium."); + else mediaOneValue.Add("Drive does not recognize this medium."); - if(testedMedia.MediaIsRecognized) - mediaOneValue.Add("Drive recognizes this medium."); - else - mediaOneValue.Add("Drive does not recognize this medium."); - if(!string.IsNullOrWhiteSpace(testedMedia.Manufacturer)) mediaOneValue.Add(string.Format("Medium manufactured by: {0}", testedMedia.Manufacturer)); if(!string.IsNullOrWhiteSpace(testedMedia.Model)) @@ -73,35 +72,55 @@ namespace DiscImageChef.Server.App_Start if(testedMedia.BlocksSpecified && testedMedia.BlockSizeSpecified) { - mediaOneValue.Add(string.Format("Medium has {0} blocks of {1} bytes each", testedMedia.Blocks, testedMedia.BlockSize)); + mediaOneValue.Add(string.Format("Medium has {0} blocks of {1} bytes each", testedMedia.Blocks, + testedMedia.BlockSize)); if(((testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024) > 1000000) { - mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Tb, {2:F2} TiB", testedMedia.Blocks * testedMedia.BlockSize, - (testedMedia.Blocks * testedMedia.BlockSize) / 1000 / 1000 / 1000 / 1000, (double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024)); + mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Tb, {2:F2} TiB", + testedMedia.Blocks * testedMedia.BlockSize, + (testedMedia.Blocks * testedMedia.BlockSize) / 1000 / 1000 / + 1000 / 1000, + (double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / + 1024 / 1024 / 1024)); } else if(((testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024) > 1000) { - mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Gb, {2:F2} GiB", testedMedia.Blocks * testedMedia.BlockSize, - (testedMedia.Blocks * testedMedia.BlockSize) / 1000 / 1000 / 1000, (double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024)); + mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Gb, {2:F2} GiB", + testedMedia.Blocks * testedMedia.BlockSize, + (testedMedia.Blocks * testedMedia.BlockSize) / 1000 / 1000 / + 1000, + (double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / + 1024 / 1024)); } else { - mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Mb, {2:F2} MiB", testedMedia.Blocks * testedMedia.BlockSize, - (testedMedia.Blocks * testedMedia.BlockSize) / 1000 / 1000, (double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024)); + mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Mb, {2:F2} MiB", + testedMedia.Blocks * testedMedia.BlockSize, + (testedMedia.Blocks * testedMedia.BlockSize) / 1000 / 1000, + (double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / + 1024)); } } if(testedMedia.CHS != null && testedMedia.CurrentCHS != null) { - int currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads * testedMedia.CurrentCHS.Sectors; - mediaOneValue.Add(string.Format("Cylinders: {0} max., {1} current", testedMedia.CHS.Cylinders, testedMedia.CurrentCHS.Cylinders)); - mediaOneValue.Add(string.Format("Heads: {0} max., {1} current", testedMedia.CHS.Heads, testedMedia.CurrentCHS.Heads)); - mediaOneValue.Add(string.Format("Sectors per track: {0} max., {1} current", testedMedia.CHS.Sectors, testedMedia.CurrentCHS.Sectors)); - mediaOneValue.Add(string.Format("Sectors addressable in CHS mode: {0} max., {1} current", testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors, - currentSectors)); - mediaOneValue.Add(string.Format("Medium size in CHS mode: {0} bytes, {1} Mb, {2:F2} MiB", (ulong)currentSectors * testedMedia.BlockSize, - ((ulong)currentSectors * testedMedia.BlockSize) / 1000 / 1000, (double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024)); + int currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads * + testedMedia.CurrentCHS.Sectors; + mediaOneValue.Add(string.Format("Cylinders: {0} max., {1} current", testedMedia.CHS.Cylinders, + testedMedia.CurrentCHS.Cylinders)); + mediaOneValue.Add(string.Format("Heads: {0} max., {1} current", testedMedia.CHS.Heads, + testedMedia.CurrentCHS.Heads)); + mediaOneValue.Add(string.Format("Sectors per track: {0} max., {1} current", testedMedia.CHS.Sectors, + testedMedia.CurrentCHS.Sectors)); + mediaOneValue.Add(string.Format("Sectors addressable in CHS mode: {0} max., {1} current", + testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * + testedMedia.CHS.Sectors, currentSectors)); + mediaOneValue.Add(string.Format("Medium size in CHS mode: {0} bytes, {1} Mb, {2:F2} MiB", + (ulong)currentSectors * testedMedia.BlockSize, + ((ulong)currentSectors * testedMedia.BlockSize) / 1000 / 1000, + (double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / + 1024)); } else if(testedMedia.CHS != null) { @@ -110,73 +129,99 @@ namespace DiscImageChef.Server.App_Start mediaOneValue.Add(string.Format("Heads: {0}", testedMedia.CHS.Heads)); mediaOneValue.Add(string.Format("Sectors per track: {0}", testedMedia.CHS.Sectors)); mediaOneValue.Add(string.Format("Sectors addressable in CHS mode: {0}", currentSectors)); - mediaOneValue.Add(string.Format("Medium size in CHS mode: {0} bytes, {1} Mb, {2:F2} MiB", (ulong)currentSectors * testedMedia.BlockSize, - ((ulong)currentSectors * testedMedia.BlockSize) / 1000 / 1000, (double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024)); + mediaOneValue.Add(string.Format("Medium size in CHS mode: {0} bytes, {1} Mb, {2:F2} MiB", + (ulong)currentSectors * testedMedia.BlockSize, + ((ulong)currentSectors * testedMedia.BlockSize) / 1000 / 1000, + (double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / + 1024)); } if(testedMedia.LBASectorsSpecified) { - mediaOneValue.Add(string.Format("Sectors addressable in sectors in 28-bit LBA mode: {0}", testedMedia.LBASectors)); + mediaOneValue.Add(string.Format("Sectors addressable in sectors in 28-bit LBA mode: {0}", + testedMedia.LBASectors)); if((((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024) > 1000000) { - mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Tb, {2:F2} TiB", (ulong)testedMedia.LBASectors * testedMedia.BlockSize, - ((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1000 / 1000 / 1000 / 1000, (double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024)); + mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Tb, {2:F2} TiB", + (ulong)testedMedia.LBASectors * testedMedia.BlockSize, + ((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1000 / + 1000 / 1000 / 1000, + (double)((ulong)testedMedia.LBASectors * + testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024)); } else if((((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024) > 1000) { - mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Gb, {2:F2} GiB", (ulong)testedMedia.LBASectors * testedMedia.BlockSize, - ((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1000 / 1000 / 1000, (double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024)); + mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Gb, {2:F2} GiB", + (ulong)testedMedia.LBASectors * testedMedia.BlockSize, + ((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1000 / + 1000 / 1000, + (double)((ulong)testedMedia.LBASectors * + testedMedia.BlockSize) / 1024 / 1024 / 1024)); } else { - mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Mb, {2:F2} MiB", (ulong)testedMedia.LBASectors * testedMedia.BlockSize, - ((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1000 / 1000, (double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024)); + mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Mb, {2:F2} MiB", + (ulong)testedMedia.LBASectors * testedMedia.BlockSize, + ((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1000 / + 1000, + (double)((ulong)testedMedia.LBASectors * + testedMedia.BlockSize) / 1024 / 1024)); } } if(testedMedia.LBA48SectorsSpecified) { - mediaOneValue.Add(string.Format("Sectors addressable in sectors in 48-bit LBA mode: {0}", testedMedia.LBA48Sectors)); + mediaOneValue.Add(string.Format("Sectors addressable in sectors in 48-bit LBA mode: {0}", + testedMedia.LBA48Sectors)); if(((testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024) > 1000000) { - mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Tb, {2:F2} TiB", testedMedia.LBA48Sectors * testedMedia.BlockSize, - (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1000 / 1000 / 1000 / 1000, (double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024)); + mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Tb, {2:F2} TiB", + testedMedia.LBA48Sectors * testedMedia.BlockSize, + (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1000 / + 1000 / 1000 / 1000, + (double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / + 1024 / 1024 / 1024 / 1024)); } else if(((testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024) > 1000) { - mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Gb, {2:F2} GiB", testedMedia.LBA48Sectors * testedMedia.BlockSize, - (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1000 / 1000 / 1000, (double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024)); + mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Gb, {2:F2} GiB", + testedMedia.LBA48Sectors * testedMedia.BlockSize, + (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1000 / + 1000 / 1000, + (double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / + 1024 / 1024 / 1024)); } else { - mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Mb, {2:F2} MiB", testedMedia.LBA48Sectors * testedMedia.BlockSize, - (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1000 / 1000, (double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024)); + mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Mb, {2:F2} MiB", + testedMedia.LBA48Sectors * testedMedia.BlockSize, + (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1000 / + 1000, + (double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / + 1024 / 1024)); } } - if(testedMedia.NominalRotationRateSpecified && - testedMedia.NominalRotationRate != 0x0000 && + if(testedMedia.NominalRotationRateSpecified && testedMedia.NominalRotationRate != 0x0000 && testedMedia.NominalRotationRate != 0xFFFF) { - if(testedMedia.NominalRotationRate == 0x0001) - mediaOneValue.Add("Medium does not rotate."); - else - mediaOneValue.Add(string.Format("Medium rotates at {0} rpm", testedMedia.NominalRotationRate)); + if(testedMedia.NominalRotationRate == 0x0001) mediaOneValue.Add("Medium does not rotate."); + else mediaOneValue.Add(string.Format("Medium rotates at {0} rpm", testedMedia.NominalRotationRate)); } - if(testedMedia.BlockSizeSpecified && - testedMedia.PhysicalBlockSizeSpecified && + if(testedMedia.BlockSizeSpecified && testedMedia.PhysicalBlockSizeSpecified && (testedMedia.BlockSize != testedMedia.PhysicalBlockSize) && - (testedMedia.LogicalAlignment & 0x8000) == 0x0000 && - (testedMedia.LogicalAlignment & 0x4000) == 0x4000) + (testedMedia.LogicalAlignment & 0x8000) == 0x0000 && + (testedMedia.LogicalAlignment & 0x4000) == 0x4000) { - mediaOneValue.Add(string.Format("Logical sector starts at offset {0} from physical sector", testedMedia.LogicalAlignment & 0x3FFF)); + mediaOneValue.Add(string.Format("Logical sector starts at offset {0} from physical sector", + testedMedia.LogicalAlignment & 0x3FFF)); } if(testedMedia.SupportsRead && ata) - mediaOneValue.Add("Device can use the READ SECTOR(S) command in CHS mode with this medium"); + mediaOneValue.Add("Device can use the READ SECTOR(S) command in CHS mode with this medium"); if(testedMedia.SupportsReadRetry) mediaOneValue.Add("Device can use the READ SECTOR(S) RETRY command in CHS mode with this medium"); if(testedMedia.SupportsReadDma) @@ -191,7 +236,8 @@ namespace DiscImageChef.Server.App_Start if(testedMedia.SupportsReadLba) mediaOneValue.Add("Device can use the READ SECTOR(S) command in 28-bit LBA mode with this medium"); if(testedMedia.SupportsReadRetryLba) - mediaOneValue.Add("Device can use the READ SECTOR(S) RETRY command in 28-bit LBA mode with this medium"); + mediaOneValue + .Add("Device can use the READ SECTOR(S) RETRY command in 28-bit LBA mode with this medium"); if(testedMedia.SupportsReadDmaLba) mediaOneValue.Add("Device can use the READ DMA command in 28-bit LBA mode with this medium"); if(testedMedia.SupportsReadDmaRetryLba) @@ -233,9 +279,11 @@ namespace DiscImageChef.Server.App_Start if(testedMedia.SupportsReadCdMsf) mediaOneValue.Add("Device can use the READ CD command with MM:SS:FF addressing with this medium"); if(testedMedia.SupportsReadCdRaw) - mediaOneValue.Add("Device can use the READ CD command with LBA addressing with this medium to read raw sector"); + mediaOneValue + .Add("Device can use the READ CD command with LBA addressing with this medium to read raw sector"); if(testedMedia.SupportsReadCdMsfRaw) - mediaOneValue.Add("Device can use the READ CD command with MM:SS:FF addressing with this medium read raw sector"); + mediaOneValue + .Add("Device can use the READ CD command with MM:SS:FF addressing with this medium read raw sector"); if(testedMedia.SupportsHLDTSTReadRawDVD) mediaOneValue.Add("Device can use the HL-DT-ST vendor READ DVD (RAW) command with this medium"); @@ -256,8 +304,7 @@ namespace DiscImageChef.Server.App_Start mediaOneValue.Add("Device can read the DVD ADress-In-Pregroove from this medium"); if(testedMedia.CanReadATIP) mediaOneValue.Add("Device can read the CD Absolute-Time-In-Pregroove from this medium"); - if(testedMedia.CanReadBCA) - mediaOneValue.Add("Device can read the Burst Cutting Area from this medium"); + if(testedMedia.CanReadBCA) mediaOneValue.Add("Device can read the Burst Cutting Area from this medium"); if(testedMedia.CanReadC2Pointers) mediaOneValue.Add("Device can report the C2 pointers when reading from this medium"); if(testedMedia.CanReadCMI) @@ -265,7 +312,8 @@ namespace DiscImageChef.Server.App_Start if(testedMedia.CanReadCorrectedSubchannel) mediaOneValue.Add("Device can correct subchannels when reading from this medium"); if(testedMedia.CanReadCorrectedSubchannelWithC2) - mediaOneValue.Add("Device can correct subchannels and report the C2 pointers when reading from this medium"); + mediaOneValue + .Add("Device can correct subchannels and report the C2 pointers when reading from this medium"); if(testedMedia.CanReadDCB) mediaOneValue.Add("Device can read the Disc Control Blocks from this medium"); if(testedMedia.CanReadDDS) @@ -280,16 +328,12 @@ namespace DiscImageChef.Server.App_Start mediaOneValue.Add("Device can read the HD DVD Copyright Management Information from this medium"); if(testedMedia.CanReadLayerCapacity) mediaOneValue.Add("Device can read the layer capacity from this medium"); - if(testedMedia.CanReadLeadIn) - mediaOneValue.Add("Device can read the Lead-In from this medium"); - if(testedMedia.CanReadLeadOut) - mediaOneValue.Add("Device can read the Lead-Out from this medium"); - if(testedMedia.CanReadMediaID) - mediaOneValue.Add("Device can read the Media ID from this medium"); + if(testedMedia.CanReadLeadIn) mediaOneValue.Add("Device can read the Lead-In from this medium"); + if(testedMedia.CanReadLeadOut) mediaOneValue.Add("Device can read the Lead-Out from this medium"); + if(testedMedia.CanReadMediaID) mediaOneValue.Add("Device can read the Media ID from this medium"); if(testedMedia.CanReadMediaSerial) mediaOneValue.Add("Device can read the Media Serial Number from this medium"); - if(testedMedia.CanReadPAC) - mediaOneValue.Add("Device can read the PAC from this medium"); + if(testedMedia.CanReadPAC) mediaOneValue.Add("Device can read the PAC from this medium"); if(testedMedia.CanReadPFI) mediaOneValue.Add("Device can read the Physical Format Information from this medium"); if(testedMedia.CanReadPMA) @@ -297,22 +341,23 @@ namespace DiscImageChef.Server.App_Start if(testedMedia.CanReadPQSubchannel) mediaOneValue.Add("Device can read the P to Q subchannels from this medium"); if(testedMedia.CanReadPQSubchannelWithC2) - mediaOneValue.Add("Device can read the P to Q subchannels from this medium reporting the C2 pointers"); + mediaOneValue + .Add("Device can read the P to Q subchannels from this medium reporting the C2 pointers"); if(testedMedia.CanReadPRI) mediaOneValue.Add("Device can read the Pre-Recorded Information from this medium"); if(testedMedia.CanReadRWSubchannel) mediaOneValue.Add("Device can read the R to W subchannels from this medium"); if(testedMedia.CanReadRWSubchannelWithC2) - mediaOneValue.Add("Device can read the R to W subchannels from this medium reporting the C2 pointers"); + mediaOneValue + .Add("Device can read the R to W subchannels from this medium reporting the C2 pointers"); if(testedMedia.CanReadRecordablePFI) mediaOneValue.Add("Device can read the Physical Format Information from Lead-In from this medium"); if(testedMedia.CanReadSpareAreaInformation) mediaOneValue.Add("Device can read the Spare Area Information from this medium"); - if(testedMedia.CanReadTOC) - mediaOneValue.Add("Device can read the Table of Contents from this medium"); + if(testedMedia.CanReadTOC) mediaOneValue.Add("Device can read the Table of Contents from this medium"); mediaOneValue.Add(""); } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/App_Start/WebApiConfig.cs b/DiscImageChef.Server/App_Start/WebApiConfig.cs index 62259c03..58a89fc9 100644 --- a/DiscImageChef.Server/App_Start/WebApiConfig.cs +++ b/DiscImageChef.Server/App_Start/WebApiConfig.cs @@ -43,11 +43,8 @@ namespace DiscImageChef.Server // Web API routes config.MapHttpAttributeRoutes(); - config.Routes.MapHttpRoute( - name: "DefaultApi", - routeTemplate: "api/{controller}/{id}", - defaults: new { id = RouteParameter.Optional } - ); + config.Routes.MapHttpRoute(name: "DefaultApi", routeTemplate: "api/{controller}/{id}", + defaults: new {id = RouteParameter.Optional}); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/Changelog.aspx b/DiscImageChef.Server/Changelog.aspx index 86d9c8a6..89f2fbcc 100644 --- a/DiscImageChef.Server/Changelog.aspx +++ b/DiscImageChef.Server/Changelog.aspx @@ -36,16 +36,16 @@ <html> <meta charset="UTF-8"> <head runat="server"> - <link type='text/css' rel='stylesheet' href='dos.css' /> + <link href='dos.css' rel='stylesheet' type='text/css'/> <title>DiscImageChef's TODO -

- Return to main page.
- DiscImageChef list of changes: -

-
- -
+

+ Return to main page.
+ DiscImageChef list of changes: +

+
+ +
- + \ No newline at end of file diff --git a/DiscImageChef.Server/Controllers/UploadReportController.cs b/DiscImageChef.Server/Controllers/UploadReportController.cs index 7ad8a813..02b8839c 100644 --- a/DiscImageChef.Server/Controllers/UploadReportController.cs +++ b/DiscImageChef.Server/Controllers/UploadReportController.cs @@ -76,7 +76,9 @@ namespace DiscImageChef.Server.Controllers filename = string.Format("NewReport_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, rng.Next()); } - FileStream newFile = new FileStream(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Upload", filename), FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None); + FileStream newFile = + new FileStream(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Upload", filename), + FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None); xs.Serialize(newFile, newReport); newFile.Close(); @@ -94,4 +96,4 @@ namespace DiscImageChef.Server.Controllers } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/Controllers/UploadStatsController.cs b/DiscImageChef.Server/Controllers/UploadStatsController.cs index 1b7a3f92..3cdf098c 100644 --- a/DiscImageChef.Server/Controllers/UploadStatsController.cs +++ b/DiscImageChef.Server/Controllers/UploadStatsController.cs @@ -70,7 +70,9 @@ namespace DiscImageChef.Server.Controllers return response; } - FileStream fs = WaitForFile(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", "Statistics.xml"), FileMode.Open, FileAccess.ReadWrite, FileShare.None); + FileStream fs = + WaitForFile(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", "Statistics.xml"), + FileMode.Open, FileAccess.ReadWrite, FileShare.None); if(fs == null) { @@ -84,8 +86,7 @@ namespace DiscImageChef.Server.Controllers if(newStats.Commands != null) { - if(oldStats.Commands == null) - oldStats.Commands = newStats.Commands; + if(oldStats.Commands == null) oldStats.Commands = newStats.Commands; else { oldStats.Commands.Analyze += newStats.Commands.Analyze; @@ -112,8 +113,7 @@ namespace DiscImageChef.Server.Controllers if(newStats.OperatingSystems != null) { - if(oldStats.OperatingSystems == null) - oldStats.OperatingSystems = newStats.OperatingSystems; + if(oldStats.OperatingSystems == null) oldStats.OperatingSystems = newStats.OperatingSystems; else { foreach(OsStats newNvs in newStats.OperatingSystems) @@ -125,7 +125,12 @@ namespace DiscImageChef.Server.Controllers { if(oldNvs.name == newNvs.name && oldNvs.version == newNvs.version) { - addNvs = new OsStats { name = oldNvs.name, Value = oldNvs.Value + newNvs.Value, version = oldNvs.version }; + addNvs = new OsStats + { + name = oldNvs.name, + Value = oldNvs.Value + newNvs.Value, + version = oldNvs.version + }; removeNvs = oldNvs; break; } @@ -136,18 +141,15 @@ namespace DiscImageChef.Server.Controllers oldStats.OperatingSystems.Remove(removeNvs); oldStats.OperatingSystems.Add(addNvs); } - else - oldStats.OperatingSystems.Add(newNvs); + else oldStats.OperatingSystems.Add(newNvs); } } } else { if(oldStats.OperatingSystems == null) - oldStats.OperatingSystems = new System.Collections.Generic.List - { - new OsStats { name = "Linux", Value = 1 } - }; + oldStats.OperatingSystems = + new System.Collections.Generic.List {new OsStats {name = "Linux", Value = 1}}; else { OsStats removeNvs = null; @@ -157,7 +159,12 @@ namespace DiscImageChef.Server.Controllers { if(oldNvs.name == "Linux") { - addNvs = new OsStats { name = oldNvs.name, Value = oldNvs.Value + 1, version = oldNvs.version }; + addNvs = new OsStats + { + name = oldNvs.name, + Value = oldNvs.Value + 1, + version = oldNvs.version + }; removeNvs = oldNvs; break; } @@ -168,15 +175,13 @@ namespace DiscImageChef.Server.Controllers oldStats.OperatingSystems.Remove(removeNvs); oldStats.OperatingSystems.Add(addNvs); } - else - oldStats.OperatingSystems.Add(new OsStats { name = "Linux", Value = 1 }); + else oldStats.OperatingSystems.Add(new OsStats {name = "Linux", Value = 1}); } } if(newStats.Versions != null) { - if(oldStats.Versions == null) - oldStats.Versions = newStats.Versions; + if(oldStats.Versions == null) oldStats.Versions = newStats.Versions; else { foreach(NameValueStats newNvs in newStats.Versions) @@ -188,7 +193,11 @@ namespace DiscImageChef.Server.Controllers { if(oldNvs.name == newNvs.name) { - addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + newNvs.Value }; + addNvs = new NameValueStats + { + name = oldNvs.name, + Value = oldNvs.Value + newNvs.Value + }; removeNvs = oldNvs; break; } @@ -199,18 +208,18 @@ namespace DiscImageChef.Server.Controllers oldStats.Versions.Remove(removeNvs); oldStats.Versions.Add(addNvs); } - else - oldStats.Versions.Add(newNvs); + else oldStats.Versions.Add(newNvs); } } } else { if(oldStats.Versions == null) - oldStats.Versions = new System.Collections.Generic.List - { - new NameValueStats { name = "previous", Value = 1 } - }; + oldStats.Versions = + new System.Collections.Generic.List + { + new NameValueStats {name = "previous", Value = 1} + }; else { NameValueStats removeNvs = null; @@ -220,7 +229,7 @@ namespace DiscImageChef.Server.Controllers { if(oldNvs.name == "previous") { - addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + 1 }; + addNvs = new NameValueStats {name = oldNvs.name, Value = oldNvs.Value + 1}; removeNvs = oldNvs; break; } @@ -231,15 +240,13 @@ namespace DiscImageChef.Server.Controllers oldStats.Versions.Remove(removeNvs); oldStats.Versions.Add(addNvs); } - else - oldStats.Versions.Add(new NameValueStats { name = "previous", Value = 1 }); + else oldStats.Versions.Add(new NameValueStats {name = "previous", Value = 1}); } } if(newStats.Filesystems != null) { - if(oldStats.Filesystems == null) - oldStats.Filesystems = newStats.Filesystems; + if(oldStats.Filesystems == null) oldStats.Filesystems = newStats.Filesystems; else { foreach(NameValueStats newNvs in newStats.Filesystems) @@ -251,7 +258,11 @@ namespace DiscImageChef.Server.Controllers { if(oldNvs.name == newNvs.name) { - addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + newNvs.Value }; + addNvs = new NameValueStats + { + name = oldNvs.name, + Value = oldNvs.Value + newNvs.Value + }; removeNvs = oldNvs; break; } @@ -262,16 +273,14 @@ namespace DiscImageChef.Server.Controllers oldStats.Filesystems.Remove(removeNvs); oldStats.Filesystems.Add(addNvs); } - else - oldStats.Filesystems.Add(newNvs); + else oldStats.Filesystems.Add(newNvs); } } } if(newStats.Partitions != null) { - if(oldStats.Partitions == null) - oldStats.Partitions = newStats.Partitions; + if(oldStats.Partitions == null) oldStats.Partitions = newStats.Partitions; else { foreach(NameValueStats newNvs in newStats.Partitions) @@ -283,7 +292,11 @@ namespace DiscImageChef.Server.Controllers { if(oldNvs.name == newNvs.name) { - addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + newNvs.Value }; + addNvs = new NameValueStats + { + name = oldNvs.name, + Value = oldNvs.Value + newNvs.Value + }; removeNvs = oldNvs; break; } @@ -294,16 +307,14 @@ namespace DiscImageChef.Server.Controllers oldStats.Partitions.Remove(removeNvs); oldStats.Partitions.Add(addNvs); } - else - oldStats.Partitions.Add(newNvs); + else oldStats.Partitions.Add(newNvs); } } } if(newStats.MediaImages != null) { - if(oldStats.MediaImages == null) - oldStats.MediaImages = newStats.MediaImages; + if(oldStats.MediaImages == null) oldStats.MediaImages = newStats.MediaImages; else { foreach(NameValueStats newNvs in newStats.MediaImages) @@ -315,7 +326,11 @@ namespace DiscImageChef.Server.Controllers { if(oldNvs.name == newNvs.name) { - addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + newNvs.Value }; + addNvs = new NameValueStats + { + name = oldNvs.name, + Value = oldNvs.Value + newNvs.Value + }; removeNvs = oldNvs; break; } @@ -326,16 +341,14 @@ namespace DiscImageChef.Server.Controllers oldStats.MediaImages.Remove(removeNvs); oldStats.MediaImages.Add(addNvs); } - else - oldStats.MediaImages.Add(newNvs); + else oldStats.MediaImages.Add(newNvs); } } } if(newStats.Filters != null) { - if(oldStats.Filters == null) - oldStats.Filters = newStats.Filters; + if(oldStats.Filters == null) oldStats.Filters = newStats.Filters; else { foreach(NameValueStats newNvs in newStats.Filters) @@ -347,7 +360,11 @@ namespace DiscImageChef.Server.Controllers { if(oldNvs.name == newNvs.name) { - addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + newNvs.Value }; + addNvs = new NameValueStats + { + name = oldNvs.name, + Value = oldNvs.Value + newNvs.Value + }; removeNvs = oldNvs; break; } @@ -358,16 +375,14 @@ namespace DiscImageChef.Server.Controllers oldStats.Filters.Remove(removeNvs); oldStats.Filters.Add(addNvs); } - else - oldStats.Filters.Add(newNvs); + else oldStats.Filters.Add(newNvs); } } } if(newStats.Devices != null) { - if(oldStats.Devices == null) - oldStats.Devices = newStats.Devices; + if(oldStats.Devices == null) oldStats.Devices = newStats.Devices; else { foreach(DeviceStats newDev in newStats.Devices) @@ -376,26 +391,22 @@ namespace DiscImageChef.Server.Controllers foreach(DeviceStats oldDev in oldStats.Devices) { - if(oldDev.Manufacturer == newDev.Manufacturer && - oldDev.Model == newDev.Model && - oldDev.Revision == newDev.Revision && - oldDev.Bus == newDev.Bus) + if(oldDev.Manufacturer == newDev.Manufacturer && oldDev.Model == newDev.Model && + oldDev.Revision == newDev.Revision && oldDev.Bus == newDev.Bus) { found = true; break; } } - if(!found) - oldStats.Devices.Add(newDev); + if(!found) oldStats.Devices.Add(newDev); } } } if(newStats.Medias != null) { - if(oldStats.Medias == null) - oldStats.Medias = newStats.Medias; + if(oldStats.Medias == null) oldStats.Medias = newStats.Medias; else { foreach(MediaStats newMstat in newStats.Medias) @@ -407,7 +418,12 @@ namespace DiscImageChef.Server.Controllers { if(oldMstat.real == newMstat.real && oldMstat.type == newMstat.type) { - addMstat = new MediaStats { real = oldMstat.real, type = oldMstat.type, Value = oldMstat.Value + newMstat.Value }; + addMstat = new MediaStats + { + real = oldMstat.real, + type = oldMstat.type, + Value = oldMstat.Value + newMstat.Value + }; removeMstat = oldMstat; break; } @@ -418,20 +434,17 @@ namespace DiscImageChef.Server.Controllers oldStats.Medias.Remove(removeMstat); oldStats.Medias.Add(addMstat); } - else - oldStats.Medias.Add(newMstat); + else oldStats.Medias.Add(newMstat); } } } if(newStats.MediaScan != null) { - if(oldStats.MediaScan == null) - oldStats.MediaScan = newStats.MediaScan; + if(oldStats.MediaScan == null) oldStats.MediaScan = newStats.MediaScan; else { - if(oldStats.MediaScan.Sectors == null) - oldStats.MediaScan.Sectors = newStats.MediaScan.Sectors; + if(oldStats.MediaScan.Sectors == null) oldStats.MediaScan.Sectors = newStats.MediaScan.Sectors; else { oldStats.MediaScan.Sectors.Correct = newStats.MediaScan.Sectors.Correct; @@ -440,8 +453,7 @@ namespace DiscImageChef.Server.Controllers oldStats.MediaScan.Sectors.Unverifiable = newStats.MediaScan.Sectors.Unverifiable; } - if(oldStats.MediaScan.Times == null) - oldStats.MediaScan.Times = newStats.MediaScan.Times; + if(oldStats.MediaScan.Times == null) oldStats.MediaScan.Times = newStats.MediaScan.Times; else { oldStats.MediaScan.Times.LessThan10ms = newStats.MediaScan.Times.LessThan10ms; @@ -456,12 +468,10 @@ namespace DiscImageChef.Server.Controllers if(newStats.Verify != null) { - if(oldStats.Verify == null) - oldStats.Verify = newStats.Verify; + if(oldStats.Verify == null) oldStats.Verify = newStats.Verify; else { - if(oldStats.Verify.Sectors == null) - oldStats.Verify.Sectors = newStats.Verify.Sectors; + if(oldStats.Verify.Sectors == null) oldStats.Verify.Sectors = newStats.Verify.Sectors; else { oldStats.Verify.Sectors.Correct = newStats.Verify.Sectors.Correct; @@ -481,16 +491,23 @@ namespace DiscImageChef.Server.Controllers } if(oldStats.Devices != null) - oldStats.Devices = oldStats.Devices.OrderBy(device => device.Manufacturer).ThenBy(device => device.Model).ThenBy(device => device.Revision).ThenBy(device => device.Bus).ToList(); + oldStats.Devices = oldStats.Devices.OrderBy(device => device.Manufacturer) + .ThenBy(device => device.Model).ThenBy(device => device.Revision) + .ThenBy(device => device.Bus).ToList(); Random rng = new Random(); - string filename = string.Format("BackupStats_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, rng.Next()); - while(File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", filename))) + string filename = string.Format("BackupStats_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, + rng.Next()); + while(File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", + filename))) { filename = string.Format("BackupStats_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, rng.Next()); } - FileStream backup = new FileStream(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", filename), FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None); + FileStream backup = + new + FileStream(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", filename), + FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None); fs.Seek(0, SeekOrigin.Begin); fs.CopyTo(backup); backup.Close(); @@ -527,10 +544,7 @@ namespace DiscImageChef.Server.Controllers } catch(IOException) { - if(fs != null) - { - fs.Dispose(); - } + if(fs != null) { fs.Dispose(); } System.Threading.Thread.Sleep(50); } } @@ -538,4 +552,4 @@ namespace DiscImageChef.Server.Controllers return null; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/DONATING.aspx b/DiscImageChef.Server/DONATING.aspx index 9a0c4e46..59716a9c 100644 --- a/DiscImageChef.Server/DONATING.aspx +++ b/DiscImageChef.Server/DONATING.aspx @@ -36,16 +36,16 @@ - + DiscImageChef's TODO -

- Return to main page.
- DiscImageChef list of things to be donated: -

-
- -
+

+ Return to main page.
+ DiscImageChef list of things to be donated: +

+
+ +
- + \ No newline at end of file diff --git a/DiscImageChef.Server/Default.aspx b/DiscImageChef.Server/Default.aspx index 1f40423c..0cbae112 100644 --- a/DiscImageChef.Server/Default.aspx +++ b/DiscImageChef.Server/Default.aspx @@ -36,10 +36,13 @@ - + DiscImageChef -

Welcome to DiscImageChef Server version

+

Welcome to + DiscImageChef + Server version +

- + \ No newline at end of file diff --git a/DiscImageChef.Server/Default.aspx.cs b/DiscImageChef.Server/Default.aspx.cs index 0262708a..b2a010d6 100644 --- a/DiscImageChef.Server/Default.aspx.cs +++ b/DiscImageChef.Server/Default.aspx.cs @@ -36,13 +36,13 @@ using Velyo.AspNet.Markdown; namespace DiscImageChef.Server { - public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { MarkdownContent mkdown = new MarkdownContent(); - StreamReader sr = new StreamReader(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "docs", "README.md")); + StreamReader sr = + new StreamReader(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "docs", "README.md")); string mdcontent = sr.ReadToEnd(); sr.Close(); @@ -52,4 +52,4 @@ namespace DiscImageChef.Server lblVersion.Text = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/Global.asax b/DiscImageChef.Server/Global.asax index a1104cba..189743a3 100644 --- a/DiscImageChef.Server/Global.asax +++ b/DiscImageChef.Server/Global.asax @@ -1 +1 @@ -<%@ Application Inherits="DiscImageChef.Server.Global" %> +<%@ Application Inherits="DiscImageChef.Server.Global" %> \ No newline at end of file diff --git a/DiscImageChef.Server/Global.asax.cs b/DiscImageChef.Server/Global.asax.cs index 51f2fea1..2b756ef5 100644 --- a/DiscImageChef.Server/Global.asax.cs +++ b/DiscImageChef.Server/Global.asax.cs @@ -42,4 +42,4 @@ namespace DiscImageChef.Server GlobalConfiguration.Configure(WebApiConfig.Register); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/Properties/AssemblyInfo.cs b/DiscImageChef.Server/Properties/AssemblyInfo.cs index 0f3206e5..02d08a2a 100644 --- a/DiscImageChef.Server/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Server/Properties/AssemblyInfo.cs @@ -54,4 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Server/Statistics.aspx b/DiscImageChef.Server/Statistics.aspx index 2cb906fc..e2cdfbb0 100644 --- a/DiscImageChef.Server/Statistics.aspx +++ b/DiscImageChef.Server/Statistics.aspx @@ -36,196 +36,243 @@ - - DiscImageChef Statistics + + DiscImageChef Statistics -

Welcome to DiscImageChef Server version

+

Welcome to + DiscImageChef + Server version +

+
+
+
+ + + + + + + + +
DiscImageChef has run on + + times. +

-
-
- - - - - - - - -
DiscImageChef has run on times.
-
-
-
- - - - - - - - -
DiscImageChef version has been used times.
-
-
-
-

Commands run:

-

- analyze command has been run times
- benchmark command has been run times
- checksum command has been run times
- compare command has been run times
- create-sidecar command has been run times
- decode command has been run times
- device-info command has been run times
- device-report command has been run times
- dump-media command has been run times
- entropy command has been run times
- extract-files command has been run times
- formats command has been run times
- list-devices command has been run times
- list-encodings command has been run times
- ls command has been run times
- media-info command has been run times
- media-scan command has been run times
- printhex command has been run times
- verify command has been run times -

-
-
-

Filters found:

- - - - - - - - - - - - - -
FilterTimes
-
-
-

Media image formats found:

- - - - - - - - - - - - - -
Media image formatTimes
-
-
-

Partition schemes found:

- - - - - - - - - - - - - -
Partition schemeTimes
-
-
-

Filesystems found:

- - - - - - - - - - - - - -
Filesystem nameTimes
-
-
-

Media types found in images:

- - - - - - - - - - - - - - - -
Physical typeLogical typeTimes
-
-
-

Media types found in devices:

- - - - - - - - - - - - - - - -
Physical typeLogical typeTimes
-
-
-

Found devices:

- - - - - - - - - - - - - - - - - - - -
ManufacturerModelRevisionBusReport
-
-
-
- +
+
+ + + + + + + + +
DiscImageChef version + + has been used times. +
+
+
+
+

Commands run:

+

+ analyze command has been run times
+ benchmark command has been run times
+ checksum command has been run times
+ compare command has been run times
+ create-sidecar command has been run times
+ decode command has been run times
+ device-info command has been run times
+ device-report command has been run times
+ dump-media command has been run times
+ entropy command has been run times
+ extract-files command has been run times
+ formats command has been run times
+ list-devices command has been run times
+ list-encodings command has been run times
+ ls command has been run times
+ media-info command has been run times
+ media-scan command has been run times
+ printhex command has been run times
+ verify command has been run times +

+
+
+

Filters found:

+ + + + + + + + + + + + + +
FilterTimes
+ + + +
+
+
+

Media image formats found:

+ + + + + + + + + + + + + +
Media image formatTimes
+ + + +
+
+
+

Partition schemes found:

+ + + + + + + + + + + + + +
Partition schemeTimes
+ + + +
+
+
+

Filesystems found:

+ + + + + + + + + + + + + +
Filesystem nameTimes
+ + + +
+
+
+

Media types found in images:

+ + + + + + + + + + + + + + + +
Physical typeLogical typeTimes
+ + + + + +
+
+
+

Media types found in devices:

+ + + + + + + + + + + + + + + +
Physical typeLogical typeTimes
+ + + + + +
+
+
+

Found devices:

+ + + + + + + + + + + + + + + + + + + +
ManufacturerModelRevisionBusReport
+ + + + + + + + + +
+
+
+
+ - + \ No newline at end of file diff --git a/DiscImageChef.Server/Statistics.aspx.cs b/DiscImageChef.Server/Statistics.aspx.cs index 3e93ff5b..1a91f008 100644 --- a/DiscImageChef.Server/Statistics.aspx.cs +++ b/DiscImageChef.Server/Statistics.aspx.cs @@ -72,10 +72,13 @@ namespace DiscImageChef.Server try { - if(!File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", "Statistics.xml"))) + if(!File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", + "Statistics.xml"))) { #if DEBUG - content.InnerHtml = string.Format("Sorry, cannot load data file \"{0}\"", Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", "Statistics.xml")); + content.InnerHtml = string.Format("Sorry, cannot load data file \"{0}\"", + Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), + "Statistics", "Statistics.xml")); #else content.InnerHtml = "Sorry, cannot load data file"; #endif @@ -85,7 +88,9 @@ namespace DiscImageChef.Server statistics = new Stats(); XmlSerializer xs = new XmlSerializer(statistics.GetType()); - FileStream fs = WaitForFile(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", "Statistics.xml"), FileMode.Open, FileAccess.Read, FileShare.Read); + FileStream fs = + WaitForFile(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", "Statistics.xml"), + FileMode.Open, FileAccess.Read, FileShare.Read); statistics = (Stats)xs.Deserialize(fs); fs.Close(); @@ -93,13 +98,20 @@ namespace DiscImageChef.Server { operatingSystems = new List(); foreach(OsStats nvs in statistics.OperatingSystems) - operatingSystems.Add(new NameValueStats { name = string.Format("{0}{1}{2}", Interop.DetectOS.GetPlatformName((Interop.PlatformID)Enum.Parse(typeof(Interop.PlatformID), nvs.name), nvs.version), - string.IsNullOrEmpty(nvs.version) ? "" : " ", nvs.version), Value = nvs.Value }); + operatingSystems.Add(new NameValueStats + { + name = string.Format("{0}{1}{2}", + Interop.DetectOS + .GetPlatformName((Interop.PlatformID)Enum.Parse(typeof(Interop.PlatformID), nvs.name), + nvs.version), + string.IsNullOrEmpty(nvs.version) ? "" : " ", nvs.version), + Value = nvs.Value + }); + repOperatingSystems.DataSource = operatingSystems.OrderBy(os => os.name).ToList(); repOperatingSystems.DataBind(); } - else - divOperatingSystems.Visible = false; + else divOperatingSystems.Visible = false; if(statistics.Versions != null) { @@ -107,15 +119,14 @@ namespace DiscImageChef.Server foreach(NameValueStats nvs in statistics.Versions) { if(nvs.name == "previous") - versions.Add(new NameValueStats { name = "Previous than 3.4.99.0", Value = nvs.Value }); - else - versions.Add(nvs); + versions.Add(new NameValueStats {name = "Previous than 3.4.99.0", Value = nvs.Value}); + else versions.Add(nvs); } + repVersions.DataSource = versions.OrderBy(ver => ver.name).ToList(); repVersions.DataBind(); } - else - divVersions.Visible = false; + else divVersions.Visible = false; if(statistics.Commands != null) { @@ -139,40 +150,35 @@ namespace DiscImageChef.Server lblListDevices.Text = statistics.Commands.ListDevices.ToString(); lblListEncodings.Text = statistics.Commands.ListEncodings.ToString(); } - else - divCommands.Visible = false; + else divCommands.Visible = false; if(statistics.Filters != null) { repFilters.DataSource = statistics.Filters.OrderBy(filter => filter.name).ToList(); repFilters.DataBind(); } - else - divFilters.Visible = false; + else divFilters.Visible = false; if(statistics.MediaImages != null) { repMediaImages.DataSource = statistics.MediaImages.OrderBy(filter => filter.name).ToList(); repMediaImages.DataBind(); } - else - divMediaImages.Visible = false; + else divMediaImages.Visible = false; if(statistics.Partitions != null) { repPartitions.DataSource = statistics.Partitions.OrderBy(filter => filter.name).ToList(); repPartitions.DataBind(); } - else - divPartitions.Visible = false; + else divPartitions.Visible = false; if(statistics.Filesystems != null) { repFilesystems.DataSource = statistics.Filesystems.OrderBy(filter => filter.name).ToList(); repFilesystems.DataBind(); } - else - divFilesystems.Visible = false; + else divFilesystems.Visible = false; if(statistics.Medias != null) { @@ -183,29 +189,29 @@ namespace DiscImageChef.Server string type; string subtype; - MediaType.MediaTypeToString((CommonTypes.MediaType)Enum.Parse(typeof(CommonTypes.MediaType), nvs.type), out type, out subtype); + MediaType + .MediaTypeToString((CommonTypes.MediaType)Enum.Parse(typeof(CommonTypes.MediaType), nvs.type), + out type, out subtype); - if(nvs.real) - realMedia.Add(new MediaItem { Type = type, SubType = subtype, Count = nvs.Value }); - else - virtualMedia.Add(new MediaItem { Type = type, SubType = subtype, Count = nvs.Value }); + if(nvs.real) realMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Value}); + else virtualMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Value}); } if(realMedia.Count > 0) { - repRealMedia.DataSource = realMedia.OrderBy(media => media.Type).ThenBy(media => media.SubType).ToList(); + repRealMedia.DataSource = + realMedia.OrderBy(media => media.Type).ThenBy(media => media.SubType).ToList(); repRealMedia.DataBind(); } - else - divRealMedia.Visible = false; + else divRealMedia.Visible = false; if(virtualMedia.Count > 0) { - repVirtualMedia.DataSource = virtualMedia.OrderBy(media => media.Type).ThenBy(media => media.SubType).ToList(); + repVirtualMedia.DataSource = + virtualMedia.OrderBy(media => media.Type).ThenBy(media => media.SubType).ToList(); repVirtualMedia.DataBind(); } - else - divVirtualMedia.Visible = false; + else divVirtualMedia.Visible = false; } else { @@ -220,37 +226,40 @@ namespace DiscImageChef.Server { string url = null; string xmlFile; - if(!string.IsNullOrWhiteSpace(device.Manufacturer) && !string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision)) + if(!string.IsNullOrWhiteSpace(device.Manufacturer) && + !string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision)) { xmlFile = device.Manufacturer + "_" + device.Model + "_" + device.Revision + ".xml"; url = string.Format("ViewReport.aspx?manufacturer={0}&model={1}&revision={2}", - HttpUtility.UrlPathEncode(device.Manufacturer), HttpUtility.UrlPathEncode(device.Model), HttpUtility.UrlPathEncode(device.Revision)); + HttpUtility.UrlPathEncode(device.Manufacturer), + HttpUtility.UrlPathEncode(device.Model), + HttpUtility.UrlPathEncode(device.Revision)); } - else if(!string.IsNullOrWhiteSpace(device.Manufacturer) && !string.IsNullOrWhiteSpace(device.Model)) + else if(!string.IsNullOrWhiteSpace(device.Manufacturer) && + !string.IsNullOrWhiteSpace(device.Model)) { xmlFile = device.Manufacturer + "_" + device.Model + ".xml"; url = string.Format("ViewReport.aspx?manufacturer={0}&model={1}", - HttpUtility.UrlPathEncode(device.Manufacturer), HttpUtility.UrlPathEncode(device.Model)); + HttpUtility.UrlPathEncode(device.Manufacturer), + HttpUtility.UrlPathEncode(device.Model)); } else if(!string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision)) { xmlFile = device.Model + "_" + device.Revision + ".xml"; url = string.Format("ViewReport.aspx?model={0}&revision={1}", - HttpUtility.UrlPathEncode(device.Model), HttpUtility.UrlPathEncode(device.Revision)); + HttpUtility.UrlPathEncode(device.Model), + HttpUtility.UrlPathEncode(device.Revision)); } else { xmlFile = device.Model + ".xml"; - url = string.Format("ViewReport.aspx?model={0}", - HttpUtility.UrlPathEncode(device.Model)); + url = string.Format("ViewReport.aspx?model={0}", HttpUtility.UrlPathEncode(device.Model)); } xmlFile = xmlFile.Replace('/', '_').Replace('\\', '_').Replace('?', '_'); - if(!File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Reports", xmlFile))) - { - url = null; - } + if(!File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Reports", + xmlFile))) { url = null; } devices.Add(new DeviceItem() { @@ -258,15 +267,17 @@ namespace DiscImageChef.Server Model = device.Model, Revision = device.Revision, Bus = device.Bus, - ReportLink = url == null ? "No" : string.Format("Yes", url) + ReportLink = + url == null ? "No" : string.Format("Yes", url) }); } - repDevices.DataSource = devices.OrderBy(device => device.Manufacturer).ThenBy(device => device.Model).ThenBy(device => device.Revision).ThenBy(device => device.Bus).ToList(); + + repDevices.DataSource = devices.OrderBy(device => device.Manufacturer) + .ThenBy(device => device.Model).ThenBy(device => device.Revision) + .ThenBy(device => device.Bus).ToList(); repDevices.DataBind(); } - else - divDevices.Visible = false; - + else divDevices.Visible = false; } catch(Exception ex) { @@ -289,10 +300,7 @@ namespace DiscImageChef.Server } catch(IOException) { - if(fs != null) - { - fs.Dispose(); - } + if(fs != null) { fs.Dispose(); } System.Threading.Thread.Sleep(50); } } @@ -300,4 +308,4 @@ namespace DiscImageChef.Server return null; } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/Statistics/Statistics.xml b/DiscImageChef.Server/Statistics/Statistics.xml index e7962d3e..3bbfdc4a 100644 --- a/DiscImageChef.Server/Statistics/Statistics.xml +++ b/DiscImageChef.Server/Statistics/Statistics.xml @@ -1,2 +1,3 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/DiscImageChef.Server/TODO.aspx b/DiscImageChef.Server/TODO.aspx index e7708acf..d31bdf18 100644 --- a/DiscImageChef.Server/TODO.aspx +++ b/DiscImageChef.Server/TODO.aspx @@ -36,16 +36,16 @@ - + DiscImageChef's TODO -

- Return to main page.
- DiscImageChef list of things to do: -

-
- -
+

+ Return to main page.
+ DiscImageChef list of things to do: +

+
+ +
- + \ No newline at end of file diff --git a/DiscImageChef.Server/ViewReport.aspx b/DiscImageChef.Server/ViewReport.aspx index df0adbaa..2a28f505 100644 --- a/DiscImageChef.Server/ViewReport.aspx +++ b/DiscImageChef.Server/ViewReport.aspx @@ -36,174 +36,186 @@ - + DiscImageChef Device Report - DiscImageChef Report for -
-
- USB characteristics:
- Manufacturer:
- Product:
- Vendor ID:
- Product ID: -
-
-
- FireWire characteristics:
- Manufacturer:
- Product:
- Vendor ID:
- Product ID: -
-
-
- PCMCIA characteristics:
- Manufacturer:
- Product:
- Manufacturer code:
- Card code:
- Compliance: - - - :
-
-
+DiscImageChef Report for +
+
+ USB characteristics:
+ Manufacturer:
+ Product:
+ Vendor ID:
+ Product ID: +
+
+
+ FireWire characteristics:
+ Manufacturer:
+ Product:
+ Vendor ID:
+ Product ID: +
+
+
+ PCMCIA characteristics:
+ Manufacturer:
+ Product:
+ Manufacturer code:
+ Card code:
+ Compliance: + + + + + :
+
+
-
-
-
- ATA characteristics:
-
- +
+
+
+ ATA characteristics:
+
+ + + + + :
+
+
+
+ + + <%# Container.DataItem?.ToString() ?? string.Empty %>
+
+
+
+
+
+ SCSI characteristics:
+ Vendor:
+ Product:
+ Revision:
+ + + <%# Container.DataItem?.ToString() ?? string.Empty %>
+
+
+
+
SCSI mode sense pages: + + + + + + - :
-
-
-
- - - <%# Container.DataItem?.ToString() ?? string.Empty%>
-
-
- -
-
- SCSI characteristics:
- Vendor:
- Product:
- Revision:
- - - <%# Container.DataItem?.ToString() ?? string.Empty%>
-
-
-
-
SCSI mode sense pages: -
ModeContents
- - - - - - - - - - - - -
ModeContents
-
-
-
SCSI extended vital product data pages: - - - + + - - - - - - - - -
EVPDContents + + + +
-
-
-
SCSI CD-ROM capabilities:
- - - <%# Container.DataItem?.ToString() ?? string.Empty%>
-
-
-
-
-
SCSI MMC features:
- - - <%# Container.DataItem?.ToString() ?? string.Empty%>
-
-
-
-
-
SCSI Streaming device capabilities:
- Block size granularity:
- Maximum block length: bytes
- Minimum block length: bytes
- - -
Information for supported density with primary code and secondary code
- Drive can write this density:
- Duplicate density:
- Default density:
- Density has bits per mm, with tracks in a mm width tape - Name:
- Organization:
- Description:
- Maximum capacity: megabytes
-
-
- - -
Information for supported media with type code
- Drive can write this density:
- Media is meters long in a mm width tape - Name:
- Organization:
- Description:
-
-
-
+ + +
-
-
Tested media:
- +
+
SCSI extended vital product data pages: + + + + + + + + + + + + + +
EVPDContents
+ + + +
+
+
+
SCSI CD-ROM capabilities:
+ - <%# Container.DataItem?.ToString() ?? string.Empty%>
+ <%# Container.DataItem?.ToString() ?? string.Empty %>
-
-
- MultiMediaCard device:
- +
+
SCSI MMC features:
+ - <%# Container.DataItem?.ToString() ?? string.Empty%>
+ <%# Container.DataItem?.ToString() ?? string.Empty %>
-
-
- SecureDigital device:
- +
+
SCSI Streaming device capabilities:
+ Block size granularity:
+ Maximum block length: bytes
+ Minimum block length: bytes
+ - <%# Container.DataItem?.ToString() ?? string.Empty%>
+
Information for supported density with primary code and secondary code
+ Drive can write this density:
+ Duplicate density:
+ Default density:
+ Density has bits per mm, with tracks in a mm width tape + Name:
+ Organization:
+ Description:
+ Maximum capacity: megabytes
+
+
+ + +
Information for supported media with type code
+ Drive can write this density:
+ Media is meters long in a mm width tape + Name:
+ Organization:
+ Description:
+
+
+
Tested media:
+ + + <%# Container.DataItem?.ToString() ?? string.Empty %>
+
+
+
+
+
+ MultiMediaCard device:
+ + + <%# Container.DataItem?.ToString() ?? string.Empty %>
+
+
+
+
+
+ SecureDigital device:
+ + + <%# Container.DataItem?.ToString() ?? string.Empty %>
+
+
+
- + \ No newline at end of file diff --git a/DiscImageChef.Server/ViewReport.aspx.cs b/DiscImageChef.Server/ViewReport.aspx.cs index 088482a0..a06509c2 100644 --- a/DiscImageChef.Server/ViewReport.aspx.cs +++ b/DiscImageChef.Server/ViewReport.aspx.cs @@ -42,7 +42,6 @@ using DiscImageChef.Server.App_Start; namespace DiscImageChef.Server { - public partial class ViewReport : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) @@ -55,23 +54,31 @@ namespace DiscImageChef.Server // Strip non-ascii, strip slashes and question marks if(manufacturer != null) - manufacturer = Encoding.ASCII.GetString(Encoding.Convert(Encoding.UTF8, Encoding.ASCII, Encoding.UTF8.GetBytes(manufacturer))).Replace('/', '_').Replace('\\', '_').Replace('?', '_'); + manufacturer = Encoding + .ASCII.GetString(Encoding.Convert(Encoding.UTF8, Encoding.ASCII, + Encoding.UTF8.GetBytes(manufacturer))).Replace('/', '_') + .Replace('\\', '_').Replace('?', '_'); if(model != null) - model = Encoding.ASCII.GetString(Encoding.Convert(Encoding.UTF8, Encoding.ASCII, Encoding.UTF8.GetBytes(model))).Replace('/', '_').Replace('\\', '_').Replace('?', '_'); + model = Encoding + .ASCII.GetString(Encoding.Convert(Encoding.UTF8, Encoding.ASCII, Encoding.UTF8.GetBytes(model))) + .Replace('/', '_').Replace('\\', '_').Replace('?', '_'); if(revision != null) - revision = Encoding.ASCII.GetString(Encoding.Convert(Encoding.UTF8, Encoding.ASCII, Encoding.UTF8.GetBytes(revision))).Replace('/', '_').Replace('\\', '_').Replace('?', '_'); + revision = Encoding + .ASCII.GetString(Encoding.Convert(Encoding.UTF8, Encoding.ASCII, + Encoding.UTF8.GetBytes(revision))).Replace('/', '_') + .Replace('\\', '_').Replace('?', '_'); string xmlFile = null; - if(!string.IsNullOrWhiteSpace(manufacturer) && !string.IsNullOrWhiteSpace(model) && !string.IsNullOrWhiteSpace(revision)) - xmlFile = manufacturer + "_" + model + "_" + revision + ".xml"; + if(!string.IsNullOrWhiteSpace(manufacturer) && !string.IsNullOrWhiteSpace(model) && + !string.IsNullOrWhiteSpace(revision)) xmlFile = manufacturer + "_" + model + "_" + revision + ".xml"; else if(!string.IsNullOrWhiteSpace(manufacturer) && !string.IsNullOrWhiteSpace(model)) xmlFile = manufacturer + "_" + model + ".xml"; else if(!string.IsNullOrWhiteSpace(model) && !string.IsNullOrWhiteSpace(revision)) xmlFile = model + "_" + revision + ".xml"; - else if(!string.IsNullOrWhiteSpace(model)) - xmlFile = model + ".xml"; + else if(!string.IsNullOrWhiteSpace(model)) xmlFile = model + ".xml"; - if(xmlFile==null || !File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Reports", xmlFile))) + if(xmlFile == null || + !File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Reports", xmlFile))) { content.InnerHtml = "Could not find the specified report"; return; @@ -83,7 +90,9 @@ namespace DiscImageChef.Server DeviceReport report = new DeviceReport(); XmlSerializer xs = new XmlSerializer(report.GetType()); - StreamReader sr = new StreamReader(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Reports", xmlFile)); + StreamReader sr = + new StreamReader(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Reports", + xmlFile)); report = (DeviceReport)xs.Deserialize(sr); sr.Close(); @@ -91,19 +100,21 @@ namespace DiscImageChef.Server { string usbVendorDescription = null; string usbProductDescription = null; - GetUsbDescriptions(report.USB.VendorID, report.USB.ProductID, out usbVendorDescription, out usbProductDescription); + GetUsbDescriptions(report.USB.VendorID, report.USB.ProductID, out usbVendorDescription, + out usbProductDescription); lblUsbManufacturer.Text = HttpUtility.HtmlEncode(report.USB.Manufacturer); lblUsbProduct.Text = HttpUtility.HtmlEncode(report.USB.Product); lblUsbVendor.Text = string.Format("0x{0:x4}", report.USB.VendorID); if(usbVendorDescription != null) - lblUsbVendorDescription.Text = string.Format("({0})", HttpUtility.HtmlEncode(usbVendorDescription)); + lblUsbVendorDescription.Text = + string.Format("({0})", HttpUtility.HtmlEncode(usbVendorDescription)); lblUsbProductId.Text = string.Format("0x{0:x4}", report.USB.ProductID); if(usbProductDescription != null) - lblUsbProductDescription.Text = string.Format("({0})", HttpUtility.HtmlEncode(usbProductDescription)); + lblUsbProductDescription.Text = + string.Format("({0})", HttpUtility.HtmlEncode(usbProductDescription)); } - else - divUsb.Visible = false; + else divUsb.Visible = false; if(report.FireWire != null) { @@ -112,8 +123,7 @@ namespace DiscImageChef.Server lblFirewireVendor.Text = string.Format("0x{0:x8}", report.FireWire.VendorID); lblFirewireProductId.Text = string.Format("0x{0:x8}", report.FireWire.ProductID); } - else - divFirewire.Visible = false; + else divFirewire.Visible = false; if(report.PCMCIA != null) { @@ -133,22 +143,38 @@ namespace DiscImageChef.Server case Decoders.PCMCIA.TupleCodes.CISTPL_NULL: case Decoders.PCMCIA.TupleCodes.CISTPL_END: case Decoders.PCMCIA.TupleCodes.CISTPL_MANFID: - case Decoders.PCMCIA.TupleCodes.CISTPL_VERS_1: - break; + case Decoders.PCMCIA.TupleCodes.CISTPL_VERS_1: break; case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICEGEO: case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICEGEO_A: - Decoders.PCMCIA.DeviceGeometryTuple geom = Decoders.PCMCIA.CIS.DecodeDeviceGeometryTuple(tuple.Data); + Decoders.PCMCIA.DeviceGeometryTuple geom = + Decoders.PCMCIA.CIS.DecodeDeviceGeometryTuple(tuple.Data); if(geom != null && geom.Geometries != null) { foreach(Decoders.PCMCIA.DeviceGeometry geometry in geom.Geometries) { - decodedTuples.Add("Device width", string.Format("{0} bits", (1 << (geometry.CardInterface - 1)) * 8)); - decodedTuples.Add("Erase block", string.Format("{0} bytes", (1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)))); - decodedTuples.Add("Read block", string.Format("{0} bytes", (1 << (geometry.ReadBlockSize - 1)) * (1 << (geometry.Interleaving - 1)))); - decodedTuples.Add("Write block", string.Format("{0} bytes", (1 << (geometry.WriteBlockSize - 1)) * (1 << (geometry.Interleaving - 1)))); - decodedTuples.Add("Partition alignment", string.Format("{0} bytes", (1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)) * (1 << (geometry.Partitions - 1)))); + decodedTuples.Add("Device width", + string.Format("{0} bits", + (1 << (geometry.CardInterface - 1)) * 8)); + decodedTuples.Add("Erase block", + string.Format("{0} bytes", + (1 << (geometry.EraseBlockSize - 1)) * + (1 << (geometry.Interleaving - 1)))); + decodedTuples.Add("Read block", + string.Format("{0} bytes", + (1 << (geometry.ReadBlockSize - 1)) * + (1 << (geometry.Interleaving - 1)))); + decodedTuples.Add("Write block", + string.Format("{0} bytes", + (1 << (geometry.WriteBlockSize - 1)) * + (1 << (geometry.Interleaving - 1)))); + decodedTuples.Add("Partition alignment", + string.Format("{0} bytes", + (1 << (geometry.EraseBlockSize - 1)) * + (1 << (geometry.Interleaving - 1)) * + (1 << (geometry.Partitions - 1)))); } } + break; case Decoders.PCMCIA.TupleCodes.CISTPL_ALTSTR: case Decoders.PCMCIA.TupleCodes.CISTPL_BAR: @@ -189,7 +215,6 @@ namespace DiscImageChef.Server default: decodedTuples.Add("Unknown tuple ID", string.Format("0x{0:X2}", (byte)tuple.Code)); break; - } } @@ -198,14 +223,11 @@ namespace DiscImageChef.Server repPcmciaTuples.DataSource = decodedTuples; repPcmciaTuples.DataBind(); } - else - repPcmciaTuples.Visible = false; + else repPcmciaTuples.Visible = false; } - else - repPcmciaTuples.Visible = false; + else repPcmciaTuples.Visible = false; } - else - divPcmcia.Visible = false; + else divPcmcia.Visible = false; bool removable = true; testedMediaType[] testedMedia = null; @@ -226,17 +248,13 @@ namespace DiscImageChef.Server ataReport = report.ATAPI; atapi = true; } - else - ataReport = report.ATA; + else ataReport = report.ATA; bool cfa = report.CompactFlashSpecified && report.CompactFlash; - if(atapi && !cfa) - lblAtaDeviceType.Text = "ATAPI device"; - else if(!atapi && cfa) - lblAtaDeviceType.Text = "CompactFlash device"; - else - lblAtaDeviceType.Text = "ATA device"; + if(atapi && !cfa) lblAtaDeviceType.Text = "ATAPI device"; + else if(!atapi && cfa) lblAtaDeviceType.Text = "CompactFlash device"; + else lblAtaDeviceType.Text = "ATA device"; Ata.Report(ataReport, cfa, atapi, ref removable, ref ataOneValue, ref ataTwoValue, ref testedMedia); @@ -245,8 +263,7 @@ namespace DiscImageChef.Server repAtaTwo.DataSource = ataTwoValue; repAtaTwo.DataBind(); } - else - divAta.Visible = false; + else divAta.Visible = false; if(report.SCSI != null) { @@ -254,32 +271,31 @@ namespace DiscImageChef.Server Dictionary modePages = new Dictionary(); Dictionary evpdPages = new Dictionary(); - if(VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification) != report.SCSI.Inquiry.VendorIdentification) - lblScsiVendor.Text = string.Format("{0} ({1})", report.SCSI.Inquiry.VendorIdentification, VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification)); - else - lblScsiVendor.Text = report.SCSI.Inquiry.VendorIdentification; + if(VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification) != + report.SCSI.Inquiry.VendorIdentification) + lblScsiVendor.Text = string.Format("{0} ({1})", report.SCSI.Inquiry.VendorIdentification, + VendorString.Prettify(report.SCSI.Inquiry + .VendorIdentification)); + else lblScsiVendor.Text = report.SCSI.Inquiry.VendorIdentification; lblScsiProduct.Text = report.SCSI.Inquiry.ProductIdentification; lblScsiRevision.Text = report.SCSI.Inquiry.ProductRevisionLevel; scsiOneValue.AddRange(ScsiInquiry.Report(report.SCSI.Inquiry)); - if(report.SCSI.SupportsModeSense6) - scsiOneValue.Add("Device supports MODE SENSE (6)"); - if(report.SCSI.SupportsModeSense10) - scsiOneValue.Add("Device supports MODE SENSE (10)"); - if(report.SCSI.SupportsModeSubpages) - scsiOneValue.Add("Device supports MODE SENSE subpages"); + if(report.SCSI.SupportsModeSense6) scsiOneValue.Add("Device supports MODE SENSE (6)"); + if(report.SCSI.SupportsModeSense10) scsiOneValue.Add("Device supports MODE SENSE (10)"); + if(report.SCSI.SupportsModeSubpages) scsiOneValue.Add("Device supports MODE SENSE subpages"); if(report.SCSI.ModeSense != null) - ScsiModeSense.Report(report.SCSI.ModeSense, report.SCSI.Inquiry.VendorIdentification, report.SCSI.Inquiry.PeripheralDeviceType, ref scsiOneValue, ref modePages); + ScsiModeSense.Report(report.SCSI.ModeSense, report.SCSI.Inquiry.VendorIdentification, + report.SCSI.Inquiry.PeripheralDeviceType, ref scsiOneValue, ref modePages); if(modePages.Count > 0) { repModeSense.DataSource = modePages; repModeSense.DataBind(); } - else - divScsiModeSense.Visible = false; + else divScsiModeSense.Visible = false; if(report.SCSI.EVPDPages != null) ScsiEvpd.Report(report.SCSI.EVPDPages, report.SCSI.Inquiry.VendorIdentification, ref evpdPages); @@ -289,8 +305,7 @@ namespace DiscImageChef.Server repEvpd.DataSource = evpdPages; repEvpd.DataBind(); } - else - divScsiEvpd.Visible = false; + else divScsiEvpd.Visible = false; divScsiMmcMode.Visible = false; divScsiMmcFeatures.Visible = false; @@ -330,84 +345,107 @@ namespace DiscImageChef.Server if(report.SCSI.SequentialDevice.BlockSizeGranularitySpecified) lblScsiSscGranularity.Text = report.SCSI.SequentialDevice.BlockSizeGranularity.ToString(); - else - lblScsiSscGranularity.Text = "Unspecified"; - + else lblScsiSscGranularity.Text = "Unspecified"; + if(report.SCSI.SequentialDevice.MaxBlockLengthSpecified) lblScsiSscMaxBlock.Text = report.SCSI.SequentialDevice.MaxBlockLength.ToString(); - else - lblScsiSscMaxBlock.Text = "Unspecified"; - + else lblScsiSscMaxBlock.Text = "Unspecified"; + if(report.SCSI.SequentialDevice.MinBlockLengthSpecified) lblScsiSscMinBlock.Text = report.SCSI.SequentialDevice.MinBlockLength.ToString(); - else - lblScsiSscMinBlock.Text = "Unspecified"; + else lblScsiSscMinBlock.Text = "Unspecified"; if(report.SCSI.SequentialDevice.SupportedDensities != null) { repScsiSscDensities.DataSource = report.SCSI.SequentialDevice.SupportedDensities; repScsiSscDensities.DataBind(); } - else - repScsiSscDensities.Visible = false; + else repScsiSscDensities.Visible = false; if(report.SCSI.SequentialDevice.SupportedMediaTypes != null) { repScsiSscMedias.DataSource = report.SCSI.SequentialDevice.SupportedMediaTypes; repScsiSscMedias.DataBind(); } - else - repScsiSscMedias.Visible = false; + else repScsiSscMedias.Visible = false; if(report.SCSI.SequentialDevice.TestedMedia != null) { List mediaOneValue = new List(); SscTestedMedia.Report(report.SCSI.SequentialDevice.TestedMedia, ref mediaOneValue); - if(mediaOneValue.Count>0) + if(mediaOneValue.Count > 0) { sscMedia = true; repTestedMedia.DataSource = mediaOneValue; repTestedMedia.DataBind(); } - else - divTestedMedia.Visible = false; + else divTestedMedia.Visible = false; } - else - divTestedMedia.Visible = false; + else divTestedMedia.Visible = false; } else if(report.SCSI.ReadCapabilities != null) { removable = false; scsiOneValue.Add(""); - if(report.SCSI.ReadCapabilities.BlocksSpecified && report.SCSI.ReadCapabilities.BlockSizeSpecified) + if(report.SCSI.ReadCapabilities.BlocksSpecified && + report.SCSI.ReadCapabilities.BlockSizeSpecified) { - scsiOneValue.Add(string.Format("Device has {0} blocks of {1} bytes each", report.SCSI.ReadCapabilities.Blocks, report.SCSI.ReadCapabilities.BlockSize)); + scsiOneValue.Add(string.Format("Device has {0} blocks of {1} bytes each", + report.SCSI.ReadCapabilities.Blocks, + report.SCSI.ReadCapabilities.BlockSize)); - if(((report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024) > 1000000) + if(((report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / + 1024) > 1000000) { - scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Tb, {2:F2} TiB", report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize, - (report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1000 / 1000 / 1000 / 1000, (double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024 / 1024)); + scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Tb, {2:F2} TiB", + report.SCSI.ReadCapabilities.Blocks * + report.SCSI.ReadCapabilities.BlockSize, + (report.SCSI.ReadCapabilities.Blocks * + report.SCSI.ReadCapabilities.BlockSize) / 1000 / 1000 / + 1000 / 1000, + (double)(report.SCSI.ReadCapabilities.Blocks * + report.SCSI.ReadCapabilities.BlockSize) / 1024 / + 1024 / 1024 / 1024)); } - else if(((report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024) > 1000) + else if( + ((report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / + 1024) > 1000) { - scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Gb, {2:F2} GiB", report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize, - (report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1000 / 1000 / 1000, (double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024)); + scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Gb, {2:F2} GiB", + report.SCSI.ReadCapabilities.Blocks * + report.SCSI.ReadCapabilities.BlockSize, + (report.SCSI.ReadCapabilities.Blocks * + report.SCSI.ReadCapabilities.BlockSize) / 1000 / 1000 / + 1000, + (double)(report.SCSI.ReadCapabilities.Blocks * + report.SCSI.ReadCapabilities.BlockSize) / 1024 / + 1024 / 1024)); } else { - scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Mb, {2:F2} MiB", report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize, - (report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1000 / 1000, (double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024)); + scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Mb, {2:F2} MiB", + report.SCSI.ReadCapabilities.Blocks * + report.SCSI.ReadCapabilities.BlockSize, + (report.SCSI.ReadCapabilities.Blocks * + report.SCSI.ReadCapabilities.BlockSize) / 1000 / 1000, + (double)(report.SCSI.ReadCapabilities.Blocks * + report.SCSI.ReadCapabilities.BlockSize) / 1024 / + 1024)); } } if(report.SCSI.ReadCapabilities.MediumTypeSpecified) - scsiOneValue.Add(string.Format("Medium type code: {0:X2}h", report.SCSI.ReadCapabilities.MediumType)); + scsiOneValue.Add(string.Format("Medium type code: {0:X2}h", + report.SCSI.ReadCapabilities.MediumType)); if(report.SCSI.ReadCapabilities.DensitySpecified) - scsiOneValue.Add(string.Format("Density code: {0:X2}h", report.SCSI.ReadCapabilities.Density)); - if((report.SCSI.ReadCapabilities.SupportsReadLong || report.SCSI.ReadCapabilities.SupportsReadLong16) && + scsiOneValue.Add(string.Format("Density code: {0:X2}h", + report.SCSI.ReadCapabilities.Density)); + if((report.SCSI.ReadCapabilities.SupportsReadLong || + report.SCSI.ReadCapabilities.SupportsReadLong16) && report.SCSI.ReadCapabilities.LongBlockSizeSpecified) - scsiOneValue.Add(string.Format("Long block size: {0} bytes", report.SCSI.ReadCapabilities.LongBlockSize)); + scsiOneValue.Add(string.Format("Long block size: {0} bytes", + report.SCSI.ReadCapabilities.LongBlockSize)); if(report.SCSI.ReadCapabilities.SupportsReadCapacity) scsiOneValue.Add("Device supports READ CAPACITY (10) command."); if(report.SCSI.ReadCapabilities.SupportsReadCapacity16) @@ -425,14 +463,12 @@ namespace DiscImageChef.Server if(report.SCSI.ReadCapabilities.SupportsReadLong16) scsiOneValue.Add("Device supports READ LONG (16) command."); } - else - testedMedia = report.SCSI.RemovableMedias; + else testedMedia = report.SCSI.RemovableMedias; repScsi.DataSource = scsiOneValue; repScsi.DataBind(); } - else - divScsi.Visible = false; + else divScsi.Visible = false; if(report.MultiMediaCard != null) { @@ -440,33 +476,36 @@ namespace DiscImageChef.Server if(report.MultiMediaCard.CID != null) { - mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCID(report.MultiMediaCard.CID).Replace("\n", "
")); + mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCID(report.MultiMediaCard.CID) + .Replace("\n", "
")); mmcOneValue.Add(""); } if(report.MultiMediaCard.CSD != null) { - mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.CSD).Replace("\n", "
")); + mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.CSD) + .Replace("\n", "
")); mmcOneValue.Add(""); } if(report.MultiMediaCard.ExtendedCSD != null) { - mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyExtendedCSD(report.MultiMediaCard.ExtendedCSD).Replace("\n", "
")); + mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyExtendedCSD(report.MultiMediaCard.ExtendedCSD) + .Replace("\n", "
")); mmcOneValue.Add(""); } if(report.MultiMediaCard.OCR != null) { - mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.OCR).Replace("\n", "
")); + mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.OCR) + .Replace("\n", "
")); mmcOneValue.Add(""); } repMMC.DataSource = mmcOneValue; repMMC.DataBind(); } - else - divMMC.Visible = false; + else divMMC.Visible = false; if(report.SecureDigital != null) { @@ -474,35 +513,38 @@ namespace DiscImageChef.Server if(report.SecureDigital.CID != null) { - sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCID(report.SecureDigital.CID).Replace("\n", "
")); + sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCID(report.SecureDigital.CID) + .Replace("\n", "
")); sdOneValue.Add(""); } if(report.SecureDigital.CSD != null) { - sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.CSD).Replace("\n", "
")); + sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.CSD) + .Replace("\n", "
")); sdOneValue.Add(""); } if(report.SecureDigital.SCR != null) { - sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifySCR(report.SecureDigital.SCR).Replace("\n", "
")); + sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifySCR(report.SecureDigital.SCR) + .Replace("\n", "
")); sdOneValue.Add(""); } if(report.SecureDigital.OCR != null) { - sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.OCR).Replace("\n", "
")); + sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.OCR) + .Replace("\n", "
")); sdOneValue.Add(""); } repSD.DataSource = sdOneValue; repSD.DataBind(); } - else - divSD.Visible = false; + else divSD.Visible = false; - if(removable && !sscMedia && testedMedia!=null) + if(removable && !sscMedia && testedMedia != null) { List mediaOneValue = new List(); TestedMedia.Report(testedMedia, ata, ref mediaOneValue); @@ -512,8 +554,7 @@ namespace DiscImageChef.Server repTestedMedia.DataSource = mediaOneValue; repTestedMedia.DataBind(); } - else - divTestedMedia.Visible = false; + else divTestedMedia.Visible = false; } else divTestedMedia.Visible &= sscMedia; } @@ -526,15 +567,16 @@ namespace DiscImageChef.Server } } - static void GetUsbDescriptions(ushort vendor, ushort product, out string vendorDescription, out string productDescription) + static void GetUsbDescriptions(ushort vendor, ushort product, out string vendorDescription, + out string productDescription) { vendorDescription = null; productDescription = null; - if(!File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "usb.ids"))) - return; + if(!File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "usb.ids"))) return; - StreamReader tocStream = new StreamReader(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "usb.ids")); + StreamReader tocStream = + new StreamReader(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "usb.ids")); string _line; bool inManufacturer = false; ushort number; @@ -543,14 +585,12 @@ namespace DiscImageChef.Server { _line = tocStream.ReadLine(); - if(_line.Length == 0 || _line[0] == '#') - continue; + if(_line.Length == 0 || _line[0] == '#') continue; if(inManufacturer) { // Finished with the manufacturer - if(_line[0] != '\t') - return; + if(_line[0] != '\t') return; number = Convert.ToUInt16(_line.Substring(1, 4), 16); @@ -563,17 +603,10 @@ namespace DiscImageChef.Server else { // Skip products - if(_line[0] == '\t') - continue; + if(_line[0] == '\t') continue; - try - { - number = Convert.ToUInt16(_line.Substring(0, 4), 16); - } - catch(FormatException) - { - continue; - } + try { number = Convert.ToUInt16(_line.Substring(0, 4), 16); } + catch(FormatException) { continue; } if(number == vendor) { @@ -584,4 +617,4 @@ namespace DiscImageChef.Server } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/Web.config b/DiscImageChef.Server/Web.config index 75ebfeb2..3e2688fc 100644 --- a/DiscImageChef.Server/Web.config +++ b/DiscImageChef.Server/Web.config @@ -1,4 +1,5 @@  + - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/DiscImageChef.Server/dos.css b/DiscImageChef.Server/dos.css index 8415a6aa..ed5ceb2f 100644 --- a/DiscImageChef.Server/dos.css +++ b/DiscImageChef.Server/dos.css @@ -1,117 +1,132 @@ @font-face { - font-family: 'VGAsquarePx'; - src: url(int10h.org/vga_squarepx.eot); - src: url(int10h.org/vga_squarepx.eot?#iefix) format('embedded-opentype'), - url(int10h.org/vga_squarepx.woff2) format('woff2'), - url(int10h.org/vga_squarepx.woff) format('woff'), - url(int10h.org/vga_squarepx.ttf) format('truetype'); - font-weight: normal; - font-style: normal; + font-family: 'VGAsquarePx'; + src: url(int10h.org/vga_squarepx.eot); + src: url(int10h.org/vga_squarepx.eot?#iefix) format('embedded-opentype'), + url(int10h.org/vga_squarepx.woff2) format('woff2'), + url(int10h.org/vga_squarepx.woff) format('woff'), + url(int10h.org/vga_squarepx.ttf) format('truetype'); + font-weight: normal; + font-style: normal; } + /* define a black "stipple" background with DOS font */ + body { - background: - radial-gradient(black 15%, transparent 16%) 0 0, - radial-gradient(black 15%, transparent 16%) 8px 8px, - radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 0 1px, - radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 8px 9px; - background-color:#282828; - background-size:16px 16px; - color: #aaa; - font-family: 'VGAsquarePx', serif; - font-size: 20pt; - margin: 0; + background: + radial-gradient(black 15%, transparent 16%) 0 0, + radial-gradient(black 15%, transparent 16%) 8px 8px, + radial-gradient(rgba(255, 255, 255, .1) 15%, transparent 20%) 0 1px, + radial-gradient(rgba(255, 255, 255, .1) 15%, transparent 20%) 8px 9px; + background-color: #282828; + background-size: 16px 16px; + color: #aaa; + font-family: 'VGAsquarePx', serif; + font-size: 20pt; + margin: 0; } + /* links are cyan, hover is bright yellow */ + a { - color: #0aa; - text-decoration: none; -} -a:hover { - color: #ff5; + color: #0aa; + text-decoration: none; } + +a:hover { color: #ff5; } + /* headings and bold text are bright white */ -h1,h2,h3,h4, + +h1, h2, h3, h4, b, strong { - color: #fff; - font-size: 1em; - font-style: normal; - font-weight: normal; - margin: 0; + color: #fff; + font-size: 1em; + font-style: normal; + font-weight: normal; + margin: 0; } + /* italic text is green */ + em, i { - color: #0a0; - font-style: normal; + color: #0a0; + font-style: normal; } + /* define content areas */ + header, main, footer { - margin: 0 auto; - padding: 1em 0; - max-width: 800px; + margin: 0 auto; + padding: 1em 0; + max-width: 800px; } + /* use black on cyan text for header */ + header { - background-color: #0aa; - color: #000; + background-color: #0aa; + color: #000; } - /* insert the "April 1st" text */ - header > h1::before { - content: "Today is April 1, 2017!"; - } - header > h1 img { + +/* insert the "April 1st" text */ + +header > h1::before { content: "Today is April 1, 2017!"; } + +header > h1 img { display: block; width: 300px; - } - header > form { - } - header > form fieldset { - border: none; - } - /* use black on gray for navigation */ - nav { +} + +header > form { } + +header > form fieldset { border: none; } + +/* use black on gray for navigation */ + +nav { background-color: #aaa; color: #000; - } - nav a { - color: #000; - } - nav img { - display: none; - } - nav span { - } - nav > ul { - list-style-type: none; - margin: 0; - padding: 0; - text-align: center; - } - nav > ul li { - display: inline; - margin: 0 .5em; - } +} + +nav a { color: #000; } + +nav img { display: none; } + +nav span { } + +nav > ul { + list-style-type: none; + margin: 0; + padding: 0; + text-align: center; +} + +nav > ul li { + display: inline; + margin: 0 .5em; +} + /* use white on blue for main text */ + main { - background-color: #00a; - color: #aaa; + background-color: #00a; + color: #aaa; } - main > nav { - } - main > nav li::before { - content: ">"; - } - main > section { - } - main div.third img { - display: block; - } + +main > nav { } + +main > nav li::before { content: ">"; } + +main > section { } + +main div.third img { display: block; } + /* use black on brown text for footer */ + footer { - background-color: #a50; - color: #000; + background-color: #a50; + color: #000; } - footer > nav { - } - footer > section { - } \ No newline at end of file + +footer > nav { } + +footer > section { } \ No newline at end of file diff --git a/DiscImageChef.Server/packages.config b/DiscImageChef.Server/packages.config index 61d303dc..26570dec 100644 --- a/DiscImageChef.Server/packages.config +++ b/DiscImageChef.Server/packages.config @@ -1,9 +1,10 @@  + - - - - - - + + + + + + \ No newline at end of file diff --git a/DiscImageChef.Settings/Properties/AssemblyInfo.cs b/DiscImageChef.Settings/Properties/AssemblyInfo.cs index 85d1df51..1f5f3fd3 100644 --- a/DiscImageChef.Settings/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Settings/Properties/AssemblyInfo.cs @@ -54,5 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Settings/Settings.cs b/DiscImageChef.Settings/Settings.cs index bf5929bc..c749aa6f 100644 --- a/DiscImageChef.Settings/Settings.cs +++ b/DiscImageChef.Settings/Settings.cs @@ -75,18 +75,12 @@ namespace DiscImageChef.Settings public static string ReportsPath { - get - { - return reportsPath; - } + get { return reportsPath; } } public static string StatsPath { - get - { - return statsPath; - } + get { return statsPath; } } public static void LoadSettings() @@ -100,72 +94,63 @@ namespace DiscImageChef.Settings { case Interop.PlatformID.MacOSX: case Interop.PlatformID.iOS: - { - string appSupportPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Application Support", "Claunia.com"); - if(!Directory.Exists(appSupportPath)) - Directory.CreateDirectory(appSupportPath); + { + string appSupportPath = + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", + "Application Support", "Claunia.com"); + if(!Directory.Exists(appSupportPath)) Directory.CreateDirectory(appSupportPath); - string dicPath = Path.Combine(appSupportPath, "DiscImageChef"); - if(!Directory.Exists(dicPath)) - Directory.CreateDirectory(dicPath); + string dicPath = Path.Combine(appSupportPath, "DiscImageChef"); + if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath); - reportsPath = Path.Combine(dicPath, "Reports"); - if(!Directory.Exists(reportsPath)) - Directory.CreateDirectory(reportsPath); + reportsPath = Path.Combine(dicPath, "Reports"); + if(!Directory.Exists(reportsPath)) Directory.CreateDirectory(reportsPath); - statsPath = Path.Combine(dicPath, "Statistics"); - if(!Directory.Exists(statsPath)) - Directory.CreateDirectory(statsPath); - } + statsPath = Path.Combine(dicPath, "Statistics"); + if(!Directory.Exists(statsPath)) Directory.CreateDirectory(statsPath); + } break; case Interop.PlatformID.Win32NT: case Interop.PlatformID.Win32S: case Interop.PlatformID.Win32Windows: case Interop.PlatformID.WinCE: case Interop.PlatformID.WindowsPhone: - { - string appSupportPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Claunia.com"); - if(!Directory.Exists(appSupportPath)) - Directory.CreateDirectory(appSupportPath); + { + string appSupportPath = + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), + "Claunia.com"); + if(!Directory.Exists(appSupportPath)) Directory.CreateDirectory(appSupportPath); - string dicPath = Path.Combine(appSupportPath, "DiscImageChef"); - if(!Directory.Exists(dicPath)) - Directory.CreateDirectory(dicPath); + string dicPath = Path.Combine(appSupportPath, "DiscImageChef"); + if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath); - reportsPath = Path.Combine(dicPath, "Reports"); - if(!Directory.Exists(reportsPath)) - Directory.CreateDirectory(reportsPath); + reportsPath = Path.Combine(dicPath, "Reports"); + if(!Directory.Exists(reportsPath)) Directory.CreateDirectory(reportsPath); - statsPath = Path.Combine(dicPath, "Statistics"); - if(!Directory.Exists(statsPath)) - Directory.CreateDirectory(statsPath); - } + statsPath = Path.Combine(dicPath, "Statistics"); + if(!Directory.Exists(statsPath)) Directory.CreateDirectory(statsPath); + } break; default: - { - string appSupportPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".claunia.com"); - if(!Directory.Exists(appSupportPath)) - Directory.CreateDirectory(appSupportPath); + { + string appSupportPath = + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), + ".claunia.com"); + if(!Directory.Exists(appSupportPath)) Directory.CreateDirectory(appSupportPath); - string dicPath = Path.Combine(appSupportPath, "DiscImageChef"); - if(!Directory.Exists(dicPath)) - Directory.CreateDirectory(dicPath); + string dicPath = Path.Combine(appSupportPath, "DiscImageChef"); + if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath); - reportsPath = Path.Combine(dicPath, "Reports"); - if(!Directory.Exists(reportsPath)) - Directory.CreateDirectory(reportsPath); + reportsPath = Path.Combine(dicPath, "Reports"); + if(!Directory.Exists(reportsPath)) Directory.CreateDirectory(reportsPath); - statsPath = Path.Combine(dicPath, "Statistics"); - if(!Directory.Exists(statsPath)) - Directory.CreateDirectory(statsPath); - } + statsPath = Path.Combine(dicPath, "Statistics"); + if(!Directory.Exists(statsPath)) Directory.CreateDirectory(statsPath); + } break; } } - catch - { - reportsPath = null; - } + catch { reportsPath = null; } FileStream prefsFs = null; StreamReader prefsSr = null; @@ -176,208 +161,196 @@ namespace DiscImageChef.Settings { case Interop.PlatformID.MacOSX: case Interop.PlatformID.iOS: + { + string preferencesPath = + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", + "Preferences"); + string preferencesFilePath = Path.Combine(preferencesPath, "com.claunia.discimagechef.plist"); + + if(!File.Exists(preferencesFilePath)) { - string preferencesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Preferences"); - string preferencesFilePath = Path.Combine(preferencesPath, "com.claunia.discimagechef.plist"); - - if(!File.Exists(preferencesFilePath)) - { - SetDefaultSettings(); - SaveSettings(); - } - - prefsFs = new FileStream(preferencesFilePath, FileMode.Open, FileAccess.Read); - - NSDictionary parsedPreferences = (NSDictionary)BinaryPropertyListParser.Parse(prefsFs); - if(parsedPreferences != null) - { - NSObject obj; - - if(parsedPreferences.TryGetValue("SaveReportsGlobally", out obj)) - { - Current.SaveReportsGlobally = ((NSNumber)obj).ToBool(); - } - else - Current.SaveReportsGlobally = false; - - if(parsedPreferences.TryGetValue("ShareReports", out obj)) - { - Current.ShareReports = ((NSNumber)obj).ToBool(); - } - else - Current.ShareReports = false; - - NSDictionary stats; - if(parsedPreferences.TryGetValue("Stats", out obj)) - { - stats = (NSDictionary)obj; - - if(stats != null) - { - NSObject obj2; - Current.Stats = new StatsSettings(); - - if(stats.TryGetValue("ShareStats", out obj2)) - { - Current.Stats.ShareStats = ((NSNumber)obj2).ToBool(); - } - else - Current.Stats.ShareStats = false; - - if(stats.TryGetValue("BenchmarkStats", out obj2)) - { - Current.Stats.BenchmarkStats = ((NSNumber)obj2).ToBool(); - } - else - Current.Stats.BenchmarkStats = false; - - if(stats.TryGetValue("CommandStats", out obj2)) - { - Current.Stats.CommandStats = ((NSNumber)obj2).ToBool(); - } - else - Current.Stats.CommandStats = false; - - if(stats.TryGetValue("DeviceStats", out obj2)) - { - Current.Stats.DeviceStats = ((NSNumber)obj2).ToBool(); - } - else - Current.Stats.DeviceStats = false; - - if(stats.TryGetValue("FilesystemStats", out obj2)) - { - Current.Stats.FilesystemStats = ((NSNumber)obj2).ToBool(); - } - else - Current.Stats.FilesystemStats = false; - - if(stats.TryGetValue("FilterStats", out obj2)) - { - Current.Stats.FilterStats = ((NSNumber)obj2).ToBool(); - } - else - Current.Stats.FilterStats = false; - - if(stats.TryGetValue("MediaImageStats", out obj2)) - { - Current.Stats.MediaImageStats = ((NSNumber)obj2).ToBool(); - } - else - Current.Stats.MediaImageStats = false; - - if(stats.TryGetValue("MediaScanStats", out obj2)) - { - Current.Stats.MediaScanStats = ((NSNumber)obj2).ToBool(); - } - else - Current.Stats.MediaScanStats = false; - - if(stats.TryGetValue("PartitionStats", out obj2)) - { - Current.Stats.PartitionStats = ((NSNumber)obj2).ToBool(); - } - else - Current.Stats.PartitionStats = false; - - if(stats.TryGetValue("MediaStats", out obj2)) - { - Current.Stats.MediaStats = ((NSNumber)obj2).ToBool(); - } - else - Current.Stats.MediaStats = false; - - if(stats.TryGetValue("VerifyStats", out obj2)) - { - Current.Stats.VerifyStats = ((NSNumber)obj2).ToBool(); - } - else - Current.Stats.VerifyStats = false; - - } - } - else - Current.Stats = null; - - prefsFs.Close(); - } - else - { - prefsFs.Close(); - - SetDefaultSettings(); - SaveSettings(); - } + SetDefaultSettings(); + SaveSettings(); } + + prefsFs = new FileStream(preferencesFilePath, FileMode.Open, FileAccess.Read); + + NSDictionary parsedPreferences = (NSDictionary)BinaryPropertyListParser.Parse(prefsFs); + if(parsedPreferences != null) + { + NSObject obj; + + if(parsedPreferences.TryGetValue("SaveReportsGlobally", out obj)) + { + Current.SaveReportsGlobally = ((NSNumber)obj).ToBool(); + } + else Current.SaveReportsGlobally = false; + + if(parsedPreferences.TryGetValue("ShareReports", out obj)) + { + Current.ShareReports = ((NSNumber)obj).ToBool(); + } + else Current.ShareReports = false; + + NSDictionary stats; + if(parsedPreferences.TryGetValue("Stats", out obj)) + { + stats = (NSDictionary)obj; + + if(stats != null) + { + NSObject obj2; + Current.Stats = new StatsSettings(); + + if(stats.TryGetValue("ShareStats", out obj2)) + { + Current.Stats.ShareStats = ((NSNumber)obj2).ToBool(); + } + else Current.Stats.ShareStats = false; + + if(stats.TryGetValue("BenchmarkStats", out obj2)) + { + Current.Stats.BenchmarkStats = ((NSNumber)obj2).ToBool(); + } + else Current.Stats.BenchmarkStats = false; + + if(stats.TryGetValue("CommandStats", out obj2)) + { + Current.Stats.CommandStats = ((NSNumber)obj2).ToBool(); + } + else Current.Stats.CommandStats = false; + + if(stats.TryGetValue("DeviceStats", out obj2)) + { + Current.Stats.DeviceStats = ((NSNumber)obj2).ToBool(); + } + else Current.Stats.DeviceStats = false; + + if(stats.TryGetValue("FilesystemStats", out obj2)) + { + Current.Stats.FilesystemStats = ((NSNumber)obj2).ToBool(); + } + else Current.Stats.FilesystemStats = false; + + if(stats.TryGetValue("FilterStats", out obj2)) + { + Current.Stats.FilterStats = ((NSNumber)obj2).ToBool(); + } + else Current.Stats.FilterStats = false; + + if(stats.TryGetValue("MediaImageStats", out obj2)) + { + Current.Stats.MediaImageStats = ((NSNumber)obj2).ToBool(); + } + else Current.Stats.MediaImageStats = false; + + if(stats.TryGetValue("MediaScanStats", out obj2)) + { + Current.Stats.MediaScanStats = ((NSNumber)obj2).ToBool(); + } + else Current.Stats.MediaScanStats = false; + + if(stats.TryGetValue("PartitionStats", out obj2)) + { + Current.Stats.PartitionStats = ((NSNumber)obj2).ToBool(); + } + else Current.Stats.PartitionStats = false; + + if(stats.TryGetValue("MediaStats", out obj2)) + { + Current.Stats.MediaStats = ((NSNumber)obj2).ToBool(); + } + else Current.Stats.MediaStats = false; + + if(stats.TryGetValue("VerifyStats", out obj2)) + { + Current.Stats.VerifyStats = ((NSNumber)obj2).ToBool(); + } + else Current.Stats.VerifyStats = false; + } + } + else Current.Stats = null; + + prefsFs.Close(); + } + else + { + prefsFs.Close(); + + SetDefaultSettings(); + SaveSettings(); + } + } break; case Interop.PlatformID.Win32NT: case Interop.PlatformID.Win32S: case Interop.PlatformID.Win32Windows: case Interop.PlatformID.WinCE: case Interop.PlatformID.WindowsPhone: + { + RegistryKey parentKey = Registry.CurrentUser.OpenSubKey("SOFTWARE").OpenSubKey("Claunia.com"); + if(parentKey == null) { - RegistryKey parentKey = Registry.CurrentUser.OpenSubKey("SOFTWARE").OpenSubKey("Claunia.com"); - if(parentKey == null) - { - SetDefaultSettings(); - SaveSettings(); - return; - } - - RegistryKey key = parentKey.OpenSubKey("DiscImageChef"); - if(key == null) - { - SetDefaultSettings(); - SaveSettings(); - return; - } - - Current.SaveReportsGlobally = Convert.ToBoolean(key.GetValue("SaveReportsGlobally")); - Current.ShareReports = Convert.ToBoolean(key.GetValue("ShareReports")); - - bool stats = Convert.ToBoolean(key.GetValue("Statistics")); - if(stats) - { - Current.Stats = new StatsSettings(); - Current.Stats.ShareStats = Convert.ToBoolean(key.GetValue("ShareStats")); - Current.Stats.BenchmarkStats = Convert.ToBoolean(key.GetValue("BenchmarkStats")); - Current.Stats.CommandStats = Convert.ToBoolean(key.GetValue("CommandStats")); - Current.Stats.DeviceStats = Convert.ToBoolean(key.GetValue("DeviceStats")); - Current.Stats.FilesystemStats = Convert.ToBoolean(key.GetValue("FilesystemStats")); - Current.Stats.FilterStats = Convert.ToBoolean(key.GetValue("FilterStats")); - Current.Stats.MediaImageStats = Convert.ToBoolean(key.GetValue("MediaImageStats")); - Current.Stats.MediaScanStats = Convert.ToBoolean(key.GetValue("MediaScanStats")); - Current.Stats.PartitionStats = Convert.ToBoolean(key.GetValue("PartitionStats")); - Current.Stats.MediaStats = Convert.ToBoolean(key.GetValue("MediaStats")); - Current.Stats.VerifyStats = Convert.ToBoolean(key.GetValue("VerifyStats")); - } + SetDefaultSettings(); + SaveSettings(); + return; } + + RegistryKey key = parentKey.OpenSubKey("DiscImageChef"); + if(key == null) + { + SetDefaultSettings(); + SaveSettings(); + return; + } + + Current.SaveReportsGlobally = Convert.ToBoolean(key.GetValue("SaveReportsGlobally")); + Current.ShareReports = Convert.ToBoolean(key.GetValue("ShareReports")); + + bool stats = Convert.ToBoolean(key.GetValue("Statistics")); + if(stats) + { + Current.Stats = new StatsSettings(); + Current.Stats.ShareStats = Convert.ToBoolean(key.GetValue("ShareStats")); + Current.Stats.BenchmarkStats = Convert.ToBoolean(key.GetValue("BenchmarkStats")); + Current.Stats.CommandStats = Convert.ToBoolean(key.GetValue("CommandStats")); + Current.Stats.DeviceStats = Convert.ToBoolean(key.GetValue("DeviceStats")); + Current.Stats.FilesystemStats = Convert.ToBoolean(key.GetValue("FilesystemStats")); + Current.Stats.FilterStats = Convert.ToBoolean(key.GetValue("FilterStats")); + Current.Stats.MediaImageStats = Convert.ToBoolean(key.GetValue("MediaImageStats")); + Current.Stats.MediaScanStats = Convert.ToBoolean(key.GetValue("MediaScanStats")); + Current.Stats.PartitionStats = Convert.ToBoolean(key.GetValue("PartitionStats")); + Current.Stats.MediaStats = Convert.ToBoolean(key.GetValue("MediaStats")); + Current.Stats.VerifyStats = Convert.ToBoolean(key.GetValue("VerifyStats")); + } + } + break; default: + { + string configPath = + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config"); + string settingsPath = Path.Combine(configPath, "DiscImageChef.xml"); + + if(!Directory.Exists(configPath)) { - string configPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config"); - string settingsPath = Path.Combine(configPath, "DiscImageChef.xml"); - - if(!Directory.Exists(configPath)) - { - SetDefaultSettings(); - SaveSettings(); - return; - } - - XmlSerializer xs = new XmlSerializer(Current.GetType()); - prefsSr = new StreamReader(settingsPath); - Current = (DicSettings)xs.Deserialize(prefsSr); + SetDefaultSettings(); + SaveSettings(); + return; } + + XmlSerializer xs = new XmlSerializer(Current.GetType()); + prefsSr = new StreamReader(settingsPath); + Current = (DicSettings)xs.Deserialize(prefsSr); + } + break; } } catch { - if(prefsFs != null) - prefsFs.Close(); - if(prefsSr != null) - prefsSr.Close(); + if(prefsFs != null) prefsFs.Close(); + if(prefsSr != null) prefsSr.Close(); SetDefaultSettings(); SaveSettings(); } @@ -393,99 +366,100 @@ namespace DiscImageChef.Settings { case Interop.PlatformID.MacOSX: case Interop.PlatformID.iOS: + { + NSDictionary root = new NSDictionary(); + root.Add("SaveReportsGlobally", Current.SaveReportsGlobally); + root.Add("ShareReports", Current.ShareReports); + if(Current.Stats != null) { - NSDictionary root = new NSDictionary(); - root.Add("SaveReportsGlobally", Current.SaveReportsGlobally); - root.Add("ShareReports", Current.ShareReports); - if(Current.Stats != null) - { - NSDictionary stats = new NSDictionary(); - stats.Add("ShareStats", Current.Stats.ShareStats); - stats.Add("BenchmarkStats", Current.Stats.BenchmarkStats); - stats.Add("CommandStats", Current.Stats.CommandStats); - stats.Add("DeviceStats", Current.Stats.DeviceStats); - stats.Add("FilesystemStats", Current.Stats.FilesystemStats); - stats.Add("FilterStats", Current.Stats.FilterStats); - stats.Add("MediaImageStats", Current.Stats.MediaImageStats); - stats.Add("MediaScanStats", Current.Stats.MediaScanStats); - stats.Add("PartitionStats", Current.Stats.PartitionStats); - stats.Add("MediaStats", Current.Stats.MediaStats); - stats.Add("VerifyStats", Current.Stats.VerifyStats); - root.Add("Stats", stats); - } - - string preferencesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Preferences"); - string preferencesFilePath = Path.Combine(preferencesPath, "com.claunia.discimagechef.plist"); - - FileStream fs = new FileStream(preferencesFilePath, FileMode.Create); - BinaryPropertyListWriter.Write(fs, root); - fs.Close(); + NSDictionary stats = new NSDictionary(); + stats.Add("ShareStats", Current.Stats.ShareStats); + stats.Add("BenchmarkStats", Current.Stats.BenchmarkStats); + stats.Add("CommandStats", Current.Stats.CommandStats); + stats.Add("DeviceStats", Current.Stats.DeviceStats); + stats.Add("FilesystemStats", Current.Stats.FilesystemStats); + stats.Add("FilterStats", Current.Stats.FilterStats); + stats.Add("MediaImageStats", Current.Stats.MediaImageStats); + stats.Add("MediaScanStats", Current.Stats.MediaScanStats); + stats.Add("PartitionStats", Current.Stats.PartitionStats); + stats.Add("MediaStats", Current.Stats.MediaStats); + stats.Add("VerifyStats", Current.Stats.VerifyStats); + root.Add("Stats", stats); } + + string preferencesPath = + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", + "Preferences"); + string preferencesFilePath = Path.Combine(preferencesPath, "com.claunia.discimagechef.plist"); + + FileStream fs = new FileStream(preferencesFilePath, FileMode.Create); + BinaryPropertyListWriter.Write(fs, root); + fs.Close(); + } break; case Interop.PlatformID.Win32NT: case Interop.PlatformID.Win32S: case Interop.PlatformID.Win32Windows: case Interop.PlatformID.WinCE: case Interop.PlatformID.WindowsPhone: + { + RegistryKey parentKey = + Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("Claunia.com"); + RegistryKey key = parentKey.CreateSubKey("DiscImageChef"); + + key.SetValue("SaveReportsGlobally", Current.SaveReportsGlobally); + key.SetValue("ShareReports", Current.ShareReports); + + if(Current.Stats != null) { - RegistryKey parentKey = Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("Claunia.com"); - RegistryKey key = parentKey.CreateSubKey("DiscImageChef"); - - key.SetValue("SaveReportsGlobally", Current.SaveReportsGlobally); - key.SetValue("ShareReports", Current.ShareReports); - - if(Current.Stats != null) - { - key.SetValue("Statistics", true); - key.SetValue("ShareStats", Current.Stats.ShareStats); - key.SetValue("BenchmarkStats", Current.Stats.BenchmarkStats); - key.SetValue("CommandStats", Current.Stats.CommandStats); - key.SetValue("DeviceStats", Current.Stats.DeviceStats); - key.SetValue("FilesystemStats", Current.Stats.FilesystemStats); - key.SetValue("FilterStats", Current.Stats.FilterStats); - key.SetValue("MediaImageStats", Current.Stats.MediaImageStats); - key.SetValue("MediaScanStats", Current.Stats.MediaScanStats); - key.SetValue("PartitionStats", Current.Stats.PartitionStats); - key.SetValue("MediaStats", Current.Stats.MediaStats); - key.SetValue("VerifyStats", Current.Stats.VerifyStats); - } - else - { - key.SetValue("Statistics", true); - key.DeleteValue("ShareStats", false); - key.DeleteValue("BenchmarkStats", false); - key.DeleteValue("CommandStats", false); - key.DeleteValue("DeviceStats", false); - key.DeleteValue("FilesystemStats", false); - key.DeleteValue("MediaImageStats", false); - key.DeleteValue("MediaScanStats", false); - key.DeleteValue("PartitionStats", false); - key.DeleteValue("MediaStats", false); - key.DeleteValue("VerifyStats", false); - } + key.SetValue("Statistics", true); + key.SetValue("ShareStats", Current.Stats.ShareStats); + key.SetValue("BenchmarkStats", Current.Stats.BenchmarkStats); + key.SetValue("CommandStats", Current.Stats.CommandStats); + key.SetValue("DeviceStats", Current.Stats.DeviceStats); + key.SetValue("FilesystemStats", Current.Stats.FilesystemStats); + key.SetValue("FilterStats", Current.Stats.FilterStats); + key.SetValue("MediaImageStats", Current.Stats.MediaImageStats); + key.SetValue("MediaScanStats", Current.Stats.MediaScanStats); + key.SetValue("PartitionStats", Current.Stats.PartitionStats); + key.SetValue("MediaStats", Current.Stats.MediaStats); + key.SetValue("VerifyStats", Current.Stats.VerifyStats); } + else + { + key.SetValue("Statistics", true); + key.DeleteValue("ShareStats", false); + key.DeleteValue("BenchmarkStats", false); + key.DeleteValue("CommandStats", false); + key.DeleteValue("DeviceStats", false); + key.DeleteValue("FilesystemStats", false); + key.DeleteValue("MediaImageStats", false); + key.DeleteValue("MediaScanStats", false); + key.DeleteValue("PartitionStats", false); + key.DeleteValue("MediaStats", false); + key.DeleteValue("VerifyStats", false); + } + } break; default: - { - string configPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config"); - string settingsPath = Path.Combine(configPath, "DiscImageChef.xml"); + { + string configPath = + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config"); + string settingsPath = Path.Combine(configPath, "DiscImageChef.xml"); - if(!Directory.Exists(configPath)) - Directory.CreateDirectory(configPath); + if(!Directory.Exists(configPath)) Directory.CreateDirectory(configPath); - FileStream fs = new FileStream(settingsPath, FileMode.Create); - XmlSerializer xs = new XmlSerializer(Current.GetType()); - xs.Serialize(fs, Current); - fs.Close(); - } + FileStream fs = new FileStream(settingsPath, FileMode.Create); + XmlSerializer xs = new XmlSerializer(Current.GetType()); + xs.Serialize(fs, Current); + fs.Close(); + } break; } } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - catch -#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body - { - } + catch { } +#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body } public static void SetDefaultSettings() @@ -507,5 +481,4 @@ namespace DiscImageChef.Settings Current.Stats.VerifyStats = true; } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Settings/packages.config b/DiscImageChef.Settings/packages.config index b24c08c8..1c45f7ec 100644 --- a/DiscImageChef.Settings/packages.config +++ b/DiscImageChef.Settings/packages.config @@ -1,4 +1,5 @@  + - + \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/ATA.cs b/DiscImageChef.Tests.Devices/ATA.cs index b31dd974..f90f5ad5 100644 --- a/DiscImageChef.Tests.Devices/ATA.cs +++ b/DiscImageChef.Tests.Devices/ATA.cs @@ -93,4 +93,4 @@ namespace DiscImageChef.Tests.Devices } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/ATA/Ata28.cs b/DiscImageChef.Tests.Devices/ATA/Ata28.cs index 6e66e50f..ea189e36 100644 --- a/DiscImageChef.Tests.Devices/ATA/Ata28.cs +++ b/DiscImageChef.Tests.Devices/ATA/Ata28.cs @@ -111,11 +111,12 @@ namespace DiscImageChef.Tests.Devices.ATA static void ReadBuffer(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.ReadBuffer(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, out double duration); + bool sense = dev.ReadBuffer(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ BUFFER to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -148,8 +149,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ BUFFER response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -165,8 +165,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; + case 3: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -177,11 +176,12 @@ namespace DiscImageChef.Tests.Devices.ATA static void ReadBufferDma(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.ReadBufferDma(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, out double duration); + bool sense = dev.ReadBufferDma(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ BUFFER DMA to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -214,8 +214,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ BUFFER DMA response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -231,8 +230,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; + case 3: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -248,7 +246,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -285,9 +283,12 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(lba > 0xFFFFFFF) { - DicConsole.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", 0xFFFFFFF); + DicConsole + .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", + 0xFFFFFFF); lba = 0xFFFFFFF; } DicConsole.Write("How many sectors?: "); @@ -299,17 +300,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadDma(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, retries, lba, count, dev.Timeout, out double duration); + bool sense = dev.ReadDma(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, retries, lba, count, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ DMA {0}to the device:", retries ? "WITH RETRIES " : ""); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -343,8 +345,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DMA {0}response:", retries ? "WITH RETRIES " : ""); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -360,10 +361,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -379,7 +378,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -416,22 +415,25 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(lba > 0xFFFFFFF) { - DicConsole.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", 0xFFFFFFF); + DicConsole + .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", + 0xFFFFFFF); lba = 0xFFFFFFF; } break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadLong(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, retries, lba, blockSize, dev.Timeout, out double duration); + bool sense = dev.ReadLong(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, retries, lba, + blockSize, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ LONG {0}to the device:", retries ? "WITH RETRIES " : ""); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -465,8 +467,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ LONG {0}response:", retries ? "WITH RETRIES " : ""); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -482,10 +483,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -501,7 +500,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -538,9 +537,12 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(lba > 0xFFFFFFF) { - DicConsole.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", 0xFFFFFFF); + DicConsole + .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", + 0xFFFFFFF); lba = 0xFFFFFFF; } DicConsole.Write("How many sectors?: "); @@ -552,17 +554,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, lba, count, dev.Timeout, out double duration); + bool sense = dev.ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, lba, count, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ MULTIPLE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -596,8 +599,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ MULTIPLE response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -613,10 +615,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -627,11 +627,12 @@ namespace DiscImageChef.Tests.Devices.ATA static void ReadNativeMaxAddress(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.ReadNativeMaxAddress(out uint lba, out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, out double duration); + bool sense = dev.ReadNativeMaxAddress(out uint lba, out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ NATIVE MAX ADDRESS to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -668,8 +669,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; + case 2: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -685,7 +685,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -722,9 +722,12 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(lba > 0xFFFFFFF) { - DicConsole.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", 0xFFFFFFF); + DicConsole + .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", + 0xFFFFFFF); lba = 0xFFFFFFF; } DicConsole.Write("How many sectors?: "); @@ -736,17 +739,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.Read(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, retries, lba, count, dev.Timeout, out double duration); + bool sense = dev.Read(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, retries, lba, count, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ SECTORS {0}to the device:", retries ? "WITH RETRIES " : ""); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -780,8 +784,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ SECTORS {0}response:", retries ? "WITH RETRIES " : ""); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -797,10 +800,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -815,7 +816,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -851,22 +852,24 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(lba > 0xFFFFFFF) { - DicConsole.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", 0xFFFFFFF); + DicConsole + .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", + 0xFFFFFFF); lba = 0xFFFFFFF; } break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); bool sense = dev.Seek(out AtaErrorRegistersLBA28 errorRegisters, lba, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEEK to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -903,10 +906,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -915,5 +916,4 @@ namespace DiscImageChef.Tests.Devices.ATA } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/ATA/Ata48.cs b/DiscImageChef.Tests.Devices/ATA/Ata48.cs index da7809f3..873088a9 100644 --- a/DiscImageChef.Tests.Devices/ATA/Ata48.cs +++ b/DiscImageChef.Tests.Devices/ATA/Ata48.cs @@ -95,11 +95,12 @@ namespace DiscImageChef.Tests.Devices.ATA static void GetNativeMaxAddressExt(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.GetNativeMaxAddressExt(out ulong lba, out AtaErrorRegistersLBA48 errorRegisters, dev.Timeout, out double duration); + bool sense = dev.GetNativeMaxAddressExt(out ulong lba, out AtaErrorRegistersLBA48 errorRegisters, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending GET NATIVE MAX ADDRESS EXT to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -136,8 +137,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; + case 2: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -153,7 +153,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -190,9 +190,12 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(lba > 0xFFFFFFFFFFFF) { - DicConsole.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", 0xFFFFFFFFFFFF); + DicConsole + .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", + 0xFFFFFFFFFFFF); lba = 0xFFFFFFFFFFFF; } DicConsole.Write("How many sectors?: "); @@ -204,17 +207,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadDma(out byte[] buffer, out AtaErrorRegistersLBA48 errorRegisters, lba, count, dev.Timeout, out double duration); + bool sense = dev.ReadDma(out byte[] buffer, out AtaErrorRegistersLBA48 errorRegisters, lba, count, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ DMA EXT to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -248,8 +252,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DMA EXT response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -265,10 +268,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -285,7 +286,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -323,6 +324,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("What page number?: "); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out page)) @@ -332,6 +334,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("How many sectors?: "); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out count)) @@ -341,17 +344,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadLog(out byte[] buffer, out AtaErrorRegistersLBA48 errorRegisters, address, page, count, dev.Timeout, out double duration); + bool sense = dev.ReadLog(out byte[] buffer, out AtaErrorRegistersLBA48 errorRegisters, address, page, count, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ LOG EXT to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -385,8 +389,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ LOG EXT response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -402,10 +405,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -422,7 +423,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -460,6 +461,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("What page number?: "); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out page)) @@ -469,6 +471,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("How many sectors?: "); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out count)) @@ -478,17 +481,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadLogDma(out byte[] buffer, out AtaErrorRegistersLBA48 errorRegisters, address, page, count, dev.Timeout, out double duration); + bool sense = dev.ReadLogDma(out byte[] buffer, out AtaErrorRegistersLBA48 errorRegisters, address, page, + count, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ LOG DMA EXT to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -522,8 +526,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ LOG DMA EXT response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -539,10 +542,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -558,7 +559,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -595,9 +596,12 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(lba > 0xFFFFFFFFFFFF) { - DicConsole.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", 0xFFFFFFFFFFFF); + DicConsole + .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", + 0xFFFFFFFFFFFF); lba = 0xFFFFFFFFFFFF; } DicConsole.Write("How many sectors?: "); @@ -609,17 +613,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA48 errorRegisters, lba, count, dev.Timeout, out double duration); + bool sense = dev.ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA48 errorRegisters, lba, count, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ MULTIPLE EXT to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -653,8 +658,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ MULTIPLE EXT response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -670,10 +674,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -684,11 +686,12 @@ namespace DiscImageChef.Tests.Devices.ATA static void ReadNativeMaxAddressExt(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.ReadNativeMaxAddress(out ulong lba, out AtaErrorRegistersLBA48 errorRegisters, dev.Timeout, out double duration); + bool sense = dev.ReadNativeMaxAddress(out ulong lba, out AtaErrorRegistersLBA48 errorRegisters, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ NATIVE MAX ADDRESS EXT to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -725,8 +728,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; + case 2: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -742,7 +744,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -779,9 +781,12 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(lba > 0xFFFFFFFFFFFF) { - DicConsole.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", 0xFFFFFFFFFFFF); + DicConsole + .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", + 0xFFFFFFFFFFFF); lba = 0xFFFFFFFFFFFF; } DicConsole.Write("How many sectors?: "); @@ -793,17 +798,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.Read(out byte[] buffer, out AtaErrorRegistersLBA48 errorRegisters, lba, count, dev.Timeout, out double duration); + bool sense = dev.Read(out byte[] buffer, out AtaErrorRegistersLBA48 errorRegisters, lba, count, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ SECTORS EXT to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -837,8 +843,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ SECTORS EXT response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -854,10 +859,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -866,5 +869,4 @@ namespace DiscImageChef.Tests.Devices.ATA } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/ATA/AtaCHS.cs b/DiscImageChef.Tests.Devices/ATA/AtaCHS.cs index 452002bc..d45100c3 100644 --- a/DiscImageChef.Tests.Devices/ATA/AtaCHS.cs +++ b/DiscImageChef.Tests.Devices/ATA/AtaCHS.cs @@ -103,11 +103,12 @@ namespace DiscImageChef.Tests.Devices.ATA static void Identify(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.AtaIdentify(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, out double duration); + bool sense = dev.AtaIdentify(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending IDENTIFY DEVICE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -141,8 +142,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("IDENTIFY DEVICE response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -152,8 +152,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("IDENTIFY DEVICE decoded response:"); - if(buffer != null) - DicConsole.WriteLine("{0}", Decoders.ATA.Identify.Prettify(buffer)); + if(buffer != null) DicConsole.WriteLine("{0}", Decoders.ATA.Identify.Prettify(buffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -169,8 +168,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -188,7 +186,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -227,6 +225,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("What head?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out head)) @@ -236,6 +235,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(head > 15) { DicConsole.WriteLine("Head cannot be bigger than 15. Setting it to 15..."); @@ -250,6 +250,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("How many sectors?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out count)) @@ -259,17 +260,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadDma(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, retries, cylinder, head, sector, count, dev.Timeout, out double duration); + bool sense = dev.ReadDma(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, retries, cylinder, + head, sector, count, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ DMA {0}to the device:", retries ? "WITH RETRIES " : ""); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -303,8 +305,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DMA {0}response:", retries ? "WITH RETRIES " : ""); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -320,10 +321,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -341,7 +340,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -380,6 +379,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("What head?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out head)) @@ -389,6 +389,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(head > 15) { DicConsole.WriteLine("Head cannot be bigger than 15. Setting it to 15..."); @@ -403,6 +404,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("How many bytes to expect?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out blockSize)) @@ -412,17 +414,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadLong(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, retries, cylinder, head, sector, blockSize, dev.Timeout, out double duration); + bool sense = dev.ReadLong(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, retries, cylinder, + head, sector, blockSize, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ LONG {0}to the device:", retries ? "WITH RETRIES " : ""); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -456,8 +459,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ LONG {0}response:", retries ? "WITH RETRIES " : ""); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -473,10 +475,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -494,7 +494,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -533,6 +533,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("What head?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out head)) @@ -542,6 +543,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(head > 15) { DicConsole.WriteLine("Head cannot be bigger than 15. Setting it to 15..."); @@ -556,6 +558,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("How many sectors?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out count)) @@ -565,17 +568,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadMultiple(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, cylinder, head, sector, count, dev.Timeout, out double duration); + bool sense = dev.ReadMultiple(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, cylinder, head, + sector, count, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ MULTIPLE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -609,8 +613,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ MULTIPLE response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -626,10 +629,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -647,7 +648,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -686,6 +687,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("What head?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out head)) @@ -695,6 +697,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(head > 15) { DicConsole.WriteLine("Head cannot be bigger than 15. Setting it to 15..."); @@ -709,6 +712,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("How many sectors?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out count)) @@ -718,17 +722,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.Read(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, retries, cylinder, head, sector, count, dev.Timeout, out double duration); + bool sense = dev.Read(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, retries, cylinder, head, + sector, count, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ SECTORS {0}to the device:", retries ? "WITH RETRIES " : ""); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -762,8 +767,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ SECTORS {0}response:", retries ? "WITH RETRIES " : ""); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -779,10 +783,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -799,7 +801,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -837,6 +839,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("What head?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out head)) @@ -846,6 +849,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(head > 15) { DicConsole.WriteLine("Head cannot be bigger than 15. Setting it to 15..."); @@ -860,17 +864,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.Seek(out AtaErrorRegistersCHS errorRegisters, cylinder, head, sector, dev.Timeout, out double duration); + bool sense = dev.Seek(out AtaErrorRegistersCHS errorRegisters, cylinder, head, sector, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEEK to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -907,10 +912,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -919,5 +922,4 @@ namespace DiscImageChef.Tests.Devices.ATA } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/ATA/Atapi.cs b/DiscImageChef.Tests.Devices/ATA/Atapi.cs index afee5177..0b046f05 100644 --- a/DiscImageChef.Tests.Devices/ATA/Atapi.cs +++ b/DiscImageChef.Tests.Devices/ATA/Atapi.cs @@ -73,7 +73,8 @@ namespace DiscImageChef.Tests.Devices.ATA { start: System.Console.Clear(); - bool sense = dev.AtapiIdentify(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, out double duration); + bool sense = dev.AtapiIdentify(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, + out double duration); menu: DicConsole.WriteLine("Device: {0}", devPath); @@ -109,8 +110,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("IDENTIFY PACKET DEVICE response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -120,8 +120,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("IDENTIFY PACKET DEVICE decoded response:"); - if(buffer != null) - DicConsole.WriteLine("{0}", Decoders.ATA.Identify.Prettify(buffer)); + if(buffer != null) DicConsole.WriteLine("{0}", Decoders.ATA.Identify.Prettify(buffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -137,16 +136,13 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); goto menu; } - } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/ATA/Cfa.cs b/DiscImageChef.Tests.Devices/ATA/Cfa.cs index 6a977f91..a1f44744 100644 --- a/DiscImageChef.Tests.Devices/ATA/Cfa.cs +++ b/DiscImageChef.Tests.Devices/ATA/Cfa.cs @@ -79,11 +79,12 @@ namespace DiscImageChef.Tests.Devices.ATA static void RequestExtendedErrorCode(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.RequestExtendedErrorCode(out byte errorCode, out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, out double duration); + bool sense = dev.RequestExtendedErrorCode(out byte errorCode, out AtaErrorRegistersLBA28 errorRegisters, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending REQUEST EXTENDED ERROR CODE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -120,8 +121,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; + case 2: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -138,7 +138,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -176,6 +176,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + DicConsole.Write("What head?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out head)) @@ -185,6 +186,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(head > 15) { DicConsole.WriteLine("Head cannot be bigger than 15. Setting it to 15..."); @@ -199,17 +201,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.TranslateSector(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, cylinder, head, sector, dev.Timeout, out double duration); + bool sense = dev.TranslateSector(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, cylinder, head, + sector, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending TRANSLATE SECTOR to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -243,8 +246,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("TRANSLATE SECTOR response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -260,10 +262,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -278,7 +278,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -314,22 +314,25 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + if(lba > 0xFFFFFFF) { - DicConsole.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", 0xFFFFFFF); + DicConsole + .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...", + 0xFFFFFFF); lba = 0xFFFFFFF; } break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.TranslateSector(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, lba, dev.Timeout, out double duration); + bool sense = dev.TranslateSector(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, lba, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending TRANSLATE SECTOR to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -363,8 +366,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("TRANSLATE SECTOR response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -380,10 +382,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); diff --git a/DiscImageChef.Tests.Devices/ATA/MCPT.cs b/DiscImageChef.Tests.Devices/ATA/MCPT.cs index 0e6cada7..3e9a89c5 100644 --- a/DiscImageChef.Tests.Devices/ATA/MCPT.cs +++ b/DiscImageChef.Tests.Devices/ATA/MCPT.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -111,17 +111,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.CheckMediaCardType(feature, out AtaErrorRegistersCHS errorRegisters, dev.Timeout, out double duration); + bool sense = dev.CheckMediaCardType(feature, out AtaErrorRegistersCHS errorRegisters, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending CHECK MEDIA CARD TYPE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -149,10 +150,8 @@ namespace DiscImageChef.Tests.Devices.ATA case 0: DicConsole.WriteLine("Returning to Media Card Pass Through commands menu..."); return; - case 1: - goto start; - case 2: - goto parameters; + case 1: goto start; + case 2: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -161,5 +160,4 @@ namespace DiscImageChef.Tests.Devices.ATA } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/ATA/Smart.cs b/DiscImageChef.Tests.Devices/ATA/Smart.cs index 034fa9b4..b3b5ead2 100644 --- a/DiscImageChef.Tests.Devices/ATA/Smart.cs +++ b/DiscImageChef.Tests.Devices/ATA/Smart.cs @@ -99,11 +99,13 @@ namespace DiscImageChef.Tests.Devices.ATA static void DisableAttributeAutosave(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.SmartDisableAttributeAutosave(out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, out double duration); + bool sense = + dev.SmartDisableAttributeAutosave(out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending DISABLE ATTRIBUTE AUTOSAVE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -130,8 +132,7 @@ namespace DiscImageChef.Tests.Devices.ATA case 0: DicConsole.WriteLine("Returning to S.M.A.R.T. commands menu..."); return; - case 1: - goto start; + case 1: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -142,11 +143,11 @@ namespace DiscImageChef.Tests.Devices.ATA static void DisableOperations(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.SmartDisable(out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending DISABLE OPERATIONS to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -173,8 +174,7 @@ namespace DiscImageChef.Tests.Devices.ATA case 0: DicConsole.WriteLine("Returning to S.M.A.R.T. commands menu..."); return; - case 1: - goto start; + case 1: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -185,11 +185,13 @@ namespace DiscImageChef.Tests.Devices.ATA static void EnableAttributeAutosave(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.SmartEnableAttributeAutosave(out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, out double duration); + bool sense = + dev.SmartEnableAttributeAutosave(out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending ENABLE ATTRIBUTE AUTOSAVE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -216,8 +218,7 @@ namespace DiscImageChef.Tests.Devices.ATA case 0: DicConsole.WriteLine("Returning to S.M.A.R.T. commands menu..."); return; - case 1: - goto start; + case 1: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -228,11 +229,11 @@ namespace DiscImageChef.Tests.Devices.ATA static void EnableOperations(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.SmartEnable(out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending ENABLE OPERATIONS to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -259,8 +260,7 @@ namespace DiscImageChef.Tests.Devices.ATA case 0: DicConsole.WriteLine("Returning to S.M.A.R.T. commands menu..."); return; - case 1: - goto start; + case 1: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -275,7 +275,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -311,17 +311,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.SmartExecuteOffLineImmediate(out AtaErrorRegistersLBA28 errorRegisters, subcommand, dev.Timeout, out double duration); + bool sense = dev.SmartExecuteOffLineImmediate(out AtaErrorRegistersLBA28 errorRegisters, subcommand, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending EXECUTE OFF-LINE IMMEDIATE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -349,10 +350,8 @@ namespace DiscImageChef.Tests.Devices.ATA case 0: DicConsole.WriteLine("Returning to S.M.A.R.T. commands menu..."); return; - case 1: - goto start; - case 2: - goto parameters; + case 1: goto start; + case 2: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -363,11 +362,12 @@ namespace DiscImageChef.Tests.Devices.ATA static void ReadData(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.SmartReadData(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, out double duration); + bool sense = dev.SmartReadData(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ DATA to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -400,8 +400,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DATA response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -417,8 +416,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -433,7 +431,7 @@ namespace DiscImageChef.Tests.Devices.ATA string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -471,17 +469,18 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.SmartReadLog(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, address, dev.Timeout, out double duration); + bool sense = dev.SmartReadLog(out byte[] buffer, out AtaErrorRegistersLBA28 errorRegisters, address, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ LOG to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -515,8 +514,7 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ LOG response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -532,10 +530,8 @@ namespace DiscImageChef.Tests.Devices.ATA System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -546,11 +542,12 @@ namespace DiscImageChef.Tests.Devices.ATA static void ReturnStatus(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.SmartReturnStatus(out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, out double duration); + bool sense = dev.SmartReturnStatus(out AtaErrorRegistersLBA28 errorRegisters, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending RETURN STATUS to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -577,8 +574,7 @@ namespace DiscImageChef.Tests.Devices.ATA case 0: DicConsole.WriteLine("Returning to S.M.A.R.T. commands menu..."); return; - case 1: - goto start; + case 1: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -587,5 +583,4 @@ namespace DiscImageChef.Tests.Devices.ATA } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/Command.cs b/DiscImageChef.Tests.Devices/Command.cs index 388e3594..6faeef60 100644 --- a/DiscImageChef.Tests.Devices/Command.cs +++ b/DiscImageChef.Tests.Devices/Command.cs @@ -80,4 +80,4 @@ namespace DiscImageChef.Tests.Devices } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/DecodeATARegisters.cs b/DiscImageChef.Tests.Devices/DecodeATARegisters.cs index 784421b2..b72e61a9 100644 --- a/DiscImageChef.Tests.Devices/DecodeATARegisters.cs +++ b/DiscImageChef.Tests.Devices/DecodeATARegisters.cs @@ -38,22 +38,14 @@ namespace DiscImageChef.Tests.Devices { string ret = ""; - if((status & 0x80) == 0x80) - ret += "BSY "; - if((status & 0x40) == 0x40) - ret += "DRDY "; - if((status & 0x20) == 0x20) - ret += "DWF "; - if((status & 0x10) == 0x10) - ret += "DSC "; - if((status & 0x8) == 0x8) - ret += "DRQ "; - if((status & 0x4) == 0x4) - ret += "CORR "; - if((status & 0x2) == 0x2) - ret += "IDX "; - if((status & 0x1) == 0x1) - ret += "ERR "; + if((status & 0x80) == 0x80) ret += "BSY "; + if((status & 0x40) == 0x40) ret += "DRDY "; + if((status & 0x20) == 0x20) ret += "DWF "; + if((status & 0x10) == 0x10) ret += "DSC "; + if((status & 0x8) == 0x8) ret += "DRQ "; + if((status & 0x4) == 0x4) ret += "CORR "; + if((status & 0x2) == 0x2) ret += "IDX "; + if((status & 0x1) == 0x1) ret += "ERR "; return ret; } @@ -62,22 +54,14 @@ namespace DiscImageChef.Tests.Devices { string ret = ""; - if((status & 0x80) == 0x80) - ret += "BBK "; - if((status & 0x40) == 0x40) - ret += "UNC "; - if((status & 0x20) == 0x20) - ret += "MC "; - if((status & 0x10) == 0x10) - ret += "IDNF "; - if((status & 0x8) == 0x8) - ret += "MCR "; - if((status & 0x4) == 0x4) - ret += "ABRT "; - if((status & 0x2) == 0x2) - ret += "TK0NF "; - if((status & 0x1) == 0x1) - ret += "AMNF "; + if((status & 0x80) == 0x80) ret += "BBK "; + if((status & 0x40) == 0x40) ret += "UNC "; + if((status & 0x20) == 0x20) ret += "MC "; + if((status & 0x10) == 0x10) ret += "IDNF "; + if((status & 0x8) == 0x8) ret += "MCR "; + if((status & 0x4) == 0x4) ret += "ABRT "; + if((status & 0x2) == 0x2) ret += "TK0NF "; + if((status & 0x1) == 0x1) ret += "AMNF "; return ret; } @@ -104,7 +88,9 @@ namespace DiscImageChef.Tests.Devices sb.AppendFormat("Status: {0}", DecodeATAStatus(registers.status)).AppendLine(); sb.AppendFormat("Error: {0}", DecodeATAStatus(registers.error)).AppendLine(); sb.AppendFormat("Device: {0}", (registers.deviceHead >> 4) & 0x01).AppendLine(); - sb.AppendFormat("LBA: {0}", ((registers.deviceHead & 0xF) << 24) + (registers.lbaHigh << 16) + (registers.lbaMid << 8) + registers.lbaLow); + sb.AppendFormat("LBA: {0}", + ((registers.deviceHead & 0xF) << 24) + (registers.lbaHigh << 16) + (registers.lbaMid << 8) + + registers.lbaLow); sb.AppendFormat("Count: {0}", registers.sectorCount).AppendLine(); sb.AppendFormat("LBA?: {0}", Convert.ToBoolean(registers.deviceHead & 0x40)).AppendLine(); sb.AppendFormat("Bit 7 set?: {0}", Convert.ToBoolean(registers.deviceHead & 0x80)).AppendLine(); @@ -118,7 +104,10 @@ namespace DiscImageChef.Tests.Devices sb.AppendFormat("Status: {0}", DecodeATAStatus(registers.status)).AppendLine(); sb.AppendFormat("Error: {0}", DecodeATAStatus(registers.error)).AppendLine(); sb.AppendFormat("Device: {0}", (registers.deviceHead >> 4) & 0x01).AppendLine(); - sb.AppendFormat("LBA: {0}", ((ulong)(registers.deviceHead & 0xF) * (ulong)0x100000000000) + (registers.lbaHigh * (ulong)0x100000000L) + (ulong)(registers.lbaMid << 16) + registers.lbaLow); + sb.AppendFormat("LBA: {0}", + ((ulong)(registers.deviceHead & 0xF) * (ulong)0x100000000000) + + (registers.lbaHigh * (ulong)0x100000000L) + (ulong)(registers.lbaMid << 16) + + registers.lbaLow); sb.AppendFormat("Count: {0}", registers.sectorCount).AppendLine(); sb.AppendFormat("LBA?: {0}", Convert.ToBoolean(registers.deviceHead & 0x40)).AppendLine(); sb.AppendFormat("Bit 7 set?: {0}", Convert.ToBoolean(registers.deviceHead & 0x80)).AppendLine(); @@ -126,4 +115,4 @@ namespace DiscImageChef.Tests.Devices return sb.ToString(); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/Device.cs b/DiscImageChef.Tests.Devices/Device.cs index 556430fc..6f4420c7 100644 --- a/DiscImageChef.Tests.Devices/Device.cs +++ b/DiscImageChef.Tests.Devices/Device.cs @@ -56,7 +56,8 @@ namespace DiscImageChef.Tests.Devices DicConsole.WriteLine("dev.IsUSB = {0}", dev.IsUSB); DicConsole.WriteLine("dev.USBVendorID = 0x{0:X4}", dev.USBVendorID); DicConsole.WriteLine("dev.USBProductID = 0x{0:X4}", dev.USBProductID); - DicConsole.WriteLine("dev.USBDescriptors.Length = {0}", dev.USBDescriptors == null ? "null" : dev.USBDescriptors.Length.ToString()); + DicConsole.WriteLine("dev.USBDescriptors.Length = {0}", + dev.USBDescriptors == null ? "null" : dev.USBDescriptors.Length.ToString()); DicConsole.WriteLine("dev.USBManufacturerString = \"{0}\"", dev.USBManufacturerString); DicConsole.WriteLine("dev.USBProductString = \"{0}\"", dev.USBProductString); DicConsole.WriteLine("dev.USBSerialString = \"{0}\"", dev.USBSerialString); @@ -100,8 +101,7 @@ namespace DiscImageChef.Tests.Devices System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("USB descriptors:"); - if(dev.USBDescriptors != null) - PrintHex.PrintHexArray(dev.USBDescriptors, 64); + if(dev.USBDescriptors != null) PrintHex.PrintHexArray(dev.USBDescriptors, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); goto menu; @@ -109,8 +109,7 @@ namespace DiscImageChef.Tests.Devices System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("PCMCIA CIS:"); - if(dev.CIS != null) - PrintHex.PrintHexArray(dev.CIS, 64); + if(dev.CIS != null) PrintHex.PrintHexArray(dev.CIS, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); goto menu; @@ -125,4 +124,4 @@ namespace DiscImageChef.Tests.Devices } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/Main.cs b/DiscImageChef.Tests.Devices/Main.cs index cd083f23..3520bb8e 100644 --- a/DiscImageChef.Tests.Devices/Main.cs +++ b/DiscImageChef.Tests.Devices/Main.cs @@ -61,13 +61,15 @@ namespace DiscImageChef.Tests.Devices DicConsole.WriteLine("DiscImageChef device handling tests"); - DicConsole.WriteLine("{6,-8}|{0,-22}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", - "Path", "Vendor", "Model", "Serial", "Bus", "Supported?", "Number"); - DicConsole.WriteLine("{6,-8}|{0,-22}+{1,-16}+{2,-24}+{3,-24}+{4,-10}+{5,-10}", - "----------------------", "----------------", "------------------------", - "------------------------", "----------", "----------", "--------"); + DicConsole.WriteLine("{6,-8}|{0,-22}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", "Path", "Vendor", + "Model", "Serial", "Bus", "Supported?", "Number"); + DicConsole.WriteLine("{6,-8}|{0,-22}+{1,-16}+{2,-24}+{3,-24}+{4,-10}+{5,-10}", "----------------------", + "----------------", "------------------------", "------------------------", + "----------", "----------", "--------"); for(int i = 0; i < devices.Length; i++) - DicConsole.WriteLine("{6,-8}|{0,-22}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", devices[i].path, devices[i].vendor, devices[i].model, devices[i].serial, devices[i].bus, devices[i].supported, i + 1); + DicConsole.WriteLine("{6,-8}|{0,-22}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", devices[i].path, + devices[i].vendor, devices[i].model, devices[i].serial, devices[i].bus, + devices[i].supported, i + 1); DicConsole.Write("Please choose which drive to test (0 to exit): "); strDev = System.Console.ReadLine(); @@ -95,4 +97,4 @@ namespace DiscImageChef.Tests.Devices } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/NVMe.cs b/DiscImageChef.Tests.Devices/NVMe.cs index 0d23698f..d89efca6 100644 --- a/DiscImageChef.Tests.Devices/NVMe.cs +++ b/DiscImageChef.Tests.Devices/NVMe.cs @@ -39,4 +39,4 @@ namespace DiscImageChef.Tests.Devices System.Console.ReadKey(); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/Properties/AssemblyInfo.cs b/DiscImageChef.Tests.Devices/Properties/AssemblyInfo.cs index 11346043..25ee96d9 100644 --- a/DiscImageChef.Tests.Devices/Properties/AssemblyInfo.cs +++ b/DiscImageChef.Tests.Devices/Properties/AssemblyInfo.cs @@ -50,4 +50,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI.cs b/DiscImageChef.Tests.Devices/SCSI.cs index e004bd94..8c8a0f3e 100644 --- a/DiscImageChef.Tests.Devices/SCSI.cs +++ b/DiscImageChef.Tests.Devices/SCSI.cs @@ -133,4 +133,4 @@ namespace DiscImageChef.Tests.Devices } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/Adaptec.cs b/DiscImageChef.Tests.Devices/SCSI/Adaptec.cs index d8622e06..006cb6a7 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Adaptec.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Adaptec.cs @@ -86,7 +86,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -122,24 +122,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.AdaptecReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, drive1, dev.Timeout, out double duration); + bool sense = dev.AdaptecReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, drive1, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ/RESET USAGE COUNTER to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -169,8 +171,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ/RESET USAGE COUNTER response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -180,8 +181,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ/RESET USAGE COUNTER sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -197,10 +197,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -211,18 +209,20 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadDataBuffer(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.AdaptecReadBuffer(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration); + bool sense = dev.AdaptecReadBuffer(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ DATA BUFFER to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -251,8 +251,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DATA BUFFER response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -262,8 +261,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DATA BUFFER sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -279,8 +277,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -296,7 +293,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -333,6 +330,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Error threshold?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out threshold)) @@ -342,22 +340,25 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.AdaptecSetErrorThreshold(threshold, out byte[] senseBuffer, drive1, dev.Timeout, out double duration); + bool sense = + dev.AdaptecSetErrorThreshold(threshold, out byte[] senseBuffer, drive1, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SET ERROR THRESHOLD to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("SET ERROR THRESHOLD decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -387,17 +388,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SET ERROR THRESHOLD sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -413,7 +411,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -450,6 +448,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("LBA?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out lba)) @@ -459,24 +458,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.AdaptecTranslate(out byte[] buffer, out byte[] senseBuffer, drive1, lba, dev.Timeout, out double duration); + bool sense = dev.AdaptecTranslate(out byte[] buffer, out byte[] senseBuffer, drive1, lba, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending TRANSLATE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -506,8 +507,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("TRANSLATE response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -517,8 +517,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("TRANSLATE sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -534,10 +533,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -546,4 +543,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/ArchiveCorp.cs b/DiscImageChef.Tests.Devices/SCSI/ArchiveCorp.cs index 95039e88..aea941a0 100644 --- a/DiscImageChef.Tests.Devices/SCSI/ArchiveCorp.cs +++ b/DiscImageChef.Tests.Devices/SCSI/ArchiveCorp.cs @@ -78,7 +78,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -114,24 +114,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ArchiveCorpRequestBlockAddress(out byte[] buffer, out byte[] senseBuffer, lba, dev.Timeout, out double duration); + bool sense = dev.ArchiveCorpRequestBlockAddress(out byte[] buffer, out byte[] senseBuffer, lba, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending REQUEST BLOCK ADDRESS to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -161,8 +163,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("REQUEST BLOCK ADDRESS response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -172,8 +173,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("REQUEST BLOCK ADDRESS sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -189,10 +189,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -208,7 +206,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -245,6 +243,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("LBA?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out lba)) @@ -254,22 +253,24 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ArchiveCorpSeekBlock(out byte[] senseBuffer, immediate, lba, dev.Timeout, out double duration); + bool sense = + dev.ArchiveCorpSeekBlock(out byte[] senseBuffer, immediate, lba, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEEK BLOCK to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("SEEK BLOCK decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -299,17 +300,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEEK BLOCK sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -317,6 +315,5 @@ namespace DiscImageChef.Tests.Devices.SCSI goto menu; } } - } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/Certance.cs b/DiscImageChef.Tests.Devices/SCSI/Certance.cs index 086b940e..84233e10 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Certance.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Certance.cs @@ -74,16 +74,17 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Park(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.CertancePark(out byte[] senseBuffer, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending PARK to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("PARK decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -112,15 +113,13 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("PARK sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; + case 2: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -131,16 +130,17 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Unpark(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.CertanceUnpark(out byte[] senseBuffer, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending UNPARK to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("UNPARK decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -169,15 +169,13 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("UNPARK sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; + case 2: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -186,4 +184,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/Fujitsu.cs b/DiscImageChef.Tests.Devices/SCSI/Fujitsu.cs index 91220151..24b4c985 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Fujitsu.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Fujitsu.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -113,8 +113,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("Display mode"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4}", FujitsuDisplayModes.Cancel, FujitsuDisplayModes.Cart, FujitsuDisplayModes.Half, FujitsuDisplayModes.Idle, FujitsuDisplayModes.Ready); + DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4}", FujitsuDisplayModes.Cancel, + FujitsuDisplayModes.Cart, FujitsuDisplayModes.Half, + FujitsuDisplayModes.Idle, FujitsuDisplayModes.Ready); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out mode)) @@ -124,26 +127,28 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("First display half (will be cut to 7-bit ASCII, 8 chars?: "); firstHalf = System.Console.ReadLine(); DicConsole.Write("Second display half (will be cut to 7-bit ASCII, 8 chars?: "); secondHalf = System.Console.ReadLine(); break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.FujitsuDisplay(out byte[] senseBuffer, flash, mode, firstHalf, secondHalf, dev.Timeout, out double duration); + bool sense = dev.FujitsuDisplay(out byte[] senseBuffer, flash, mode, firstHalf, secondHalf, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending DISPLAY to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("DISPLAY decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -173,17 +178,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("DISPLAY sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -192,4 +194,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/HL-DT-ST.cs b/DiscImageChef.Tests.Devices/SCSI/HL-DT-ST.cs index 530d616d..cb27466b 100644 --- a/DiscImageChef.Tests.Devices/SCSI/HL-DT-ST.cs +++ b/DiscImageChef.Tests.Devices/SCSI/HL-DT-ST.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -112,6 +112,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("LBA?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out lba)) @@ -121,24 +122,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.HlDtStReadRawDvd(out byte[] buffer, out byte[] senseBuffer, lba, count, dev.Timeout, out double duration); + bool sense = dev.HlDtStReadRawDvd(out byte[] buffer, out byte[] senseBuffer, lba, count, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ DVD (RAW) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -168,8 +171,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DVD (RAW) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -179,8 +181,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DVD (RAW) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -196,10 +197,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -208,4 +207,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/HP.cs b/DiscImageChef.Tests.Devices/SCSI/HP.cs index 821678d0..5e7cb604 100644 --- a/DiscImageChef.Tests.Devices/SCSI/HP.cs +++ b/DiscImageChef.Tests.Devices/SCSI/HP.cs @@ -79,7 +79,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -88,8 +88,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("{0} Block Address: {1}", physical ? "Physical" : "Logical", address); DicConsole.WriteLine("Relative?: {0}", relative); DicConsole.WriteLine("Will transfer {0} {1}", length, sectorCount ? "sectors" : "bytes"); - if(sectorCount) - DicConsole.WriteLine("Expected sector size: {0} bytes", bps); + if(sectorCount) DicConsole.WriteLine("Expected sector size: {0} bytes", bps); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -119,6 +118,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Relative address?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out relative)) @@ -128,6 +128,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("{0} Block Address?: ", physical ? "Physical" : "Logical"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out address)) @@ -137,6 +138,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Transfer sectors?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out sectorCount)) @@ -146,6 +148,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many {0} to transfer?: ", sectorCount ? "sectors" : "bytes"); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out length)) @@ -155,6 +158,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + if(sectorCount) { DicConsole.Write("How many bytes to expect per sector?"); @@ -167,24 +171,26 @@ namespace DiscImageChef.Tests.Devices.SCSI continue; } } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.HPReadLong(out byte[] buffer, out byte[] senseBuffer, relative, address, length, bps, physical, sectorCount, dev.Timeout, out double duration); + bool sense = dev.HPReadLong(out byte[] buffer, out byte[] senseBuffer, relative, address, length, bps, + physical, sectorCount, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ LONG to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -214,8 +220,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ LONG response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -225,8 +230,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ LONG sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -242,10 +246,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -254,4 +256,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/Kreon.cs b/DiscImageChef.Tests.Devices/SCSI/Kreon.cs index a2c356f5..544e6215 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Kreon.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Kreon.cs @@ -86,7 +86,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -122,24 +122,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.KreonExtractSS(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration, requestNumber); + bool sense = dev.KreonExtractSS(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration, + requestNumber); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending EXTRACT SS to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -169,8 +171,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("EXTRACT SS response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -180,8 +181,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("EXTRACT SS sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -197,10 +197,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -211,16 +209,18 @@ namespace DiscImageChef.Tests.Devices.SCSI static void GetFeatureList(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.KreonGetFeatureList(out byte[] senseBuffer, out KreonFeatures features, dev.Timeout, out double duration); + bool sense = dev.KreonGetFeatureList(out byte[] senseBuffer, out KreonFeatures features, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending GET FEATURE LIST to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("Features: {0}.", features); DicConsole.WriteLine("GET FEATURE LIST decoded sense:"); @@ -250,15 +250,13 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET FEATURE LIST sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; + case 2: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -273,7 +271,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -301,7 +299,8 @@ namespace DiscImageChef.Tests.Devices.SCSI return; case 1: DicConsole.WriteLine("Lock state"); - DicConsole.WriteLine("Available values: {0} {1} {2}", KreonLockStates.Locked, KreonLockStates.Wxripper, KreonLockStates.Xtreme); + DicConsole.WriteLine("Available values: {0} {1} {2}", KreonLockStates.Locked, + KreonLockStates.Wxripper, KreonLockStates.Xtreme); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out state)) @@ -311,17 +310,17 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); bool sense = dev.KreonSetLockState(out byte[] senseBuffer, state, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SET LOCK STATE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -349,10 +348,8 @@ namespace DiscImageChef.Tests.Devices.SCSI case 0: DicConsole.WriteLine("Returning to Kreon vendor commands menu..."); return; - case 1: - goto start; - case 2: - goto parameters; + case 1: goto start; + case 2: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -363,16 +360,17 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Unlock(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.KreonDeprecatedUnlock(out byte[] senseBuffer, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending UNLOCK to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("UNLOCK decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -401,15 +399,13 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("UNLOCK sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; + case 2: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -418,4 +414,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/MMC.cs b/DiscImageChef.Tests.Devices/SCSI/MMC.cs index f54232c4..1daf283f 100644 --- a/DiscImageChef.Tests.Devices/SCSI/MMC.cs +++ b/DiscImageChef.Tests.Devices/SCSI/MMC.cs @@ -103,7 +103,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -132,7 +132,9 @@ namespace DiscImageChef.Tests.Devices.SCSI return; case 1: DicConsole.WriteLine("RT"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3}", MmcGetConfigurationRt.All, MmcGetConfigurationRt.Current, MmcGetConfigurationRt.Reserved, MmcGetConfigurationRt.Single); + DicConsole.WriteLine("Available values: {0} {1} {2} {3}", MmcGetConfigurationRt.All, + MmcGetConfigurationRt.Current, MmcGetConfigurationRt.Reserved, + MmcGetConfigurationRt.Single); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out rt)) @@ -142,6 +144,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Feature number"); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out startingFeatureNumber)) @@ -151,24 +154,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.GetConfiguration(out byte[] buffer, out byte[] senseBuffer, startingFeatureNumber, rt, dev.Timeout, out double duration); + bool sense = dev.GetConfiguration(out byte[] buffer, out byte[] senseBuffer, startingFeatureNumber, rt, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending GET CONFIGURATION to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -199,8 +204,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET CONFIGURATION buffer:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -463,6 +467,7 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -472,8 +477,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET CONFIGURATION sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -483,17 +487,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET CONFIGURATION decoded sense:"); - if(senseBuffer != null) - DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); + if(senseBuffer != null) DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 5: - goto start; - case 6: - goto parameters; + case 5: goto start; + case 6: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -509,7 +510,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -546,6 +547,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Persistent value?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out persistent)) @@ -555,22 +557,24 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.PreventAllowMediumRemoval(out byte[] senseBuffer, persistent, prevent, dev.Timeout, out double duration); + bool sense = dev.PreventAllowMediumRemoval(out byte[] senseBuffer, persistent, prevent, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending PREVENT ALLOW MEDIUM REMOVAL to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("PREVENT ALLOW MEDIUM REMOVAL decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -600,17 +604,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("PREVENT ALLOW MEDIUM REMOVAL sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -636,7 +637,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -683,6 +684,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("{0}?: ", relative ? "Address" : "LBA"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out address)) @@ -692,6 +694,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many sectors to transfer?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out length)) @@ -701,8 +704,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("Sector type"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4} {5}", MmcSectorTypes.AllTypes, MmcSectorTypes.CDDA, MmcSectorTypes.Mode1, MmcSectorTypes.Mode2, MmcSectorTypes.Mode2Form1, MmcSectorTypes.Mode2Form2); + DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4} {5}", MmcSectorTypes.AllTypes, + MmcSectorTypes.CDDA, MmcSectorTypes.Mode1, MmcSectorTypes.Mode2, + MmcSectorTypes.Mode2Form1, MmcSectorTypes.Mode2Form2); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out sectorType)) @@ -712,6 +718,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Process audio?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out dap)) @@ -721,6 +728,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Retrieve sync bytes?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out sync)) @@ -730,8 +738,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("Header mode"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3}", MmcHeaderCodes.None, MmcHeaderCodes.HeaderOnly, MmcHeaderCodes.SubHeaderOnly, MmcHeaderCodes.AllHeaders); + DicConsole.WriteLine("Available values: {0} {1} {2} {3}", MmcHeaderCodes.None, + MmcHeaderCodes.HeaderOnly, MmcHeaderCodes.SubHeaderOnly, + MmcHeaderCodes.AllHeaders); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out header)) @@ -741,6 +752,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Retrieve user data?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out user)) @@ -750,6 +762,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Retrieve EDC/ECC?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out edc)) @@ -759,8 +772,10 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("C2 mode"); - DicConsole.WriteLine("Available values: {0} {1} {2}", MmcErrorField.None, MmcErrorField.C2Pointers, MmcErrorField.C2PointersAndBlock); + DicConsole.WriteLine("Available values: {0} {1} {2}", MmcErrorField.None, + MmcErrorField.C2Pointers, MmcErrorField.C2PointersAndBlock); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out c2)) @@ -770,8 +785,10 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("Subchannel mode"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3}", MmcSubchannel.None, MmcSubchannel.Raw, MmcSubchannel.Q16, MmcSubchannel.RW); + DicConsole.WriteLine("Available values: {0} {1} {2} {3}", MmcSubchannel.None, MmcSubchannel.Raw, + MmcSubchannel.Q16, MmcSubchannel.RW); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out subchan)) @@ -781,6 +798,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Expected block size?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out blockSize)) @@ -790,24 +808,27 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadCd(out byte[] buffer, out byte[] senseBuffer, address, blockSize, length, sectorType, dap, relative, sync, header, user, edc, c2, subchan, dev.Timeout, out double duration); + bool sense = dev.ReadCd(out byte[] buffer, out byte[] senseBuffer, address, blockSize, length, sectorType, + dap, relative, sync, header, user, edc, c2, subchan, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ CD to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -837,8 +858,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -848,8 +868,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -865,10 +884,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -897,7 +914,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -943,6 +960,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Start second?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out startSecond)) @@ -952,6 +970,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Start frame?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out startFrame)) @@ -961,6 +980,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("End minute?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out endMinute)) @@ -970,6 +990,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("End second?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out endMinute)) @@ -979,6 +1000,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("End frame?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out endFrame)) @@ -988,8 +1010,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("Sector type"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4} {5}", MmcSectorTypes.AllTypes, MmcSectorTypes.CDDA, MmcSectorTypes.Mode1, MmcSectorTypes.Mode2, MmcSectorTypes.Mode2Form1, MmcSectorTypes.Mode2Form2); + DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4} {5}", MmcSectorTypes.AllTypes, + MmcSectorTypes.CDDA, MmcSectorTypes.Mode1, MmcSectorTypes.Mode2, + MmcSectorTypes.Mode2Form1, MmcSectorTypes.Mode2Form2); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out sectorType)) @@ -999,6 +1024,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Process audio?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out dap)) @@ -1008,6 +1034,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Retrieve sync bytes?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out sync)) @@ -1017,8 +1044,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("Header mode"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3}", MmcHeaderCodes.None, MmcHeaderCodes.HeaderOnly, MmcHeaderCodes.SubHeaderOnly, MmcHeaderCodes.AllHeaders); + DicConsole.WriteLine("Available values: {0} {1} {2} {3}", MmcHeaderCodes.None, + MmcHeaderCodes.HeaderOnly, MmcHeaderCodes.SubHeaderOnly, + MmcHeaderCodes.AllHeaders); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out header)) @@ -1028,6 +1058,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Retrieve user data?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out user)) @@ -1037,6 +1068,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Retrieve EDC/ECC?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out edc)) @@ -1046,8 +1078,10 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("C2 mode"); - DicConsole.WriteLine("Available values: {0} {1} {2}", MmcErrorField.None, MmcErrorField.C2Pointers, MmcErrorField.C2PointersAndBlock); + DicConsole.WriteLine("Available values: {0} {1} {2}", MmcErrorField.None, + MmcErrorField.C2Pointers, MmcErrorField.C2PointersAndBlock); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out c2)) @@ -1057,8 +1091,10 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("Subchannel mode"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3}", MmcSubchannel.None, MmcSubchannel.Raw, MmcSubchannel.Q16, MmcSubchannel.RW); + DicConsole.WriteLine("Available values: {0} {1} {2} {3}", MmcSubchannel.None, MmcSubchannel.Raw, + MmcSubchannel.Q16, MmcSubchannel.RW); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out subchan)) @@ -1068,6 +1104,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Expected block size?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out blockSize)) @@ -1077,26 +1114,29 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: uint startMsf = (uint)((startMinute << 16) + (startSecond << 8) + startFrame); uint endMsf = (uint)((startMinute << 16) + (startSecond << 8) + startFrame); System.Console.Clear(); - bool sense = dev.ReadCdMsf(out byte[] buffer, out byte[] senseBuffer, startMsf, endMsf, blockSize, sectorType, dap, sync, header, user, edc, c2, subchan, dev.Timeout, out double duration); + bool sense = dev.ReadCdMsf(out byte[] buffer, out byte[] senseBuffer, startMsf, endMsf, blockSize, + sectorType, dap, sync, header, user, edc, c2, subchan, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ CD MSF to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1126,8 +1166,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD MSF response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1137,8 +1176,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD MSF sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1154,10 +1192,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1172,7 +1208,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1200,7 +1236,10 @@ namespace DiscImageChef.Tests.Devices.SCSI return; case 1: DicConsole.WriteLine("Information type"); - DicConsole.WriteLine("Available values: {0} {1} {2}", MmcDiscInformationDataTypes.DiscInformation, MmcDiscInformationDataTypes.TrackResources, MmcDiscInformationDataTypes.POWResources); + DicConsole.WriteLine("Available values: {0} {1} {2}", + MmcDiscInformationDataTypes.DiscInformation, + MmcDiscInformationDataTypes.TrackResources, + MmcDiscInformationDataTypes.POWResources); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out info)) @@ -1210,24 +1249,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadDiscInformation(out byte[] buffer, out byte[] senseBuffer, info, dev.Timeout, out double duration); + bool sense = dev.ReadDiscInformation(out byte[] buffer, out byte[] senseBuffer, info, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ DISC INFORMATION to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1258,8 +1299,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DISC INFORMATION response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1279,8 +1319,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DISC INFORMATION sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1296,10 +1335,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 5: - goto start; - case 6: - goto parameters; + case 5: goto start; + case 6: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1318,7 +1355,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1350,7 +1387,8 @@ namespace DiscImageChef.Tests.Devices.SCSI return; case 1: DicConsole.WriteLine("Media type"); - DicConsole.WriteLine("Available values: {0} {1}", MmcDiscStructureMediaType.DVD, MmcDiscStructureMediaType.BD); + DicConsole.WriteLine("Available values: {0} {1}", MmcDiscStructureMediaType.DVD, + MmcDiscStructureMediaType.BD); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out mediaType)) @@ -1360,26 +1398,56 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("Format"); DicConsole.WriteLine("Available values:"); if(mediaType == MmcDiscStructureMediaType.DVD) { - DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.PhysicalInformation, MmcDiscStructureFormat.CopyrightInformation, MmcDiscStructureFormat.DiscKey, MmcDiscStructureFormat.BurstCuttingArea); - DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.DiscManufacturingInformation, MmcDiscStructureFormat.SectorCopyrightInformation, MmcDiscStructureFormat.MediaIdentifier, MmcDiscStructureFormat.MediaKeyBlock); - DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.DVDRAM_DDS, MmcDiscStructureFormat.DVDRAM_MediumStatus, MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, MmcDiscStructureFormat.DVDRAM_RecordingType); - DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.LastBorderOutRMD, MmcDiscStructureFormat.SpecifiedRMD, MmcDiscStructureFormat.PreRecordedInfo, MmcDiscStructureFormat.DVDR_MediaIdentifier); - DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.DVDR_PhysicalInformation, MmcDiscStructureFormat.ADIP, MmcDiscStructureFormat.HDDVD_CopyrightInformation, MmcDiscStructureFormat.DVD_AACS); - DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.HDDVDR_MediumStatus, MmcDiscStructureFormat.HDDVDR_LastRMD, MmcDiscStructureFormat.DVDR_LayerCapacity, MmcDiscStructureFormat.MiddleZoneStart); - DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.JumpIntervalSize, MmcDiscStructureFormat.ManualLayerJumpStartLBA, MmcDiscStructureFormat.RemapAnchorPoint, MmcDiscStructureFormat.DCB); + DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.PhysicalInformation, + MmcDiscStructureFormat.CopyrightInformation, + MmcDiscStructureFormat.DiscKey, + MmcDiscStructureFormat.BurstCuttingArea); + DicConsole.WriteLine("\t{0} {1} {2} {3}", + MmcDiscStructureFormat.DiscManufacturingInformation, + MmcDiscStructureFormat.SectorCopyrightInformation, + MmcDiscStructureFormat.MediaIdentifier, + MmcDiscStructureFormat.MediaKeyBlock); + DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.DVDRAM_DDS, + MmcDiscStructureFormat.DVDRAM_MediumStatus, + MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, + MmcDiscStructureFormat.DVDRAM_RecordingType); + DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.LastBorderOutRMD, + MmcDiscStructureFormat.SpecifiedRMD, + MmcDiscStructureFormat.PreRecordedInfo, + MmcDiscStructureFormat.DVDR_MediaIdentifier); + DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.DVDR_PhysicalInformation, + MmcDiscStructureFormat.ADIP, + MmcDiscStructureFormat.HDDVD_CopyrightInformation, + MmcDiscStructureFormat.DVD_AACS); + DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.HDDVDR_MediumStatus, + MmcDiscStructureFormat.HDDVDR_LastRMD, + MmcDiscStructureFormat.DVDR_LayerCapacity, + MmcDiscStructureFormat.MiddleZoneStart); + DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.JumpIntervalSize, + MmcDiscStructureFormat.ManualLayerJumpStartLBA, + MmcDiscStructureFormat.RemapAnchorPoint, MmcDiscStructureFormat.DCB); } if(mediaType == MmcDiscStructureMediaType.BD) { - DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.DiscInformation, MmcDiscStructureFormat.BD_BurstCuttingArea, MmcDiscStructureFormat.BD_DDS, MmcDiscStructureFormat.CartridgeStatus); - DicConsole.WriteLine("\t{0} {1} {2}", MmcDiscStructureFormat.BD_SpareAreaInformation, MmcDiscStructureFormat.RawDFL, MmcDiscStructureFormat.PAC); + DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.DiscInformation, + MmcDiscStructureFormat.BD_BurstCuttingArea, + MmcDiscStructureFormat.BD_DDS, MmcDiscStructureFormat.CartridgeStatus); + DicConsole.WriteLine("\t{0} {1} {2}", MmcDiscStructureFormat.BD_SpareAreaInformation, + MmcDiscStructureFormat.RawDFL, MmcDiscStructureFormat.PAC); } - DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.AACSVolId, MmcDiscStructureFormat.AACSMediaSerial, MmcDiscStructureFormat.AACSMediaId, MmcDiscStructureFormat.AACSMKB); - DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.AACSDataKeys, MmcDiscStructureFormat.AACSLBAExtents, MmcDiscStructureFormat.AACSMKBCPRM, MmcDiscStructureFormat.RecognizedFormatLayers); - DicConsole.WriteLine("\t{0} {1}", MmcDiscStructureFormat.WriteProtectionStatus, MmcDiscStructureFormat.CapabilityList); + DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.AACSVolId, + MmcDiscStructureFormat.AACSMediaSerial, MmcDiscStructureFormat.AACSMediaId, + MmcDiscStructureFormat.AACSMKB); + DicConsole.WriteLine("\t{0} {1} {2} {3}", MmcDiscStructureFormat.AACSDataKeys, + MmcDiscStructureFormat.AACSLBAExtents, MmcDiscStructureFormat.AACSMKBCPRM, + MmcDiscStructureFormat.RecognizedFormatLayers); + DicConsole.WriteLine("\t{0} {1}", MmcDiscStructureFormat.WriteProtectionStatus, + MmcDiscStructureFormat.CapabilityList); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out format)) @@ -1389,6 +1457,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Address?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out address)) @@ -1398,6 +1467,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Layer?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out layer)) @@ -1407,6 +1477,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("AGID?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out agid)) @@ -1416,24 +1487,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadDiscStructure(out byte[] buffer, out byte[] senseBuffer, mediaType, address, layer, format, agid, dev.Timeout, out double duration); + bool sense = dev.ReadDiscStructure(out byte[] buffer, out byte[] senseBuffer, mediaType, address, layer, + format, agid, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ DISC STRUCTURE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1464,8 +1537,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DISC STRUCTURE response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1485,8 +1557,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DISC STRUCTURE sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1502,10 +1573,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 5: - goto start; - case 6: - goto parameters; + case 5: goto start; + case 6: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1522,7 +1591,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1560,6 +1629,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Format?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out format)) @@ -1569,6 +1639,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Session?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out session)) @@ -1578,24 +1649,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadTocPmaAtip(out byte[] buffer, out byte[] senseBuffer, msf, format, session, dev.Timeout, out double duration); + bool sense = dev.ReadTocPmaAtip(out byte[] buffer, out byte[] senseBuffer, msf, format, session, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ TOC/PMA/ATIP to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1626,8 +1699,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ TOC/PMA/ATIP buffer:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1667,6 +1739,7 @@ namespace DiscImageChef.Tests.Devices.SCSI break; } } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1676,8 +1749,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ TOC/PMA/ATIP sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1687,17 +1759,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ TOC/PMA/ATIP decoded sense:"); - if(senseBuffer != null) - DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); + if(senseBuffer != null) DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 5: - goto start; - case 6: - goto parameters; + case 5: goto start; + case 6: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1717,7 +1786,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1758,6 +1827,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Change format layer?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out changeFormatLayer)) @@ -1767,6 +1837,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Eject?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out loadEject)) @@ -1776,6 +1847,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Start?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out start)) @@ -1785,6 +1857,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Format layer?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out formatLayer)) @@ -1794,6 +1867,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Power conditions?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out powerConditions)) @@ -1803,22 +1877,24 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.StartStopUnit(out byte[] senseBuffer, immediate, formatLayer, powerConditions, changeFormatLayer, loadEject, start, dev.Timeout, out double duration); + bool sense = dev.StartStopUnit(out byte[] senseBuffer, immediate, formatLayer, powerConditions, + changeFormatLayer, loadEject, start, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending START STOP UNIT to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("START STOP UNIT decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -1848,17 +1924,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("START STOP UNIT sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1867,4 +1940,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/NEC.cs b/DiscImageChef.Tests.Devices/SCSI/NEC.cs index c3d6dbaa..138925e8 100644 --- a/DiscImageChef.Tests.Devices/SCSI/NEC.cs +++ b/DiscImageChef.Tests.Devices/SCSI/NEC.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -112,6 +112,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many sectors to transfer?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out length)) @@ -121,24 +122,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.NecReadCdDa(out byte[] buffer, out byte[] senseBuffer, address, length, dev.Timeout, out double duration); + bool sense = dev.NecReadCdDa(out byte[] buffer, out byte[] senseBuffer, address, length, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ CD-DA to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -168,8 +171,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD-DA response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -179,8 +181,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD-DA sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -196,10 +197,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -208,4 +207,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/Pioneer.cs b/DiscImageChef.Tests.Devices/SCSI/Pioneer.cs index 7de318d5..97ea144d 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Pioneer.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Pioneer.cs @@ -85,7 +85,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -124,6 +124,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many sectors to transfer?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out length)) @@ -133,8 +134,10 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("Subchannel mode"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3}", PioneerSubchannel.None, PioneerSubchannel.Q16, PioneerSubchannel.All, PioneerSubchannel.Only); + DicConsole.WriteLine("Available values: {0} {1} {2} {3}", PioneerSubchannel.None, + PioneerSubchannel.Q16, PioneerSubchannel.All, PioneerSubchannel.Only); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out subchan)) @@ -144,6 +147,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + switch(subchan) { case PioneerSubchannel.Q16: @@ -159,24 +163,26 @@ namespace DiscImageChef.Tests.Devices.SCSI blockSize = 2352; break; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.PioneerReadCdDa(out byte[] buffer, out byte[] senseBuffer, address, blockSize, length, subchan, dev.Timeout, out double duration); + bool sense = dev.PioneerReadCdDa(out byte[] buffer, out byte[] senseBuffer, address, blockSize, length, + subchan, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ CD-DA to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -206,8 +212,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD-DA response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -217,8 +222,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD-DA sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -234,10 +238,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -259,7 +261,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -298,6 +300,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Start second?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out startSecond)) @@ -307,6 +310,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Start frame?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out startFrame)) @@ -316,6 +320,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("End minute?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out endMinute)) @@ -325,6 +330,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("End second?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out endMinute)) @@ -334,6 +340,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("End frame?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out endFrame)) @@ -343,8 +350,10 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("Subchannel mode"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3}", PioneerSubchannel.None, PioneerSubchannel.Q16, PioneerSubchannel.All, PioneerSubchannel.Only); + DicConsole.WriteLine("Available values: {0} {1} {2} {3}", PioneerSubchannel.None, + PioneerSubchannel.Q16, PioneerSubchannel.All, PioneerSubchannel.Only); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out subchan)) @@ -354,6 +363,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + switch(subchan) { case PioneerSubchannel.Q16: @@ -369,26 +379,28 @@ namespace DiscImageChef.Tests.Devices.SCSI blockSize = 2352; break; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: uint startMsf = (uint)((startMinute << 16) + (startSecond << 8) + startFrame); uint endMsf = (uint)((startMinute << 16) + (startSecond << 8) + startFrame); System.Console.Clear(); - bool sense = dev.PioneerReadCdDaMsf(out byte[] buffer, out byte[] senseBuffer, startMsf, endMsf, blockSize, subchan, dev.Timeout, out double duration); + bool sense = dev.PioneerReadCdDaMsf(out byte[] buffer, out byte[] senseBuffer, startMsf, endMsf, blockSize, + subchan, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ CD-DA MSF to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -418,8 +430,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD-DA MSF response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -429,8 +440,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD-DA MSF sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -446,10 +456,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -467,7 +475,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -506,6 +514,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many sectors to transfer?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out length)) @@ -515,6 +524,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Include error flags?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out errorFlags)) @@ -524,6 +534,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Read whole sector?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out wholeSector)) @@ -533,24 +544,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.PioneerReadCdXa(out byte[] buffer, out byte[] senseBuffer, address, length, errorFlags, wholeSector, dev.Timeout, out double duration); + bool sense = dev.PioneerReadCdXa(out byte[] buffer, out byte[] senseBuffer, address, length, errorFlags, + wholeSector, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ CD-XA to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -580,8 +593,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD-XA response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -591,8 +603,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD-XA sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -608,10 +619,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -619,6 +628,5 @@ namespace DiscImageChef.Tests.Devices.SCSI goto menu; } } - } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/Plasmon.cs b/DiscImageChef.Tests.Devices/SCSI/Plasmon.cs index 2cfa90c2..9a8653a1 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Plasmon.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Plasmon.cs @@ -83,7 +83,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -92,8 +92,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("{0} Block Address: {1}", physical ? "Physical" : "Logical", address); DicConsole.WriteLine("Relative?: {0}", relative); DicConsole.WriteLine("Will transfer {0} {1}", length, sectorCount ? "sectors" : "bytes"); - if(sectorCount) - DicConsole.WriteLine("Expected sector size: {0} bytes", bps); + if(sectorCount) DicConsole.WriteLine("Expected sector size: {0} bytes", bps); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -123,6 +122,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Relative address?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out relative)) @@ -132,6 +132,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("{0} Block Address?: ", physical ? "Physical" : "Logical"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out address)) @@ -141,6 +142,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Transfer sectors?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out sectorCount)) @@ -150,6 +152,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many {0} to transfer?: ", sectorCount ? "sectors" : "bytes"); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out length)) @@ -159,6 +162,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + if(sectorCount) { DicConsole.Write("How many bytes to expect per sector?"); @@ -171,24 +175,26 @@ namespace DiscImageChef.Tests.Devices.SCSI continue; } } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, relative, address, length, bps, physical, sectorCount, dev.Timeout, out double duration); + bool sense = dev.PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, relative, address, length, bps, + physical, sectorCount, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ LONG to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -218,8 +224,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ LONG response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -229,8 +234,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ LONG sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -246,10 +250,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -265,7 +267,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -301,6 +303,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("{0} Block Address?: ", physical ? "Physical" : "Logical"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out address)) @@ -310,24 +313,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.PlasmonReadSectorLocation(out byte[] buffer, out byte[] senseBuffer, address, physical, dev.Timeout, out double duration); + bool sense = dev.PlasmonReadSectorLocation(out byte[] buffer, out byte[] senseBuffer, address, physical, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ SECTOR LOCATION to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -357,8 +362,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ SECTOR LOCATION response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -368,8 +372,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ SECTOR LOCATION sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -385,10 +388,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -397,4 +398,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/Plextor.cs b/DiscImageChef.Tests.Devices/SCSI/Plextor.cs index 85414094..1699967b 100644 --- a/DiscImageChef.Tests.Devices/SCSI/Plextor.cs +++ b/DiscImageChef.Tests.Devices/SCSI/Plextor.cs @@ -126,7 +126,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -162,24 +162,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.PlextorGetBitsetting(out byte[] buffer, out byte[] senseBuffer, dl, dev.Timeout, out double duration); + bool sense = dev.PlextorGetBitsetting(out byte[] buffer, out byte[] senseBuffer, dl, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending GET BOOK BITSETTING to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -209,8 +211,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET BOOK BITSETTING response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -220,8 +221,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET BOOK BITSETTING sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -237,10 +237,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -251,18 +249,20 @@ namespace DiscImageChef.Tests.Devices.SCSI static void GetGigaRec(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.PlextorGetGigaRec(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration); + bool sense = dev.PlextorGetGigaRec(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending GET GIGAREC to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -291,8 +291,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET GIGAREC response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -302,8 +301,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET GIGAREC sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -319,8 +317,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -331,18 +328,20 @@ namespace DiscImageChef.Tests.Devices.SCSI static void GetSecuRec(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.PlextorGetSecuRec(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration); + bool sense = dev.PlextorGetSecuRec(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending GET SECUREC to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -371,8 +370,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET SECUREC response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -382,8 +380,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET SECUREC sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -399,8 +396,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -411,18 +407,20 @@ namespace DiscImageChef.Tests.Devices.SCSI static void GetSilentMode(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.PlextorGetSilentMode(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration); + bool sense = dev.PlextorGetSilentMode(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending GET SILENT MODE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -451,8 +449,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET SILENT MODE response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -462,8 +459,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET SILENT MODE sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -479,8 +475,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -491,18 +486,20 @@ namespace DiscImageChef.Tests.Devices.SCSI static void GetSingleSessionHideCdR(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.PlextorGetHiding(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration); + bool sense = dev.PlextorGetHiding(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending GET SINGLE-SESSION / HIDE CD-R to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -531,8 +528,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET SINGLE-SESSION / HIDE CD-R response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -542,8 +538,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET SINGLE-SESSION / HIDE CD-R sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -559,8 +554,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -571,18 +565,20 @@ namespace DiscImageChef.Tests.Devices.SCSI static void GetSpeedRead(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.PlextorGetSpeedRead(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration); + bool sense = dev.PlextorGetSpeedRead(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending GET SPEEDREAD to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -611,8 +607,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET SPEEDREAD response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -622,8 +617,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET SPEEDREAD sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -639,8 +633,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -651,18 +644,21 @@ namespace DiscImageChef.Tests.Devices.SCSI static void GetTestWriteDvdPlus(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.PlextorGetTestWriteDvdPlus(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration); + bool sense = + dev.PlextorGetTestWriteDvdPlus(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending GET TEST WRITE DVD+ to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -691,8 +687,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET TEST WRITE DVD+ response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -702,8 +697,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET TEST WRITE DVD+ sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -719,8 +713,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -735,7 +728,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -771,24 +764,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.PlextorGetVariRec(out byte[] buffer, out byte[] senseBuffer, dvd, dev.Timeout, out double duration); + bool sense = dev.PlextorGetVariRec(out byte[] buffer, out byte[] senseBuffer, dvd, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending GET VARIREC to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -818,8 +813,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET VARIREC response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -829,8 +823,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("GET VARIREC sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -846,10 +839,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -860,18 +851,20 @@ namespace DiscImageChef.Tests.Devices.SCSI static void PoweRecGetSpeeds(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.PlextorGetPoweRec(out byte[] senseBuffer, out bool enabled, out ushort speed, dev.Timeout, out double duration); + bool sense = dev.PlextorGetPoweRec(out byte[] senseBuffer, out bool enabled, out ushort speed, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending POWEREC GET SPEEDS to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("PoweRec is {0}.", enabled ? "enabled" : "disabled"); DicConsole.WriteLine("Speed: {0}", speed); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("POWEREC GET SPEEDS decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -900,15 +893,13 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("POWEREC GET SPEEDS sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; + case 2: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -926,7 +917,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -965,6 +956,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many sectors to transfer?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out length)) @@ -974,8 +966,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("Subchannel mode"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4}", PlextorSubchannel.None, PlextorSubchannel.Q16, PlextorSubchannel.All, PlextorSubchannel.Pack, PlextorSubchannel.RawC2); + DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4}", PlextorSubchannel.None, + PlextorSubchannel.Q16, PlextorSubchannel.All, PlextorSubchannel.Pack, + PlextorSubchannel.RawC2); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out subchan)) @@ -985,6 +980,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + switch(subchan) { case PlextorSubchannel.Q16: @@ -1001,24 +997,26 @@ namespace DiscImageChef.Tests.Devices.SCSI blockSize = 2352; break; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.PlextorReadCdDa(out byte[] buffer, out byte[] senseBuffer, address, blockSize, length, subchan, dev.Timeout, out double duration); + bool sense = dev.PlextorReadCdDa(out byte[] buffer, out byte[] senseBuffer, address, blockSize, length, + subchan, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ CD-DA to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1048,8 +1046,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD-DA response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1059,8 +1056,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CD-DA sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1076,10 +1072,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1095,7 +1089,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1132,6 +1126,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("LBA?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out lba)) @@ -1141,24 +1136,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.PlextorReadRawDvd(out byte[] buffer, out byte[] senseBuffer, lba, count, dev.Timeout, out double duration); + bool sense = dev.PlextorReadRawDvd(out byte[] buffer, out byte[] senseBuffer, lba, count, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ DVD (RAW) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1188,8 +1185,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DVD (RAW) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1199,8 +1195,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ DVD (RAW) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1216,10 +1211,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1230,18 +1223,20 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadEepromCdR(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.PlextorReadEepromCDR(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration); + bool sense = dev.PlextorReadEepromCDR(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ EEPROM to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1270,8 +1265,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ EEPROM response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1281,8 +1275,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ EEPROM sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1298,8 +1291,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1315,7 +1307,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1352,6 +1344,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("EEPROM block size?: "); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out blockSize)) @@ -1361,24 +1354,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.PlextorReadEepromBlock(out byte[] buffer, out byte[] senseBuffer, block, blockSize, dev.Timeout, out double duration); + bool sense = dev.PlextorReadEepromBlock(out byte[] buffer, out byte[] senseBuffer, block, blockSize, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ EEPROM to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1408,8 +1403,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ EEPROM response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1419,8 +1413,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ EEPROM sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1436,10 +1429,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1450,18 +1441,20 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadEeprom(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.PlextorReadEeprom(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration); + bool sense = dev.PlextorReadEeprom(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ EEPROM to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1490,8 +1483,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ EEPROM response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1501,8 +1493,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ EEPROM sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1518,8 +1509,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1528,4 +1518,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/SBC.cs b/DiscImageChef.Tests.Devices/SCSI/SBC.cs index 8eac054b..e2f88735 100644 --- a/DiscImageChef.Tests.Devices/SCSI/SBC.cs +++ b/DiscImageChef.Tests.Devices/SCSI/SBC.cs @@ -104,7 +104,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -142,6 +142,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + if(lba > 0x1FFFFF) { DicConsole.WriteLine("Max LBA is {0}, setting to {0}", 0x1FFFFF); @@ -156,6 +157,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many bytes to expect per block?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out blockSize)) @@ -165,24 +167,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.Read6(out byte[] buffer, out byte[] senseBuffer, lba, blockSize, count, dev.Timeout, out double duration); + bool sense = dev.Read6(out byte[] buffer, out byte[] senseBuffer, lba, blockSize, count, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ (6) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -212,8 +216,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ (6) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -223,8 +226,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ (6) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -240,10 +242,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -266,7 +266,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -310,6 +310,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("{0}?: ", relative ? "Address" : "LBA"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out lba)) @@ -319,6 +320,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Blocks to read (0 for 256 blocks)?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out count)) @@ -328,6 +330,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many bytes to expect per block?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out blockSize)) @@ -337,6 +340,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How to check protection information?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out rdprotect)) @@ -346,6 +350,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Give lowest cache priority?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out dpo)) @@ -355,6 +360,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Force bypassing cache and reading from medium?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out fua)) @@ -364,6 +370,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Force bypassing cache and reading from non-volatile cache?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out fuaNv)) @@ -373,6 +380,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Group number?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out count)) @@ -382,24 +390,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.Read10(out byte[] buffer, out byte[] senseBuffer, rdprotect, dpo, fua, fuaNv, relative, lba, blockSize, groupNumber, count, dev.Timeout, out double duration); + bool sense = dev.Read10(out byte[] buffer, out byte[] senseBuffer, rdprotect, dpo, fua, fuaNv, relative, + lba, blockSize, groupNumber, count, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ (10) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -429,8 +439,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ (10) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -440,8 +449,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ (10) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -457,10 +465,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -484,7 +490,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -529,6 +535,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("{0}?: ", relative ? "Address" : "LBA"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out lba)) @@ -538,6 +545,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Blocks to read (0 for 256 blocks)?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out count)) @@ -547,6 +555,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many bytes to expect per block?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out blockSize)) @@ -556,6 +565,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How to check protection information?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out rdprotect)) @@ -565,6 +575,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Give lowest cache priority?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out dpo)) @@ -574,6 +585,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Force bypassing cache and reading from medium?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out fua)) @@ -583,6 +595,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Force bypassing cache and reading from non-volatile cache?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out fuaNv)) @@ -592,6 +605,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Group number?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out count)) @@ -601,6 +615,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Use streaming?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out streaming)) @@ -610,24 +625,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.Read12(out byte[] buffer, out byte[] senseBuffer, rdprotect, dpo, fua, fuaNv, relative, lba, blockSize, groupNumber, count, streaming, dev.Timeout, out double duration); + bool sense = dev.Read12(out byte[] buffer, out byte[] senseBuffer, rdprotect, dpo, fua, fuaNv, relative, + lba, blockSize, groupNumber, count, streaming, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ (12) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -657,8 +674,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ (12) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -668,8 +684,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ (12) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -685,10 +700,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -711,7 +724,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -755,6 +768,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Blocks to read (0 for 256 blocks)?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out count)) @@ -764,6 +778,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many bytes to expect per block?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out blockSize)) @@ -773,6 +788,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How to check protection information?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out rdprotect)) @@ -782,6 +798,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Give lowest cache priority?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out dpo)) @@ -791,6 +808,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Force bypassing cache and reading from medium?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out fua)) @@ -800,6 +818,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Force bypassing cache and reading from non-volatile cache?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out fuaNv)) @@ -809,6 +828,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Group number?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out count)) @@ -818,6 +838,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Use streaming?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out streaming)) @@ -827,24 +848,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.Read16(out byte[] buffer, out byte[] senseBuffer, rdprotect, dpo, fua, fuaNv, lba, blockSize, groupNumber, count, streaming, dev.Timeout, out double duration); + bool sense = dev.Read16(out byte[] buffer, out byte[] senseBuffer, rdprotect, dpo, fua, fuaNv, lba, + blockSize, groupNumber, count, streaming, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ (16) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -874,8 +897,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ (16) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -885,8 +907,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ (16) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -902,10 +923,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -923,7 +942,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -962,6 +981,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("{0}?: ", relative ? "Address" : "LBA"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out lba)) @@ -971,6 +991,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many bytes to expect per block?: "); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out blockSize)) @@ -980,6 +1001,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Try to error correct block?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out correct)) @@ -989,24 +1011,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadLong10(out byte[] buffer, out byte[] senseBuffer, correct, relative, lba, blockSize, dev.Timeout, out double duration); + bool sense = dev.ReadLong10(out byte[] buffer, out byte[] senseBuffer, correct, relative, lba, blockSize, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ LONG (10) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1036,8 +1060,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ LONG (10) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1047,8 +1070,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ LONG (10) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1064,10 +1086,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1084,7 +1104,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1122,6 +1142,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many bytes to expect per block?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out blockSize)) @@ -1131,6 +1152,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Try to error correct block?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out correct)) @@ -1140,24 +1162,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadLong16(out byte[] buffer, out byte[] senseBuffer, correct, lba, blockSize, dev.Timeout, out double duration); + bool sense = dev.ReadLong16(out byte[] buffer, out byte[] senseBuffer, correct, lba, blockSize, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ LONG (16) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1187,8 +1211,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ LONG (16) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1198,8 +1221,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ LONG (16) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1215,10 +1237,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1233,7 +1253,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1269,27 +1289,28 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + if(lba > 0x1FFFFF) { DicConsole.WriteLine("Max LBA is {0}, setting to {0}", 0x1FFFFF); lba = 0x1FFFFF; } break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); bool sense = dev.Seek6(out byte[] senseBuffer, lba, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEEK (6) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("SEEK (6) decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -1319,17 +1340,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEEK (6) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1344,7 +1362,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1380,22 +1398,23 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); bool sense = dev.Seek10(out byte[] senseBuffer, lba, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEEK (10) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("SEEK (6) decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -1425,17 +1444,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEEK (10) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1444,4 +1460,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/SMC.cs b/DiscImageChef.Tests.Devices/SCSI/SMC.cs index 2b3fad6f..c88bc5d0 100644 --- a/DiscImageChef.Tests.Devices/SCSI/SMC.cs +++ b/DiscImageChef.Tests.Devices/SCSI/SMC.cs @@ -80,7 +80,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -114,7 +114,10 @@ namespace DiscImageChef.Tests.Devices.SCSI return; case 1: DicConsole.WriteLine("Attribute action"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4}", ScsiAttributeAction.Values, ScsiAttributeAction.List, ScsiAttributeAction.VolumeList, ScsiAttributeAction.PartitionList, ScsiAttributeAction.ElementList, ScsiAttributeAction.Supported); + DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4}", ScsiAttributeAction.Values, + ScsiAttributeAction.List, ScsiAttributeAction.VolumeList, + ScsiAttributeAction.PartitionList, ScsiAttributeAction.ElementList, + ScsiAttributeAction.Supported); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out action)) @@ -124,6 +127,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Element?: "); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out element)) @@ -133,6 +137,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Element type?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out elementType)) @@ -142,6 +147,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Volume?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out volume)) @@ -151,6 +157,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Partition?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out partition)) @@ -160,6 +167,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("First attribute?: "); strDev = System.Console.ReadLine(); if(!ushort.TryParse(strDev, out firstAttribute)) @@ -169,6 +177,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Use cache?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out cache)) @@ -178,24 +187,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadAttribute(out byte[] buffer, out byte[] senseBuffer, action, element, elementType, volume, partition, firstAttribute, cache, dev.Timeout, out double duration); + bool sense = dev.ReadAttribute(out byte[] buffer, out byte[] senseBuffer, action, element, elementType, + volume, partition, firstAttribute, cache, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ ATTRIBUTE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -225,8 +236,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ ATTRIBUTE response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -236,8 +246,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ ATTRIBUTE sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -253,10 +262,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -265,4 +272,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/SPC.cs b/DiscImageChef.Tests.Devices/SCSI/SPC.cs index 97fb3af8..88f2fb63 100644 --- a/DiscImageChef.Tests.Devices/SCSI/SPC.cs +++ b/DiscImageChef.Tests.Devices/SCSI/SPC.cs @@ -107,18 +107,19 @@ namespace DiscImageChef.Tests.Devices.SCSI static void Inquiry(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.ScsiInquiry(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending INQUIRY to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -148,8 +149,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("INQUIRY response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -159,8 +159,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("INQUIRY decoded response:"); - if(buffer != null) - DicConsole.WriteLine("{0}", Decoders.SCSI.Inquiry.Prettify(buffer)); + if(buffer != null) DicConsole.WriteLine("{0}", Decoders.SCSI.Inquiry.Prettify(buffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -170,8 +169,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("INQUIRY sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -187,8 +185,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 5: - goto start; + case 5: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -203,7 +200,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -239,24 +236,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ScsiInquiry(out byte[] buffer, out byte[] senseBuffer, page, dev.Timeout, out double duration); + bool sense = dev.ScsiInquiry(out byte[] buffer, out byte[] senseBuffer, page, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending INQUIRY to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -286,8 +285,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("INQUIRY response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -297,8 +295,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("INQUIRY sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -314,10 +311,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -335,7 +330,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -374,8 +369,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("Page control"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3}", ScsiModeSensePageControl.Changeable, ScsiModeSensePageControl.Current, ScsiModeSensePageControl.Default, ScsiModeSensePageControl.Saved); + DicConsole.WriteLine("Available values: {0} {1} {2} {3}", ScsiModeSensePageControl.Changeable, + ScsiModeSensePageControl.Current, ScsiModeSensePageControl.Default, + ScsiModeSensePageControl.Saved); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!Enum.TryParse(strDev, true, out pageControl)) @@ -385,6 +383,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Page?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out page)) @@ -394,6 +393,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Subpage?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out subpage)) @@ -403,24 +403,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ModeSense6(out byte[] buffer, out byte[] senseBuffer, dbd, pageControl, page, subpage, dev.Timeout, out double duration); + bool sense = dev.ModeSense6(out byte[] buffer, out byte[] senseBuffer, dbd, pageControl, page, subpage, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending MODE SENSE (6) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -451,8 +453,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("MODE SENSE (6) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -473,8 +474,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("MODE SENSE (6) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -490,10 +490,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 5: - goto start; - case 6: - goto parameters; + case 5: goto start; + case 6: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -512,7 +510,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -552,6 +550,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("DBD?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out dbd)) @@ -561,8 +560,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.WriteLine("Page control"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3}", ScsiModeSensePageControl.Changeable, ScsiModeSensePageControl.Current, ScsiModeSensePageControl.Default, ScsiModeSensePageControl.Saved); + DicConsole.WriteLine("Available values: {0} {1} {2} {3}", ScsiModeSensePageControl.Changeable, + ScsiModeSensePageControl.Current, ScsiModeSensePageControl.Default, + ScsiModeSensePageControl.Saved); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!Enum.TryParse(strDev, true, out pageControl)) @@ -572,6 +574,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Page?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out page)) @@ -581,6 +584,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Subpage?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out subpage)) @@ -590,24 +594,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ModeSense10(out byte[] buffer, out byte[] senseBuffer, llba, dbd, pageControl, page, subpage, dev.Timeout, out double duration); + bool sense = dev.ModeSense10(out byte[] buffer, out byte[] senseBuffer, llba, dbd, pageControl, page, + subpage, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending MODE SENSE (10) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -638,8 +644,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("MODE SENSE (10) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -660,8 +665,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("MODE SENSE (10) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -677,10 +681,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 5: - goto start; - case 6: - goto parameters; + case 5: goto start; + case 6: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -695,7 +697,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -723,7 +725,9 @@ namespace DiscImageChef.Tests.Devices.SCSI return; case 1: DicConsole.WriteLine("Mode"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3}", ScsiPreventAllowMode.Allow, ScsiPreventAllowMode.Prevent, ScsiPreventAllowMode.PreventAll, ScsiPreventAllowMode.PreventChanger); + DicConsole.WriteLine("Available values: {0} {1} {2} {3}", ScsiPreventAllowMode.Allow, + ScsiPreventAllowMode.Prevent, ScsiPreventAllowMode.PreventAll, + ScsiPreventAllowMode.PreventChanger); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!Enum.TryParse(strDev, true, out mode)) @@ -733,17 +737,18 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.SpcPreventAllowMediumRemoval(out byte[] senseBuffer, mode, dev.Timeout, out double duration); + bool sense = + dev.SpcPreventAllowMediumRemoval(out byte[] senseBuffer, mode, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending PREVENT ALLOW MEDIUM REMOVAL to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -771,10 +776,8 @@ namespace DiscImageChef.Tests.Devices.SCSI case 0: DicConsole.WriteLine("Returning to SCSI Primary Commands menu..."); return; - case 1: - goto start; - case 2: - goto parameters; + case 1: goto start; + case 2: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -791,7 +794,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -829,6 +832,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Partial capacity?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out partial)) @@ -838,6 +842,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Address?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out address)) @@ -847,24 +852,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadCapacity(out byte[] buffer, out byte[] senseBuffer, relative, address, partial, dev.Timeout, out double duration); + bool sense = dev.ReadCapacity(out byte[] buffer, out byte[] senseBuffer, relative, address, partial, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ CAPACITY (10) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -894,8 +901,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CAPACITY (10) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -905,8 +911,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CAPACITY (10) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -922,10 +927,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -941,7 +944,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -978,6 +981,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Address?: "); strDev = System.Console.ReadLine(); if(!ulong.TryParse(strDev, out address)) @@ -987,24 +991,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadCapacity16(out byte[] buffer, out byte[] senseBuffer, address, partial, dev.Timeout, out double duration); + bool sense = dev.ReadCapacity16(out byte[] buffer, out byte[] senseBuffer, address, partial, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ CAPACITY (16) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1034,8 +1040,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CAPACITY (16) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1045,8 +1050,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ CAPACITY (16) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1062,10 +1066,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1076,18 +1078,20 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadMediaSerialNumber(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.ReadMediaSerialNumber(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration); + bool sense = dev.ReadMediaSerialNumber(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ MEDIA SERIAL NUMBER to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1116,8 +1120,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ MEDIA SERIAL NUMBER response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1127,8 +1130,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ MEDIA SERIAL NUMBER sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1144,8 +1146,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1160,7 +1161,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1196,22 +1197,23 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); bool sense = dev.RequestSense(descriptor, out byte[] senseBuffer, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending REQUEST SENSE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("REQUEST SENSE decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -1241,17 +1243,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("REQUEST SENSE sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1262,16 +1261,17 @@ namespace DiscImageChef.Tests.Devices.SCSI static void TestUnitReady(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.ScsiTestUnitReady(out byte[] senseBuffer, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending TEST UNIT READY to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("TEST UNIT READY decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -1300,15 +1300,13 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("TEST UNIT READY sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; + case 2: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1317,4 +1315,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/SSC.cs b/DiscImageChef.Tests.Devices/SCSI/SSC.cs index 6106922a..c1e087d2 100644 --- a/DiscImageChef.Tests.Devices/SCSI/SSC.cs +++ b/DiscImageChef.Tests.Devices/SCSI/SSC.cs @@ -130,7 +130,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -170,6 +170,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Immediate?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out immediate)) @@ -179,6 +180,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Retense?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out retense)) @@ -188,6 +190,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("End of tape?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out eot)) @@ -197,6 +200,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Hold?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out hold)) @@ -206,22 +210,24 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.LoadUnload(out byte[] senseBuffer, immediate, load, retense, eot, hold, dev.Timeout, out double duration); + bool sense = dev.LoadUnload(out byte[] senseBuffer, immediate, load, retense, eot, hold, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending LOAD UNLOAD to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("LOAD UNLOAD decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -251,17 +257,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("LOAD UNLOAD sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -280,7 +283,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -320,6 +323,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Immediate?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out immediate)) @@ -329,6 +333,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Change partition?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out changePartition)) @@ -338,6 +343,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Partition?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out partition)) @@ -347,6 +353,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("{0}?: ", blockType ? "Block" : "Object"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out objectId)) @@ -356,22 +363,24 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.Locate(out byte[] senseBuffer, immediate, blockType, changePartition, partition, objectId, dev.Timeout, out double duration); + bool sense = dev.Locate(out byte[] senseBuffer, immediate, blockType, changePartition, partition, objectId, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending LOCATE (10) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("LOCATE (10) decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -401,17 +410,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("LOCATE (10) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -431,7 +437,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -464,7 +470,9 @@ namespace DiscImageChef.Tests.Devices.SCSI return; case 1: DicConsole.WriteLine("Object type"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3}", SscLogicalIdTypes.FileId, SscLogicalIdTypes.ObjectId, SscLogicalIdTypes.Reserved, SscLogicalIdTypes.SetId); + DicConsole.WriteLine("Available values: {0} {1} {2} {3}", SscLogicalIdTypes.FileId, + SscLogicalIdTypes.ObjectId, SscLogicalIdTypes.Reserved, + SscLogicalIdTypes.SetId); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out destType)) @@ -474,6 +482,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Immediate?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out immediate)) @@ -483,6 +492,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Explicit identifier?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out bam)) @@ -492,6 +502,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Change partition?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out changePartition)) @@ -501,6 +512,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Partition?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out partition)) @@ -510,6 +522,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Identifier"); strDev = System.Console.ReadLine(); if(!ulong.TryParse(strDev, out objectId)) @@ -519,22 +532,24 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.Locate16(out byte[] senseBuffer, immediate, changePartition, destType, bam, partition, objectId, dev.Timeout, out double duration); + bool sense = dev.Locate16(out byte[] senseBuffer, immediate, changePartition, destType, bam, partition, + objectId, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending LOCATE (16) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("LOCATE (16) decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -564,17 +579,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("LOCATE (16) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -592,7 +604,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -600,8 +612,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Parameters for READ (6) command:"); DicConsole.WriteLine("Fixed block size?: {0}", fixedLen); DicConsole.WriteLine("Will read {0} {1}", length, fixedLen ? "blocks" : "bytes"); - if(fixedLen) - DicConsole.WriteLine("{0} bytes expected per block", blockSize); + if(fixedLen) DicConsole.WriteLine("{0} bytes expected per block", blockSize); DicConsole.WriteLine("Suppress length indicator?: {0}", sili); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -632,6 +643,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many {0} to read?: ", fixedLen ? "blocks" : "bytes"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out length)) @@ -641,9 +653,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + if(length > 0xFFFFFF) { - DicConsole.WriteLine("Max number of {1} is {0}, setting to {0}", 0xFFFFFF, fixedLen ? "blocks" : "bytes"); + DicConsole.WriteLine("Max number of {1} is {0}, setting to {0}", 0xFFFFFF, + fixedLen ? "blocks" : "bytes"); length = 0xFFFFFF; } if(fixedLen) @@ -658,6 +672,7 @@ namespace DiscImageChef.Tests.Devices.SCSI continue; } } + DicConsole.Write("Suppress length indicator?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out sili)) @@ -667,24 +682,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.Read6(out byte[] buffer, out byte[] senseBuffer, sili, fixedLen, length, blockSize, dev.Timeout, out double duration); + bool sense = dev.Read6(out byte[] buffer, out byte[] senseBuffer, sili, fixedLen, length, blockSize, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ (6) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -714,8 +731,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ (6) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -725,8 +741,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ (6) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -742,10 +757,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -765,7 +778,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -773,8 +786,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Parameters for READ (16) command:"); DicConsole.WriteLine("Fixed block size?: {0}", fixedLen); DicConsole.WriteLine("Will read {0} {1}", length, fixedLen ? "objects" : "bytes"); - if(fixedLen) - DicConsole.WriteLine("{0} bytes expected per object", objectSize); + if(fixedLen) DicConsole.WriteLine("{0} bytes expected per object", objectSize); DicConsole.WriteLine("Suppress length indicator?: {0}", sili); DicConsole.WriteLine("Read object {0} from partition {1}", objectId, partition); DicConsole.WriteLine(); @@ -806,6 +818,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many {0} to read?: ", fixedLen ? "objects" : "bytes"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out length)) @@ -815,9 +828,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + if(length > 0xFFFFFF) { - DicConsole.WriteLine("Max number of {1} is {0}, setting to {0}", 0xFFFFFF, fixedLen ? "blocks" : "bytes"); + DicConsole.WriteLine("Max number of {1} is {0}, setting to {0}", 0xFFFFFF, + fixedLen ? "blocks" : "bytes"); length = 0xFFFFFF; } if(fixedLen) @@ -832,6 +847,7 @@ namespace DiscImageChef.Tests.Devices.SCSI continue; } } + DicConsole.Write("Suppress length indicator?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out sili)) @@ -841,6 +857,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Object identifier?: "); strDev = System.Console.ReadLine(); if(!ulong.TryParse(strDev, out objectId)) @@ -850,6 +867,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Partition?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out partition)) @@ -859,24 +877,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.Read16(out byte[] buffer, out byte[] senseBuffer, sili, fixedLen, partition, objectId, length, objectSize, dev.Timeout, out double duration); + bool sense = dev.Read16(out byte[] buffer, out byte[] senseBuffer, sili, fixedLen, partition, objectId, + length, objectSize, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ (16) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -906,8 +926,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ (16) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -917,8 +936,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ (16) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -934,10 +952,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -948,18 +964,20 @@ namespace DiscImageChef.Tests.Devices.SCSI static void ReadBlockLimits(string devPath, Device dev) { - start: + start: System.Console.Clear(); - bool sense = dev.ReadBlockLimits(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration); + bool sense = dev.ReadBlockLimits(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ BLOCK LIMITS to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -989,8 +1007,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ BLOCK LIMITS response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1000,8 +1017,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ BLOCK LIMITS decoded response:"); - if(buffer != null) - DicConsole.WriteLine("{0}", Decoders.SCSI.SSC.BlockLimits.Prettify(buffer)); + if(buffer != null) DicConsole.WriteLine("{0}", Decoders.SCSI.SSC.BlockLimits.Prettify(buffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1011,8 +1027,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ BLOCK LIMITS sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1028,8 +1043,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 5: - goto start; + case 5: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1044,7 +1058,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1072,8 +1086,12 @@ namespace DiscImageChef.Tests.Devices.SCSI return; case 1: DicConsole.WriteLine("Response form"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4} {5} {6} {7} {8}", SscPositionForms.Short, SscPositionForms.VendorShort, SscPositionForms.OldLong, SscPositionForms.OldLongVendor, - SscPositionForms.OldTclp, SscPositionForms.OldTclpVendor, SscPositionForms.Long, SscPositionForms.OldLongTclpVendor, SscPositionForms.Extended); + DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4} {5} {6} {7} {8}", + SscPositionForms.Short, SscPositionForms.VendorShort, + SscPositionForms.OldLong, SscPositionForms.OldLongVendor, + SscPositionForms.OldTclp, SscPositionForms.OldTclpVendor, + SscPositionForms.Long, SscPositionForms.OldLongTclpVendor, + SscPositionForms.Extended); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out responseForm)) @@ -1083,22 +1101,24 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadPosition(out byte[] buffer, out byte[] senseBuffer, responseForm, dev.Timeout, out double duration); + bool sense = dev.ReadPosition(out byte[] buffer, out byte[] senseBuffer, responseForm, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ POSITION to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("READ POSITION decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -1128,17 +1148,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ POSITION sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1157,7 +1174,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1165,8 +1182,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Parameters for READ REVERSE (6) command:"); DicConsole.WriteLine("Fixed block size?: {0}", fixedLen); DicConsole.WriteLine("Will read {0} {1}", length, fixedLen ? "blocks" : "bytes"); - if(fixedLen) - DicConsole.WriteLine("{0} bytes expected per block", blockSize); + if(fixedLen) DicConsole.WriteLine("{0} bytes expected per block", blockSize); DicConsole.WriteLine("Suppress length indicator?: {0}", sili); DicConsole.WriteLine("Drive should unreverse bytes?: {0}", byteOrder); DicConsole.WriteLine(); @@ -1198,6 +1214,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many {0} to read?: ", fixedLen ? "blocks" : "bytes"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out length)) @@ -1207,9 +1224,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + if(length > 0xFFFFFF) { - DicConsole.WriteLine("Max number of {1} is {0}, setting to {0}", 0xFFFFFF, fixedLen ? "blocks" : "bytes"); + DicConsole.WriteLine("Max number of {1} is {0}, setting to {0}", 0xFFFFFF, + fixedLen ? "blocks" : "bytes"); length = 0xFFFFFF; } if(fixedLen) @@ -1224,6 +1243,7 @@ namespace DiscImageChef.Tests.Devices.SCSI continue; } } + DicConsole.Write("Suppress length indicator?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out sili)) @@ -1233,6 +1253,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Drive should unreverse bytes?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out byteOrder)) @@ -1242,24 +1263,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadReverse6(out byte[] buffer, out byte[] senseBuffer, byteOrder, sili, fixedLen, length, blockSize, dev.Timeout, out double duration); + bool sense = dev.ReadReverse6(out byte[] buffer, out byte[] senseBuffer, byteOrder, sili, fixedLen, length, + blockSize, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ REVERSE (6) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1289,8 +1312,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ REVERSE (6) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1300,8 +1322,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ REVERSE (6) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1317,10 +1338,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1341,7 +1360,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1349,8 +1368,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Parameters for READ REVERSE (16) command:"); DicConsole.WriteLine("Fixed block size?: {0}", fixedLen); DicConsole.WriteLine("Will read {0} {1}", length, fixedLen ? "objects" : "bytes"); - if(fixedLen) - DicConsole.WriteLine("{0} bytes expected per object", objectSize); + if(fixedLen) DicConsole.WriteLine("{0} bytes expected per object", objectSize); DicConsole.WriteLine("Suppress length indicator?: {0}", sili); DicConsole.WriteLine("Read object {0} from partition {1}", objectId, partition); DicConsole.WriteLine("Drive should unreverse bytes?: {0}", byteOrder); @@ -1383,6 +1401,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many {0} to read?: ", fixedLen ? "objects" : "bytes"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out length)) @@ -1392,9 +1411,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + if(length > 0xFFFFFF) { - DicConsole.WriteLine("Max number of {1} is {0}, setting to {0}", 0xFFFFFF, fixedLen ? "blocks" : "bytes"); + DicConsole.WriteLine("Max number of {1} is {0}, setting to {0}", 0xFFFFFF, + fixedLen ? "blocks" : "bytes"); length = 0xFFFFFF; } if(fixedLen) @@ -1409,6 +1430,7 @@ namespace DiscImageChef.Tests.Devices.SCSI continue; } } + DicConsole.Write("Suppress length indicator?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out sili)) @@ -1418,6 +1440,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Object identifier?: "); strDev = System.Console.ReadLine(); if(!ulong.TryParse(strDev, out objectId)) @@ -1427,6 +1450,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Partition?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out partition)) @@ -1436,6 +1460,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Drive should unreverse bytes?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out byteOrder)) @@ -1445,24 +1470,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReadReverse16(out byte[] buffer, out byte[] senseBuffer, byteOrder, sili, fixedLen, partition, objectId, length, objectSize, dev.Timeout, out double duration); + bool sense = dev.ReadReverse16(out byte[] buffer, out byte[] senseBuffer, byteOrder, sili, fixedLen, + partition, objectId, length, objectSize, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ REVERSE (16) to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1492,8 +1519,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ REVERSE (16) response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1503,8 +1529,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ REVERSE (16) sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1520,10 +1545,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1541,7 +1564,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1549,8 +1572,7 @@ namespace DiscImageChef.Tests.Devices.SCSI DicConsole.WriteLine("Parameters for RECOVER BUFFERED DATA command:"); DicConsole.WriteLine("Fixed block size?: {0}", fixedLen); DicConsole.WriteLine("Will read {0} {1}", length, fixedLen ? "blocks" : "bytes"); - if(fixedLen) - DicConsole.WriteLine("{0} bytes expected per block", blockSize); + if(fixedLen) DicConsole.WriteLine("{0} bytes expected per block", blockSize); DicConsole.WriteLine("Suppress length indicator?: {0}", sili); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1581,6 +1603,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many {0} to read?: ", fixedLen ? "blocks" : "bytes"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out length)) @@ -1590,9 +1613,11 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + if(length > 0xFFFFFF) { - DicConsole.WriteLine("Max number of {1} is {0}, setting to {0}", 0xFFFFFF, fixedLen ? "blocks" : "bytes"); + DicConsole.WriteLine("Max number of {1} is {0}, setting to {0}", 0xFFFFFF, + fixedLen ? "blocks" : "bytes"); length = 0xFFFFFF; } if(fixedLen) @@ -1607,6 +1632,7 @@ namespace DiscImageChef.Tests.Devices.SCSI continue; } } + DicConsole.Write("Suppress length indicator?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out sili)) @@ -1616,24 +1642,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, sili, fixedLen, length, blockSize, dev.Timeout, out double duration); + bool sense = dev.RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, sili, fixedLen, length, + blockSize, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending RECOVER BUFFERED DATA to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1663,8 +1691,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("RECOVER BUFFERED DATA response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1674,8 +1701,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("RECOVER BUFFERED DATA sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1691,10 +1717,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1710,7 +1734,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1747,6 +1771,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Report about current medium?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out current)) @@ -1756,24 +1781,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, medium, current, dev.Timeout, out double duration); + bool sense = dev.ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, medium, current, + dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending REPORT DENSITY SUPPORT to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -1804,8 +1831,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("REPORT DENSITY SUPPORT response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1815,10 +1841,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("REPORT DENSITY SUPPORT decoded buffer:"); - if(medium) - DicConsole.Write("{0}", Decoders.SCSI.SSC.DensitySupport.PrettifyMediumType(buffer)); - else - DicConsole.Write("{0}", Decoders.SCSI.SSC.DensitySupport.PrettifyDensity(buffer)); + if(medium) DicConsole.Write("{0}", Decoders.SCSI.SSC.DensitySupport.PrettifyMediumType(buffer)); + else DicConsole.Write("{0}", Decoders.SCSI.SSC.DensitySupport.PrettifyDensity(buffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1828,8 +1852,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("REPORT DENSITY SUPPORT sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -1845,10 +1868,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 5: - goto start; - case 6: - goto parameters; + case 5: goto start; + case 6: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1863,7 +1884,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1899,22 +1920,23 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); bool sense = dev.Rewind(out byte[] senseBuffer, immediate, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending REWIND to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("REWIND decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -1944,17 +1966,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("REWIND sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -1970,7 +1989,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -1999,7 +2018,9 @@ namespace DiscImageChef.Tests.Devices.SCSI return; case 1: DicConsole.WriteLine("What to space"); - DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4} {5}", SscSpaceCodes.LogicalBlock, SscSpaceCodes.Filemark, SscSpaceCodes.SequentialFilemark, SscSpaceCodes.EndOfData, SscSpaceCodes.Obsolete1, SscSpaceCodes.Obsolete2); + DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4} {5}", SscSpaceCodes.LogicalBlock, + SscSpaceCodes.Filemark, SscSpaceCodes.SequentialFilemark, + SscSpaceCodes.EndOfData, SscSpaceCodes.Obsolete1, SscSpaceCodes.Obsolete2); DicConsole.Write("Choose?: "); strDev = System.Console.ReadLine(); if(!System.Enum.TryParse(strDev, true, out what)) @@ -2009,6 +2030,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many (negative for reverse)?: "); strDev = System.Console.ReadLine(); if(!int.TryParse(strDev, out count)) @@ -2018,22 +2040,23 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); bool sense = dev.Space(out byte[] senseBuffer, what, count, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SPACE to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("SPACE decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -2063,17 +2086,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SPACE sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -2088,7 +2108,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -2124,22 +2144,23 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); bool sense = dev.TrackSelect(out byte[] senseBuffer, track, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending TRACK SELECT to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine("TRACK SELECT decoded sense:"); DicConsole.Write("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuffer)); @@ -2169,17 +2190,14 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("TRACK SELECT sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 2: - goto start; - case 3: - goto parameters; + case 2: goto start; + case 3: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -2188,4 +2206,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SCSI/SyQuest.cs b/DiscImageChef.Tests.Devices/SCSI/SyQuest.cs index 36eb59cc..82a24d89 100644 --- a/DiscImageChef.Tests.Devices/SCSI/SyQuest.cs +++ b/DiscImageChef.Tests.Devices/SCSI/SyQuest.cs @@ -93,7 +93,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -132,6 +132,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + if(lba > 0x1FFFFF) { DicConsole.WriteLine("Max LBA is {0}, setting to {0}", 0x1FFFFF); @@ -146,6 +147,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many bytes to expect per block?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out blockSize)) @@ -155,6 +157,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Inhibit DMA?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out noDma)) @@ -164,24 +167,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.SyQuestRead6(out byte[] buffer, out byte[] senseBuffer, lba, blockSize, count, noDma, readlong, dev.Timeout, out double duration); + bool sense = dev.SyQuestRead6(out byte[] buffer, out byte[] senseBuffer, lba, blockSize, count, noDma, + readlong, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ {0}(6) to the device:", readlong ? "LONG " : ""); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -211,8 +216,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ {0}(6) response:", readlong ? "LONG " : ""); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -222,8 +226,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ {0}(6) sense:", readlong ? "LONG " : ""); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -239,10 +242,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -260,7 +261,7 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -299,6 +300,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Blocks to read (0 for 256 blocks)?: "); strDev = System.Console.ReadLine(); if(!byte.TryParse(strDev, out count)) @@ -308,6 +310,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("How many bytes to expect per block?: "); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out blockSize)) @@ -317,6 +320,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + DicConsole.Write("Inhibit DMA?: "); strDev = System.Console.ReadLine(); if(!bool.TryParse(strDev, out noDma)) @@ -326,24 +330,26 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.SyQuestRead10(out byte[] buffer, out byte[] senseBuffer, lba, blockSize, count, noDma, readlong, dev.Timeout, out double duration); + bool sense = dev.SyQuestRead10(out byte[] buffer, out byte[] senseBuffer, lba, blockSize, count, noDma, + readlong, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ {0}(10) to the device:", readlong ? "LONG " : ""); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -373,8 +379,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ {0}(10) response:", readlong ? "LONG " : ""); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -384,8 +389,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ {0}(10) sense:", readlong ? "LONG " : ""); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -401,10 +405,8 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; - case 5: - goto parameters; + case 4: goto start; + case 5: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -418,18 +420,21 @@ namespace DiscImageChef.Tests.Devices.SCSI string strDev; int item; - start: + start: System.Console.Clear(); - bool sense = dev.SyQuestReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, out double duration); + bool sense = + dev.SyQuestReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, dev.Timeout, + out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ/RESET USAGE COUNTER to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); DicConsole.WriteLine("Sense is {0}.", sense); DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString()); DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer)); - DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString()); + DicConsole.WriteLine("Sense buffer is {0} bytes.", + senseBuffer == null ? "null" : senseBuffer.Length.ToString()); DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer)); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); @@ -458,8 +463,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ/RESET USAGE COUNTER response:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -469,8 +473,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ/RESET USAGE COUNTER sense:"); - if(senseBuffer != null) - PrintHex.PrintHexArray(senseBuffer, 64); + if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -486,8 +489,7 @@ namespace DiscImageChef.Tests.Devices.SCSI System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -496,4 +498,4 @@ namespace DiscImageChef.Tests.Devices.SCSI } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SecureDigital.cs b/DiscImageChef.Tests.Devices/SecureDigital.cs index 2193b549..b066af07 100644 --- a/DiscImageChef.Tests.Devices/SecureDigital.cs +++ b/DiscImageChef.Tests.Devices/SecureDigital.cs @@ -73,4 +73,4 @@ namespace DiscImageChef.Tests.Devices } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SecureDigital/MultiMediaCard.cs b/DiscImageChef.Tests.Devices/SecureDigital/MultiMediaCard.cs index 8de1bdb4..740c9cbf 100644 --- a/DiscImageChef.Tests.Devices/SecureDigital/MultiMediaCard.cs +++ b/DiscImageChef.Tests.Devices/SecureDigital/MultiMediaCard.cs @@ -105,7 +105,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -113,8 +113,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("Parameters for READ_{0}_BLOCK command:", multiple ? "MULTIPLE" : "SINGLE"); DicConsole.WriteLine("Read from {1}: {0}", address, byteAddr ? "byte" : "block"); DicConsole.WriteLine("Expected block size: {0} bytes", blockSize); - if(multiple) - DicConsole.WriteLine("Will read {0} blocks", count); + if(multiple) DicConsole.WriteLine("Will read {0} blocks", count); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -144,6 +143,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.ReadKey(); continue; } + DicConsole.Write("Read from {0}?: ", byteAddr ? "byte" : "block"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out address)) @@ -153,6 +153,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.ReadKey(); continue; } + if(multiple) { DicConsole.Write("How many blocks to read?"); @@ -165,6 +166,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital continue; } } + DicConsole.Write("How many bytes to expect in a block?"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out blockSize)) @@ -174,17 +176,18 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); - bool sense = dev.Read(out byte[] buffer, out uint[] response, address, blockSize, multiple ? count : 1, byteAddr, dev.Timeout, out double duration); + bool sense = dev.Read(out byte[] buffer, out uint[] response, address, blockSize, multiple ? count : 1, + byteAddr, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ_{0}_BLOCK to the device:", multiple ? "MULTIPLE" : "SINGLE"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -219,8 +222,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ_{0}_BLOCK buffer:", multiple ? "MULTIPLE" : "SINGLE"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -232,19 +234,18 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("READ_{0}_BLOCK response:", multiple ? "MULTIPLE" : "SINGLE"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -255,11 +256,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void SendOpCond(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.ReadOCR(out byte[] buffer, out uint[] response, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_OP_COND to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -294,8 +295,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_OP_COND buffer:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -305,8 +305,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_OP_COND decoded buffer:"); - if(buffer != null) - DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyOCR(buffer)); + if(buffer != null) DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyOCR(buffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -318,17 +317,17 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("SEND_OP_COND response:"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -339,11 +338,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void Status(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.ReadSDStatus(out byte[] buffer, out uint[] response, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_STATUS to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -377,8 +376,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_STATUS buffer:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -390,17 +388,17 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("SEND_STATUS response:"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; + case 3: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -411,11 +409,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void SendCID(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.ReadCID(out byte[] buffer, out uint[] response, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_CID to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -450,8 +448,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_CID buffer:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -461,8 +458,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_CID decoded buffer:"); - if(buffer != null) - DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCID(buffer)); + if(buffer != null) DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCID(buffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -474,17 +470,17 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("SEND_CID response:"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -495,11 +491,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void SendCSD(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.ReadCSD(out byte[] buffer, out uint[] response, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_CSD to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -534,8 +530,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_CSD buffer:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -545,8 +540,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_CSD decoded buffer:"); - if(buffer != null) - DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCSD(buffer)); + if(buffer != null) DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCSD(buffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -558,17 +552,17 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("SEND_CSD response:"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -579,11 +573,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void SendExtendedCSD(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.ReadExtendedCSD(out byte[] buffer, out uint[] response, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_EXT_CSD to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -618,8 +612,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_EXT_CSD buffer:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -629,8 +622,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_EXT_CSD decoded buffer:"); - if(buffer != null) - DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyExtendedCSD(buffer)); + if(buffer != null) DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyExtendedCSD(buffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -642,17 +634,17 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("SEND_EXT_CSD response:"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -667,7 +659,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -703,17 +695,17 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); bool sense = dev.SetBlockLength(blockSize, out uint[] response, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SET_BLOCKLEN to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -722,10 +714,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("SET_BLOCKLEN response:"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Send command again."); @@ -747,10 +740,8 @@ namespace DiscImageChef.Tests.Devices.SecureDigital case 0: DicConsole.WriteLine("Returning to MultiMediaCard commands menu..."); return; - case 1: - goto start; - case 2: - goto parameters; + case 1: goto start; + case 2: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -759,4 +750,4 @@ namespace DiscImageChef.Tests.Devices.SecureDigital } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests.Devices/SecureDigital/SecureDigital.cs b/DiscImageChef.Tests.Devices/SecureDigital/SecureDigital.cs index 14e16891..f2626822 100644 --- a/DiscImageChef.Tests.Devices/SecureDigital/SecureDigital.cs +++ b/DiscImageChef.Tests.Devices/SecureDigital/SecureDigital.cs @@ -105,7 +105,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -113,8 +113,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("Parameters for READ_{0}_BLOCK command:", multiple ? "MULTIPLE" : "SINGLE"); DicConsole.WriteLine("Read from {1}: {0}", address, byteAddr ? "byte" : "block"); DicConsole.WriteLine("Expected block size: {0} bytes", blockSize); - if(multiple) - DicConsole.WriteLine("Will read {0} blocks", count); + if(multiple) DicConsole.WriteLine("Will read {0} blocks", count); DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Change parameters."); @@ -144,6 +143,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.ReadKey(); continue; } + DicConsole.Write("Read from {0}?: ", byteAddr ? "byte" : "block"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out address)) @@ -153,6 +153,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.ReadKey(); continue; } + if(multiple) { DicConsole.Write("How many blocks to read?"); @@ -165,6 +166,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital continue; } } + DicConsole.Write("How many bytes to expect in a block?"); strDev = System.Console.ReadLine(); if(!uint.TryParse(strDev, out blockSize)) @@ -174,17 +176,18 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } start: System.Console.Clear(); - bool sense = dev.Read(out byte[] buffer, out uint[] response, address, blockSize, multiple ? count : 1, byteAddr, dev.Timeout, out double duration); + bool sense = dev.Read(out byte[] buffer, out uint[] response, address, blockSize, multiple ? count : 1, + byteAddr, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending READ_{0}_BLOCK to the device:", multiple ? "MULTIPLE" : "SINGLE"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -219,8 +222,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("READ_{0}_BLOCK buffer:", multiple ? "MULTIPLE" : "SINGLE"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -232,19 +234,18 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("READ_{0}_BLOCK response:", multiple ? "MULTIPLE" : "SINGLE"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; - case 4: - goto parameters; + case 3: goto start; + case 4: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -255,11 +256,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void SendOpCond(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.ReadSDOCR(out byte[] buffer, out uint[] response, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SD_SEND_OP_COND to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -294,8 +295,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SD_SEND_OP_COND buffer:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -305,8 +305,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SD_SEND_OP_COND decoded buffer:"); - if(buffer != null) - DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyOCR(buffer)); + if(buffer != null) DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyOCR(buffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -318,17 +317,17 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("SD_SEND_OP_COND response:"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -339,11 +338,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void Status(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.ReadSDStatus(out byte[] buffer, out uint[] response, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SD_STATUS to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -377,8 +376,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SD_STATUS buffer:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -390,17 +388,17 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("SD_STATUS response:"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 3: - goto start; + case 3: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -411,11 +409,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void SendCID(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.ReadCID(out byte[] buffer, out uint[] response, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_CID to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -450,8 +448,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_CID buffer:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -461,8 +458,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_CID decoded buffer:"); - if(buffer != null) - DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCID(buffer)); + if(buffer != null) DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCID(buffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -474,17 +470,17 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("SEND_CID response:"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -495,11 +491,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void SendCSD(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.ReadCSD(out byte[] buffer, out uint[] response, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_CSD to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -534,8 +530,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_CSD buffer:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -545,8 +540,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_CSD decoded buffer:"); - if(buffer != null) - DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCSD(buffer)); + if(buffer != null) DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCSD(buffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -558,17 +552,17 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("SEND_CSD response:"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -579,11 +573,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital static void SendSCR(string devPath, Device dev) { - start: + start: System.Console.Clear(); bool sense = dev.ReadSCR(out byte[] buffer, out uint[] response, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SEND_SCR to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -618,8 +612,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_SCR buffer:"); - if(buffer != null) - PrintHex.PrintHexArray(buffer, 64); + if(buffer != null) PrintHex.PrintHexArray(buffer, 64); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -629,8 +622,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("SEND_SCR decoded buffer:"); - if(buffer != null) - DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifySCR(buffer)); + if(buffer != null) DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifySCR(buffer)); DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); @@ -642,17 +634,17 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("SEND_SCR response:"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine("Press any key to continue..."); System.Console.ReadKey(); System.Console.Clear(); DicConsole.WriteLine("Device: {0}", devPath); goto menu; - case 4: - goto start; + case 4: goto start; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -667,7 +659,7 @@ namespace DiscImageChef.Tests.Devices.SecureDigital string strDev; int item; - parameters: + parameters: while(true) { System.Console.Clear(); @@ -703,17 +695,17 @@ namespace DiscImageChef.Tests.Devices.SecureDigital System.Console.ReadKey(); continue; } + break; - case 2: - goto start; + case 2: goto start; } } - start: + start: System.Console.Clear(); bool sense = dev.SetBlockLength(blockSize, out uint[] response, dev.Timeout, out double duration); - menu: + menu: DicConsole.WriteLine("Device: {0}", devPath); DicConsole.WriteLine("Sending SET_BLOCKLEN to the device:"); DicConsole.WriteLine("Command took {0} ms.", duration); @@ -722,10 +714,11 @@ namespace DiscImageChef.Tests.Devices.SecureDigital DicConsole.WriteLine("SET_BLOCKLEN response:"); if(response != null) { - foreach(uint res in response) - DicConsole.Write("0x{0:x8} ", res); + foreach(uint res in response) DicConsole.Write("0x{0:x8} ", res); + DicConsole.WriteLine(); } + DicConsole.WriteLine(); DicConsole.WriteLine("Choose what to do:"); DicConsole.WriteLine("1.- Send command again."); @@ -747,10 +740,8 @@ namespace DiscImageChef.Tests.Devices.SecureDigital case 0: DicConsole.WriteLine("Returning to SecureDigital commands menu..."); return; - case 1: - goto start; - case 2: - goto parameters; + case 1: goto start; + case 2: goto parameters; default: DicConsole.WriteLine("Incorrect option. Press any key to continue..."); System.Console.ReadKey(); @@ -759,4 +750,4 @@ namespace DiscImageChef.Tests.Devices.SecureDigital } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Checksums/Adler32.cs b/DiscImageChef.Tests/Checksums/Adler32.cs index 1eaea4a3..9fa85ffe 100644 --- a/DiscImageChef.Tests/Checksums/Adler32.cs +++ b/DiscImageChef.Tests/Checksums/Adler32.cs @@ -35,8 +35,8 @@ namespace DiscImageChef.Tests.Checksums [TestFixture] public class Adler32 { - static readonly byte[] ExpectedEmpty = { 0x00, 0xf0, 0x00, 0x01 }; - static readonly byte[] ExpectedRandom = { 0x37, 0x28, 0xd1, 0x86 }; + static readonly byte[] ExpectedEmpty = {0x00, 0xf0, 0x00, 0x01}; + static readonly byte[] ExpectedRandom = {0x37, 0x28, 0xd1, 0x86}; [Test] public void Adler32EmptyFile() @@ -49,7 +49,8 @@ namespace DiscImageChef.Tests.Checksums public void Adler32EmptyData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -61,7 +62,8 @@ namespace DiscImageChef.Tests.Checksums public void Adler32EmptyInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -83,7 +85,8 @@ namespace DiscImageChef.Tests.Checksums public void Adler32RandomData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -95,7 +98,8 @@ namespace DiscImageChef.Tests.Checksums public void Adler32RandomInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -106,4 +110,4 @@ namespace DiscImageChef.Tests.Checksums Assert.AreEqual(ExpectedRandom, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Checksums/CRC16.cs b/DiscImageChef.Tests/Checksums/CRC16.cs index 596f4f7f..865fe461 100644 --- a/DiscImageChef.Tests/Checksums/CRC16.cs +++ b/DiscImageChef.Tests/Checksums/CRC16.cs @@ -35,8 +35,8 @@ namespace DiscImageChef.Tests.Checksums [TestFixture] public class CRC16 { - static readonly byte[] ExpectedEmpty = { 0x00, 0x00 }; - static readonly byte[] ExpectedRandom = { 0x2d, 0x6d }; + static readonly byte[] ExpectedEmpty = {0x00, 0x00}; + static readonly byte[] ExpectedRandom = {0x2d, 0x6d}; [Test] public void CRC16EmptyFile() @@ -49,7 +49,8 @@ namespace DiscImageChef.Tests.Checksums public void CRC16EmptyData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -61,7 +62,8 @@ namespace DiscImageChef.Tests.Checksums public void CRC16EmptyInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -83,7 +85,8 @@ namespace DiscImageChef.Tests.Checksums public void CRC16RandomData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -95,7 +98,8 @@ namespace DiscImageChef.Tests.Checksums public void CRC16RandomInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -106,4 +110,4 @@ namespace DiscImageChef.Tests.Checksums Assert.AreEqual(ExpectedRandom, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Checksums/CRC32.cs b/DiscImageChef.Tests/Checksums/CRC32.cs index a539da8d..e5436ef3 100644 --- a/DiscImageChef.Tests/Checksums/CRC32.cs +++ b/DiscImageChef.Tests/Checksums/CRC32.cs @@ -35,8 +35,8 @@ namespace DiscImageChef.Tests.Checksums [TestFixture] public class CRC32 { - static readonly byte[] ExpectedEmpty = { 0xa7, 0x38, 0xea, 0x1c }; - static readonly byte[] ExpectedRandom = { 0x2b, 0x6e, 0x68, 0x54 }; + static readonly byte[] ExpectedEmpty = {0xa7, 0x38, 0xea, 0x1c}; + static readonly byte[] ExpectedRandom = {0x2b, 0x6e, 0x68, 0x54}; [Test] public void CRC32EmptyFile() @@ -49,7 +49,8 @@ namespace DiscImageChef.Tests.Checksums public void CRC32EmptyData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -61,7 +62,8 @@ namespace DiscImageChef.Tests.Checksums public void CRC32EmptyInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -83,7 +85,8 @@ namespace DiscImageChef.Tests.Checksums public void CRC32RandomData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -95,7 +98,8 @@ namespace DiscImageChef.Tests.Checksums public void CRC32RandomInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -106,4 +110,4 @@ namespace DiscImageChef.Tests.Checksums Assert.AreEqual(ExpectedRandom, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Checksums/CRC64.cs b/DiscImageChef.Tests/Checksums/CRC64.cs index 1ee70cdf..bd57e9fc 100644 --- a/DiscImageChef.Tests/Checksums/CRC64.cs +++ b/DiscImageChef.Tests/Checksums/CRC64.cs @@ -35,8 +35,8 @@ namespace DiscImageChef.Tests.Checksums [TestFixture] public class CRC64 { - static readonly byte[] ExpectedEmpty = { 0x60, 0x6b, 0x70, 0xa2, 0x3e, 0xba, 0xf6, 0xc2 }; - static readonly byte[] ExpectedRandom = { 0xbf, 0x09, 0x99, 0x2c, 0xc5, 0xed, 0xe3, 0x8e }; + static readonly byte[] ExpectedEmpty = {0x60, 0x6b, 0x70, 0xa2, 0x3e, 0xba, 0xf6, 0xc2}; + static readonly byte[] ExpectedRandom = {0xbf, 0x09, 0x99, 0x2c, 0xc5, 0xed, 0xe3, 0x8e}; [Test] public void CRC64EmptyFile() @@ -49,7 +49,8 @@ namespace DiscImageChef.Tests.Checksums public void CRC64EmptyData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -61,7 +62,8 @@ namespace DiscImageChef.Tests.Checksums public void CRC64EmptyInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -83,7 +85,8 @@ namespace DiscImageChef.Tests.Checksums public void CRC64RandomData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -95,7 +98,8 @@ namespace DiscImageChef.Tests.Checksums public void CRC64RandomInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -106,4 +110,4 @@ namespace DiscImageChef.Tests.Checksums Assert.AreEqual(ExpectedRandom, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Checksums/MD5.cs b/DiscImageChef.Tests/Checksums/MD5.cs index 7a1f1d19..9f288025 100644 --- a/DiscImageChef.Tests/Checksums/MD5.cs +++ b/DiscImageChef.Tests/Checksums/MD5.cs @@ -35,8 +35,10 @@ namespace DiscImageChef.Tests.Checksums [TestFixture] public class MD5 { - static readonly byte[] ExpectedEmpty = { 0xb6, 0xd8, 0x1b, 0x36, 0x0a, 0x56, 0x72, 0xd8, 0x0c, 0x27, 0x43, 0x0f, 0x39, 0x15, 0x3e, 0x2c }; - static readonly byte[] ExpectedRandom = { 0xd7, 0x8f, 0x0e, 0xec, 0x41, 0x7b, 0xe3, 0x86, 0x21, 0x9b, 0x21, 0xb7, 0x00, 0x04, 0x4b, 0x95 }; + static readonly byte[] ExpectedEmpty = + {0xb6, 0xd8, 0x1b, 0x36, 0x0a, 0x56, 0x72, 0xd8, 0x0c, 0x27, 0x43, 0x0f, 0x39, 0x15, 0x3e, 0x2c}; + static readonly byte[] ExpectedRandom = + {0xd7, 0x8f, 0x0e, 0xec, 0x41, 0x7b, 0xe3, 0x86, 0x21, 0x9b, 0x21, 0xb7, 0x00, 0x04, 0x4b, 0x95}; [Test] public void MD5EmptyFile() @@ -51,7 +53,8 @@ namespace DiscImageChef.Tests.Checksums public void MD5EmptyData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -65,7 +68,8 @@ namespace DiscImageChef.Tests.Checksums public void MD5EmptyInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -89,7 +93,8 @@ namespace DiscImageChef.Tests.Checksums public void MD5RandomData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -103,7 +108,8 @@ namespace DiscImageChef.Tests.Checksums public void MD5RandomInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -114,4 +120,4 @@ namespace DiscImageChef.Tests.Checksums Assert.AreEqual(ExpectedRandom, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Checksums/RIPEMD160.cs b/DiscImageChef.Tests/Checksums/RIPEMD160.cs index e6a9706d..b8c5cfd0 100644 --- a/DiscImageChef.Tests/Checksums/RIPEMD160.cs +++ b/DiscImageChef.Tests/Checksums/RIPEMD160.cs @@ -35,8 +35,16 @@ namespace DiscImageChef.Tests.Checksums [TestFixture] public class RIPEMD160 { - static readonly byte[] ExpectedEmpty = { 0x59, 0xf4, 0x4e, 0x7d, 0xaf, 0xba, 0xe0, 0xfa, 0x30, 0x15, 0xc1, 0x96, 0x41, 0xc5, 0xa5, 0xaf, 0x2d, 0x93, 0x99, 0x8d }; - static readonly byte[] ExpectedRandom = { 0x2a, 0x7b, 0x6c, 0x0e, 0xc1, 0x80, 0xce, 0x6a, 0xe2, 0xfd, 0x77, 0xb4, 0xe0, 0xb6, 0x80, 0xc5, 0xd9, 0x9f, 0xf6, 0x7b }; + static readonly byte[] ExpectedEmpty = + { + 0x59, 0xf4, 0x4e, 0x7d, 0xaf, 0xba, 0xe0, 0xfa, 0x30, 0x15, 0xc1, 0x96, 0x41, 0xc5, 0xa5, 0xaf, 0x2d, 0x93, + 0x99, 0x8d + }; + static readonly byte[] ExpectedRandom = + { + 0x2a, 0x7b, 0x6c, 0x0e, 0xc1, 0x80, 0xce, 0x6a, 0xe2, 0xfd, 0x77, 0xb4, 0xe0, 0xb6, 0x80, 0xc5, 0xd9, 0x9f, + 0xf6, 0x7b + }; [Test] public void RIPEMD160EmptyFile() @@ -51,7 +59,8 @@ namespace DiscImageChef.Tests.Checksums public void RIPEMD160EmptyData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -65,7 +74,8 @@ namespace DiscImageChef.Tests.Checksums public void RIPEMD160EmptyInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -89,7 +99,8 @@ namespace DiscImageChef.Tests.Checksums public void RIPEMD160RandomData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -103,7 +114,8 @@ namespace DiscImageChef.Tests.Checksums public void RIPEMD160RandomInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -114,4 +126,4 @@ namespace DiscImageChef.Tests.Checksums Assert.AreEqual(ExpectedRandom, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Checksums/SHA1.cs b/DiscImageChef.Tests/Checksums/SHA1.cs index e74fd297..f8d62a45 100644 --- a/DiscImageChef.Tests/Checksums/SHA1.cs +++ b/DiscImageChef.Tests/Checksums/SHA1.cs @@ -35,8 +35,16 @@ namespace DiscImageChef.Tests.Checksums [TestFixture] public class SHA1 { - static readonly byte[] ExpectedEmpty = { 0x3b, 0x71, 0xf4, 0x3f, 0xf3, 0x0f, 0x4b, 0x15, 0xb5, 0xcd, 0x85, 0xdd, 0x9e, 0x95, 0xeb, 0xc7, 0xe8, 0x4e, 0xb5, 0xa3 }; - static readonly byte[] ExpectedRandom = { 0x72, 0x0d, 0x3b, 0x71, 0x7d, 0xe0, 0xc7, 0x4c, 0x77, 0xdd, 0x9c, 0xaa, 0x9e, 0xba, 0x50, 0x60, 0xdc, 0xbd, 0x28, 0x8d }; + static readonly byte[] ExpectedEmpty = + { + 0x3b, 0x71, 0xf4, 0x3f, 0xf3, 0x0f, 0x4b, 0x15, 0xb5, 0xcd, 0x85, 0xdd, 0x9e, 0x95, 0xeb, 0xc7, 0xe8, 0x4e, + 0xb5, 0xa3 + }; + static readonly byte[] ExpectedRandom = + { + 0x72, 0x0d, 0x3b, 0x71, 0x7d, 0xe0, 0xc7, 0x4c, 0x77, 0xdd, 0x9c, 0xaa, 0x9e, 0xba, 0x50, 0x60, 0xdc, 0xbd, + 0x28, 0x8d + }; [Test] public void SHA1EmptyFile() @@ -51,7 +59,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA1EmptyData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -65,7 +74,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA1EmptyInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -89,7 +99,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA1RandomData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -103,7 +114,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA1RandomInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -114,4 +126,4 @@ namespace DiscImageChef.Tests.Checksums Assert.AreEqual(ExpectedRandom, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Checksums/SHA256.cs b/DiscImageChef.Tests/Checksums/SHA256.cs index 1833ef5f..551bc1c7 100644 --- a/DiscImageChef.Tests/Checksums/SHA256.cs +++ b/DiscImageChef.Tests/Checksums/SHA256.cs @@ -35,8 +35,16 @@ namespace DiscImageChef.Tests.Checksums [TestFixture] public class SHA256 { - static readonly byte[] ExpectedEmpty = { 0x30, 0xe1, 0x49, 0x55, 0xeb, 0xf1, 0x35, 0x22, 0x66, 0xdc, 0x2f, 0xf8, 0x06, 0x7e, 0x68, 0x10, 0x46, 0x07, 0xe7, 0x50, 0xab, 0xb9, 0xd3, 0xb3, 0x65, 0x82, 0xb8, 0xaf, 0x90, 0x9f, 0xcb, 0x58 }; - static readonly byte[] ExpectedRandom = { 0x4d, 0x1a, 0x6b, 0x8a, 0x54, 0x67, 0x00, 0xc4, 0x8e, 0xda, 0x70, 0xd3, 0x39, 0x1c, 0x8f, 0x15, 0x8a, 0x8d, 0x12, 0xb2, 0x38, 0x92, 0x89, 0x29, 0x50, 0x47, 0x8c, 0x41, 0x8e, 0x25, 0xcc, 0x39 }; + static readonly byte[] ExpectedEmpty = + { + 0x30, 0xe1, 0x49, 0x55, 0xeb, 0xf1, 0x35, 0x22, 0x66, 0xdc, 0x2f, 0xf8, 0x06, 0x7e, 0x68, 0x10, 0x46, 0x07, + 0xe7, 0x50, 0xab, 0xb9, 0xd3, 0xb3, 0x65, 0x82, 0xb8, 0xaf, 0x90, 0x9f, 0xcb, 0x58 + }; + static readonly byte[] ExpectedRandom = + { + 0x4d, 0x1a, 0x6b, 0x8a, 0x54, 0x67, 0x00, 0xc4, 0x8e, 0xda, 0x70, 0xd3, 0x39, 0x1c, 0x8f, 0x15, 0x8a, 0x8d, + 0x12, 0xb2, 0x38, 0x92, 0x89, 0x29, 0x50, 0x47, 0x8c, 0x41, 0x8e, 0x25, 0xcc, 0x39 + }; [Test] public void SHA256EmptyFile() @@ -51,7 +59,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA256EmptyData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -65,7 +74,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA256EmptyInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -89,7 +99,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA256RandomData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -103,7 +114,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA256RandomInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -114,4 +126,4 @@ namespace DiscImageChef.Tests.Checksums Assert.AreEqual(ExpectedRandom, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Checksums/SHA384.cs b/DiscImageChef.Tests/Checksums/SHA384.cs index b7d4284e..14d19c61 100644 --- a/DiscImageChef.Tests/Checksums/SHA384.cs +++ b/DiscImageChef.Tests/Checksums/SHA384.cs @@ -35,8 +35,18 @@ namespace DiscImageChef.Tests.Checksums [TestFixture] public class SHA384 { - static readonly byte[] ExpectedEmpty = { 0x31, 0x64, 0x67, 0x3a, 0x8a, 0xc2, 0x75, 0x76, 0xab, 0x5f, 0xc0, 0x6b, 0x9a, 0xdc, 0x4c, 0xe0, 0xac, 0xa5, 0xbd, 0x30, 0x25, 0x38, 0x4b, 0x1c, 0xf2, 0x12, 0x8a, 0x87, 0x95, 0xe7, 0x47, 0xc4, 0x31, 0xe8, 0x82, 0x78, 0x5a, 0x0b, 0xf8, 0xdc, 0x70, 0xb4, 0x29, 0x95, 0xdb, 0x38, 0x85, 0x75 }; - static readonly byte[] ExpectedRandom = { 0xdb, 0x53, 0x0e, 0x17, 0x9b, 0x81, 0xfe, 0x5f, 0x6d, 0x20, 0x41, 0x04, 0x6e, 0x77, 0xd9, 0x85, 0xf2, 0x85, 0x8a, 0x66, 0xca, 0xd3, 0x8d, 0x1a, 0xd5, 0xac, 0x67, 0xa9, 0x74, 0xe1, 0xef, 0x3f, 0x4d, 0xdf, 0x94, 0x15, 0x2e, 0xac, 0x2e, 0xfe, 0x16, 0x95, 0x81, 0x54, 0xdc, 0x59, 0xd4, 0xc3 }; + static readonly byte[] ExpectedEmpty = + { + 0x31, 0x64, 0x67, 0x3a, 0x8a, 0xc2, 0x75, 0x76, 0xab, 0x5f, 0xc0, 0x6b, 0x9a, 0xdc, 0x4c, 0xe0, 0xac, 0xa5, + 0xbd, 0x30, 0x25, 0x38, 0x4b, 0x1c, 0xf2, 0x12, 0x8a, 0x87, 0x95, 0xe7, 0x47, 0xc4, 0x31, 0xe8, 0x82, 0x78, + 0x5a, 0x0b, 0xf8, 0xdc, 0x70, 0xb4, 0x29, 0x95, 0xdb, 0x38, 0x85, 0x75 + }; + static readonly byte[] ExpectedRandom = + { + 0xdb, 0x53, 0x0e, 0x17, 0x9b, 0x81, 0xfe, 0x5f, 0x6d, 0x20, 0x41, 0x04, 0x6e, 0x77, 0xd9, 0x85, 0xf2, 0x85, + 0x8a, 0x66, 0xca, 0xd3, 0x8d, 0x1a, 0xd5, 0xac, 0x67, 0xa9, 0x74, 0xe1, 0xef, 0x3f, 0x4d, 0xdf, 0x94, 0x15, + 0x2e, 0xac, 0x2e, 0xfe, 0x16, 0x95, 0x81, 0x54, 0xdc, 0x59, 0xd4, 0xc3 + }; [Test] public void SHA384EmptyFile() @@ -51,7 +61,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA384EmptyData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -65,7 +76,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA384EmptyInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -89,7 +101,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA384RandomData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -103,7 +116,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA384RandomInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -114,4 +128,4 @@ namespace DiscImageChef.Tests.Checksums Assert.AreEqual(ExpectedRandom, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Checksums/SHA512.cs b/DiscImageChef.Tests/Checksums/SHA512.cs index 85484863..d91eac0d 100644 --- a/DiscImageChef.Tests/Checksums/SHA512.cs +++ b/DiscImageChef.Tests/Checksums/SHA512.cs @@ -35,8 +35,20 @@ namespace DiscImageChef.Tests.Checksums [TestFixture] public class SHA512 { - static readonly byte[] ExpectedEmpty = { 0xd6, 0x29, 0x26, 0x85, 0xb3, 0x80, 0xe3, 0x38, 0xe0, 0x25, 0xb3, 0x41, 0x5a, 0x90, 0xfe, 0x8f, 0x9d, 0x39, 0xa4, 0x6e, 0x7b, 0xdb, 0xa8, 0xcb, 0x78, 0xc5, 0x0a, 0x33, 0x8c, 0xef, 0xca, 0x74, 0x1f, 0x69, 0xe4, 0xe4, 0x64, 0x11, 0xc3, 0x2d, 0xe1, 0xaf, 0xde, 0xdf, 0xb2, 0x68, 0xe5, 0x79, 0xa5, 0x1f, 0x81, 0xff, 0x85, 0xe5, 0x6f, 0x55, 0xb0, 0xee, 0x7c, 0x33, 0xfe, 0x8c, 0x25, 0xc9 }; - static readonly byte[] ExpectedRandom = { 0x6a, 0x0a, 0x18, 0xc2, 0xad, 0xf8, 0x83, 0xac, 0x58, 0xe6, 0x21, 0x96, 0xdb, 0x8d, 0x3d, 0x0e, 0xb9, 0x87, 0xd1, 0x49, 0x24, 0x97, 0xdb, 0x15, 0xb9, 0xfc, 0xcc, 0xb0, 0x36, 0xdf, 0x64, 0xae, 0xdb, 0x3e, 0x82, 0xa0, 0x4d, 0xdc, 0xd1, 0x37, 0x48, 0x92, 0x95, 0x51, 0xf9, 0xdd, 0xab, 0x82, 0xf4, 0x8a, 0x85, 0x3f, 0x9a, 0x01, 0xb5, 0xf2, 0x8c, 0xbb, 0x4a, 0xa5, 0x1b, 0x40, 0x7c, 0xb6 }; + static readonly byte[] ExpectedEmpty = + { + 0xd6, 0x29, 0x26, 0x85, 0xb3, 0x80, 0xe3, 0x38, 0xe0, 0x25, 0xb3, 0x41, 0x5a, 0x90, 0xfe, 0x8f, 0x9d, 0x39, + 0xa4, 0x6e, 0x7b, 0xdb, 0xa8, 0xcb, 0x78, 0xc5, 0x0a, 0x33, 0x8c, 0xef, 0xca, 0x74, 0x1f, 0x69, 0xe4, 0xe4, + 0x64, 0x11, 0xc3, 0x2d, 0xe1, 0xaf, 0xde, 0xdf, 0xb2, 0x68, 0xe5, 0x79, 0xa5, 0x1f, 0x81, 0xff, 0x85, 0xe5, + 0x6f, 0x55, 0xb0, 0xee, 0x7c, 0x33, 0xfe, 0x8c, 0x25, 0xc9 + }; + static readonly byte[] ExpectedRandom = + { + 0x6a, 0x0a, 0x18, 0xc2, 0xad, 0xf8, 0x83, 0xac, 0x58, 0xe6, 0x21, 0x96, 0xdb, 0x8d, 0x3d, 0x0e, 0xb9, 0x87, + 0xd1, 0x49, 0x24, 0x97, 0xdb, 0x15, 0xb9, 0xfc, 0xcc, 0xb0, 0x36, 0xdf, 0x64, 0xae, 0xdb, 0x3e, 0x82, 0xa0, + 0x4d, 0xdc, 0xd1, 0x37, 0x48, 0x92, 0x95, 0x51, 0xf9, 0xdd, 0xab, 0x82, 0xf4, 0x8a, 0x85, 0x3f, 0x9a, 0x01, + 0xb5, 0xf2, 0x8c, 0xbb, 0x4a, 0xa5, 0x1b, 0x40, 0x7c, 0xb6 + }; [Test] public void SHA512EmptyFile() @@ -51,7 +63,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA512EmptyData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -65,7 +78,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA512EmptyInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -89,7 +103,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA512RandomData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -103,7 +118,8 @@ namespace DiscImageChef.Tests.Checksums public void SHA512RandomInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -114,4 +130,4 @@ namespace DiscImageChef.Tests.Checksums Assert.AreEqual(ExpectedRandom, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Checksums/SpamSum.cs b/DiscImageChef.Tests/Checksums/SpamSum.cs index 18d82724..2b747477 100644 --- a/DiscImageChef.Tests/Checksums/SpamSum.cs +++ b/DiscImageChef.Tests/Checksums/SpamSum.cs @@ -42,7 +42,8 @@ namespace DiscImageChef.Tests.Checksums public void SpamSumEmptyData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -55,7 +56,8 @@ namespace DiscImageChef.Tests.Checksums public void SpamSumEmptyInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -70,7 +72,8 @@ namespace DiscImageChef.Tests.Checksums public void SpamSumRandomData() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -83,7 +86,8 @@ namespace DiscImageChef.Tests.Checksums public void SpamSumRandomInstance() { byte[] data = new byte[1048576]; - FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, FileAccess.Read); + FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open, + FileAccess.Read); fs.Read(data, 0, 1048576); fs.Close(); fs.Dispose(); @@ -94,4 +98,4 @@ namespace DiscImageChef.Tests.Checksums Assert.AreEqual(ExpectedRandom, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Consts.cs b/DiscImageChef.Tests/Consts.cs index 0804b502..7a233e14 100644 --- a/DiscImageChef.Tests/Consts.cs +++ b/DiscImageChef.Tests/Consts.cs @@ -32,4 +32,4 @@ namespace DiscImageChef.Tests { public const string TestFilesRoot = "/mnt/DiscImageChef/tests"; } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Devices/IomegaJaz.cs b/DiscImageChef.Tests/Devices/IomegaJaz.cs index 80b607a4..0bc050ee 100644 --- a/DiscImageChef.Tests/Devices/IomegaJaz.cs +++ b/DiscImageChef.Tests/Devices/IomegaJaz.cs @@ -37,21 +37,13 @@ namespace DiscImageChef.Tests.Devices [TestFixture] public class IomegaJaz { - readonly string[] testfiles = { - "jaz1.bin.lz", - }; + readonly string[] testfiles = {"jaz1.bin.lz",}; - readonly MediaType[] mediatypes = { - MediaType.Jaz, - }; + readonly MediaType[] mediatypes = {MediaType.Jaz,}; - readonly ulong[] sectors = { - 2091050, - }; + readonly ulong[] sectors = {2091050,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; [Test] public void Test() @@ -69,4 +61,4 @@ namespace DiscImageChef.Tests.Devices } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Devices/LS120.cs b/DiscImageChef.Tests/Devices/LS120.cs index cb36fa27..8ca40f0d 100644 --- a/DiscImageChef.Tests/Devices/LS120.cs +++ b/DiscImageChef.Tests/Devices/LS120.cs @@ -37,21 +37,13 @@ namespace DiscImageChef.Tests.Devices [TestFixture] public class LS120 { - readonly string[] testfiles = { - "ls120.bin.lz","mf2dd.bin.lz","mf2hd.bin.lz", - }; + readonly string[] testfiles = {"ls120.bin.lz", "mf2dd.bin.lz", "mf2hd.bin.lz",}; - readonly MediaType[] mediatypes = { - MediaType.LS120,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, - }; + readonly MediaType[] mediatypes = {MediaType.LS120, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD,}; - readonly ulong[] sectors = { - 246528,1440,2880, - }; + readonly ulong[] sectors = {246528, 1440, 2880,}; - readonly uint[] sectorsize = { - 512,512,512 - }; + readonly uint[] sectorsize = {512, 512, 512}; [Test] public void Test() @@ -69,4 +61,4 @@ namespace DiscImageChef.Tests.Devices } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Devices/PocketZip.cs b/DiscImageChef.Tests/Devices/PocketZip.cs index 7190d2db..950b25e0 100644 --- a/DiscImageChef.Tests/Devices/PocketZip.cs +++ b/DiscImageChef.Tests/Devices/PocketZip.cs @@ -37,21 +37,13 @@ namespace DiscImageChef.Tests.Devices [TestFixture] public class PocketZip { - readonly string[] testfiles = { - "clik!.bin.lz","pocketzip.bin.lz", - }; + readonly string[] testfiles = {"clik!.bin.lz", "pocketzip.bin.lz",}; - readonly MediaType[] mediatypes = { - MediaType.PocketZip,MediaType.PocketZip, - }; + readonly MediaType[] mediatypes = {MediaType.PocketZip, MediaType.PocketZip,}; - readonly ulong[] sectors = { - 78882,78882, - }; + readonly ulong[] sectors = {78882, 78882,}; - readonly uint[] sectorsize = { - 512,512, - }; + readonly uint[] sectorsize = {512, 512,}; [Test] public void Test() @@ -69,4 +61,4 @@ namespace DiscImageChef.Tests.Devices } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/ADFS.cs b/DiscImageChef.Tests/Filesystems/ADFS.cs index 304d9310..4a4eb4d0 100644 --- a/DiscImageChef.Tests/Filesystems/ADFS.cs +++ b/DiscImageChef.Tests/Filesystems/ADFS.cs @@ -38,45 +38,33 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class ADFS { - readonly string[] testfiles = { - "adfs_d.adf.lz", - "adfs_e.adf.lz", - "adfs_f.adf.lz", - "adfs_e+.adf.lz", - "adfs_f+.adf.lz", - "adfs_s.adf.lz", - "adfs_m.adf.lz", - "adfs_l.adf.lz", - "hdd_old.hdf.lz", - "hdd_new.hdf.lz", + readonly string[] testfiles = + { + "adfs_d.adf.lz", "adfs_e.adf.lz", "adfs_f.adf.lz", "adfs_e+.adf.lz", "adfs_f+.adf.lz", "adfs_s.adf.lz", + "adfs_m.adf.lz", "adfs_l.adf.lz", "hdd_old.hdf.lz", "hdd_new.hdf.lz", }; - readonly MediaType[] mediatypes = { - MediaType.ACORN_35_DS_DD, - MediaType.ACORN_35_DS_DD, - MediaType.ACORN_35_DS_HD, - MediaType.ACORN_35_DS_DD, - MediaType.ACORN_35_DS_HD, - MediaType.ACORN_525_SS_DD_40, - MediaType.ACORN_525_SS_DD_80, - MediaType.ACORN_525_DS_DD, - MediaType.GENERIC_HDD, - MediaType.GENERIC_HDD, + readonly MediaType[] mediatypes = + { + MediaType.ACORN_35_DS_DD, MediaType.ACORN_35_DS_DD, MediaType.ACORN_35_DS_HD, MediaType.ACORN_35_DS_DD, + MediaType.ACORN_35_DS_HD, MediaType.ACORN_525_SS_DD_40, MediaType.ACORN_525_SS_DD_80, + MediaType.ACORN_525_DS_DD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, }; - readonly ulong[] sectors = { 800, 800, 1600, 800, 1600, 640, 1280, 2560, 78336, 78336 }; + readonly ulong[] sectors = {800, 800, 1600, 800, 1600, 640, 1280, 2560, 78336, 78336}; - readonly uint[] sectorsize = { 1024, 1024, 1024, 1024, 1024, 256, 256, 256, 256, 256 }; + readonly uint[] sectorsize = {1024, 1024, 1024, 1024, 1024, 256, 256, 256, 256, 256}; - readonly bool[] bootable = { false, false, false, false, false, false, false, false, false, false }; + readonly bool[] bootable = {false, false, false, false, false, false, false, false, false, false}; - readonly long[] clusters = { 800, 800, 1600, 800, 1600, 640, 1280, 2560, 78336, 78336 }; + readonly long[] clusters = {800, 800, 1600, 800, 1600, 640, 1280, 2560, 78336, 78336}; - readonly uint[] clustersize = { 1024, 1024, 1024, 1024, 1024, 256, 256, 256, 256, 256 }; + readonly uint[] clustersize = {1024, 1024, 1024, 1024, 1024, 256, 256, 256, 256, 256}; - readonly string[] volumename = { "ADFSD", "ADFSE ", null, "ADFSE+ ", null, "$", "$", "$", "VolLablOld", null }; + readonly string[] volumename = + {"ADFSD", "ADFSE ", null, "ADFSE+ ", null, "$", "$", "$", "VolLablOld", null}; - readonly string[] volumeserial = { "3E48", "E13A", null, "1142", null, "F20D", "D6CA", "0CA6", "080E", null }; + readonly string[] volumeserial = {"3E48", "E13A", null, "1142", null, "F20D", "D6CA", "0CA6", "080E", null}; [Test] public void Test() @@ -109,4 +97,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/AFFS.cs b/DiscImageChef.Tests/Filesystems/AFFS.cs index c9b6d5f2..8f10c631 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS.cs @@ -38,37 +38,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class AFFS { - readonly string[] testfiles = { - "amigaos_3.9.adf.lz", "amigaos_3.9_intl.adf.lz", - }; + readonly string[] testfiles = {"amigaos_3.9.adf.lz", "amigaos_3.9_intl.adf.lz",}; - readonly MediaType[] mediatypes = { - MediaType.CBM_AMIGA_35_DD, MediaType.CBM_AMIGA_35_DD, - }; + readonly MediaType[] mediatypes = {MediaType.CBM_AMIGA_35_DD, MediaType.CBM_AMIGA_35_DD,}; - readonly ulong[] sectors = { - 1760, 1760, - }; + readonly ulong[] sectors = {1760, 1760,}; - readonly uint[] sectorsize = { - 512, 512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 1760, 1760, - }; + readonly long[] clusters = {1760, 1760,}; - readonly int[] clustersize = { - 512, 512, - }; + readonly int[] clustersize = {512, 512,}; - readonly string[] volumename = { - "Volume label", "Volume label", - }; + readonly string[] volumename = {"Volume label", "Volume label",}; - readonly string[] volumeserial = { - "A5D9FAE2", "A5DA0CC9", - }; + readonly string[] volumeserial = {"A5D9FAE2", "A5DA0CC9",}; [Test] public void Test() @@ -100,4 +84,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs b/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs index 54bf10d2..d14523ee 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class AFFS2_RDB { - readonly string[] testfiles = { - "amigaos_4.0.vdi.lz", - }; + readonly string[] testfiles = {"amigaos_4.0.vdi.lz",}; - readonly ulong[] sectors = { - 1024128, - }; + readonly ulong[] sectors = {1024128,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 511040, - }; + readonly long[] clusters = {511040,}; - readonly int[] clustersize = { - 1024, - }; + readonly int[] clustersize = {1024,}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - "611D85E5", - }; + readonly string[] volumeserial = {"611D85E5",}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs b/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs index 64c7c907..9ba14854 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class AFFS_MBR { - readonly string[] testfiles = { - "aros.vdi.lz","aros_intl.vdi.lz", - }; + readonly string[] testfiles = {"aros.vdi.lz", "aros_intl.vdi.lz",}; - readonly ulong[] sectors = { - 409600,409600, - }; + readonly ulong[] sectors = {409600, 409600,}; - readonly uint[] sectorsize = { - 512,512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 408240,408240, - }; + readonly long[] clusters = {408240, 408240,}; - readonly int[] clustersize = { - 512,512, - }; + readonly int[] clustersize = {512, 512,}; - readonly string[] volumename = { - "Volume label","Volume label", - }; + readonly string[] volumename = {"Volume label", "Volume label",}; - readonly string[] volumeserial = { - "A582DCA4","A582BC91", - }; + readonly string[] volumeserial = {"A582DCA4", "A582BC91",}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs b/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs index cbf04b26..ecdd2ca1 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class AFFS_MBR_RDB { - readonly string[] testfiles = { - "aros.vdi.lz","aros_intl.vdi.lz", - }; + readonly string[] testfiles = {"aros.vdi.lz", "aros_intl.vdi.lz",}; - readonly ulong[] sectors = { - 409600,409600, - }; + readonly ulong[] sectors = {409600, 409600,}; - readonly uint[] sectorsize = { - 512,512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 406224,406224, - }; + readonly long[] clusters = {406224, 406224,}; - readonly int[] clustersize = { - 512,512, - }; + readonly int[] clustersize = {512, 512,}; - readonly string[] volumename = { - "Volume label","Volume label", - }; + readonly string[] volumename = {"Volume label", "Volume label",}; - readonly string[] volumeserial = { - "A58348CE","A5833CD0", - }; + readonly string[] volumeserial = {"A58348CE", "A5833CD0",}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs b/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs index 3026db75..a61a00d1 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs @@ -40,40 +40,28 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class AFFS_RDB { - readonly string[] testfiles = { - "amigaos_3.9.vdi.lz","amigaos_3.9_intl.vdi.lz","aros.vdi.lz","aros_intl.vdi.lz", - "amigaos_4.0.vdi.lz","amigaos_4.0_intl.vdi.lz","amigaos_4.0_cache.vdi.lz" + readonly string[] testfiles = + { + "amigaos_3.9.vdi.lz", "amigaos_3.9_intl.vdi.lz", "aros.vdi.lz", "aros_intl.vdi.lz", "amigaos_4.0.vdi.lz", + "amigaos_4.0_intl.vdi.lz", "amigaos_4.0_cache.vdi.lz" }; - readonly ulong[] sectors = { - 1024128,1024128,409600,409600, - 1024128,1024128,1024128, + readonly ulong[] sectors = {1024128, 1024128, 409600, 409600, 1024128, 1024128, 1024128,}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512,}; + + readonly long[] clusters = {510032, 510032, 407232, 407232, 511040, 511040, 511040,}; + + readonly int[] clustersize = {1024, 1024, 512, 512, 1024, 1024, 1024,}; + + readonly string[] volumename = + { + "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", + "Volume label", }; - readonly uint[] sectorsize = { - 512,512,512,512, - 512,512,512, - }; - - readonly long[] clusters = { - 510032,510032,407232,407232, - 511040,511040,511040, - }; - - readonly int[] clustersize = { - 1024,1024,512,512, - 1024,1024,1024, - }; - - readonly string[] volumename = { - "Volume label","Volume label","Volume label","Volume label", - "Volume label","Volume label","Volume label", - }; - - readonly string[] volumeserial = { - "A56D0F5C","A56D049C","A58307A9","A58304BE", - "A56CC7EE","A56CDDC4","A56CC133", - }; + readonly string[] volumeserial = + {"A56D0F5C", "A56D049C", "A58307A9", "A58304BE", "A56CC7EE", "A56CDDC4", "A56CC133",}; [Test] public void Test() @@ -92,12 +80,14 @@ namespace DiscImageChef.Tests.Filesystems int part = -1; for(int j = 0; j < partitions.Count; j++) { - if(partitions[j].Type == "\"DOS\\1\"" || partitions[j].Type == "\"DOS\\3\"" || partitions[j].Type == "\"DOS\\5\"") + if(partitions[j].Type == "\"DOS\\1\"" || partitions[j].Type == "\"DOS\\3\"" || + partitions[j].Type == "\"DOS\\5\"") { part = j; break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -109,4 +99,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/AFS.cs b/DiscImageChef.Tests/Filesystems/AFS.cs index ba10d54d..7f16a197 100644 --- a/DiscImageChef.Tests/Filesystems/AFS.cs +++ b/DiscImageChef.Tests/Filesystems/AFS.cs @@ -38,47 +38,30 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class AFS { - readonly string[] testfiles = { - "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", + readonly string[] testfiles = + { + "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", + "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", "scoopenserver_5.0.7hw_mf2hd.img.lz", }; - readonly MediaType[] mediatypes = { - MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, - MediaType.DOS_35_HD, - }; + readonly MediaType[] mediatypes = + {MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD,}; - readonly ulong[] sectors = { - 3360, 2400, 1440, 5760, - 2880, - }; + readonly ulong[] sectors = {3360, 2400, 1440, 5760, 2880,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 1680, 1200, 720, 2880, - 1440, - }; + readonly long[] clusters = {1680, 1200, 720, 2880, 1440,}; - readonly int[] clustersize = { - 1024, 1024, 1024, 1024, - 1024, - }; + readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024,}; - readonly string[] volumename = { - "", "", "", "", - "", - }; + readonly string[] volumename = {"", "", "", "", "",}; - readonly string[] volumeserial = { - null, null, null, null, - null, - }; + readonly string[] volumeserial = {null, null, null, null, null,}; - readonly string[] type = { + readonly string[] type = + { "Acer Fast Filesystem", "Acer Fast Filesystem", "Acer Fast Filesystem", "Acer Fast Filesystem", "Acer Fast Filesystem", }; @@ -113,4 +96,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/AFS_MBR.cs b/DiscImageChef.Tests/Filesystems/AFS_MBR.cs index 15cbfc35..fccf3429 100644 --- a/DiscImageChef.Tests/Filesystems/AFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/AFS_MBR.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class AFS_MBR { - readonly string[] testfiles = { - "scoopenserver_5.0.7hw.vdi.lz" - }; + readonly string[] testfiles = {"scoopenserver_5.0.7hw.vdi.lz"}; - readonly ulong[] sectors = { - 1024000, - }; + readonly ulong[] sectors = {1024000,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 510048, - }; + readonly long[] clusters = {510048,}; - readonly int[] clustersize = { - 1024, - }; + readonly int[] clustersize = {1024,}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - null, null, - }; + readonly string[] volumeserial = {null, null,}; - readonly string[] type = { - "Acer Fast Filesystem", - }; + readonly string[] type = {"Acer Fast Filesystem",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -106,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/AOFS.cs b/DiscImageChef.Tests/Filesystems/AOFS.cs index 5733b0c4..e3c344b3 100644 --- a/DiscImageChef.Tests/Filesystems/AOFS.cs +++ b/DiscImageChef.Tests/Filesystems/AOFS.cs @@ -38,37 +38,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class AOFS { - readonly string[] testfiles = { - "amigaos_3.9.adf.lz", "amigaos_3.9_intl.adf.lz", - }; + readonly string[] testfiles = {"amigaos_3.9.adf.lz", "amigaos_3.9_intl.adf.lz",}; - readonly MediaType[] mediatypes = { - MediaType.CBM_AMIGA_35_DD, MediaType.CBM_AMIGA_35_DD, - }; + readonly MediaType[] mediatypes = {MediaType.CBM_AMIGA_35_DD, MediaType.CBM_AMIGA_35_DD,}; - readonly ulong[] sectors = { - 1760, 1760, - }; + readonly ulong[] sectors = {1760, 1760,}; - readonly uint[] sectorsize = { - 512, 512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 1760, 1760, - }; + readonly long[] clusters = {1760, 1760,}; - readonly int[] clustersize = { - 512, 512, - }; + readonly int[] clustersize = {512, 512,}; - readonly string[] volumename = { - "Volume label", "Volume label", - }; + readonly string[] volumename = {"Volume label", "Volume label",}; - readonly string[] volumeserial = { - "A5D9FE71", "A5D9F14F", - }; + readonly string[] volumeserial = {"A5D9FE71", "A5D9F14F",}; [Test] public void Test() @@ -100,4 +84,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs b/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs index 8b839fe7..fb1ab992 100644 --- a/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class AOFS_MBR { - readonly string[] testfiles = { - "aros.vdi.lz","aros_intl.vdi.lz", - }; + readonly string[] testfiles = {"aros.vdi.lz", "aros_intl.vdi.lz",}; - readonly ulong[] sectors = { - 409600,409600, - }; + readonly ulong[] sectors = {409600, 409600,}; - readonly uint[] sectorsize = { - 512,512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 408240,408240, - }; + readonly long[] clusters = {408240, 408240,}; - readonly int[] clustersize = { - 512,512, - }; + readonly int[] clustersize = {512, 512,}; - readonly string[] volumename = { - "Volume label","Volume label", - }; + readonly string[] volumename = {"Volume label", "Volume label",}; - readonly string[] volumeserial = { - "A582C90C","A582CE0D", - }; + readonly string[] volumeserial = {"A582C90C", "A582CE0D",}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs b/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs index 5be53268..80037281 100644 --- a/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class AOFS_MBR_RDB { - readonly string[] testfiles = { - "aros.vdi.lz","aros_intl.vdi.lz", - }; + readonly string[] testfiles = {"aros.vdi.lz", "aros_intl.vdi.lz",}; - readonly ulong[] sectors = { - 409600,409600, - }; + readonly ulong[] sectors = {409600, 409600,}; - readonly uint[] sectorsize = { - 512,512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 406224,406224, - }; + readonly long[] clusters = {406224, 406224,}; - readonly int[] clustersize = { - 512,512, - }; + readonly int[] clustersize = {512, 512,}; - readonly string[] volumename = { - "Volume label","Volume label", - }; + readonly string[] volumename = {"Volume label", "Volume label",}; - readonly string[] volumeserial = { - "A5833C5B","A5833085", - }; + readonly string[] volumeserial = {"A5833C5B", "A5833085",}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs b/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs index 6a83b865..853d4e39 100644 --- a/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs @@ -40,33 +40,20 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class AOFS_RDB { - readonly string[] testfiles = { - "amigaos_3.9.vdi.lz","amigaos_3.9_intl.vdi.lz","aros.vdi.lz","aros_intl.vdi.lz", - }; + readonly string[] testfiles = + {"amigaos_3.9.vdi.lz", "amigaos_3.9_intl.vdi.lz", "aros.vdi.lz", "aros_intl.vdi.lz",}; - readonly ulong[] sectors = { - 1024128,1024128,409600,409600, - }; + readonly ulong[] sectors = {1024128, 1024128, 409600, 409600,}; - readonly uint[] sectorsize = { - 512,512,512,512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512,}; - readonly long[] clusters = { - 510032,510032,407232,407232, - }; + readonly long[] clusters = {510032, 510032, 407232, 407232,}; - readonly int[] clustersize = { - 1024,1024,512,512, - }; + readonly int[] clustersize = {1024, 1024, 512, 512,}; - readonly string[] volumename = { - "Volume label","Volume label","Volume label","Volume label", - }; + readonly string[] volumename = {"Volume label", "Volume label", "Volume label", "Volume label",}; - readonly string[] volumeserial = { - "A56D13BB","A56D0415","A582F3A0","A5830B06", - }; + readonly string[] volumeserial = {"A56D13BB", "A56D0415", "A582F3A0", "A5830B06",}; [Test] public void Test() @@ -85,12 +72,14 @@ namespace DiscImageChef.Tests.Filesystems int part = -1; for(int j = 0; j < partitions.Count; j++) { - if(partitions[j].Type == "\"DOS\\0\"" || partitions[j].Type == "\"DOS\\2\"" || partitions[j].Type == "\"DOS\\4\"") + if(partitions[j].Type == "\"DOS\\0\"" || partitions[j].Type == "\"DOS\\2\"" || + partitions[j].Type == "\"DOS\\4\"") { part = j; break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs b/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs index 289e31f8..0cb826c3 100644 --- a/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class Atheos_MBR { - readonly string[] testfiles = { - "syllable_0.6.7.vdi.lz", - }; + readonly string[] testfiles = {"syllable_0.6.7.vdi.lz",}; - readonly ulong[] sectors = { - 4194304, - }; + readonly ulong[] sectors = {4194304,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 2097120, - }; + readonly long[] clusters = {2097120,}; - readonly int[] clustersize = { - 1024, - }; + readonly int[] clustersize = {1024,}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - null, - }; + readonly string[] volumeserial = {null,}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/BeFS.cs b/DiscImageChef.Tests/Filesystems/BeFS.cs index 8b1fdf43..cbc68f9f 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS.cs @@ -38,41 +38,23 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class BeFS { - readonly string[] testfiles = { - "beos_r3.1.img.lz", "beos_r4.5.img.lz", - }; + readonly string[] testfiles = {"beos_r3.1.img.lz", "beos_r4.5.img.lz",}; - readonly MediaType[] mediatypes = { - MediaType.DOS_35_HD, MediaType.DOS_35_HD, - }; + readonly MediaType[] mediatypes = {MediaType.DOS_35_HD, MediaType.DOS_35_HD,}; - readonly ulong[] sectors = { - 2880, 2880, - }; + readonly ulong[] sectors = {2880, 2880,}; - readonly uint[] sectorsize = { - 512, 512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 1440, 1440, - }; + readonly long[] clusters = {1440, 1440,}; - readonly int[] clustersize = { - 1024, 1024, - }; + readonly int[] clustersize = {1024, 1024,}; - readonly string[] volumename = { - "Volume label","Volume label", - }; + readonly string[] volumename = {"Volume label", "Volume label",}; - readonly string[] volumeserial = { - null, null, - }; + readonly string[] volumeserial = {null, null,}; - readonly string[] oemid = { - null, null, - }; + readonly string[] oemid = {null, null,}; [Test] public void Test() @@ -105,4 +87,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/BeFS_APM.cs b/DiscImageChef.Tests/Filesystems/BeFS_APM.cs index 41d7dc01..c104f9fc 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS_APM.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class BeFS_APM { - readonly string[] testfiles = { - "beos_r3.1.vdi.lz", "beos_r4.5.vdi.lz", - }; + readonly string[] testfiles = {"beos_r3.1.vdi.lz", "beos_r4.5.vdi.lz",}; - readonly ulong[] sectors = { - 1572864, 1572864, - }; + readonly ulong[] sectors = {1572864, 1572864,}; - readonly uint[] sectorsize = { - 512, 512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 786336, 786336, - }; + readonly long[] clusters = {786336, 786336,}; - readonly int[] clustersize = { - 1024, 1024, - }; + readonly int[] clustersize = {1024, 1024,}; - readonly string[] volumename = { - "Volume label","Volume label", - }; + readonly string[] volumename = {"Volume label", "Volume label",}; - readonly string[] volumeserial = { - null,null, - }; + readonly string[] volumeserial = {null, null,}; - readonly string[] oemid = { - null,null, - }; + readonly string[] oemid = {null, null,}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -107,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs b/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs index 3fc0803a..49200a6d 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class BeFS_GPT { - readonly string[] testfiles = { - "haiku_hrev51259.vdi.lz", - }; + readonly string[] testfiles = {"haiku_hrev51259.vdi.lz",}; - readonly ulong[] sectors = { - 8388608, - }; + readonly ulong[] sectors = {8388608,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 2096640, - }; + readonly long[] clusters = {2096640,}; - readonly int[] clustersize = { - 2048 - }; + readonly int[] clustersize = {2048}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - null,null, - }; + readonly string[] volumeserial = {null, null,}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs b/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs index a8f00613..e2fd3c70 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs @@ -40,33 +40,20 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class BeFS_MBR { - readonly string[] testfiles = { - "beos_r3.1.vdi.lz", "beos_r4.5.vdi.lz", "haiku_hrev51259.vdi.lz","syllable_0.6.7.vdi.lz" - }; + readonly string[] testfiles = + {"beos_r3.1.vdi.lz", "beos_r4.5.vdi.lz", "haiku_hrev51259.vdi.lz", "syllable_0.6.7.vdi.lz"}; - readonly ulong[] sectors = { - 1572864, 1572864, 8388608, 2097152, - }; + readonly ulong[] sectors = {1572864, 1572864, 8388608, 2097152,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512,}; - readonly long[] clusters = { - 786400, 785232, 2096640, 524272, - }; + readonly long[] clusters = {786400, 785232, 2096640, 524272,}; - readonly int[] clustersize = { - 1024, 1024, 2048, 2048, - }; + readonly int[] clustersize = {1024, 1024, 2048, 2048,}; - readonly string[] volumename = { - "Volume label","Volume label","Volume label","Volume label", - }; + readonly string[] volumename = {"Volume label", "Volume label", "Volume label", "Volume label",}; - readonly string[] volumeserial = { - null,null,null,null, - }; + readonly string[] volumeserial = {null, null, null, null,}; [Test] public void Test() @@ -91,6 +78,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +90,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/COHERENT.cs b/DiscImageChef.Tests/Filesystems/COHERENT.cs index 26816a39..533307fc 100644 --- a/DiscImageChef.Tests/Filesystems/COHERENT.cs +++ b/DiscImageChef.Tests/Filesystems/COHERENT.cs @@ -38,42 +38,28 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class COHERENT { - readonly string[] testfiles = { - "coherentunix_4.2.10_dsdd.img.lz", "coherentunix_4.2.10_dshd.img.lz", "coherentunix_4.2.10_mf2dd.img.lz", "coherentunix_4.2.10_mf2hd.img.lz", + readonly string[] testfiles = + { + "coherentunix_4.2.10_dsdd.img.lz", "coherentunix_4.2.10_dshd.img.lz", "coherentunix_4.2.10_mf2dd.img.lz", + "coherentunix_4.2.10_mf2hd.img.lz", }; - readonly MediaType[] mediatypes = { - MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, - }; + readonly MediaType[] mediatypes = + {MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD,}; - readonly ulong[] sectors = { - 720, 2400, 1440, 2880, - }; + readonly ulong[] sectors = {720, 2400, 1440, 2880,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512,}; - readonly long[] clusters = { - 720, 2400, 1440, 2880, - }; + readonly long[] clusters = {720, 2400, 1440, 2880,}; - readonly int[] clustersize = { - 512, 512, 512, 512, - }; + readonly int[] clustersize = {512, 512, 512, 512,}; - readonly string[] volumename = { - "noname", "noname", "noname", "noname", - }; + readonly string[] volumename = {"noname", "noname", "noname", "noname",}; - readonly string[] volumeserial = { - null, null, null, null, - null, - }; + readonly string[] volumeserial = {null, null, null, null, null,}; - readonly string[] type = { - "Coherent fs", "Coherent fs", "Coherent fs", "Coherent fs", - }; + readonly string[] type = {"Coherent fs", "Coherent fs", "Coherent fs", "Coherent fs",}; [Test] public void Test() @@ -105,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs b/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs index 948bd2df..14f8c1c2 100644 --- a/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class COHERENT_MBR { - readonly string[] testfiles = { - "coherentunix_4.2.10.vdi.lz" - }; + readonly string[] testfiles = {"coherentunix_4.2.10.vdi.lz"}; - readonly ulong[] sectors = { - 1024000, - }; + readonly ulong[] sectors = {1024000,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 510048, - }; + readonly long[] clusters = {510048,}; - readonly int[] clustersize = { - 1024, - }; + readonly int[] clustersize = {1024,}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - null, - }; + readonly string[] volumeserial = {null,}; - readonly string[] type = { - "Coherent fs", - }; + readonly string[] type = {"Coherent fs",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -106,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/DTFS.cs b/DiscImageChef.Tests/Filesystems/DTFS.cs index 45799d81..6e9370f1 100644 --- a/DiscImageChef.Tests/Filesystems/DTFS.cs +++ b/DiscImageChef.Tests/Filesystems/DTFS.cs @@ -38,50 +38,29 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class DTFS { - readonly string[] testfiles = { - "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", + readonly string[] testfiles = + { + "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", + "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", "scoopenserver_5.0.7hw_mf2hd.img.lz", }; - readonly MediaType[] mediatypes = { - MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, - MediaType.DOS_35_HD, - }; + readonly MediaType[] mediatypes = + {MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD,}; - readonly ulong[] sectors = { - 3360, 2400, 1440, 5760, - 2880, - }; + readonly ulong[] sectors = {3360, 2400, 1440, 5760, 2880,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 1680, 1200, 720, 2880, - 1440, - }; + readonly long[] clusters = {1680, 1200, 720, 2880, 1440,}; - readonly int[] clustersize = { - 1024, 1024, 1024, 1024, - 1024, - }; + readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024,}; - readonly string[] volumename = { - "", "", "", "", - "", - }; + readonly string[] volumename = {"", "", "", "", "",}; - readonly string[] volumeserial = { - null, null, null, null, - null, - }; + readonly string[] volumeserial = {null, null, null, null, null,}; - readonly string[] type = { - "DTFS", "DTFS", "DTFS", "DTFS", - "DTFS", - }; + readonly string[] type = {"DTFS", "DTFS", "DTFS", "DTFS", "DTFS",}; [Test] public void Test() @@ -113,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs b/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs index 5ccd80ef..a2e1d26a 100644 --- a/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class DTFS_MBR { - readonly string[] testfiles = { - "scoopenserver_5.0.7hw.vdi.lz" - }; + readonly string[] testfiles = {"scoopenserver_5.0.7hw.vdi.lz"}; - readonly ulong[] sectors = { - 1024000, - }; + readonly ulong[] sectors = {1024000,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 510048, - }; + readonly long[] clusters = {510048,}; - readonly int[] clustersize = { - 1024, - }; + readonly int[] clustersize = {1024,}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - null, - }; + readonly string[] volumeserial = {null,}; - readonly string[] type = { - "DTFS", - }; + readonly string[] type = {"DTFS",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -106,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/EAFS.cs b/DiscImageChef.Tests/Filesystems/EAFS.cs index 90d5b104..d30369c3 100644 --- a/DiscImageChef.Tests/Filesystems/EAFS.cs +++ b/DiscImageChef.Tests/Filesystems/EAFS.cs @@ -38,49 +38,32 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class EAFS { - readonly string[] testfiles = { - "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", + readonly string[] testfiles = + { + "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", + "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", "scoopenserver_5.0.7hw_mf2hd.img.lz", }; - readonly MediaType[] mediatypes = { - MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, - MediaType.DOS_35_HD, - }; + readonly MediaType[] mediatypes = + {MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD,}; - readonly ulong[] sectors = { - 3360, 2400, 1440, 5760, - 2880, - }; + readonly ulong[] sectors = {3360, 2400, 1440, 5760, 2880,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 1680, 1200, 720, 2880, - 1440, - }; + readonly long[] clusters = {1680, 1200, 720, 2880, 1440,}; - readonly int[] clustersize = { - 1024, 1024, 1024, 1024, - 1024, - }; + readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024,}; - readonly string[] volumename = { - "", "", "", "", - "", - }; + readonly string[] volumename = {"", "", "", "", "",}; - readonly string[] volumeserial = { - null, null, null, null, - null, - }; + readonly string[] volumeserial = {null, null, null, null, null,}; - readonly string[] type = { - "Extended Acer Fast Filesystem", "Extended Acer Fast Filesystem", "Extended Acer Fast Filesystem", "Extended Acer Fast Filesystem", - "Extended Acer Fast Filesystem", + readonly string[] type = + { + "Extended Acer Fast Filesystem", "Extended Acer Fast Filesystem", "Extended Acer Fast Filesystem", + "Extended Acer Fast Filesystem", "Extended Acer Fast Filesystem", }; [Test] @@ -113,4 +96,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs b/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs index 25d5f1a4..b8d5f495 100644 --- a/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class EAFS_MBR { - readonly string[] testfiles = { - "scoopenserver_5.0.7hw.vdi.lz" - }; + readonly string[] testfiles = {"scoopenserver_5.0.7hw.vdi.lz"}; - readonly ulong[] sectors = { - 1024000, - }; + readonly ulong[] sectors = {1024000,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 510048, - }; + readonly long[] clusters = {510048,}; - readonly int[] clustersize = { - 1024, - }; + readonly int[] clustersize = {1024,}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - null, - }; + readonly string[] volumeserial = {null,}; - readonly string[] type = { - "Extended Acer Fast Filesystem", - }; + readonly string[] type = {"Extended Acer Fast Filesystem",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -106,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/F2FS.cs b/DiscImageChef.Tests/Filesystems/F2FS.cs index deccb6b1..012ff0e7 100644 --- a/DiscImageChef.Tests/Filesystems/F2FS.cs +++ b/DiscImageChef.Tests/Filesystems/F2FS.cs @@ -41,33 +41,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class F2FS { - readonly string[] testfiles = { - "linux.vdi.lz", - }; + readonly string[] testfiles = {"linux.vdi.lz",}; - readonly ulong[] sectors = { - 262144, - }; + readonly ulong[] sectors = {262144,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 32512, - }; + readonly long[] clusters = {32512,}; - readonly int[] clustersize = { - 4096, - }; + readonly int[] clustersize = {4096,}; - readonly string[] volumename = { - "VolumeLabel", - }; + readonly string[] volumename = {"VolumeLabel",}; - readonly string[] volumeserial = { - "81bd3a4e-de0c-484c-becc-aaa479b2070a", - }; + readonly string[] volumeserial = {"81bd3a4e-de0c-484c-becc-aaa479b2070a",}; [Test] public void Test() @@ -93,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -104,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/FAT12.cs b/DiscImageChef.Tests/Filesystems/FAT12.cs index e28231a4..87f94b56 100644 --- a/DiscImageChef.Tests/Filesystems/FAT12.cs +++ b/DiscImageChef.Tests/Filesystems/FAT12.cs @@ -38,7 +38,8 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class FAT12 { - readonly string[] testfiles = { + readonly string[] testfiles = + { // Concurrent DOS 6.00 "concurrentdos_6.00_dshd.img.lz", "concurrentdos_6.00_mf2dd.img.lz", "concurrentdos_6.00_mf2hd.img.lz", // DR-DOS 3.40 @@ -63,200 +64,218 @@ namespace DiscImageChef.Tests.Filesystems "drdos_8.00_dsdd.img.lz", "drdos_8.00_dsdd8.img.lz", "drdos_8.00_dshd.img.lz", "drdos_8.00_mf2dd.img.lz", "drdos_8.00_mf2ed.img.lz", "drdos_8.00_mf2hd.img.lz", "drdos_8.00_ssdd.img.lz", "drdos_8.00_ssdd8.img.lz", // MS-DOS 3.30A - "msdos_3.30A_dsdd.img.lz","msdos_3.30A_dsdd8.img.lz","msdos_3.30A_dshd.img.lz","msdos_3.30A_mf2dd.img.lz", - "msdos_3.30A_mf2hd.img.lz","msdos_3.30A_ssdd.img.lz","msdos_3.30A_ssdd8.img.lz", + "msdos_3.30A_dsdd.img.lz", "msdos_3.30A_dsdd8.img.lz", "msdos_3.30A_dshd.img.lz", + "msdos_3.30A_mf2dd.img.lz", "msdos_3.30A_mf2hd.img.lz", "msdos_3.30A_ssdd.img.lz", + "msdos_3.30A_ssdd8.img.lz", // MS-DOS 3.31 - "msdos_3.31_dsdd.img.lz","msdos_3.31_dsdd8.img.lz","msdos_3.31_dshd.img.lz","msdos_3.31_mf2dd.img.lz", - "msdos_3.31_mf2hd.img.lz","msdos_3.31_ssdd.img.lz","msdos_3.31_ssdd8.img.lz", + "msdos_3.31_dsdd.img.lz", "msdos_3.31_dsdd8.img.lz", "msdos_3.31_dshd.img.lz", "msdos_3.31_mf2dd.img.lz", + "msdos_3.31_mf2hd.img.lz", "msdos_3.31_ssdd.img.lz", "msdos_3.31_ssdd8.img.lz", // MS-DOS 4.01 - "msdos_4.01_dsdd.img.lz","msdos_4.01_dsdd8.img.lz","msdos_4.01_dshd.img.lz","msdos_4.01_mf2dd.img.lz", - "msdos_4.01_mf2hd.img.lz","msdos_4.01_ssdd.img.lz","msdos_4.01_ssdd8.img.lz", + "msdos_4.01_dsdd.img.lz", "msdos_4.01_dsdd8.img.lz", "msdos_4.01_dshd.img.lz", "msdos_4.01_mf2dd.img.lz", + "msdos_4.01_mf2hd.img.lz", "msdos_4.01_ssdd.img.lz", "msdos_4.01_ssdd8.img.lz", // MS-DOS 5.00 - "msdos_5.00_dsdd.img.lz","msdos_5.00_dsdd8.img.lz","msdos_5.00_dshd.img.lz","msdos_5.00_mf2dd.img.lz", - "msdos_5.00_mf2ed.img.lz","msdos_5.00_mf2hd.img.lz","msdos_5.00_ssdd.img.lz","msdos_5.00_ssdd8.img.lz", + "msdos_5.00_dsdd.img.lz", "msdos_5.00_dsdd8.img.lz", "msdos_5.00_dshd.img.lz", "msdos_5.00_mf2dd.img.lz", + "msdos_5.00_mf2ed.img.lz", "msdos_5.00_mf2hd.img.lz", "msdos_5.00_ssdd.img.lz", "msdos_5.00_ssdd8.img.lz", // MS-DOS 6.00 - "msdos_6.00_dsdd.img.lz","msdos_6.00_dsdd8.img.lz","msdos_6.00_dshd.img.lz","msdos_6.00_mf2dd.img.lz", - "msdos_6.00_mf2ed.img.lz","msdos_6.00_mf2hd.img.lz","msdos_6.00_ssdd.img.lz","msdos_6.00_ssdd8.img.lz", + "msdos_6.00_dsdd.img.lz", "msdos_6.00_dsdd8.img.lz", "msdos_6.00_dshd.img.lz", "msdos_6.00_mf2dd.img.lz", + "msdos_6.00_mf2ed.img.lz", "msdos_6.00_mf2hd.img.lz", "msdos_6.00_ssdd.img.lz", "msdos_6.00_ssdd8.img.lz", // MS-DOS 6.20 - "msdos_6.20_dsdd.img.lz","msdos_6.20_dsdd8.img.lz","msdos_6.20_dshd.img.lz","msdos_6.20_mf2dd.img.lz", - "msdos_6.20_mf2ed.img.lz","msdos_6.20_mf2hd.img.lz","msdos_6.20_ssdd.img.lz","msdos_6.20_ssdd8.img.lz", + "msdos_6.20_dsdd.img.lz", "msdos_6.20_dsdd8.img.lz", "msdos_6.20_dshd.img.lz", "msdos_6.20_mf2dd.img.lz", + "msdos_6.20_mf2ed.img.lz", "msdos_6.20_mf2hd.img.lz", "msdos_6.20_ssdd.img.lz", "msdos_6.20_ssdd8.img.lz", // MS-DOS 6.20 RC1 - "msdos_6.20rc1_dsdd.img.lz","msdos_6.20rc1_dsdd8.img.lz","msdos_6.20rc1_dshd.img.lz","msdos_6.20rc1_mf2dd.img.lz", - "msdos_6.20rc1_mf2ed.img.lz","msdos_6.20rc1_mf2hd.img.lz","msdos_6.20rc1_ssdd.img.lz","msdos_6.20rc1_ssdd8.img.lz", + "msdos_6.20rc1_dsdd.img.lz", "msdos_6.20rc1_dsdd8.img.lz", "msdos_6.20rc1_dshd.img.lz", + "msdos_6.20rc1_mf2dd.img.lz", "msdos_6.20rc1_mf2ed.img.lz", "msdos_6.20rc1_mf2hd.img.lz", + "msdos_6.20rc1_ssdd.img.lz", "msdos_6.20rc1_ssdd8.img.lz", // MS-DOS 6.21 - "msdos_6.21_dsdd.img.lz","msdos_6.21_dsdd8.img.lz","msdos_6.21_dshd.img.lz","msdos_6.21_mf2dd.img.lz", - "msdos_6.21_mf2ed.img.lz","msdos_6.21_mf2hd.img.lz","msdos_6.21_ssdd.img.lz","msdos_6.21_ssdd8.img.lz", + "msdos_6.21_dsdd.img.lz", "msdos_6.21_dsdd8.img.lz", "msdos_6.21_dshd.img.lz", "msdos_6.21_mf2dd.img.lz", + "msdos_6.21_mf2ed.img.lz", "msdos_6.21_mf2hd.img.lz", "msdos_6.21_ssdd.img.lz", "msdos_6.21_ssdd8.img.lz", // MS-DOS 6.22 - "msdos_6.22_dsdd.img.lz","msdos_6.22_dsdd8.img.lz","msdos_6.22_dshd.img.lz","msdos_6.22_mf2dd.img.lz", - "msdos_6.22_mf2ed.img.lz","msdos_6.22_mf2hd.img.lz","msdos_6.22_ssdd.img.lz","msdos_6.22_ssdd8.img.lz", + "msdos_6.22_dsdd.img.lz", "msdos_6.22_dsdd8.img.lz", "msdos_6.22_dshd.img.lz", "msdos_6.22_mf2dd.img.lz", + "msdos_6.22_mf2ed.img.lz", "msdos_6.22_mf2hd.img.lz", "msdos_6.22_ssdd.img.lz", "msdos_6.22_ssdd8.img.lz", // MS-DOS 7.10 - "msdos_7.10_dsdd.img.lz","msdos_7.10_dsdd8.img.lz","msdos_7.10_dshd.img.lz","msdos_7.10_mf2dd.img.lz", - "msdos_7.10_mf2ed.img.lz","msdos_7.10_mf2hd.img.lz","msdos_7.10_ssdd.img.lz","msdos_7.10_ssdd8.img.lz", + "msdos_7.10_dsdd.img.lz", "msdos_7.10_dsdd8.img.lz", "msdos_7.10_dshd.img.lz", "msdos_7.10_mf2dd.img.lz", + "msdos_7.10_mf2ed.img.lz", "msdos_7.10_mf2hd.img.lz", "msdos_7.10_ssdd.img.lz", "msdos_7.10_ssdd8.img.lz", // MS-DOS 3.20 for Amstrad - "msdos_amstrad_3.20_dsdd.img.lz","msdos_amstrad_3.20_dsdd8.img.lz","msdos_amstrad_3.20_dshd.img.lz", - "msdos_amstrad_3.20_mf2dd.img.lz","msdos_amstrad_3.20_ssdd.img.lz","msdos_amstrad_3.20_ssdd8.img.lz", + "msdos_amstrad_3.20_dsdd.img.lz", "msdos_amstrad_3.20_dsdd8.img.lz", "msdos_amstrad_3.20_dshd.img.lz", + "msdos_amstrad_3.20_mf2dd.img.lz", "msdos_amstrad_3.20_ssdd.img.lz", "msdos_amstrad_3.20_ssdd8.img.lz", // MS-DOS 2.11 for AT&T "msdos_att_2.11_dsdd.img.lz", // MS-DOS 3.30 for DeLL - "msdos_dell_3.30_dsdd.img.lz","msdos_dell_3.30_dsdd8.img.lz","msdos_dell_3.30_dshd.img.lz", - "msdos_dell_3.30_mf2dd.img.lz","msdos_dell_3.30_mf2hd.img.lz","msdos_dell_3.30_ssdd.img.lz", + "msdos_dell_3.30_dsdd.img.lz", "msdos_dell_3.30_dsdd8.img.lz", "msdos_dell_3.30_dshd.img.lz", + "msdos_dell_3.30_mf2dd.img.lz", "msdos_dell_3.30_mf2hd.img.lz", "msdos_dell_3.30_ssdd.img.lz", "msdos_dell_3.30_ssdd8.img.lz", // MS-DOS 3.10 for Epson - "msdos_epson_3.10_dsdd.img.lz","msdos_epson_3.10_dsdd8.img.lz","msdos_epson_3.10_dshd.img.lz", + "msdos_epson_3.10_dsdd.img.lz", "msdos_epson_3.10_dsdd8.img.lz", "msdos_epson_3.10_dshd.img.lz", // MS-DOS 3.20 for Epson - "msdos_epson_3.20_dsdd.img.lz","msdos_epson_3.20_dsdd8.img.lz","msdos_epson_3.20_dshd.img.lz", - "msdos_epson_3.20_mf2dd.img.lz","msdos_epson_3.20_ssdd.img.lz","msdos_epson_3.20_ssdd8.img.lz", + "msdos_epson_3.20_dsdd.img.lz", "msdos_epson_3.20_dsdd8.img.lz", "msdos_epson_3.20_dshd.img.lz", + "msdos_epson_3.20_mf2dd.img.lz", "msdos_epson_3.20_ssdd.img.lz", "msdos_epson_3.20_ssdd8.img.lz", // MS-DOS 3.20 for HP - "msdos_hp_3.20_dsdd.img.lz","msdos_hp_3.20_dsdd8.img.lz","msdos_hp_3.20_dshd.img.lz", - "msdos_hp_3.20_mf2dd.img.lz","msdos_hp_3.20_mf2hd.img.lz","msdos_hp_3.20_ssdd.img.lz", + "msdos_hp_3.20_dsdd.img.lz", "msdos_hp_3.20_dsdd8.img.lz", "msdos_hp_3.20_dshd.img.lz", + "msdos_hp_3.20_mf2dd.img.lz", "msdos_hp_3.20_mf2hd.img.lz", "msdos_hp_3.20_ssdd.img.lz", "msdos_hp_3.20_ssdd8.img.lz", // MS-DOS 3.21 for Hyosung - "msdos_hyonsung_3.21_dsdd.img.lz","msdos_hyonsung_3.21_dsdd8.img.lz","msdos_hyonsung_3.21_dshd.img.lz", - "msdos_hyonsung_3.21_mf2dd.img.lz","msdos_hyonsung_3.21_mf2hd.img.lz","msdos_hyonsung_3.21_ssdd.img.lz", + "msdos_hyonsung_3.21_dsdd.img.lz", "msdos_hyonsung_3.21_dsdd8.img.lz", "msdos_hyonsung_3.21_dshd.img.lz", + "msdos_hyonsung_3.21_mf2dd.img.lz", "msdos_hyonsung_3.21_mf2hd.img.lz", "msdos_hyonsung_3.21_ssdd.img.lz", "msdos_hyonsung_3.21_ssdd8.img.lz", // MS-DOS 3.21 for Kaypro - "msdos_kaypro_3.21_dsdd.img.lz","msdos_kaypro_3.21_dsdd8.img.lz","msdos_kaypro_3.21_dshd.img.lz", - "msdos_kaypro_3.21_mf2dd.img.lz","msdos_kaypro_3.21_mf2hd.img.lz","msdos_kaypro_3.21_ssdd.img.lz", + "msdos_kaypro_3.21_dsdd.img.lz", "msdos_kaypro_3.21_dsdd8.img.lz", "msdos_kaypro_3.21_dshd.img.lz", + "msdos_kaypro_3.21_mf2dd.img.lz", "msdos_kaypro_3.21_mf2hd.img.lz", "msdos_kaypro_3.21_ssdd.img.lz", "msdos_kaypro_3.21_ssdd8.img.lz", // MS-DOS 3.10 for Olivetti - "msdos_olivetti_3.10_dsdd.img.lz","msdos_olivetti_3.10_dshd.img.lz","msdos_olivetti_3.10_ssdd.img.lz", + "msdos_olivetti_3.10_dsdd.img.lz", "msdos_olivetti_3.10_dshd.img.lz", "msdos_olivetti_3.10_ssdd.img.lz", // MS-DOS 3.30 for Toshiba - "msdos_toshiba_3.30_dsdd.img.lz","msdos_toshiba_3.30_dsdd8.img.lz","msdos_toshiba_3.30_dshd.img.lz", - "msdos_toshiba_3.30_mf2dd.img.lz","msdos_toshiba_3.30_mf2hd.img.lz","msdos_toshiba_3.30_ssdd.img.lz", + "msdos_toshiba_3.30_dsdd.img.lz", "msdos_toshiba_3.30_dsdd8.img.lz", "msdos_toshiba_3.30_dshd.img.lz", + "msdos_toshiba_3.30_mf2dd.img.lz", "msdos_toshiba_3.30_mf2hd.img.lz", "msdos_toshiba_3.30_ssdd.img.lz", "msdos_toshiba_3.30_ssdd8.img.lz", // MS-DOS 4.01 for Toshiba - "msdos_toshiba_4.01_dsdd.img.lz","msdos_toshiba_4.01_dsdd8.img.lz","msdos_toshiba_4.01_dshd.img.lz", - "msdos_toshiba_4.01_mf2dd.img.lz","msdos_toshiba_4.01_mf2hd.img.lz","msdos_toshiba_4.01_ssdd.img.lz", + "msdos_toshiba_4.01_dsdd.img.lz", "msdos_toshiba_4.01_dsdd8.img.lz", "msdos_toshiba_4.01_dshd.img.lz", + "msdos_toshiba_4.01_mf2dd.img.lz", "msdos_toshiba_4.01_mf2hd.img.lz", "msdos_toshiba_4.01_ssdd.img.lz", "msdos_toshiba_4.01_ssdd8.img.lz", // Novell DOS 7.00 - "novelldos_7.00_dsdd.img.lz","novelldos_7.00_dsdd8.img.lz","novelldos_7.00_dshd.img.lz","novelldos_7.00_mf2dd.img.lz", - "novelldos_7.00_mf2ed.img.lz","novelldos_7.00_mf2hd.img.lz","novelldos_7.00_ssdd.img.lz","novelldos_7.00_ssdd8.img.lz", + "novelldos_7.00_dsdd.img.lz", "novelldos_7.00_dsdd8.img.lz", "novelldos_7.00_dshd.img.lz", + "novelldos_7.00_mf2dd.img.lz", "novelldos_7.00_mf2ed.img.lz", "novelldos_7.00_mf2hd.img.lz", + "novelldos_7.00_ssdd.img.lz", "novelldos_7.00_ssdd8.img.lz", // OpenDOS 7.01 - "opendos_7.01_dsdd.img.lz","opendos_7.01_dsdd8.img.lz","opendos_7.01_dshd.img.lz","opendos_7.01_mf2dd.img.lz", - "opendos_7.01_mf2ed.img.lz","opendos_7.01_mf2hd.img.lz","opendos_7.01_ssdd.img.lz","opendos_7.01_ssdd8.img.lz", + "opendos_7.01_dsdd.img.lz", "opendos_7.01_dsdd8.img.lz", "opendos_7.01_dshd.img.lz", + "opendos_7.01_mf2dd.img.lz", "opendos_7.01_mf2ed.img.lz", "opendos_7.01_mf2hd.img.lz", + "opendos_7.01_ssdd.img.lz", "opendos_7.01_ssdd8.img.lz", // PC-DOS 2.00 "pcdos_2.00_dsdd.img.lz", // PC-DOS 2.10 "pcdos_2.10_dsdd.img.lz", // PC-DOS 2000 - "pcdos_2000_dsdd.img.lz","pcdos_2000_dsdd8.img.lz","pcdos_2000_dshd.img.lz","pcdos_2000_mf2dd.img.lz", - "pcdos_2000_mf2ed.img.lz","pcdos_2000_mf2hd.img.lz","pcdos_2000_ssdd.img.lz","pcdos_2000_ssdd8.img.lz", + "pcdos_2000_dsdd.img.lz", "pcdos_2000_dsdd8.img.lz", "pcdos_2000_dshd.img.lz", "pcdos_2000_mf2dd.img.lz", + "pcdos_2000_mf2ed.img.lz", "pcdos_2000_mf2hd.img.lz", "pcdos_2000_ssdd.img.lz", "pcdos_2000_ssdd8.img.lz", // PC-DOS 3.00 "pcdos_3.00_dshd.img.lz", // PC-DOS 3.10 "pcdos_3.10_dshd.img.lz", // PC-DOS 3.30 - "pcdos_3.30_dshd.img.lz","pcdos_3.30_mf2hd.img.lz", + "pcdos_3.30_dshd.img.lz", "pcdos_3.30_mf2hd.img.lz", // PC-DOS 4.00 - "pcdos_4.00_dshd.img.lz","pcdos_4.00_mf2hd.img.lz", + "pcdos_4.00_dshd.img.lz", "pcdos_4.00_mf2hd.img.lz", // PC-DOS 5.00 - "pcdos_5.00_dsdd.img.lz","pcdos_5.00_dsdd8.img.lz","pcdos_5.00_dshd.img.lz","pcdos_5.00_mf2dd.img.lz", - "pcdos_5.00_mf2ed.img.lz","pcdos_5.00_mf2hd.img.lz","pcdos_5.00_ssdd.img.lz","pcdos_5.00_ssdd8.img.lz", + "pcdos_5.00_dsdd.img.lz", "pcdos_5.00_dsdd8.img.lz", "pcdos_5.00_dshd.img.lz", "pcdos_5.00_mf2dd.img.lz", + "pcdos_5.00_mf2ed.img.lz", "pcdos_5.00_mf2hd.img.lz", "pcdos_5.00_ssdd.img.lz", "pcdos_5.00_ssdd8.img.lz", // PC-DOS 5.02 - "pcdos_5.02_dsdd.img.lz","pcdos_5.02_dsdd8.img.lz","pcdos_5.02_dshd.img.lz","pcdos_5.02_mf2dd.img.lz", - "pcdos_5.02_mf2ed.img.lz","pcdos_5.02_mf2hd.img.lz","pcdos_5.02_ssdd.img.lz","pcdos_5.02_ssdd8.img.lz", + "pcdos_5.02_dsdd.img.lz", "pcdos_5.02_dsdd8.img.lz", "pcdos_5.02_dshd.img.lz", "pcdos_5.02_mf2dd.img.lz", + "pcdos_5.02_mf2ed.img.lz", "pcdos_5.02_mf2hd.img.lz", "pcdos_5.02_ssdd.img.lz", "pcdos_5.02_ssdd8.img.lz", // PC-DOS 6.10 - "pcdos_6.10_dsdd.img.lz","pcdos_6.10_dsdd8.img.lz","pcdos_6.10_dshd.img.lz","pcdos_6.10_mf2dd.img.lz", - "pcdos_6.10_mf2ed.img.lz","pcdos_6.10_mf2hd.img.lz","pcdos_6.10_ssdd.img.lz","pcdos_6.10_ssdd8.img.lz", + "pcdos_6.10_dsdd.img.lz", "pcdos_6.10_dsdd8.img.lz", "pcdos_6.10_dshd.img.lz", "pcdos_6.10_mf2dd.img.lz", + "pcdos_6.10_mf2ed.img.lz", "pcdos_6.10_mf2hd.img.lz", "pcdos_6.10_ssdd.img.lz", "pcdos_6.10_ssdd8.img.lz", // PC-DOS 6.30 - "pcdos_6.30_dsdd.img.lz","pcdos_6.30_dsdd8.img.lz","pcdos_6.30_dshd.img.lz","pcdos_6.30_mf2dd.img.lz", - "pcdos_6.30_mf2ed.img.lz","pcdos_6.30_mf2hd.img.lz","pcdos_6.30_ssdd.img.lz","pcdos_6.30_ssdd8.img.lz", + "pcdos_6.30_dsdd.img.lz", "pcdos_6.30_dsdd8.img.lz", "pcdos_6.30_dshd.img.lz", "pcdos_6.30_mf2dd.img.lz", + "pcdos_6.30_mf2ed.img.lz", "pcdos_6.30_mf2hd.img.lz", "pcdos_6.30_ssdd.img.lz", "pcdos_6.30_ssdd8.img.lz", // mkfs.vfat - "mkfs.vfat_dshd.img.lz","mkfs.vfat_mf2dd.img.lz","mkfs.vfat_mf2ed.img.lz","mkfs.vfat_mf2hd.img.lz", + "mkfs.vfat_dshd.img.lz", "mkfs.vfat_mf2dd.img.lz", "mkfs.vfat_mf2ed.img.lz", "mkfs.vfat_mf2hd.img.lz", // mkfs.vfat for Atari - "mkfs.vfat_atari_dshd.img.lz","mkfs.vfat_atari_mf2dd.img.lz","mkfs.vfat_atari_mf2ed.img.lz","mkfs.vfat_atari_mf2hd.img.lz", + "mkfs.vfat_atari_dshd.img.lz", "mkfs.vfat_atari_mf2dd.img.lz", "mkfs.vfat_atari_mf2ed.img.lz", + "mkfs.vfat_atari_mf2hd.img.lz", // Microsoft OS/2 1.00 for Tandy - "msos2_1.00_tandy_dsdd.img.lz","msos2_1.00_tandy_dshd.img.lz","msos2_1.00_tandy_mf2dd.img.lz","msos2_1.00_tandy_mf2hd.img.lz", + "msos2_1.00_tandy_dsdd.img.lz", "msos2_1.00_tandy_dshd.img.lz", "msos2_1.00_tandy_mf2dd.img.lz", + "msos2_1.00_tandy_mf2hd.img.lz", // Microsoft OS/2 1.10 for AST - "msos2_1.10_ast_dsdd.img.lz","msos2_1.10_ast_dshd.img.lz","msos2_1.10_ast_mf2dd.img.lz","msos2_1.10_ast_mf2hd.img.lz", + "msos2_1.10_ast_dsdd.img.lz", "msos2_1.10_ast_dshd.img.lz", "msos2_1.10_ast_mf2dd.img.lz", + "msos2_1.10_ast_mf2hd.img.lz", // Microsoft OS/2 1.10 for Nokia - "msos2_1.10_nokia_dsdd.img.lz","msos2_1.10_nokia_dshd.img.lz","msos2_1.10_nokia_mf2dd.img.lz","msos2_1.10_nokia_mf2hd.img.lz", + "msos2_1.10_nokia_dsdd.img.lz", "msos2_1.10_nokia_dshd.img.lz", "msos2_1.10_nokia_mf2dd.img.lz", + "msos2_1.10_nokia_mf2hd.img.lz", // Microsoft OS/2 1.21 - "msos2_1.21_dsdd.img.lz","msos2_1.21_dshd.img.lz","msos2_1.21_mf2dd.img.lz","msos2_1.21_mf2hd.img.lz", + "msos2_1.21_dsdd.img.lz", "msos2_1.21_dshd.img.lz", "msos2_1.21_mf2dd.img.lz", "msos2_1.21_mf2hd.img.lz", // Microsoft OS/2 1.30.1 - "msos2_1.30.1_dsdd.img.lz","msos2_1.30.1_dshd.img.lz","msos2_1.30.1_mf2dd.img.lz","msos2_1.30.1_mf2ed.img.lz","msos2_1.30.1_mf2hd.img.lz", + "msos2_1.30.1_dsdd.img.lz", "msos2_1.30.1_dshd.img.lz", "msos2_1.30.1_mf2dd.img.lz", + "msos2_1.30.1_mf2ed.img.lz", "msos2_1.30.1_mf2hd.img.lz", // OS/2 1.20 - "os2_1.20_dsdd.img.lz","os2_1.20_dshd.img.lz","os2_1.20_mf2dd.img.lz","os2_1.20_mf2hd.img.lz", + "os2_1.20_dsdd.img.lz", "os2_1.20_dshd.img.lz", "os2_1.20_mf2dd.img.lz", "os2_1.20_mf2hd.img.lz", // OS/2 1.30 - "os2_1.30_dsdd.img.lz","os2_1.30_dshd.img.lz","os2_1.30_mf2dd.img.lz","os2_1.30_mf2hd.img.lz", + "os2_1.30_dsdd.img.lz", "os2_1.30_dshd.img.lz", "os2_1.30_mf2dd.img.lz", "os2_1.30_mf2hd.img.lz", // OS/2 2.00 - "os2_6.307_dsdd.img.lz","os2_6.307_dshd.img.lz","os2_6.307_mf2dd.img.lz","os2_6.307_mf2ed.img.lz","os2_6.307_mf2hd.img.lz", + "os2_6.307_dsdd.img.lz", "os2_6.307_dshd.img.lz", "os2_6.307_mf2dd.img.lz", "os2_6.307_mf2ed.img.lz", + "os2_6.307_mf2hd.img.lz", // OS/2 2.10 - "os2_6.514_dsdd.img.lz","os2_6.514_dshd.img.lz","os2_6.514_mf2dd.img.lz","os2_6.514_mf2ed.img.lz","os2_6.514_mf2hd.img.lz", + "os2_6.514_dsdd.img.lz", "os2_6.514_dshd.img.lz", "os2_6.514_mf2dd.img.lz", "os2_6.514_mf2ed.img.lz", + "os2_6.514_mf2hd.img.lz", // OS/2 2.11 - "os2_6.617_dsdd.img.lz","os2_6.617_dshd.img.lz","os2_6.617_mf2dd.img.lz","os2_6.617_mf2ed.img.lz","os2_6.617_mf2hd.img.lz", + "os2_6.617_dsdd.img.lz", "os2_6.617_dshd.img.lz", "os2_6.617_mf2dd.img.lz", "os2_6.617_mf2ed.img.lz", + "os2_6.617_mf2hd.img.lz", // OS/2 Warp 3 - "os2_8.162_dshd.img.lz","os2_8.162_mf2dd.img.lz","os2_8.162_mf2ed.img.lz","os2_8.162_mf2hd.img.lz", + "os2_8.162_dshd.img.lz", "os2_8.162_mf2dd.img.lz", "os2_8.162_mf2ed.img.lz", "os2_8.162_mf2hd.img.lz", // OS/2 Warp 4 - "os2_9.023_dshd.img.lz","os2_9.023_mf2dd.img.lz","os2_9.023_mf2ed.img.lz","os2_9.023_mf2hd.img.lz", + "os2_9.023_dshd.img.lz", "os2_9.023_mf2dd.img.lz", "os2_9.023_mf2ed.img.lz", "os2_9.023_mf2hd.img.lz", // eComStation - "ecs_dshd.img.lz","ecs_mf2dd.img.lz","ecs_mf2ed.img.lz","ecs_mf2hd.img.lz", + "ecs_dshd.img.lz", "ecs_mf2dd.img.lz", "ecs_mf2ed.img.lz", "ecs_mf2hd.img.lz", // Windows 95 - "win95_dsdd8.img.lz","win95_dsdd.img.lz","win95_dshd.img.lz","win95_mf2dd.img.lz", - "win95_mf2ed.img.lz","win95_mf2hd.img.lz","win95_ssdd8.img.lz","win95_ssdd.img.lz", + "win95_dsdd8.img.lz", "win95_dsdd.img.lz", "win95_dshd.img.lz", "win95_mf2dd.img.lz", "win95_mf2ed.img.lz", + "win95_mf2hd.img.lz", "win95_ssdd8.img.lz", "win95_ssdd.img.lz", // Windows 95 OSR 2 - "win95osr2_dsdd8.img.lz","win95osr2_dsdd.img.lz","win95osr2_dshd.img.lz","win95osr2_mf2dd.img.lz", - "win95osr2_mf2ed.img.lz","win95osr2_mf2hd.img.lz","win95osr2_ssdd8.img.lz","win95osr2_ssdd.img.lz", + "win95osr2_dsdd8.img.lz", "win95osr2_dsdd.img.lz", "win95osr2_dshd.img.lz", "win95osr2_mf2dd.img.lz", + "win95osr2_mf2ed.img.lz", "win95osr2_mf2hd.img.lz", "win95osr2_ssdd8.img.lz", "win95osr2_ssdd.img.lz", /// Windows 95 OSR 2.1 - "win95osr2.1_dsdd8.img.lz","win95osr2.1_dsdd.img.lz","win95osr2.1_dshd.img.lz","win95osr2.1_mf2dd.img.lz", - "win95osr2.1_mf2ed.img.lz","win95osr2.1_mf2hd.img.lz","win95osr2.1_ssdd8.img.lz","win95osr2.1_ssdd.img.lz", + "win95osr2.1_dsdd8.img.lz", "win95osr2.1_dsdd.img.lz", "win95osr2.1_dshd.img.lz", + "win95osr2.1_mf2dd.img.lz", "win95osr2.1_mf2ed.img.lz", "win95osr2.1_mf2hd.img.lz", + "win95osr2.1_ssdd8.img.lz", "win95osr2.1_ssdd.img.lz", // Windows 95 OSR 2.5 - "win95osr2.5_dsdd8.img.lz","win95osr2.5_dsdd.img.lz","win95osr2.5_dshd.img.lz","win95osr2.5_mf2dd.img.lz", - "win95osr2.5_mf2ed.img.lz","win95osr2.5_mf2hd.img.lz","win95osr2.5_ssdd8.img.lz","win95osr2.5_ssdd.img.lz", + "win95osr2.5_dsdd8.img.lz", "win95osr2.5_dsdd.img.lz", "win95osr2.5_dshd.img.lz", + "win95osr2.5_mf2dd.img.lz", "win95osr2.5_mf2ed.img.lz", "win95osr2.5_mf2hd.img.lz", + "win95osr2.5_ssdd8.img.lz", "win95osr2.5_ssdd.img.lz", // Windows 98 - "win98_dsdd8.img.lz","win98_dsdd.img.lz","win98_dshd.img.lz","win98_mf2dd.img.lz", - "win98_mf2ed.img.lz","win98_mf2hd.img.lz","win98_ssdd8.img.lz","win98_ssdd.img.lz", + "win98_dsdd8.img.lz", "win98_dsdd.img.lz", "win98_dshd.img.lz", "win98_mf2dd.img.lz", "win98_mf2ed.img.lz", + "win98_mf2hd.img.lz", "win98_ssdd8.img.lz", "win98_ssdd.img.lz", // Windows 98 Second Edition - "win98se_dsdd8.img.lz","win98se_dsdd.img.lz","win98se_dshd.img.lz","win98se_mf2dd.img.lz", - "win98se_mf2ed.img.lz","win98se_mf2hd.img.lz","win98se_ssdd8.img.lz","win98se_ssdd.img.lz", + "win98se_dsdd8.img.lz", "win98se_dsdd.img.lz", "win98se_dshd.img.lz", "win98se_mf2dd.img.lz", + "win98se_mf2ed.img.lz", "win98se_mf2hd.img.lz", "win98se_ssdd8.img.lz", "win98se_ssdd.img.lz", // Windows Me - "winme_dsdd.img.lz","winme_dshd.img.lz","winme_mf2dd.img.lz","winme_mf2ed.img.lz","winme_mf2hd.img.lz", + "winme_dsdd.img.lz", "winme_dshd.img.lz", "winme_mf2dd.img.lz", "winme_mf2ed.img.lz", "winme_mf2hd.img.lz", // Windows NT 3.10 - "winnt_3.10_dshd.img.lz","winnt_3.10_mf2dd.img.lz","winnt_3.10_mf2ed.img.lz","winnt_3.10_mf2hd.img.lz", + "winnt_3.10_dshd.img.lz", "winnt_3.10_mf2dd.img.lz", "winnt_3.10_mf2ed.img.lz", "winnt_3.10_mf2hd.img.lz", // Windows NT 3.50 - "winnt_3.50_dshd.img.lz","winnt_3.50_mf2dd.img.lz","winnt_3.50_mf2ed.img.lz","winnt_3.50_mf2hd.img.lz", + "winnt_3.50_dshd.img.lz", "winnt_3.50_mf2dd.img.lz", "winnt_3.50_mf2ed.img.lz", "winnt_3.50_mf2hd.img.lz", // Windows NT 3.51 - "winnt_3.51_dshd.img.lz","winnt_3.51_mf2dd.img.lz","winnt_3.51_mf2ed.img.lz","winnt_3.51_mf2hd.img.lz", + "winnt_3.51_dshd.img.lz", "winnt_3.51_mf2dd.img.lz", "winnt_3.51_mf2ed.img.lz", "winnt_3.51_mf2hd.img.lz", // Windows NT 4.00 - "winnt_4_dsdd.img.lz","winnt_4_dshd.img.lz","winnt_4_mf2dd.img.lz","winnt_4_mf2ed.img.lz", - "winnt_4_mf2hd.img.lz","winnt_4_ssdd.img.lz", + "winnt_4_dsdd.img.lz", "winnt_4_dshd.img.lz", "winnt_4_mf2dd.img.lz", "winnt_4_mf2ed.img.lz", + "winnt_4_mf2hd.img.lz", "winnt_4_ssdd.img.lz", // Windows 2000 - "win2000_dsdd.img.lz","win2000_dshd.img.lz","win2000_mf2dd.img.lz","win2000_mf2ed.img.lz","win2000_mf2hd.img.lz", + "win2000_dsdd.img.lz", "win2000_dshd.img.lz", "win2000_mf2dd.img.lz", "win2000_mf2ed.img.lz", + "win2000_mf2hd.img.lz", // Windows Vista - "winvista_dsdd.img.lz","winvista_dshd.img.lz","winvista_mf2dd.img.lz","winvista_mf2ed.img.lz","winvista_mf2hd.img.lz", + "winvista_dsdd.img.lz", "winvista_dshd.img.lz", "winvista_mf2dd.img.lz", "winvista_mf2ed.img.lz", + "winvista_mf2hd.img.lz", // BeOS R4.5 "beos_r4.5_mf2hd.img.lz", // Hatari - "hatari_mf1dd.st.lz","hatari_mf1dd_10.st.lz","hatari_mf1dd_11.st.lz", - "hatari_mf2dd.st.lz","hatari_mf2dd_10.st.lz","hatari_mf2dd_11.st.lz", - "hatari_mf2ed.st.lz","hatari_mf2hd.st.lz", + "hatari_mf1dd.st.lz", "hatari_mf1dd_10.st.lz", "hatari_mf1dd_11.st.lz", "hatari_mf2dd.st.lz", + "hatari_mf2dd_10.st.lz", "hatari_mf2dd_11.st.lz", "hatari_mf2ed.st.lz", "hatari_mf2hd.st.lz", // Atari TOS 1.04 - "tos_1.04_mf1dd.st.lz","tos_1.04_mf2dd.st.lz", + "tos_1.04_mf1dd.st.lz", "tos_1.04_mf2dd.st.lz", // NetBSD 1.6 - "netbsd_1.6_mf2dd.img.lz","netbsd_1.6_mf2hd.img.lz", + "netbsd_1.6_mf2dd.img.lz", "netbsd_1.6_mf2hd.img.lz", // NeXTStep 3.3 - "nextstep_3.3_mf2dd.img.lz","nextstep_3.3_mf2hd.img.lz", + "nextstep_3.3_mf2dd.img.lz", "nextstep_3.3_mf2hd.img.lz", // OpenStep for Mach 4.0 - "openstep_4.0_mf2dd.img.lz","openstep_4.0_mf2hd.img.lz", + "openstep_4.0_mf2dd.img.lz", "openstep_4.0_mf2hd.img.lz", // OpenStep for Mach 4.2 - "openstep_4.2_mf2dd.img.lz","openstep_4.2_mf2hd.img.lz", + "openstep_4.2_mf2dd.img.lz", "openstep_4.2_mf2hd.img.lz", // Solaris 2.4 - "solaris_2.4_mf2dd.img.lz","solaris_2.4_mf2hd.img.lz", + "solaris_2.4_mf2dd.img.lz", "solaris_2.4_mf2hd.img.lz", // COHERENT UNIX 4.2.10 - "coherentunix_4.2.10_dsdd.img.lz","coherentunix_4.2.10_dshd.img.lz","coherentunix_4.2.10_mf2dd.img.lz","coherentunix_4.2.10_mf2hd.img.lz", + "coherentunix_4.2.10_dsdd.img.lz", "coherentunix_4.2.10_dshd.img.lz", "coherentunix_4.2.10_mf2dd.img.lz", + "coherentunix_4.2.10_mf2hd.img.lz", // SCO OpenServer 5.0.7Hw - "scoopenserver_5.0.7hw_dshd.img.lz","scoopenserver_5.0.7hw_mf2dd.img.lz","scoopenserver_5.0.7hw_mf2hd.img.lz", + "scoopenserver_5.0.7hw_dshd.img.lz", "scoopenserver_5.0.7hw_mf2dd.img.lz", + "scoopenserver_5.0.7hw_mf2hd.img.lz", // Epson MS-DOS 5.00 for PC-98 - "msdos_epson_pc98_5.00_md2dd.img.lz","msdos_epson_pc98_5.00_md2hd.img.lz", + "msdos_epson_pc98_5.00_md2dd.img.lz", "msdos_epson_pc98_5.00_md2hd.img.lz", // NEC MS-DOS 3.30 for PC-98 - "msdos_pc98_3.30_md2dd.img.lz","msdos_pc98_3.30_md2hd.img.lz", + "msdos_pc98_3.30_md2dd.img.lz", "msdos_pc98_3.30_md2hd.img.lz", // NEC MS-DOS 5.00 for PC-98 - "msdos_pc98_5.00_md2dd.img.lz","msdos_pc98_5.00_md2hd.img.lz", + "msdos_pc98_5.00_md2dd.img.lz", "msdos_pc98_5.00_md2hd.img.lz", // NEC MS-DOS 6.20 for PC-98 - "msdos_pc98_6.20_md2dd.img.lz","msdos_pc98_6.20_md2hd.img.lz", + "msdos_pc98_6.20_md2dd.img.lz", "msdos_pc98_6.20_md2hd.img.lz", }; - readonly MediaType[] mediatypes = { + readonly MediaType[] mediatypes = + { // Concurrent DOS 6.00 MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // DR-DOS 3.40 @@ -272,887 +291,898 @@ namespace DiscImageChef.Tests.Filesystems MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // DR-DOS 7.02 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // DR-DOS 7.03 - MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, // DR-DOS 8.00 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 3.30A - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 3.31 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 4.01 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 5.00 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 6.00 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 6.20 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 6.20 RC1 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 6.21 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 6.22 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 7.10 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 3.20 for Amstrad - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 2.11 for AT&T MediaType.DOS_525_DS_DD_9, // MS-DOS 3.30 for DeLL - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 3.10 for Epson - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, // MS-DOS 3.20 for Epson - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 3.20 for HP - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 3.21 for Hyosung - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 3.21 for Kaypro - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 3.10 for Olivetti - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_525_SS_DD_9, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_525_SS_DD_9, // MS-DOS 3.30 for Toshiba - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // MS-DOS 4.01 for Toshiba - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // Novell DOS 7.00 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // OpenDOS 7.01 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // PC-DOS 2.00 MediaType.DOS_525_DS_DD_9, // PC-DOS 2.10 MediaType.DOS_525_DS_DD_9, // PC-DOS 2000 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // PC-DOS 3.00 MediaType.DOS_525_HD, // PC-DOS 3.10 MediaType.DOS_525_HD, // PC-DOS 3.30 - MediaType.DOS_525_HD,MediaType.DOS_35_HD, + MediaType.DOS_525_HD, MediaType.DOS_35_HD, // PC-DOS 4.00 - MediaType.DOS_525_HD,MediaType.DOS_35_HD, + MediaType.DOS_525_HD, MediaType.DOS_35_HD, // PC-DOS 5.00 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // PC-DOS 5.02 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // PC-DOS 6.10 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // PC-DOS 6.30 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9,MediaType.DOS_525_SS_DD_8, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_8, // mkfs.vfat - MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, // mkfs.vfat for Atari - MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, // Microsoft OS/2 1.00 for Tandy - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // Microsoft OS/2 1.10 for AST - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // Microsoft OS/2 1.10 for Nokia - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // Microsoft OS/2 1.21 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // Microsoft OS/2 1.30.1 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, + MediaType.DOS_35_HD, // OS/2 1.20 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // OS/2 1.30 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // OS/2 2.00 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, + MediaType.DOS_35_HD, // OS/2 2.10 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, + MediaType.DOS_35_HD, // OS/2 2.11 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, + MediaType.DOS_35_HD, // OS/2 Warp 3 - MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, // OS/2 Warp 4 - MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, // eComStation - MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, // Windows 95 - MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_8,MediaType.DOS_525_SS_DD_9, + MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, // Windows 95 OSR 2 - MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_8,MediaType.DOS_525_SS_DD_9, + MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, /// Windows 95 OSR 2.1 - MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_8,MediaType.DOS_525_SS_DD_9, + MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, // Windows 95 OSR 2.5 - MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_8,MediaType.DOS_525_SS_DD_9, + MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, // Windows 98 - MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_8,MediaType.DOS_525_SS_DD_9, + MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, // Windows 98 Second Edition - MediaType.DOS_525_DS_DD_8,MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_ED,MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_8,MediaType.DOS_525_SS_DD_9, + MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, // Windows Me - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, + MediaType.DOS_35_HD, // Windows NT 3.10 - MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, // Windows NT 3.50 - MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, // Windows NT 3.51 - MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, // Windows NT 4.00 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED, - MediaType.DOS_35_HD,MediaType.DOS_525_SS_DD_9, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, + MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_9, // Windows 2000 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, + MediaType.DOS_35_HD, // Windows Vista - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, + MediaType.DOS_35_HD, // BeOS R4.5 MediaType.DOS_35_HD, // Hatari - MediaType.DOS_35_SS_DD_9,MediaType.ATARI_35_SS_DD,MediaType.ATARI_35_SS_DD_11, - MediaType.DOS_35_DS_DD_9,MediaType.ATARI_35_DS_DD,MediaType.ATARI_35_DS_DD_11, - MediaType.DOS_35_ED,MediaType.DOS_35_HD, + MediaType.DOS_35_SS_DD_9, MediaType.ATARI_35_SS_DD, MediaType.ATARI_35_SS_DD_11, MediaType.DOS_35_DS_DD_9, + MediaType.ATARI_35_DS_DD, MediaType.ATARI_35_DS_DD_11, MediaType.DOS_35_ED, MediaType.DOS_35_HD, // Atari TOS 1.04 - MediaType.DOS_35_SS_DD_9,MediaType.DOS_35_DS_DD_9, + MediaType.DOS_35_SS_DD_9, MediaType.DOS_35_DS_DD_9, // NetBSD 1.6 - MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // NeXTStep 3.3 - MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // OpenStep for Mach 4.0 - MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // OpenStep for Mach 4.2 - MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // Solaris 2.4 - MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // COHERENT UNIX 4.2.10 - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // SCO OpenServer 5.0.7Hw - MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, // Epson MS-DOS 5.00 for PC-98 - MediaType.DOS_35_DS_DD_9,MediaType.NEC_525_HD, + MediaType.DOS_35_DS_DD_9, MediaType.NEC_525_HD, // NEC MS-DOS 3.30 for PC-98 - MediaType.DOS_35_DS_DD_9,MediaType.NEC_525_HD, + MediaType.DOS_35_DS_DD_9, MediaType.NEC_525_HD, // NEC MS-DOS 5.00 for PC-98 - MediaType.DOS_35_DS_DD_9,MediaType.NEC_525_HD, + MediaType.DOS_35_DS_DD_9, MediaType.NEC_525_HD, // NEC MS-DOS 6.20 for PC-98 - MediaType.DOS_35_DS_DD_9,MediaType.NEC_525_HD, + MediaType.DOS_35_DS_DD_9, MediaType.NEC_525_HD, }; - readonly ulong[] sectors = { + readonly ulong[] sectors = + { // Concurrent DOS 6.00 2400, 1440, 2880, // DR-DOS 3.40 720, 640, 2400, 1440, 2880, 360, 320, // DR-DOS 3.41 - 720,640,2400,1440,2880,360,320, + 720, 640, 2400, 1440, 2880, 360, 320, // DR-DOS 5.00 - 720,640,2400,1440,2880,360,320, + 720, 640, 2400, 1440, 2880, 360, 320, // DR-DOS 6.00 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // DR-DOS 7.02 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // DR-DOS 7.03 - 720,640,2400,1440,5760,2880, + 720, 640, 2400, 1440, 5760, 2880, // DR-DOS 8.00 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // MS-DOS 3.30A - 720,640,2400,1440,2880,360,320, + 720, 640, 2400, 1440, 2880, 360, 320, // MS-DOS 3.31 - 720,640,2400,1440,2880,360,320, + 720, 640, 2400, 1440, 2880, 360, 320, // MS-DOS 4.01 - 720,640,2400,1440,2880,360,320, + 720, 640, 2400, 1440, 2880, 360, 320, // MS-DOS 5.00 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // MS-DOS 6.00 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // MS-DOS 6.20 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // MS-DOS 6.20 RC1 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // MS-DOS 6.21 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // MS-DOS 6.22 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // MS-DOS 7.10 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // MS-DOS 3.20 for Amstrad - 720,640,2400,1440,360,320, + 720, 640, 2400, 1440, 360, 320, // MS-DOS 2.11 for AT&T 720, // MS-DOS 3.30 for DeLL - 720,640,2400,1440,2880,360,320, + 720, 640, 2400, 1440, 2880, 360, 320, // MS-DOS 3.10 for Epson - 720,640,2400, + 720, 640, 2400, // MS-DOS 3.20 for Epson - 720,640,2400,1440,360,320, + 720, 640, 2400, 1440, 360, 320, // MS-DOS 3.20 for HP - 720,640,2400,1440,2880,360,320, + 720, 640, 2400, 1440, 2880, 360, 320, // MS-DOS 3.21 for Hyosung - 720,640,2400,1440,2880,360,320, + 720, 640, 2400, 1440, 2880, 360, 320, // MS-DOS 3.21 for Kaypro - 720,640,2400,1440,2880,360,320, + 720, 640, 2400, 1440, 2880, 360, 320, // MS-DOS 3.10 for Olivetti - 720,2400,360, + 720, 2400, 360, // MS-DOS 3.30 for Toshiba - 720,640,2400,1440,2880,360,320, + 720, 640, 2400, 1440, 2880, 360, 320, // MS-DOS 4.01 for Toshiba - 720,640,2400,1440,2880,360,320, + 720, 640, 2400, 1440, 2880, 360, 320, // Novell DOS 7.00 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // OpenDOS 7.01 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // PC-DOS 2.00 720, // PC-DOS 2.10 720, // PC-DOS 2000 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // PC-DOS 3.00 2400, // PC-DOS 3.10 2400, // PC-DOS 3.30 - 2400,2880, + 2400, 2880, // PC-DOS 4.00 - 2400,2880, + 2400, 2880, // PC-DOS 5.00 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // PC-DOS 5.02 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // PC-DOS 6.10 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // PC-DOS 6.30 - 720,640,2400,1440,5760,2880,360,320, + 720, 640, 2400, 1440, 5760, 2880, 360, 320, // mkfs.vfat - 2400,1440,5760,2880, + 2400, 1440, 5760, 2880, // mkfs.vfat for Atari - 2400,1440,5760,2880, + 2400, 1440, 5760, 2880, // Microsoft OS/2 1.00 for Tandy - 720,2400,1440,2880, + 720, 2400, 1440, 2880, // Microsoft OS/2 1.10 for AST - 720,2400,1440,2880, + 720, 2400, 1440, 2880, // Microsoft OS/2 1.10 for Nokia - 720,2400,1440,2880, + 720, 2400, 1440, 2880, // Microsoft OS/2 1.21 - 720,2400,1440,2880, + 720, 2400, 1440, 2880, // Microsoft OS/2 1.30.1 - 720,2400,1440,5760,2880, + 720, 2400, 1440, 5760, 2880, // OS/2 1.20 - 720,2400,1440,2880, + 720, 2400, 1440, 2880, // OS/2 1.30 - 720,2400,1440,2880, + 720, 2400, 1440, 2880, // OS/2 2.00 - 720,2400,1440,5760,2880, + 720, 2400, 1440, 5760, 2880, // OS/2 2.10 - 720,2400,1440,5760,2880, + 720, 2400, 1440, 5760, 2880, // OS/2 2.11 - 720,2400,1440,5760,2880, + 720, 2400, 1440, 5760, 2880, // OS/2 Warp 3 - 2400,1440,5760,2880, + 2400, 1440, 5760, 2880, // OS/2 Warp 4 - 2400,1440,5760,2880, + 2400, 1440, 5760, 2880, // eComStation - 2400,1440,5760,2880, + 2400, 1440, 5760, 2880, // Windows 95 - 640,720,2400,1440,5760,2880,320,360, + 640, 720, 2400, 1440, 5760, 2880, 320, 360, // Windows 95 OSR 2 - 640,720,2400,1440,5760,2880,320,360, + 640, 720, 2400, 1440, 5760, 2880, 320, 360, /// Windows 95 OSR 2.1 - 640,720,2400,1440,5760,2880,320,360, + 640, 720, 2400, 1440, 5760, 2880, 320, 360, // Windows 95 OSR 2.5 - 640,720,2400,1440,5760,2880,320,360, + 640, 720, 2400, 1440, 5760, 2880, 320, 360, // Windows 98 - 640,720,2400,1440,5760,2880,320,360, + 640, 720, 2400, 1440, 5760, 2880, 320, 360, // Windows 98 Second Edition - 640,720,2400,1440,5760,2880,320,360, + 640, 720, 2400, 1440, 5760, 2880, 320, 360, // Windows Me - 720,2400,1440,5760,2880, + 720, 2400, 1440, 5760, 2880, // Windows NT 3.10 - 2400,1440,5760,2880, + 2400, 1440, 5760, 2880, // Windows NT 3.50 - 2400,1440,5760,2880, + 2400, 1440, 5760, 2880, // Windows NT 3.51 - 2400,1440,5760,2880, + 2400, 1440, 5760, 2880, // Windows NT 4.00 - 720,2400,1440,5760,2880,360, + 720, 2400, 1440, 5760, 2880, 360, // Windows 2000 - 720,2400,1440,5760,2880, + 720, 2400, 1440, 5760, 2880, // Windows Vista - 720,2400,1440,5760,2880, + 720, 2400, 1440, 5760, 2880, // BeOS R4.5 2880, // Hatari - 720,800,880,1440,1600,1760,5760,2880, + 720, 800, 880, 1440, 1600, 1760, 5760, 2880, // Atari TOS 1.04 - 720,1440, + 720, 1440, // NetBSD 1.6 - 1440,2880, + 1440, 2880, // NeXTStep 3.3 - 1440,2880, + 1440, 2880, // OpenStep for Mach 4.0 - 1440,2880, + 1440, 2880, // OpenStep for Mach 4.2 - 1440,2880, + 1440, 2880, // Solaris 2.4 - 1440,2880, + 1440, 2880, // COHERENT UNIX 4.2.10 - 720,2400,1440,2880, + 720, 2400, 1440, 2880, // SCO OpenServer 5.0.7Hw - 2400,1440,2880, + 2400, 1440, 2880, // Epson MS-DOS 5.00 for PC-98 - 1440,1232, + 1440, 1232, // NEC MS-DOS 3.30 for PC-98 - 1440,1232, + 1440, 1232, // NEC MS-DOS 5.00 for PC-98 - 1440,1232, + 1440, 1232, // NEC MS-DOS 6.20 for PC-98 - 1440,1232, + 1440, 1232, }; - readonly uint[] sectorsize = { + readonly uint[] sectorsize = + { // Concurrent DOS 6.00 512, 512, 512, // DR-DOS 3.40 512, 512, 512, 512, 512, 512, 512, // DR-DOS 3.41 - 512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, // DR-DOS 5.00 - 512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, // DR-DOS 6.00 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // DR-DOS 7.02 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // DR-DOS 7.03 - 512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, // DR-DOS 8.00 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // MS-DOS 3.30A - 512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, // MS-DOS 3.31 - 512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, // MS-DOS 4.01 - 512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, // MS-DOS 5.00 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // MS-DOS 6.00 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // MS-DOS 6.20 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // MS-DOS 6.20 RC1 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // MS-DOS 6.21 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // MS-DOS 6.22 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // MS-DOS 7.10 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // MS-DOS 3.20 for Amstrad - 512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, // MS-DOS 2.11 for AT&T 512, // MS-DOS 3.30 for DeLL - 512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, // MS-DOS 3.10 for Epson - 512,512,512, + 512, 512, 512, // MS-DOS 3.20 for Epson - 512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, // MS-DOS 3.20 for HP - 512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, // MS-DOS 3.21 for Hyosung - 512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, // MS-DOS 3.21 for Kaypro - 512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, // MS-DOS 3.10 for Olivetti - 512,512,512, + 512, 512, 512, // MS-DOS 3.30 for Toshiba - 512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, // MS-DOS 4.01 for Toshiba - 512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, // Novell DOS 7.00 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // OpenDOS 7.01 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // PC-DOS 2.00 512, // PC-DOS 2.10 512, // PC-DOS 2000 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // PC-DOS 3.00 512, // PC-DOS 3.10 512, // PC-DOS 3.30 - 512,512, + 512, 512, // PC-DOS 4.00 - 512,512, + 512, 512, // PC-DOS 5.00 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // PC-DOS 5.02 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // PC-DOS 6.10 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // PC-DOS 6.30 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // mkfs.vfat - 512,512,512,512, + 512, 512, 512, 512, // mkfs.vfat for Atari - 512,512,512,512, + 512, 512, 512, 512, // Microsoft OS/2 1.00 for Tandy - 512,512,512,512, + 512, 512, 512, 512, // Microsoft OS/2 1.10 for AST - 512,512,512,512, + 512, 512, 512, 512, // Microsoft OS/2 1.10 for Nokia - 512,512,512,512, + 512, 512, 512, 512, // Microsoft OS/2 1.21 - 512,512,512,512, + 512, 512, 512, 512, // Microsoft OS/2 1.30.1 - 512,512,512,512,512, + 512, 512, 512, 512, 512, // OS/2 1.20 - 512,512,512,512, + 512, 512, 512, 512, // OS/2 1.30 - 512,512,512,512, + 512, 512, 512, 512, // OS/2 2.00 - 512,512,512,512,512, + 512, 512, 512, 512, 512, // OS/2 2.10 - 512,512,512,512,512, + 512, 512, 512, 512, 512, // OS/2 2.11 - 512,512,512,512,512, + 512, 512, 512, 512, 512, // OS/2 Warp 3 - 512,512,512,512, + 512, 512, 512, 512, // OS/2 Warp 4 - 512,512,512,512, + 512, 512, 512, 512, // eComStation - 512,512,512,512, + 512, 512, 512, 512, // Windows 95 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // Windows 95 OSR 2 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, /// Windows 95 OSR 2.1 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // Windows 95 OSR 2.5 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // Windows 98 - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // Windows 98 Second Edition - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // Windows Me - 512,512,512,512,512, + 512, 512, 512, 512, 512, // Windows NT 3.10 - 512,512,512,512, + 512, 512, 512, 512, // Windows NT 3.50 - 512,512,512,512, + 512, 512, 512, 512, // Windows NT 3.51 - 512,512,512,512, + 512, 512, 512, 512, // Windows NT 4.00 - 512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, // Windows 2000 - 512,512,512,512,512, + 512, 512, 512, 512, 512, // Windows Vista - 512,512,512,512,512, + 512, 512, 512, 512, 512, // BeOS R4.5 512, // Hatari - 512,512,512,512,512,512,512,512, + 512, 512, 512, 512, 512, 512, 512, 512, // Atari TOS 1.04 - 512,512, + 512, 512, // NetBSD 1.6 - 512,512, + 512, 512, // NeXTStep 3.3 - 512,512, + 512, 512, // OpenStep for Mach 4.0 - 512,512, + 512, 512, // OpenStep for Mach 4.2 - 512,512, + 512, 512, // Solaris 2.4 - 512,512, + 512, 512, // COHERENT UNIX 4.2.10 - 512,512,512,512, + 512, 512, 512, 512, // SCO OpenServer 5.0.7Hw - 512,512,512, + 512, 512, 512, // Epson MS-DOS 5.00 for PC-98 - 512,1024, + 512, 1024, // NEC MS-DOS 3.30 for PC-98 - 512,1024, + 512, 1024, // NEC MS-DOS 5.00 for PC-98 - 512,1024, + 512, 1024, // NEC MS-DOS 6.20 for PC-98 - 512,1024, + 512, 1024, }; - readonly long[] clusters = { + readonly long[] clusters = + { // Concurrent DOS 6.00 2400, 720, 2880, // DR-DOS 3.40 - 360,320,2400,720,2880,360,320, + 360, 320, 2400, 720, 2880, 360, 320, // DR-DOS 3.41 - 360,320,2400,720,2880,360,320, + 360, 320, 2400, 720, 2880, 360, 320, // DR-DOS 5.00 - 360,320,2400,720,2880,360,320, + 360, 320, 2400, 720, 2880, 360, 320, // DR-DOS 6.00 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // DR-DOS 7.02 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // DR-DOS 7.03 - 360,320,2400,720,2880,2880, + 360, 320, 2400, 720, 2880, 2880, // DR-DOS 8.00 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // MS-DOS 3.30A - 360,320,2400,720,2880,360,320, + 360, 320, 2400, 720, 2880, 360, 320, // MS-DOS 3.31 - 360,320,2400,720,2880,360,320, + 360, 320, 2400, 720, 2880, 360, 320, // MS-DOS 4.01 - 360,320,2400,720,2880,360,320, + 360, 320, 2400, 720, 2880, 360, 320, // MS-DOS 5.00 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // MS-DOS 6.00 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // MS-DOS 6.20 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // MS-DOS 6.20 RC1 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // MS-DOS 6.21 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // MS-DOS 6.22 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // MS-DOS 7.10 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // MS-DOS 3.20 for Amstrad - 360,320,2400,720,360,320, + 360, 320, 2400, 720, 360, 320, // MS-DOS 2.11 for AT&T 360, // MS-DOS 3.30 for DeLL - 360,320,2400,720,2880,360,320, + 360, 320, 2400, 720, 2880, 360, 320, // MS-DOS 3.10 for Epson - 360,320,2400, + 360, 320, 2400, // MS-DOS 3.20 for Epson - 360,320,2400,720,360,320, + 360, 320, 2400, 720, 360, 320, // MS-DOS 3.20 for HP - 360,320,2400,720,2880,360,320, + 360, 320, 2400, 720, 2880, 360, 320, // MS-DOS 3.21 for Hyosung - 360,320,2400,720,2880,360,320, + 360, 320, 2400, 720, 2880, 360, 320, // MS-DOS 3.21 for Kaypro - 360,320,2400,720,2880,360,320, + 360, 320, 2400, 720, 2880, 360, 320, // MS-DOS 3.10 for Olivetti - 360,2400,360, + 360, 2400, 360, // MS-DOS 3.30 for Toshiba - 360,320,2400,720,2880,360,320, + 360, 320, 2400, 720, 2880, 360, 320, // MS-DOS 4.01 for Toshiba - 360,320,2400,720,2880,360,320, + 360, 320, 2400, 720, 2880, 360, 320, // Novell DOS 7.00 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // OpenDOS 7.01 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // PC-DOS 2.00 360, // PC-DOS 2.10 360, // PC-DOS 2000 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // PC-DOS 3.00 2400, // PC-DOS 3.10 2400, // PC-DOS 3.30 - 2400,2880, + 2400, 2880, // PC-DOS 4.00 - 2400,2880, + 2400, 2880, // PC-DOS 5.00 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // PC-DOS 5.02 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // PC-DOS 6.10 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // PC-DOS 6.30 - 360,320,2400,720,2880,2880,360,320, + 360, 320, 2400, 720, 2880, 2880, 360, 320, // mkfs.vfat - 2400,720,2880,2880, + 2400, 720, 2880, 2880, // mkfs.vfat for Atari - 1200,720,2880,1440, + 1200, 720, 2880, 1440, // Microsoft OS/2 1.00 for Tandy - 360,2400,720,2880, + 360, 2400, 720, 2880, // Microsoft OS/2 1.10 for AST - 360,2400,720,2880, + 360, 2400, 720, 2880, // Microsoft OS/2 1.10 for Nokia - 360,2400,720,2880, + 360, 2400, 720, 2880, // Microsoft OS/2 1.21 - 360,2400,720,2880, + 360, 2400, 720, 2880, // Microsoft OS/2 1.30.1 - 360,2400,720,2880,2880, + 360, 2400, 720, 2880, 2880, // OS/2 1.20 - 360,2400,720,2880, + 360, 2400, 720, 2880, // OS/2 1.30 - 360,2400,720,2880, + 360, 2400, 720, 2880, // OS/2 2.00 - 360,2400,720,2880,2880, + 360, 2400, 720, 2880, 2880, // OS/2 2.10 - 360,2400,720,2880,2880, + 360, 2400, 720, 2880, 2880, // OS/2 2.11 - 360,2400,720,2880,2880, + 360, 2400, 720, 2880, 2880, // OS/2 Warp 3 - 2400,720,2880,2880, + 2400, 720, 2880, 2880, // OS/2 Warp 4 - 2400,720,2880,2880, + 2400, 720, 2880, 2880, // eComStation - 2400,720,2880,2880, + 2400, 720, 2880, 2880, // Windows 95 - 320,360,2400,720,2880,2880,320,360, + 320, 360, 2400, 720, 2880, 2880, 320, 360, // Windows 95 OSR 2 - 320,360,2400,720,2880,2880,320,360, + 320, 360, 2400, 720, 2880, 2880, 320, 360, /// Windows 95 OSR 2.1 - 320,360,2400,720,2880,2880,320,360, + 320, 360, 2400, 720, 2880, 2880, 320, 360, // Windows 95 OSR 2.5 - 320,360,2400,720,2880,2880,320,360, + 320, 360, 2400, 720, 2880, 2880, 320, 360, // Windows 98 - 320,360,2400,720,2880,2880,320,360, + 320, 360, 2400, 720, 2880, 2880, 320, 360, // Windows 98 Second Edition - 320,360,2400,720,2880,2880,320,360, + 320, 360, 2400, 720, 2880, 2880, 320, 360, // Windows Me - 360,2400,720,2880,2880, + 360, 2400, 720, 2880, 2880, // Windows NT 3.10 - 2400,720,2880,2880, + 2400, 720, 2880, 2880, // Windows NT 3.50 - 2400,720,2880,2880, + 2400, 720, 2880, 2880, // Windows NT 3.51 - 2400,720,2880,2880, + 2400, 720, 2880, 2880, // Windows NT 4.00 - 360,2400,720,2880,2880,360, + 360, 2400, 720, 2880, 2880, 360, // Windows 2000 - 360,2400,720,2880,2880, + 360, 2400, 720, 2880, 2880, // Windows Vista - 360,2400,720,2880,2880, + 360, 2400, 720, 2880, 2880, // BeOS R4.5 2880, // Hatari - 360,400,440,720,800,880,2880,1440, + 360, 400, 440, 720, 800, 880, 2880, 1440, // Atari TOS 1.04 - 360,720, + 360, 720, // NetBSD 1.6 - 720,2880, + 720, 2880, // NeXTStep 3.3 - 720,2880, + 720, 2880, // OpenStep for Mach 4.0 - 720,2880, + 720, 2880, // OpenStep for Mach 4.2 - 720,2880, + 720, 2880, // Solaris 2.4 - 720,2880, + 720, 2880, // COHERENT UNIX 4.2.10 - 360,2400,720,2880, + 360, 2400, 720, 2880, // SCO OpenServer 5.0.7Hw - 2400,1440,2880, + 2400, 1440, 2880, // Epson MS-DOS 5.00 for PC-98 - 640,1232, + 640, 1232, // NEC MS-DOS 3.30 for PC-98 - 640,1232, + 640, 1232, // NEC MS-DOS 5.00 for PC-98 - 640,1232, + 640, 1232, // NEC MS-DOS 6.20 for PC-98 - 640,1232, + 640, 1232, }; - readonly int[] clustersize = { + readonly int[] clustersize = + { // Concurrent DOS 6.00 512, 1024, 512, // DR-DOS 3.40 - 1024,1024,512,1024,512,512,512, + 1024, 1024, 512, 1024, 512, 512, 512, // DR-DOS 3.41 - 1024,1024,512,1024,512,512,512, + 1024, 1024, 512, 1024, 512, 512, 512, // DR-DOS 5.00 - 1024,1024,512,1024,512,512,512, + 1024, 1024, 512, 1024, 512, 512, 512, // DR-DOS 6.00 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // DR-DOS 7.02 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // DR-DOS 7.03 - 1024,1024,512,1024,1024,512, + 1024, 1024, 512, 1024, 1024, 512, // DR-DOS 8.00 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // MS-DOS 3.30A - 1024,1024,512,1024,512,512,512, + 1024, 1024, 512, 1024, 512, 512, 512, // MS-DOS 3.31 - 1024,1024,512,1024,512,512,512, + 1024, 1024, 512, 1024, 512, 512, 512, // MS-DOS 4.01 - 1024,1024,512,1024,512,512,512, + 1024, 1024, 512, 1024, 512, 512, 512, // MS-DOS 5.00 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // MS-DOS 6.00 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // MS-DOS 6.20 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // MS-DOS 6.20 RC1 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // MS-DOS 6.21 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // MS-DOS 6.22 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // MS-DOS 7.10 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // MS-DOS 3.20 for Amstrad - 1024,1024,512,1024,512,512, + 1024, 1024, 512, 1024, 512, 512, // MS-DOS 2.11 for AT&T 1024, // MS-DOS 3.30 for DeLL - 1024,1024,512,1024,512,512,512, + 1024, 1024, 512, 1024, 512, 512, 512, // MS-DOS 3.10 for Epson - 1024,1024,512, + 1024, 1024, 512, // MS-DOS 3.20 for Epson - 1024,1024,512,1024,512,512, + 1024, 1024, 512, 1024, 512, 512, // MS-DOS 3.20 for HP - 1024,1024,512,1024,512,512,512, + 1024, 1024, 512, 1024, 512, 512, 512, // MS-DOS 3.21 for Hyosung - 1024,1024,512,1024,512,512,512, + 1024, 1024, 512, 1024, 512, 512, 512, // MS-DOS 3.21 for Kaypro - 1024,1024,512,1024,512,512,512, + 1024, 1024, 512, 1024, 512, 512, 512, // MS-DOS 3.10 for Olivetti - 1024,512,512, + 1024, 512, 512, // MS-DOS 3.30 for Toshiba - 1024,1024,512,1024,512,512,512, + 1024, 1024, 512, 1024, 512, 512, 512, // MS-DOS 4.01 for Toshiba - 1024,1024,512,1024,512,512,512, + 1024, 1024, 512, 1024, 512, 512, 512, // Novell DOS 7.00 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // OpenDOS 7.01 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // PC-DOS 2.00 1024, // PC-DOS 2.10 1024, // PC-DOS 2000 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // PC-DOS 3.00 512, // PC-DOS 3.10 512, // PC-DOS 3.30 - 512,512, + 512, 512, // PC-DOS 4.00 - 512,512, + 512, 512, // PC-DOS 5.00 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // PC-DOS 5.02 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // PC-DOS 6.10 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // PC-DOS 6.30 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // mkfs.vfat - 512,1024,1024,512, + 512, 1024, 1024, 512, // mkfs.vfat for Atari - 1024,1024,1024,1024, + 1024, 1024, 1024, 1024, // Microsoft OS/2 1.00 for Tandy - 1024,512,1024,512, + 1024, 512, 1024, 512, // Microsoft OS/2 1.10 for AST - 1024,512,1024,512, + 1024, 512, 1024, 512, // Microsoft OS/2 1.10 for Nokia - 1024,512,1024,512, + 1024, 512, 1024, 512, // Microsoft OS/2 1.21 - 1024,512,1024,512, + 1024, 512, 1024, 512, // Microsoft OS/2 1.30.1 - 1024,512,1024,1024,512, + 1024, 512, 1024, 1024, 512, // OS/2 1.20 - 1024,512,1024,512, + 1024, 512, 1024, 512, // OS/2 1.30 - 1024,512,1024,512, + 1024, 512, 1024, 512, // OS/2 2.00 - 1024,512,1024,1024,512, + 1024, 512, 1024, 1024, 512, // OS/2 2.10 - 1024,512,1024,1024,512, + 1024, 512, 1024, 1024, 512, // OS/2 2.11 - 1024,512,1024,1024,512, + 1024, 512, 1024, 1024, 512, // OS/2 Warp 3 - 512,1024,1024,512, + 512, 1024, 1024, 512, // OS/2 Warp 4 - 512,1024,1024,512, + 512, 1024, 1024, 512, // eComStation - 512,1024,1024,512, + 512, 1024, 1024, 512, // Windows 95 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // Windows 95 OSR 2 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, /// Windows 95 OSR 2.1 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // Windows 95 OSR 2.5 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // Windows 98 - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // Windows 98 Second Edition - 1024,1024,512,1024,1024,512,512,512, + 1024, 1024, 512, 1024, 1024, 512, 512, 512, // Windows Me - 1024,512,1024,1024,512, + 1024, 512, 1024, 1024, 512, // Windows NT 3.10 - 512,1024,1024,512, + 512, 1024, 1024, 512, // Windows NT 3.50 - 512,1024,1024,512, + 512, 1024, 1024, 512, // Windows NT 3.51 - 512,1024,1024,512, + 512, 1024, 1024, 512, // Windows NT 4.00 - 1024,512,1024,512,512,512, + 1024, 512, 1024, 512, 512, 512, // Windows 2000 - 1024,512,1024,1024,512, + 1024, 512, 1024, 1024, 512, // Windows Vista - 1024,512,1024,1024,512, + 1024, 512, 1024, 1024, 512, // BeOS R4.5 512, // Hatari - 1024,1024,1024,1024,1024,1024,1024,1024, + 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, // Atari TOS 1.04 - 1024,1024, + 1024, 1024, // NetBSD 1.6 - 1024,512, + 1024, 512, // NeXTStep 3.3 - 1024,512, + 1024, 512, // OpenStep for Mach 4.0 - 1024,512, + 1024, 512, // OpenStep for Mach 4.2 - 1024,512, + 1024, 512, // Solaris 2.4 - 1024,512, + 1024, 512, // COHERENT UNIX 4.2.10 - 1024,512,1024,512, + 1024, 512, 1024, 512, // SCO OpenServer 5.0.7Hw - 512,512,512, + 512, 512, 512, // Epson MS-DOS 5.00 for PC-98 - 1024,1024, + 1024, 1024, // NEC MS-DOS 3.30 for PC-98 - 1024,1024, + 1024, 1024, // NEC MS-DOS 5.00 for PC-98 - 1024,1024, + 1024, 1024, // NEC MS-DOS 6.20 for PC-98 - 1024,1024, + 1024, 1024, }; - readonly string[] volumename = { + readonly string[] volumename = + { // Concurrent DOS 6.00 null, null, null, // DR-DOS 3.40 @@ -1162,177 +1192,175 @@ namespace DiscImageChef.Tests.Filesystems // DR-DOS 5.00 null, null, null, null, null, null, null, // DR-DOS 6.00 - "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", // DR-DOS 7.02 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", // DR-DOS 7.03 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // DR-DOS 8.00 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", // MS-DOS 3.30A null, null, null, null, null, null, null, // MS-DOS 3.31 - null, null, null, null, null, null,null, + null, null, null, null, null, null, null, // MS-DOS 4.01 - "VOLUMELABEL",null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, + "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, // MS-DOS 5.00 - "VOLUMELABEL",null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, + "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, // MS-DOS 6.00 - "VOLUMELABEL",null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, + "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, // MS-DOS 6.20 - "VOLUMELABEL",null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, + "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, // MS-DOS 6.20 RC1 - "VOLUMELABEL",null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, + "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, // MS-DOS 6.21 - "VOLUMELABEL",null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, + "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, // MS-DOS 6.22 - "VOLUMELABEL",null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, + "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, // MS-DOS 7.10 - "VOLUMELABEL",null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, + "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, // MS-DOS 3.20 for Amstrad - null,null,null,null,null,null, + null, null, null, null, null, null, // MS-DOS 2.11 for AT&T null, // MS-DOS 3.30 for DeLL - null,null,null,null,null,null,null, + null, null, null, null, null, null, null, // MS-DOS 3.10 for Epson - null,null,null, + null, null, null, // MS-DOS 3.20 for Epson - null,null,null,null,null,null, + null, null, null, null, null, null, // MS-DOS 3.20 for HP - null,null,null,null,null,null,null, + null, null, null, null, null, null, null, // MS-DOS 3.21 for Hyosung - null,null,null,null,null,null,null, + null, null, null, null, null, null, null, // MS-DOS 3.21 for Kaypro - null,null,null,null,null,null,null, + null, null, null, null, null, null, null, // MS-DOS 3.10 for Olivetti - null,null,null, + null, null, null, // MS-DOS 3.30 for Toshiba - null,null,null,null,null,null,null, + null, null, null, null, null, null, null, // MS-DOS 4.01 for Toshiba - "VOLUMELABEL","NO NAME ","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","NO NAME ", + "VOLUMELABEL", "NO NAME ", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "NO NAME ", // Novell DOS 7.00 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", // OpenDOS 7.01 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", // PC-DOS 2.00 null, // PC-DOS 2.10 null, // PC-DOS 2000 - "VOLUMELABEL",null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, + "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, // PC-DOS 3.00 null, // PC-DOS 3.10 null, // PC-DOS 3.30 - null,null, + null, null, // PC-DOS 4.00 - "VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", // PC-DOS 5.00 - "VOLUMELABEL",null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, + "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, // PC-DOS 5.02 - "VOLUMELABEL",null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, + "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, // PC-DOS 6.10 - "VOLUMELABEL",null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, + "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, // PC-DOS 6.30 - "VOLUMELABEL",null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, + "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, // mkfs.vfat - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // mkfs.vfat for Atari - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // Microsoft OS/2 1.00 for Tandy - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // Microsoft OS/2 1.10 for AST - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // Microsoft OS/2 1.10 for Nokia - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // Microsoft OS/2 1.21 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // Microsoft OS/2 1.30.1 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // OS/2 1.20 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // OS/2 1.30 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // OS/2 2.00 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // OS/2 2.10 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // OS/2 2.11 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // OS/2 Warp 3 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // OS/2 Warp 4 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // eComStation - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // Windows 95 - null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL",null,"VOLUMELABEL", + null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, "VOLUMELABEL", // Windows 95 OSR 2 - null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL",null,"VOLUMELABEL", + null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, "VOLUMELABEL", /// Windows 95 OSR 2.1 - null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL",null,"VOLUMELABEL", + null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, "VOLUMELABEL", // Windows 95 OSR 2.5 - null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL",null,"VOLUMELABEL", + null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, "VOLUMELABEL", // Windows 98 - null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL",null,"VOLUMELABEL", + null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, "VOLUMELABEL", // Windows 98 Second Edition - null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL",null,"VOLUMELABEL", + null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, "VOLUMELABEL", // Windows Me - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // Windows NT 3.10 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // Windows NT 3.50 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // Windows NT 3.51 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // Windows NT 4.00 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // Windows 2000 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // Windows Vista - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // BeOS R4.5 "VOLUMELABEL", // Hatari - "volumelabel","volumelabel","volumelabel", - "volumelabel","volumelabel","volumelabel", - "volumelabel","volumelabel", + "volumelabel", "volumelabel", "volumelabel", "volumelabel", "volumelabel", "volumelabel", "volumelabel", + "volumelabel", // Atari TOS 1.04 - "VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", // NetBSD 1.6 - "VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", // NeXTStep 3.3 - "VOLUMELABEL","VOLUME LABE", + "VOLUMELABEL", "VOLUME LABE", // OpenStep for Mach 4.0 - "VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", // OpenStep for Mach 4.2 - "VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", // Solaris 2.4 - null,null, + null, null, // COHERENT UNIX 4.2.10 - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // SCO OpenServer 5.0.7Hw - null,null,null, + null, null, null, // Epson MS-DOS 5.00 for PC-98 - "NO NAME ","NO NAME ", + "NO NAME ", "NO NAME ", // NEC MS-DOS 3.30 for PC-98 - null,null, + null, null, // NEC MS-DOS 5.00 for PC-98 - "NO NAME ","NO NAME ", + "NO NAME ", "NO NAME ", // NEC MS-DOS 6.20 for PC-98 - "NO NAME ","NO NAME ", + "NO NAME ", "NO NAME ", }; - readonly string[] volumeserial = { + readonly string[] volumeserial = + { // Concurrent DOS 6.00 null, null, null, // DR-DOS 3.40 @@ -1344,175 +1372,167 @@ namespace DiscImageChef.Tests.Filesystems // DR-DOS 6.00 null, null, null, null, null, null, null, null, // DR-DOS 7.02 - "1BF63C69","1BF70E75","1BF7185F","1BF80C4F","1BF90F1D","1BF82777","1BF72430","1BF72F1E", + "1BF63C69", "1BF70E75", "1BF7185F", "1BF80C4F", "1BF90F1D", "1BF82777", "1BF72430", "1BF72F1E", // DR-DOS 7.03 - "0C1A2013","0CE22B5B","0CEA1D3E","0CEE102F","0CEE3760","0CEF2739", + "0C1A2013", "0CE22B5B", "0CEA1D3E", "0CEE102F", "0CEE3760", "0CEF2739", // DR-DOS 8.00 - "1BFD1977","1BFD2D3F","1BFD3531","1BFC3231","1BFA1D58","1BFC117D","1BFE0971","1BFE1423", + "1BFD1977", "1BFD2D3F", "1BFD3531", "1BFC3231", "1BFA1D58", "1BFC117D", "1BFE0971", "1BFE1423", // MS-DOS 3.30A null, null, null, null, null, null, null, // MS-DOS 3.31 - null, null, null, null, null, null,null, + null, null, null, null, null, null, null, // MS-DOS 4.01 - "122C190A",null,"2480190A","2D471909","0F5A1908","2F3D190A",null, + "122C190A", null, "2480190A", "2D471909", "0F5A1908", "2F3D190A", null, // MS-DOS 5.00 - "0B6018F8",null,"1E3518F8","285A18FB","231D18FE","415118FC","316118F8",null, + "0B6018F8", null, "1E3518F8", "285A18FB", "231D18FE", "415118FC", "316118F8", null, // MS-DOS 6.00 - "067B18F6",null,"193418F6","1F3A18F5","165318F3","172418F4","234918F6",null, + "067B18F6", null, "193418F6", "1F3A18F5", "165318F3", "172418F4", "234918F6", null, // MS-DOS 6.20 - "265418ED",null,"0B7018EE","127418F0","137F18F2","364C18F0","185C18EE",null, + "265418ED", null, "0B7018EE", "127418F0", "137F18F2", "364C18F0", "185C18EE", null, // MS-DOS 6.20 RC1 - "064B18EB",null,"192518EB","244C18EA","3C3118E7","344118E9","267E18EB",null, + "064B18EB", null, "192518EB", "244C18EA", "3C3118E7", "344118E9", "267E18EB", null, // MS-DOS 6.21 - "2A41181B",null,"0641181C","3B26181C","082518E2","237118E1","123F181C",null, + "2A41181B", null, "0641181C", "3B26181C", "082518E2", "237118E1", "123F181C", null, // MS-DOS 6.22 - "317C1818",null,"0D3A1819","3C251817","387A1815","185E1817","18231819",null, + "317C1818", null, "0D3A1819", "3C251817", "387A1815", "185E1817", "18231819", null, // MS-DOS 7.10 - "1156180A",null,"2951180A","3057180B","2B4A1811","344B180C","352D180A",null, + "1156180A", null, "2951180A", "3057180B", "2B4A1811", "344B180C", "352D180A", null, // MS-DOS 3.20 for Amstrad - null,null,null,null,null,null, + null, null, null, null, null, null, // MS-DOS 2.11 for AT&T null, // MS-DOS 3.30 for DeLL - null,null,null,null,null,null,null, + null, null, null, null, null, null, null, // MS-DOS 3.10 for Epson - null,null,null, + null, null, null, // MS-DOS 3.20 for Epson - null,null,null,null,null,null, + null, null, null, null, null, null, // MS-DOS 3.20 for HP - null,null,null,null,null,null,null, + null, null, null, null, null, null, null, // MS-DOS 3.21 for Hyosung - null,null,null,null,null,null,null, + null, null, null, null, null, null, null, // MS-DOS 3.21 for Kaypro - null,null,null,null,null,null,null, + null, null, null, null, null, null, null, // MS-DOS 3.10 for Olivetti - null,null,null, + null, null, null, // MS-DOS 3.30 for Toshiba - null,null,null,null,null,null,null, + null, null, null, null, null, null, null, // MS-DOS 4.01 for Toshiba - "0B2519E7","163419E7","1E3119E7","133919E9","177419EA","317E19E7","3B7319E7", + "0B2519E7", "163419E7", "1E3119E7", "133919E9", "177419EA", "317E19E7", "3B7319E7", // Novell DOS 7.00 - "1BE7254C","1BE73024","1BE7397C","1BE63635","1BE51661","1BE61143","1BE80A5D","1BE8144C", + "1BE7254C", "1BE73024", "1BE7397C", "1BE63635", "1BE51661", "1BE61143", "1BE80A5D", "1BE8144C", // OpenDOS 7.01 - "1BE93E2B","1BEA234D","1BEA325D","1BEB294F","1BEC2C2E","1BEC0C5D","1BEA3E60","1BEB0E26", + "1BE93E2B", "1BEA234D", "1BEA325D", "1BEB294F", "1BEC2C2E", "1BEC0C5D", "1BEA3E60", "1BEB0E26", // PC-DOS 2.00 null, // PC-DOS 2.10 null, // PC-DOS 2000 - "2634100E",null,"3565100E","3B6B1012","3B2D1013","1D491013","4136100E",null, + "2634100E", null, "3565100E", "3B6B1012", "3B2D1013", "1D491013", "4136100E", null, // PC-DOS 3.00 null, // PC-DOS 3.10 null, // PC-DOS 3.30 - null,null, + null, null, // PC-DOS 4.00 - "3C240FE3","2E3E0FE1", + "3C240FE3", "2E3E0FE1", // PC-DOS 5.00 - "33260FF9",null,"11550FFA","234F0FFB","2F600FFC","0D550FFC","1D630FFA",null, + "33260FF9", null, "11550FFA", "234F0FFB", "2F600FFC", "0D550FFC", "1D630FFA", null, // PC-DOS 5.02 - "06231000",null,"1A3E1000","1F3B0FFF","3D750FFD","3F4F0FFE","26471000",null, + "06231000", null, "1A3E1000", "1F3B0FFF", "3D750FFD", "3F4F0FFE", "26471000", null, // PC-DOS 6.10 - "25551004",null,"3E5F1004","142D1006","17541007","355A1006","0D5E1005",null, + "25551004", null, "3E5F1004", "142D1006", "17541007", "355A1006", "0D5E1005", null, // PC-DOS 6.30 - "2B22100C",null,"3B47100C","0C55100C","1B80100A","0B59100B","0A3A100D",null, + "2B22100C", null, "3B47100C", "0C55100C", "1B80100A", "0B59100B", "0A3A100D", null, // mkfs.vfat - "20C279B1","20FD9501","2132D70A","2118F1AA", + "20C279B1", "20FD9501", "2132D70A", "2118F1AA", // mkfs.vfat for Atari - "83E030","C53F06","A154CD","D54DEE", + "83E030", "C53F06", "A154CD", "D54DEE", // Microsoft OS/2 1.00 for Tandy - "9C170C15","9BFB0C15","9C13FC15","9BF99C15", + "9C170C15", "9BFB0C15", "9C13FC15", "9BF99C15", // Microsoft OS/2 1.10 for AST - "66A42C15","67696C15","66DEBC15","66DC4C15", + "66A42C15", "67696C15", "66DEBC15", "66DC4C15", // Microsoft OS/2 1.10 for Nokia - "676B4C15","67768C15","9C12DC15","66A74C15", + "676B4C15", "67768C15", "9C12DC15", "66A74C15", // Microsoft OS/2 1.21 - "9C074C15","66BCFC15","66C1AC15","66C7FC15", + "9C074C15", "66BCFC15", "66C1AC15", "66C7FC15", // Microsoft OS/2 1.30.1 - "66C47C15","66CBEC15","9C167C15","9C147C15","9C0FEC15", + "66C47C15", "66CBEC15", "9C167C15", "9C147C15", "9C0FEC15", // OS/2 1.20 - "5BF5E015","5BE61015","5C26F015","5C376015", + "5BF5E015", "5BE61015", "5C26F015", "5C376015", // OS/2 1.30 - "5C418015","5BE20015","5C7F1015","5B83C015", + "5C418015", "5BE20015", "5C7F1015", "5B83C015", // OS/2 2.00 - "5C3BD015","5B807015","5BE69015","5C187015","5C390015", + "5C3BD015", "5B807015", "5BE69015", "5C187015", "5C390015", // OS/2 2.10 - "1BFCB414","E6C6C414","E6CCF414","E6AF6414","1C005414", + "1BFCB414", "E6C6C414", "E6CCF414", "E6AF6414", "1C005414", // OS/2 2.11 - "E6AEB414","1C00D414","1C03B414","E6C90414","E6B6E414", + "E6AEB414", "1C00D414", "1C03B414", "E6C90414", "E6B6E414", // OS/2 Warp 3 - "E6AF7414","E6D63414","E6A65414","E6AE6414", + "E6AF7414", "E6D63414", "E6A65414", "E6AE6414", // OS/2 Warp 4 - "E6CD9414","1BFAD414","E6DFF414","E6D4C414", + "E6CD9414", "1BFAD414", "E6DFF414", "E6D4C414", // eComStation - "E6CA5814","E6CBC814","E6B81814","1C013814", + "E6CA5814", "E6CBC814", "E6B81814", "1C013814", // Windows 95 - null,"3B360D0D","24240D0D","3C260D11", - "30050D10","275A0D11",null,"3B100D0F", + null, "3B360D0D", "24240D0D", "3C260D11", "30050D10", "275A0D11", null, "3B100D0F", // Windows 95 OSR 2 - null,"1C5B0D19","11510D19","0F1F0D15", - "40200D17","3D610D14",null,"280B0D19", + null, "1C5B0D19", "11510D19", "0F1F0D15", "40200D17", "3D610D14", null, "280B0D19", /// Windows 95 OSR 2.1 - null,"1F3B0D1C","14470D1C","1C510DE4", - "2E250DE2","10640DE4",null,"2B3E0D1C", + null, "1F3B0D1C", "14470D1C", "1C510DE4", "2E250DE2", "10640DE4", null, "2B3E0D1C", // Windows 95 OSR 2.5 - null,"18190DFB","0A240DFB","1E320DE7", - "33230DE8","125B0DE7",null,"21410DFB", + null, "18190DFB", "0A240DFB", "1E320DE7", "33230DE8", "125B0DE7", null, "21410DFB", // Windows 98 - null,"40090E0F","28140E0F","0E620E0A", - "14390E0D","0E081246",null,"30600E10", + null, "40090E0F", "28140E0F", "0E620E0A", "14390E0D", "0E081246", null, "30600E10", // Windows 98 Second Edition - null,"1B550EEC","1B100EEB","08410EE6", - "0E0F0EE8","325D0EE4",null,"13380EEC", + null, "1B550EEC", "1B100EEB", "08410EE6", "0E0F0EE8", "325D0EE4", null, "13380EEC", // Windows Me - "2F200F02","103A0F01","2F1C0EFC","21570EFF","07040EFB", + "2F200F02", "103A0F01", "2F1C0EFC", "21570EFF", "07040EFB", // Windows NT 3.10 - "60EA50BC","6C857D51","4009440C","30761EDC", + "60EA50BC", "6C857D51", "4009440C", "30761EDC", // Windows NT 3.50 - "0C478404","7CBEB35B","7C1E8DCB","ECB276AF", + "0C478404", "7CBEB35B", "7C1E8DCB", "ECB276AF", // Windows NT 3.51 - "482D8681","8889C95E","54DE6C39","F47D2516", + "482D8681", "8889C95E", "54DE6C39", "F47D2516", // Windows NT 4.00 - "D8CAAC1F","E0BB6D70","C08C3C60","9C44B411", - "4C7DD099","4CD82982", + "D8CAAC1F", "E0BB6D70", "C08C3C60", "9C44B411", "4C7DD099", "4CD82982", // Windows 2000 - "4019989C","78F30AF8","E4217DDE","80B3B996","28043527", + "4019989C", "78F30AF8", "E4217DDE", "80B3B996", "28043527", // Windows Vista - "3C9F0BD2","3A8E465C","B2EFB822","3C30C632","16DAB07A", + "3C9F0BD2", "3A8E465C", "B2EFB822", "3C30C632", "16DAB07A", // BeOS R4.5 "00000000", // Hatari - "A82270","D08917","37AD91", - "1ED910","299DFE","94AE59", - "3A1757","C08249", + "A82270", "D08917", "37AD91", "1ED910", "299DFE", "94AE59", "3A1757", "C08249", // Atari TOS 1.04 - "2356F0","51C7A3", + "2356F0", "51C7A3", // NetBSD 1.6 - "EEB51A0C","CCFD1A06", + "EEB51A0C", "CCFD1A06", // NeXTStep 3.3 - null,null, + null, null, // OpenStep for Mach 4.0 - null,null, + null, null, // OpenStep for Mach 4.2 - null,null, + null, null, // Solaris 2.4 - null,null, + null, null, // COHERENT UNIX 4.2.10 - null,null,null,null, + null, null, null, null, // SCO OpenServer 5.0.7Hw - null,null,null, + null, null, null, // Epson MS-DOS 5.00 for PC-98 - "27021316","11021317", + "27021316", "11021317", // NEC MS-DOS 3.30 for PC-98 - null,null, + null, null, // NEC MS-DOS 5.00 for PC-98 - "1002120E","41021209", + "1002120E", "41021209", // NEC MS-DOS 6.20 for PC-98 - "3D021418","16021409", + "3D021418", "16021409", }; - readonly string[] oemid = { + readonly string[] oemid = + { // Concurrent DOS 6.00 "DIGITAL ", "DIGITAL ", "DIGITAL ", // DR-DOS 3.40 @@ -1524,172 +1544,163 @@ namespace DiscImageChef.Tests.Filesystems // DR-DOS 6.00 "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", // DR-DOS 7.02 - "DRDOS 7","DRDOS 7","DRDOS 7","DRDOS 7","DRDOS 7","DRDOS 7","DRDOS 7","DRDOS 7", + "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", // DR-DOS 7.03 - "DRDOS 7","DRDOS 7","DRDOS 7","DRDOS 7","DRDOS 7","DRDOS 7", + "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", // DR-DOS 8.00 - "DRDOS 7","DRDOS 7","DRDOS 7","DRDOS 7","DRDOS 7","DRDOS 7","DRDOS 7","DRDOS 7", + "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", // MS-DOS 3.30A - "MSDOS3.3",null,"MSDOS3.3","MSDOS3.3","MSDOS3.3","MSDOS3.3",null, + "MSDOS3.3", null, "MSDOS3.3", "MSDOS3.3", "MSDOS3.3", "MSDOS3.3", null, // MS-DOS 3.31 - "IBM 3.3",null,"IBM 3.3","IBM 3.3","IBM 3.3","IBM 3.3",null, + "IBM 3.3", null, "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", null, // MS-DOS 4.01 - "MSDOS4.0",null,"MSDOS4.0","MSDOS4.0","MSDOS4.0","MSDOS4.0",null, + "MSDOS4.0", null, "MSDOS4.0", "MSDOS4.0", "MSDOS4.0", "MSDOS4.0", null, // MS-DOS 5.00 - "MSDOS5.0",null,"MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0",null, + "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, // MS-DOS 6.00 - "MSDOS5.0",null,"MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0",null, + "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, // MS-DOS 6.20 - "MSDOS5.0",null,"MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0",null, + "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, // MS-DOS 6.20 RC1 - "MSDOS5.0",null,"MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0",null, + "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, // MS-DOS 6.21 - "MSDOS5.0",null,"MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0",null, + "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, // MS-DOS 6.22 - "MSDOS5.0",null,"MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0",null, + "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, // MS-DOS 7.10 - "MSWIN4.1",null,"MSWIN4.1","MSWIN4.1","MSWIN4.1","MSWIN4.1","MSWIN4.1",null, + "MSWIN4.1", null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, // MS-DOS 3.20 for Amstrad - "MSDOS3.2",null,"MSDOS3.2","MSDOS3.2","MSDOS3.2",null, + "MSDOS3.2", null, "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", null, // MS-DOS 2.11 for AT&T "PSA 1.04", // MS-DOS 3.30 for DeLL - "IBM 3.3",null,"IBM 3.3","IBM 3.3","IBM 3.3","IBM 3.3",null, + "IBM 3.3", null, "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", null, // MS-DOS 3.10 for Epson - "EPS 3.10","EPS 3.10","EPS 3.10", + "EPS 3.10", "EPS 3.10", "EPS 3.10", // MS-DOS 3.20 for Epson - "IBM 3.2","IBM 3.2","IBM 3.2","IBM 3.2","IBM 3.2","IBM 3.2", + "IBM 3.2", "IBM 3.2", "IBM 3.2", "IBM 3.2", "IBM 3.2", "IBM 3.2", // MS-DOS 3.20 for HP - "MSDOS3.2",null,"MSDOS3.2","MSDOS3.2","MSDOS3.2","MSDOS3.2",null, + "MSDOS3.2", null, "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", null, // MS-DOS 3.21 for Hyosung - "MSDOS3.2",null,"MSDOS3.2","MSDOS3.2","MSDOS3.2","MSDOS3.2",null, + "MSDOS3.2", null, "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", null, // MS-DOS 3.21 for Kaypro - "MSDOS3.2",null,"MSDOS3.2","MSDOS3.2","MSDOS3.2","MSDOS3.2",null, + "MSDOS3.2", null, "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", null, // MS-DOS 3.10 for Olivetti - "IBM 3.1","IBM 3.1","IBM 3.1", + "IBM 3.1", "IBM 3.1", "IBM 3.1", // MS-DOS 3.30 for Toshiba - "IBM 3.3",null,"IBM 3.3","IBM 3.3","IBM 3.3","IBM 3.3",null, + "IBM 3.3", null, "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", null, // MS-DOS 4.01 for Toshiba - "T V4.00 ","T V4.00 ","T V4.00 ","T V4.00 ","T V4.00 ","T V4.00 ","T V4.00 ", + "T V4.00 ", "T V4.00 ", "T V4.00 ", "T V4.00 ", "T V4.00 ", "T V4.00 ", "T V4.00 ", // Novell DOS 7.00 - "NWDOS7.0","NWDOS7.0","NWDOS7.0","NWDOS7.0","NWDOS7.0","NWDOS7.0","NWDOS7.0","NWDOS7.0", + "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", // OpenDOS 7.01 - "OPENDOS7","OPENDOS7","OPENDOS7","OPENDOS7","OPENDOS7","OPENDOS7","OPENDOS7","OPENDOS7", + "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", // PC-DOS 2.00 "IBM 2.0", // PC-DOS 2.10 "IBM 2.0", // PC-DOS 2000 - "IBM 7.0",null,"IBM 7.0","IBM 7.0","IBM 7.0","IBM 7.0","IBM 7.0",null, + "IBM 7.0", null, "IBM 7.0", "IBM 7.0", "IBM 7.0", "IBM 7.0", "IBM 7.0", null, // PC-DOS 3.00 "IBM 3.0", // PC-DOS 3.10 "IBM 3.1", // PC-DOS 3.30 - "IBM 3.3","IBM 3.3", + "IBM 3.3", "IBM 3.3", // PC-DOS 4.00 - "IBM 4.0","IBM 4.0", + "IBM 4.0", "IBM 4.0", // PC-DOS 5.00 - "IBM 5.0",null,"IBM 5.0","IBM 5.0","IBM 5.0","IBM 5.0","IBM 5.0",null, + "IBM 5.0", null, "IBM 5.0", "IBM 5.0", "IBM 5.0", "IBM 5.0", "IBM 5.0", null, // PC-DOS 5.02 - "IBM 5.0",null,"IBM 5.0","IBM 5.0","IBM 5.0","IBM 5.0","IBM 5.0",null, + "IBM 5.0", null, "IBM 5.0", "IBM 5.0", "IBM 5.0", "IBM 5.0", "IBM 5.0", null, // PC-DOS 6.10 - "IBM 6.0",null,"IBM 6.0","IBM 6.0","IBM 6.0","IBM 6.0","IBM 6.0",null, + "IBM 6.0", null, "IBM 6.0", "IBM 6.0", "IBM 6.0", "IBM 6.0", "IBM 6.0", null, // PC-DOS 6.30 - "IBM 6.0",null,"IBM 6.0","IBM 6.0","IBM 6.0","IBM 6.0","IBM 6.0",null, + "IBM 6.0", null, "IBM 6.0", "IBM 6.0", "IBM 6.0", "IBM 6.0", "IBM 6.0", null, // mkfs.vfat - "mkfs.fat","mkfs.fat","mkfs.fat","mkfs.fat", + "mkfs.fat", "mkfs.fat", "mkfs.fat", "mkfs.fat", // mkfs.vfat for Atari - "mkdosf","mkdosf","mkdosf","mkdosf", + "mkdosf", "mkdosf", "mkdosf", "mkdosf", // Microsoft OS/2 1.00 for Tandy - "TAN 10.0","TAN 10.0","TAN 10.0","TAN 10.0", + "TAN 10.0", "TAN 10.0", "TAN 10.0", "TAN 10.0", // Microsoft OS/2 1.10 for AST - "IBM 10.1","IBM 10.1","IBM 10.1","IBM 10.1", + "IBM 10.1", "IBM 10.1", "IBM 10.1", "IBM 10.1", // Microsoft OS/2 1.10 for Nokia - "IBM 10.1","IBM 10.1","IBM 10.1","IBM 10.1", + "IBM 10.1", "IBM 10.1", "IBM 10.1", "IBM 10.1", // Microsoft OS/2 1.21 - "IBM 10.2","IBM 10.2","IBM 10.2","IBM 10.2", + "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", // Microsoft OS/2 1.30.1 - "IBM 10.2","IBM 10.2","IBM 10.2","IBM 10.2","IBM 10.2", + "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", // OS/2 1.20 - "IBM 10.2","IBM 10.2","IBM 10.2","IBM 10.2", + "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", // OS/2 1.30 - "IBM 10.2","IBM 10.2","IBM 10.2","IBM 10.2", + "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", // OS/2 2.00 - "IBM 20.0","IBM 20.0","IBM 20.0","IBM 20.0","IBM 20.0", + "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", // OS/2 2.10 - "IBM 20.0","IBM 20.0","IBM 20.0","IBM 20.0","IBM 20.0", + "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", // OS/2 2.11 - "IBM 20.0","IBM 20.0","IBM 20.0","IBM 20.0","IBM 20.0", + "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", // OS/2 Warp 3 - "IBM 20.0","IBM 20.0","IBM 20.0","IBM 20.0", + "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", // OS/2 Warp 4 - "IBM 20.0","IBM 20.0","IBM 20.0","IBM 20.0", + "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", // eComStation - "IBM 4.50","IBM 4.50","IBM 4.50","IBM 4.50", + "IBM 4.50", "IBM 4.50", "IBM 4.50", "IBM 4.50", // Windows 95 - null,"MSWIN4.0","MSWIN4.0","MSWIN4.0", - "MSWIN4.0","MSWIN4.0",null,"MSWIN4.0", + null, "MSWIN4.0", "MSWIN4.0", "MSWIN4.0", "MSWIN4.0", "MSWIN4.0", null, "MSWIN4.0", // Windows 95 OSR 2 - null,"MSWIN4.1","MSWIN4.1","MSWIN4.1", - "MSWIN4.1","MSWIN4.1",null,"MSWIN4.1", + null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", /// Windows 95 OSR 2.1 - null,"MSWIN4.1","MSWIN4.1","MSWIN4.1", - "MSWIN4.1","MSWIN4.1",null,"MSWIN4.1", + null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", // Windows 95 OSR 2.5 - null,"MSWIN4.1","MSWIN4.1","MSWIN4.1", - "MSWIN4.1","MSWIN4.1",null,"MSWIN4.1", + null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", // Windows 98 - null,"MSWIN4.1","MSWIN4.1","MSWIN4.1", - "MSWIN4.1","MSWIN4.1",null,"MSWIN4.1", + null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", // Windows 98 Second Edition - null,"MSWIN4.1","MSWIN4.1","MSWIN4.1", - "MSWIN4.1","MSWIN4.1",null,"MSWIN4.1", + null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", // Windows Me - "MSWIN4.1","MSWIN4.1","MSWIN4.1","MSWIN4.1","MSWIN4.1", + "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", // Windows NT 3.10 - "MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0", + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", // Windows NT 3.50 - "MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0", + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", // Windows NT 3.51 - "MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0", + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", // Windows NT 4.00 - "MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0", - "MSDOS5.0","MSDOS5.0", + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", // Windows 2000 - "MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0", + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", // Windows Vista - "MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0","MSDOS5.0", + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", // BeOS R4.5 "BeOS ", // Hatari - "NNNNNN","NNNNNN","NNNNNN", - "NNNNNN","NNNNNN","NNNNNN", - "NNNNNN","NNNNNN", + "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", // Atari TOS 1.04 - "NNNNNN","NNNNNN", + "NNNNNN", "NNNNNN", // NetBSD 1.6 - "BSD 4.4","BSD 4.4", + "BSD 4.4", "BSD 4.4", // NeXTStep 3.3 - "NEXT ","NEXT ", + "NEXT ", "NEXT ", // OpenStep for Mach 4.0 - "NEXT ","NEXT ", + "NEXT ", "NEXT ", // OpenStep for Mach 4.2 - "NEXT ","NEXT ", + "NEXT ", "NEXT ", // Solaris 2.4 - "MSDOS3.3","MSDOS3.3", + "MSDOS3.3", "MSDOS3.3", // COHERENT UNIX 4.2.10 - "COHERENT","COHERENT","COHERENT","COHERENT", + "COHERENT", "COHERENT", "COHERENT", "COHERENT", // SCO OpenServer 5.0.7Hw - "SCO BOOT","SCO BOOT","SCO BOOT", + "SCO BOOT", "SCO BOOT", "SCO BOOT", // Epson MS-DOS 5.00 for PC-98 - "EPSON5.0","EPSON5.0", + "EPSON5.0", "EPSON5.0", // NEC MS-DOS 3.30 for PC-98 - "NEC 2.00","NEC 2.00", + "NEC 2.00", "NEC 2.00", // NEC MS-DOS 5.00 for PC-98 - "NEC 5.0","NEC 5.0", + "NEC 5.0", "NEC 5.0", // NEC MS-DOS 6.20 for PC-98 - "NEC 5.0","NEC 5.0", + "NEC 5.0", "NEC 5.0", }; [Test] @@ -1723,4 +1734,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/FAT12_APM.cs b/DiscImageChef.Tests/Filesystems/FAT12_APM.cs index 614dd32a..61fd97b6 100644 --- a/DiscImageChef.Tests/Filesystems/FAT12_APM.cs +++ b/DiscImageChef.Tests/Filesystems/FAT12_APM.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class FAT12_APM { - readonly string[] testfiles = { - "macosx_10.11.vdi.lz", - }; + readonly string[] testfiles = {"macosx_10.11.vdi.lz",}; - readonly ulong[] sectors = { - 16384, - }; + readonly ulong[] sectors = {16384,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 4076, - }; + readonly long[] clusters = {4076,}; - readonly int[] clustersize = { - 2048, - }; + readonly int[] clustersize = {2048,}; - readonly string[] volumename = { - "VOLUMELABEL", - }; + readonly string[] volumename = {"VOLUMELABEL",}; - readonly string[] volumeserial = { - "32181F09", - }; + readonly string[] volumeserial = {"32181F09",}; - readonly string[] oemid = { - "BSD 4.4", - }; + readonly string[] oemid = {"BSD 4.4",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -107,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs b/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs index c0a83d42..585dd697 100644 --- a/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class FAT12_GPT { - readonly string[] testfiles = { - "macosx_10.11.vdi.lz", - }; + readonly string[] testfiles = {"macosx_10.11.vdi.lz",}; - readonly ulong[] sectors = { - 16384, - }; + readonly ulong[] sectors = {16384,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 4076, - }; + readonly long[] clusters = {4076,}; - readonly int[] clustersize = { - 2048, - }; + readonly int[] clustersize = {2048,}; - readonly string[] volumename = { - "VOLUMELABEL", - }; + readonly string[] volumename = {"VOLUMELABEL",}; - readonly string[] volumeserial = { - "66901F1B", - }; + readonly string[] volumeserial = {"66901F1B",}; - readonly string[] oemid = { - "BSD 4.4", - }; + readonly string[] oemid = {"BSD 4.4",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -107,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/FAT12_MBR.cs b/DiscImageChef.Tests/Filesystems/FAT12_MBR.cs index 614ff25f..46fabfce 100644 --- a/DiscImageChef.Tests/Filesystems/FAT12_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/FAT12_MBR.cs @@ -40,156 +40,88 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class FAT12_MBR { - readonly string[] testfiles = { - "compaqmsdos331.vdi.lz", "drdos_3.40.vdi.lz", "drdos_3.41.vdi.lz", "drdos_5.00.vdi.lz", - "drdos_6.00.vdi.lz", "drdos_7.02.vdi.lz", "drdos_7.03.vdi.lz", "drdos_8.00.vdi.lz", - "msdos331.vdi.lz", "msdos401.vdi.lz", "msdos500.vdi.lz", "msdos600.vdi.lz", - "msdos620rc1.vdi.lz", "msdos620.vdi.lz", "msdos621.vdi.lz", "msdos622.vdi.lz", - "msdos710.vdi.lz", "novelldos_7.00.vdi.lz", "opendos_7.01.vdi.lz", "pcdos2000.vdi.lz", - "pcdos200.vdi.lz", "pcdos210.vdi.lz", "pcdos300.vdi.lz", "pcdos310.vdi.lz", - "pcdos330.vdi.lz", "pcdos400.vdi.lz", "pcdos500.vdi.lz", "pcdos502.vdi.lz", - "pcdos610.vdi.lz", "pcdos630.vdi.lz", "toshibamsdos330.vdi.lz", "toshibamsdos401.vdi.lz", - "msos2_1.21.vdi.lz", "msos2_1.30.1.vdi.lz", "multiuserdos_7.22r4.vdi.lz", "os2_1.20.vdi.lz", - "os2_1.30.vdi.lz", "os2_6.307.vdi.lz", "os2_6.514.vdi.lz", "os2_6.617.vdi.lz", - "os2_8.162.vdi.lz", "os2_9.023.vdi.lz", "ecs.vdi.lz", "macosx_10.11.vdi.lz", - "win10.vdi.lz", "win2000.vdi.lz","win95.vdi.lz","win95osr2.1.vdi.lz", - "win95osr2.5.vdi.lz","win95osr2.vdi.lz","win98.vdi.lz","win98se.vdi.lz", - "winme.vdi.lz","winnt_3.10.vdi.lz","winnt_3.50.vdi.lz","winnt_3.51.vdi.lz", - "winnt_4.00.vdi.lz","winvista.vdi.lz","beos_r4.5.vdi.lz","linux.vdi.lz", - "freebsd_6.1.vdi.lz","freebsd_7.0.vdi.lz","freebsd_8.2.vdi.lz", + readonly string[] testfiles = + { + "compaqmsdos331.vdi.lz", "drdos_3.40.vdi.lz", "drdos_3.41.vdi.lz", "drdos_5.00.vdi.lz", "drdos_6.00.vdi.lz", + "drdos_7.02.vdi.lz", "drdos_7.03.vdi.lz", "drdos_8.00.vdi.lz", "msdos331.vdi.lz", "msdos401.vdi.lz", + "msdos500.vdi.lz", "msdos600.vdi.lz", "msdos620rc1.vdi.lz", "msdos620.vdi.lz", "msdos621.vdi.lz", + "msdos622.vdi.lz", "msdos710.vdi.lz", "novelldos_7.00.vdi.lz", "opendos_7.01.vdi.lz", "pcdos2000.vdi.lz", + "pcdos200.vdi.lz", "pcdos210.vdi.lz", "pcdos300.vdi.lz", "pcdos310.vdi.lz", "pcdos330.vdi.lz", + "pcdos400.vdi.lz", "pcdos500.vdi.lz", "pcdos502.vdi.lz", "pcdos610.vdi.lz", "pcdos630.vdi.lz", + "toshibamsdos330.vdi.lz", "toshibamsdos401.vdi.lz", "msos2_1.21.vdi.lz", "msos2_1.30.1.vdi.lz", + "multiuserdos_7.22r4.vdi.lz", "os2_1.20.vdi.lz", "os2_1.30.vdi.lz", "os2_6.307.vdi.lz", "os2_6.514.vdi.lz", + "os2_6.617.vdi.lz", "os2_8.162.vdi.lz", "os2_9.023.vdi.lz", "ecs.vdi.lz", "macosx_10.11.vdi.lz", + "win10.vdi.lz", "win2000.vdi.lz", "win95.vdi.lz", "win95osr2.1.vdi.lz", "win95osr2.5.vdi.lz", + "win95osr2.vdi.lz", "win98.vdi.lz", "win98se.vdi.lz", "winme.vdi.lz", "winnt_3.10.vdi.lz", + "winnt_3.50.vdi.lz", "winnt_3.51.vdi.lz", "winnt_4.00.vdi.lz", "winvista.vdi.lz", "beos_r4.5.vdi.lz", + "linux.vdi.lz", "freebsd_6.1.vdi.lz", "freebsd_7.0.vdi.lz", "freebsd_8.2.vdi.lz", }; - readonly ulong[] sectors = { - 8192, 30720, 28672, 28672, - 28672, 28672, 28672, 28672, - 8192, 8192, 8192, 8192, - 8192, 8192, 8192, 8192, - 16384, 28672, 28672, 32768, - 32768, 32768, 32768, 32768, - 32768, 32768, 32768, 32768, - 32768, 32768, 8192, 8192, - 16384, 16384, 16384, 16384, - 16384, 16384, 16384, 16384, - 16384, 16384, 16384, 16384, - 16384, 16384, 16384, 16384, - 16384, 16384, 16384, 16384, - 16384, 16384, 16384, 16384, - 16384, 16384, 16384, 16384, - 16384, 16384, 16384, + readonly ulong[] sectors = + { + 8192, 30720, 28672, 28672, 28672, 28672, 28672, 28672, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, + 16384, 28672, 28672, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 8192, + 8192, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, + 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, + 16384, 16384, }; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, + readonly uint[] sectorsize = + { + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, }; - readonly long[] clusters = { - 1000, 3654, 3520, 3520, - 3520, 3520, 3520, 3520, - 1000, 1000, 1000, 1000, - 1000, 1000, 1000, 1000, - 2008, 3520, 3520, 4024, - 4031, 4031, 4024, 4024, - 4024, 4024, 4024, 4024, - 4024, 4024, 1000, 1000, - 2008, 2008, 2008, 2008, - 2008, 2008, 2008, 2008, - 2008, 2008, 1890, 4079, - 3552, 4088, 2008, 2008, - 2008, 2008, 2044, 2044, - 2044, 4016, 2044, 2044, - 4016, 3072, 2040, 3584, - 2044, 2044, 2044, + readonly long[] clusters = + { + 1000, 3654, 3520, 3520, 3520, 3520, 3520, 3520, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 2008, 3520, + 3520, 4024, 4031, 4031, 4024, 4024, 4024, 4024, 4024, 4024, 4024, 4024, 1000, 1000, 2008, 2008, 2008, 2008, + 2008, 2008, 2008, 2008, 2008, 2008, 1890, 4079, 3552, 4088, 2008, 2008, 2008, 2008, 2044, 2044, 2044, 4016, + 2044, 2044, 4016, 3072, 2040, 3584, 2044, 2044, 2044, }; - readonly int[] clustersize = { - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 2048, - 2048, 2048, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 2048, 4096, 4096, - 2048, 2048, 4096, 2048, - 4096, 4096, 4096, + readonly int[] clustersize = + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048, 2048, 2048, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048, + 4096, 4096, 2048, 2048, 4096, 2048, 4096, 4096, 4096, }; - readonly string[] volumename = { - null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - null,null,null,null, - null,"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VolumeLabel", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + readonly string[] volumename = + { + null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, null, null, + null, null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", }; - readonly string[] volumeserial = { - null,null,null,null, - null,null,null,"1BFB1273", - null,"407D1907","345D18FB","332518F4", - "395718E9","076718EF","1371181B","23281816", - "2F781809",null,null,"294F100F", - null,null,null,null, - null,"0F340FE4","1A5E0FF9","1D2F0FFE", - "076C1004","2C481009",null,"3C2319E8", - "66CC3C15","66A54C15",null,"5C578015", - "5B845015","5C4BF015","E6B5F414","E6B15414", - "E6A41414","E6A39414","E6B0B814","26A21EF4", - "74F4921D","C4B64D11","29200D0C","234F0DE4", - "074C0DFC","33640D18","0E121460","094C0EED", - "38310F02","50489A1B","2CE52101","94313E7E", - "BC184FE6","BAD08A1E","00000000","8D418102", - "8FC80E0A","34FA0E0B","02140E0B", + readonly string[] volumeserial = + { + null, null, null, null, null, null, null, "1BFB1273", null, "407D1907", "345D18FB", "332518F4", "395718E9", + "076718EF", "1371181B", "23281816", "2F781809", null, null, "294F100F", null, null, null, null, null, + "0F340FE4", "1A5E0FF9", "1D2F0FFE", "076C1004", "2C481009", null, "3C2319E8", "66CC3C15", "66A54C15", null, + "5C578015", "5B845015", "5C4BF015", "E6B5F414", "E6B15414", "E6A41414", "E6A39414", "E6B0B814", "26A21EF4", + "74F4921D", "C4B64D11", "29200D0C", "234F0DE4", "074C0DFC", "33640D18", "0E121460", "094C0EED", "38310F02", + "50489A1B", "2CE52101", "94313E7E", "BC184FE6", "BAD08A1E", "00000000", "8D418102", "8FC80E0A", "34FA0E0B", + "02140E0B", }; - readonly string[] oemid = { - "IBM 3.3", "IBM 3.2", "IBM 3.2", "IBM 3.3", - "IBM 3.3", "IBM 3.3", "DRDOS 7", "IBM 5.0", - "IBM 3.3", "MSDOS4.0", "MSDOS5.0", "MSDOS5.0", - "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", - "MSWIN4.1", "IBM 3.3", "IBM 3.3", "IBM 7.0", - "IBM 2.0", "IBM 2.0", "IBM 3.0", "IBM 3.1", - "IBM 3.3", "IBM 4.0", "IBM 5.0", "IBM 5.0", - "IBM 6.0", "IBM 6.0", "T V3.30 ", "T V4.00 ", - "IBM 10.2", "IBM 10.2", "IBM 3.2", "IBM 10.2", - "IBM 10.2", "IBM 20.0", "IBM 20.0", "IBM 20.0", - "IBM 20.0", "IBM 20.0", "IBM 4.50", "BSD 4.4", - "MSDOS5.0", "MSDOS5.0", "MSWIN4.0", "MSWIN4.1", - "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", - "MSWIN4.1", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", - "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat", - "BSD 4.4", "BSD 4.4", "BSD4.4 ", + readonly string[] oemid = + { + "IBM 3.3", "IBM 3.2", "IBM 3.2", "IBM 3.3", "IBM 3.3", "IBM 3.3", "DRDOS 7", "IBM 5.0", "IBM 3.3", + "MSDOS4.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "IBM 3.3", + "IBM 3.3", "IBM 7.0", "IBM 2.0", "IBM 2.0", "IBM 3.0", "IBM 3.1", "IBM 3.3", "IBM 4.0", "IBM 5.0", + "IBM 5.0", "IBM 6.0", "IBM 6.0", "T V3.30 ", "T V4.00 ", "IBM 10.2", "IBM 10.2", "IBM 3.2", "IBM 10.2", + "IBM 10.2", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 4.50", "BSD 4.4", "MSDOS5.0", + "MSDOS5.0", "MSWIN4.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSDOS5.0", + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat", "BSD 4.4", "BSD 4.4", "BSD4.4 ", }; [Test] @@ -217,4 +149,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/FAT16.cs b/DiscImageChef.Tests/Filesystems/FAT16.cs index a80dc949..708ce409 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16.cs @@ -38,63 +38,72 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class FAT16 { - readonly string[] testfiles = { + readonly string[] testfiles = + { // MS-DOS 3.30A "msdos_3.30A_mf2ed.img.lz", // MS-DOS 3.31 "msdos_3.31_mf2ed.img.lz", }; - readonly MediaType[] mediatypes = { + readonly MediaType[] mediatypes = + { // MS-DOS 3.30A MediaType.DOS_35_ED, // MS-DOS 3.31 MediaType.DOS_35_ED, }; - readonly ulong[] sectors = { + readonly ulong[] sectors = + { // MS-DOS 3.30A 5760, // MS-DOS 3.31 5760, }; - readonly uint[] sectorsize = { + readonly uint[] sectorsize = + { // MS-DOS 3.30A 512, // MS-DOS 3.31 512, }; - readonly long[] clusters = { + readonly long[] clusters = + { // MS-DOS 3.30A 5760, // MS-DOS 3.31 5760, }; - readonly int[] clustersize = { + readonly int[] clustersize = + { // MS-DOS 3.30A 512, // MS-DOS 3.31 512, }; - readonly string[] volumename = { + readonly string[] volumename = + { // MS-DOS 3.30A null, // MS-DOS 3.31 null, }; - readonly string[] volumeserial = { + readonly string[] volumeserial = + { // MS-DOS 3.30A null, // MS-DOS 3.31 null, }; - readonly string[] oemid = { + readonly string[] oemid = + { // MS-DOS 3.30A "MSDOS3.3", // MS-DOS 3.31 @@ -132,4 +141,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/FAT16_APM.cs b/DiscImageChef.Tests/Filesystems/FAT16_APM.cs index d46904aa..38f180ec 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_APM.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_APM.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class FAT16_APM { - readonly string[] testfiles = { - "macosx_10.11.vdi.lz", - }; + readonly string[] testfiles = {"macosx_10.11.vdi.lz",}; - readonly ulong[] sectors = { - 1024000, - }; + readonly ulong[] sectors = {1024000,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 63995, - }; + readonly long[] clusters = {63995,}; - readonly int[] clustersize = { - 8192, - }; + readonly int[] clustersize = {8192,}; - readonly string[] volumename = { - "VOLUMELABEL", - }; + readonly string[] volumename = {"VOLUMELABEL",}; - readonly string[] volumeserial = { - "063D1F09", - }; + readonly string[] volumeserial = {"063D1F09",}; - readonly string[] oemid = { - "BSD 4.4", - }; + readonly string[] oemid = {"BSD 4.4",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -107,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs b/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs index 6dcabd84..9c1bba07 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class FAT16_Atari { - readonly string[] testfiles = { - "tos_1.04.vdi.lz","tos_1.04_small.vdi.lz", - }; + readonly string[] testfiles = {"tos_1.04.vdi.lz", "tos_1.04_small.vdi.lz",}; - readonly ulong[] sectors = { - 81920, 16384, - }; + readonly ulong[] sectors = {81920, 16384,}; - readonly uint[] sectorsize = { - 512, 512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 10239, 8191, - }; + readonly long[] clusters = {10239, 8191,}; - readonly int[] clustersize = { - 4096, 1024, - }; + readonly int[] clustersize = {4096, 1024,}; - readonly string[] volumename = { - null, null, - }; + readonly string[] volumename = {null, null,}; - readonly string[] volumeserial = { - "BA9831", "2019E1", - }; + readonly string[] volumeserial = {"BA9831", "2019E1",}; - readonly string[] oemid = { - null, null, - }; + readonly string[] oemid = {null, null,}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -107,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs b/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs index d0b9254c..9c8111a8 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class FAT16_GPT { - readonly string[] testfiles = { - "macosx_10.11.vdi.lz", - }; + readonly string[] testfiles = {"macosx_10.11.vdi.lz",}; - readonly ulong[] sectors = { - 1024000, - }; + readonly ulong[] sectors = {1024000,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 63995, - }; + readonly long[] clusters = {63995,}; - readonly int[] clustersize = { - 8192, - }; + readonly int[] clustersize = {8192,}; - readonly string[] volumename = { - "VOLUMELABEL", - }; + readonly string[] volumename = {"VOLUMELABEL",}; - readonly string[] volumeserial = { - "2E8A1F1B", - }; + readonly string[] volumeserial = {"2E8A1F1B",}; - readonly string[] oemid = { - "BSD 4.4", - }; + readonly string[] oemid = {"BSD 4.4",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -107,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/FAT16_MBR.cs b/DiscImageChef.Tests/Filesystems/FAT16_MBR.cs index 23469122..f41bfd0f 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_MBR.cs @@ -40,156 +40,90 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class FAT16_MBR { - readonly string[] testfiles = { - "drdos_3.40.vdi.lz", "drdos_3.41.vdi.lz", "drdos_5.00.vdi.lz", "drdos_6.00.vdi.lz", - "drdos_7.02.vdi.lz", "drdos_7.03.vdi.lz", "drdos_8.00.vdi.lz", "msdos331.vdi.lz", - "msdos401.vdi.lz", "msdos500.vdi.lz", "msdos600.vdi.lz", "msdos620rc1.vdi.lz", - "msdos620.vdi.lz", "msdos621.vdi.lz", "msdos622.vdi.lz", "msdos710.vdi.lz", - "novelldos_7.00.vdi.lz", "opendos_7.01.vdi.lz", "pcdos2000.vdi.lz", "pcdos400.vdi.lz", - "pcdos500.vdi.lz", "pcdos502.vdi.lz", "pcdos610.vdi.lz", "pcdos630.vdi.lz", - "msos2_1.21.vdi.lz", "msos2_1.30.1.vdi.lz", "multiuserdos_7.22r4.vdi.lz", "os2_1.20.vdi.lz", - "os2_1.30.vdi.lz", "os2_6.307.vdi.lz", "os2_6.514.vdi.lz", "os2_6.617.vdi.lz", - "os2_8.162.vdi.lz", "os2_9.023.vdi.lz", "ecs.vdi.lz", "macosx_10.11.vdi.lz", - "win10.vdi.lz", "win2000.vdi.lz", "win95osr2.1.vdi.lz", "win95osr2.5.vdi.lz", - "win95osr2.vdi.lz", "win95.vdi.lz", "win98se.vdi.lz", "win98.vdi.lz", - "winme.vdi.lz", "winnt_3.10.vdi.lz", "winnt_3.50.vdi.lz", "winnt_3.51.vdi.lz", - "winnt_4.00.vdi.lz", "winvista.vdi.lz", "beos_r4.5.vdi.lz", "linux.vdi.lz", - "amigaos_3.9.vdi.lz","aros.vdi.lz","freebsd_6.1.vdi.lz","freebsd_7.0.vdi.lz", - "freebsd_8.2.vdi.lz","macos_7.5.3.vdi.lz","macos_7.5.vdi.lz","macos_7.6.vdi.lz", + readonly string[] testfiles = + { + "drdos_3.40.vdi.lz", "drdos_3.41.vdi.lz", "drdos_5.00.vdi.lz", "drdos_6.00.vdi.lz", "drdos_7.02.vdi.lz", + "drdos_7.03.vdi.lz", "drdos_8.00.vdi.lz", "msdos331.vdi.lz", "msdos401.vdi.lz", "msdos500.vdi.lz", + "msdos600.vdi.lz", "msdos620rc1.vdi.lz", "msdos620.vdi.lz", "msdos621.vdi.lz", "msdos622.vdi.lz", + "msdos710.vdi.lz", "novelldos_7.00.vdi.lz", "opendos_7.01.vdi.lz", "pcdos2000.vdi.lz", "pcdos400.vdi.lz", + "pcdos500.vdi.lz", "pcdos502.vdi.lz", "pcdos610.vdi.lz", "pcdos630.vdi.lz", "msos2_1.21.vdi.lz", + "msos2_1.30.1.vdi.lz", "multiuserdos_7.22r4.vdi.lz", "os2_1.20.vdi.lz", "os2_1.30.vdi.lz", + "os2_6.307.vdi.lz", "os2_6.514.vdi.lz", "os2_6.617.vdi.lz", "os2_8.162.vdi.lz", "os2_9.023.vdi.lz", + "ecs.vdi.lz", "macosx_10.11.vdi.lz", "win10.vdi.lz", "win2000.vdi.lz", "win95osr2.1.vdi.lz", + "win95osr2.5.vdi.lz", "win95osr2.vdi.lz", "win95.vdi.lz", "win98se.vdi.lz", "win98.vdi.lz", "winme.vdi.lz", + "winnt_3.10.vdi.lz", "winnt_3.50.vdi.lz", "winnt_3.51.vdi.lz", "winnt_4.00.vdi.lz", "winvista.vdi.lz", + "beos_r4.5.vdi.lz", "linux.vdi.lz", "amigaos_3.9.vdi.lz", "aros.vdi.lz", "freebsd_6.1.vdi.lz", + "freebsd_7.0.vdi.lz", "freebsd_8.2.vdi.lz", "macos_7.5.3.vdi.lz", "macos_7.5.vdi.lz", "macos_7.6.vdi.lz", "macos_8.0.vdi.lz", }; - readonly ulong[] sectors = { - 1024000, 1024000, 1024000, 1024000, - 1024000, 1024000, 1024000, 1024000, - 1024000, 1024000, 1024000, 1024000, - 1024000, 1024000, 1024000, 1024000, - 1024000, 1024000, 1024000, 1024000, - 1024000, 1024000, 1024000, 1024000, - 1024000, 1024000, 1024000, 1024000, - 1024000, 1024000, 1024000, 1024000, - 1024000, 1024000, 1024000, 1024000, - 1024000, 1024000, 1024000, 1024000, - 1024000, 1024000, 1024000, 1024000, - 1024000, 1024000, 1024000, 1024000, - 1024000, 1024000, 1024000, 262144, - 1024128, 1024000, 1024000, 1024000, - 1024000, 1024000, 1024000, 1024000, + readonly ulong[] sectors = + { + 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, + 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, + 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, + 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, + 1024000, 1024000, 1024000, 262144, 1024128, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, }; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, + readonly uint[] sectorsize = + { + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, }; - readonly long[] clusters = { - 63882, 63941, 63941, 63941, - 63941, 63941, 63941, 63941, - 63941, 63941, 63941, 63941, - 63941, 63941, 63941, 63941, - 63941, 63941, 63941, 63941, - 63941, 63941, 63941, 63941, - 63941, 63941, 63941, 63941, - 63941, 63941, 63941, 63941, - 63941, 63941, 63882, 63992, - 63864, 63252, 63941, 63941, - 63941, 63941, 63998, 63998, - 63998, 63941, 63998, 63998, - 63941, 63616, 63996, 65024, - 63941, 63882, 63998, 63998, - 31999, 63941, 63941, 63941, + readonly long[] clusters = + { + 63882, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, + 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, + 63941, 63941, 63941, 63941, 63882, 63992, 63864, 63252, 63941, 63941, 63941, 63941, 63998, 63998, 63998, + 63941, 63998, 63998, 63941, 63616, 63996, 65024, 63941, 63882, 63998, 63998, 31999, 63941, 63941, 63941, 63941, }; - readonly int[] clustersize = { - 8192, 8192, 8192, 8192, - 8192, 8192, 8192, 8192, - 8192, 8192, 8192, 8192, - 8192, 8192, 8192, 8192, - 8192, 8192, 8192, 8192, - 8192, 8192, 8192, 8192, - 8192, 8192, 8192, 8192, - 8192, 8192, 8192, 8192, - 8192, 8192, 8192, 8192, - 8192, 8192, 8192, 8192, - 8192, 8192, 8192, 8192, - 8192, 8192, 8192, 8192, - 8192, 8192, 8192, 2048, - 8192, 8192, 8192, 8192, - 16384, 8192, 8192, 8192, - 8192, + readonly int[] clustersize = + { + 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, + 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, + 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 2048, 8192, 8192, + 8192, 8192, 16384, 8192, 8192, 8192, 8192, }; - readonly string[] volumename = { - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",null, - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","NO NAME ", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VolumeLabel", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL", + readonly string[] volumename = + { + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "NO NAME ", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", }; - readonly string[] volumeserial = { - null,null,null,null, - null,null,"1BFB0748",null, - "217B1909","0C6D18FC","382B18F4","3E2018E9", - "0D2418EF","195A181B","27761816","356B1809", - null,null,"2272100F","07280FE1", - "1F630FF9","18340FFE","3F3F1003","273D1009", - "9C162C15","9C1E2C15",null,"5BE66015", - "5BE43015","5BEAC015","E6B18414","E6C63414", - "1C069414","1C059414","1BE5B814","3EF71EF4", - "DAF97911","305637BD","275B0DE4","09650DFC", - "38270D18","2E620D0C","0B4F0EED","0E122464", - "3B5F0F02","C84CB6F2","D0E9AD4E","C039A2EC", - "501F9FA6","9AAA4216","00000000","A132D985", - "374D3BD1","52BEA34A","3CF10E0D","C6C30E0D", - "44770E0D","27761816","27761816","27761816", - "27761816", + readonly string[] volumeserial = + { + null, null, null, null, null, null, "1BFB0748", null, "217B1909", "0C6D18FC", "382B18F4", "3E2018E9", + "0D2418EF", "195A181B", "27761816", "356B1809", null, null, "2272100F", "07280FE1", "1F630FF9", "18340FFE", + "3F3F1003", "273D1009", "9C162C15", "9C1E2C15", null, "5BE66015", "5BE43015", "5BEAC015", "E6B18414", + "E6C63414", "1C069414", "1C059414", "1BE5B814", "3EF71EF4", "DAF97911", "305637BD", "275B0DE4", "09650DFC", + "38270D18", "2E620D0C", "0B4F0EED", "0E122464", "3B5F0F02", "C84CB6F2", "D0E9AD4E", "C039A2EC", "501F9FA6", + "9AAA4216", "00000000", "A132D985", "374D3BD1", "52BEA34A", "3CF10E0D", "C6C30E0D", "44770E0D", "27761816", + "27761816", "27761816", "27761816", }; - readonly string[] oemid = { - "IBM 3.2", "IBM 3.2", "IBM 3.3", "IBM 3.3", - "IBM 3.3", "DRDOS 7", "IBM 5.0", "IBM 3.3", - "MSDOS4.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", - "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", - "IBM 3.3", "IBM 3.3", "IBM 7.0", "IBM 4.0", - "IBM 5.0", "IBM 5.0", "IBM 6.0", "IBM 6.0", - "IBM 10.2", "IBM 10.2", "IBM 3.2", "IBM 10.2", - "IBM 10.2", "IBM 20.0", "IBM 20.0", "IBM 20.0", - "IBM 20.0", "IBM 20.0", "IBM 4.50", "BSD 4.4", - "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1", - "MSWIN4.1", "MSWIN4.0", "MSWIN4.1", "MSWIN4.1", - "MSWIN4.1", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", - "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat", - "CDP 5.0", "MSWIN4.1", "BSD 4.4", "BSD 4.4", - "BSD4.4 ", "PCX 2.0 ", "PCX 2.0 ", "PCX 2.0 ", - "PCX 2.0 ", + readonly string[] oemid = + { + "IBM 3.2", "IBM 3.2", "IBM 3.3", "IBM 3.3", "IBM 3.3", "DRDOS 7", "IBM 5.0", "IBM 3.3", "MSDOS4.0", + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "IBM 3.3", "IBM 3.3", + "IBM 7.0", "IBM 4.0", "IBM 5.0", "IBM 5.0", "IBM 6.0", "IBM 6.0", "IBM 10.2", "IBM 10.2", "IBM 3.2", + "IBM 10.2", "IBM 10.2", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 4.50", "BSD 4.4", + "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat", "CDP 5.0", "MSWIN4.1", + "BSD 4.4", "BSD 4.4", "BSD4.4 ", "PCX 2.0 ", "PCX 2.0 ", "PCX 2.0 ", "PCX 2.0 ", }; [Test] @@ -217,4 +151,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs b/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs index 3ec4e7f1..6d242e62 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class FAT16_RDB { - readonly string[] testfiles = { - "amigaos_3.9.vdi.lz", - }; + readonly string[] testfiles = {"amigaos_3.9.vdi.lz",}; - readonly ulong[] sectors = { - 1024128 - }; + readonly ulong[] sectors = {1024128}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 63689 - }; + readonly long[] clusters = {63689}; - readonly int[] clustersize = { - 8192, - }; + readonly int[] clustersize = {8192,}; - readonly string[] volumename = { - "VOLUMELABEL" - }; + readonly string[] volumename = {"VOLUMELABEL"}; - readonly string[] volumeserial = { - "374D40D1", - }; + readonly string[] volumeserial = {"374D40D1",}; - readonly string[] oemid = { - "CDP 5.0", - }; + readonly string[] oemid = {"CDP 5.0",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -107,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/FAT32_APM.cs b/DiscImageChef.Tests/Filesystems/FAT32_APM.cs index 16188748..3a2e3a14 100644 --- a/DiscImageChef.Tests/Filesystems/FAT32_APM.cs +++ b/DiscImageChef.Tests/Filesystems/FAT32_APM.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class FAT32_APM { - readonly string[] testfiles = { - "macosx_10.11.vdi.lz", - }; + readonly string[] testfiles = {"macosx_10.11.vdi.lz",}; - readonly ulong[] sectors = { - 4194304, - }; + readonly ulong[] sectors = {4194304,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 524278, - }; + readonly long[] clusters = {524278,}; - readonly int[] clustersize = { - 4096, - }; + readonly int[] clustersize = {4096,}; - readonly string[] volumename = { - "VOLUMELABEL", - }; + readonly string[] volumename = {"VOLUMELABEL",}; - readonly string[] volumeserial = { - "35BD1F0A", - }; + readonly string[] volumeserial = {"35BD1F0A",}; - readonly string[] oemid = { - "BSD 4.4", - }; + readonly string[] oemid = {"BSD 4.4",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -107,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs b/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs index a04e6bdc..3b7391f9 100644 --- a/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class FAT32_GPT { - readonly string[] testfiles = { - "macosx_10.11.vdi.lz", - }; + readonly string[] testfiles = {"macosx_10.11.vdi.lz",}; - readonly ulong[] sectors = { - 4194304, - }; + readonly ulong[] sectors = {4194304,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 523775, - }; + readonly long[] clusters = {523775,}; - readonly int[] clustersize = { - 4096, - }; + readonly int[] clustersize = {4096,}; - readonly string[] volumename = { - "VOLUMELABEL", - }; + readonly string[] volumename = {"VOLUMELABEL",}; - readonly string[] volumeserial = { - "7ABE1F1B", - }; + readonly string[] volumeserial = {"7ABE1F1B",}; - readonly string[] oemid = { - "BSD 4.4", - }; + readonly string[] oemid = {"BSD 4.4",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -107,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/FAT32_MBR.cs b/DiscImageChef.Tests/Filesystems/FAT32_MBR.cs index f1e3cea6..2531b4c7 100644 --- a/DiscImageChef.Tests/Filesystems/FAT32_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/FAT32_MBR.cs @@ -40,68 +40,54 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class FAT32_MBR { - readonly string[] testfiles = { - "drdos_7.03.vdi.lz", "drdos_8.00.vdi.lz", "msdos_7.10.vdi.lz", "macosx_10.11.vdi.lz", - "win10.vdi.lz", "win2000.vdi.lz", "win95osr2.1.vdi.lz", "win95osr2.5.vdi.lz", - "win95osr2.vdi.lz", "win98se.vdi.lz", "win98.vdi.lz", "winme.vdi.lz", - "winvista.vdi.lz", "beos_r4.5.vdi.lz", "linux.vdi.lz","aros.vdi.lz", - "freebsd_6.1.vdi.lz","freebsd_7.0.vdi.lz","freebsd_8.2.vdi.lz","freedos_1.2.vdi.lz", + readonly string[] testfiles = + { + "drdos_7.03.vdi.lz", "drdos_8.00.vdi.lz", "msdos_7.10.vdi.lz", "macosx_10.11.vdi.lz", "win10.vdi.lz", + "win2000.vdi.lz", "win95osr2.1.vdi.lz", "win95osr2.5.vdi.lz", "win95osr2.vdi.lz", "win98se.vdi.lz", + "win98.vdi.lz", "winme.vdi.lz", "winvista.vdi.lz", "beos_r4.5.vdi.lz", "linux.vdi.lz", "aros.vdi.lz", + "freebsd_6.1.vdi.lz", "freebsd_7.0.vdi.lz", "freebsd_8.2.vdi.lz", "freedos_1.2.vdi.lz", }; - readonly ulong[] sectors = { - 8388608, 8388608, 8388608, 4194304, - 4194304, 8388608, 4194304, 4194304, - 4194304, 4194304, 4194304, 4194304, - 4194304, 4194304, 262144, 4194304, - 4194304, 4194304, 4194304, 8388608, + readonly ulong[] sectors = + { + 8388608, 8388608, 8388608, 4194304, 4194304, 8388608, 4194304, 4194304, 4194304, 4194304, 4194304, 4194304, + 4194304, 4194304, 262144, 4194304, 4194304, 4194304, 4194304, 8388608, }; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, + readonly uint[] sectorsize = + {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,}; + + readonly long[] clusters = + { + 1048233, 1048233, 1048233, 524287, 524016, 1048233, 524152, 524152, 524152, 524112, 524112, 524112, 523520, + 1048560, 260096, 524160, 524112, 524112, 65514, 1048233, }; - readonly long[] clusters = { - 1048233, 1048233, 1048233, 524287, - 524016, 1048233, 524152, 524152, - 524152, 524112, 524112, 524112, - 523520, 1048560, 260096, 524160, - 524112, 524112, 65514, 1048233, + readonly int[] clustersize = + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048, 512, 4096, 4096, 4096, + 32768, 4096, }; - readonly int[] clustersize = { - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 2048, 512, 4096, - 4096, 4096, 32768, 4096, + readonly string[] volumename = + { + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", }; - readonly string[] volumename = { - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VolumeLabel","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + readonly string[] volumeserial = + { + "5955996C", "1BFB1A43", "3B331809", "42D51EF1", "48073346", "EC62E6DE", "2A310DE4", "0C140DFC", "3E310D18", + "0D3D0EED", "0E131162", "3F500F02", "82EB4C04", "00000000", "B488C502", "5CAC9B4E", "41540E0E", "4E600E0F", + "26E20E0F", "3E0C1BE8", }; - readonly string[] volumeserial = { - "5955996C","1BFB1A43","3B331809","42D51EF1", - "48073346","EC62E6DE","2A310DE4","0C140DFC", - "3E310D18","0D3D0EED","0E131162","3F500F02", - "82EB4C04","00000000","B488C502","5CAC9B4E", - "41540E0E","4E600E0F","26E20E0F","3E0C1BE8", - }; - - readonly string[] oemid = { - "DRDOS7.X", "IBM 7.1", "MSWIN4.1", "BSD 4.4", - "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1", - "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", - "MSDOS5.0", "BeOS ", "mkfs.fat", "MSWIN4.1", - "BSD 4.4", "BSD 4.4", "BSD4.4 ", "FRDOS4.1", + readonly string[] oemid = + { + "DRDOS7.X", "IBM 7.1", "MSWIN4.1", "BSD 4.4", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", + "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSDOS5.0", "BeOS ", "mkfs.fat", "MSWIN4.1", "BSD 4.4", "BSD 4.4", + "BSD4.4 ", "FRDOS4.1", }; [Test] @@ -129,4 +115,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs b/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs index 5f825970..e0e00b2d 100644 --- a/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs @@ -40,33 +40,20 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HAMMER_MBR { - readonly string[] testfiles = { - "dflybsd_3.6.1.vdi.lz","dflybsd_4.0.5.vdi.lz", - }; + readonly string[] testfiles = {"dflybsd_3.6.1.vdi.lz", "dflybsd_4.0.5.vdi.lz",}; - readonly ulong[] sectors = { - 104857600, 104857600, - }; + readonly ulong[] sectors = {104857600, 104857600,}; - readonly uint[] sectorsize = { - 512, 512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 6310, 6310, - }; + readonly long[] clusters = {6310, 6310,}; - readonly int[] clustersize = { - 8388608, 8388608, - }; + readonly int[] clustersize = {8388608, 8388608,}; - readonly string[] volumename = { - "Volume label", "Volume label", - }; + readonly string[] volumename = {"Volume label", "Volume label",}; - readonly string[] volumeserial = { - "f8e1a8bb-626d-11e7-94b5-0900274691e4","ff4dc664-6276-11e7-983f-090027c41b46", - }; + readonly string[] volumeserial = + {"f8e1a8bb-626d-11e7-94b5-0900274691e4", "ff4dc664-6276-11e7-983f-090027c41b46",}; [Test] public void Test() @@ -91,6 +78,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +90,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HFS.cs b/DiscImageChef.Tests/Filesystems/HFS.cs index 12089ab9..a81e03ac 100644 --- a/DiscImageChef.Tests/Filesystems/HFS.cs +++ b/DiscImageChef.Tests/Filesystems/HFS.cs @@ -38,45 +38,33 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HFS { - readonly string[] testfiles = { - "macos_1.1_mf2dd.img.lz","macos_2.0_mf2dd.img.lz","macos_6.0.7_mf2dd.img.lz","nextstep_3.3_mf2hd.img.lz", - "openstep_4.0_mf2hd.img.lz","openstep_4.2_mf2hd.img.lz","rhapsody_dr1_mf2hd.img.lz", + readonly string[] testfiles = + { + "macos_1.1_mf2dd.img.lz", "macos_2.0_mf2dd.img.lz", "macos_6.0.7_mf2dd.img.lz", "nextstep_3.3_mf2hd.img.lz", + "openstep_4.0_mf2hd.img.lz", "openstep_4.2_mf2hd.img.lz", "rhapsody_dr1_mf2hd.img.lz", }; - readonly MediaType[] mediatypes = { + readonly MediaType[] mediatypes = + { MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD, }; - readonly ulong[] sectors = { - 1600, 1600, 1600, 2880, - 2880, 2880, 2880, + readonly ulong[] sectors = {1600, 1600, 1600, 2880, 2880, 2880, 2880,}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512,}; + + readonly long[] clusters = {1594, 1594, 1594, 2874, 2874, 2874, 2874,}; + + readonly int[] clustersize = {512, 512, 512, 512, 512, 512, 512,}; + + readonly string[] volumename = + { + "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", + "Volume label", }; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, - }; - - readonly long[] clusters = { - 1594, 1594, 1594, 2874, - 2874, 2874, 2874, - }; - - readonly int[] clustersize = { - 512, 512, 512, 512, - 512, 512, 512, - }; - - readonly string[] volumename = { - "Volume label","Volume label","Volume label","Volume label", - "Volume label","Volume label","Volume label", - }; - - readonly string[] volumeserial = { - null, null, null, null, - null, null, null, - }; + readonly string[] volumeserial = {null, null, null, null, null, null, null,}; [Test] public void Test() @@ -108,4 +96,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs b/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs index a168a1a9..317f5309 100644 --- a/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs +++ b/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs @@ -41,76 +41,53 @@ namespace DiscImageChef.Tests.Filesystems public class HFSPlus_APM { // Missing Darwin 1.4.1 - readonly string[] testfiles = { - "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz","darwin_1.3.1.vdi.lz","darwin_1.3.1_wrapped.vdi.lz", - "darwin_1.4.1_wrapped.vdi.lz","darwin_6.0.2.vdi.lz","darwin_6.0.2_wrapped.vdi.lz", - "darwin_8.0.1_journal.vdi.lz","darwin_8.0.1.vdi.lz","darwin_8.0.1_wrapped.vdi.lz","macos_8.1.vdi.lz", - "macos_9.0.4.vdi.lz","macos_9.1.vdi.lz","macos_9.2.1.vdi.lz","macos_9.2.2.vdi.lz", - "macosx_10.2.vdi.lz","macosx_10.3_journal.vdi.lz","macosx_10.3.vdi.lz","macosx_10.4_journal.vdi.lz", - "macosx_10.4.vdi.lz", + readonly string[] testfiles = + { + "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz", "darwin_1.3.1.vdi.lz", "darwin_1.3.1_wrapped.vdi.lz", + "darwin_1.4.1_wrapped.vdi.lz", "darwin_6.0.2.vdi.lz", "darwin_6.0.2_wrapped.vdi.lz", + "darwin_8.0.1_journal.vdi.lz", "darwin_8.0.1.vdi.lz", "darwin_8.0.1_wrapped.vdi.lz", "macos_8.1.vdi.lz", + "macos_9.0.4.vdi.lz", "macos_9.1.vdi.lz", "macos_9.2.1.vdi.lz", "macos_9.2.2.vdi.lz", "macosx_10.2.vdi.lz", + "macosx_10.3_journal.vdi.lz", "macosx_10.3.vdi.lz", "macosx_10.4_journal.vdi.lz", "macosx_10.4.vdi.lz", }; - readonly ulong[] sectors = { - 409600, 614400, 819200, 614400, - 614400, 819200, 614400, - 1228800, 819200, 614400, 4194304, - 4194304, 4194304,4194304,4194304, - 4194304, 2097152, 4194304, 2097152, - 4194304 + readonly ulong[] sectors = + { + 409600, 614400, 819200, 614400, 614400, 819200, 614400, 1228800, 819200, 614400, 4194304, 4194304, 4194304, + 4194304, 4194304, 4194304, 2097152, 4194304, 2097152, 4194304 }; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, + readonly uint[] sectorsize = + {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,}; + + readonly long[] clusters = + { + 51190, 76790, 102392, 76774, 76774, 102392, 76774, 153592, 102392, 76774, 524152, 524088, 524088, 524088, + 524088, 524008, 261884, 491240, 261884, 491240, }; - readonly long[] clusters = { - 51190, 76790, 102392, 76774, - 76774, 102392, 76774, - 153592, 102392, 76774, 524152, - 524088, 524088, 524088, 524088, - 524008, 261884, 491240, 261884, - 491240, + readonly int[] clustersize = + { + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, }; - readonly int[] clustersize = { - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, + readonly string[] volumename = + { + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, }; - readonly string[] volumename = { - null, null, null, null, - null, null, null, - null, null, null, null, - null, null, null, null, - null, null, null, null, - null, + readonly string[] volumeserial = + { + "FA94762D086A18A9", "33D4A309C8E7BD10", null, null, null, null, null, "4D5140EB8F14A385", + "0D592249833E2DC4", "AA616146576BD9BC", null, null, null, null, null, "EFA132FFFAC1ADA6", + "009D570FFCF8F20B", "17F6F33AB313EE32", "AD5690C093F66FCF", "A7D63854DF76DDE6", }; - readonly string[] volumeserial = { - "FA94762D086A18A9","33D4A309C8E7BD10",null,null, - null,null,null, - "4D5140EB8F14A385","0D592249833E2DC4","AA616146576BD9BC",null, - null,null,null,null, - "EFA132FFFAC1ADA6","009D570FFCF8F20B","17F6F33AB313EE32","AD5690C093F66FCF", - "A7D63854DF76DDE6", - }; - - readonly string[] oemid = { - "10.0","HFSJ","10.0","10.0", - "10.0","10.0","10.0", - "10.0","10.0","10.0","8.10", - "8.10","8.10","8.10","8.10", - "10.0","HFSJ","10.0","HFSJ", - "10.0", + readonly string[] oemid = + { + "10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "8.10", "8.10", "8.10", + "8.10", "8.10", "10.0", "HFSJ", "10.0", "HFSJ", "10.0", }; [Test] @@ -136,6 +113,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -148,4 +126,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs b/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs index ed8232eb..03f024b8 100644 --- a/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HFSPlus_GPT { - readonly string[] testfiles = { - "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz", - }; + readonly string[] testfiles = {"macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz",}; - readonly ulong[] sectors = { - 409600, 614400, - }; + readonly ulong[] sectors = {409600, 614400,}; - readonly uint[] sectorsize = { - 512, 512 - }; + readonly uint[] sectorsize = {512, 512}; - readonly long[] clusters = { - 51190, 76790, - }; + readonly long[] clusters = {51190, 76790,}; - readonly int[] clustersize = { - 4096, 4096, - }; + readonly int[] clustersize = {4096, 4096,}; - readonly string[] volumename = { - null, null, - }; + readonly string[] volumename = {null, null,}; - readonly string[] volumeserial = { - "D8C68470046E67BE","FD3CB598F3C6294A", - }; + readonly string[] volumeserial = {"D8C68470046E67BE", "FD3CB598F3C6294A",}; - readonly string[] oemid = { - "10.0","HFSJ" - }; + readonly string[] oemid = {"10.0", "HFSJ"}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -107,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs b/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs index 027cbbb1..88e0e981 100644 --- a/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs @@ -41,61 +41,33 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HFSPlus_MBR { - readonly string[] testfiles = { + readonly string[] testfiles = + { "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz", "linux.vdi.lz", "linux_journal.vdi.lz", - "darwin_1.3.1.vdi.lz","darwin_1.3.1_wrapped.vdi.lz","darwin_1.4.1.vdi.lz","darwin_1.4.1_wrapped.vdi.lz", - "darwin_6.0.2.vdi.lz","darwin_8.0.1_journal.vdi.lz","darwin_8.0.1.vdi.lz", - "darwin_8.0.1_wrapped.vdi.lz", + "darwin_1.3.1.vdi.lz", "darwin_1.3.1_wrapped.vdi.lz", "darwin_1.4.1.vdi.lz", "darwin_1.4.1_wrapped.vdi.lz", + "darwin_6.0.2.vdi.lz", "darwin_8.0.1_journal.vdi.lz", "darwin_8.0.1.vdi.lz", "darwin_8.0.1_wrapped.vdi.lz", }; - readonly ulong[] sectors = { - 303104, 352256, 262144, 262144, - 819200, 614400, 819200, 614400, - 819200, 1228800, 819200, - 614400, + readonly ulong[] sectors = + {303104, 352256, 262144, 262144, 819200, 614400, 819200, 614400, 819200, 1228800, 819200, 614400,}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,}; + + readonly long[] clusters = + {37878, 44021, 32512, 32512, 102178, 76708, 102178, 76708, 102178, 153592, 102392, 76774,}; + + readonly int[] clustersize = {4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096,}; + + readonly string[] volumename = {null, null, null, null, null, null, null, null, null, null, null, null,}; + + readonly string[] volumeserial = + { + "C84F550907D13F50", "016599F88029F73D", null, null, null, null, null, null, null, "F92964F9B3F64ABB", + "A8FAC484A0A2B177", "D5D5BF1346AD2B8D", }; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, - 512, - }; - - readonly long[] clusters = { - 37878, 44021, 32512, 32512, - 102178, 76708, 102178, 76708, - 102178, 153592, 102392, - 76774, - }; - - readonly int[] clustersize = { - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, 4096, - 4096, 4096, 4096, - 4096, - }; - - readonly string[] volumename = { - null, null, null, null, - null, null, null, null, - null, null, null, - null, - }; - - readonly string[] volumeserial = { - "C84F550907D13F50","016599F88029F73D",null,null, - null,null,null,null, - null,"F92964F9B3F64ABB","A8FAC484A0A2B177", - "D5D5BF1346AD2B8D", - }; - - readonly string[] oemid = { - "10.0","HFSJ","10.0","10.0", - "10.0","10.0","10.0","10.0", - "10.0","10.0","10.0", - "10.0", - }; + readonly string[] oemid = + {"10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0",}; [Test] public void Test() @@ -120,6 +92,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -132,4 +105,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HFSX_APM.cs b/DiscImageChef.Tests/Filesystems/HFSX_APM.cs index 1af9d711..7bf0ec8a 100644 --- a/DiscImageChef.Tests/Filesystems/HFSX_APM.cs +++ b/DiscImageChef.Tests/Filesystems/HFSX_APM.cs @@ -40,45 +40,29 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HFSX_APM { - readonly string[] testfiles = { - "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz","darwin_8.0.1_journal.vdi.lz","darwin_8.0.1.vdi.lz", - "macosx_10.4_journal.vdi.lz","macosx_10.4.vdi.lz", + readonly string[] testfiles = + { + "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz", "darwin_8.0.1_journal.vdi.lz", "darwin_8.0.1.vdi.lz", + "macosx_10.4_journal.vdi.lz", "macosx_10.4.vdi.lz", }; - readonly ulong[] sectors = { - 819200, 1228800, 1638400, 1433600, - 4194304, 1024000, + readonly ulong[] sectors = {819200, 1228800, 1638400, 1433600, 4194304, 1024000,}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512,}; + + readonly long[] clusters = {102390, 153590, 204792, 179192, 491290, 127770,}; + + readonly int[] clustersize = {4096, 4096, 4096, 4096, 4096, 4096,}; + + readonly string[] volumename = {null, null, null, null, null, null,}; + + readonly string[] volumeserial = + { + "CC2D56884950D9AE", "7AF1175D8EA7A072", "BB4ABD7E7E2FF5AF", "E2F212D815EF77B5", "5A8C646A5D77EB16", + "258C51A750F6A485", }; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, - }; - - readonly long[] clusters = { - 102390, 153590, 204792, 179192, - 491290, 127770, - }; - - readonly int[] clustersize = { - 4096, 4096,4096, 4096, - 4096, 4096, - }; - - readonly string[] volumename = { - null, null, null, null, - null, null, - }; - - readonly string[] volumeserial = { - "CC2D56884950D9AE","7AF1175D8EA7A072","BB4ABD7E7E2FF5AF","E2F212D815EF77B5", - "5A8C646A5D77EB16","258C51A750F6A485", - }; - - readonly string[] oemid = { - "10.0","HFSJ","10.0","10.0", - "HFSJ","10.0", - }; + readonly string[] oemid = {"10.0", "HFSJ", "10.0", "10.0", "HFSJ", "10.0",}; [Test] public void Test() @@ -103,6 +87,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -115,4 +100,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs b/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs index fa09f956..62d6f0ae 100644 --- a/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HFSX_GPT { - readonly string[] testfiles = { - "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz", - }; + readonly string[] testfiles = {"macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz",}; - readonly ulong[] sectors = { - 819200, 1228800, - }; + readonly ulong[] sectors = {819200, 1228800,}; - readonly uint[] sectorsize = { - 512, 512 - }; + readonly uint[] sectorsize = {512, 512}; - readonly long[] clusters = { - 102390, 153590, - }; + readonly long[] clusters = {102390, 153590,}; - readonly int[] clustersize = { - 4096, 4096, - }; + readonly int[] clustersize = {4096, 4096,}; - readonly string[] volumename = { - null, null, - }; + readonly string[] volumename = {null, null,}; - readonly string[] volumeserial = { - "328343989312AE9F","FB98504073464C5C", - }; + readonly string[] volumeserial = {"328343989312AE9F", "FB98504073464C5C",}; - readonly string[] oemid = { - "10.0","HFSJ" - }; + readonly string[] oemid = {"10.0", "HFSJ"}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -107,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs b/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs index 4c67f3ed..3806c33e 100644 --- a/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs @@ -40,45 +40,26 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HFSX_MBR { - readonly string[] testfiles = { + readonly string[] testfiles = + { "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz", "linux.vdi.lz", "linux_journal.vdi.lz", - "darwin_8.0.1_journal.vdi.lz","darwin_8.0.1.vdi.lz", + "darwin_8.0.1_journal.vdi.lz", "darwin_8.0.1.vdi.lz", }; - readonly ulong[] sectors = { - 393216, 409600, 262144, 262144, - 1638400, 1433600, - }; + readonly ulong[] sectors = {393216, 409600, 262144, 262144, 1638400, 1433600,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 49140, 51187, 32512, 32512, - 204792, 179192, - }; + readonly long[] clusters = {49140, 51187, 32512, 32512, 204792, 179192,}; - readonly int[] clustersize = { - 4096, 4096, 4096, 4096, - 4096, 4096, - }; + readonly int[] clustersize = {4096, 4096, 4096, 4096, 4096, 4096,}; - readonly string[] volumename = { - null, null, null, null, - null, null, - }; + readonly string[] volumename = {null, null, null, null, null, null,}; - readonly string[] volumeserial = { - "C2BCCCE6DE5BC98D","AC54CD78C75CC30F",null,null, - "7559DD01BCFADD9A","AEA39CFBBF14C0FF", - }; + readonly string[] volumeserial = + {"C2BCCCE6DE5BC98D", "AC54CD78C75CC30F", null, null, "7559DD01BCFADD9A", "AEA39CFBBF14C0FF",}; - readonly string[] oemid = { - "10.0","HFSJ","10.0","10.0", - "10.0","10.0", - }; + readonly string[] oemid = {"10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0",}; [Test] public void Test() @@ -103,6 +84,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -115,4 +97,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HFS_APM.cs b/DiscImageChef.Tests/Filesystems/HFS_APM.cs index b49d8ad1..291431cb 100644 --- a/DiscImageChef.Tests/Filesystems/HFS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/HFS_APM.cs @@ -40,95 +40,59 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HFS_APM { - readonly string[] testfiles = { - "amigaos_3.9.vdi.lz","darwin_1.3.1.vdi.lz","darwin_1.4.1.vdi.lz","darwin_6.0.2.vdi.lz", - "darwin_8.0.1.vdi.lz","macos_1.1.vdi.lz","macos_2.0.vdi.lz","macos_6.0.7.vdi.lz", - "macos_7.5.3.vdi.lz","macos_7.5.vdi.lz","macos_7.6.vdi.lz","macos_8.0.vdi.lz", - "macos_8.1.vdi.lz","macos_9.0.4.vdi.lz","macos_9.1.vdi.lz","macos_9.2.1.vdi.lz", - "macos_9.2.2.vdi.lz","macosx_10.2.vdi.lz","macosx_10.3.vdi.lz","macosx_10.4.vdi.lz", - "rhapsody_dr1.vdi.lz","d2_driver.vdi.lz","hdt_1.8.vdi.lz","macos_4.2.vdi.lz", - "macos_4.3.vdi.lz","macos_6.0.2.vdi.lz","macos_6.0.3.vdi.lz","macos_6.0.4.vdi.lz", - "macos_6.0.5.vdi.lz","macos_6.0.8.vdi.lz","macos_6.0.vdi.lz","macos_7.0.vdi.lz", - "macos_7.1.1.vdi.lz","parted.vdi.lz","silverlining_2.2.1.vdi.lz","speedtools_3.6.vdi.lz", - "vcpformatter_2.1.1.vdi.lz", + readonly string[] testfiles = + { + "amigaos_3.9.vdi.lz", "darwin_1.3.1.vdi.lz", "darwin_1.4.1.vdi.lz", "darwin_6.0.2.vdi.lz", + "darwin_8.0.1.vdi.lz", "macos_1.1.vdi.lz", "macos_2.0.vdi.lz", "macos_6.0.7.vdi.lz", "macos_7.5.3.vdi.lz", + "macos_7.5.vdi.lz", "macos_7.6.vdi.lz", "macos_8.0.vdi.lz", "macos_8.1.vdi.lz", "macos_9.0.4.vdi.lz", + "macos_9.1.vdi.lz", "macos_9.2.1.vdi.lz", "macos_9.2.2.vdi.lz", "macosx_10.2.vdi.lz", "macosx_10.3.vdi.lz", + "macosx_10.4.vdi.lz", "rhapsody_dr1.vdi.lz", "d2_driver.vdi.lz", "hdt_1.8.vdi.lz", "macos_4.2.vdi.lz", + "macos_4.3.vdi.lz", "macos_6.0.2.vdi.lz", "macos_6.0.3.vdi.lz", "macos_6.0.4.vdi.lz", "macos_6.0.5.vdi.lz", + "macos_6.0.8.vdi.lz", "macos_6.0.vdi.lz", "macos_7.0.vdi.lz", "macos_7.1.1.vdi.lz", "parted.vdi.lz", + "silverlining_2.2.1.vdi.lz", "speedtools_3.6.vdi.lz", "vcpformatter_2.1.1.vdi.lz", }; - readonly ulong[] sectors = { - 1024128,409600,409600,409600, - 409600,41820,41820,81648, - 1024000,1024000,1024000,1024000, - 1024000,1024000,1024000,1024000, - 1024000,1024000,1024000,1024000, - 409600,51200,51200,41820, - 41820,54840,54840,54840, - 54840,54840,41820,54840, - 54840,262144,51200,51200, - 54840, + readonly ulong[] sectors = + { + 1024128, 409600, 409600, 409600, 409600, 41820, 41820, 81648, 1024000, 1024000, 1024000, 1024000, 1024000, + 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 409600, 51200, 51200, 41820, 41820, 54840, + 54840, 54840, 54840, 54840, 41820, 54840, 54840, 262144, 51200, 51200, 54840, }; - readonly uint[] sectorsize = { - 512,512,512,512, - 512,512,512,512, - 512,512,512,512, - 512,512,512,512, - 512,512,512,512, - 512,512,512,512, - 512,512,512,512, - 512,512,512,512, - 512,512,512,512, - 512, + readonly uint[] sectorsize = + { + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, }; - readonly long[] clusters = { - 64003,51189,51189,58502, - 58502,41788,38950,39991, - 63954,63990,63954,63954, - 63954,63922,63922,63922, - 63922,63884,63883,63883, - 58506,50926,50094,38950, - 38950,38950,38950,7673, - 38950,38950,38950,38950, - 38950,46071,50382,49135, - 54643, + readonly long[] clusters = + { + 64003, 51189, 51189, 58502, 58502, 41788, 38950, 39991, 63954, 63990, 63954, 63954, 63954, 63922, 63922, + 63922, 63922, 63884, 63883, 63883, 58506, 50926, 50094, 38950, 38950, 38950, 38950, 7673, 38950, 38950, + 38950, 38950, 38950, 46071, 50382, 49135, 54643, }; - readonly int[] clustersize = { - 8192,4096,4096,3584, - 3584,512,512,1024, - 8192,8192,8192,8192, - 8192,8192,8192,8192, - 8192,8192,8192,8192, - 3584,512,512,512, - 512,512,512,512, - 512,512,512,512, - 512,1024,512,512, - 512, + readonly int[] clustersize = + { + 8192, 4096, 4096, 3584, 3584, 512, 512, 1024, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, + 8192, 8192, 3584, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 1024, 512, 512, 512, }; - readonly string[] volumename = { - "Volume label","Volume label","Volume label","Volume label", - "Volume label","Volume label","Volume label","Volume label", - "Volume label","Volume label","Volume label","Volume label", - "Volume label","Volume label","Volume label","Volume label", - "Volume label","Volume label","Volume label","Volume label", - "Volume label","Volume label","Volume label","Volume label", - "Volume label","Volume label","Volume label","Test disk", - "Volume label","Volume label","Volume label","Volume label", - "Volume label","Untitled","Untitled #1","24 MB Disk", - "Volume label", + readonly string[] volumename = + { + "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", + "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", + "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", + "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", + "Volume label", "Volume label", "Volume label", "Test disk", "Volume label", "Volume label", "Volume label", + "Volume label", "Volume label", "Untitled", "Untitled #1", "24 MB Disk", "Volume label", }; - readonly string[] volumeserial = { - null,null,null,null, - "AAFE1382AF5AA898",null,null,null, - null,null,null,null, - null,null,null,null, - null,"5A7C38B0CAF279C4","FB49083EBD150509","632C0B1DB46FD188", - null,null,null,null, - null,null,null,null, - null,null,null,null, - null,null,null,null, - null, + readonly string[] volumeserial = + { + null, null, null, null, "AAFE1382AF5AA898", null, null, null, null, null, null, null, null, null, null, + null, null, "5A7C38B0CAF279C4", "FB49083EBD150509", "632C0B1DB46FD188", null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, }; [Test] @@ -154,6 +118,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -165,4 +130,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs b/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs index 3a2fc264..4dd2d0de 100644 --- a/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs +++ b/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs @@ -39,45 +39,25 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HFS_CDROM { - readonly string[] testfiles = { - "toast_3.5.7_hfs_from_volume.iso.lz","toast_3.5.7_iso9660_hfs.iso.lz", - "toast_4.1.3_hfs_from_volume.iso.lz","toast_4.1.3_iso9660_hfs.iso.lz", - "toast_3.5.7_hfs_from_files.iso.lz","toast_4.1.3_hfs_from_files.iso.lz", + readonly string[] testfiles = + { + "toast_3.5.7_hfs_from_volume.iso.lz", "toast_3.5.7_iso9660_hfs.iso.lz", + "toast_4.1.3_hfs_from_volume.iso.lz", "toast_4.1.3_iso9660_hfs.iso.lz", "toast_3.5.7_hfs_from_files.iso.lz", + "toast_4.1.3_hfs_from_files.iso.lz", }; - readonly ulong[] sectors = { - 942,1880, - 943,1882, - 1509,1529, - }; + readonly ulong[] sectors = {942, 1880, 943, 1882, 1509, 1529,}; - readonly uint[] sectorsize = { - 2048,2048, - 2048,2048, - 2048,2048, - }; + readonly uint[] sectorsize = {2048, 2048, 2048, 2048, 2048, 2048,}; - readonly long[] clusters = { - 3724,931, - 931,931, - 249,249, - }; + readonly long[] clusters = {3724, 931, 931, 931, 249, 249,}; - readonly int[] clustersize = { - 512,2048, - 2048,2048, - 12288,12288, - }; + readonly int[] clustersize = {512, 2048, 2048, 2048, 12288, 12288,}; - readonly string[] volumename = { - "Disk utils","Disk utils","Disk utils", - "Disk utils","Disk utils","Disk utils", - }; + readonly string[] volumename = + {"Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils",}; - readonly string[] volumeserial = { - null,null,null, - null,null,null, - }; + readonly string[] volumeserial = {null, null, null, null, null, null,}; [Test] public void Test() @@ -102,6 +82,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -113,4 +94,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HFS_MBR.cs b/DiscImageChef.Tests/Filesystems/HFS_MBR.cs index 4d14d731..eeb16193 100644 --- a/DiscImageChef.Tests/Filesystems/HFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HFS_MBR.cs @@ -40,40 +40,23 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HFS_MBR { - readonly string[] testfiles = { - "linux.vdi.lz", - "darwin_1.3.1.vdi.lz","darwin_1.4.1.vdi.lz","darwin_6.0.2.vdi.lz","darwin_8.0.1.vdi.lz", + readonly string[] testfiles = + { + "linux.vdi.lz", "darwin_1.3.1.vdi.lz", "darwin_1.4.1.vdi.lz", "darwin_6.0.2.vdi.lz", "darwin_8.0.1.vdi.lz", }; - readonly ulong[] sectors = { - 262144, - 409600,409600,409600,409600, - }; + readonly ulong[] sectors = {262144, 409600, 409600, 409600, 409600,}; - readonly uint[] sectorsize = { - 512, - 512,512,512,512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 65018, - 51145,51145,58452,58502, - }; + readonly long[] clusters = {65018, 51145, 51145, 58452, 58502,}; - readonly int[] clustersize = { - 2048, - 4096,4096,3584,3584, - }; + readonly int[] clustersize = {2048, 4096, 4096, 3584, 3584,}; - readonly string[] volumename = { - "Volume label", - "Volume label","Volume label","Volume label","Volume label", - }; + readonly string[] volumename = + {"Volume label", "Volume label", "Volume label", "Volume label", "Volume label",}; - readonly string[] volumeserial = { - null, - null,null,null,"81FE805D61458753", - }; + readonly string[] volumeserial = {null, null, null, null, "81FE805D61458753",}; [Test] public void Test() @@ -98,6 +81,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -109,4 +93,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HFS_RDB.cs b/DiscImageChef.Tests/Filesystems/HFS_RDB.cs index aaa057d8..25238202 100644 --- a/DiscImageChef.Tests/Filesystems/HFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/HFS_RDB.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HFS_RDB { - readonly string[] testfiles = { - "amigaos_3.9.vdi.lz", - }; + readonly string[] testfiles = {"amigaos_3.9.vdi.lz",}; - readonly ulong[] sectors = { - 1024128 - }; + readonly ulong[] sectors = {1024128}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 63752, - }; + readonly long[] clusters = {63752,}; - readonly int[] clustersize = { - 8192, - }; + readonly int[] clustersize = {8192,}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - null, - }; + readonly string[] volumeserial = {null,}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HPFS.cs b/DiscImageChef.Tests/Filesystems/HPFS.cs index 90e596dd..5ca7e6b8 100644 --- a/DiscImageChef.Tests/Filesystems/HPFS.cs +++ b/DiscImageChef.Tests/Filesystems/HPFS.cs @@ -40,52 +40,39 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HPFS { - readonly string[] testfiles = { - "ecs.vdi.lz", "msos2_1.21.vdi.lz", "msos2_1.30.1.vdi.lz", "os2_1.20.vdi.lz", - "os2_1.30.vdi.lz", "os2_6.307.vdi.lz", "os2_6.514.vdi.lz", "os2_6.617.vdi.lz", - "os2_8.162.vdi.lz", "os2_9.023.vdi.lz", "winnt_3.10.vdi.lz", "winnt_3.50.vdi.lz", + readonly string[] testfiles = + { + "ecs.vdi.lz", "msos2_1.21.vdi.lz", "msos2_1.30.1.vdi.lz", "os2_1.20.vdi.lz", "os2_1.30.vdi.lz", + "os2_6.307.vdi.lz", "os2_6.514.vdi.lz", "os2_6.617.vdi.lz", "os2_8.162.vdi.lz", "os2_9.023.vdi.lz", + "winnt_3.10.vdi.lz", "winnt_3.50.vdi.lz", }; - readonly ulong[] sectors = { - 262144, 1024000, 1024000, 1024000, - 1024000, 1024000, 262144, 262144, - 262144, 262144, 262144, 262144 + readonly ulong[] sectors = + {262144, 1024000, 1024000, 1024000, 1024000, 1024000, 262144, 262144, 262144, 262144, 262144, 262144}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512}; + + readonly long[] clusters = + {261072, 1023056, 1023056, 1023056, 1023056, 1023056, 262016, 262016, 262016, 262016, 262016, 262112,}; + + readonly int[] clustersize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,}; + + readonly string[] volumename = + { + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", }; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512 + readonly string[] volumeserial = + { + "2BBBD814", "AC0DDC15", "ABEB2C15", "6C4EE015", "6C406015", "6C49B015", "2BCEB414", "2C157414", "2BF55414", + "2BE31414", "E851CB14", "A4EDC29C", }; - readonly long[] clusters = { - 261072, 1023056, 1023056, 1023056, - 1023056, 1023056, 262016, 262016, - 262016, 262016, 262016, 262112, - }; - - readonly int[] clustersize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - }; - - readonly string[] volumename = { - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", - }; - - readonly string[] volumeserial = { - "2BBBD814","AC0DDC15","ABEB2C15","6C4EE015", - "6C406015","6C49B015","2BCEB414","2C157414", - "2BF55414","2BE31414","E851CB14","A4EDC29C", - }; - - readonly string[] oemid = { - "IBM 4.50", "OS2 10.1", "OS2 10.0", "OS2 10.0", - "OS2 10.0", "OS2 20.0", "OS2 20.0", "OS2 20.1", - "OS2 20.0", "OS2 20.0", "MSDOS5.0", "MSDOS5.0", + readonly string[] oemid = + { + "IBM 4.50", "OS2 10.1", "OS2 10.0", "OS2 10.0", "OS2 10.0", "OS2 20.0", "OS2 20.0", "OS2 20.1", "OS2 20.0", + "OS2 20.0", "MSDOS5.0", "MSDOS5.0", }; [Test] @@ -113,4 +100,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HTFS.cs b/DiscImageChef.Tests/Filesystems/HTFS.cs index c40460ca..ba0bf279 100644 --- a/DiscImageChef.Tests/Filesystems/HTFS.cs +++ b/DiscImageChef.Tests/Filesystems/HTFS.cs @@ -38,50 +38,29 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HTFS { - readonly string[] testfiles = { - "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", + readonly string[] testfiles = + { + "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", + "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", "scoopenserver_5.0.7hw_mf2hd.img.lz", }; - readonly MediaType[] mediatypes = { - MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, - MediaType.DOS_35_HD, - }; + readonly MediaType[] mediatypes = + {MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD,}; - readonly ulong[] sectors = { - 3360, 2400, 1440, 5760, - 2880, - }; + readonly ulong[] sectors = {3360, 2400, 1440, 5760, 2880,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 1680, 1200, 720, 2880, - 1440, - }; + readonly long[] clusters = {1680, 1200, 720, 2880, 1440,}; - readonly int[] clustersize = { - 1024, 1024, 1024, 1024, - 1024, - }; + readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024,}; - readonly string[] volumename = { - "", "", "", "", - "", - }; + readonly string[] volumename = {"", "", "", "", "",}; - readonly string[] volumeserial = { - null, null, null, null, - null, - }; + readonly string[] volumeserial = {null, null, null, null, null,}; - readonly string[] type = { - "HTFS", "HTFS", "HTFS", "HTFS", - "HTFS", - }; + readonly string[] type = {"HTFS", "HTFS", "HTFS", "HTFS", "HTFS",}; [Test] public void Test() @@ -113,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs b/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs index 8c03e75e..f3ba1976 100644 --- a/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class HTFS_MBR { - readonly string[] testfiles = { - "scoopenserver_5.0.7hw.vdi.lz" - }; + readonly string[] testfiles = {"scoopenserver_5.0.7hw.vdi.lz"}; - readonly ulong[] sectors = { - 2097152, - }; + readonly ulong[] sectors = {2097152,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 1020096, - }; + readonly long[] clusters = {1020096,}; - readonly int[] clustersize = { - 1024, - }; + readonly int[] clustersize = {1024,}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - null, - }; + readonly string[] volumeserial = {null,}; - readonly string[] type = { - "HTFS", - }; + readonly string[] type = {"HTFS",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -106,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/ISO9660.cs b/DiscImageChef.Tests/Filesystems/ISO9660.cs index fdca5302..902c8661 100644 --- a/DiscImageChef.Tests/Filesystems/ISO9660.cs +++ b/DiscImageChef.Tests/Filesystems/ISO9660.cs @@ -38,85 +38,78 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class ISO9660 { - readonly string[] testfiles = { + readonly string[] testfiles = + { // Toast 3.5.7 - "toast_3.5.7_iso9660_apple.iso.lz", "toast_3.5.7_iso9660_dos_apple.iso.lz", "toast_3.5.7_iso9660_dos.iso.lz", "toast_3.5.7_iso9660_hfs.iso.lz", - "toast_3.5.7_iso9660.iso.lz", "toast_3.5.7_iso9660_joliet_apple.iso.lz", "toast_3.5.7_iso9660_joliet.iso.lz", "toast_3.5.7_iso9660_mac_apple.iso.lz", - "toast_3.5.7_iso9660_mac.iso.lz", "toast_3.5.7_iso9660_ver_apple.iso.lz", "toast_3.5.7_iso9660_ver_dos_apple.iso.lz", "toast_3.5.7_iso9660_ver_dos.iso.lz", - "toast_3.5.7_iso9660_ver.iso.lz", "toast_3.5.7_iso9660_ver_joliet_apple.iso.lz", "toast_3.5.7_iso9660_ver_joliet.iso.lz", "toast_3.5.7_iso9660.iso.lz", + "toast_3.5.7_iso9660_apple.iso.lz", "toast_3.5.7_iso9660_dos_apple.iso.lz", + "toast_3.5.7_iso9660_dos.iso.lz", "toast_3.5.7_iso9660_hfs.iso.lz", "toast_3.5.7_iso9660.iso.lz", + "toast_3.5.7_iso9660_joliet_apple.iso.lz", "toast_3.5.7_iso9660_joliet.iso.lz", + "toast_3.5.7_iso9660_mac_apple.iso.lz", "toast_3.5.7_iso9660_mac.iso.lz", + "toast_3.5.7_iso9660_ver_apple.iso.lz", "toast_3.5.7_iso9660_ver_dos_apple.iso.lz", + "toast_3.5.7_iso9660_ver_dos.iso.lz", "toast_3.5.7_iso9660_ver.iso.lz", + "toast_3.5.7_iso9660_ver_joliet_apple.iso.lz", "toast_3.5.7_iso9660_ver_joliet.iso.lz", + "toast_3.5.7_iso9660.iso.lz", // Toast 4.1.3 "toast_4.1.3_iso9660_hfs.iso.lz", }; - readonly MediaType[] mediatypes = { - MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, - MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, - MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, - MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, - MediaType.CD, + readonly MediaType[] mediatypes = + { + MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, + MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, + MediaType.CD, MediaType.CD, MediaType.CD, }; - readonly ulong[] sectors = { - 946, 946, 300, 1880, - 300, 951, 300, 946, - 300, 946, 946, 300, - 300, 951, 300, 300, - 1882, + readonly ulong[] sectors = + {946, 946, 300, 1880, 300, 951, 300, 946, 300, 946, 946, 300, 300, 951, 300, 300, 1882,}; + + readonly uint[] sectorsize = + {2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048,}; + + readonly long[] clusters = + {946, 946, 300, 1880, 300, 951, 300, 946, 300, 946, 946, 300, 300, 951, 300, 300, 1882,}; + + readonly int[] clustersize = + {2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048,}; + + readonly string[] volumename = + { + "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "Disk utils", "Disk utils", + "Disk utils", "Disk utils", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "Disk utils", + "Disk utils", "DISK_UTILS", "DISK_UTILS", }; - readonly uint[] sectorsize = { - 2048, 2048, 2048, 2048, - 2048, 2048, 2048, 2048, - 2048, 2048, 2048, 2048, - 2048, 2048, 2048, 2048, - 2048, + readonly string[] volumeserial = + {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,}; + + readonly string[] sysid = + { + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", }; - readonly long[] clusters = { - 946, 946, 300, 1880, - 300, 951, 300, 946, - 300, 946, 946, 300, - 300, 951, 300, 300, - 1882, - }; - - readonly int[] clustersize = { - 2048, 2048, 2048, 2048, - 2048, 2048, 2048, 2048, - 2048, 2048, 2048, 2048, - 2048, 2048, 2048, 2048, - 2048, - }; - - readonly string[] volumename = { - "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", - "DISK_UTILS", "Disk utils", "Disk utils", "Disk utils", - "Disk utils", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", - "DISK_UTILS", "Disk utils", "Disk utils", "DISK_UTILS", - "DISK_UTILS", - }; - - readonly string[] volumeserial = { - null, null, null, null, - null, null, null, null, - null, null, null, null, - null, null, null, null, - null, - }; - - readonly string[] sysid = { - "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - "APPLE COMPUTER, INC., TYPE: 0002", - }; - - readonly string[] appid = { - "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY","TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY","TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY","TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", - "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY","TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY","TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY","TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", - "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY","TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY","TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY","TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", - "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY","TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY","TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY","TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + readonly string[] appid = + { + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", + "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", }; @@ -152,4 +145,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/JFS2.cs b/DiscImageChef.Tests/Filesystems/JFS2.cs index aecdd306..1e42702e 100644 --- a/DiscImageChef.Tests/Filesystems/JFS2.cs +++ b/DiscImageChef.Tests/Filesystems/JFS2.cs @@ -40,33 +40,20 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class JFS2 { - readonly string[] testfiles = { - "linux.vdi.lz","linux_caseinsensitive.vdi.lz", - }; + readonly string[] testfiles = {"linux.vdi.lz", "linux_caseinsensitive.vdi.lz",}; - readonly ulong[] sectors = { - 262144, 262144, - }; + readonly ulong[] sectors = {262144, 262144,}; - readonly uint[] sectorsize = { - 512, 512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 257632, 257632, - }; + readonly long[] clusters = {257632, 257632,}; - readonly int[] clustersize = { - 4096, 4096, - }; + readonly int[] clustersize = {4096, 4096,}; - readonly string[] volumename = { - "Volume labe", "Volume labe", - }; + readonly string[] volumename = {"Volume labe", "Volume labe",}; - readonly string[] volumeserial = { - "8033b783-0cd1-1645-8ecc-f8f113ad6a47", "d6cd91e9-3899-7e40-8468-baab688ee2e2", - }; + readonly string[] volumeserial = + {"8033b783-0cd1-1645-8ecc-f8f113ad6a47", "d6cd91e9-3899-7e40-8468-baab688ee2e2",}; [Test] public void Test() @@ -91,6 +78,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +90,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/LFS_MBR.cs b/DiscImageChef.Tests/Filesystems/LFS_MBR.cs index b7f5eaed..b6777072 100644 --- a/DiscImageChef.Tests/Filesystems/LFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/LFS_MBR.cs @@ -34,33 +34,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class LFS_MBR { - readonly string[] testfiles = { - "netbsd_1.6.vdi.lz", - }; + readonly string[] testfiles = {"netbsd_1.6.vdi.lz",}; - readonly ulong[] sectors = { - 409600, - }; + readonly ulong[] sectors = {409600,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 409600 - }; + readonly long[] clusters = {409600}; - readonly int[] clustersize = { - 512, - }; + readonly int[] clustersize = {512,}; - readonly string[] volumename = { - null, - }; + readonly string[] volumename = {null,}; - readonly string[] volumeserial = { - null, - }; + readonly string[] volumeserial = {null,}; [Test] public void Test() @@ -98,4 +84,4 @@ namespace DiscImageChef.Tests.Filesystems }*/ } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/LisaFS.cs b/DiscImageChef.Tests/Filesystems/LisaFS.cs index e04c2c49..f220c435 100644 --- a/DiscImageChef.Tests/Filesystems/LisaFS.cs +++ b/DiscImageChef.Tests/Filesystems/LisaFS.cs @@ -38,52 +38,45 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class LisaFS { - readonly string[] testfiles = { - "166files.dc42.lz", "222files.dc42.lz", "blank2.0.dc42.lz", "blank-disk.dc42.lz", "file-with-a-password.dc42.lz", - "tfwdndrc-has-been-erased.dc42.lz", "tfwdndrc-has-been-restored.dc42.lz", "three-empty-folders.dc42.lz", - "three-folders-with-differently-named-docs.dc42.lz", + readonly string[] testfiles = + { + "166files.dc42.lz", "222files.dc42.lz", "blank2.0.dc42.lz", "blank-disk.dc42.lz", + "file-with-a-password.dc42.lz", "tfwdndrc-has-been-erased.dc42.lz", "tfwdndrc-has-been-restored.dc42.lz", + "three-empty-folders.dc42.lz", "three-folders-with-differently-named-docs.dc42.lz", "three-folders-with-differently-named-docs-root-alphabetical.dc42.lz", "three-folders-with-differently-named-docs-root-chronological.dc42.lz", "three-folders-with-identically-named-docs.dc42.lz", }; - readonly MediaType[] mediatypes = { - MediaType.AppleSonySS,MediaType.AppleSonySS,MediaType.AppleSonySS,MediaType.AppleSonySS, - MediaType.AppleSonySS,MediaType.AppleSonySS,MediaType.AppleSonySS,MediaType.AppleSonySS, - MediaType.AppleSonySS,MediaType.AppleSonySS,MediaType.AppleSonySS,MediaType.AppleSonySS, + readonly MediaType[] mediatypes = + { + MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, + MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, + MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, }; - readonly ulong[] sectors = { - 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, - }; + readonly ulong[] sectors = {800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 800, 800, 792, 800, 800, 800, 800, 800, 800, 800, 800, 800, - }; + readonly long[] clusters = {800, 800, 792, 800, 800, 800, 800, 800, 800, 800, 800, 800,}; - readonly int[] clustersize = { - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, - }; + readonly int[] clustersize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,}; - readonly string[] volumename = { - "166Files", "222Files", "AOS 4:59 pm 10/02/87", "AOS 3.0", - "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", + readonly string[] volumename = + { + "166Files", "222Files", "AOS 4:59 pm 10/02/87", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", }; - readonly string[] volumeserial = { - "A23703A202010663", "A23703A201010663", "A32D261301010663", "A22CB48D01010663", - "A22CC3A702010663", "A22CB48D14010663", "A22CB48D14010663", "A22CB48D01010663", - "A22CB48D01010663", "A22CB48D01010663", "A22CB48D01010663", "A22CB48D01010663", + readonly string[] volumeserial = + { + "A23703A202010663", "A23703A201010663", "A32D261301010663", "A22CB48D01010663", "A22CC3A702010663", + "A22CB48D14010663", "A22CB48D14010663", "A22CB48D01010663", "A22CB48D01010663", "A22CB48D01010663", + "A22CB48D01010663", "A22CB48D01010663", }; - readonly string[] oemid = { - null, null, null, null, null, null, null, null, null, null, null, null, - }; + readonly string[] oemid = {null, null, null, null, null, null, null, null, null, null, null, null,}; [Test] public void Test() @@ -116,4 +109,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/Locus.cs b/DiscImageChef.Tests/Filesystems/Locus.cs index a1f723cc..2c931eaa 100644 --- a/DiscImageChef.Tests/Filesystems/Locus.cs +++ b/DiscImageChef.Tests/Filesystems/Locus.cs @@ -38,41 +38,23 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class Locus { - readonly string[] testfiles = { - "mf2dd.img.lz", "mf2hd.img.lz", - }; + readonly string[] testfiles = {"mf2dd.img.lz", "mf2hd.img.lz",}; - readonly MediaType[] mediatypes = { - MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, - }; + readonly MediaType[] mediatypes = {MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD,}; - readonly ulong[] sectors = { - 1440, 2880, - }; + readonly ulong[] sectors = {1440, 2880,}; - readonly uint[] sectorsize = { - 512, 512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 180, 360, - }; + readonly long[] clusters = {180, 360,}; - readonly int[] clustersize = { - 4096, 4096, - }; + readonly int[] clustersize = {4096, 4096,}; - readonly string[] volumename = { - "Label", "Label", - }; + readonly string[] volumename = {"Label", "Label",}; - readonly string[] volumeserial = { - null, null, - }; + readonly string[] volumeserial = {null, null,}; - readonly string[] oemid = { - null, null, - }; + readonly string[] oemid = {null, null,}; [Test] public void Test() @@ -105,4 +87,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/MFS.cs b/DiscImageChef.Tests/Filesystems/MFS.cs index 638866d0..ff648e9e 100644 --- a/DiscImageChef.Tests/Filesystems/MFS.cs +++ b/DiscImageChef.Tests/Filesystems/MFS.cs @@ -38,45 +38,30 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class MFS { - readonly string[] testfiles = { - "macos_0.1_mf1dd.img.lz","macos_0.5_mf1dd.img.lz","macos_1.1_mf1dd.img.lz","macos_2.0_mf1dd.img.lz", + readonly string[] testfiles = + { + "macos_0.1_mf1dd.img.lz", "macos_0.5_mf1dd.img.lz", "macos_1.1_mf1dd.img.lz", "macos_2.0_mf1dd.img.lz", "macos_6.0.7_mf1dd.img.lz", }; - readonly MediaType[] mediatypes = { + readonly MediaType[] mediatypes = + { MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS }; - readonly ulong[] sectors = { - 800, 800, 800, 800, - 800, - }; + readonly ulong[] sectors = {800, 800, 800, 800, 800,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 391, 391, 391, 391, - 391, - }; + readonly long[] clusters = {391, 391, 391, 391, 391,}; - readonly int[] clustersize = { - 1024, 1024, 1024, 1024, - 1024, - }; + readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024,}; - readonly string[] volumename = { - "Volume label","Volume label","Volume label","Volume label", - "Volume label", - }; + readonly string[] volumename = + {"Volume label", "Volume label", "Volume label", "Volume label", "Volume label",}; - readonly string[] volumeserial = { - null, null, null, null, - null, null, null, - }; + readonly string[] volumeserial = {null, null, null, null, null, null, null,}; [Test] public void Test() @@ -108,4 +93,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/MINIXv1.cs b/DiscImageChef.Tests/Filesystems/MINIXv1.cs index 743e3aa7..160fcc5b 100644 --- a/DiscImageChef.Tests/Filesystems/MINIXv1.cs +++ b/DiscImageChef.Tests/Filesystems/MINIXv1.cs @@ -38,33 +38,24 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class MINIXv1 { - readonly string[] testfiles = { - "minix_3.1.2a_dsdd.img.lz","minix_3.1.2a_dshd.img.lz","minix_3.1.2a_mf2dd.img.lz","minix_3.1.2a_mf2hd.img.lz", + readonly string[] testfiles = + { + "minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz", + "minix_3.1.2a_mf2hd.img.lz", }; - readonly MediaType[] mediatypes = { - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, - }; + readonly MediaType[] mediatypes = + {MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD,}; - readonly ulong[] sectors = { - 720, 2400, 1440, 2880, - }; + readonly ulong[] sectors = {720, 2400, 1440, 2880,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512 - }; + readonly uint[] sectorsize = {512, 512, 512, 512}; - readonly long[] clusters = { - 360, 1200, 720, 1440, - }; + readonly long[] clusters = {360, 1200, 720, 1440,}; - readonly int[] clustersize = { - 1024, 1024, 1024, 1024, - }; + readonly int[] clustersize = {1024, 1024, 1024, 1024,}; - readonly string[] types = { - "Minix 3 v1", "Minix 3 v1", "Minix 3 v1", "Minix 3 v1", - }; + readonly string[] types = {"Minix 3 v1", "Minix 3 v1", "Minix 3 v1", "Minix 3 v1",}; [Test] public void Test() @@ -94,4 +85,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs index 0bdcce40..ce9bf462 100644 --- a/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs @@ -40,29 +40,17 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class MINIXv1_MBR { - readonly string[] testfiles = { - "linux.vdi.lz","minix_3.1.2a.vdi.lz", - }; + readonly string[] testfiles = {"linux.vdi.lz", "minix_3.1.2a.vdi.lz",}; - readonly ulong[] sectors = { - 262144,102400, - }; + readonly ulong[] sectors = {262144, 102400,}; - readonly uint[] sectorsize = { - 512,512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 65535,50399, - }; + readonly long[] clusters = {65535, 50399,}; - readonly int[] clustersize = { - 1024,1024, - }; + readonly int[] clustersize = {1024, 1024,}; - readonly string[] types = { - "Minix v1", "Minix 3 v1", - }; + readonly string[] types = {"Minix v1", "Minix 3 v1",}; [Test] public void Test() @@ -87,6 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -96,4 +85,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/MINIXv2.cs b/DiscImageChef.Tests/Filesystems/MINIXv2.cs index 963be2b3..8a47f796 100644 --- a/DiscImageChef.Tests/Filesystems/MINIXv2.cs +++ b/DiscImageChef.Tests/Filesystems/MINIXv2.cs @@ -38,33 +38,24 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class MINIXv2 { - readonly string[] testfiles = { - "minix_3.1.2a_dsdd.img.lz","minix_3.1.2a_dshd.img.lz","minix_3.1.2a_mf2dd.img.lz","minix_3.1.2a_mf2hd.img.lz", + readonly string[] testfiles = + { + "minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz", + "minix_3.1.2a_mf2hd.img.lz", }; - readonly MediaType[] mediatypes = { - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, - }; + readonly MediaType[] mediatypes = + {MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD,}; - readonly ulong[] sectors = { - 720, 2400, 1440, 2880, - }; + readonly ulong[] sectors = {720, 2400, 1440, 2880,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512 - }; + readonly uint[] sectorsize = {512, 512, 512, 512}; - readonly long[] clusters = { - 360, 1200, 720, 1440, - }; + readonly long[] clusters = {360, 1200, 720, 1440,}; - readonly int[] clustersize = { - 1024, 1024, 1024, 1024, - }; + readonly int[] clustersize = {1024, 1024, 1024, 1024,}; - readonly string[] types = { - "Minix 3 v2", "Minix 3 v2", "Minix 3 v2", "Minix 3 v2", - }; + readonly string[] types = {"Minix 3 v2", "Minix 3 v2", "Minix 3 v2", "Minix 3 v2",}; [Test] public void Test() @@ -94,4 +85,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs index 3d400958..664c630f 100644 --- a/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs @@ -40,29 +40,17 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class MINIXv2_MBR { - readonly string[] testfiles = { - "minix_3.1.2a.vdi.lz", - }; + readonly string[] testfiles = {"minix_3.1.2a.vdi.lz",}; - readonly ulong[] sectors = { - 1024000, - }; + readonly ulong[] sectors = {1024000,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 511055, - }; + readonly long[] clusters = {511055,}; - readonly int[] clustersize = { - 1024, - }; + readonly int[] clustersize = {1024,}; - readonly string[] types = { - "Minix 3 v2", - }; + readonly string[] types = {"Minix 3 v2",}; [Test] public void Test() @@ -87,6 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -96,4 +85,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/MINIXv3.cs b/DiscImageChef.Tests/Filesystems/MINIXv3.cs index 22d5ce19..b28c24b4 100644 --- a/DiscImageChef.Tests/Filesystems/MINIXv3.cs +++ b/DiscImageChef.Tests/Filesystems/MINIXv3.cs @@ -38,33 +38,24 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class MINIXv3 { - readonly string[] testfiles = { - "minix_3.1.2a_dsdd.img.lz","minix_3.1.2a_dshd.img.lz","minix_3.1.2a_mf2dd.img.lz","minix_3.1.2a_mf2hd.img.lz", + readonly string[] testfiles = + { + "minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz", + "minix_3.1.2a_mf2hd.img.lz", }; - readonly MediaType[] mediatypes = { - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, - }; + readonly MediaType[] mediatypes = + {MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD,}; - readonly ulong[] sectors = { - 720, 2400, 1440, 2880, - }; + readonly ulong[] sectors = {720, 2400, 1440, 2880,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512 - }; + readonly uint[] sectorsize = {512, 512, 512, 512}; - readonly long[] clusters = { - 90, 300, 180, 360, - }; + readonly long[] clusters = {90, 300, 180, 360,}; - readonly int[] clustersize = { - 4096, 4096, 4096, 4096, - }; + readonly int[] clustersize = {4096, 4096, 4096, 4096,}; - readonly string[] types = { - "Minix v3", "Minix v3", "Minix v3", "Minix v3", - }; + readonly string[] types = {"Minix v3", "Minix v3", "Minix v3", "Minix v3",}; [Test] public void Test() @@ -94,4 +85,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs index 1a9bcdb1..3c55da12 100644 --- a/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs @@ -40,29 +40,17 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class MINIXv3_MBR { - readonly string[] testfiles = { - "minix_3.1.2a.vdi.lz", - }; + readonly string[] testfiles = {"minix_3.1.2a.vdi.lz",}; - readonly ulong[] sectors = { - 4194304, - }; + readonly ulong[] sectors = {4194304,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 523151, - }; + readonly long[] clusters = {523151,}; - readonly int[] clustersize = { - 4096, - }; + readonly int[] clustersize = {4096,}; - readonly string[] types = { - "Minix v3", - }; + readonly string[] types = {"Minix v3",}; [Test] public void Test() @@ -87,6 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -96,4 +85,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/NILFS2.cs b/DiscImageChef.Tests/Filesystems/NILFS2.cs index d1052f03..91c5aa8e 100644 --- a/DiscImageChef.Tests/Filesystems/NILFS2.cs +++ b/DiscImageChef.Tests/Filesystems/NILFS2.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class NILFS2 { - readonly string[] testfiles = { - "linux.vdi.lz", - }; + readonly string[] testfiles = {"linux.vdi.lz",}; - readonly ulong[] sectors = { - 262144, - }; + readonly ulong[] sectors = {262144,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 32512, - }; + readonly long[] clusters = {32512,}; - readonly int[] clustersize = { - 4096, - }; + readonly int[] clustersize = {4096,}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - "6b1ca79e-7048-a748-93a0-89c74b02cb5a", - }; + readonly string[] volumeserial = {"6b1ca79e-7048-a748-93a0-89c74b02cb5a",}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs b/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs index 5a157347..a0bf818a 100644 --- a/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs @@ -40,39 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class NTFS_GPT { - readonly string[] testfiles = { - "haiku_hrev51259.vdi.lz", + readonly string[] testfiles = {"haiku_hrev51259.vdi.lz",}; - }; + readonly ulong[] sectors = {2097152,}; - readonly ulong[] sectors = { - 2097152, - }; + readonly uint[] sectorsize = {512,}; - readonly uint[] sectorsize = { - 512, - }; + readonly long[] clusters = {261887,}; - readonly long[] clusters = { - 261887, - }; + readonly int[] clustersize = {4096,}; - readonly int[] clustersize = { - 4096, - }; + readonly string[] volumename = {null, null, null, null, null, null, null, null,}; - readonly string[] volumename = { - null, null, null, null, - null, null, null, null, - }; + readonly string[] volumeserial = {"106DA7693F7F6B3F",}; - readonly string[] volumeserial = { - "106DA7693F7F6B3F", - }; - - readonly string[] oemid = { - null, - }; + readonly string[] oemid = {null,}; [Test] public void Test() @@ -97,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -109,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs b/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs index 2bbe4570..33387b0b 100644 --- a/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs @@ -40,53 +40,29 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class NTFS_MBR { - readonly string[] testfiles = { - "win10.vdi.lz", "win2000.vdi.lz", "winnt_3.10.vdi.lz", "winnt_3.50.vdi.lz", - "winnt_3.51.vdi.lz", "winnt_4.00.vdi.lz", "winvista.vdi.lz", "linux.vdi.lz", - "haiku_hrev51259.vdi.lz", + readonly string[] testfiles = + { + "win10.vdi.lz", "win2000.vdi.lz", "winnt_3.10.vdi.lz", "winnt_3.50.vdi.lz", "winnt_3.51.vdi.lz", + "winnt_4.00.vdi.lz", "winvista.vdi.lz", "linux.vdi.lz", "haiku_hrev51259.vdi.lz", }; - readonly ulong[] sectors = { - 524288, 2097152, 1024000, 524288, - 524288, 524288, 524288, 262144, - 2097152, + readonly ulong[] sectors = {524288, 2097152, 1024000, 524288, 524288, 524288, 524288, 262144, 2097152,}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512,}; + + readonly long[] clusters = {65263, 1046511, 1023057, 524256, 524256, 524096, 64767, 32511, 261887,}; + + readonly int[] clustersize = {4096, 1024, 512, 512, 512, 512, 4096, 4096, 4096,}; + + readonly string[] volumename = {null, null, null, null, null, null, null, null, null,}; + + readonly string[] volumeserial = + { + "C46C1B3C6C1B28A6", "8070C8EC70C8E9CC", "10CC6AC6CC6AA5A6", "7A14F50014F4BFE5", "24884447884419A6", + "822C288D2C287E73", "E20AF54B0AF51D6B", "065BB96B7C1BCFDA", "46EC796749C6FA66", }; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, - }; - - readonly long[] clusters = { - 65263, 1046511, 1023057, 524256, - 524256, 524096, 64767, 32511, - 261887, - }; - - readonly int[] clustersize = { - 4096, 1024, 512, 512, - 512, 512, 4096, 4096, - 4096, - }; - - readonly string[] volumename = { - null, null, null, null, - null, null, null, null, - null, - }; - - readonly string[] volumeserial = { - "C46C1B3C6C1B28A6","8070C8EC70C8E9CC","10CC6AC6CC6AA5A6","7A14F50014F4BFE5", - "24884447884419A6","822C288D2C287E73","E20AF54B0AF51D6B","065BB96B7C1BCFDA", - "46EC796749C6FA66", - }; - - readonly string[] oemid = { - null, null, null, null, - null, null, null, null, - null, - }; + readonly string[] oemid = {null, null, null, null, null, null, null, null, null,}; [Test] public void Test() @@ -113,6 +89,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -125,4 +102,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/NWFS386.cs b/DiscImageChef.Tests/Filesystems/NWFS386.cs index 46739e04..d867b8bd 100644 --- a/DiscImageChef.Tests/Filesystems/NWFS386.cs +++ b/DiscImageChef.Tests/Filesystems/NWFS386.cs @@ -34,33 +34,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class NWFS386 { - readonly string[] testfiles = { - "netware_3.12.vdi.lz", - }; + readonly string[] testfiles = {"netware_3.12.vdi.lz",}; - readonly ulong[] sectors = { - 104857600, - }; + readonly ulong[] sectors = {104857600,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 104856192, - }; + readonly long[] clusters = {104856192,}; - readonly int[] clustersize = { - 512, - }; + readonly int[] clustersize = {512,}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - "UNKNOWN", - }; + readonly string[] volumeserial = {"UNKNOWN",}; [Test] public void Test() @@ -98,4 +84,4 @@ namespace DiscImageChef.Tests.Filesystems }*/ } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/OCFS2.cs b/DiscImageChef.Tests/Filesystems/OCFS2.cs index 656ff00a..ca8c978a 100644 --- a/DiscImageChef.Tests/Filesystems/OCFS2.cs +++ b/DiscImageChef.Tests/Filesystems/OCFS2.cs @@ -34,33 +34,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class OCFS2 { - readonly string[] testfiles = { - "linux.vdi.lz", - }; + readonly string[] testfiles = {"linux.vdi.lz",}; - readonly ulong[] sectors = { - 104857600, - }; + readonly ulong[] sectors = {104857600,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 104856192, - }; + readonly long[] clusters = {104856192,}; - readonly int[] clustersize = { - 512, - }; + readonly int[] clustersize = {512,}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - "UNKNOWN", - }; + readonly string[] volumeserial = {"UNKNOWN",}; [Test] public void Test() @@ -98,4 +84,4 @@ namespace DiscImageChef.Tests.Filesystems }*/ } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs b/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs index 48d3905e..42d58d8a 100644 --- a/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class PFS3_RDB { - readonly string[] testfiles = { - "uae.vdi.lz", - }; + readonly string[] testfiles = {"uae.vdi.lz",}; - readonly ulong[] sectors = { - 1024128, - }; + readonly ulong[] sectors = {1024128,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 1023552, - }; + readonly long[] clusters = {1023552,}; - readonly int[] clustersize = { - 512, - }; + readonly int[] clustersize = {512,}; - readonly string[] volumename = { - "PFS", - }; + readonly string[] volumename = {"PFS",}; - readonly string[] volumeserial = { - null, - }; + readonly string[] volumeserial = {null,}; - readonly string[] oemid = { - null, - }; + readonly string[] oemid = {null,}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -107,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs b/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs index fbf07453..169a381d 100644 --- a/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs @@ -40,40 +40,27 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class ProDOS_APM { - readonly string[] testfiles = { - "macos_7.5.3.vdi.lz","macos_7.6.vdi.lz","macos_8.0.vdi.lz","macos_8.1.vdi.lz", - "macos_9.0.4.vdi.lz","macos_9.1.vdi.lz","macos_9.2.1.vdi.lz","macos_9.2.2.vdi.lz", + readonly string[] testfiles = + { + "macos_7.5.3.vdi.lz", "macos_7.6.vdi.lz", "macos_8.0.vdi.lz", "macos_8.1.vdi.lz", "macos_9.0.4.vdi.lz", + "macos_9.1.vdi.lz", "macos_9.2.1.vdi.lz", "macos_9.2.2.vdi.lz", }; - readonly ulong[] sectors = { - 49152,49152,49152,49152, - 49152,49152,49152,49152, + readonly ulong[] sectors = {49152, 49152, 49152, 49152, 49152, 49152, 49152, 49152,}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512,}; + + readonly long[] clusters = {48438, 48438, 48438, 48438, 46326, 46326, 46326, 46326,}; + + readonly int[] clustersize = {512, 512, 512, 512, 512, 512, 512, 512,}; + + readonly string[] volumename = + { + "VOLUME.LABEL", "VOLUME.LABEL", "VOLUME.LABEL", "VOLUME.LABEL", "VOLUME.LABEL", "VOLUME.LABEL", + "VOLUME.LABEL", "VOLUME.LABEL", }; - readonly uint[] sectorsize = { - 512,512,512,512, - 512,512,512,512, - }; - - readonly long[] clusters = { - 48438,48438,48438,48438, - 46326,46326,46326,46326, - }; - - readonly int[] clustersize = { - 512,512,512,512, - 512,512,512,512, - }; - - readonly string[] volumename = { - "VOLUME.LABEL","VOLUME.LABEL","VOLUME.LABEL","VOLUME.LABEL", - "VOLUME.LABEL","VOLUME.LABEL","VOLUME.LABEL","VOLUME.LABEL", - }; - - readonly string[] volumeserial = { - null,null,null,null, - null,null,null,null, - }; + readonly string[] volumeserial = {null, null, null, null, null, null, null, null,}; [Test] public void Test() @@ -98,6 +85,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -109,4 +97,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/QNX4.cs b/DiscImageChef.Tests/Filesystems/QNX4.cs index aac4ac64..5d329beb 100644 --- a/DiscImageChef.Tests/Filesystems/QNX4.cs +++ b/DiscImageChef.Tests/Filesystems/QNX4.cs @@ -38,29 +38,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class QNX4 { - readonly string[] testfiles = { - "qnx_4.24_dsdd.img.lz","qnx_4.24_dshd.img.lz","qnx_4.24_mf2dd.img.lz","qnx_4.24_mf2hd.img.lz", - }; + readonly string[] testfiles = + {"qnx_4.24_dsdd.img.lz", "qnx_4.24_dshd.img.lz", "qnx_4.24_mf2dd.img.lz", "qnx_4.24_mf2hd.img.lz",}; - readonly MediaType[] mediatypes = { - MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, - }; + readonly MediaType[] mediatypes = + {MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD,}; - readonly ulong[] sectors = { - 720, 2400, 1440, 2880, - }; + readonly ulong[] sectors = {720, 2400, 1440, 2880,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512,}; - readonly long[] clusters = { - 720, 2400, 1440, 2880, - }; + readonly long[] clusters = {720, 2400, 1440, 2880,}; - readonly int[] clustersize = { - 512, 512, 512, 512, - }; + readonly int[] clustersize = {512, 512, 512, 512,}; [Test] public void Test() @@ -90,4 +80,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs b/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs index 2b175235..7a36b0a3 100644 --- a/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs @@ -40,25 +40,15 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class QNX4_MBR { - readonly string[] testfiles = { - "qnx_4.24.vdi.lz", - }; + readonly string[] testfiles = {"qnx_4.24.vdi.lz",}; - readonly ulong[] sectors = { - 1024000, - }; + readonly ulong[] sectors = {1024000,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 1023104, - }; + readonly long[] clusters = {1023104,}; - readonly int[] clustersize = { - 512, - }; + readonly int[] clustersize = {512,}; [Test] public void Test() @@ -83,6 +73,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -92,4 +83,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/ReFS_MBR.cs b/DiscImageChef.Tests/Filesystems/ReFS_MBR.cs index c93595d6..99aa4d7b 100644 --- a/DiscImageChef.Tests/Filesystems/ReFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/ReFS_MBR.cs @@ -40,38 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class ReFS_MBR { - readonly string[] testfiles = { - "win10.vdi.lz", + readonly string[] testfiles = {"win10.vdi.lz",}; - }; + readonly ulong[] sectors = {67108864,}; - readonly ulong[] sectors = { - 67108864, - }; + readonly uint[] sectorsize = {512,}; - readonly uint[] sectorsize = { - 512, - }; + readonly long[] clusters = {8388096,}; - readonly long[] clusters = { - 8388096, - }; + readonly int[] clustersize = {4096,}; - readonly int[] clustersize = { - 4096, - }; + readonly string[] volumename = {null,}; - readonly string[] volumename = { - null, - }; + readonly string[] volumeserial = {"UNKNOWN",}; - readonly string[] volumeserial = { - "UNKNOWN", - }; - - readonly string[] oemid = { - null, - }; + readonly string[] oemid = {null,}; [Test] public void Test() @@ -95,6 +78,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); throw new NotImplementedException("ReFS is not yet implemented"); /* @@ -110,4 +94,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/Reiser3.cs b/DiscImageChef.Tests/Filesystems/Reiser3.cs index 5dd5990a..8057a123 100644 --- a/DiscImageChef.Tests/Filesystems/Reiser3.cs +++ b/DiscImageChef.Tests/Filesystems/Reiser3.cs @@ -40,29 +40,17 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class Reiser3 { - readonly string[] testfiles = { - "linux_r3.5.vdi.lz", "linux_r3.6.vdi.lz" - }; + readonly string[] testfiles = {"linux_r3.5.vdi.lz", "linux_r3.6.vdi.lz"}; - readonly ulong[] sectors = { - 262144, 262144, - }; + readonly ulong[] sectors = {262144, 262144,}; - readonly uint[] sectorsize = { - 512, 512, - }; + readonly uint[] sectorsize = {512, 512,}; - readonly long[] clusters = { - 32512, 32512, - }; + readonly long[] clusters = {32512, 32512,}; - readonly int[] clustersize = { - 4096, 4096, - }; + readonly int[] clustersize = {4096, 4096,}; - readonly string[] reiserversion = { - "Reiser 3.5 filesystem", "Reiser 3.6 filesystem" - }; + readonly string[] reiserversion = {"Reiser 3.5 filesystem", "Reiser 3.6 filesystem"}; [Test] public void Test() @@ -87,6 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -96,4 +85,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/Reiser4.cs b/DiscImageChef.Tests/Filesystems/Reiser4.cs index ee519264..508820f5 100644 --- a/DiscImageChef.Tests/Filesystems/Reiser4.cs +++ b/DiscImageChef.Tests/Filesystems/Reiser4.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class Reiser4 { - readonly string[] testfiles = { - "linux.vdi.lz", - }; + readonly string[] testfiles = {"linux.vdi.lz",}; - readonly ulong[] sectors = { - 262144, - }; + readonly ulong[] sectors = {262144,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 32511, - }; + readonly long[] clusters = {32511,}; - readonly int[] clustersize = { - 4096, - }; + readonly int[] clustersize = {4096,}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - "b0c1924e-6f10-8c42-b6c5-66a457896460", - }; + readonly string[] volumeserial = {"b0c1924e-6f10-8c42-b6c5-66a457896460",}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/SFS_MBR.cs b/DiscImageChef.Tests/Filesystems/SFS_MBR.cs index d1d088ae..4457b954 100644 --- a/DiscImageChef.Tests/Filesystems/SFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/SFS_MBR.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class SFS_MBR { - readonly string[] testfiles = { - "aros.vdi.lz", - }; + readonly string[] testfiles = {"aros.vdi.lz",}; - readonly ulong[] sectors = { - 409600, - }; + readonly ulong[] sectors = {409600,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 408240, - }; + readonly long[] clusters = {408240,}; - readonly int[] clustersize = { - 512, - }; + readonly int[] clustersize = {512,}; - readonly string[] volumename = { - null, - }; + readonly string[] volumename = {null,}; - readonly string[] volumeserial = { - null, - }; + readonly string[] volumeserial = {null,}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs b/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs index b0d4a2a5..51a37df5 100644 --- a/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class SFS_MBR_RDB { - readonly string[] testfiles = { - "aros.vdi.lz", - }; + readonly string[] testfiles = {"aros.vdi.lz",}; - readonly ulong[] sectors = { - 409600, - }; + readonly ulong[] sectors = {409600,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 406224, - }; + readonly long[] clusters = {406224,}; - readonly int[] clustersize = { - 512, - }; + readonly int[] clustersize = {512,}; - readonly string[] volumename = { - null, - }; + readonly string[] volumename = {null,}; - readonly string[] volumeserial = { - null, - }; + readonly string[] volumeserial = {null,}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/SFS_RDB.cs b/DiscImageChef.Tests/Filesystems/SFS_RDB.cs index 4d7ce1c3..672c028e 100644 --- a/DiscImageChef.Tests/Filesystems/SFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/SFS_RDB.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class SFS_RDB { - readonly string[] testfiles = { - "uae.vdi.lz","aros.vdi.lz","amigaos_4.0.vdi.lz","amigaos_4.0_sfs2.vdi.lz" - }; + readonly string[] testfiles = {"uae.vdi.lz", "aros.vdi.lz", "amigaos_4.0.vdi.lz", "amigaos_4.0_sfs2.vdi.lz"}; - readonly ulong[] sectors = { - 1024128,409600,1024128,1024128, - }; + readonly ulong[] sectors = {1024128, 409600, 1024128, 1024128,}; - readonly uint[] sectorsize = { - 512,512,512,512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512,}; - readonly long[] clusters = { - 127000,407232,511040,511040, - }; + readonly long[] clusters = {127000, 407232, 511040, 511040,}; - readonly int[] clustersize = { - 2048,512,1024,1024, - }; + readonly int[] clustersize = {2048, 512, 1024, 1024,}; - readonly string[] volumename = { - null,null,null,null, - }; + readonly string[] volumename = {null, null, null, null,}; - readonly string[] volumeserial = { - null,null,null,null, - }; + readonly string[] volumeserial = {null, null, null, null,}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/SysV.cs b/DiscImageChef.Tests/Filesystems/SysV.cs index 385d1c7f..431786c0 100644 --- a/DiscImageChef.Tests/Filesystems/SysV.cs +++ b/DiscImageChef.Tests/Filesystems/SysV.cs @@ -38,68 +38,34 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class SysV { - readonly string[] testfiles = { - "amix.adf.lz", - "att_unix_svr4v2.1_dsdd.img.lz", "att_unix_svr4v2.1_mf2dd.img.lz", "att_unix_svr4v2.1_mf2hd.img.lz", - "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", + readonly string[] testfiles = + { + "amix.adf.lz", "att_unix_svr4v2.1_dsdd.img.lz", "att_unix_svr4v2.1_mf2dd.img.lz", + "att_unix_svr4v2.1_mf2hd.img.lz", "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", + "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", "scoopenserver_5.0.7hw_mf2hd.img.lz", }; - readonly MediaType[] mediatypes = { - MediaType.CBM_AMIGA_35_DD, - MediaType.DOS_525_DS_DD_9,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, - MediaType.DMF,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_ED, - MediaType.DOS_35_HD, + readonly MediaType[] mediatypes = + { + MediaType.CBM_AMIGA_35_DD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, + MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, }; - readonly ulong[] sectors = { - 1760, - 720, 1440, 2880, - 3360, 2400, 1440, 5760, - 2880, - }; + readonly ulong[] sectors = {1760, 720, 1440, 2880, 3360, 2400, 1440, 5760, 2880,}; - readonly uint[] sectorsize = { - 512, - 512, 512, 512, - 512, 512, 512, 512, - 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 880, - 360, 720, 1440, - 1680, 1200, 720, 2880, - 1440, - }; + readonly long[] clusters = {880, 360, 720, 1440, 1680, 1200, 720, 2880, 1440,}; - readonly int[] clustersize = { - 1024, - 1024, 1024, 1024, - 1024, 1024, 1024, 1024, - 1024, - }; + readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,}; - readonly string[] volumename = { - "", - "", "", "", - "", "", "", "", - "", - }; + readonly string[] volumename = {"", "", "", "", "", "", "", "", "",}; - readonly string[] volumeserial = { - null, - null, null, null, - null, null, null, null, - null, - }; + readonly string[] volumeserial = {null, null, null, null, null, null, null, null, null,}; - readonly string[] type = { - "SVR4 fs", - "SVR4 fs", "SVR4 fs", "SVR4 fs", - "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", - "SVR4 fs", - }; + readonly string[] type = + {"SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs",}; [Test] public void Test() @@ -131,4 +97,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/SysV_MBR.cs b/DiscImageChef.Tests/Filesystems/SysV_MBR.cs index 97f4104b..f49a5c09 100644 --- a/DiscImageChef.Tests/Filesystems/SysV_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/SysV_MBR.cs @@ -40,37 +40,22 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class SysV_MBR { - readonly string[] testfiles = { - "att_unix_svr4v2.1.vdi.lz", "att_unix_svr4v2.1_2k.vdi.lz", "scoopenserver_5.0.7hw.vdi.lz" - }; + readonly string[] testfiles = + {"att_unix_svr4v2.1.vdi.lz", "att_unix_svr4v2.1_2k.vdi.lz", "scoopenserver_5.0.7hw.vdi.lz"}; - readonly ulong[] sectors = { - 1024000, 1024000, 2097152, - }; + readonly ulong[] sectors = {1024000, 1024000, 2097152,}; - readonly uint[] sectorsize = { - 512, 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512,}; - readonly long[] clusters = { - 511056, 255528, 1020096, - }; + readonly long[] clusters = {511056, 255528, 1020096,}; - readonly int[] clustersize = { - 1024, 2048, 1024, - }; + readonly int[] clustersize = {1024, 2048, 1024,}; - readonly string[] volumename = { - "/usr3", "/usr3", "Volume label", - }; + readonly string[] volumename = {"/usr3", "/usr3", "Volume label",}; - readonly string[] volumeserial = { - null, null, null, - }; + readonly string[] volumeserial = {null, null, null,}; - readonly string[] type = { - "SVR4 fs", "SVR4 fs", "SVR4 fs", - }; + readonly string[] type = {"SVR4 fs", "SVR4 fs", "SVR4 fs",}; [Test] public void Test() @@ -95,6 +80,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -106,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/SysV_RDB.cs b/DiscImageChef.Tests/Filesystems/SysV_RDB.cs index 2c6fbe91..e2025190 100644 --- a/DiscImageChef.Tests/Filesystems/SysV_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/SysV_RDB.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class SysV_RDB { - readonly string[] testfiles = { - "amix.vdi.lz", - }; + readonly string[] testfiles = {"amix.vdi.lz",}; - readonly ulong[] sectors = { - 1024128, - }; + readonly ulong[] sectors = {1024128,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 511424, - }; + readonly long[] clusters = {511424,}; - readonly int[] clustersize = { - 1024, - }; + readonly int[] clustersize = {1024,}; - readonly string[] volumename = { - "", - }; + readonly string[] volumename = {"",}; - readonly string[] volumeserial = { - null, - }; + readonly string[] volumeserial = {null,}; - readonly string[] type = { - "SVR4 fs", - }; + readonly string[] type = {"SVR4 fs",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -106,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/UDF.cs b/DiscImageChef.Tests/Filesystems/UDF.cs index 6875e448..6887d0d7 100644 --- a/DiscImageChef.Tests/Filesystems/UDF.cs +++ b/DiscImageChef.Tests/Filesystems/UDF.cs @@ -39,67 +39,59 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class UDF { - readonly string[] testfiles = { + readonly string[] testfiles = + { "1.02/linux.vdi.lz", "1.02/macosx_10.11.vdi.lz", "1.50/linux.vdi.lz", "1.50/macosx_10.11.vdi.lz", "2.00/linux.vdi.lz", "2.00/macosx_10.11.vdi.lz", "2.01/linux.vdi.lz", "2.01/macosx_10.11.vdi.lz", "2.50/linux.vdi.lz", "2.50/macosx_10.11.vdi.lz", "2.60/macosx_10.11.vdi.lz", "1.50/solaris_7.vdi.lz", "1.50/solaris_9.vdi.lz", "2.01/netbsd_7.1.vdi.lz", }; - readonly ulong[] sectors = { - 1024000, 204800, 1024000, 409600, - 1024000, 614400, 1024000, 819200, - 1024000, 1024000, 1228800, 8388608, + readonly ulong[] sectors = + { + 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, 8388608, 8388608, }; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 1024000, 204800, 1024000, 409600, - 1024000, 614400, 1024000, 819200, - 1024000, 1024000, 1228800, 8388608, + readonly long[] clusters = + { + 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, 8388608, 8388608, }; - readonly int[] clustersize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512,512, - 512, 512, + readonly int[] clustersize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,}; + + readonly string[] udfversion = + { + "UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50", "UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01", + "UDF v2.50", "UDF v2.50", "UDF v2.60", "UDF v1.50", "UDF v1.50", "UDF v2.01", }; - readonly string[] udfversion = { - "UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50", - "UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01", - "UDF v2.50", "UDF v2.50", "UDF v2.60", "UDF v1.50", - "UDF v1.50", "UDF v2.01", + readonly string[] volumename = + { + "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", + "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "*NoLabel*", "*NoLabel*", + "anonymous", }; - readonly string[] volumename = { - "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label", "Volume label", "Volume label", "*NoLabel*", - "*NoLabel*", "anonymous", - }; - - readonly string[] volumeserial = { - "595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF", "4DD0458B (Mac OS X newfs_udf) UDF Volume Set", - "595c5d07f4fc8e8dLinuxUDF", "5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF", "48847EB3 (Mac OS X newfs_udf) UDF Volume Set", - "595c5d0e4f338552LinuxUDF", "709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set","595EB2A9", + readonly string[] volumeserial = + { + "595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF", + "4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595c5d07f4fc8e8dLinuxUDF", + "5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF", + "48847EB3 (Mac OS X newfs_udf) UDF Volume Set", "595c5d0e4f338552LinuxUDF", + "709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set", "595EB2A9", "595EB55A", "7cc94d726669d773", }; - readonly string[] oemid = { - "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", - "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", - "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS","*SUN SOLARIS UDF", - "*SUN SOLARIS UDF", "*NetBSD userland UDF", + readonly string[] oemid = + { + "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", + "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", + "*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS", "*SUN SOLARIS UDF", "*SUN SOLARIS UDF", + "*NetBSD userland UDF", }; [Test] @@ -132,4 +124,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/UFS.cs b/DiscImageChef.Tests/Filesystems/UFS.cs index 0c68da04..d604b5dd 100644 --- a/DiscImageChef.Tests/Filesystems/UFS.cs +++ b/DiscImageChef.Tests/Filesystems/UFS.cs @@ -38,50 +38,32 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class UFS { - readonly string[] testfiles = { - "amix_mf2dd.adf.lz","netbsd_1.6_mf2hd.img.lz","att_unix_svr4v2.1_dsdd.img.lz","att_unix_svr4v2.1_dshd.img.lz", - "att_unix_svr4v2.1_mf2dd.img.lz","att_unix_svr4v2.1_mf2hd.img.lz","solaris_2.4_mf2dd.img.lz","solaris_2.4_mf2hd.img.lz", + readonly string[] testfiles = + { + "amix_mf2dd.adf.lz", "netbsd_1.6_mf2hd.img.lz", "att_unix_svr4v2.1_dsdd.img.lz", + "att_unix_svr4v2.1_dshd.img.lz", "att_unix_svr4v2.1_mf2dd.img.lz", "att_unix_svr4v2.1_mf2hd.img.lz", + "solaris_2.4_mf2dd.img.lz", "solaris_2.4_mf2hd.img.lz", }; - readonly MediaType[] mediatypes = { + readonly MediaType[] mediatypes = + { MediaType.CBM_AMIGA_35_DD, MediaType.DOS_35_HD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, }; - readonly ulong[] sectors = { - 1760, 2880, 720, 2400, - 1440, 2880, 1440, 2880, - }; + readonly ulong[] sectors = {1760, 2880, 720, 2400, 1440, 2880, 1440, 2880,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 880, 2880, 360, 1200, - 720, 1440, 711, 1422, - }; + readonly long[] clusters = {880, 2880, 360, 1200, 720, 1440, 711, 1422,}; - readonly int[] clustersize = { - 1024, 512, 1024, 1024, - 1024, 1024, 1024, 1024, - }; + readonly int[] clustersize = {1024, 512, 1024, 1024, 1024, 1024, 1024, 1024,}; - readonly string[] volumename = { - null, null, null, null, - null, null, null, null, - }; + readonly string[] volumename = {null, null, null, null, null, null, null, null,}; - readonly string[] volumeserial = { - null, null, null, null, - null, null, null, null, - }; + readonly string[] volumeserial = {null, null, null, null, null, null, null, null,}; - readonly string[] type = { - "UFS", "UFS", "UFS", "UFS", - "UFS", "UFS", "UFS", "UFS", - }; + readonly string[] type = {"UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS",}; [Test] public void Test() @@ -113,4 +95,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/UFS_APM.cs b/DiscImageChef.Tests/Filesystems/UFS_APM.cs index 35a77856..04a597ed 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_APM.cs @@ -40,53 +40,29 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class UFS_APM { - readonly string[] testfiles = { - "ffs43/darwin_1.3.1.vdi.lz","ffs43/darwin_1.4.1.vdi.lz","ffs43/darwin_6.0.2.vdi.lz","ffs43/darwin_8.0.1.vdi.lz", - "ufs1/darwin_1.3.1.vdi.lz","ufs1/darwin_1.4.1.vdi.lz","ufs1/darwin_6.0.2.vdi.lz","ufs1/darwin_8.0.1.vdi.lz", - "ufs1/macosx_10.2.vdi.lz","ufs1/macosx_10.3.vdi.lz","ufs1/macosx_10.4.vdi.lz", + readonly string[] testfiles = + { + "ffs43/darwin_1.3.1.vdi.lz", "ffs43/darwin_1.4.1.vdi.lz", "ffs43/darwin_6.0.2.vdi.lz", + "ffs43/darwin_8.0.1.vdi.lz", "ufs1/darwin_1.3.1.vdi.lz", "ufs1/darwin_1.4.1.vdi.lz", + "ufs1/darwin_6.0.2.vdi.lz", "ufs1/darwin_8.0.1.vdi.lz", "ufs1/macosx_10.2.vdi.lz", + "ufs1/macosx_10.3.vdi.lz", "ufs1/macosx_10.4.vdi.lz", }; - readonly ulong[] sectors = { - 1024000, 1024000, 1024000, 1024000, - 204800, 204800, 204800, 204800, - 2097152, 2097152, 2097152, - }; + readonly ulong[] sectors = + {1024000, 1024000, 1024000, 1024000, 204800, 204800, 204800, 204800, 2097152, 2097152, 2097152,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 511488, 511488, 511488, 511488, - 102368, 102368, 102368, 102368, - 1047660, 1038952, 1038952, - }; + readonly long[] clusters = + {511488, 511488, 511488, 511488, 102368, 102368, 102368, 102368, 1047660, 1038952, 1038952,}; - readonly int[] clustersize = { - 1024, 1024, 1024, 1024, - 1024, 1024, 1024, 1024, - 1024, 1024, 1024, - }; + readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,}; - readonly string[] volumename = { - null, null, null, null, - null, null, null, null, - null, null, null, - }; + readonly string[] volumename = {null, null, null, null, null, null, null, null, null, null, null,}; - readonly string[] volumeserial = { - null, null, null, null, - null, null, null, null, - null, null, null, - }; + readonly string[] volumeserial = {null, null, null, null, null, null, null, null, null, null, null,}; - readonly string[] type = { - "UFS", "UFS", "UFS", "UFS", - "UFS", "UFS", "UFS", "UFS", - "UFS", "UFS", "UFS", - }; + readonly string[] type = {"UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS",}; [Test] public void Test() @@ -111,6 +87,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -122,4 +99,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/UFS_MBR.cs b/DiscImageChef.Tests/Filesystems/UFS_MBR.cs index 518efe11..24bcaab6 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_MBR.cs @@ -40,92 +40,61 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class UFS_MBR { - readonly string[] testfiles = { + readonly string[] testfiles = + { "ufs1/linux.vdi.lz", "ufs2/linux.vdi.lz", "ffs43/darwin_1.3.1.vdi.lz", "ffs43/darwin_1.4.1.vdi.lz", - "ffs43/darwin_6.0.2.vdi.lz", "ffs43/darwin_8.0.1.vdi.lz", "ffs43/dflybsd_1.2.0.vdi.lz", "ffs43/dflybsd_3.6.1.vdi.lz", - "ffs43/dflybsd_4.0.5.vdi.lz", "ffs43/netbsd_1.6.vdi.lz", "ffs43/netbsd_7.1.vdi.lz", "ufs1/darwin_1.3.1.vdi.lz", - "ufs1/darwin_1.4.1.vdi.lz", "ufs1/darwin_6.0.2.vdi.lz", "ufs1/darwin_8.0.1.vdi.lz", "ufs1/dflybsd_1.2.0.vdi.lz", - "ufs1/dflybsd_3.6.1.vdi.lz", "ufs1/dflybsd_4.0.5.vdi.lz", "ufs1/freebsd_6.1.vdi.lz", "ufs1/freebsd_7.0.vdi.lz", - "ufs1/freebsd_8.2.vdi.lz", "ufs1/netbsd_1.6.vdi.lz", "ufs1/netbsd_7.1.vdi.lz", "ufs1/solaris_7.vdi.lz", - "ufs1/solaris_9.vdi.lz", "ufs2/freebsd_6.1.vdi.lz", "ufs2/freebsd_7.0.vdi.lz", "ufs2/freebsd_8.2.vdi.lz", - "ufs2/netbsd_7.1.vdi.lz", + "ffs43/darwin_6.0.2.vdi.lz", "ffs43/darwin_8.0.1.vdi.lz", "ffs43/dflybsd_1.2.0.vdi.lz", + "ffs43/dflybsd_3.6.1.vdi.lz", "ffs43/dflybsd_4.0.5.vdi.lz", "ffs43/netbsd_1.6.vdi.lz", + "ffs43/netbsd_7.1.vdi.lz", "ufs1/darwin_1.3.1.vdi.lz", "ufs1/darwin_1.4.1.vdi.lz", + "ufs1/darwin_6.0.2.vdi.lz", "ufs1/darwin_8.0.1.vdi.lz", "ufs1/dflybsd_1.2.0.vdi.lz", + "ufs1/dflybsd_3.6.1.vdi.lz", "ufs1/dflybsd_4.0.5.vdi.lz", "ufs1/freebsd_6.1.vdi.lz", + "ufs1/freebsd_7.0.vdi.lz", "ufs1/freebsd_8.2.vdi.lz", "ufs1/netbsd_1.6.vdi.lz", "ufs1/netbsd_7.1.vdi.lz", + "ufs1/solaris_7.vdi.lz", "ufs1/solaris_9.vdi.lz", "ufs2/freebsd_6.1.vdi.lz", "ufs2/freebsd_7.0.vdi.lz", + "ufs2/freebsd_8.2.vdi.lz", "ufs2/netbsd_7.1.vdi.lz", }; - readonly ulong[] sectors = { - 262144, 262144, 1024000, 1024000, - 1024000, 1024000, 1024000, 1024000, - 1024000, 1024000, 409600, 204800, - 204800, 204800, 204800, 2097152, - 2097152, 2097152, 2097152, 8388608, - 8388608, 2097152, 1024000, 2097152, - 2097152, 16777216, 16777216, 16777216, - 2097152, + readonly ulong[] sectors = + { + 262144, 262144, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 409600, 204800, + 204800, 204800, 204800, 2097152, 2097152, 2097152, 2097152, 8388608, 8388608, 2097152, 1024000, 2097152, + 2097152, 16777216, 16777216, 16777216, 2097152, }; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, + readonly uint[] sectorsize = + { + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 512, }; - readonly long[] clusters = { - 65024, 65024, 511024, 511024, - 511024, 511488, 511950, 255470, - 255470, 511992, 204768, 102280, - 102280, 102280, 102368, 1048500, - 523758, 523758, 262138, 1048231, - 2096462, 524284, 511968, 1038240, - 1046808, 2096472, 2096472, 4192945, - 524272, + readonly long[] clusters = + { + 65024, 65024, 511024, 511024, 511024, 511488, 511950, 255470, 255470, 511992, 204768, 102280, 102280, + 102280, 102368, 1048500, 523758, 523758, 262138, 1048231, 2096462, 524284, 511968, 1038240, 1046808, + 2096472, 2096472, 4192945, 524272, }; - readonly int[] clustersize = { - 2048, 2048, 1024, 1024, - 1024, 1024, 1024, 2048, - 2048, 1024, 1024, 1024, - 1024, 1024, 1024, 1024, - 2048, 2048, 4096, 4096, - 2048, 2048, 1024, 1024, - 1024, 4096, 4096, 2048, - 2048, + readonly int[] clustersize = + { + 2048, 2048, 1024, 1024, 1024, 1024, 1024, 2048, 2048, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 2048, 2048, + 4096, 4096, 2048, 2048, 1024, 1024, 1024, 4096, 4096, 2048, 2048, }; - readonly string[] volumename = { - null, "VolumeLabel", null, null, - null, null, null, null, - null, null, null, null, - null, null, null, null, - null, null, null, null, - null, null, null, null, - null, "VolumeLabel", "VolumeLabel", "VolumeLabel", - "", + readonly string[] volumename = + { + null, "VolumeLabel", null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, "VolumeLabel", "VolumeLabel", "VolumeLabel", "", }; - readonly string[] volumeserial = { - null, null, null, null, - null, null, null, null, - null, null, null, null, - null, null, null, null, - null, null, null, null, - null, null, null, null, - null, null, null, null, - null, + readonly string[] volumeserial = + { + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, }; - readonly string[] type = { - "UFS", "UFS2", "UFS", "UFS", - "UFS", "UFS", "UFS", "UFS", - "UFS", "UFS", "UFS", "UFS", - "UFS", "UFS", "UFS", "UFS", - "UFS", "UFS", "UFS", "UFS", - "UFS", "UFS", "UFS", "UFS", - "UFS", "UFS2", "UFS2", "UFS2", - "UFS2", + readonly string[] type = + { + "UFS", "UFS2", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", + "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS2", "UFS2", "UFS2", "UFS2", }; [Test] @@ -145,13 +114,15 @@ namespace DiscImageChef.Tests.Filesystems int part = -1; for(int j = 0; j < partitions.Count; j++) { - if(partitions[j].Type == "0x63" || partitions[j].Type == "0xA8" || partitions[j].Type == "0xA5" || partitions[j].Type == "0xA9" || - partitions[j].Type == "0x82" || partitions[j].Type == "0x83" || partitions[j].Type == "4.2BSD Fast File System" || partitions[j].Type == "Sun boot") + if(partitions[j].Type == "0x63" || partitions[j].Type == "0xA8" || partitions[j].Type == "0xA5" || + partitions[j].Type == "0xA9" || partitions[j].Type == "0x82" || partitions[j].Type == "0x83" || + partitions[j].Type == "4.2BSD Fast File System" || partitions[j].Type == "Sun boot") { part = j; break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -163,4 +134,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs b/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs index 90c801e6..1b838725 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs @@ -40,45 +40,25 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class UFS_NeXT { - readonly string[] testfiles = { - "nextstep_3.3.vdi.lz","openstep_4.0.vdi.lz","openstep_4.2.vdi.lz", - "rhapsody_dr1.vdi.lz","rhapsody_dr2.vdi.lz", + readonly string[] testfiles = + { + "nextstep_3.3.vdi.lz", "openstep_4.0.vdi.lz", "openstep_4.2.vdi.lz", "rhapsody_dr1.vdi.lz", + "rhapsody_dr2.vdi.lz", }; - readonly ulong[] sectors = { - 409600,409600,409600, - 409600,409600, - }; + readonly ulong[] sectors = {409600, 409600, 409600, 409600, 409600,}; - readonly uint[] sectorsize = { - 512, 512, 512, - 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 204640,204640,204640, - 204640,204464, - }; + readonly long[] clusters = {204640, 204640, 204640, 204640, 204464,}; - readonly int[] clustersize = { - 1024, 1024, 1024, - 1024, 1024, - }; + readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024,}; - readonly string[] volumename = { - null, null, null, - null, null, - }; + readonly string[] volumename = {null, null, null, null, null,}; - readonly string[] volumeserial = { - null, null, null, - null, null, - }; + readonly string[] volumeserial = {null, null, null, null, null,}; - readonly string[] type = { - "UFS", "UFS", "UFS", - "UFS", "UFS", - }; + readonly string[] type = {"UFS", "UFS", "UFS", "UFS", "UFS",}; [Test] public void Test() @@ -103,6 +83,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -114,4 +95,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs b/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs index 08017eff..623fc2b5 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs @@ -39,69 +39,27 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class UFS_NeXT_Floppy { - readonly string[] testfiles = { - "nextstep_3.3_mf2dd.img.lz","nextstep_3.3_mf2hd.img.lz", - "openstep_4.0_mf2dd.img.lz","openstep_4.0_mf2hd.img.lz", - "openstep_4.2_mf2dd.img.lz","openstep_4.2_mf2hd.img.lz", - "rhapsody_dr1_mf2dd.img.lz","rhapsody_dr1_mf2hd.img.lz", - "rhapsody_dr2_mf2dd.img.lz","rhapsody_dr2_mf2hd.img.lz", + readonly string[] testfiles = + { + "nextstep_3.3_mf2dd.img.lz", "nextstep_3.3_mf2hd.img.lz", "openstep_4.0_mf2dd.img.lz", + "openstep_4.0_mf2hd.img.lz", "openstep_4.2_mf2dd.img.lz", "openstep_4.2_mf2hd.img.lz", + "rhapsody_dr1_mf2dd.img.lz", "rhapsody_dr1_mf2hd.img.lz", "rhapsody_dr2_mf2dd.img.lz", + "rhapsody_dr2_mf2hd.img.lz", }; - readonly ulong[] sectors = { - 1440, 2880, - 1440, 2880, - 1440, 2880, - 1440, 2880, - 1440, 2880, - }; + readonly ulong[] sectors = {1440, 2880, 1440, 2880, 1440, 2880, 1440, 2880, 1440, 2880,}; - readonly uint[] sectorsize = { - 512, 512, - 512, 512, - 512, 512, - 512, 512, - 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 624, 1344, - 624, 1344, - 624, 1344, - 624, 1344, - 624, 1344, - }; + readonly long[] clusters = {624, 1344, 624, 1344, 624, 1344, 624, 1344, 624, 1344,}; - readonly int[] clustersize = { - 1024, 1024, - 1024, 1024, - 1024, 1024, - 1024, 1024, - 1024, 1024, - }; + readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,}; - readonly string[] volumename = { - null, null, - null, null, - null, null, - null, null, - null, null, - }; + readonly string[] volumename = {null, null, null, null, null, null, null, null, null, null,}; - readonly string[] volumeserial = { - null, null, - null, null, - null, null, - null, null, - null, null, - }; + readonly string[] volumeserial = {null, null, null, null, null, null, null, null, null, null,}; - readonly string[] type = { - "UFS", "UFS", - "UFS", "UFS", - "UFS", "UFS", - "UFS", "UFS", - "UFS", "UFS", - }; + readonly string[] type = {"UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS",}; [Test] public void Test() @@ -126,6 +84,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -137,4 +96,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/UFS_RDB.cs b/DiscImageChef.Tests/Filesystems/UFS_RDB.cs index 03f7cdfe..63d29ff7 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_RDB.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class UFS_RDB { - readonly string[] testfiles = { - "amix.vdi.lz", - }; + readonly string[] testfiles = {"amix.vdi.lz",}; - readonly ulong[] sectors = { - 1024128, - }; + readonly ulong[] sectors = {1024128,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 511424, - }; + readonly long[] clusters = {511424,}; - readonly int[] clustersize = { - 1024, - }; + readonly int[] clustersize = {1024,}; - readonly string[] volumename = { - null, - }; + readonly string[] volumename = {null,}; - readonly string[] volumeserial = { - null, - }; + readonly string[] volumeserial = {null,}; - readonly string[] type = { - "UFS", - }; + readonly string[] type = {"UFS",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -106,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs b/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs index 10ff3411..2df34686 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class UFS_Suni86 { - readonly string[] testfiles = { - "solaris_7.vdi.lz", - }; + readonly string[] testfiles = {"solaris_7.vdi.lz",}; - readonly ulong[] sectors = { - 4194304, - }; + readonly ulong[] sectors = {4194304,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 2063376, - }; + readonly long[] clusters = {2063376,}; - readonly int[] clustersize = { - 1024, - }; + readonly int[] clustersize = {1024,}; - readonly string[] volumename = { - null, - }; + readonly string[] volumename = {null,}; - readonly string[] volumeserial = { - null, - }; + readonly string[] volumeserial = {null,}; - readonly string[] type = { - "UFS", - }; + readonly string[] type = {"UFS",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -106,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/UNIXBFS.cs b/DiscImageChef.Tests/Filesystems/UNIXBFS.cs index 90eb4348..6d8c65c5 100644 --- a/DiscImageChef.Tests/Filesystems/UNIXBFS.cs +++ b/DiscImageChef.Tests/Filesystems/UNIXBFS.cs @@ -38,40 +38,27 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class unixbfs { - readonly string[] testfiles = { - "amix_mf2dd.adf.lz","att_unix_svr4v2.1_dsdd.img.lz","att_unix_svr4v2.1_dshd.img.lz","att_unix_svr4v2.1_mf2dd.img.lz", - "att_unix_svr4v2.1_mf2hd.img.lz", + readonly string[] testfiles = + { + "amix_mf2dd.adf.lz", "att_unix_svr4v2.1_dsdd.img.lz", "att_unix_svr4v2.1_dshd.img.lz", + "att_unix_svr4v2.1_mf2dd.img.lz", "att_unix_svr4v2.1_mf2hd.img.lz", }; - readonly MediaType[] mediatypes = { + readonly MediaType[] mediatypes = + { MediaType.CBM_AMIGA_35_DD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, }; - readonly ulong[] sectors = { - 1760, 720, 2400, 1440, - 2880, - }; + readonly ulong[] sectors = {1760, 720, 2400, 1440, 2880,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 1760, 720, 2400, 1440, - 2880, - }; + readonly long[] clusters = {1760, 720, 2400, 1440, 2880,}; - readonly int[] clustersize = { - 512, 512, 512, 512, - 512, - }; + readonly int[] clustersize = {512, 512, 512, 512, 512,}; - readonly string[] volumename = { - "Label",null,null,null, - null, - }; + readonly string[] volumename = {"Label", null, null, null, null,}; [Test] public void Test() @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs b/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs index 4885405d..19cb7c2f 100644 --- a/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs @@ -40,29 +40,17 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class unixbfs_mbr { - readonly string[] testfiles = { - "linux.vdi.lz", - }; + readonly string[] testfiles = {"linux.vdi.lz",}; - readonly ulong[] sectors = { - 262144, - }; + readonly ulong[] sectors = {262144,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 260096, - }; + readonly long[] clusters = {260096,}; - readonly int[] clustersize = { - 512, - }; + readonly int[] clustersize = {512,}; - readonly string[] volumename = { - "Label", - }; + readonly string[] volumename = {"Label",}; [Test] public void Test() @@ -87,6 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -97,4 +86,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs b/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs index 139e3f27..0176c5c0 100644 --- a/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs @@ -40,37 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class UNIXBFS_RDB { - readonly string[] testfiles = { - "amix.vdi.lz", - }; + readonly string[] testfiles = {"amix.vdi.lz",}; - readonly ulong[] sectors = { - 1024128, - }; + readonly ulong[] sectors = {1024128,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 65024, - }; + readonly long[] clusters = {65024,}; - readonly int[] clustersize = { - 2048, - }; + readonly int[] clustersize = {2048,}; - readonly string[] volumename = { - null, - }; + readonly string[] volumename = {null,}; - readonly string[] volumeserial = { - "UNKNOWN", - }; + readonly string[] volumeserial = {"UNKNOWN",}; - readonly string[] type = { - "UFS", - }; + readonly string[] type = {"UFS",}; [Test] public void Test() @@ -95,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -106,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/XENIX.cs b/DiscImageChef.Tests/Filesystems/XENIX.cs index d30022c3..075546fe 100644 --- a/DiscImageChef.Tests/Filesystems/XENIX.cs +++ b/DiscImageChef.Tests/Filesystems/XENIX.cs @@ -38,51 +38,29 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class XENIX { - readonly string[] testfiles = { - "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", + readonly string[] testfiles = + { + "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", + "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", "scoopenserver_5.0.7hw_mf2hd.img.lz", }; - readonly MediaType[] mediatypes = { - MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, - MediaType.DOS_35_HD, - }; + readonly MediaType[] mediatypes = + {MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD,}; - readonly ulong[] sectors = { - 3360, 2400, 1440, 5760, - 2880, - }; + readonly ulong[] sectors = {3360, 2400, 1440, 5760, 2880,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512,}; - readonly long[] clusters = { - 0, 0, 0, 0, 0, - 1680, 1200, 720, 2880, - 1440, - }; + readonly long[] clusters = {0, 0, 0, 0, 0, 1680, 1200, 720, 2880, 1440,}; - readonly int[] clustersize = { - 1024, 1024, 1024, 1024, - 1024, - }; + readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024,}; - readonly string[] volumename = { - "", "", "", "", - "", - }; + readonly string[] volumename = {"", "", "", "", "",}; - readonly string[] volumeserial = { - null, null, null, null, - null, - }; + readonly string[] volumeserial = {null, null, null, null, null,}; - readonly string[] type = { - "XENIX fs", "XENIX fs", "XENIX fs", "XENIX fs", - "XENIX fs", - }; + readonly string[] type = {"XENIX fs", "XENIX fs", "XENIX fs", "XENIX fs", "XENIX fs",}; [Test] public void Test() @@ -114,4 +92,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs b/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs index 125bef57..b70e8961 100644 --- a/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs @@ -40,38 +40,21 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class XENIX_MBR { - readonly string[] testfiles = { - "xenix_2.3.2d.vdi.lz", "xenix_2.3.4h.vdi.lz", "scoopenserver_5.0.7hw.vdi.lz", - }; + readonly string[] testfiles = {"xenix_2.3.2d.vdi.lz", "xenix_2.3.4h.vdi.lz", "scoopenserver_5.0.7hw.vdi.lz",}; - readonly ulong[] sectors = { - 40960, 40960, 2097152, - }; + readonly ulong[] sectors = {40960, 40960, 2097152,}; - readonly uint[] sectorsize = { - 512, 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512,}; - readonly long[] clusters = { - 0, 0, 0, - 19624, 19624, 19624, - }; + readonly long[] clusters = {0, 0, 0, 19624, 19624, 19624,}; - readonly int[] clustersize = { - 1024, 1024, 1024, - }; + readonly int[] clustersize = {1024, 1024, 1024,}; - readonly string[] volumename = { - "", "", "", - }; + readonly string[] volumename = {"", "", "",}; - readonly string[] volumeserial = { - null, null, null, - }; + readonly string[] volumeserial = {null, null, null,}; - readonly string[] type = { - "XENIX fs", "XENIX fs", "XENIX fs", - }; + readonly string[] type = {"XENIX fs", "XENIX fs", "XENIX fs",}; [Test] public void Test() @@ -96,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -107,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/XFS_MBR.cs b/DiscImageChef.Tests/Filesystems/XFS_MBR.cs index aaade401..31a62fd1 100644 --- a/DiscImageChef.Tests/Filesystems/XFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/XFS_MBR.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class XFS_MBR { - readonly string[] testfiles = { - "linux.vdi.lz", - }; + readonly string[] testfiles = {"linux.vdi.lz",}; - readonly ulong[] sectors = { - 1048576, - }; + readonly ulong[] sectors = {1048576,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 130816, - }; + readonly long[] clusters = {130816,}; - readonly int[] clustersize = { - 4096, - }; + readonly int[] clustersize = {4096,}; - readonly string[] volumename = { - "Volume label", - }; + readonly string[] volumename = {"Volume label",}; - readonly string[] volumeserial = { - "230075b7-9834-b44e-a257-982a058311d8", - }; + readonly string[] volumeserial = {"230075b7-9834-b44e-a257-982a058311d8",}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/ZFS.cs b/DiscImageChef.Tests/Filesystems/ZFS.cs index b8aae875..90f148bd 100644 --- a/DiscImageChef.Tests/Filesystems/ZFS.cs +++ b/DiscImageChef.Tests/Filesystems/ZFS.cs @@ -39,33 +39,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class ZFS { - readonly string[] testfiles = { - "netbsd_7.1.vdi.lz", - }; + readonly string[] testfiles = {"netbsd_7.1.vdi.lz",}; - readonly ulong[] sectors = { - 33554432, - }; + readonly ulong[] sectors = {33554432,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 0, - }; + readonly long[] clusters = {0,}; - readonly int[] clustersize = { - 0, - }; + readonly int[] clustersize = {0,}; - readonly string[] volumename = { - "NetBSD 7.1", - }; + readonly string[] volumename = {"NetBSD 7.1",}; - readonly string[] volumeserial = { - "2639895335654686206", - }; + readonly string[] volumeserial = {"2639895335654686206",}; [Test] public void Test() @@ -96,4 +82,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/btrfs.cs b/DiscImageChef.Tests/Filesystems/btrfs.cs index d2a4bfdd..4ef6ecc3 100644 --- a/DiscImageChef.Tests/Filesystems/btrfs.cs +++ b/DiscImageChef.Tests/Filesystems/btrfs.cs @@ -41,33 +41,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class btrfs { - readonly string[] testfiles = { - "linux.vdi.lz", - }; + readonly string[] testfiles = {"linux.vdi.lz",}; - readonly ulong[] sectors = { - 262144, - }; + readonly ulong[] sectors = {262144,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 32512, - }; + readonly long[] clusters = {32512,}; - readonly int[] clustersize = { - 4096, - }; + readonly int[] clustersize = {4096,}; - readonly string[] volumename = { - "VolumeLabel", - }; + readonly string[] volumename = {"VolumeLabel",}; - readonly string[] volumeserial = { - "a4fc5201-85cc-6840-8a68-998cab9ae897", - }; + readonly string[] volumeserial = {"a4fc5201-85cc-6840-8a68-998cab9ae897",}; [Test] public void Test() @@ -93,6 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -104,4 +91,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/exFAT_APM.cs b/DiscImageChef.Tests/Filesystems/exFAT_APM.cs index bc922014..620d1cd0 100644 --- a/DiscImageChef.Tests/Filesystems/exFAT_APM.cs +++ b/DiscImageChef.Tests/Filesystems/exFAT_APM.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class exFAT_APM { - readonly string[] testfiles = { - "macosx_10.11.vdi.lz", - }; + readonly string[] testfiles = {"macosx_10.11.vdi.lz",}; - readonly ulong[] sectors = { - 262144, - }; + readonly ulong[] sectors = {262144,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 32710, - }; + readonly long[] clusters = {32710,}; - readonly int[] clustersize = { - 4096, - }; + readonly int[] clustersize = {4096,}; - readonly string[] volumename = { - null, - }; + readonly string[] volumename = {null,}; - readonly string[] volumeserial = { - "595AC82C", - }; + readonly string[] volumeserial = {"595AC82C",}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs b/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs index df6e8c3d..e58a92cc 100644 --- a/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class exFAT_GPT { - readonly string[] testfiles = { - "macosx_10.11.vdi.lz", - }; + readonly string[] testfiles = {"macosx_10.11.vdi.lz",}; - readonly ulong[] sectors = { - 262144, - }; + readonly ulong[] sectors = {262144,}; - readonly uint[] sectorsize = { - 512, - }; + readonly uint[] sectorsize = {512,}; - readonly long[] clusters = { - 32208, - }; + readonly long[] clusters = {32208,}; - readonly int[] clustersize = { - 4096, - }; + readonly int[] clustersize = {4096,}; - readonly string[] volumename = { - null, - }; + readonly string[] volumename = {null,}; - readonly string[] volumeserial = { - "595ACC39", - }; + readonly string[] volumeserial = {"595ACC39",}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs b/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs index 422fcd4a..37255e9e 100644 --- a/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs @@ -40,33 +40,19 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class exFAT_MBR { - readonly string[] testfiles = { - "linux.vdi.lz", "macosx_10.11.vdi.lz", "win10.vdi.lz", "winvista.vdi.lz", - }; + readonly string[] testfiles = {"linux.vdi.lz", "macosx_10.11.vdi.lz", "win10.vdi.lz", "winvista.vdi.lz",}; - readonly ulong[] sectors = { - 262144, 262144, 262144, 262144, - }; + readonly ulong[] sectors = {262144, 262144, 262144, 262144,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512,}; - readonly long[] clusters = { - 32464, 32712, 32448, 32208, - }; + readonly long[] clusters = {32464, 32712, 32448, 32208,}; - readonly int[] clustersize = { - 4096, 4096, 4096, 4096, - }; + readonly int[] clustersize = {4096, 4096, 4096, 4096,}; - readonly string[] volumename = { - null, null, null, null, - }; + readonly string[] volumename = {null, null, null, null,}; - readonly string[] volumeserial = { - "603565AC", "595AC21E", "20126663", "0AC5CA52" - }; + readonly string[] volumeserial = {"603565AC", "595AC21E", "20126663", "0AC5CA52"}; [Test] public void Test() @@ -91,6 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -102,4 +89,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/ext2.cs b/DiscImageChef.Tests/Filesystems/ext2.cs index ea6dd4d6..d90db602 100644 --- a/DiscImageChef.Tests/Filesystems/ext2.cs +++ b/DiscImageChef.Tests/Filesystems/ext2.cs @@ -41,45 +41,29 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class ext2 { - readonly string[] testfiles = { - "linux_ext2.vdi.lz", "linux_ext3.vdi.lz","linux_ext4.vdi.lz", - "netbsd_7.1.vdi.lz", "netbsd_7.1_r0.vdi.lz", + readonly string[] testfiles = + { + "linux_ext2.vdi.lz", "linux_ext3.vdi.lz", "linux_ext4.vdi.lz", "netbsd_7.1.vdi.lz", "netbsd_7.1_r0.vdi.lz", }; - readonly ulong[] sectors = { - 262144, 262144, 262144, - 8388608, 2097152, + readonly ulong[] sectors = {262144, 262144, 262144, 8388608, 2097152,}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512,}; + + readonly long[] clusters = {130048, 130048, 130048, 1046567, 260135,}; + + readonly int[] clustersize = {1024, 1024, 1024, 4096, 4096,}; + + readonly string[] volumename = {"VolumeLabel", "VolumeLabel", "VolumeLabel", "Volume label", "Volume label",}; + + readonly string[] volumeserial = + { + "8e3992cf-7d98-e44a-b753-0591a35913eb", "1b411516-5415-4b42-95e6-1a247056a960", + "b2f8f305-770f-ad47-abe4-f0484aa319e9", "e72aee05-627b-11e7-a573-0800272a08ec", + "072756f2-627c-11e7-a573-0800272a08ec", }; - readonly uint[] sectorsize = { - 512, 512, 512, - 512, 512, - }; - - readonly long[] clusters = { - 130048, 130048, 130048, - 1046567, 260135, - }; - - readonly int[] clustersize = { - 1024, 1024, 1024, - 4096, 4096, - }; - - readonly string[] volumename = { - "VolumeLabel", "VolumeLabel", "VolumeLabel", - "Volume label", "Volume label", - }; - - readonly string[] volumeserial = { - "8e3992cf-7d98-e44a-b753-0591a35913eb", "1b411516-5415-4b42-95e6-1a247056a960", "b2f8f305-770f-ad47-abe4-f0484aa319e9", - "e72aee05-627b-11e7-a573-0800272a08ec", "072756f2-627c-11e7-a573-0800272a08ec", - }; - - readonly string[] extversion = { - "ext2", "ext3", "ext4", - "ext2", "ext2" - }; + readonly string[] extversion = {"ext2", "ext3", "ext4", "ext2", "ext2"}; [Test] public void Test() @@ -105,6 +89,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); @@ -116,4 +101,4 @@ namespace DiscImageChef.Tests.Filesystems } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/AppleDoubleDave.cs b/DiscImageChef.Tests/Filters/AppleDoubleDave.cs index 9f67fcde..2e8fcf8a 100644 --- a/DiscImageChef.Tests/Filters/AppleDoubleDave.cs +++ b/DiscImageChef.Tests/Filters/AppleDoubleDave.cs @@ -46,7 +46,8 @@ namespace DiscImageChef.Tests.Filters public AppleDoubleDave() { location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "dave", "DOS_720.dmg"); - sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "dave", "resource.frk", "DOS_720.dmg"); + sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "dave", "resource.frk", + "DOS_720.dmg"); } [Test] @@ -118,4 +119,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedResource, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/AppleDoubleDos.cs b/DiscImageChef.Tests/Filters/AppleDoubleDos.cs index 9869f12b..60c40648 100644 --- a/DiscImageChef.Tests/Filters/AppleDoubleDos.cs +++ b/DiscImageChef.Tests/Filters/AppleDoubleDos.cs @@ -118,4 +118,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedResource, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/AppleDoubleNetatalk.cs b/DiscImageChef.Tests/Filters/AppleDoubleNetatalk.cs index 30151e01..04956fc0 100644 --- a/DiscImageChef.Tests/Filters/AppleDoubleNetatalk.cs +++ b/DiscImageChef.Tests/Filters/AppleDoubleNetatalk.cs @@ -46,7 +46,8 @@ namespace DiscImageChef.Tests.Filters public AppleDoubleNetatalk() { location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "netatalk", "DOS_720.dmg"); - sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "netatalk", ".AppleDouble", "DOS_720.dmg"); + sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "netatalk", ".AppleDouble", + "DOS_720.dmg"); } [Test] @@ -118,4 +119,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedResource, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/AppleDoubleOsX.cs b/DiscImageChef.Tests/Filters/AppleDoubleOsX.cs index 06766782..d48c7dd4 100644 --- a/DiscImageChef.Tests/Filters/AppleDoubleOsX.cs +++ b/DiscImageChef.Tests/Filters/AppleDoubleOsX.cs @@ -118,4 +118,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedResource, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/AppleDoubleProDos.cs b/DiscImageChef.Tests/Filters/AppleDoubleProDos.cs index c46b06e1..72e20913 100644 --- a/DiscImageChef.Tests/Filters/AppleDoubleProDos.cs +++ b/DiscImageChef.Tests/Filters/AppleDoubleProDos.cs @@ -118,4 +118,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedResource, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/AppleDoubleUnAr.cs b/DiscImageChef.Tests/Filters/AppleDoubleUnAr.cs index 5d0a8d23..ad4a73e3 100644 --- a/DiscImageChef.Tests/Filters/AppleDoubleUnAr.cs +++ b/DiscImageChef.Tests/Filters/AppleDoubleUnAr.cs @@ -118,4 +118,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedResource, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/AppleDoubleUnix.cs b/DiscImageChef.Tests/Filters/AppleDoubleUnix.cs index 75ad01ce..64b9909b 100644 --- a/DiscImageChef.Tests/Filters/AppleDoubleUnix.cs +++ b/DiscImageChef.Tests/Filters/AppleDoubleUnix.cs @@ -118,4 +118,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedResource, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/AppleSingle.cs b/DiscImageChef.Tests/Filters/AppleSingle.cs index 40f86144..cf2bf35f 100644 --- a/DiscImageChef.Tests/Filters/AppleSingle.cs +++ b/DiscImageChef.Tests/Filters/AppleSingle.cs @@ -110,4 +110,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedResource, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/BZip2.cs b/DiscImageChef.Tests/Filters/BZip2.cs index f0d7d707..0e3412b8 100644 --- a/DiscImageChef.Tests/Filters/BZip2.cs +++ b/DiscImageChef.Tests/Filters/BZip2.cs @@ -36,8 +36,10 @@ namespace DiscImageChef.Tests.Filters [TestFixture] public class BZip2 { - static readonly byte[] ExpectedFile = { 0xf8, 0xb6, 0xbc, 0x62, 0x33, 0xcf, 0x1d, 0x28, 0x02, 0xef, 0x80, 0xf1, 0xe4, 0xfc, 0x1b, 0xdf }; - static readonly byte[] ExpectedContents = { 0x18, 0x90, 0x5a, 0xf9, 0x83, 0xd8, 0x2b, 0xdd, 0x1a, 0xcc, 0x69, 0x75, 0x4f, 0x0f, 0x81, 0x5e }; + static readonly byte[] ExpectedFile = + {0xf8, 0xb6, 0xbc, 0x62, 0x33, 0xcf, 0x1d, 0x28, 0x02, 0xef, 0x80, 0xf1, 0xe4, 0xfc, 0x1b, 0xdf}; + static readonly byte[] ExpectedContents = + {0x18, 0x90, 0x5a, 0xf9, 0x83, 0xd8, 0x2b, 0xdd, 0x1a, 0xcc, 0x69, 0x75, 0x4f, 0x0f, 0x81, 0x5e}; readonly string location; public BZip2() @@ -92,4 +94,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedContents, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/GZip.cs b/DiscImageChef.Tests/Filters/GZip.cs index 0013befe..098e622f 100644 --- a/DiscImageChef.Tests/Filters/GZip.cs +++ b/DiscImageChef.Tests/Filters/GZip.cs @@ -36,8 +36,10 @@ namespace DiscImageChef.Tests.Filters [TestFixture] public class GZip { - static readonly byte[] ExpectedFile = { 0x35, 0xe2, 0x9c, 0x9d, 0x05, 0x1b, 0x6d, 0xa6, 0x6c, 0x24, 0xeb, 0x30, 0xe8, 0xd2, 0xa6, 0x6b }; - static readonly byte[] ExpectedContents = { 0x18, 0x90, 0x5a, 0xf9, 0x83, 0xd8, 0x2b, 0xdd, 0x1a, 0xcc, 0x69, 0x75, 0x4f, 0x0f, 0x81, 0x5e }; + static readonly byte[] ExpectedFile = + {0x35, 0xe2, 0x9c, 0x9d, 0x05, 0x1b, 0x6d, 0xa6, 0x6c, 0x24, 0xeb, 0x30, 0xe8, 0xd2, 0xa6, 0x6b}; + static readonly byte[] ExpectedContents = + {0x18, 0x90, 0x5a, 0xf9, 0x83, 0xd8, 0x2b, 0xdd, 0x1a, 0xcc, 0x69, 0x75, 0x4f, 0x0f, 0x81, 0x5e}; readonly string location; public GZip() @@ -92,4 +94,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedContents, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/LZip.cs b/DiscImageChef.Tests/Filters/LZip.cs index c8449573..a49ef79a 100644 --- a/DiscImageChef.Tests/Filters/LZip.cs +++ b/DiscImageChef.Tests/Filters/LZip.cs @@ -36,8 +36,10 @@ namespace DiscImageChef.Tests.Filters [TestFixture] public class LZip { - static readonly byte[] ExpectedFile = { 0x3f, 0x7b, 0x77, 0x3e, 0x52, 0x48, 0xd5, 0x26, 0xf4, 0xb1, 0xac, 0x15, 0xb2, 0xb3, 0x5f, 0x87 }; - static readonly byte[] ExpectedContents = { 0x18, 0x90, 0x5a, 0xf9, 0x83, 0xd8, 0x2b, 0xdd, 0x1a, 0xcc, 0x69, 0x75, 0x4f, 0x0f, 0x81, 0x5e }; + static readonly byte[] ExpectedFile = + {0x3f, 0x7b, 0x77, 0x3e, 0x52, 0x48, 0xd5, 0x26, 0xf4, 0xb1, 0xac, 0x15, 0xb2, 0xb3, 0x5f, 0x87}; + static readonly byte[] ExpectedContents = + {0x18, 0x90, 0x5a, 0xf9, 0x83, 0xd8, 0x2b, 0xdd, 0x1a, 0xcc, 0x69, 0x75, 0x4f, 0x0f, 0x81, 0x5e}; readonly string location; public LZip() @@ -92,4 +94,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedContents, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/MacBinary1.cs b/DiscImageChef.Tests/Filters/MacBinary1.cs index 5bfd6698..d2ed61c7 100644 --- a/DiscImageChef.Tests/Filters/MacBinary1.cs +++ b/DiscImageChef.Tests/Filters/MacBinary1.cs @@ -110,4 +110,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedResource, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/MacBinary2.cs b/DiscImageChef.Tests/Filters/MacBinary2.cs index 877e9c68..7a5ad788 100644 --- a/DiscImageChef.Tests/Filters/MacBinary2.cs +++ b/DiscImageChef.Tests/Filters/MacBinary2.cs @@ -110,4 +110,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedResource, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/MacBinary3.cs b/DiscImageChef.Tests/Filters/MacBinary3.cs index e5a5d910..2705ff92 100644 --- a/DiscImageChef.Tests/Filters/MacBinary3.cs +++ b/DiscImageChef.Tests/Filters/MacBinary3.cs @@ -110,4 +110,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedResource, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/PCExchange.cs b/DiscImageChef.Tests/Filters/PCExchange.cs index 1f9a99ea..0dc8fc2c 100644 --- a/DiscImageChef.Tests/Filters/PCExchange.cs +++ b/DiscImageChef.Tests/Filters/PCExchange.cs @@ -51,7 +51,8 @@ namespace DiscImageChef.Tests.Filters { MD5Context ctx = new MD5Context(); ctx.Init(); - string result = ctx.File(Path.Combine(Consts.TestFilesRoot, "filters", "pcexchange", "FINDER.DAT"), out byte[] tmp); + string result = ctx.File(Path.Combine(Consts.TestFilesRoot, "filters", "pcexchange", "FINDER.DAT"), + out byte[] tmp); Assert.AreEqual(ExpectedFile, result); } @@ -92,7 +93,7 @@ namespace DiscImageChef.Tests.Filters string result = ctx.Data(data, out byte[] tmp); Assert.AreEqual(ExpectedContents, result); } - + [Test] public void CheckResource() { @@ -110,4 +111,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedResource, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filters/XZ.cs b/DiscImageChef.Tests/Filters/XZ.cs index ba8fb4e6..59d4d468 100644 --- a/DiscImageChef.Tests/Filters/XZ.cs +++ b/DiscImageChef.Tests/Filters/XZ.cs @@ -36,8 +36,10 @@ namespace DiscImageChef.Tests.Filters [TestFixture] public class XZ { - static readonly byte[] ExpectedFile = { 0x6c, 0x88, 0xa5, 0x9a, 0x1b, 0x7a, 0xec, 0x59, 0x2b, 0xef, 0x8a, 0x28, 0xdb, 0x11, 0x01, 0xc8 }; - static readonly byte[] ExpectedContents = { 0x18, 0x90, 0x5a, 0xf9, 0x83, 0xd8, 0x2b, 0xdd, 0x1a, 0xcc, 0x69, 0x75, 0x4f, 0x0f, 0x81, 0x5e }; + static readonly byte[] ExpectedFile = + {0x6c, 0x88, 0xa5, 0x9a, 0x1b, 0x7a, 0xec, 0x59, 0x2b, 0xef, 0x8a, 0x28, 0xdb, 0x11, 0x01, 0xc8}; + static readonly byte[] ExpectedContents = + {0x18, 0x90, 0x5a, 0xf9, 0x83, 0xd8, 0x2b, 0xdd, 0x1a, 0xcc, 0x69, 0x75, 0x4f, 0x0f, 0x81, 0x5e}; readonly string location; public XZ() @@ -92,4 +94,4 @@ namespace DiscImageChef.Tests.Filters Assert.AreEqual(ExpectedContents, result); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Images/2MG.cs b/DiscImageChef.Tests/Images/2MG.cs index ff68680c..f8359aa8 100644 --- a/DiscImageChef.Tests/Images/2MG.cs +++ b/DiscImageChef.Tests/Images/2MG.cs @@ -38,29 +38,26 @@ namespace DiscImageChef.Tests.Images [TestFixture] public class Apple2MG { - readonly string[] testfiles = { - "blank140.2mg.lz", "dos32.2mg.lz", "dos33-do.2mg.lz", "dos33-nib.2mg.lz", - "dos33-po.2mg.lz", "prodos1440.2mg.lz", + readonly string[] testfiles = + { + "blank140.2mg.lz", "dos32.2mg.lz", "dos33-do.2mg.lz", "dos33-nib.2mg.lz", "dos33-po.2mg.lz", + "prodos1440.2mg.lz", }; - readonly ulong[] sectors = { - 560, 415, 560, 560, - 560, 2880, + readonly ulong[] sectors = {560, 415, 560, 560, 560, 2880,}; + + readonly uint[] sectorsize = {256, 256, 256, 256, 256, 512}; + + readonly MediaType[] mediatypes = + { + MediaType.Apple33SS, MediaType.Apple32SS, MediaType.Apple33SS, MediaType.Apple33SS, MediaType.Apple33SS, + MediaType.DOS_35_HD, }; - readonly uint[] sectorsize = { - 256, 256, 256, 256, - 256, 512 - }; - - readonly MediaType[] mediatypes = { - MediaType.Apple33SS, MediaType.Apple32SS, MediaType.Apple33SS, MediaType.Apple33SS, - MediaType.Apple33SS, MediaType.DOS_35_HD, - }; - - readonly string[] md5s = { - "7db5d585270ab858043d50e60068d45f", "c62ee4dac8835f9acc999e7531d3b5f8", "86bc7879bb477917aab3976057a6a7b2", "32b8f8163238d4f3ea2a3db95ad1a812", - "a5acba4cbaddd9c53ea0e8210f4aba55", "eb9b60c78b30d2b6541ed0781944b6da", + readonly string[] md5s = + { + "7db5d585270ab858043d50e60068d45f", "c62ee4dac8835f9acc999e7531d3b5f8", "86bc7879bb477917aab3976057a6a7b2", + "32b8f8163238d4f3ea2a3db95ad1a812", "a5acba4cbaddd9c53ea0e8210f4aba55", "eb9b60c78b30d2b6541ed0781944b6da", }; [Test] @@ -106,4 +103,4 @@ namespace DiscImageChef.Tests.Images } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Images/Anex86.cs b/DiscImageChef.Tests/Images/Anex86.cs index e6e1abb7..409c7046 100644 --- a/DiscImageChef.Tests/Images/Anex86.cs +++ b/DiscImageChef.Tests/Images/Anex86.cs @@ -38,34 +38,30 @@ namespace DiscImageChef.Tests.Images [TestFixture] public class Anex86 { - readonly string[] testfiles = { + readonly string[] testfiles = + { "anex86_10mb.hdi.lz", "anex86_15mb.hdi.lz", "anex86_20mb.hdi.lz", "anex86_30mb.hdi.lz", "anex86_40mb.hdi.lz", "anex86_5mb.hdi.lz", "blank_md2hd.fdi.lz", "msdos33d_md2hd.fdi.lz", "msdos50_epson_md2hd.fdi.lz", "msdos50_md2hd.fdi.lz", "msdos62_md2hd.fdi.lz", }; - readonly ulong[] sectors = { - 40920, 61380, 81840, 121770, - 162360, 20196, 1232, 1232, - 1232, 1232, 1232, - }; + readonly ulong[] sectors = {40920, 61380, 81840, 121770, 162360, 20196, 1232, 1232, 1232, 1232, 1232,}; - readonly uint[] sectorsize = { - 256, 256, 256, 256, - 256, 256, 1024, 1024, - 1024, 1024, 1024 - }; + readonly uint[] sectorsize = {256, 256, 256, 256, 256, 256, 1024, 1024, 1024, 1024, 1024}; - readonly MediaType[] mediatypes = { + readonly MediaType[] mediatypes = + { MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.NEC_525_HD, MediaType.NEC_525_HD, MediaType.NEC_525_HD, MediaType.NEC_525_HD, MediaType.NEC_525_HD, }; - readonly string[] md5s = { - "1c5387e38e58165c517c059e5d48905d", "a84366658c1c3bd09af4d0d42fbf716e", "919c9eecf1b65b10870f617cb976668a", "02d35af02581afb2e56792dcaba2c1af", - "b8c3f858f1a9d300d3e74f36eea04354", "c348bbbaf99fcb8c8e66de157aef62f4", "c3587f7020743067cf948c9d5c5edb27", "a23874a4474334b035a24c6924140744", - "bc1ef3236e75cb09575037b884ee9dce", "243036c4617b666a6c886cc23d7274e0", "09bb2ff964a0c5c223a1900f085e3955", + readonly string[] md5s = + { + "1c5387e38e58165c517c059e5d48905d", "a84366658c1c3bd09af4d0d42fbf716e", "919c9eecf1b65b10870f617cb976668a", + "02d35af02581afb2e56792dcaba2c1af", "b8c3f858f1a9d300d3e74f36eea04354", "c348bbbaf99fcb8c8e66de157aef62f4", + "c3587f7020743067cf948c9d5c5edb27", "a23874a4474334b035a24c6924140744", "bc1ef3236e75cb09575037b884ee9dce", + "243036c4617b666a6c886cc23d7274e0", "09bb2ff964a0c5c223a1900f085e3955", }; [Test] @@ -111,4 +107,4 @@ namespace DiscImageChef.Tests.Images } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Images/CisCopy.cs b/DiscImageChef.Tests/Images/CisCopy.cs index 329d8e4e..2362b033 100644 --- a/DiscImageChef.Tests/Images/CisCopy.cs +++ b/DiscImageChef.Tests/Images/CisCopy.cs @@ -39,34 +39,26 @@ namespace DiscImageChef.Tests.Images public class CisCopy { // TODO: Support compression - readonly string[] testfiles = { + readonly string[] testfiles = + { "md1dd8_all.dcf.lz", "md1dd8_belelung.dcf.lz", "md1dd8_fat.dcf.lz", "md1dd_all.dcf.lz", "md1dd_belelung.dcf.lz", "md1dd_fat.dcf.lz", "md2dd8_all.dcf.lz", "md2dd8_belelung.dcf.lz", - "md2dd8_fat.dcf.lz", "md2dd_all.dcf.lz", "md2dd_belelung.dcf.lz", "md2dd_fat.dcf.lz", - "md2hd_all.dcf.lz", "md2hd_belelung.dcf.lz", "md2hd_fat.dcf.lz", "mf2dd_all.dcf.lz", - "mf2dd_belelung.dcf.lz", "mf2dd_fat.dcf.lz", "mf2hd_all.dcf.lz", "mf2hd_belelung.dcf.lz", - "mf2hd_fat.dcf.lz", + "md2dd8_fat.dcf.lz", "md2dd_all.dcf.lz", "md2dd_belelung.dcf.lz", "md2dd_fat.dcf.lz", "md2hd_all.dcf.lz", + "md2hd_belelung.dcf.lz", "md2hd_fat.dcf.lz", "mf2dd_all.dcf.lz", "mf2dd_belelung.dcf.lz", + "mf2dd_fat.dcf.lz", "mf2hd_all.dcf.lz", "mf2hd_belelung.dcf.lz", "mf2hd_fat.dcf.lz", }; - readonly ulong[] sectors = { - 320, 320, 320, 360, - 360, 360, 640, 640, - 640, 720, 720, 720, - 2400, 2400, 2400, 1440, - 1440, 1440, 2880, 2880, + readonly ulong[] sectors = + { + 320, 320, 320, 360, 360, 360, 640, 640, 640, 720, 720, 720, 2400, 2400, 2400, 1440, 1440, 1440, 2880, 2880, 2880, }; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, - }; + readonly uint[] sectorsize = + {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,}; - readonly MediaType[] mediatypes = { + readonly MediaType[] mediatypes = + { MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_9, @@ -75,13 +67,15 @@ namespace DiscImageChef.Tests.Images MediaType.DOS_35_HD, }; - readonly string[] md5s = { - "95c0b76419c1c74db6dbe1d790f97dde", "95c0b76419c1c74db6dbe1d790f97dde", "6f6507e416b7320d583dc347b8e57844", "48b93e8619c4c13f4a3724b550e4b371", - "48b93e8619c4c13f4a3724b550e4b371", "1d060d2e2543e1c2e8569f5451660060", "0c93155bbc5e412f5014e037d08c2745", "0c93155bbc5e412f5014e037d08c2745", - "0c93155bbc5e412f5014e037d08c2745", "d2a33090ec03bfb536e7356deacf4bbc", "d2a33090ec03bfb536e7356deacf4bbc", "d2a33090ec03bfb536e7356deacf4bbc", - "181f3bc62f0b90f74af9d8027ebf7512", "181f3bc62f0b90f74af9d8027ebf7512", "181f3bc62f0b90f74af9d8027ebf7512", "783559ee5e774515d5e7d2feab9c333e", - "783559ee5e774515d5e7d2feab9c333e", "783559ee5e774515d5e7d2feab9c333e", "91f3fde8d56a536cdda4c6758e5dbc93", "91f3fde8d56a536cdda4c6758e5dbc93", - "91f3fde8d56a536cdda4c6758e5dbc93", + readonly string[] md5s = + { + "95c0b76419c1c74db6dbe1d790f97dde", "95c0b76419c1c74db6dbe1d790f97dde", "6f6507e416b7320d583dc347b8e57844", + "48b93e8619c4c13f4a3724b550e4b371", "48b93e8619c4c13f4a3724b550e4b371", "1d060d2e2543e1c2e8569f5451660060", + "0c93155bbc5e412f5014e037d08c2745", "0c93155bbc5e412f5014e037d08c2745", "0c93155bbc5e412f5014e037d08c2745", + "d2a33090ec03bfb536e7356deacf4bbc", "d2a33090ec03bfb536e7356deacf4bbc", "d2a33090ec03bfb536e7356deacf4bbc", + "181f3bc62f0b90f74af9d8027ebf7512", "181f3bc62f0b90f74af9d8027ebf7512", "181f3bc62f0b90f74af9d8027ebf7512", + "783559ee5e774515d5e7d2feab9c333e", "783559ee5e774515d5e7d2feab9c333e", "783559ee5e774515d5e7d2feab9c333e", + "91f3fde8d56a536cdda4c6758e5dbc93", "91f3fde8d56a536cdda4c6758e5dbc93", "91f3fde8d56a536cdda4c6758e5dbc93", }; [Test] @@ -127,4 +121,4 @@ namespace DiscImageChef.Tests.Images } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Images/CopyQM.cs b/DiscImageChef.Tests/Images/CopyQM.cs index d26a1777..71ca39ba 100644 --- a/DiscImageChef.Tests/Images/CopyQM.cs +++ b/DiscImageChef.Tests/Images/CopyQM.cs @@ -38,30 +38,28 @@ namespace DiscImageChef.Tests.Images [TestFixture] public class CopyQM { - readonly string[] testfiles = { - "mf2dd.cqm.lz", "mf2dd_fdformat_800.cqm.lz", "mf2dd_freedos.cqm.lz", "mf2hd_blind.cqm.lz", - "mf2hd.cqm.lz", "mf2hd_fdformat_168.cqm.lz", "mf2hd_freedos.cqm.lz", + readonly string[] testfiles = + { + "mf2dd.cqm.lz", "mf2dd_fdformat_800.cqm.lz", "mf2dd_freedos.cqm.lz", "mf2hd_blind.cqm.lz", "mf2hd.cqm.lz", + "mf2hd_fdformat_168.cqm.lz", "mf2hd_freedos.cqm.lz", }; - readonly ulong[] sectors = { - 1440, 1600, 1600, 2880, - 2880, 3360, 3360, - }; + readonly ulong[] sectors = {1440, 1600, 1600, 2880, 2880, 3360, 3360,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512,}; // TODO: Add "unknown" media types - readonly MediaType[] mediatypes = { - MediaType.DOS_35_DS_DD_9, MediaType.Unknown, MediaType.Unknown, MediaType.DOS_35_HD, - MediaType.DOS_35_HD, MediaType.DMF, MediaType.DMF, + readonly MediaType[] mediatypes = + { + MediaType.DOS_35_DS_DD_9, MediaType.Unknown, MediaType.Unknown, MediaType.DOS_35_HD, MediaType.DOS_35_HD, + MediaType.DMF, MediaType.DMF, }; - readonly string[] md5s = { - "de3f85896f771b7e5bc4c9e3926d64e4", "c533488a21098a62c85f1649abda2803", "1ff7649b679ba22ff20d39ff717dbec8", "b4a602f67903c46eef62addb0780aa56", - "b4a602f67903c46eef62addb0780aa56", "03c2af6a8ebf4bd6f530335de34ae5dd", "1a9f2eeb3cbeeb057b9a9a5c6e9b0cc6", + readonly string[] md5s = + { + "de3f85896f771b7e5bc4c9e3926d64e4", "c533488a21098a62c85f1649abda2803", "1ff7649b679ba22ff20d39ff717dbec8", + "b4a602f67903c46eef62addb0780aa56", "b4a602f67903c46eef62addb0780aa56", "03c2af6a8ebf4bd6f530335de34ae5dd", + "1a9f2eeb3cbeeb057b9a9a5c6e9b0cc6", }; [Test] @@ -107,4 +105,4 @@ namespace DiscImageChef.Tests.Images } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Images/D88.cs b/DiscImageChef.Tests/Images/D88.cs index b1bb5c01..59edaeeb 100644 --- a/DiscImageChef.Tests/Images/D88.cs +++ b/DiscImageChef.Tests/Images/D88.cs @@ -38,45 +38,46 @@ namespace DiscImageChef.Tests.Images [TestFixture] public class D88 { - readonly string[] testfiles = { - "1942 (1987)(ASCII)(JP).d77.lz", "'Ashe (1988)(Quasar)(Disk 4 of 4)(User Disk).d88.lz", "Crimsin (1988)(Xtalsoft)(Disk 3 of 3).d88.lz", "Dragon Slayer (1986)(Falcom - Login)(JP).d88.lz", - "D-Side - Lagrange L-2 Part II (1986)(Compaq)(JP).d88.lz", "File Master FM, The v1.01 (1986)(Kyoto Media)(JP).d77.lz", "Gandhara (1987)(Enix)(JP).d88.lz", "Might & Magic (198x)(Star Craft)(Disk 1 of 3)(Disk A).d88.lz", - "msdos33d_md2dd.d88.lz", "msdos33d_md2hd.d88.lz", "msdos50_epson_md2dd.d88.lz", "msdos50_epson_md2hd.d88.lz", - "msdos50_md2dd.d88.lz", "msdos50_md2hd.d88.lz", "msdos62_md2dd.d88.lz", "msdos62_md2hd.d88.lz", - "R-Type (1988)(Irem)(Disk 1 of 2).d88.lz", "Towns System Software v1.1L30 (1992)(Fujitsu)(JP).d88.lz", "Visual Instrument Player (198x)(Kamiya)(JP)(Disk 1 of 2).d88.lz", + readonly string[] testfiles = + { + "1942 (1987)(ASCII)(JP).d77.lz", "'Ashe (1988)(Quasar)(Disk 4 of 4)(User Disk).d88.lz", + "Crimsin (1988)(Xtalsoft)(Disk 3 of 3).d88.lz", "Dragon Slayer (1986)(Falcom - Login)(JP).d88.lz", + "D-Side - Lagrange L-2 Part II (1986)(Compaq)(JP).d88.lz", + "File Master FM, The v1.01 (1986)(Kyoto Media)(JP).d77.lz", "Gandhara (1987)(Enix)(JP).d88.lz", + "Might & Magic (198x)(Star Craft)(Disk 1 of 3)(Disk A).d88.lz", "msdos33d_md2dd.d88.lz", + "msdos33d_md2hd.d88.lz", "msdos50_epson_md2dd.d88.lz", "msdos50_epson_md2hd.d88.lz", "msdos50_md2dd.d88.lz", + "msdos50_md2hd.d88.lz", "msdos62_md2dd.d88.lz", "msdos62_md2hd.d88.lz", + "R-Type (1988)(Irem)(Disk 1 of 2).d88.lz", "Towns System Software v1.1L30 (1992)(Fujitsu)(JP).d88.lz", + "Visual Instrument Player (198x)(Kamiya)(JP)(Disk 1 of 2).d88.lz", }; - readonly ulong[] sectors = { - 1280, 1280, 1280, 411, - 1440, 1280, 1280, 4033, - 1440, 1232, 1440, 1232, - 1440, 1232, 1440, 1232, - 1284, 1232, 1280 + readonly ulong[] sectors = + { + 1280, 1280, 1280, 411, 1440, 1280, 1280, 4033, 1440, 1232, 1440, 1232, 1440, 1232, 1440, 1232, 1284, 1232, + 1280 }; - readonly uint[] sectorsize = { - 256, 256, 256, 256, - 256, 256, 256, 128, - 512, 1024, 512, 1024, - 512, 1024, 512, 1024, - 1024, 1024, 256, - }; + readonly uint[] sectorsize = + {256, 256, 256, 256, 256, 256, 256, 128, 512, 1024, 512, 1024, 512, 1024, 512, 1024, 1024, 1024, 256,}; // TODO: Add "unknown" media types - readonly MediaType[] mediatypes = { - MediaType.NEC_525_SS, MediaType.NEC_525_SS, MediaType.NEC_525_SS, MediaType.Unknown, - MediaType.Unknown, MediaType.NEC_525_SS, MediaType.NEC_525_SS, MediaType.Unknown, - MediaType.Unknown, MediaType.NEC_525_HD, MediaType.Unknown, MediaType.NEC_525_HD, - MediaType.Unknown, MediaType.NEC_525_HD, MediaType.Unknown, MediaType.NEC_525_HD, - MediaType.Unknown, MediaType.NEC_525_HD, MediaType.NEC_525_SS, + readonly MediaType[] mediatypes = + { + MediaType.NEC_525_SS, MediaType.NEC_525_SS, MediaType.NEC_525_SS, MediaType.Unknown, MediaType.Unknown, + MediaType.NEC_525_SS, MediaType.NEC_525_SS, MediaType.Unknown, MediaType.Unknown, MediaType.NEC_525_HD, + MediaType.Unknown, MediaType.NEC_525_HD, MediaType.Unknown, MediaType.NEC_525_HD, MediaType.Unknown, + MediaType.NEC_525_HD, MediaType.Unknown, MediaType.NEC_525_HD, MediaType.NEC_525_SS, }; - readonly string[] md5s = { - "a4103c39cd7fd9fc3de8418dfcf22364", "b948048c03e0b3d34d77f5c9dced0b41", "f91152fab791d4dc0677a289d90478a5", "39b01df04a6312b09f1b83c9f3a46b22", - "ef775ec1f41b8b725ea83ec8c5ca04e2", "5c2b22f824524cd6c539aaeb2ecb84cd", "6bddf3dd32877f7b552cbf9da6b89f76", "003cd0292879733b6eab7ca79ab9cfeb", - "acb738a5a945e4e2ba1504a14a529933", "106068dbdf13803979c7bbb63612f43d", "be916f25847b9cfc9776d88cc150ae7e", "ccc7f98e216db35c2b7a08634a9f3e20", - "7a3332e82b0fe8c5673a2615f6c0b9a2", "62f5be96a8b8ccab9ee4aebf557cfcf7", "07fb4c225d4b5a2e2a1046ae66fc153c", "1f73980e45a384bed331eaa33c9ef65b", - "9d675e5147b55cee0b2bc05476eef825", "bb48546ced9c61462e1c89dca4987143", "c7df67f4e66dad658fe856d3c8b36c7a", + readonly string[] md5s = + { + "a4103c39cd7fd9fc3de8418dfcf22364", "b948048c03e0b3d34d77f5c9dced0b41", "f91152fab791d4dc0677a289d90478a5", + "39b01df04a6312b09f1b83c9f3a46b22", "ef775ec1f41b8b725ea83ec8c5ca04e2", "5c2b22f824524cd6c539aaeb2ecb84cd", + "6bddf3dd32877f7b552cbf9da6b89f76", "003cd0292879733b6eab7ca79ab9cfeb", "acb738a5a945e4e2ba1504a14a529933", + "106068dbdf13803979c7bbb63612f43d", "be916f25847b9cfc9776d88cc150ae7e", "ccc7f98e216db35c2b7a08634a9f3e20", + "7a3332e82b0fe8c5673a2615f6c0b9a2", "62f5be96a8b8ccab9ee4aebf557cfcf7", "07fb4c225d4b5a2e2a1046ae66fc153c", + "1f73980e45a384bed331eaa33c9ef65b", "9d675e5147b55cee0b2bc05476eef825", "bb48546ced9c61462e1c89dca4987143", + "c7df67f4e66dad658fe856d3c8b36c7a", }; [Test] @@ -122,4 +123,4 @@ namespace DiscImageChef.Tests.Images } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Images/DART.cs b/DiscImageChef.Tests/Images/DART.cs index f6d27e2d..8238a71d 100644 --- a/DiscImageChef.Tests/Images/DART.cs +++ b/DiscImageChef.Tests/Images/DART.cs @@ -38,29 +38,27 @@ namespace DiscImageChef.Tests.Images [TestFixture] public class DART { - readonly string[] testfiles = { + readonly string[] testfiles = + { "mf1dd_hfs_best.dart.lz", "mf1dd_hfs_fast.dart.lz", "mf1dd_mfs_best.dart.lz", "mf1dd_mfs_fast.dart.lz", "mf2dd_hfs_best.dart.lz", "mf2dd_hfs_fast.dart.lz", "mf2dd_mfs_best.dart.lz", "mf2dd_mfs_fast.dart.lz", }; - readonly ulong[] sectors = { - 800, 800, 800, 800, - 1600, 1600, 1600, 1600, - }; + readonly ulong[] sectors = {800, 800, 800, 800, 1600, 1600, 1600, 1600,}; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - }; + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512,}; - readonly MediaType[] mediatypes = { + readonly MediaType[] mediatypes = + { MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, }; - readonly string[] md5s = { - "eae3a95671d077deb702b3549a769f56", "eae3a95671d077deb702b3549a769f56", "c5d92544c3e78b7f0a9b4baaa9a64eec", "c5d92544c3e78b7f0a9b4baaa9a64eec", - "a99744348a70b62b57bce2dec9132ced", "a99744348a70b62b57bce2dec9132ced", "93e71b9ecdb39d3ec9245b4f451856d4", "93e71b9ecdb39d3ec9245b4f451856d4", + readonly string[] md5s = + { + "eae3a95671d077deb702b3549a769f56", "eae3a95671d077deb702b3549a769f56", "c5d92544c3e78b7f0a9b4baaa9a64eec", + "c5d92544c3e78b7f0a9b4baaa9a64eec", "a99744348a70b62b57bce2dec9132ced", "a99744348a70b62b57bce2dec9132ced", + "93e71b9ecdb39d3ec9245b4f451856d4", "93e71b9ecdb39d3ec9245b4f451856d4", }; [Test] @@ -106,4 +104,4 @@ namespace DiscImageChef.Tests.Images } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Images/DiskCopy42.cs b/DiscImageChef.Tests/Images/DiskCopy42.cs index fc075ea8..a6df8ecb 100644 --- a/DiscImageChef.Tests/Images/DiskCopy42.cs +++ b/DiscImageChef.Tests/Images/DiskCopy42.cs @@ -38,51 +38,46 @@ namespace DiscImageChef.Tests.Images [TestFixture] public class DiskCopy42 { - readonly string[] testfiles = { + readonly string[] testfiles = + { // Made with DiskCopy 4.2 "dc42/mf1dd_hfs.img.lz", "dc42/mf1dd_mfs.img.lz", "dc42/mf2dd_hfs.img.lz", "dc42/mf2dd_mfs.img.lz", // Made with ShrinkWrap 3 - "shrinkwrap/DiskCopy 4/DC6_RW_HFS_1440.image.lz", "shrinkwrap/DiskCopy 4/DC6_RW_HFS_800.image.lz", "shrinkwrap/DiskCopy 4/DOS1440.image.lz", "shrinkwrap/DiskCopy 4/DOS720.image.lz", + "shrinkwrap/DiskCopy 4/DC6_RW_HFS_1440.image.lz", "shrinkwrap/DiskCopy 4/DC6_RW_HFS_800.image.lz", + "shrinkwrap/DiskCopy 4/DOS1440.image.lz", "shrinkwrap/DiskCopy 4/DOS720.image.lz", "shrinkwrap/DiskCopy 4/PD1440.image.lz", "shrinkwrap/DiskCopy 4/PD800.image.lz", // Made with DiskImages.framework - "macosx/DC42/DOS_1440.img.lz", "macosx/DC42/DOS_720.img.lz", "macosx/DC42/HFS_1440.img.lz", "macosx/DC42/HFS_800.img.lz", - "macosx/DC42/ProDOS_1440.img.lz", "macosx/DC42/ProDOS_800.img.lz", "macosx/DC42/UFS_1440.img.lz", "macosx/DC42/UFS_720.img.lz", - "macosx/DC42/UFS_800.img.lz", + "macosx/DC42/DOS_1440.img.lz", "macosx/DC42/DOS_720.img.lz", "macosx/DC42/HFS_1440.img.lz", + "macosx/DC42/HFS_800.img.lz", "macosx/DC42/ProDOS_1440.img.lz", "macosx/DC42/ProDOS_800.img.lz", + "macosx/DC42/UFS_1440.img.lz", "macosx/DC42/UFS_720.img.lz", "macosx/DC42/UFS_800.img.lz", }; - readonly ulong[] sectors = { - 800, 800, 1600, 1600, - 2880, 1600, 2880, 1440, - 2880, 1600, - 2880, 1440, 2880, 1600, - 2880, 1600, 2880, 1440, + readonly ulong[] sectors = + { + 800, 800, 1600, 1600, 2880, 1600, 2880, 1440, 2880, 1600, 2880, 1440, 2880, 1600, 2880, 1600, 2880, 1440, 1600, }; - readonly uint[] sectorsize = { - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, 512, - 512, 512, 512, 512, - 512, 512, 512, 512, - 512, - }; + readonly uint[] sectorsize = + {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,}; - readonly MediaType[] mediatypes = { + readonly MediaType[] mediatypes = + { MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.DOS_35_HD, MediaType.AppleSonyDS, MediaType.DOS_35_HD, MediaType.DOS_35_DS_DD_9, - MediaType.DOS_35_HD, MediaType.AppleSonyDS, - MediaType.DOS_35_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, MediaType.AppleSonyDS, MediaType.DOS_35_HD, MediaType.AppleSonyDS, MediaType.DOS_35_HD, MediaType.DOS_35_DS_DD_9, - MediaType.AppleSonyDS, + MediaType.DOS_35_HD, MediaType.AppleSonyDS, MediaType.DOS_35_HD, MediaType.AppleSonyDS, MediaType.DOS_35_HD, + MediaType.DOS_35_DS_DD_9, MediaType.AppleSonyDS, }; - readonly string[] md5s = { - "eae3a95671d077deb702b3549a769f56", "c5d92544c3e78b7f0a9b4baaa9a64eec", "a99744348a70b62b57bce2dec9132ced", "93e71b9ecdb39d3ec9245b4f451856d4", - "3160038ca028ccf52ad7863790072145", "5e255c4bc0f6a26ecd27845b37e65aaa", "ff419213080574056ebd9adf7bab3d32", "c2be571406cf6353269faa59a4a8c0a4", - "7975e8cf7579a6848d6fb4e546d1f682", "a72da7aedadbe194c22a3d71c62e4766", - "ff419213080574056ebd9adf7bab3d32", "c2be571406cf6353269faa59a4a8c0a4", "3160038ca028ccf52ad7863790072145", "5e255c4bc0f6a26ecd27845b37e65aaa", - "7975e8cf7579a6848d6fb4e546d1f682", "a72da7aedadbe194c22a3d71c62e4766", "b37823c7a90d1917f719ba5927b23da8", "4942032f7bf1d115237ea1764424828b", + readonly string[] md5s = + { + "eae3a95671d077deb702b3549a769f56", "c5d92544c3e78b7f0a9b4baaa9a64eec", "a99744348a70b62b57bce2dec9132ced", + "93e71b9ecdb39d3ec9245b4f451856d4", "3160038ca028ccf52ad7863790072145", "5e255c4bc0f6a26ecd27845b37e65aaa", + "ff419213080574056ebd9adf7bab3d32", "c2be571406cf6353269faa59a4a8c0a4", "7975e8cf7579a6848d6fb4e546d1f682", + "a72da7aedadbe194c22a3d71c62e4766", "ff419213080574056ebd9adf7bab3d32", "c2be571406cf6353269faa59a4a8c0a4", + "3160038ca028ccf52ad7863790072145", "5e255c4bc0f6a26ecd27845b37e65aaa", "7975e8cf7579a6848d6fb4e546d1f682", + "a72da7aedadbe194c22a3d71c62e4766", "b37823c7a90d1917f719ba5927b23da8", "4942032f7bf1d115237ea1764424828b", "85574aebeef03eb355bf8541955d06ea", }; @@ -129,4 +124,4 @@ namespace DiscImageChef.Tests.Images } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Partitions/Acorn.cs b/DiscImageChef.Tests/Partitions/Acorn.cs index 7484826e..1a367874 100644 --- a/DiscImageChef.Tests/Partitions/Acorn.cs +++ b/DiscImageChef.Tests/Partitions/Acorn.cs @@ -39,24 +39,60 @@ namespace DiscImageChef.Tests.Partitions [TestFixture] public class Acorn { - readonly string[] testfiles = { - "linux_ics.vdi.lz", - }; + readonly string[] testfiles = {"linux_ics.vdi.lz",}; - readonly Partition[][] wanted = { + readonly Partition[][] wanted = + { // Linux (ICS) // TODO: Values are incorrect - new []{ - new Partition{ Description = null, Size = 31457280, Name = null, Type = "GEM", Offset = 512, Length = 61440, - Sequence = 0, Start = 1 }, - new Partition{ Description = null, Size = 41943040, Name = null, Type = "BGM", Offset = 31457792, Length = 81920, - Sequence = 1, Start = 61441 }, - new Partition{ Description = null, Size = 56402432, Name = null, Type = "LNX", Offset = 73400832, Length = 110161, - Sequence = 2, Start = 143361 }, - new Partition{ Description = null, Size = 43212800, Name = null, Type = "MAC", Offset = 129803264, Length = 84400, - Sequence = 3, Start = 253522 }, + new[] + { + new Partition + { + Description = null, + Size = 31457280, + Name = null, + Type = "GEM", + Offset = 512, + Length = 61440, + Sequence = 0, + Start = 1 + }, + new Partition + { + Description = null, + Size = 41943040, + Name = null, + Type = "BGM", + Offset = 31457792, + Length = 81920, + Sequence = 1, + Start = 61441 + }, + new Partition + { + Description = null, + Size = 56402432, + Name = null, + Type = "LNX", + Offset = 73400832, + Length = 110161, + Sequence = 2, + Start = 143361 + }, + new Partition + { + Description = null, + Size = 43212800, + Name = null, + Type = "MAC", + Offset = 129803264, + Length = 84400, + Sequence = 3, + Start = 253522 + }, }, - }; + }; [Test] public void Test() @@ -85,4 +121,4 @@ namespace DiscImageChef.Tests.Partitions } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Partitions/AppleMap.cs b/DiscImageChef.Tests/Partitions/AppleMap.cs index 385a2b0d..fea0fda9 100644 --- a/DiscImageChef.Tests/Partitions/AppleMap.cs +++ b/DiscImageChef.Tests/Partitions/AppleMap.cs @@ -39,426 +39,1964 @@ namespace DiscImageChef.Tests.Partitions [TestFixture] public class AppleMap { - readonly string[] testfiles = { - "d2_driver.vdi.lz","hdt_1.8_encrypted1.vdi.lz","hdt_1.8_encrypted2.vdi.lz","hdt_1.8_password.vdi.lz", - "hdt_1.8.vdi.lz","linux.vdi.lz","macos_1.1.vdi.lz","macos_2.0.vdi.lz", - "macos_4.2.vdi.lz","macos_4.3.vdi.lz","macos_6.0.2.vdi.lz","macos_6.0.3.vdi.lz", - "macos_6.0.4.vdi.lz","macos_6.0.5.vdi.lz","macos_6.0.7.vdi.lz","macos_6.0.8.vdi.lz", - "macos_6.0.vdi.lz","macos_7.0.vdi.lz","macos_7.1.1.vdi.lz","macos_7.5.vdi.lz", - "parted.vdi.lz","silverlining_2.2.1.vdi.lz","speedtools_3.6.vdi.lz","vcpformatter_2.1.1.vdi.lz", + readonly string[] testfiles = + { + "d2_driver.vdi.lz", "hdt_1.8_encrypted1.vdi.lz", "hdt_1.8_encrypted2.vdi.lz", "hdt_1.8_password.vdi.lz", + "hdt_1.8.vdi.lz", "linux.vdi.lz", "macos_1.1.vdi.lz", "macos_2.0.vdi.lz", "macos_4.2.vdi.lz", + "macos_4.3.vdi.lz", "macos_6.0.2.vdi.lz", "macos_6.0.3.vdi.lz", "macos_6.0.4.vdi.lz", "macos_6.0.5.vdi.lz", + "macos_6.0.7.vdi.lz", "macos_6.0.8.vdi.lz", "macos_6.0.vdi.lz", "macos_7.0.vdi.lz", "macos_7.1.1.vdi.lz", + "macos_7.5.vdi.lz", "parted.vdi.lz", "silverlining_2.2.1.vdi.lz", "speedtools_3.6.vdi.lz", + "vcpformatter_2.1.1.vdi.lz", }; - readonly Partition[][] wanted = { + readonly Partition[][] wanted = + { // D2 - new []{ - new Partition{ Description = null, Size = 1024, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 2, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 42496, Name = "Macintosh", Type = "Apple_Driver43", Offset = 32768, Length = 83, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 55808, Name = "Empty", Type = "Apple_Free", Offset = 75264, Length = 109, - Sequence = 2, Start = 147 }, - new Partition{ Description = null, Size = 26083328, Name = "Volume label", Type = "Apple_HFS", Offset = 131072, Length = 50944, - Sequence = 3, Start = 256 }, + new[] + { + new Partition + { + Description = null, + Size = 1024, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 2, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 42496, + Name = "Macintosh", + Type = "Apple_Driver43", + Offset = 32768, + Length = 83, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 55808, + Name = "Empty", + Type = "Apple_Free", + Offset = 75264, + Length = 109, + Sequence = 2, + Start = 147 + }, + new Partition + { + Description = null, + Size = 26083328, + Name = "Volume label", + Type = "Apple_HFS", + Offset = 131072, + Length = 50944, + Sequence = 3, + Start = 256 + }, }, // HDT 1.8 Encryption Level 1 - new []{ - new Partition{ Description = null, Size = 7168, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 14, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 524288, Name = "FWB Disk Driver", Type = "Apple_Driver43", Offset = 32768, Length = 1024, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 25657344, Name = "MacOS", Type = "Apple_HFS", Offset = 557056, Length = 50112, - Sequence = 2, Start = 1088 }, + new[] + { + new Partition + { + Description = null, + Size = 7168, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 14, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 524288, + Name = "FWB Disk Driver", + Type = "Apple_Driver43", + Offset = 32768, + Length = 1024, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 25657344, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 557056, + Length = 50112, + Sequence = 2, + Start = 1088 + }, }, // HDT 1.8 Encryption Level 2 - new []{ - new Partition{ Description = null, Size = 7168, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 14, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 524288, Name = "FWB Disk Driver", Type = "Apple_Driver43", Offset = 32768, Length = 1024, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 25657344, Name = "MacOS", Type = "Apple_HFS", Offset = 557056, Length = 50112, - Sequence = 2, Start = 1088 }, + new[] + { + new Partition + { + Description = null, + Size = 7168, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 14, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 524288, + Name = "FWB Disk Driver", + Type = "Apple_Driver43", + Offset = 32768, + Length = 1024, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 25657344, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 557056, + Length = 50112, + Sequence = 2, + Start = 1088 + }, }, // HDT 1.8 with password - new []{ - new Partition{ Description = null, Size = 7168, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 14, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 524288, Name = "FWB Disk Driver", Type = "Apple_Driver43", Offset = 32768, Length = 1024, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 25657344, Name = "MacOS", Type = "Apple_HFS", Offset = 557056, Length = 50112, - Sequence = 2, Start = 1088 }, + new[] + { + new Partition + { + Description = null, + Size = 7168, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 14, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 524288, + Name = "FWB Disk Driver", + Type = "Apple_Driver43", + Offset = 32768, + Length = 1024, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 25657344, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 557056, + Length = 50112, + Sequence = 2, + Start = 1088 + }, }, // HDT 1.8 - new []{ - new Partition{ Description = null, Size = 7168, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 14, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 524288, Name = "FWB Disk Driver", Type = "Apple_Driver43", Offset = 32768, Length = 1024, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 25657344, Name = "MacOS", Type = "Apple_HFS", Offset = 557056, Length = 50112, - Sequence = 2, Start = 1088 }, + new[] + { + new Partition + { + Description = null, + Size = 7168, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 14, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 524288, + Name = "FWB Disk Driver", + Type = "Apple_Driver43", + Offset = 32768, + Length = 1024, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 25657344, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 557056, + Length = 50112, + Sequence = 2, + Start = 1088 + }, }, // Linux - new []{ - new Partition{ Description = null, Size = 512, Name = "Extra", Type = "Apple_Free", Offset = 32768, Length = 1, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 819200, Name = "bootstrap", Type = "Apple_Bootstrap", Offset = 33280, Length = 1600, - Sequence = 1, Start = 65 }, - new Partition{ Description = null, Size = 512, Name = "Extra", Type = "Apple_Free", Offset = 852480, Length = 1, - Sequence = 2, Start = 1665 }, - new Partition{ Description = null, Size = 52428800, Name = "Linux", Type = "Apple_UNIX_SVR2", Offset = 852992, Length = 102400, - Sequence = 3, Start = 1666 }, - new Partition{ Description = null, Size = 20971520, Name = "ProDOS", Type = "Apple_PRODOS", Offset = 53281792, Length = 40960, - Sequence = 4, Start = 104066 }, - new Partition{ Description = null, Size = 52428800, Name = "Macintosh", Type = "Apple_HFS", Offset = 74253312, Length = 102400, - Sequence = 5, Start = 145026 }, - new Partition{ Description = null, Size = 7535616, Name = "Extra", Type = "Apple_Free", Offset = 126682112, Length = 14718, - Sequence = 6, Start = 247426 }, + new[] + { + new Partition + { + Description = null, + Size = 512, + Name = "Extra", + Type = "Apple_Free", + Offset = 32768, + Length = 1, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 819200, + Name = "bootstrap", + Type = "Apple_Bootstrap", + Offset = 33280, + Length = 1600, + Sequence = 1, + Start = 65 + }, + new Partition + { + Description = null, + Size = 512, + Name = "Extra", + Type = "Apple_Free", + Offset = 852480, + Length = 1, + Sequence = 2, + Start = 1665 + }, + new Partition + { + Description = null, + Size = 52428800, + Name = "Linux", + Type = "Apple_UNIX_SVR2", + Offset = 852992, + Length = 102400, + Sequence = 3, + Start = 1666 + }, + new Partition + { + Description = null, + Size = 20971520, + Name = "ProDOS", + Type = "Apple_PRODOS", + Offset = 53281792, + Length = 40960, + Sequence = 4, + Start = 104066 + }, + new Partition + { + Description = null, + Size = 52428800, + Name = "Macintosh", + Type = "Apple_HFS", + Offset = 74253312, + Length = 102400, + Sequence = 5, + Start = 145026 + }, + new Partition + { + Description = null, + Size = 7535616, + Name = "Extra", + Type = "Apple_Free", + Offset = 126682112, + Length = 14718, + Sequence = 6, + Start = 247426 + }, }, // Mac OS 1.1 - new []{ - new Partition{ Description = null, Size = 5120, Name = null, Type = "Apple_Driver", Offset = 2048, Length = 10, - Sequence = 0, Start = 4 }, - new Partition{ Description = null, Size = 21403648, Name = "Macintosh", Type = "Apple_HFS", Offset = 8192, Length = 41804, - Sequence = 1, Start = 16 }, + new[] + { + new Partition + { + Description = null, + Size = 5120, + Name = null, + Type = "Apple_Driver", + Offset = 2048, + Length = 10, + Sequence = 0, + Start = 4 + }, + new Partition + { + Description = null, + Size = 21403648, + Name = "Macintosh", + Type = "Apple_HFS", + Offset = 8192, + Length = 41804, + Sequence = 1, + Start = 16 + }, }, // Mac OS 2.0 - new []{ - new Partition{ Description = null, Size = 5120, Name = null, Type = "Apple_Driver", Offset = 2048, Length = 10, - Sequence = 0, Start = 4 }, - new Partition{ Description = null, Size = 19950080, Name = "Macintosh", Type = "Apple_HFS", Offset = 8192, Length = 38965, - Sequence = 1, Start = 16 }, + new[] + { + new Partition + { + Description = null, + Size = 5120, + Name = null, + Type = "Apple_Driver", + Offset = 2048, + Length = 10, + Sequence = 0, + Start = 4 + }, + new Partition + { + Description = null, + Size = 19950080, + Name = "Macintosh", + Type = "Apple_HFS", + Offset = 8192, + Length = 38965, + Sequence = 1, + Start = 16 + }, }, // Mac OS 4.2 - new []{ - new Partition{ Description = null, Size = 5632, Name = null, Type = "Apple_Driver", Offset = 2048, Length = 11, - Sequence = 0, Start = 4 }, - new Partition{ Description = null, Size = 19950080, Name = "Macintosh", Type = "Apple_HFS", Offset = 8192, Length = 38965, - Sequence = 1, Start = 16 }, + new[] + { + new Partition + { + Description = null, + Size = 5632, + Name = null, + Type = "Apple_Driver", + Offset = 2048, + Length = 11, + Sequence = 0, + Start = 4 + }, + new Partition + { + Description = null, + Size = 19950080, + Name = "Macintosh", + Type = "Apple_HFS", + Offset = 8192, + Length = 38965, + Sequence = 1, + Start = 16 + }, }, // Mac OS 4.3 - new []{ - new Partition{ Description = null, Size = 5632, Name = null, Type = "Apple_Driver", Offset = 2048, Length = 11, - Sequence = 0, Start = 4 }, - new Partition{ Description = null, Size = 19950080, Name = "Macintosh", Type = "Apple_HFS", Offset = 8192, Length = 38965, - Sequence = 1, Start = 16 }, + new[] + { + new Partition + { + Description = null, + Size = 5632, + Name = null, + Type = "Apple_Driver", + Offset = 2048, + Length = 11, + Sequence = 0, + Start = 4 + }, + new Partition + { + Description = null, + Size = 19950080, + Name = "Macintosh", + Type = "Apple_HFS", + Offset = 8192, + Length = 38965, + Sequence = 1, + Start = 16 + }, }, // Mac OS 6.0.2 - new []{ - new Partition{ Description = null, Size = 5120, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 10, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver", Offset = 32768, Length = 32, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 3203072, Name = "MacOS", Type = "Apple_HFS", Offset = 49152, Length = 6256, - Sequence = 2, Start = 96 }, - new Partition{ Description = null, Size = 524288, Name = "Scratch", Type = "Apple_Scratch", Offset = 3252224, Length = 1024, - Sequence = 3, Start = 6352 }, - new Partition{ Description = null, Size = 1048576, Name = "Eschatology 1", Type = "Apple_UNIX_SVR2", Offset = 3776512, Length = 2048, - Sequence = 4, Start = 7376 }, - new Partition{ Description = null, Size = 2191360, Name = "A/UX Root", Type = "Apple_UNIX_SVR2", Offset = 4825088, Length = 4280, - Sequence = 5, Start = 9424 }, - new Partition{ Description = null, Size = 1217024, Name = "Swap", Type = "Apple_UNIX_SVR2", Offset = 7016448, Length = 2377, - Sequence = 6, Start = 13704 }, - new Partition{ Description = null, Size = 1572864, Name = "Eschatology 2", Type = "Apple_UNIX_SVR2", Offset = 8233472, Length = 3072, - Sequence = 7, Start = 16081 }, - new Partition{ Description = null, Size = 1310720, Name = "Root file system", Type = "Apple_UNIX_SVR2", Offset = 9806336, Length = 2560, - Sequence = 8, Start = 19153 }, - new Partition{ Description = null, Size = 2550272, Name = "Usr file system", Type = "Apple_UNIX_SVR2", Offset = 11117056, Length = 4981, - Sequence = 9, Start = 21713 }, - new Partition{ Description = null, Size = 2048000, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 13667328, Length = 4000, - Sequence = 10, Start = 26694 }, - new Partition{ Description = null, Size = 1296384, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 15715328, Length = 2532, - Sequence = 11, Start = 30694 }, - new Partition{ Description = null, Size = 1364992, Name = "Usr file system", Type = "Apple_UNIX_SVR2", Offset = 17011712, Length = 2666, - Sequence = 12, Start = 33226 }, - new Partition{ Description = null, Size = 3986432, Name = "Usr file system", Type = "Apple_UNIX_SVR2", Offset = 18376704, Length = 7786, - Sequence = 13, Start = 35892 }, - new Partition{ Description = null, Size = 5714944, Name = "Extra", Type = "Apple_Free", Offset = 22363136, Length = 11162, - Sequence = 14, Start = 43678 }, + new[] + { + new Partition + { + Description = null, + Size = 5120, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 10, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 16384, + Name = "Macintosh", + Type = "Apple_Driver", + Offset = 32768, + Length = 32, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 3203072, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 49152, + Length = 6256, + Sequence = 2, + Start = 96 + }, + new Partition + { + Description = null, + Size = 524288, + Name = "Scratch", + Type = "Apple_Scratch", + Offset = 3252224, + Length = 1024, + Sequence = 3, + Start = 6352 + }, + new Partition + { + Description = null, + Size = 1048576, + Name = "Eschatology 1", + Type = "Apple_UNIX_SVR2", + Offset = 3776512, + Length = 2048, + Sequence = 4, + Start = 7376 + }, + new Partition + { + Description = null, + Size = 2191360, + Name = "A/UX Root", + Type = "Apple_UNIX_SVR2", + Offset = 4825088, + Length = 4280, + Sequence = 5, + Start = 9424 + }, + new Partition + { + Description = null, + Size = 1217024, + Name = "Swap", + Type = "Apple_UNIX_SVR2", + Offset = 7016448, + Length = 2377, + Sequence = 6, + Start = 13704 + }, + new Partition + { + Description = null, + Size = 1572864, + Name = "Eschatology 2", + Type = "Apple_UNIX_SVR2", + Offset = 8233472, + Length = 3072, + Sequence = 7, + Start = 16081 + }, + new Partition + { + Description = null, + Size = 1310720, + Name = "Root file system", + Type = "Apple_UNIX_SVR2", + Offset = 9806336, + Length = 2560, + Sequence = 8, + Start = 19153 + }, + new Partition + { + Description = null, + Size = 2550272, + Name = "Usr file system", + Type = "Apple_UNIX_SVR2", + Offset = 11117056, + Length = 4981, + Sequence = 9, + Start = 21713 + }, + new Partition + { + Description = null, + Size = 2048000, + Name = "Random A/UX fs", + Type = "Apple_UNIX_SVR2", + Offset = 13667328, + Length = 4000, + Sequence = 10, + Start = 26694 + }, + new Partition + { + Description = null, + Size = 1296384, + Name = "Random A/UX fs", + Type = "Apple_UNIX_SVR2", + Offset = 15715328, + Length = 2532, + Sequence = 11, + Start = 30694 + }, + new Partition + { + Description = null, + Size = 1364992, + Name = "Usr file system", + Type = "Apple_UNIX_SVR2", + Offset = 17011712, + Length = 2666, + Sequence = 12, + Start = 33226 + }, + new Partition + { + Description = null, + Size = 3986432, + Name = "Usr file system", + Type = "Apple_UNIX_SVR2", + Offset = 18376704, + Length = 7786, + Sequence = 13, + Start = 35892 + }, + new Partition + { + Description = null, + Size = 5714944, + Name = "Extra", + Type = "Apple_Free", + Offset = 22363136, + Length = 11162, + Sequence = 14, + Start = 43678 + }, }, // Mac OS 6.0.3 - new []{ - new Partition{ Description = null, Size = 5120, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 10, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver", Offset = 32768, Length = 32, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 5948928, Name = "MacOS", Type = "Apple_HFS", Offset = 49152, Length = 11619, - Sequence = 2, Start = 96 }, - new Partition{ Description = null, Size = 1029632, Name = "Scratch", Type = "Apple_Scratch", Offset = 5998080, Length = 2011, - Sequence = 3, Start = 11715 }, - new Partition{ Description = null, Size = 2455552, Name = "Eschatology 1", Type = "Apple_UNIX_SVR2", Offset = 7027712, Length = 4796, - Sequence = 4, Start = 13726 }, - new Partition{ Description = null, Size = 3932160, Name = "A/UX Root", Type = "Apple_UNIX_SVR2", Offset = 9483264, Length = 7680, - Sequence = 5, Start = 18522 }, - new Partition{ Description = null, Size = 4194304, Name = "Swap", Type = "Apple_UNIX_SVR2", Offset = 13415424, Length = 8192, - Sequence = 6, Start = 26202 }, - new Partition{ Description = null, Size = 587776, Name = "Eschatology 2", Type = "Apple_UNIX_SVR2", Offset = 17609728, Length = 1148, - Sequence = 7, Start = 34394 }, - new Partition{ Description = null, Size = 6537216, Name = "Root file system", Type = "Apple_UNIX_SVR2", Offset = 18197504, Length = 12768, - Sequence = 8, Start = 35542 }, - new Partition{ Description = null, Size = 1766400, Name = "Usr file system", Type = "Apple_UNIX_SVR2", Offset = 24734720, Length = 3450, - Sequence = 9, Start = 48310 }, - new Partition{ Description = null, Size = 18432, Name = "Extra", Type = "Apple_Free", Offset = 26501120, Length = 36, - Sequence = 10, Start = 51760 }, - new Partition{ Description = null, Size = 1558528, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 26519552, Length = 3044, - Sequence = 11, Start = 51796 }, + new[] + { + new Partition + { + Description = null, + Size = 5120, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 10, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 16384, + Name = "Macintosh", + Type = "Apple_Driver", + Offset = 32768, + Length = 32, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 5948928, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 49152, + Length = 11619, + Sequence = 2, + Start = 96 + }, + new Partition + { + Description = null, + Size = 1029632, + Name = "Scratch", + Type = "Apple_Scratch", + Offset = 5998080, + Length = 2011, + Sequence = 3, + Start = 11715 + }, + new Partition + { + Description = null, + Size = 2455552, + Name = "Eschatology 1", + Type = "Apple_UNIX_SVR2", + Offset = 7027712, + Length = 4796, + Sequence = 4, + Start = 13726 + }, + new Partition + { + Description = null, + Size = 3932160, + Name = "A/UX Root", + Type = "Apple_UNIX_SVR2", + Offset = 9483264, + Length = 7680, + Sequence = 5, + Start = 18522 + }, + new Partition + { + Description = null, + Size = 4194304, + Name = "Swap", + Type = "Apple_UNIX_SVR2", + Offset = 13415424, + Length = 8192, + Sequence = 6, + Start = 26202 + }, + new Partition + { + Description = null, + Size = 587776, + Name = "Eschatology 2", + Type = "Apple_UNIX_SVR2", + Offset = 17609728, + Length = 1148, + Sequence = 7, + Start = 34394 + }, + new Partition + { + Description = null, + Size = 6537216, + Name = "Root file system", + Type = "Apple_UNIX_SVR2", + Offset = 18197504, + Length = 12768, + Sequence = 8, + Start = 35542 + }, + new Partition + { + Description = null, + Size = 1766400, + Name = "Usr file system", + Type = "Apple_UNIX_SVR2", + Offset = 24734720, + Length = 3450, + Sequence = 9, + Start = 48310 + }, + new Partition + { + Description = null, + Size = 18432, + Name = "Extra", + Type = "Apple_Free", + Offset = 26501120, + Length = 36, + Sequence = 10, + Start = 51760 + }, + new Partition + { + Description = null, + Size = 1558528, + Name = "Random A/UX fs", + Type = "Apple_UNIX_SVR2", + Offset = 26519552, + Length = 3044, + Sequence = 11, + Start = 51796 + }, }, // Mac OS 6.0.4 - new []{ - new Partition{ Description = null, Size = 5120, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 10, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver", Offset = 32768, Length = 32, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 3932160, Name = "MacOS", Type = "Apple_HFS", Offset = 49152, Length = 7680, - Sequence = 2, Start = 96 }, - new Partition{ Description = null, Size = 3197440, Name = "Scratch", Type = "Apple_Scratch", Offset = 3981312, Length = 6245, - Sequence = 3, Start = 7776 }, - new Partition{ Description = null, Size = 3197440, Name = "Eschatology 1", Type = "Apple_UNIX_SVR2", Offset = 7178752, Length = 6245, - Sequence = 4, Start = 14021 }, - new Partition{ Description = null, Size = 2626560, Name = "A/UX Root", Type = "Apple_UNIX_SVR2", Offset = 10376192, Length = 5130, - Sequence = 5, Start = 20266 }, - new Partition{ Description = null, Size = 1370112, Name = "Swap", Type = "Apple_UNIX_SVR2", Offset = 13002752, Length = 2676, - Sequence = 6, Start = 25396 }, - new Partition{ Description = null, Size = 2944512, Name = "Eschatology 2", Type = "Apple_UNIX_SVR2", Offset = 14372864, Length = 5751, - Sequence = 7, Start = 28072 }, - new Partition{ Description = null, Size = 2776576, Name = "Root file system", Type = "Apple_UNIX_SVR2", Offset = 17317376, Length = 5423, - Sequence = 8, Start = 33823 }, - new Partition{ Description = null, Size = 2892800, Name = "Usr file system", Type = "Apple_UNIX_SVR2", Offset = 20093952, Length = 5650, - Sequence = 9, Start = 39246 }, - new Partition{ Description = null, Size = 3433472, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 22986752, Length = 6706, - Sequence = 10, Start = 44896 }, - new Partition{ Description = null, Size = 1657856, Name = "Extra", Type = "Apple_Free", Offset = 26420224, Length = 3238, - Sequence = 11, Start = 51602 }, + new[] + { + new Partition + { + Description = null, + Size = 5120, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 10, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 16384, + Name = "Macintosh", + Type = "Apple_Driver", + Offset = 32768, + Length = 32, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 3932160, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 49152, + Length = 7680, + Sequence = 2, + Start = 96 + }, + new Partition + { + Description = null, + Size = 3197440, + Name = "Scratch", + Type = "Apple_Scratch", + Offset = 3981312, + Length = 6245, + Sequence = 3, + Start = 7776 + }, + new Partition + { + Description = null, + Size = 3197440, + Name = "Eschatology 1", + Type = "Apple_UNIX_SVR2", + Offset = 7178752, + Length = 6245, + Sequence = 4, + Start = 14021 + }, + new Partition + { + Description = null, + Size = 2626560, + Name = "A/UX Root", + Type = "Apple_UNIX_SVR2", + Offset = 10376192, + Length = 5130, + Sequence = 5, + Start = 20266 + }, + new Partition + { + Description = null, + Size = 1370112, + Name = "Swap", + Type = "Apple_UNIX_SVR2", + Offset = 13002752, + Length = 2676, + Sequence = 6, + Start = 25396 + }, + new Partition + { + Description = null, + Size = 2944512, + Name = "Eschatology 2", + Type = "Apple_UNIX_SVR2", + Offset = 14372864, + Length = 5751, + Sequence = 7, + Start = 28072 + }, + new Partition + { + Description = null, + Size = 2776576, + Name = "Root file system", + Type = "Apple_UNIX_SVR2", + Offset = 17317376, + Length = 5423, + Sequence = 8, + Start = 33823 + }, + new Partition + { + Description = null, + Size = 2892800, + Name = "Usr file system", + Type = "Apple_UNIX_SVR2", + Offset = 20093952, + Length = 5650, + Sequence = 9, + Start = 39246 + }, + new Partition + { + Description = null, + Size = 3433472, + Name = "Random A/UX fs", + Type = "Apple_UNIX_SVR2", + Offset = 22986752, + Length = 6706, + Sequence = 10, + Start = 44896 + }, + new Partition + { + Description = null, + Size = 1657856, + Name = "Extra", + Type = "Apple_Free", + Offset = 26420224, + Length = 3238, + Sequence = 11, + Start = 51602 + }, }, // Mac OS 6.0.5 - new []{ - new Partition{ Description = null, Size = 5120, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 10, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver", Offset = 32768, Length = 32, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 2097152, Name = "MacOS", Type = "Apple_HFS", Offset = 49152, Length = 4096, - Sequence = 2, Start = 96 }, - new Partition{ Description = null, Size = 342528, Name = "Scratch", Type = "Apple_Scratch", Offset = 2146304, Length = 669, - Sequence = 3, Start = 4192 }, - new Partition{ Description = null, Size = 1417216, Name = "Eschatology 1", Type = "Apple_UNIX_SVR2", Offset = 2488832, Length = 2768, - Sequence = 4, Start = 4861 }, - new Partition{ Description = null, Size = 1830912, Name = "A/UX Root", Type = "Apple_UNIX_SVR2", Offset = 3906048, Length = 3576, - Sequence = 5, Start = 7629 }, - new Partition{ Description = null, Size = 1448960, Name = "Swap", Type = "Apple_UNIX_SVR2", Offset = 5736960, Length = 2830, - Sequence = 6, Start = 11205 }, - new Partition{ Description = null, Size = 2687488, Name = "Root file system", Type = "Apple_UNIX_SVR2", Offset = 7185920, Length = 5249, - Sequence = 7, Start = 14035 }, - new Partition{ Description = null, Size = 2565632, Name = "Usr file system", Type = "Apple_UNIX_SVR2", Offset = 9873408, Length = 5011, - Sequence = 8, Start = 19284 }, - new Partition{ Description = null, Size = 1954816, Name = "Unreserved 1", Type = "Apple_UNIX_SVR2", Offset = 12439040, Length = 3818, - Sequence = 9, Start = 24295 }, - new Partition{ Description = null, Size = 3543040, Name = "Unreserved 2", Type = "Apple_UNIX_SVR2", Offset = 14393856, Length = 6920, - Sequence = 10, Start = 28113 }, - new Partition{ Description = null, Size = 2565632, Name = "Unreserved 3", Type = "Apple_UNIX_SVR2", Offset = 17936896, Length = 5011, - Sequence = 11, Start = 35033 }, - new Partition{ Description = null, Size = 2932224, Name = "Unreserved 4", Type = "Apple_UNIX_SVR2", Offset = 20502528, Length = 5727, - Sequence = 12, Start = 40044 }, - new Partition{ Description = null, Size = 1221632, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 23434752, Length = 2386, - Sequence = 13, Start = 45771 }, - new Partition{ Description = null, Size = 3421696, Name = "Extra", Type = "Apple_Free", Offset = 24656384, Length = 6683, - Sequence = 14, Start = 48157 }, + new[] + { + new Partition + { + Description = null, + Size = 5120, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 10, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 16384, + Name = "Macintosh", + Type = "Apple_Driver", + Offset = 32768, + Length = 32, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 2097152, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 49152, + Length = 4096, + Sequence = 2, + Start = 96 + }, + new Partition + { + Description = null, + Size = 342528, + Name = "Scratch", + Type = "Apple_Scratch", + Offset = 2146304, + Length = 669, + Sequence = 3, + Start = 4192 + }, + new Partition + { + Description = null, + Size = 1417216, + Name = "Eschatology 1", + Type = "Apple_UNIX_SVR2", + Offset = 2488832, + Length = 2768, + Sequence = 4, + Start = 4861 + }, + new Partition + { + Description = null, + Size = 1830912, + Name = "A/UX Root", + Type = "Apple_UNIX_SVR2", + Offset = 3906048, + Length = 3576, + Sequence = 5, + Start = 7629 + }, + new Partition + { + Description = null, + Size = 1448960, + Name = "Swap", + Type = "Apple_UNIX_SVR2", + Offset = 5736960, + Length = 2830, + Sequence = 6, + Start = 11205 + }, + new Partition + { + Description = null, + Size = 2687488, + Name = "Root file system", + Type = "Apple_UNIX_SVR2", + Offset = 7185920, + Length = 5249, + Sequence = 7, + Start = 14035 + }, + new Partition + { + Description = null, + Size = 2565632, + Name = "Usr file system", + Type = "Apple_UNIX_SVR2", + Offset = 9873408, + Length = 5011, + Sequence = 8, + Start = 19284 + }, + new Partition + { + Description = null, + Size = 1954816, + Name = "Unreserved 1", + Type = "Apple_UNIX_SVR2", + Offset = 12439040, + Length = 3818, + Sequence = 9, + Start = 24295 + }, + new Partition + { + Description = null, + Size = 3543040, + Name = "Unreserved 2", + Type = "Apple_UNIX_SVR2", + Offset = 14393856, + Length = 6920, + Sequence = 10, + Start = 28113 + }, + new Partition + { + Description = null, + Size = 2565632, + Name = "Unreserved 3", + Type = "Apple_UNIX_SVR2", + Offset = 17936896, + Length = 5011, + Sequence = 11, + Start = 35033 + }, + new Partition + { + Description = null, + Size = 2932224, + Name = "Unreserved 4", + Type = "Apple_UNIX_SVR2", + Offset = 20502528, + Length = 5727, + Sequence = 12, + Start = 40044 + }, + new Partition + { + Description = null, + Size = 1221632, + Name = "Random A/UX fs", + Type = "Apple_UNIX_SVR2", + Offset = 23434752, + Length = 2386, + Sequence = 13, + Start = 45771 + }, + new Partition + { + Description = null, + Size = 3421696, + Name = "Extra", + Type = "Apple_Free", + Offset = 24656384, + Length = 6683, + Sequence = 14, + Start = 48157 + }, }, // Mac OS 6.0.7 - new []{ - new Partition{ Description = null, Size = 5120, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 10, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver", Offset = 32768, Length = 32, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 14013952, Name = "MacOS", Type = "Apple_HFS", Offset = 49152, Length = 27371, - Sequence = 2, Start = 96 }, - new Partition{ Description = null, Size = 1492992, Name = "Eschatology 1", Type = "Apple_UNIX_SVR2", Offset = 14063104, Length = 2916, - Sequence = 3, Start = 27467 }, - new Partition{ Description = null, Size = 919040, Name = "A/UX Root", Type = "Apple_UNIX_SVR2", Offset = 15556096, Length = 1795, - Sequence = 4, Start = 30383 }, - new Partition{ Description = null, Size = 1302016, Name = "Swap", Type = "Apple_UNIX_SVR2", Offset = 16475136, Length = 2543, - Sequence = 5, Start = 32178 }, - new Partition{ Description = null, Size = 1796608, Name = "Root file system", Type = "Apple_UNIX_SVR2", Offset = 17777152, Length = 3509, - Sequence = 6, Start = 34721 }, - new Partition{ Description = null, Size = 1943552, Name = "Usr file system", Type = "Apple_UNIX_SVR2", Offset = 19573760, Length = 3796, - Sequence = 7, Start = 38230 }, - new Partition{ Description = null, Size = 2186752, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 21517312, Length = 4271, - Sequence = 8, Start = 42026 }, - new Partition{ Description = null, Size = 524288, Name = "Unreserved 1", Type = "Apple_UNIX_SVR2", Offset = 23704064, Length = 1024, - Sequence = 9, Start = 46297 }, - new Partition{ Description = null, Size = 655360, Name = "Unreserved 2", Type = "Apple_UNIX_SVR2", Offset = 24228352, Length = 1280, - Sequence = 10, Start = 47321 }, - new Partition{ Description = null, Size = 798208, Name = "Unreserved 3", Type = "Apple_UNIX_SVR2", Offset = 24883712, Length = 1559, - Sequence = 11, Start = 48601 }, - new Partition{ Description = null, Size = 143360, Name = "Extra", Type = "Apple_Free", Offset = 25681920, Length = 280, - Sequence = 12, Start = 50160 }, - new Partition{ Description = null, Size = 2252800, Name = "Unreserved 4", Type = "Apple_UNIX_SVR2", Offset = 25825280, Length = 4400, - Sequence = 13, Start = 50440 }, + new[] + { + new Partition + { + Description = null, + Size = 5120, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 10, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 16384, + Name = "Macintosh", + Type = "Apple_Driver", + Offset = 32768, + Length = 32, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 14013952, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 49152, + Length = 27371, + Sequence = 2, + Start = 96 + }, + new Partition + { + Description = null, + Size = 1492992, + Name = "Eschatology 1", + Type = "Apple_UNIX_SVR2", + Offset = 14063104, + Length = 2916, + Sequence = 3, + Start = 27467 + }, + new Partition + { + Description = null, + Size = 919040, + Name = "A/UX Root", + Type = "Apple_UNIX_SVR2", + Offset = 15556096, + Length = 1795, + Sequence = 4, + Start = 30383 + }, + new Partition + { + Description = null, + Size = 1302016, + Name = "Swap", + Type = "Apple_UNIX_SVR2", + Offset = 16475136, + Length = 2543, + Sequence = 5, + Start = 32178 + }, + new Partition + { + Description = null, + Size = 1796608, + Name = "Root file system", + Type = "Apple_UNIX_SVR2", + Offset = 17777152, + Length = 3509, + Sequence = 6, + Start = 34721 + }, + new Partition + { + Description = null, + Size = 1943552, + Name = "Usr file system", + Type = "Apple_UNIX_SVR2", + Offset = 19573760, + Length = 3796, + Sequence = 7, + Start = 38230 + }, + new Partition + { + Description = null, + Size = 2186752, + Name = "Random A/UX fs", + Type = "Apple_UNIX_SVR2", + Offset = 21517312, + Length = 4271, + Sequence = 8, + Start = 42026 + }, + new Partition + { + Description = null, + Size = 524288, + Name = "Unreserved 1", + Type = "Apple_UNIX_SVR2", + Offset = 23704064, + Length = 1024, + Sequence = 9, + Start = 46297 + }, + new Partition + { + Description = null, + Size = 655360, + Name = "Unreserved 2", + Type = "Apple_UNIX_SVR2", + Offset = 24228352, + Length = 1280, + Sequence = 10, + Start = 47321 + }, + new Partition + { + Description = null, + Size = 798208, + Name = "Unreserved 3", + Type = "Apple_UNIX_SVR2", + Offset = 24883712, + Length = 1559, + Sequence = 11, + Start = 48601 + }, + new Partition + { + Description = null, + Size = 143360, + Name = "Extra", + Type = "Apple_Free", + Offset = 25681920, + Length = 280, + Sequence = 12, + Start = 50160 + }, + new Partition + { + Description = null, + Size = 2252800, + Name = "Unreserved 4", + Type = "Apple_UNIX_SVR2", + Offset = 25825280, + Length = 4400, + Sequence = 13, + Start = 50440 + }, }, // Mac OS 6.0.8 - new []{ - new Partition{ Description = null, Size = 5120, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 10, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver", Offset = 32768, Length = 32, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 4575744, Name = "MacOS", Type = "Apple_HFS", Offset = 49152, Length = 8937, - Sequence = 2, Start = 96 }, - new Partition{ Description = null, Size = 1143808, Name = "Scratch", Type = "Apple_Scratch", Offset = 4624896, Length = 2234, - Sequence = 3, Start = 9033 }, - new Partition{ Description = null, Size = 3020800, Name = "Eschatology 1", Type = "Apple_UNIX_SVR2", Offset = 5768704, Length = 5900, - Sequence = 4, Start = 11267 }, - new Partition{ Description = null, Size = 1615872, Name = "Unreserved 1", Type = "Apple_UNIX_SVR2", Offset = 8789504, Length = 3156, - Sequence = 5, Start = 17167 }, - new Partition{ Description = null, Size = 1384960, Name = "Unreserved 3", Type = "Apple_UNIX_SVR2", Offset = 10405376, Length = 2705, - Sequence = 6, Start = 20323 }, - new Partition{ Description = null, Size = 952832, Name = "Unreserved 4", Type = "Apple_UNIX_SVR2", Offset = 11790336, Length = 1861, - Sequence = 7, Start = 23028 }, - new Partition{ Description = null, Size = 1246208, Name = "Extra", Type = "Apple_Free", Offset = 12743168, Length = 2434, - Sequence = 8, Start = 24889 }, - new Partition{ Description = null, Size = 1495040, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 13989376, Length = 2920, - Sequence = 9, Start = 27323 }, - new Partition{ Description = null, Size = 1615872, Name = "Unreserved 2", Type = "Apple_UNIX_SVR2", Offset = 15484416, Length = 3156, - Sequence = 10, Start = 30243 }, - new Partition{ Description = null, Size = 2885120, Name = "Usr file system", Type = "Apple_UNIX_SVR2", Offset = 17100288, Length = 5635, - Sequence = 11, Start = 33399 }, - new Partition{ Description = null, Size = 2308096, Name = "Root file system", Type = "Apple_UNIX_SVR2", Offset = 19985408, Length = 4508, - Sequence = 12, Start = 39034 }, - new Partition{ Description = null, Size = 3693056, Name = "Swap", Type = "Apple_UNIX_SVR2", Offset = 22293504, Length = 7213, - Sequence = 13, Start = 43542 }, - new Partition{ Description = null, Size = 2091520, Name = "A/UX Root", Type = "Apple_UNIX_SVR2", Offset = 25986560, Length = 4085, - Sequence = 14, Start = 50755 }, + new[] + { + new Partition + { + Description = null, + Size = 5120, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 10, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 16384, + Name = "Macintosh", + Type = "Apple_Driver", + Offset = 32768, + Length = 32, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 4575744, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 49152, + Length = 8937, + Sequence = 2, + Start = 96 + }, + new Partition + { + Description = null, + Size = 1143808, + Name = "Scratch", + Type = "Apple_Scratch", + Offset = 4624896, + Length = 2234, + Sequence = 3, + Start = 9033 + }, + new Partition + { + Description = null, + Size = 3020800, + Name = "Eschatology 1", + Type = "Apple_UNIX_SVR2", + Offset = 5768704, + Length = 5900, + Sequence = 4, + Start = 11267 + }, + new Partition + { + Description = null, + Size = 1615872, + Name = "Unreserved 1", + Type = "Apple_UNIX_SVR2", + Offset = 8789504, + Length = 3156, + Sequence = 5, + Start = 17167 + }, + new Partition + { + Description = null, + Size = 1384960, + Name = "Unreserved 3", + Type = "Apple_UNIX_SVR2", + Offset = 10405376, + Length = 2705, + Sequence = 6, + Start = 20323 + }, + new Partition + { + Description = null, + Size = 952832, + Name = "Unreserved 4", + Type = "Apple_UNIX_SVR2", + Offset = 11790336, + Length = 1861, + Sequence = 7, + Start = 23028 + }, + new Partition + { + Description = null, + Size = 1246208, + Name = "Extra", + Type = "Apple_Free", + Offset = 12743168, + Length = 2434, + Sequence = 8, + Start = 24889 + }, + new Partition + { + Description = null, + Size = 1495040, + Name = "Random A/UX fs", + Type = "Apple_UNIX_SVR2", + Offset = 13989376, + Length = 2920, + Sequence = 9, + Start = 27323 + }, + new Partition + { + Description = null, + Size = 1615872, + Name = "Unreserved 2", + Type = "Apple_UNIX_SVR2", + Offset = 15484416, + Length = 3156, + Sequence = 10, + Start = 30243 + }, + new Partition + { + Description = null, + Size = 2885120, + Name = "Usr file system", + Type = "Apple_UNIX_SVR2", + Offset = 17100288, + Length = 5635, + Sequence = 11, + Start = 33399 + }, + new Partition + { + Description = null, + Size = 2308096, + Name = "Root file system", + Type = "Apple_UNIX_SVR2", + Offset = 19985408, + Length = 4508, + Sequence = 12, + Start = 39034 + }, + new Partition + { + Description = null, + Size = 3693056, + Name = "Swap", + Type = "Apple_UNIX_SVR2", + Offset = 22293504, + Length = 7213, + Sequence = 13, + Start = 43542 + }, + new Partition + { + Description = null, + Size = 2091520, + Name = "A/UX Root", + Type = "Apple_UNIX_SVR2", + Offset = 25986560, + Length = 4085, + Sequence = 14, + Start = 50755 + }, }, // Mac OS 6.0 - new []{ - new Partition{ Description = null, Size = 5120, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 10, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver", Offset = 32768, Length = 32, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 2097152, Name = "MacOS", Type = "Apple_HFS", Offset = 49152, Length = 4096, - Sequence = 2, Start = 96 }, - new Partition{ Description = null, Size = 2097152, Name = "Scratch", Type = "Apple_Scratch", Offset = 2146304, Length = 4096, - Sequence = 3, Start = 4192 }, - new Partition{ Description = null, Size = 2097152, Name = "Eschatology 1", Type = "Apple_UNIX_SVR2", Offset = 4243456, Length = 4096, - Sequence = 4, Start = 8288 }, - new Partition{ Description = null, Size = 2097152, Name = "A/UX Root", Type = "Apple_UNIX_SVR2", Offset = 6340608, Length = 4096, - Sequence = 5, Start = 12384 }, - new Partition{ Description = null, Size = 1048576, Name = "Swap", Type = "Apple_UNIX_SVR2", Offset = 8437760, Length = 2048, - Sequence = 6, Start = 16480 }, - new Partition{ Description = null, Size = 2097152, Name = "Eschatology 2", Type = "Apple_UNIX_SVR2", Offset = 9486336, Length = 4096, - Sequence = 7, Start = 18528 }, - new Partition{ Description = null, Size = 2097152, Name = "Root file system", Type = "Apple_UNIX_SVR2", Offset = 11583488, Length = 4096, - Sequence = 8, Start = 22624 }, - new Partition{ Description = null, Size = 2310144, Name = "Usr file system", Type = "Apple_UNIX_SVR2", Offset = 13680640, Length = 4512, - Sequence = 9, Start = 26720 }, - new Partition{ Description = null, Size = 5416960, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 15990784, Length = 10580, - Sequence = 10, Start = 31232 }, - new Partition{ Description = null, Size = 4096, Name = "Extra", Type = "Apple_Free", Offset = 21407744, Length = 8, - Sequence = 11, Start = 41812 }, + new[] + { + new Partition + { + Description = null, + Size = 5120, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 10, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 16384, + Name = "Macintosh", + Type = "Apple_Driver", + Offset = 32768, + Length = 32, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 2097152, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 49152, + Length = 4096, + Sequence = 2, + Start = 96 + }, + new Partition + { + Description = null, + Size = 2097152, + Name = "Scratch", + Type = "Apple_Scratch", + Offset = 2146304, + Length = 4096, + Sequence = 3, + Start = 4192 + }, + new Partition + { + Description = null, + Size = 2097152, + Name = "Eschatology 1", + Type = "Apple_UNIX_SVR2", + Offset = 4243456, + Length = 4096, + Sequence = 4, + Start = 8288 + }, + new Partition + { + Description = null, + Size = 2097152, + Name = "A/UX Root", + Type = "Apple_UNIX_SVR2", + Offset = 6340608, + Length = 4096, + Sequence = 5, + Start = 12384 + }, + new Partition + { + Description = null, + Size = 1048576, + Name = "Swap", + Type = "Apple_UNIX_SVR2", + Offset = 8437760, + Length = 2048, + Sequence = 6, + Start = 16480 + }, + new Partition + { + Description = null, + Size = 2097152, + Name = "Eschatology 2", + Type = "Apple_UNIX_SVR2", + Offset = 9486336, + Length = 4096, + Sequence = 7, + Start = 18528 + }, + new Partition + { + Description = null, + Size = 2097152, + Name = "Root file system", + Type = "Apple_UNIX_SVR2", + Offset = 11583488, + Length = 4096, + Sequence = 8, + Start = 22624 + }, + new Partition + { + Description = null, + Size = 2310144, + Name = "Usr file system", + Type = "Apple_UNIX_SVR2", + Offset = 13680640, + Length = 4512, + Sequence = 9, + Start = 26720 + }, + new Partition + { + Description = null, + Size = 5416960, + Name = "Random A/UX fs", + Type = "Apple_UNIX_SVR2", + Offset = 15990784, + Length = 10580, + Sequence = 10, + Start = 31232 + }, + new Partition + { + Description = null, + Size = 4096, + Name = "Extra", + Type = "Apple_Free", + Offset = 21407744, + Length = 8, + Sequence = 11, + Start = 41812 + }, }, // Mac OS 7.0 - new []{ - new Partition{ Description = null, Size = 5120, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 10, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver", Offset = 32768, Length = 32, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 3073024, Name = "Scratch", Type = "Apple_Scratch", Offset = 49152, Length = 6002, - Sequence = 2, Start = 96 }, - new Partition{ Description = null, Size = 2726400, Name = "Root file system", Type = "Apple_UNIX_SVR2", Offset = 3122176, Length = 5325, - Sequence = 3, Start = 6098 }, - new Partition{ Description = null, Size = 3180544, Name = "Extra", Type = "Apple_Free", Offset = 5848576, Length = 6212, - Sequence = 4, Start = 11423 }, - new Partition{ Description = null, Size = 4203520, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 9029120, Length = 8210, - Sequence = 5, Start = 17635 }, - new Partition{ Description = null, Size = 2613248, Name = "Extra", Type = "Apple_Free", Offset = 13232640, Length = 5104, - Sequence = 6, Start = 25845 }, - new Partition{ Description = null, Size = 5262336, Name = "MacOS", Type = "Apple_HFS", Offset = 15845888, Length = 10278, - Sequence = 7, Start = 30949 }, - new Partition{ Description = null, Size = 1707520, Name = "Eschatology 1", Type = "Apple_UNIX_SVR2", Offset = 21108224, Length = 3335, - Sequence = 8, Start = 41227 }, - new Partition{ Description = null, Size = 5262336, Name = "Extra", Type = "Apple_Free", Offset = 22815744, Length = 10278, - Sequence = 9, Start = 44562 }, + new[] + { + new Partition + { + Description = null, + Size = 5120, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 10, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 16384, + Name = "Macintosh", + Type = "Apple_Driver", + Offset = 32768, + Length = 32, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 3073024, + Name = "Scratch", + Type = "Apple_Scratch", + Offset = 49152, + Length = 6002, + Sequence = 2, + Start = 96 + }, + new Partition + { + Description = null, + Size = 2726400, + Name = "Root file system", + Type = "Apple_UNIX_SVR2", + Offset = 3122176, + Length = 5325, + Sequence = 3, + Start = 6098 + }, + new Partition + { + Description = null, + Size = 3180544, + Name = "Extra", + Type = "Apple_Free", + Offset = 5848576, + Length = 6212, + Sequence = 4, + Start = 11423 + }, + new Partition + { + Description = null, + Size = 4203520, + Name = "Random A/UX fs", + Type = "Apple_UNIX_SVR2", + Offset = 9029120, + Length = 8210, + Sequence = 5, + Start = 17635 + }, + new Partition + { + Description = null, + Size = 2613248, + Name = "Extra", + Type = "Apple_Free", + Offset = 13232640, + Length = 5104, + Sequence = 6, + Start = 25845 + }, + new Partition + { + Description = null, + Size = 5262336, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 15845888, + Length = 10278, + Sequence = 7, + Start = 30949 + }, + new Partition + { + Description = null, + Size = 1707520, + Name = "Eschatology 1", + Type = "Apple_UNIX_SVR2", + Offset = 21108224, + Length = 3335, + Sequence = 8, + Start = 41227 + }, + new Partition + { + Description = null, + Size = 5262336, + Name = "Extra", + Type = "Apple_Free", + Offset = 22815744, + Length = 10278, + Sequence = 9, + Start = 44562 + }, }, // Mac OS 7.1.1 - new []{ - new Partition{ Description = null, Size = 8704, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 17, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver43", Offset = 32768, Length = 32, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 1486848, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 49152, Length = 2904, - Sequence = 2, Start = 96 }, - new Partition{ Description = null, Size = 2097152, Name = "ProDOS", Type = "Apple_PRODOS", Offset = 1536000, Length = 4096, - Sequence = 3, Start = 3000 }, - new Partition{ Description = null, Size = 1564160, Name = "Extra", Type = "Apple_Free", Offset = 3633152, Length = 3055, - Sequence = 4, Start = 7096 }, - new Partition{ Description = null, Size = 2097152, Name = "ProDOS", Type = "Apple_PRODOS", Offset = 5197312, Length = 4096, - Sequence = 5, Start = 10151 }, - new Partition{ Description = null, Size = 5148160, Name = "MacOS", Type = "Apple_HFS", Offset = 7294464, Length = 10055, - Sequence = 6, Start = 14247 }, - new Partition{ Description = null, Size = 4406784, Name = "Extra", Type = "Apple_Free", Offset = 12442624, Length = 8607, - Sequence = 7, Start = 24302 }, - new Partition{ Description = null, Size = 2485760, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 16849408, Length = 4855, - Sequence = 8, Start = 32909 }, - new Partition{ Description = null, Size = 4746240, Name = "Extra", Type = "Apple_Free", Offset = 19335168, Length = 9270, - Sequence = 9, Start = 37764 }, - new Partition{ Description = null, Size = 3996672, Name = "A/UX Root", Type = "Apple_UNIX_SVR2", Offset = 24081408, Length = 7806, - Sequence = 10, Start = 47034 }, + new[] + { + new Partition + { + Description = null, + Size = 8704, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 17, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 16384, + Name = "Macintosh", + Type = "Apple_Driver43", + Offset = 32768, + Length = 32, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 1486848, + Name = "Random A/UX fs", + Type = "Apple_UNIX_SVR2", + Offset = 49152, + Length = 2904, + Sequence = 2, + Start = 96 + }, + new Partition + { + Description = null, + Size = 2097152, + Name = "ProDOS", + Type = "Apple_PRODOS", + Offset = 1536000, + Length = 4096, + Sequence = 3, + Start = 3000 + }, + new Partition + { + Description = null, + Size = 1564160, + Name = "Extra", + Type = "Apple_Free", + Offset = 3633152, + Length = 3055, + Sequence = 4, + Start = 7096 + }, + new Partition + { + Description = null, + Size = 2097152, + Name = "ProDOS", + Type = "Apple_PRODOS", + Offset = 5197312, + Length = 4096, + Sequence = 5, + Start = 10151 + }, + new Partition + { + Description = null, + Size = 5148160, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 7294464, + Length = 10055, + Sequence = 6, + Start = 14247 + }, + new Partition + { + Description = null, + Size = 4406784, + Name = "Extra", + Type = "Apple_Free", + Offset = 12442624, + Length = 8607, + Sequence = 7, + Start = 24302 + }, + new Partition + { + Description = null, + Size = 2485760, + Name = "Random A/UX fs", + Type = "Apple_UNIX_SVR2", + Offset = 16849408, + Length = 4855, + Sequence = 8, + Start = 32909 + }, + new Partition + { + Description = null, + Size = 4746240, + Name = "Extra", + Type = "Apple_Free", + Offset = 19335168, + Length = 9270, + Sequence = 9, + Start = 37764 + }, + new Partition + { + Description = null, + Size = 3996672, + Name = "A/UX Root", + Type = "Apple_UNIX_SVR2", + Offset = 24081408, + Length = 7806, + Sequence = 10, + Start = 47034 + }, }, // Mac OS 7.5 - new []{ - new Partition{ Description = null, Size = 9216, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 18, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver43", Offset = 32768, Length = 32, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 28028928, Name = "MacOS", Type = "Apple_HFS", Offset = 49152, Length = 54744, - Sequence = 2, Start = 96 }, + new[] + { + new Partition + { + Description = null, + Size = 9216, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 18, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 16384, + Name = "Macintosh", + Type = "Apple_Driver43", + Offset = 32768, + Length = 32, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 28028928, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 49152, + Length = 54744, + Sequence = 2, + Start = 96 + }, }, // GNU Parted - new []{ - new Partition{ Description = null, Size = 2064384, Name = "Extra", Type = "Apple_Free", Offset = 32768, Length = 4032, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 47185920, Name = "untitled", Type = "Apple_HFS", Offset = 2097152, Length = 92160, - Sequence = 1, Start = 4096 }, - new Partition{ Description = null, Size = 84934656, Name = "untitled", Type = "Apple_UNIX_SVR2", Offset = 49283072, Length = 165888, - Sequence = 2, Start = 96256 }, + new[] + { + new Partition + { + Description = null, + Size = 2064384, + Name = "Extra", + Type = "Apple_Free", + Offset = 32768, + Length = 4032, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 47185920, + Name = "untitled", + Type = "Apple_HFS", + Offset = 2097152, + Length = 92160, + Sequence = 1, + Start = 4096 + }, + new Partition + { + Description = null, + Size = 84934656, + Name = "untitled", + Type = "Apple_UNIX_SVR2", + Offset = 49283072, + Length = 165888, + Sequence = 2, + Start = 96256 + }, }, // Silverlining 2.2.1 - new []{ - new Partition{ Description = null, Size = 3072, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 6, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 65536, Name = "Macintosh_SL", Type = "Apple_Driver43", Offset = 32768, Length = 128, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 25088, Name = null, Type = "Apple_Driver", Offset = 98304, Length = 49, - Sequence = 2, Start = 192 }, - new Partition{ Description = null, Size = 65536, Name = "Macintosh_SL", Type = "Apple_Driver_ATA", Offset = 98304, Length = 128, - Sequence = 3, Start = 192 }, - new Partition{ Description = null, Size = 25804800, Name = "Untitled #1", Type = "Apple_HFS", Offset = 163840, Length = 50400, - Sequence = 4, Start = 320 }, - new Partition{ Description = null, Size = 237568, Name = "Extra", Type = "Apple_Free", Offset = 25968640, Length = 464, - Sequence = 5, Start = 50720 }, + new[] + { + new Partition + { + Description = null, + Size = 3072, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 6, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 65536, + Name = "Macintosh_SL", + Type = "Apple_Driver43", + Offset = 32768, + Length = 128, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 25088, + Name = null, + Type = "Apple_Driver", + Offset = 98304, + Length = 49, + Sequence = 2, + Start = 192 + }, + new Partition + { + Description = null, + Size = 65536, + Name = "Macintosh_SL", + Type = "Apple_Driver_ATA", + Offset = 98304, + Length = 128, + Sequence = 3, + Start = 192 + }, + new Partition + { + Description = null, + Size = 25804800, + Name = "Untitled #1", + Type = "Apple_HFS", + Offset = 163840, + Length = 50400, + Sequence = 4, + Start = 320 + }, + new Partition + { + Description = null, + Size = 237568, + Name = "Extra", + Type = "Apple_Free", + Offset = 25968640, + Length = 464, + Sequence = 5, + Start = 50720 + }, }, // Hard Disk Speed Tools 3.6 - new []{ - new Partition{ Description = null, Size = 13824, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 27, - Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 51200, Name = "Macintosh", Type = "Apple_Driver43", Offset = 32768, Length = 100, - Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 25165824, Name = "untitled", Type = "Apple_HFS", Offset = 83968, Length = 49152, - Sequence = 2, Start = 164 }, - new Partition{ Description = null, Size = 963584, Name = "Extra", Type = "Apple_Free", Offset = 25249792, Length = 1882, - Sequence = 3, Start = 49316 }, + new[] + { + new Partition + { + Description = null, + Size = 13824, + Name = null, + Type = "Apple_Driver", + Offset = 32768, + Length = 27, + Sequence = 0, + Start = 64 + }, + new Partition + { + Description = null, + Size = 51200, + Name = "Macintosh", + Type = "Apple_Driver43", + Offset = 32768, + Length = 100, + Sequence = 1, + Start = 64 + }, + new Partition + { + Description = null, + Size = 25165824, + Name = "untitled", + Type = "Apple_HFS", + Offset = 83968, + Length = 49152, + Sequence = 2, + Start = 164 + }, + new Partition + { + Description = null, + Size = 963584, + Name = "Extra", + Type = "Apple_Free", + Offset = 25249792, + Length = 1882, + Sequence = 3, + Start = 49316 + }, }, // VCP Formatter 2.1.1 - new []{ - new Partition{ Description = null, Size = 12288, Name = null, Type = "Apple_Driver", Offset = 57344, Length = 24, - Sequence = 0, Start = 112 }, - new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver", Offset = 57344, Length = 32, - Sequence = 1, Start = 112 }, - new Partition{ Description = null, Size = 16384, Name = "Extra", Type = "Apple_Free", Offset = 73728, Length = 32, - Sequence = 2, Start = 144 }, - new Partition{ Description = null, Size = 27986944, Name = "MacOS", Type = "Apple_HFS", Offset = 90112, Length = 54662, - Sequence = 3, Start = 176 }, + new[] + { + new Partition + { + Description = null, + Size = 12288, + Name = null, + Type = "Apple_Driver", + Offset = 57344, + Length = 24, + Sequence = 0, + Start = 112 + }, + new Partition + { + Description = null, + Size = 16384, + Name = "Macintosh", + Type = "Apple_Driver", + Offset = 57344, + Length = 32, + Sequence = 1, + Start = 112 + }, + new Partition + { + Description = null, + Size = 16384, + Name = "Extra", + Type = "Apple_Free", + Offset = 73728, + Length = 32, + Sequence = 2, + Start = 144 + }, + new Partition + { + Description = null, + Size = 27986944, + Name = "MacOS", + Type = "Apple_HFS", + Offset = 90112, + Length = 54662, + Sequence = 3, + Start = 176 + }, // TODO: ADFS tries to read past this partition... - new Partition{ Description = null, Size = 1024, Name = "Extra", Type = "Apple_Free", Offset = 28077056, Length = 2, - Sequence = 4, Start = 54838 }, + new Partition + { + Description = null, + Size = 1024, + Name = "Extra", + Type = "Apple_Free", + Offset = 28077056, + Length = 2, + Sequence = 4, + Start = 54838 + }, }, - }; + }; [Test] public void Test() @@ -487,4 +2025,4 @@ namespace DiscImageChef.Tests.Partitions } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Partitions/Atari.cs b/DiscImageChef.Tests/Partitions/Atari.cs index b178d1d3..d41f228b 100644 --- a/DiscImageChef.Tests/Partitions/Atari.cs +++ b/DiscImageChef.Tests/Partitions/Atari.cs @@ -39,67 +39,276 @@ namespace DiscImageChef.Tests.Partitions [TestFixture] public class Atari { - readonly string[] testfiles = { - "linux_ahdi.vdi.lz","linux_icd.vdi.lz","tos_1.04.vdi.lz", - }; + readonly string[] testfiles = {"linux_ahdi.vdi.lz", "linux_icd.vdi.lz", "tos_1.04.vdi.lz",}; - readonly Partition[][] wanted = { + readonly Partition[][] wanted = + { // Linux (AHDI) - new []{ - new Partition{ Description = null, Size = 31457280, Name = null, Type = "GEM", Offset = 512, Length = 61440, - Sequence = 0, Start = 1 }, - new Partition{ Description = null, Size = 41943040, Name = null, Type = "BGM", Offset = 31457792, Length = 81920, - Sequence = 1, Start = 61441 }, - new Partition{ Description = null, Size = 56402432, Name = null, Type = "LNX", Offset = 73400832, Length = 110161, - Sequence = 2, Start = 143361 }, - new Partition{ Description = null, Size = 43212800, Name = null, Type = "MAC", Offset = 129803264, Length = 84400, - Sequence = 3, Start = 253522 }, - new Partition{ Description = null, Size = 57671680, Name = null, Type = "MIX", Offset = 173016064, Length = 112640, - Sequence = 4, Start = 337922 }, - new Partition{ Description = null, Size = 62914560, Name = null, Type = "MNX", Offset = 230687744, Length = 122880, - Sequence = 5, Start = 450562 }, - new Partition{ Description = null, Size = 73400320, Name = null, Type = "RAW", Offset = 293602304, Length = 143360, - Sequence = 6, Start = 573442 }, - new Partition{ Description = null, Size = 78643200, Name = null, Type = "SWP", Offset = 367002624, Length = 153600, - Sequence = 7, Start = 716802 }, - new Partition{ Description = null, Size = 1048576, Name = null, Type = "UNX", Offset = 445645824, Length = 2048, - Sequence = 8, Start = 870402 }, - new Partition{ Description = null, Size = 77593600, Name = null, Type = "LNX", Offset = 446694400, Length = 151550, - Sequence = 9, Start = 872450 }, + new[] + { + new Partition + { + Description = null, + Size = 31457280, + Name = null, + Type = "GEM", + Offset = 512, + Length = 61440, + Sequence = 0, + Start = 1 + }, + new Partition + { + Description = null, + Size = 41943040, + Name = null, + Type = "BGM", + Offset = 31457792, + Length = 81920, + Sequence = 1, + Start = 61441 + }, + new Partition + { + Description = null, + Size = 56402432, + Name = null, + Type = "LNX", + Offset = 73400832, + Length = 110161, + Sequence = 2, + Start = 143361 + }, + new Partition + { + Description = null, + Size = 43212800, + Name = null, + Type = "MAC", + Offset = 129803264, + Length = 84400, + Sequence = 3, + Start = 253522 + }, + new Partition + { + Description = null, + Size = 57671680, + Name = null, + Type = "MIX", + Offset = 173016064, + Length = 112640, + Sequence = 4, + Start = 337922 + }, + new Partition + { + Description = null, + Size = 62914560, + Name = null, + Type = "MNX", + Offset = 230687744, + Length = 122880, + Sequence = 5, + Start = 450562 + }, + new Partition + { + Description = null, + Size = 73400320, + Name = null, + Type = "RAW", + Offset = 293602304, + Length = 143360, + Sequence = 6, + Start = 573442 + }, + new Partition + { + Description = null, + Size = 78643200, + Name = null, + Type = "SWP", + Offset = 367002624, + Length = 153600, + Sequence = 7, + Start = 716802 + }, + new Partition + { + Description = null, + Size = 1048576, + Name = null, + Type = "UNX", + Offset = 445645824, + Length = 2048, + Sequence = 8, + Start = 870402 + }, + new Partition + { + Description = null, + Size = 77593600, + Name = null, + Type = "LNX", + Offset = 446694400, + Length = 151550, + Sequence = 9, + Start = 872450 + }, }, // Linux (ICD) - new []{ - new Partition{ Description = null, Size = 15728640, Name = null, Type = "GEM", Offset = 512, Length = 30720, - Sequence = 0, Start = 1 }, - new Partition{ Description = null, Size = 20971520, Name = null, Type = "UNX", Offset = 15729152, Length = 40960, - Sequence = 1, Start = 30721 }, - new Partition{ Description = null, Size = 31457280, Name = null, Type = "LNX", Offset = 36700672, Length = 61440, - Sequence = 2, Start = 71681 }, - new Partition{ Description = null, Size = 41943040, Name = null, Type = "BGM", Offset = 68157952, Length = 81920, - Sequence = 3, Start = 133121 }, - new Partition{ Description = null, Size = 52428800, Name = null, Type = "MAC", Offset = 110100992, Length = 102400, - Sequence = 4, Start = 215041 }, - new Partition{ Description = null, Size = 62914560, Name = null, Type = "MIX", Offset = 162529792, Length = 122880, - Sequence = 5, Start = 317441 }, - new Partition{ Description = null, Size = 83886080, Name = null, Type = "SWP", Offset = 225444352, Length = 163840, - Sequence = 6, Start = 440321 }, - new Partition{ Description = null, Size = 103809024, Name = null, Type = "MNX", Offset = 309330432, Length = 202752, - Sequence = 7, Start = 604161 }, - new Partition{ Description = null, Size = 104857600, Name = null, Type = "LNX", Offset = 413139456, Length = 204800, - Sequence = 8, Start = 806913 }, + new[] + { + new Partition + { + Description = null, + Size = 15728640, + Name = null, + Type = "GEM", + Offset = 512, + Length = 30720, + Sequence = 0, + Start = 1 + }, + new Partition + { + Description = null, + Size = 20971520, + Name = null, + Type = "UNX", + Offset = 15729152, + Length = 40960, + Sequence = 1, + Start = 30721 + }, + new Partition + { + Description = null, + Size = 31457280, + Name = null, + Type = "LNX", + Offset = 36700672, + Length = 61440, + Sequence = 2, + Start = 71681 + }, + new Partition + { + Description = null, + Size = 41943040, + Name = null, + Type = "BGM", + Offset = 68157952, + Length = 81920, + Sequence = 3, + Start = 133121 + }, + new Partition + { + Description = null, + Size = 52428800, + Name = null, + Type = "MAC", + Offset = 110100992, + Length = 102400, + Sequence = 4, + Start = 215041 + }, + new Partition + { + Description = null, + Size = 62914560, + Name = null, + Type = "MIX", + Offset = 162529792, + Length = 122880, + Sequence = 5, + Start = 317441 + }, + new Partition + { + Description = null, + Size = 83886080, + Name = null, + Type = "SWP", + Offset = 225444352, + Length = 163840, + Sequence = 6, + Start = 440321 + }, + new Partition + { + Description = null, + Size = 103809024, + Name = null, + Type = "MNX", + Offset = 309330432, + Length = 202752, + Sequence = 7, + Start = 604161 + }, + new Partition + { + Description = null, + Size = 104857600, + Name = null, + Type = "LNX", + Offset = 413139456, + Length = 204800, + Sequence = 8, + Start = 806913 + }, }, // TOS 1.04 - new []{ - new Partition{ Description = null, Size = 7340032, Name = null, Type = "GEM", Offset = 1024, Length = 14336, - Sequence = 0, Start = 2 }, - new Partition{ Description = null, Size = 7340032, Name = null, Type = "GEM", Offset = 7341056, Length = 14336, - Sequence = 1, Start = 14338 }, - new Partition{ Description = null, Size = 7340032, Name = null, Type = "GEM", Offset = 14681088, Length = 14336, - Sequence = 2, Start = 28674 }, - new Partition{ Description = null, Size = 7339008, Name = null, Type = "GEM", Offset = 22021120, Length = 14334, - Sequence = 3, Start = 43010 }, + new[] + { + new Partition + { + Description = null, + Size = 7340032, + Name = null, + Type = "GEM", + Offset = 1024, + Length = 14336, + Sequence = 0, + Start = 2 + }, + new Partition + { + Description = null, + Size = 7340032, + Name = null, + Type = "GEM", + Offset = 7341056, + Length = 14336, + Sequence = 1, + Start = 14338 + }, + new Partition + { + Description = null, + Size = 7340032, + Name = null, + Type = "GEM", + Offset = 14681088, + Length = 14336, + Sequence = 2, + Start = 28674 + }, + new Partition + { + Description = null, + Size = 7339008, + Name = null, + Type = "GEM", + Offset = 22021120, + Length = 14334, + Sequence = 3, + Start = 43010 + }, }, - }; + }; [Test] public void Test() @@ -128,4 +337,4 @@ namespace DiscImageChef.Tests.Partitions } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Partitions/BSD.cs b/DiscImageChef.Tests/Partitions/BSD.cs index 18ecbdb8..d8f7d675 100644 --- a/DiscImageChef.Tests/Partitions/BSD.cs +++ b/DiscImageChef.Tests/Partitions/BSD.cs @@ -39,84 +39,349 @@ namespace DiscImageChef.Tests.Partitions [TestFixture] public class BSD { - readonly string[] testfiles = { - "parted.vdi.lz","netbsd_1.6.vdi.lz","netbsd_6.1.5.vdi.lz","netbsd_7.1.vdi.lz" - }; + readonly string[] testfiles = + {"parted.vdi.lz", "netbsd_1.6.vdi.lz", "netbsd_6.1.5.vdi.lz", "netbsd_7.1.vdi.lz"}; - readonly Partition[][] wanted = { + readonly Partition[][] wanted = + { // Parted - new []{ - new Partition{ Description = null, Size = 38797312, Name = null, Type = "FAT", Offset = 1048576, Length = 75776, - Sequence = 0, Start = 2048 }, - new Partition{ Description = null, Size = 19922944, Name = null, Type = "FAT", Offset = 40894464, Length = 38912, - Sequence = 1, Start = 79872 }, - new Partition{ Description = null, Size = 48234496, Name = null, Type = "FAT", Offset = 61865984, Length = 94208, - Sequence = 2, Start = 120832 }, + new[] + { + new Partition + { + Description = null, + Size = 38797312, + Name = null, + Type = "FAT", + Offset = 1048576, + Length = 75776, + Sequence = 0, + Start = 2048 + }, + new Partition + { + Description = null, + Size = 19922944, + Name = null, + Type = "FAT", + Offset = 40894464, + Length = 38912, + Sequence = 1, + Start = 79872 + }, + new Partition + { + Description = null, + Size = 48234496, + Name = null, + Type = "FAT", + Offset = 61865984, + Length = 94208, + Sequence = 2, + Start = 120832 + }, }, // NetBSD 1.6 - new []{ - new Partition{ Description = null, Size = 10453504, Name = null, Type = "FAT", Offset = 516096, Length = 20417, - Sequence = 0, Start = 1008 }, - new Partition{ Description = null, Size = 209715200, Name = null, Type = "FAT", Offset = 11354112, Length = 409600, - Sequence = 1, Start = 22176 }, - new Partition{ Description = null, Size = 805306368, Name = null, Type = "FAT", Offset = 221405184, Length = 1572864, - Sequence = 2, Start = 432432 }, - new Partition{ Description = null, Size = 747656192, Name = null, Type = "4.2BSD Fast File System", Offset = 1027031040, Length = 1460266, - Sequence = 3, Start = 2005920 }, - new Partition{ Description = null, Size = 268435456, Name = null, Type = "4.4LFS", Offset = 1774854144, Length = 524288, - Sequence = 4, Start = 3466512 }, - new Partition{ Description = null, Size = 103743488, Name = null, Type = "4.2BSD Fast File System", Offset = 2043740160, Length = 202624, - Sequence = 5, Start = 3991680 }, + new[] + { + new Partition + { + Description = null, + Size = 10453504, + Name = null, + Type = "FAT", + Offset = 516096, + Length = 20417, + Sequence = 0, + Start = 1008 + }, + new Partition + { + Description = null, + Size = 209715200, + Name = null, + Type = "FAT", + Offset = 11354112, + Length = 409600, + Sequence = 1, + Start = 22176 + }, + new Partition + { + Description = null, + Size = 805306368, + Name = null, + Type = "FAT", + Offset = 221405184, + Length = 1572864, + Sequence = 2, + Start = 432432 + }, + new Partition + { + Description = null, + Size = 747656192, + Name = null, + Type = "4.2BSD Fast File System", + Offset = 1027031040, + Length = 1460266, + Sequence = 3, + Start = 2005920 + }, + new Partition + { + Description = null, + Size = 268435456, + Name = null, + Type = "4.4LFS", + Offset = 1774854144, + Length = 524288, + Sequence = 4, + Start = 3466512 + }, + new Partition + { + Description = null, + Size = 103743488, + Name = null, + Type = "4.2BSD Fast File System", + Offset = 2043740160, + Length = 202624, + Sequence = 5, + Start = 3991680 + }, }, // NetBSD 6.1.5 - new []{ - new Partition{ Description = null, Size = 10485760, Name = null, Type = "FAT", Offset = 516096, Length = 20480, - Sequence = 0, Start = 1008 }, - new Partition{ Description = null, Size = 104857600, Name = null, Type = "FAT", Offset = 11354112, Length = 204800, - Sequence = 1, Start = 22176 }, - new Partition{ Description = null, Size = 209715200, Name = null, Type = "FAT", Offset = 116637696, Length = 409600, - Sequence = 2, Start = 227808 }, - new Partition{ Description = null, Size = 40771584, Name = null, Type = "4.2BSD Fast File System", Offset = 326688768, Length = 79632, - Sequence = 3, Start = 638064 }, - new Partition{ Description = null, Size = 419430400, Name = null, Type = "4.2BSD Fast File System", Offset = 367460352, Length = 819200, - Sequence = 4, Start = 717696 }, - new Partition{ Description = null, Size = 471859200, Name = null, Type = "4.2BSD Fast File System", Offset = 787562496, Length = 921600, - Sequence = 5, Start = 1538208 }, + new[] + { + new Partition + { + Description = null, + Size = 10485760, + Name = null, + Type = "FAT", + Offset = 516096, + Length = 20480, + Sequence = 0, + Start = 1008 + }, + new Partition + { + Description = null, + Size = 104857600, + Name = null, + Type = "FAT", + Offset = 11354112, + Length = 204800, + Sequence = 1, + Start = 22176 + }, + new Partition + { + Description = null, + Size = 209715200, + Name = null, + Type = "FAT", + Offset = 116637696, + Length = 409600, + Sequence = 2, + Start = 227808 + }, + new Partition + { + Description = null, + Size = 40771584, + Name = null, + Type = "4.2BSD Fast File System", + Offset = 326688768, + Length = 79632, + Sequence = 3, + Start = 638064 + }, + new Partition + { + Description = null, + Size = 419430400, + Name = null, + Type = "4.2BSD Fast File System", + Offset = 367460352, + Length = 819200, + Sequence = 4, + Start = 717696 + }, + new Partition + { + Description = null, + Size = 471859200, + Name = null, + Type = "4.2BSD Fast File System", + Offset = 787562496, + Length = 921600, + Sequence = 5, + Start = 1538208 + }, // Type conflicts between DragonFly and NetBSD, really is Apple UFS - new Partition{ Description = null, Size = 78643200, Name = null, Type = "Hammer", Offset = 1259790336, Length = 153600, - Sequence = 6, Start = 2460528 }, - new Partition{ Description = null, Size = 99614720, Name = null, Type = "UNIX 7th Edition", Offset = 1338753024, Length = 194560, - Sequence = 7, Start = 2614752 }, - new Partition{ Description = null, Size = 244318208, Name = null, Type = "4.4LFS", Offset = 1438875648, Length = 477184, - Sequence = 8, Start = 2810304 }, + new Partition + { + Description = null, + Size = 78643200, + Name = null, + Type = "Hammer", + Offset = 1259790336, + Length = 153600, + Sequence = 6, + Start = 2460528 + }, + new Partition + { + Description = null, + Size = 99614720, + Name = null, + Type = "UNIX 7th Edition", + Offset = 1338753024, + Length = 194560, + Sequence = 7, + Start = 2614752 + }, + new Partition + { + Description = null, + Size = 244318208, + Name = null, + Type = "4.4LFS", + Offset = 1438875648, + Length = 477184, + Sequence = 8, + Start = 2810304 + }, // Type conflicts, really is Linux ext2 - new Partition{ Description = null, Size = 463978496, Name = null, Type = "Digital LSM Public Region", Offset = 1683505152, Length = 906208, - Sequence = 9, Start = 3288096 }, + new Partition + { + Description = null, + Size = 463978496, + Name = null, + Type = "Digital LSM Public Region", + Offset = 1683505152, + Length = 906208, + Sequence = 9, + Start = 3288096 + }, }, // NetBSD 7.1 - new []{ - new Partition{ Description = null, Size = 10321920, Name = null, Type = "FAT", Offset = 516096, Length = 20160, - Sequence = 0, Start = 1008 }, - new Partition{ Description = null, Size = 104767488, Name = null, Type = "FAT", Offset = 11354112, Length = 204624, - Sequence = 1, Start = 22176 }, - new Partition{ Description = null, Size = 209534976, Name = null, Type = "FAT", Offset = 116637696, Length = 409248, - Sequence = 2, Start = 227808 }, - new Partition{ Description = null, Size = 40255488, Name = null, Type = "4.2BSD Fast File System", Offset = 326688768, Length = 78624, - Sequence = 3, Start = 638064 }, - new Partition{ Description = null, Size = 419069952, Name = null, Type = "4.2BSD Fast File System", Offset = 367460352, Length = 818496, - Sequence = 4, Start = 717696 }, - new Partition{ Description = null, Size = 471711744, Name = null, Type = "4.2BSD Fast File System", Offset = 787562496, Length = 921312, - Sequence = 5, Start = 1538208 }, + new[] + { + new Partition + { + Description = null, + Size = 10321920, + Name = null, + Type = "FAT", + Offset = 516096, + Length = 20160, + Sequence = 0, + Start = 1008 + }, + new Partition + { + Description = null, + Size = 104767488, + Name = null, + Type = "FAT", + Offset = 11354112, + Length = 204624, + Sequence = 1, + Start = 22176 + }, + new Partition + { + Description = null, + Size = 209534976, + Name = null, + Type = "FAT", + Offset = 116637696, + Length = 409248, + Sequence = 2, + Start = 227808 + }, + new Partition + { + Description = null, + Size = 40255488, + Name = null, + Type = "4.2BSD Fast File System", + Offset = 326688768, + Length = 78624, + Sequence = 3, + Start = 638064 + }, + new Partition + { + Description = null, + Size = 419069952, + Name = null, + Type = "4.2BSD Fast File System", + Offset = 367460352, + Length = 818496, + Sequence = 4, + Start = 717696 + }, + new Partition + { + Description = null, + Size = 471711744, + Name = null, + Type = "4.2BSD Fast File System", + Offset = 787562496, + Length = 921312, + Sequence = 5, + Start = 1538208 + }, // Type conflicts between DragonFly and NetBSD, really is Apple UFS - new Partition{ Description = null, Size = 78446592, Name = null, Type = "Hammer", Offset = 1259790336, Length = 153216, - Sequence = 6, Start = 2460528 }, - new Partition{ Description = null, Size = 99606528, Name = null, Type = "UNIX 7th Edition", Offset = 1338753024, Length = 194544, - Sequence = 7, Start = 2614752 }, - new Partition{ Description = null, Size = 243597312, Name = null, Type = "4.4LFS", Offset = 1438875648, Length = 475776, - Sequence = 8, Start = 2810304 }, + new Partition + { + Description = null, + Size = 78446592, + Name = null, + Type = "Hammer", + Offset = 1259790336, + Length = 153216, + Sequence = 6, + Start = 2460528 + }, + new Partition + { + Description = null, + Size = 99606528, + Name = null, + Type = "UNIX 7th Edition", + Offset = 1338753024, + Length = 194544, + Sequence = 7, + Start = 2614752 + }, + new Partition + { + Description = null, + Size = 243597312, + Name = null, + Type = "4.4LFS", + Offset = 1438875648, + Length = 475776, + Sequence = 8, + Start = 2810304 + }, // Type conflicts, really is Linux ext2 - new Partition{ Description = null, Size = 463970304, Name = null, Type = "Digital LSM Public Region", Offset = 1683505152, Length = 906192, - Sequence = 9, Start = 3288096 }, + new Partition + { + Description = null, + Size = 463970304, + Name = null, + Type = "Digital LSM Public Region", + Offset = 1683505152, + Length = 906192, + Sequence = 9, + Start = 3288096 + }, }, }; @@ -147,4 +412,4 @@ namespace DiscImageChef.Tests.Partitions } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Partitions/GPT.cs b/DiscImageChef.Tests/Partitions/GPT.cs index 287b4e41..a75c7f5a 100644 --- a/DiscImageChef.Tests/Partitions/GPT.cs +++ b/DiscImageChef.Tests/Partitions/GPT.cs @@ -39,34 +39,116 @@ namespace DiscImageChef.Tests.Partitions [TestFixture] public class GPT { - readonly string[] testfiles = { - "linux.vdi.lz","parted.vdi.lz", - }; + readonly string[] testfiles = {"linux.vdi.lz", "parted.vdi.lz",}; - readonly Partition[][] wanted = { + readonly Partition[][] wanted = + { // Linux - new []{ - new Partition{ Description = null, Size = 10485760, Name = "EFI System", Type = "EFI System", Offset = 1048576, Length = 20480, - Sequence = 0, Start = 2048 }, - new Partition{ Description = null, Size = 15728640, Name = "Microsoft basic data", Type = "Microsoft Basic data", Offset = 11534336, Length = 30720, - Sequence = 1, Start = 22528 }, - new Partition{ Description = null, Size = 20971520, Name = "Apple label", Type = "Apple Label", Offset = 27262976, Length = 40960, - Sequence = 2, Start = 53248 }, - new Partition{ Description = null, Size = 26214400, Name = "Solaris /usr & Mac ZFS", Type = "Solaris /usr or Apple ZFS", Offset = 48234496, Length = 51200, - Sequence = 3, Start = 94208 }, - new Partition{ Description = null, Size = 31457280, Name = "FreeBSD ZFS", Type = "FreeBSD ZFS", Offset = 74448896, Length = 61440, - Sequence = 4, Start = 145408 }, - new Partition{ Description = null, Size = 28294656, Name = "HP-UX data", Type = "HP-UX Data", Offset = 105906176, Length = 55263, - Sequence = 5, Start = 206848 }, + new[] + { + new Partition + { + Description = null, + Size = 10485760, + Name = "EFI System", + Type = "EFI System", + Offset = 1048576, + Length = 20480, + Sequence = 0, + Start = 2048 + }, + new Partition + { + Description = null, + Size = 15728640, + Name = "Microsoft basic data", + Type = "Microsoft Basic data", + Offset = 11534336, + Length = 30720, + Sequence = 1, + Start = 22528 + }, + new Partition + { + Description = null, + Size = 20971520, + Name = "Apple label", + Type = "Apple Label", + Offset = 27262976, + Length = 40960, + Sequence = 2, + Start = 53248 + }, + new Partition + { + Description = null, + Size = 26214400, + Name = "Solaris /usr & Mac ZFS", + Type = "Solaris /usr or Apple ZFS", + Offset = 48234496, + Length = 51200, + Sequence = 3, + Start = 94208 + }, + new Partition + { + Description = null, + Size = 31457280, + Name = "FreeBSD ZFS", + Type = "FreeBSD ZFS", + Offset = 74448896, + Length = 61440, + Sequence = 4, + Start = 145408 + }, + new Partition + { + Description = null, + Size = 28294656, + Name = "HP-UX data", + Type = "HP-UX Data", + Offset = 105906176, + Length = 55263, + Sequence = 5, + Start = 206848 + }, }, // Parted - new []{ - new Partition{ Description = null, Size = 42991616, Name = "", Type = "Apple HFS", Offset = 1048576, Length = 83968, - Sequence = 0, Start = 2048 }, - new Partition{ Description = null, Size = 52428800, Name = "", Type = "Linux filesystem", Offset = 44040192, Length = 102400, - Sequence = 1, Start = 86016 }, - new Partition{ Description = null, Size = 36700160, Name = "", Type = "Microsoft Basic data", Offset = 96468992, Length = 71680, - Sequence = 2, Start = 188416 }, + new[] + { + new Partition + { + Description = null, + Size = 42991616, + Name = "", + Type = "Apple HFS", + Offset = 1048576, + Length = 83968, + Sequence = 0, + Start = 2048 + }, + new Partition + { + Description = null, + Size = 52428800, + Name = "", + Type = "Linux filesystem", + Offset = 44040192, + Length = 102400, + Sequence = 1, + Start = 86016 + }, + new Partition + { + Description = null, + Size = 36700160, + Name = "", + Type = "Microsoft Basic data", + Offset = 96468992, + Length = 71680, + Sequence = 2, + Start = 188416 + }, }, }; @@ -97,4 +179,4 @@ namespace DiscImageChef.Tests.Partitions } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Partitions/MBR.cs b/DiscImageChef.Tests/Partitions/MBR.cs index 79626358..5d7ccdc1 100644 --- a/DiscImageChef.Tests/Partitions/MBR.cs +++ b/DiscImageChef.Tests/Partitions/MBR.cs @@ -39,518 +39,1920 @@ namespace DiscImageChef.Tests.Partitions [TestFixture] public class MBR { - readonly string[] testfiles = { - "concurrentdos_6.0.vdi.lz","darwin_1.4.1.vdi.lz","darwin_6.0.2.vdi.lz","darwin_8.0.1.vdi.lz", - "drdos_3.40.vdi.lz","drdos_3.41.vdi.lz","drdos_5.00.vdi.lz","drdos_6.00.vdi.lz", - "drdos_7.02.vdi.lz","drdos_7.03.vdi.lz","drdos_8.0.vdi.lz","linux.vdi.lz", - "macosx_10.3.vdi.lz","macosx_10.4.vdi.lz","msdos_3.30a.vdi.lz","msdos_5.00.vdi.lz", - "msdos_6.00.vdi.lz","msdos_6.20.vdi.lz","msdos_6.21.vdi.lz","msdos_6.22.vdi.lz", - "multiuserdos_7.22r04.vdi.lz","novelldos_7.00.vdi.lz","opendos_7.01.vdi.lz","parted.vdi.lz", - "pcdos_2000.vdi.lz","pcdos_2.00.vdi.lz","pcdos_2.10.vdi.lz","pcdos_3.00.vdi.lz", - "pcdos_3.10.vdi.lz","pcdos_3.30.vdi.lz","pcdos_4.00.vdi.lz","pcdos_5.00.vdi.lz", - "pcdos_6.10.vdi.lz","win95.vdi.lz","win96osr25.vdi.lz","winnt_3.10.vdi.lz", + readonly string[] testfiles = + { + "concurrentdos_6.0.vdi.lz", "darwin_1.4.1.vdi.lz", "darwin_6.0.2.vdi.lz", "darwin_8.0.1.vdi.lz", + "drdos_3.40.vdi.lz", "drdos_3.41.vdi.lz", "drdos_5.00.vdi.lz", "drdos_6.00.vdi.lz", "drdos_7.02.vdi.lz", + "drdos_7.03.vdi.lz", "drdos_8.0.vdi.lz", "linux.vdi.lz", "macosx_10.3.vdi.lz", "macosx_10.4.vdi.lz", + "msdos_3.30a.vdi.lz", "msdos_5.00.vdi.lz", "msdos_6.00.vdi.lz", "msdos_6.20.vdi.lz", "msdos_6.21.vdi.lz", + "msdos_6.22.vdi.lz", "multiuserdos_7.22r04.vdi.lz", "novelldos_7.00.vdi.lz", "opendos_7.01.vdi.lz", + "parted.vdi.lz", "pcdos_2000.vdi.lz", "pcdos_2.00.vdi.lz", "pcdos_2.10.vdi.lz", "pcdos_3.00.vdi.lz", + "pcdos_3.10.vdi.lz", "pcdos_3.30.vdi.lz", "pcdos_4.00.vdi.lz", "pcdos_5.00.vdi.lz", "pcdos_6.10.vdi.lz", + "win95.vdi.lz", "win96osr25.vdi.lz", "winnt_3.10.vdi.lz", }; - readonly Partition[][] wanted = { + readonly Partition[][] wanted = + { // Concurrent DOS 6.0 - new []{ - new Partition{ Description = null, Name = null, Type = "0x04", Length = 100800, - Sequence = 0, Start = 1008 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 99792, - Sequence = 1, Start = 102816 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 100800, - Sequence = 2, Start = 202608 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 303408, - Sequence = 3, Start = 352800 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 100800, + Sequence = 0, + Start = 1008 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 99792, + Sequence = 1, + Start = 102816 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 100800, + Sequence = 2, + Start = 202608 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 303408, + Sequence = 3, + Start = 352800 + }, }, // Darwin 1.4.1 - new []{ - new Partition{ Description = null, Name = null, Type = "0x07", Length = 409248, - Sequence = 0, Start = 409248 }, - new Partition{ Description = null, Name = null, Type = "0xA8", Length = 204624, - Sequence = 1, Start = 818496 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x07", + Length = 409248, + Sequence = 0, + Start = 409248 + }, + new Partition + { + Description = null, + Name = null, + Type = "0xA8", + Length = 204624, + Sequence = 1, + Start = 818496 + }, }, // Darwin 6.0.2 - new []{ - new Partition{ Description = null, Name = null, Type = "0xA8", Length = 204561, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0xAB", Length = 81648, - Sequence = 1, Start = 204624 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 245952, - Sequence = 2, Start = 286272 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 488880, - Sequence = 3, Start = 532224 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0xA8", + Length = 204561, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0xAB", + Length = 81648, + Sequence = 1, + Start = 204624 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 245952, + Sequence = 2, + Start = 286272 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 488880, + Sequence = 3, + Start = 532224 + }, }, // Darwin 8.0.1 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 150000, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0xAF", Length = 176000, - Sequence = 1, Start = 150063 }, - new Partition{ Description = null, Name = null, Type = "0xA8", Length = 350000, - Sequence = 2, Start = 326063 }, - new Partition{ Description = null, Name = null, Type = "0x0C", Length = 347937, - Sequence = 3, Start = 676063 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 150000, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0xAF", + Length = 176000, + Sequence = 1, + Start = 150063 + }, + new Partition + { + Description = null, + Name = null, + Type = "0xA8", + Length = 350000, + Sequence = 2, + Start = 326063 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x0C", + Length = 347937, + Sequence = 3, + Start = 676063 + }, }, // DR-DOS 3.40 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 100800, - Sequence = 0, Start = 1008 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 402129, - Sequence = 1, Start = 101871 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 152145, - Sequence = 2, Start = 504063 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 365841, - Sequence = 3, Start = 656271 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 100800, + Sequence = 0, + Start = 1008 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 402129, + Sequence = 1, + Start = 101871 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 152145, + Sequence = 2, + Start = 504063 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 365841, + Sequence = 3, + Start = 656271 + }, }, // DR-DOS 3.41 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 126945, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 124929, - Sequence = 1, Start = 127071 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 101745, - Sequence = 2, Start = 252063 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 668241, - Sequence = 3, Start = 353871 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 126945, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 124929, + Sequence = 1, + Start = 127071 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 101745, + Sequence = 2, + Start = 252063 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 668241, + Sequence = 3, + Start = 353871 + }, }, // DR-DOS 5.00 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 128016, - Sequence = 0, Start = 124992 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 99729, - Sequence = 1, Start = 253071 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 100737, - Sequence = 2, Start = 352863 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 313425, - Sequence = 3, Start = 453663 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 254961, - Sequence = 4, Start = 767151 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 128016, + Sequence = 0, + Start = 124992 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 99729, + Sequence = 1, + Start = 253071 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 100737, + Sequence = 2, + Start = 352863 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 313425, + Sequence = 3, + Start = 453663 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 254961, + Sequence = 4, + Start = 767151 + }, }, // DR-DOS 6.00 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 101745, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 18081, - Sequence = 1, Start = 102879 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 130977, - Sequence = 2, Start = 121023 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 202545, - Sequence = 3, Start = 252063 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 567441, - Sequence = 4, Start = 454671 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 101745, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 18081, + Sequence = 1, + Start = 102879 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 130977, + Sequence = 2, + Start = 121023 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 202545, + Sequence = 3, + Start = 252063 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 567441, + Sequence = 4, + Start = 454671 + }, }, // DR-DOS 7.02 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 102753, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 307377, - Sequence = 1, Start = 102879 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 384993, - Sequence = 2, Start = 410319 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 17073, - Sequence = 3, Start = 795375 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 209601, - Sequence = 4, Start = 812511 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 102753, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 307377, + Sequence = 1, + Start = 102879 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 384993, + Sequence = 2, + Start = 410319 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 17073, + Sequence = 3, + Start = 795375 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 209601, + Sequence = 4, + Start = 812511 + }, }, // DR-DOS 7.03 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 202545, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 141057, - Sequence = 1, Start = 202671 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 152145, - Sequence = 2, Start = 352863 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 364833, - Sequence = 3, Start = 505071 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 152145, - Sequence = 4, Start = 869967 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 202545, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 141057, + Sequence = 1, + Start = 202671 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 152145, + Sequence = 2, + Start = 352863 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 364833, + Sequence = 3, + Start = 505071 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 152145, + Sequence = 4, + Start = 869967 + }, }, // DR-DOS 8.0 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 205569, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 138033, - Sequence = 1, Start = 205695 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 303345, - Sequence = 2, Start = 352863 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 249921, - Sequence = 3, Start = 656271 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 115857, - Sequence = 4, Start = 906255 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 138033, + Sequence = 1, + Start = 205695 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 303345, + Sequence = 2, + Start = 352863 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 249921, + Sequence = 3, + Start = 656271 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 115857, + Sequence = 4, + Start = 906255 + }, }, // Linux - new []{ - new Partition{ Description = null, Name = null, Type = "0x04", Length = 20480, - Sequence = 0, Start = 2048 }, - new Partition{ Description = null, Name = null, Type = "0x24", Length = 40960, - Sequence = 1, Start = 22528 }, - new Partition{ Description = null, Name = null, Type = "0xA7", Length = 61440, - Sequence = 2, Start = 65536 }, - new Partition{ Description = null, Name = null, Type = "0x42", Length = 81920, - Sequence = 3, Start = 129024 }, - new Partition{ Description = null, Name = null, Type = "0x83", Length = 49152, - Sequence = 4, Start = 212992 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 20480, + Sequence = 0, + Start = 2048 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x24", + Length = 40960, + Sequence = 1, + Start = 22528 + }, + new Partition + { + Description = null, + Name = null, + Type = "0xA7", + Length = 61440, + Sequence = 2, + Start = 65536 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x42", + Length = 81920, + Sequence = 3, + Start = 129024 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x83", + Length = 49152, + Sequence = 4, + Start = 212992 + }, }, // Mac OS X 10.3 - new []{ - new Partition{ Description = null, Name = null, Type = "0xA8", Length = 204800, - Sequence = 0, Start = 8 }, - new Partition{ Description = null, Name = null, Type = "0xAF", Length = 102400, - Sequence = 1, Start = 204816 }, - new Partition{ Description = null, Name = null, Type = "0x0B", Length = 102400, - Sequence = 2, Start = 307224 }, - new Partition{ Description = null, Name = null, Type = "0xAF", Length = 204800, - Sequence = 3, Start = 409632 }, - new Partition{ Description = null, Name = null, Type = "0xAF", Length = 204800, - Sequence = 4, Start = 614440 }, - new Partition{ Description = null, Name = null, Type = "0xAF", Length = 204752, - Sequence = 5, Start = 819248 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0xA8", + Length = 204800, + Sequence = 0, + Start = 8 + }, + new Partition + { + Description = null, + Name = null, + Type = "0xAF", + Length = 102400, + Sequence = 1, + Start = 204816 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x0B", + Length = 102400, + Sequence = 2, + Start = 307224 + }, + new Partition + { + Description = null, + Name = null, + Type = "0xAF", + Length = 204800, + Sequence = 3, + Start = 409632 + }, + new Partition + { + Description = null, + Name = null, + Type = "0xAF", + Length = 204800, + Sequence = 4, + Start = 614440 + }, + new Partition + { + Description = null, + Name = null, + Type = "0xAF", + Length = 204752, + Sequence = 5, + Start = 819248 + }, }, // Mac OS X 10.4 - new []{ - new Partition{ Description = null, Name = null, Type = "0xAF", Length = 102400, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0xAF", Length = 204800, - Sequence = 1, Start = 102501 }, - new Partition{ Description = null, Name = null, Type = "0x0B", Length = 204800, - Sequence = 2, Start = 307314 }, - new Partition{ Description = null, Name = null, Type = "0xA8", Length = 204800, - Sequence = 3, Start = 512127 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 102400, - Sequence = 4, Start = 716940 }, - new Partition{ Description = null, Name = null, Type = "0xAF", Length = 204622, - Sequence = 5, Start = 819378 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0xAF", + Length = 102400, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0xAF", + Length = 204800, + Sequence = 1, + Start = 102501 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x0B", + Length = 204800, + Sequence = 2, + Start = 307314 + }, + new Partition + { + Description = null, + Name = null, + Type = "0xA8", + Length = 204800, + Sequence = 3, + Start = 512127 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 102400, + Sequence = 4, + Start = 716940 + }, + new Partition + { + Description = null, + Name = null, + Type = "0xAF", + Length = 204622, + Sequence = 5, + Start = 819378 + }, }, // MS-DOS 3.30A - new []{ - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 1, Start = 65583 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 2, Start = 131103 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 3, Start = 196623 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 4, Start = 262143 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 5, Start = 327663 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 6, Start = 393183 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 7, Start = 458703 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 8, Start = 524223 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 9, Start = 589743 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 10, Start = 655263 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 11, Start = 720783 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 12, Start = 786303 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 13, Start = 851823 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 14, Start = 917343 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 39249, - Sequence = 15, Start = 982863 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 1, + Start = 65583 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 2, + Start = 131103 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 3, + Start = 196623 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 4, + Start = 262143 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 5, + Start = 327663 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 6, + Start = 393183 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 7, + Start = 458703 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 8, + Start = 524223 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 9, + Start = 589743 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 10, + Start = 655263 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 11, + Start = 720783 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 12, + Start = 786303 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 13, + Start = 851823 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 14, + Start = 917343 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 39249, + Sequence = 15, + Start = 982863 + }, }, // MS-DOS 5.00 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 102753, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 31185, - Sequence = 1, Start = 102879 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 41265, - Sequence = 2, Start = 134127 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 51345, - Sequence = 3, Start = 175455 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 61425, - Sequence = 4, Start = 226863 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 72513, - Sequence = 5, Start = 288351 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 82593, - Sequence = 6, Start = 360927 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 92673, - Sequence = 7, Start = 443583 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 102753, - Sequence = 8, Start = 536319 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 112833, - Sequence = 9, Start = 639135 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 122913, - Sequence = 10, Start = 752031 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 134001, - Sequence = 11, Start = 875007 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 13041, - Sequence = 12, Start = 1009071 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 102753, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 31185, + Sequence = 1, + Start = 102879 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 41265, + Sequence = 2, + Start = 134127 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 51345, + Sequence = 3, + Start = 175455 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 61425, + Sequence = 4, + Start = 226863 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 72513, + Sequence = 5, + Start = 288351 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 82593, + Sequence = 6, + Start = 360927 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 92673, + Sequence = 7, + Start = 443583 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 102753, + Sequence = 8, + Start = 536319 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 112833, + Sequence = 9, + Start = 639135 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 122913, + Sequence = 10, + Start = 752031 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 134001, + Sequence = 11, + Start = 875007 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 13041, + Sequence = 12, + Start = 1009071 + }, }, // MS-DOS 6.00 - new []{ - new Partition{ Description = null, Name = null, Type = "0x04", Length = 51345, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 72513, - Sequence = 1, Start = 51471 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 92673, - Sequence = 2, Start = 124047 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 112833, - Sequence = 3, Start = 216783 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 134001, - Sequence = 4, Start = 329679 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 154161, - Sequence = 5, Start = 463743 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 178353, - Sequence = 6, Start = 617967 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 184401, - Sequence = 7, Start = 796383 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 41265, - Sequence = 8, Start = 980847 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 51345, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 72513, + Sequence = 1, + Start = 51471 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 92673, + Sequence = 2, + Start = 124047 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 112833, + Sequence = 3, + Start = 216783 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 134001, + Sequence = 4, + Start = 329679 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 154161, + Sequence = 5, + Start = 463743 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 178353, + Sequence = 6, + Start = 617967 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 184401, + Sequence = 7, + Start = 796383 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 41265, + Sequence = 8, + Start = 980847 + }, }, // MS-DOS 6.20 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 205569, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 225729, - Sequence = 1, Start = 205695 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 245889, - Sequence = 2, Start = 431487 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 267057, - Sequence = 3, Start = 677439 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 61425, - Sequence = 4, Start = 944559 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 16065, - Sequence = 5, Start = 1006047 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 225729, + Sequence = 1, + Start = 205695 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 2, + Start = 431487 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 267057, + Sequence = 3, + Start = 677439 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 61425, + Sequence = 4, + Start = 944559 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 16065, + Sequence = 5, + Start = 1006047 + }, }, // MS-DOS 6.21 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 205569, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 225729, - Sequence = 1, Start = 205695 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 245889, - Sequence = 2, Start = 431487 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 267057, - Sequence = 3, Start = 677439 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 51345, - Sequence = 4, Start = 944559 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 6993, - Sequence = 5, Start = 995967 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 19089, - Sequence = 6, Start = 1003023 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 225729, + Sequence = 1, + Start = 205695 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 2, + Start = 431487 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 267057, + Sequence = 3, + Start = 677439 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 51345, + Sequence = 4, + Start = 944559 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 6993, + Sequence = 5, + Start = 995967 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 19089, + Sequence = 6, + Start = 1003023 + }, }, // MS-DOS 6.22 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 245889, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 205569, - Sequence = 1, Start = 246015 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 307377, - Sequence = 2, Start = 451647 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 225729, - Sequence = 3, Start = 759087 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 37233, - Sequence = 4, Start = 984879 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 1, + Start = 246015 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 307377, + Sequence = 2, + Start = 451647 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 225729, + Sequence = 3, + Start = 759087 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 37233, + Sequence = 4, + Start = 984879 + }, }, // Multiuser DOS 7.22 release 04 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 152145, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 99729, - Sequence = 1, Start = 152271 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 202545, - Sequence = 2, Start = 252063 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 1953, - Sequence = 3, Start = 454671 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 565425, - Sequence = 4, Start = 456687 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 152145, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 99729, + Sequence = 1, + Start = 152271 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 202545, + Sequence = 2, + Start = 252063 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 1953, + Sequence = 3, + Start = 454671 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 565425, + Sequence = 4, + Start = 456687 + }, }, // Novell DOS 7.0 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 252945, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 4977, - Sequence = 1, Start = 253071 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 202545, - Sequence = 2, Start = 352863 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 348705, - Sequence = 3, Start = 555471 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 117873, - Sequence = 4, Start = 904239 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 252945, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 4977, + Sequence = 1, + Start = 253071 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 202545, + Sequence = 2, + Start = 352863 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 348705, + Sequence = 3, + Start = 555471 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 117873, + Sequence = 4, + Start = 904239 + }, }, // OpenDOS 7.01 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 307377, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 4977, - Sequence = 1, Start = 307503 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 40257, - Sequence = 2, Start = 312543 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 202545, - Sequence = 3, Start = 352863 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 466641, - Sequence = 4, Start = 555471 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 307377, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 4977, + Sequence = 1, + Start = 307503 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 40257, + Sequence = 2, + Start = 312543 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 202545, + Sequence = 3, + Start = 352863 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 466641, + Sequence = 4, + Start = 555471 + }, }, // Parted - new []{ - new Partition{ Description = null, Name = null, Type = "0x83", Length = 67584, - Sequence = 0, Start = 4096 }, - new Partition{ Description = null, Name = null, Type = "0x07", Length = 59392, - Sequence = 1, Start = 73728 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 129024, - Sequence = 2, Start = 133120 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x83", + Length = 67584, + Sequence = 0, + Start = 4096 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x07", + Length = 59392, + Sequence = 1, + Start = 73728 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 129024, + Sequence = 2, + Start = 133120 + }, }, // PC-DOS 2000 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 205569, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 225729, - Sequence = 1, Start = 205695 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 245889, - Sequence = 2, Start = 431487 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 287217, - Sequence = 3, Start = 677439 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 57393, - Sequence = 4, Start = 964719 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 225729, + Sequence = 1, + Start = 205695 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 2, + Start = 431487 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 287217, + Sequence = 3, + Start = 677439 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 57393, + Sequence = 4, + Start = 964719 + }, }, // PC-DOS 2.00 - new []{ - new Partition{ Description = null, Name = null, Type = "0x01", Length = 1022111, - Sequence = 0, Start = 1 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 1022111, + Sequence = 0, + Start = 1 + }, }, // PC-DOS 2.10 - new []{ - new Partition{ Description = null, Name = null, Type = "0x01", Length = 1022111, - Sequence = 0, Start = 1 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 1022111, + Sequence = 0, + Start = 1 + }, }, // PC-DOS 3.00 - new []{ - new Partition{ Description = null, Name = null, Type = "0x01", Length = 66465, - Sequence = 0, Start = 63 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 66465, + Sequence = 0, + Start = 63 + }, }, // PC-DOS 3.10 - new []{ - new Partition{ Description = null, Name = null, Type = "0x01", Length = 66465, - Sequence = 0, Start = 63 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 66465, + Sequence = 0, + Start = 63 + }, }, // PC-DOS 3.30 - new []{ - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 1, Start = 65583 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 2, Start = 131103 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 3, Start = 196623 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 4, Start = 262143 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 5, Start = 327663 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 6, Start = 393183 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 7, Start = 458703 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 8, Start = 524223 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 9, Start = 589743 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 10, Start = 655263 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 11, Start = 720783 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 12, Start = 786303 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 13, Start = 851823 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 65457, - Sequence = 14, Start = 917343 }, - new Partition{ Description = null, Name = null, Type = "0x04", Length = 39249, - Sequence = 15, Start = 982863 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 1, + Start = 65583 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 2, + Start = 131103 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 3, + Start = 196623 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 4, + Start = 262143 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 5, + Start = 327663 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 6, + Start = 393183 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 7, + Start = 458703 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 8, + Start = 524223 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 9, + Start = 589743 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 10, + Start = 655263 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 11, + Start = 720783 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 12, + Start = 786303 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 13, + Start = 851823 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 65457, + Sequence = 14, + Start = 917343 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x04", + Length = 39249, + Sequence = 15, + Start = 982863 + }, }, // PC-DOS 4.00 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 205569, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 25137, - Sequence = 1, Start = 205695 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 245889, - Sequence = 2, Start = 230895 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 307377, - Sequence = 3, Start = 476847 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 237825, - Sequence = 4, Start = 784287 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 25137, + Sequence = 1, + Start = 205695 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 2, + Start = 230895 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 307377, + Sequence = 3, + Start = 476847 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 237825, + Sequence = 4, + Start = 784287 + }, }, // PC-DOS 5.00 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 205569, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 25137, - Sequence = 1, Start = 205695 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 245889, - Sequence = 2, Start = 230895 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 287217, - Sequence = 3, Start = 476847 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 257985, - Sequence = 4, Start = 764127 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 25137, + Sequence = 1, + Start = 205695 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 2, + Start = 230895 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 287217, + Sequence = 3, + Start = 476847 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 257985, + Sequence = 4, + Start = 764127 + }, }, // PC-DOS 6.10 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 205569, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 25137, - Sequence = 1, Start = 205695 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 225729, - Sequence = 2, Start = 230895 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 245889, - Sequence = 3, Start = 456687 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 319473, - Sequence = 4, Start = 702639 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 25137, + Sequence = 1, + Start = 205695 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 225729, + Sequence = 2, + Start = 230895 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 3, + Start = 456687 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 319473, + Sequence = 4, + Start = 702639 + }, }, // Windows 95 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 205569, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 245889, - Sequence = 1, Start = 205695 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 267057, - Sequence = 2, Start = 451647 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 287217, - Sequence = 3, Start = 718767 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 17073, - Sequence = 4, Start = 1006047 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 205569, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 1, + Start = 205695 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 267057, + Sequence = 2, + Start = 451647 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 287217, + Sequence = 3, + Start = 718767 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 17073, + Sequence = 4, + Start = 1006047 + }, }, // Windows 95 OSR 2.5 - new []{ - new Partition{ Description = null, Name = null, Type = "0x06", Length = 307377, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 245889, - Sequence = 1, Start = 307503 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 328545, - Sequence = 2, Start = 553455 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 102753, - Sequence = 3, Start = 882063 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 21105, - Sequence = 4, Start = 984879 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 17073, - Sequence = 5, Start = 1006047 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 307377, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 245889, + Sequence = 1, + Start = 307503 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 328545, + Sequence = 2, + Start = 553455 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 102753, + Sequence = 3, + Start = 882063 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 21105, + Sequence = 4, + Start = 984879 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 17073, + Sequence = 5, + Start = 1006047 + }, }, // Windows NT 3.10 - new []{ - new Partition{ Description = null, Name = null, Type = "0x07", Length = 204561, - Sequence = 0, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "0x07", Length = 307377, - Sequence = 1, Start = 204687 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 224721, - Sequence = 2, Start = 512127 }, - new Partition{ Description = null, Name = null, Type = "0x06", Length = 214641, - Sequence = 3, Start = 736911 }, - new Partition{ Description = null, Name = null, Type = "0x01", Length = 10017, - Sequence = 4, Start = 951615 }, - new Partition{ Description = null, Name = null, Type = "0x07", Length = 60480, - Sequence = 5, Start = 962640 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "0x07", + Length = 204561, + Sequence = 0, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x07", + Length = 307377, + Sequence = 1, + Start = 204687 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 224721, + Sequence = 2, + Start = 512127 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x06", + Length = 214641, + Sequence = 3, + Start = 736911 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x01", + Length = 10017, + Sequence = 4, + Start = 951615 + }, + new Partition + { + Description = null, + Name = null, + Type = "0x07", + Length = 60480, + Sequence = 5, + Start = 962640 + }, }, - }; + }; [Test] public void Test() @@ -569,7 +1971,7 @@ namespace DiscImageChef.Tests.Partitions // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); Assert.AreEqual(wanted[i][j].Length * 512, partitions[j].Size, testfiles[i]); -// Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); + // Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); Assert.AreEqual(wanted[i][j].Type, partitions[j].Type, testfiles[i]); Assert.AreEqual(wanted[i][j].Start * 512, partitions[j].Offset, testfiles[i]); Assert.AreEqual(wanted[i][j].Length, partitions[j].Length, testfiles[i]); @@ -579,4 +1981,4 @@ namespace DiscImageChef.Tests.Partitions } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Partitions/MINIX.cs b/DiscImageChef.Tests/Partitions/MINIX.cs index e45186a3..69a9bbb3 100644 --- a/DiscImageChef.Tests/Partitions/MINIX.cs +++ b/DiscImageChef.Tests/Partitions/MINIX.cs @@ -39,21 +39,57 @@ namespace DiscImageChef.Tests.Partitions [TestFixture] public class MINIX { - readonly string[] testfiles = { - "minix_3.1.2a.vdi.lz", - }; + readonly string[] testfiles = {"minix_3.1.2a.vdi.lz",}; - readonly Partition[][] wanted = { + readonly Partition[][] wanted = + { // Parted - new []{ - new Partition{ Description = null, Size = 268369408, Name = "MINIX", Type = "MINIX", Offset = 2064896, Length = 524159, - Sequence = 0, Start = 4033 }, - new Partition{ Description = null, Size = 270434304, Name = "MINIX", Type = "MINIX", Offset = 270434304, Length = 528192, - Sequence = 1, Start = 528192 }, - new Partition{ Description = null, Size = 270434304, Name = "MINIX", Type = "MINIX", Offset = 540868608, Length = 528192, - Sequence = 2, Start = 1056384 }, - new Partition{ Description = null, Size = 262176768, Name = "MINIX", Type = "MINIX", Offset = 811302912, Length = 512064, - Sequence = 3, Start = 1584576 }, + new[] + { + new Partition + { + Description = null, + Size = 268369408, + Name = "MINIX", + Type = "MINIX", + Offset = 2064896, + Length = 524159, + Sequence = 0, + Start = 4033 + }, + new Partition + { + Description = null, + Size = 270434304, + Name = "MINIX", + Type = "MINIX", + Offset = 270434304, + Length = 528192, + Sequence = 1, + Start = 528192 + }, + new Partition + { + Description = null, + Size = 270434304, + Name = "MINIX", + Type = "MINIX", + Offset = 540868608, + Length = 528192, + Sequence = 2, + Start = 1056384 + }, + new Partition + { + Description = null, + Size = 262176768, + Name = "MINIX", + Type = "MINIX", + Offset = 811302912, + Length = 512064, + Sequence = 3, + Start = 1584576 + }, }, }; @@ -74,7 +110,7 @@ namespace DiscImageChef.Tests.Partitions // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); Assert.AreEqual(wanted[i][j].Size, partitions[j].Size, testfiles[i]); -// Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); + // Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); Assert.AreEqual(wanted[i][j].Type, partitions[j].Type, testfiles[i]); Assert.AreEqual(wanted[i][j].Offset, partitions[j].Offset, testfiles[i]); Assert.AreEqual(wanted[i][j].Length, partitions[j].Length, testfiles[i]); @@ -84,4 +120,4 @@ namespace DiscImageChef.Tests.Partitions } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Partitions/PC98.cs b/DiscImageChef.Tests/Partitions/PC98.cs index 4b99402b..06fbd47b 100644 --- a/DiscImageChef.Tests/Partitions/PC98.cs +++ b/DiscImageChef.Tests/Partitions/PC98.cs @@ -38,60 +38,336 @@ namespace DiscImageChef.Tests.Partitions [TestFixture] public class PC98 { - readonly string[] testfiles = { - "msdos330.thd.lz","msdos330_alt.thd.lz","msdos500_epson.thd.lz","msdos500.thd.lz", - "msdos620.thd.lz", - }; + readonly string[] testfiles = + {"msdos330.thd.lz", "msdos330_alt.thd.lz", "msdos500_epson.thd.lz", "msdos500.thd.lz", "msdos620.thd.lz",}; - readonly Partition[][] wanted = { + readonly Partition[][] wanted = + { // NEC MS-DOS 3.30 (256Mb HDD) - new []{ - new Partition{ Description = null, Name = "MS-DOS 3.30", Type = "FAT12", Length = 19536, Sequence = 0, Start = 264 }, - new Partition{ Description = null, Name = "MS-DOS 3.30", Type = "FAT12", Length = 39336, Sequence = 1, Start = 20064 }, - new Partition{ Description = null, Name = "MS-DOS 3.30", Type = "FAT16", Length = 59136, Sequence = 2, Start = 59664 }, - new Partition{ Description = null, Name = "MS-DOS 3.30", Type = "FAT16", Length = 78936, Sequence = 3, Start = 119064 }, - new Partition{ Description = null, Name = "MS-DOS 3.30", Type = "FAT16", Length = 118536, Sequence = 4, Start = 198264 }, - new Partition{ Description = null, Name = "MS-DOS 3.30", Type = "FAT16", Length = 197736, Sequence = 5, Start = 317064 }, - new Partition{ Description = null, Name = "MS-DOS 3.30", Type = "FAT16", Length = 237336, Sequence = 6, Start = 515064 }, - new Partition{ Description = null, Name = "MS-DOS 3.30", Type = "FAT16", Length = 245256, Sequence = 7, Start = 752664 }, + new[] + { + new Partition + { + Description = null, + Name = "MS-DOS 3.30", + Type = "FAT12", + Length = 19536, + Sequence = 0, + Start = 264 + }, + new Partition + { + Description = null, + Name = "MS-DOS 3.30", + Type = "FAT12", + Length = 39336, + Sequence = 1, + Start = 20064 + }, + new Partition + { + Description = null, + Name = "MS-DOS 3.30", + Type = "FAT16", + Length = 59136, + Sequence = 2, + Start = 59664 + }, + new Partition + { + Description = null, + Name = "MS-DOS 3.30", + Type = "FAT16", + Length = 78936, + Sequence = 3, + Start = 119064 + }, + new Partition + { + Description = null, + Name = "MS-DOS 3.30", + Type = "FAT16", + Length = 118536, + Sequence = 4, + Start = 198264 + }, + new Partition + { + Description = null, + Name = "MS-DOS 3.30", + Type = "FAT16", + Length = 197736, + Sequence = 5, + Start = 317064 + }, + new Partition + { + Description = null, + Name = "MS-DOS 3.30", + Type = "FAT16", + Length = 237336, + Sequence = 6, + Start = 515064 + }, + new Partition + { + Description = null, + Name = "MS-DOS 3.30", + Type = "FAT16", + Length = 245256, + Sequence = 7, + Start = 752664 + }, }, // NEC MS-DOS 3.30 (80Mb HDD) - new []{ - new Partition{ Description = null, Name = "MS-DOS 3.30", Type = "FAT16", Length = 59136, Sequence = 0, Start = 264 }, - new Partition{ Description = null, Name = "MS-DOS 3.30", Type = "FAT16", Length = 158136, Sequence = 1, Start = 59664 }, - new Partition{ Description = null, Name = "MS-DOS 3.30", Type = "FAT16", Length = 94776, Sequence = 2, Start = 218064 }, + new[] + { + new Partition + { + Description = null, + Name = "MS-DOS 3.30", + Type = "FAT16", + Length = 59136, + Sequence = 0, + Start = 264 + }, + new Partition + { + Description = null, + Name = "MS-DOS 3.30", + Type = "FAT16", + Length = 158136, + Sequence = 1, + Start = 59664 + }, + new Partition + { + Description = null, + Name = "MS-DOS 3.30", + Type = "FAT16", + Length = 94776, + Sequence = 2, + Start = 218064 + }, }, // Epson MS-DOS 3.30 - new []{ - new Partition{ Description = null, Name = "NamenameName", Type = "FAT12", Length = 35639, Sequence = 0, Start = 264 }, - new Partition{ Description = null, Name = "12BitFAT", Type = "FAT12", Length = 59399, Sequence = 1, Start = 35904 }, - new Partition{ Description = null, Name = "16BitFAT", Type = "FAT16", Length = 79199, Sequence = 2, Start = 95304 }, - new Partition{ Description = null, Name = "PartLblMaxNameXX", Type = "FAT16", Length = 118799, Sequence = 3, Start = 174504 }, - new Partition{ Description = null, Name = "BigFAT12", Type = "FAT12", Length = 158399, Sequence = 4, Start = 293304 }, - new Partition{ Description = null, Name = "Lalalalalalalala", Type = "FAT16", Length = 197999, Sequence = 5, Start = 451704 }, - new Partition{ Description = null, Name = "MS-DOS Ver 5.0", Type = "FAT16", Length = 237599, Sequence = 6, Start = 649704 }, - new Partition{ Description = null, Name = "MS-DOS Ver 5.0", Type = "FAT16", Length = 118799, Sequence = 7, Start = 887304 }, + new[] + { + new Partition + { + Description = null, + Name = "NamenameName", + Type = "FAT12", + Length = 35639, + Sequence = 0, + Start = 264 + }, + new Partition + { + Description = null, + Name = "12BitFAT", + Type = "FAT12", + Length = 59399, + Sequence = 1, + Start = 35904 + }, + new Partition + { + Description = null, + Name = "16BitFAT", + Type = "FAT16", + Length = 79199, + Sequence = 2, + Start = 95304 + }, + new Partition + { + Description = null, + Name = "PartLblMaxNameXX", + Type = "FAT16", + Length = 118799, + Sequence = 3, + Start = 174504 + }, + new Partition + { + Description = null, + Name = "BigFAT12", + Type = "FAT12", + Length = 158399, + Sequence = 4, + Start = 293304 + }, + new Partition + { + Description = null, + Name = "Lalalalalalalala", + Type = "FAT16", + Length = 197999, + Sequence = 5, + Start = 451704 + }, + new Partition + { + Description = null, + Name = "MS-DOS Ver 5.0", + Type = "FAT16", + Length = 237599, + Sequence = 6, + Start = 649704 + }, + new Partition + { + Description = null, + Name = "MS-DOS Ver 5.0", + Type = "FAT16", + Length = 118799, + Sequence = 7, + Start = 887304 + }, }, // NEC MS-DOS 5.00 - new []{ - new Partition{ Description = null, Name = "MS-DOS 5.00", Type = "FAT12", Length = 28512, Sequence = 0, Start = 264 }, - new Partition{ Description = null, Name = "MS-DOS 5.00", Type = "FAT16", Length = 49104, Sequence = 1, Start = 29040 }, - new Partition{ Description = null, Name = "MS-DOS 5.00", Type = "FAT16", Length = 93984, Sequence = 2, Start = 78408 }, - new Partition{ Description = null, Name = "MS-DOS 5.00", Type = "FAT16", Length = 122760, Sequence = 3, Start = 172656 }, - new Partition{ Description = null, Name = "MS-DOS 5.00", Type = "FAT16", Length = 163680, Sequence = 4, Start = 295680 }, - new Partition{ Description = null, Name = "MS-DOS 5.00", Type = "FAT16", Length = 204600, Sequence = 5, Start = 459624 }, - new Partition{ Description = null, Name = "MS-DOS 5.00", Type = "FAT16", Length = 204600, Sequence = 6, Start = 664488 }, - new Partition{ Description = null, Name = "MS-DOS 5.00", Type = "FAT16", Length = 139128, Sequence = 7, Start = 869352 }, + new[] + { + new Partition + { + Description = null, + Name = "MS-DOS 5.00", + Type = "FAT12", + Length = 28512, + Sequence = 0, + Start = 264 + }, + new Partition + { + Description = null, + Name = "MS-DOS 5.00", + Type = "FAT16", + Length = 49104, + Sequence = 1, + Start = 29040 + }, + new Partition + { + Description = null, + Name = "MS-DOS 5.00", + Type = "FAT16", + Length = 93984, + Sequence = 2, + Start = 78408 + }, + new Partition + { + Description = null, + Name = "MS-DOS 5.00", + Type = "FAT16", + Length = 122760, + Sequence = 3, + Start = 172656 + }, + new Partition + { + Description = null, + Name = "MS-DOS 5.00", + Type = "FAT16", + Length = 163680, + Sequence = 4, + Start = 295680 + }, + new Partition + { + Description = null, + Name = "MS-DOS 5.00", + Type = "FAT16", + Length = 204600, + Sequence = 5, + Start = 459624 + }, + new Partition + { + Description = null, + Name = "MS-DOS 5.00", + Type = "FAT16", + Length = 204600, + Sequence = 6, + Start = 664488 + }, + new Partition + { + Description = null, + Name = "MS-DOS 5.00", + Type = "FAT16", + Length = 139128, + Sequence = 7, + Start = 869352 + }, }, // NEC MS-DOS 6.20 - new []{ - new Partition{ Description = null, Name = "MS-DOS 6.20", Type = "FAT16", Length = 61248, Sequence = 0, Start = 264 }, - new Partition{ Description = null, Name = "MS-DOS 6.20", Type = "FAT16", Length = 81840, Sequence = 1, Start = 61776 }, - new Partition{ Description = null, Name = "MS-DOS 6.20", Type = "FAT16", Length = 122760, Sequence = 2, Start = 143880 }, - new Partition{ Description = null, Name = "MS-DOS 6.20", Type = "FAT16", Length = 163680, Sequence = 3, Start = 266904 }, - new Partition{ Description = null, Name = "MS-DOS 6.20", Type = "FAT12", Length = 20328, Sequence = 4, Start = 430848 }, - new Partition{ Description = null, Name = "MS-DOS 6.20", Type = "FAT16", Length = 245520, Sequence = 5, Start = 451440 }, - new Partition{ Description = null, Name = "MS-DOS 6.20", Type = "FAT16", Length = 315216, Sequence = 6, Start = 697224 }, + new[] + { + new Partition + { + Description = null, + Name = "MS-DOS 6.20", + Type = "FAT16", + Length = 61248, + Sequence = 0, + Start = 264 + }, + new Partition + { + Description = null, + Name = "MS-DOS 6.20", + Type = "FAT16", + Length = 81840, + Sequence = 1, + Start = 61776 + }, + new Partition + { + Description = null, + Name = "MS-DOS 6.20", + Type = "FAT16", + Length = 122760, + Sequence = 2, + Start = 143880 + }, + new Partition + { + Description = null, + Name = "MS-DOS 6.20", + Type = "FAT16", + Length = 163680, + Sequence = 3, + Start = 266904 + }, + new Partition + { + Description = null, + Name = "MS-DOS 6.20", + Type = "FAT12", + Length = 20328, + Sequence = 4, + Start = 430848 + }, + new Partition + { + Description = null, + Name = "MS-DOS 6.20", + Type = "FAT16", + Length = 245520, + Sequence = 5, + Start = 451440 + }, + new Partition + { + Description = null, + Name = "MS-DOS 6.20", + Type = "FAT16", + Length = 315216, + Sequence = 6, + Start = 697224 + }, }, }; @@ -120,4 +396,4 @@ namespace DiscImageChef.Tests.Partitions } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Partitions/RDB.cs b/DiscImageChef.Tests/Partitions/RDB.cs index be29c6da..38629139 100644 --- a/DiscImageChef.Tests/Partitions/RDB.cs +++ b/DiscImageChef.Tests/Partitions/RDB.cs @@ -39,51 +39,188 @@ namespace DiscImageChef.Tests.Partitions [TestFixture] public class RDB { - readonly string[] testfiles = { - "amigaos_3.9.vdi.lz","amigaos_4.0.vdi.lz","parted.vdi.lz", - }; + readonly string[] testfiles = {"amigaos_3.9.vdi.lz", "amigaos_4.0.vdi.lz", "parted.vdi.lz",}; - readonly Partition[][] wanted = { + readonly Partition[][] wanted = + { // AmigaOS 3.9 - new []{ - new Partition{ Description = null, Size = 87392256, Name = "UDH0", Type = "\"DOS\\0\"", Offset = 2080768, Length = 170688, - Sequence = 0, Start = 4064 }, - new Partition{ Description = null, Size = 87392256, Name = "UDH1", Type = "\"DOS\\2\"", Offset = 89473024, Length = 170688, - Sequence = 1, Start = 174752 }, - new Partition{ Description = null, Size = 87392256, Name = "UDH2", Type = "\"DOS\\1\"", Offset = 176865280, Length = 170688, - Sequence = 2, Start = 345440 }, - new Partition{ Description = null, Size = 87392256, Name = "UDH3", Type = "\"DOS\\3\"", Offset = 264257536, Length = 170688, - Sequence = 3, Start = 516128 }, - new Partition{ Description = null, Size = 87300096, Name = "FAT16", Type = "0x06", Offset = 351663104, Length = 170508, - Sequence = 4, Start = 686842 }, - new Partition{ Description = null, Size = 85311488, Name = "UDH5", Type = "\"RES\\86\"", Offset = 439042048, Length = 166624, - Sequence = 5, Start = 857504 }, + new[] + { + new Partition + { + Description = null, + Size = 87392256, + Name = "UDH0", + Type = "\"DOS\\0\"", + Offset = 2080768, + Length = 170688, + Sequence = 0, + Start = 4064 + }, + new Partition + { + Description = null, + Size = 87392256, + Name = "UDH1", + Type = "\"DOS\\2\"", + Offset = 89473024, + Length = 170688, + Sequence = 1, + Start = 174752 + }, + new Partition + { + Description = null, + Size = 87392256, + Name = "UDH2", + Type = "\"DOS\\1\"", + Offset = 176865280, + Length = 170688, + Sequence = 2, + Start = 345440 + }, + new Partition + { + Description = null, + Size = 87392256, + Name = "UDH3", + Type = "\"DOS\\3\"", + Offset = 264257536, + Length = 170688, + Sequence = 3, + Start = 516128 + }, + new Partition + { + Description = null, + Size = 87300096, + Name = "FAT16", + Type = "0x06", + Offset = 351663104, + Length = 170508, + Sequence = 4, + Start = 686842 + }, + new Partition + { + Description = null, + Size = 85311488, + Name = "UDH5", + Type = "\"RES\\86\"", + Offset = 439042048, + Length = 166624, + Sequence = 5, + Start = 857504 + }, }, // AmigaOS 4.0 - new []{ - new Partition{ Description = null, Size = 91455488, Name = "DH1", Type = "\"DOS\\1\"", Offset = 1048576, Length = 178624, - Sequence = 0, Start = 2048 }, - new Partition{ Description = null, Size = 76546048, Name = "DH2", Type = "\"DOS\\3\"", Offset = 92504064, Length = 149504, - Sequence = 1, Start = 180672 }, - new Partition{ Description = null, Size = 78741504, Name = "DH3", Type = "\"DOS\\3\"", Offset = 169050112, Length = 153792, - Sequence = 2, Start = 330176 }, - new Partition{ Description = null, Size = 78020608, Name = "DH4", Type = "\"DOS\\7\"", Offset = 247791616, Length = 152384, - Sequence = 3, Start = 483968 }, - new Partition{ Description = null, Size = 85000192, Name = "DH5", Type = "\"SFS\\0\"", Offset = 325812224, Length = 166016, - Sequence = 4, Start = 636352 }, - new Partition{ Description = null, Size = 113541120, Name = "DH6", Type = "\"SFS\\2\"", Offset = 410812416, Length = 221760, - Sequence = 5, Start = 802368 }, + new[] + { + new Partition + { + Description = null, + Size = 91455488, + Name = "DH1", + Type = "\"DOS\\1\"", + Offset = 1048576, + Length = 178624, + Sequence = 0, + Start = 2048 + }, + new Partition + { + Description = null, + Size = 76546048, + Name = "DH2", + Type = "\"DOS\\3\"", + Offset = 92504064, + Length = 149504, + Sequence = 1, + Start = 180672 + }, + new Partition + { + Description = null, + Size = 78741504, + Name = "DH3", + Type = "\"DOS\\3\"", + Offset = 169050112, + Length = 153792, + Sequence = 2, + Start = 330176 + }, + new Partition + { + Description = null, + Size = 78020608, + Name = "DH4", + Type = "\"DOS\\7\"", + Offset = 247791616, + Length = 152384, + Sequence = 3, + Start = 483968 + }, + new Partition + { + Description = null, + Size = 85000192, + Name = "DH5", + Type = "\"SFS\\0\"", + Offset = 325812224, + Length = 166016, + Sequence = 4, + Start = 636352 + }, + new Partition + { + Description = null, + Size = 113541120, + Name = "DH6", + Type = "\"SFS\\2\"", + Offset = 410812416, + Length = 221760, + Sequence = 5, + Start = 802368 + }, }, // Parted - new []{ - new Partition{ Description = null, Size = 8225280, Name = "primary", Type = "\"\0\0\0\\0\"", Offset = 8225280, Length = 16065, - Sequence = 0, Start = 16065 }, - new Partition{ Description = null, Size = 24675840, Name = "name", Type = "\"FAT\\1\"", Offset = 16450560, Length = 48195, - Sequence = 1, Start = 32130 }, - new Partition{ Description = null, Size = 90478080, Name = "partition", Type = "\"\0\0\0\\0\"", Offset = 41126400, Length = 176715, - Sequence = 2, Start = 80325 }, + new[] + { + new Partition + { + Description = null, + Size = 8225280, + Name = "primary", + Type = "\"\0\0\0\\0\"", + Offset = 8225280, + Length = 16065, + Sequence = 0, + Start = 16065 + }, + new Partition + { + Description = null, + Size = 24675840, + Name = "name", + Type = "\"FAT\\1\"", + Offset = 16450560, + Length = 48195, + Sequence = 1, + Start = 32130 + }, + new Partition + { + Description = null, + Size = 90478080, + Name = "partition", + Type = "\"\0\0\0\\0\"", + Offset = 41126400, + Length = 176715, + Sequence = 2, + Start = 80325 + }, }, - }; + }; [Test] public void Test() @@ -112,4 +249,4 @@ namespace DiscImageChef.Tests.Partitions } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Partitions/SGI.cs b/DiscImageChef.Tests/Partitions/SGI.cs index 15692539..e505c5cf 100644 --- a/DiscImageChef.Tests/Partitions/SGI.cs +++ b/DiscImageChef.Tests/Partitions/SGI.cs @@ -39,36 +39,181 @@ namespace DiscImageChef.Tests.Partitions [TestFixture] public class SGI { - readonly string[] testfiles = { - "linux.vdi.lz","parted.vdi.lz", - }; + readonly string[] testfiles = {"linux.vdi.lz", "parted.vdi.lz",}; - readonly Partition[][] wanted = { + readonly Partition[][] wanted = + { // Linux's fdisk - new []{ - new Partition{ Description = null, Name = null, Type = "XFS", Length = 40961, Sequence = 0, Start = 16065 }, - new Partition{ Description = null, Name = null, Type = "Linux RAID", Length = 61441, Sequence = 1, Start = 64260 }, - new Partition{ Description = null, Name = null, Type = "Track replacements", Length = 81921, Sequence = 2, Start = 128520 }, - new Partition{ Description = null, Name = null, Type = "Sector replacements", Length = 92161, Sequence = 3, Start = 224910 }, - new Partition{ Description = null, Name = null, Type = "Raw data (swap)", Length = 102401, Sequence = 4, Start = 321300 }, - new Partition{ Description = null, Name = null, Type = "4.2BSD Fast File System", Length = 30721, Sequence = 5, Start = 433755 }, - new Partition{ Description = null, Name = null, Type = "UNIX System V", Length = 71681, Sequence = 6, Start = 465885 }, - new Partition{ Description = null, Name = null, Type = "EFS", Length = 10241, Sequence = 7, Start = 546210 }, - new Partition{ Description = null, Name = null, Type = "Logical volume", Length = 122881, Sequence = 8, Start = 562275 }, - new Partition{ Description = null, Name = null, Type = "Raw logical volume", Length = 133121, Sequence = 9, Start = 690795 }, - new Partition{ Description = null, Name = null, Type = "XFS log device", Length = 51201, Sequence = 10, Start = 835380 }, - new Partition{ Description = null, Name = null, Type = "Linux swap", Length = 30721, Sequence = 11, Start = 899640 }, - new Partition{ Description = null, Name = null, Type = "SGI XVM", Length = 6145, Sequence = 12, Start = 931770 }, - new Partition{ Description = null, Name = null, Type = "Linux", Length = 64260, Sequence = 13, Start = 947835 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "XFS", + Length = 40961, + Sequence = 0, + Start = 16065 + }, + new Partition + { + Description = null, + Name = null, + Type = "Linux RAID", + Length = 61441, + Sequence = 1, + Start = 64260 + }, + new Partition + { + Description = null, + Name = null, + Type = "Track replacements", + Length = 81921, + Sequence = 2, + Start = 128520 + }, + new Partition + { + Description = null, + Name = null, + Type = "Sector replacements", + Length = 92161, + Sequence = 3, + Start = 224910 + }, + new Partition + { + Description = null, + Name = null, + Type = "Raw data (swap)", + Length = 102401, + Sequence = 4, + Start = 321300 + }, + new Partition + { + Description = null, + Name = null, + Type = "4.2BSD Fast File System", + Length = 30721, + Sequence = 5, + Start = 433755 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX System V", + Length = 71681, + Sequence = 6, + Start = 465885 + }, + new Partition + { + Description = null, + Name = null, + Type = "EFS", + Length = 10241, + Sequence = 7, + Start = 546210 + }, + new Partition + { + Description = null, + Name = null, + Type = "Logical volume", + Length = 122881, + Sequence = 8, + Start = 562275 + }, + new Partition + { + Description = null, + Name = null, + Type = "Raw logical volume", + Length = 133121, + Sequence = 9, + Start = 690795 + }, + new Partition + { + Description = null, + Name = null, + Type = "XFS log device", + Length = 51201, + Sequence = 10, + Start = 835380 + }, + new Partition + { + Description = null, + Name = null, + Type = "Linux swap", + Length = 30721, + Sequence = 11, + Start = 899640 + }, + new Partition + { + Description = null, + Name = null, + Type = "SGI XVM", + Length = 6145, + Sequence = 12, + Start = 931770 + }, + new Partition + { + Description = null, + Name = null, + Type = "Linux", + Length = 64260, + Sequence = 13, + Start = 947835 + }, }, // GNU Parted - new []{ - new Partition{ Description = null, Name = null, Type = "Raw data (swap)", Length = 22528, Sequence = 0, Start = 6144 }, - new Partition{ Description = null, Name = null, Type = "Raw data (swap)", Length = 67584, Sequence = 1, Start = 30720 }, - new Partition{ Description = null, Name = null, Type = "Raw data (swap)", Length = 94208, Sequence = 2, Start = 100352 }, - new Partition{ Description = null, Name = null, Type = "XFS", Length = 36864, Sequence = 3, Start = 196608 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "Raw data (swap)", + Length = 22528, + Sequence = 0, + Start = 6144 + }, + new Partition + { + Description = null, + Name = null, + Type = "Raw data (swap)", + Length = 67584, + Sequence = 1, + Start = 30720 + }, + new Partition + { + Description = null, + Name = null, + Type = "Raw data (swap)", + Length = 94208, + Sequence = 2, + Start = 100352 + }, + new Partition + { + Description = null, + Name = null, + Type = "XFS", + Length = 36864, + Sequence = 3, + Start = 196608 + }, }, - }; + }; [Test] public void Test() @@ -87,7 +232,7 @@ namespace DiscImageChef.Tests.Partitions // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); Assert.AreEqual(wanted[i][j].Length * 512, partitions[j].Size, testfiles[i]); -// Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); + // Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); Assert.AreEqual(wanted[i][j].Type, partitions[j].Type, testfiles[i]); Assert.AreEqual(wanted[i][j].Start * 512, partitions[j].Offset, testfiles[i]); Assert.AreEqual(wanted[i][j].Length, partitions[j].Length, testfiles[i]); @@ -97,4 +242,4 @@ namespace DiscImageChef.Tests.Partitions } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Partitions/Sun.cs b/DiscImageChef.Tests/Partitions/Sun.cs index dd574aa7..263d02d8 100644 --- a/DiscImageChef.Tests/Partitions/Sun.cs +++ b/DiscImageChef.Tests/Partitions/Sun.cs @@ -40,28 +40,109 @@ namespace DiscImageChef.Tests.Partitions [TestFixture] public class Sun { - readonly string[] testfiles = { - "linux.vdi.lz","parted.vdi.lz", - }; + readonly string[] testfiles = {"linux.vdi.lz", "parted.vdi.lz",}; - readonly Partition[][] wanted = { + readonly Partition[][] wanted = + { // Linux's fdisk - new []{ - new Partition{ Description = null, Name = null, Type = "Linux", Length = 204800, Sequence = 0, Start = 0 }, - new Partition{ Description = null, Name = null, Type = "Sun boot", Length = 102400, Sequence = 1, Start = 208845 }, - new Partition{ Description = null, Name = null, Type = "Sun /", Length = 102400, Sequence = 2, Start = 321300 }, - new Partition{ Description = null, Name = null, Type = "Sun /home", Length = 102400, Sequence = 3, Start = 433755 }, - new Partition{ Description = null, Name = null, Type = "Sun swap", Length = 153600, Sequence = 4, Start = 546210 }, - new Partition{ Description = null, Name = null, Type = "Sun /usr", Length = 208845, Sequence = 5, Start = 706860 }, - new Partition{ Description = null, Name = null, Type = "Linux swap", Length = 96390, Sequence = 6, Start = 915705 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "Linux", + Length = 204800, + Sequence = 0, + Start = 0 + }, + new Partition + { + Description = null, + Name = null, + Type = "Sun boot", + Length = 102400, + Sequence = 1, + Start = 208845 + }, + new Partition + { + Description = null, + Name = null, + Type = "Sun /", + Length = 102400, + Sequence = 2, + Start = 321300 + }, + new Partition + { + Description = null, + Name = null, + Type = "Sun /home", + Length = 102400, + Sequence = 3, + Start = 433755 + }, + new Partition + { + Description = null, + Name = null, + Type = "Sun swap", + Length = 153600, + Sequence = 4, + Start = 546210 + }, + new Partition + { + Description = null, + Name = null, + Type = "Sun /usr", + Length = 208845, + Sequence = 5, + Start = 706860 + }, + new Partition + { + Description = null, + Name = null, + Type = "Linux swap", + Length = 96390, + Sequence = 6, + Start = 915705 + }, }, // GNU Parted - new []{ - new Partition{ Description = null, Name = null, Type = "Linux", Length = 49152, Sequence = 0, Start = 0 }, - new Partition{ Description = null, Name = null, Type = "Linux", Length = 80325, Sequence = 1, Start = 64260 }, - new Partition{ Description = null, Name = null, Type = "Linux", Length = 96390, Sequence = 2, Start = 144585 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "Linux", + Length = 49152, + Sequence = 0, + Start = 0 + }, + new Partition + { + Description = null, + Name = null, + Type = "Linux", + Length = 80325, + Sequence = 1, + Start = 64260 + }, + new Partition + { + Description = null, + Name = null, + Type = "Linux", + Length = 96390, + Sequence = 2, + Start = 144585 + }, }, - }; + }; [Test] public void Test() @@ -80,7 +161,7 @@ namespace DiscImageChef.Tests.Partitions // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); Assert.AreEqual(wanted[i][j].Length * 512, partitions[j].Size, testfiles[i]); -// Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); + // Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); Assert.AreEqual(wanted[i][j].Type, partitions[j].Type, testfiles[i]); Assert.AreEqual(wanted[i][j].Start * 512, partitions[j].Offset, testfiles[i]); Assert.AreEqual(wanted[i][j].Length, partitions[j].Length, testfiles[i]); @@ -90,4 +171,4 @@ namespace DiscImageChef.Tests.Partitions } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Partitions/VTOC.cs b/DiscImageChef.Tests/Partitions/VTOC.cs index 97bfca5b..a50707d9 100644 --- a/DiscImageChef.Tests/Partitions/VTOC.cs +++ b/DiscImageChef.Tests/Partitions/VTOC.cs @@ -39,31 +39,159 @@ namespace DiscImageChef.Tests.Partitions [TestFixture] public class VTOC { - readonly string[] testfiles = { - "att_unix_vtoc.vdi.lz", - }; + readonly string[] testfiles = {"att_unix_vtoc.vdi.lz",}; - readonly Partition[][] wanted = { + readonly Partition[][] wanted = + { // AT&T UNIX System V Release 4 Version 2.1 for 386 - new []{ - new Partition{ Description = null, Name = null, Type = "UNIX: Boot", Length = 34, Sequence = 0, Start = 1 }, - new Partition{ Description = null, Name = null, Type = "UNIX: Whole disk", Length = 1023119, Sequence = 1, Start = 1 }, - new Partition{ Description = null, Name = null, Type = "UNIX: Stand", Length = 253, Sequence = 2, Start = 63 }, - new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 3, Start = 378 }, - new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 4, Start = 79002 }, - new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 5, Start = 157626 }, - new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 6, Start = 236250 }, - new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 7, Start = 314874 }, - new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 8, Start = 393498 }, - new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 9, Start = 472122 }, - new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 10, Start = 550746 }, - new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 11, Start = 629370 }, - new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 76608, Sequence = 12, Start = 707994 }, - new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 77616, Sequence = 13, Start = 784602 }, - new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 75600, Sequence = 14, Start = 862218 }, - new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 84672, Sequence = 15, Start = 937818 }, + new[] + { + new Partition + { + Description = null, + Name = null, + Type = "UNIX: Boot", + Length = 34, + Sequence = 0, + Start = 1 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: Whole disk", + Length = 1023119, + Sequence = 1, + Start = 1 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: Stand", + Length = 253, + Sequence = 2, + Start = 63 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: /usr", + Length = 78624, + Sequence = 3, + Start = 378 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: /usr", + Length = 78624, + Sequence = 4, + Start = 79002 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: /usr", + Length = 78624, + Sequence = 5, + Start = 157626 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: /usr", + Length = 78624, + Sequence = 6, + Start = 236250 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: /usr", + Length = 78624, + Sequence = 7, + Start = 314874 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: /usr", + Length = 78624, + Sequence = 8, + Start = 393498 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: /usr", + Length = 78624, + Sequence = 9, + Start = 472122 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: /usr", + Length = 78624, + Sequence = 10, + Start = 550746 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: /usr", + Length = 78624, + Sequence = 11, + Start = 629370 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: /usr", + Length = 76608, + Sequence = 12, + Start = 707994 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: /usr", + Length = 77616, + Sequence = 13, + Start = 784602 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: /usr", + Length = 75600, + Sequence = 14, + Start = 862218 + }, + new Partition + { + Description = null, + Name = null, + Type = "UNIX: /usr", + Length = 84672, + Sequence = 15, + Start = 937818 + }, }, - }; + }; [Test] public void Test() @@ -82,7 +210,7 @@ namespace DiscImageChef.Tests.Partitions // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); Assert.AreEqual(wanted[i][j].Length * 512, partitions[j].Size, testfiles[i]); -// Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); + // Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); Assert.AreEqual(wanted[i][j].Type, partitions[j].Type, testfiles[i]); Assert.AreEqual(wanted[i][j].Start * 512, partitions[j].Offset, testfiles[i]); Assert.AreEqual(wanted[i][j].Length, partitions[j].Length, testfiles[i]); @@ -92,4 +220,4 @@ namespace DiscImageChef.Tests.Partitions } } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Tests/packages.config b/DiscImageChef.Tests/packages.config index 68fa5795..19a2a03f 100644 --- a/DiscImageChef.Tests/packages.config +++ b/DiscImageChef.Tests/packages.config @@ -1,6 +1,7 @@  + - - - + + + \ No newline at end of file diff --git a/DiscImageChef/AssemblyInfo.cs b/DiscImageChef/AssemblyInfo.cs index 1aa2ae5d..e831d76e 100644 --- a/DiscImageChef/AssemblyInfo.cs +++ b/DiscImageChef/AssemblyInfo.cs @@ -54,5 +54,4 @@ using System.Reflection; // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/DiscImageChef/Commands/Analyze.cs b/DiscImageChef/Commands/Analyze.cs index f0679d0c..63ac6803 100644 --- a/DiscImageChef/Commands/Analyze.cs +++ b/DiscImageChef/Commands/Analyze.cs @@ -68,8 +68,7 @@ namespace DiscImageChef.Commands try { encoding = Claunia.Encoding.Encoding.GetEncoding(options.EncodingName); - if(options.Verbose) - DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName); + if(options.Verbose) DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName); } catch(ArgumentException) { @@ -100,9 +99,9 @@ namespace DiscImageChef.Commands else { if(options.Verbose) - DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", _imageFormat.Name, _imageFormat.PluginUUID); - else - DicConsole.WriteLine("Image format identified by {0}.", _imageFormat.Name); + DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", _imageFormat.Name, + _imageFormat.PluginUUID); + else DicConsole.WriteLine("Image format identified by {0}.", _imageFormat.Name); } try @@ -115,9 +114,11 @@ namespace DiscImageChef.Commands } DicConsole.DebugWriteLine("Analyze command", "Correctly opened image file."); - DicConsole.DebugWriteLine("Analyze command", "Image without headers is {0} bytes.", _imageFormat.GetImageSize()); + DicConsole.DebugWriteLine("Analyze command", "Image without headers is {0} bytes.", + _imageFormat.GetImageSize()); DicConsole.DebugWriteLine("Analyze command", "Image has {0} sectors.", _imageFormat.GetSectors()); - DicConsole.DebugWriteLine("Analyze command", "Image identifies disk type as {0}.", _imageFormat.GetMediaType()); + DicConsole.DebugWriteLine("Analyze command", "Image identifies disk type as {0}.", + _imageFormat.GetMediaType()); Core.Statistics.AddMediaFormat(_imageFormat.GetImageFormat()); Core.Statistics.AddMedia(_imageFormat.ImageInfo.mediaType, false); @@ -144,6 +145,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("No partitions founds, not searching for filesystems"); return; } + checkraw = true; } else @@ -156,8 +158,10 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Partition {0}:", partitions[i].Sequence); DicConsole.WriteLine("Partition name: {0}", partitions[i].Name); DicConsole.WriteLine("Partition type: {0}", partitions[i].Type); - DicConsole.WriteLine("Partition start: sector {0}, byte {1}", partitions[i].Start, partitions[i].Offset); - DicConsole.WriteLine("Partition length: {0} sectors, {1} bytes", partitions[i].Length, partitions[i].Size); + DicConsole.WriteLine("Partition start: sector {0}, byte {1}", partitions[i].Start, + partitions[i].Offset); + DicConsole.WriteLine("Partition length: {0} sectors, {1} bytes", partitions[i].Length, + partitions[i].Size); DicConsole.WriteLine("Partition scheme: {0}", partitions[i].Scheme); DicConsole.WriteLine("Partition description:"); DicConsole.WriteLine(partitions[i].Description); @@ -167,8 +171,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Identifying filesystem on partition"); Core.Filesystems.Identify(_imageFormat, out id_plugins, partitions[i]); - if(id_plugins.Count == 0) - DicConsole.WriteLine("Filesystem not identified"); + if(id_plugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(id_plugins.Count > 1) { DicConsole.WriteLine(string.Format("Identified by {0} plugins", id_plugins.Count)); @@ -207,8 +210,7 @@ namespace DiscImageChef.Commands }; Core.Filesystems.Identify(_imageFormat, out id_plugins, wholePart); - if(id_plugins.Count == 0) - DicConsole.WriteLine("Filesystem not identified"); + if(id_plugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(id_plugins.Count > 1) { DicConsole.WriteLine(string.Format("Identified by {0} plugins", id_plugins.Count)); @@ -243,5 +245,4 @@ namespace DiscImageChef.Commands Core.Statistics.AddCommand("analyze"); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/Benchmark.cs b/DiscImageChef/Commands/Benchmark.cs index 3f9ef184..fc557cfa 100644 --- a/DiscImageChef/Commands/Benchmark.cs +++ b/DiscImageChef/Commands/Benchmark.cs @@ -47,26 +47,32 @@ namespace DiscImageChef.Commands BenchmarkResults results = Core.Benchmark.Do(options.BufferSize * 1024 * 1024, options.BlockSize); - DicConsole.WriteLine("Took {0} seconds to fill buffer, {1:F3} MiB/sec.", results.fillTime, results.fillSpeed); - DicConsole.WriteLine("Took {0} seconds to read buffer, {1:F3} MiB/sec.", results.readTime, results.readSpeed); - DicConsole.WriteLine("Took {0} seconds to entropy buffer, {1:F3} MiB/sec.", results.entropyTime, results.entropySpeed); + DicConsole.WriteLine("Took {0} seconds to fill buffer, {1:F3} MiB/sec.", results.fillTime, + results.fillSpeed); + DicConsole.WriteLine("Took {0} seconds to read buffer, {1:F3} MiB/sec.", results.readTime, + results.readSpeed); + DicConsole.WriteLine("Took {0} seconds to entropy buffer, {1:F3} MiB/sec.", results.entropyTime, + results.entropySpeed); foreach(KeyValuePair entry in results.entries) { checksumTimes.Add(entry.Key, entry.Value.timeSpan); - DicConsole.WriteLine("Took {0} seconds to {1} buffer, {2:F3} MiB/sec.", entry.Value.timeSpan, entry.Key, entry.Value.speed); + DicConsole.WriteLine("Took {0} seconds to {1} buffer, {2:F3} MiB/sec.", entry.Value.timeSpan, entry.Key, + entry.Value.speed); } - DicConsole.WriteLine("Took {0} seconds to do all algorithms at the same time, {1} MiB/sec.", results.totalTime, results.totalSpeed); - DicConsole.WriteLine("Took {0} seconds to do all algorithms sequentially, {1} MiB/sec.", results.separateTime, results.separateSpeed); + DicConsole.WriteLine("Took {0} seconds to do all algorithms at the same time, {1} MiB/sec.", + results.totalTime, results.totalSpeed); + DicConsole.WriteLine("Took {0} seconds to do all algorithms sequentially, {1} MiB/sec.", + results.separateTime, results.separateSpeed); DicConsole.WriteLine(); DicConsole.WriteLine("Max memory used is {0} bytes", results.maxMemory); DicConsole.WriteLine("Min memory used is {0} bytes", results.minMemory); Core.Statistics.AddCommand("benchmark"); - Core.Statistics.AddBenchmark(checksumTimes, results.entropyTime, results.totalTime, results.separateTime, results.maxMemory, results.minMemory); + Core.Statistics.AddBenchmark(checksumTimes, results.entropyTime, results.totalTime, results.separateTime, + results.maxMemory, results.minMemory); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/Checksum.cs b/DiscImageChef/Commands/Checksum.cs index da96b4bb..5ce2cc16 100644 --- a/DiscImageChef/Commands/Checksum.cs +++ b/DiscImageChef/Commands/Checksum.cs @@ -87,28 +87,17 @@ namespace DiscImageChef.Commands Core.Statistics.AddFilter(inputFilter.Name); EnableChecksum enabledChecksums = new EnableChecksum(); - if(options.DoAdler32) - enabledChecksums |= EnableChecksum.Adler32; - if(options.DoCRC16) - enabledChecksums |= EnableChecksum.CRC16; - if(options.DoCRC32) - enabledChecksums |= EnableChecksum.CRC32; - if(options.DoCRC64) - enabledChecksums |= EnableChecksum.CRC64; - if(options.DoMD5) - enabledChecksums |= EnableChecksum.MD5; - if(options.DoRIPEMD160) - enabledChecksums |= EnableChecksum.RIPEMD160; - if(options.DoSHA1) - enabledChecksums |= EnableChecksum.SHA1; - if(options.DoSHA256) - enabledChecksums |= EnableChecksum.SHA256; - if(options.DoSHA384) - enabledChecksums |= EnableChecksum.SHA384; - if(options.DoSHA512) - enabledChecksums |= EnableChecksum.SHA512; - if(options.DoSpamSum) - enabledChecksums |= EnableChecksum.SpamSum; + if(options.DoAdler32) enabledChecksums |= EnableChecksum.Adler32; + if(options.DoCRC16) enabledChecksums |= EnableChecksum.CRC16; + if(options.DoCRC32) enabledChecksums |= EnableChecksum.CRC32; + if(options.DoCRC64) enabledChecksums |= EnableChecksum.CRC64; + if(options.DoMD5) enabledChecksums |= EnableChecksum.MD5; + if(options.DoRIPEMD160) enabledChecksums |= EnableChecksum.RIPEMD160; + if(options.DoSHA1) enabledChecksums |= EnableChecksum.SHA1; + if(options.DoSHA256) enabledChecksums |= EnableChecksum.SHA256; + if(options.DoSHA384) enabledChecksums |= EnableChecksum.SHA384; + if(options.DoSHA512) enabledChecksums |= EnableChecksum.SHA512; + if(options.DoSpamSum) enabledChecksums |= EnableChecksum.SpamSum; Core.Checksum mediaChecksum = null; @@ -118,16 +107,14 @@ namespace DiscImageChef.Commands { Core.Checksum trackChecksum = null; - if(options.WholeDisc) - mediaChecksum = new Core.Checksum(enabledChecksums); + if(options.WholeDisc) mediaChecksum = new Core.Checksum(enabledChecksums); ulong previousTrackEnd = 0; List inputTracks = inputFormat.GetTracks(); foreach(Track currentTrack in inputTracks) { - if((currentTrack.TrackStartSector - previousTrackEnd) != 0 && - options.WholeDisc) + if((currentTrack.TrackStartSector - previousTrackEnd) != 0 && options.WholeDisc) { for(ulong i = previousTrackEnd + 1; i < currentTrack.TrackStartSector; i++) { @@ -139,11 +126,12 @@ namespace DiscImageChef.Commands } } - DicConsole.DebugWriteLine("Checksum command", "Track {0} starts at sector {1} and ends at sector {2}", currentTrack.TrackSequence, - currentTrack.TrackStartSector, currentTrack.TrackEndSector); + DicConsole.DebugWriteLine("Checksum command", + "Track {0} starts at sector {1} and ends at sector {2}", + currentTrack.TrackSequence, currentTrack.TrackStartSector, + currentTrack.TrackEndSector); - if(options.SeparatedTracks) - trackChecksum = new Core.Checksum(enabledChecksums); + if(options.SeparatedTracks) trackChecksum = new Core.Checksum(enabledChecksums); ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1; ulong doneSectors = 0; @@ -155,22 +143,24 @@ namespace DiscImageChef.Commands if((sectors - doneSectors) >= sectorsToRead) { - sector = inputFormat.ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence); - DicConsole.Write("\rHashings sectors {0} to {2} of track {1}", doneSectors, currentTrack.TrackSequence, doneSectors + sectorsToRead); + sector = inputFormat.ReadSectors(doneSectors, sectorsToRead, + currentTrack.TrackSequence); + DicConsole.Write("\rHashings sectors {0} to {2} of track {1}", doneSectors, + currentTrack.TrackSequence, doneSectors + sectorsToRead); doneSectors += sectorsToRead; } else { - sector = inputFormat.ReadSectors(doneSectors, (uint)(sectors - doneSectors), currentTrack.TrackSequence); - DicConsole.Write("\rHashings sectors {0} to {2} of track {1}", doneSectors, currentTrack.TrackSequence, doneSectors + (sectors - doneSectors)); + sector = inputFormat.ReadSectors(doneSectors, (uint)(sectors - doneSectors), + currentTrack.TrackSequence); + DicConsole.Write("\rHashings sectors {0} to {2} of track {1}", doneSectors, + currentTrack.TrackSequence, doneSectors + (sectors - doneSectors)); doneSectors += (sectors - doneSectors); } - if(options.WholeDisc) - mediaChecksum.Update(sector); + if(options.WholeDisc) mediaChecksum.Update(sector); - if(options.SeparatedTracks) - trackChecksum.Update(sector); + if(options.SeparatedTracks) trackChecksum.Update(sector); } DicConsole.WriteLine(); @@ -178,14 +168,14 @@ namespace DiscImageChef.Commands if(options.SeparatedTracks) { foreach(ChecksumType chk in trackChecksum.End()) - DicConsole.WriteLine("Track {0}'s {1}: {2}", currentTrack.TrackSequence, chk.type, chk.Value); + DicConsole.WriteLine("Track {0}'s {1}: {2}", currentTrack.TrackSequence, chk.type, + chk.Value); } previousTrackEnd = currentTrack.TrackEndSector; } - if((inputFormat.GetSectors() - previousTrackEnd) != 0 && - options.WholeDisc) + if((inputFormat.GetSectors() - previousTrackEnd) != 0 && options.WholeDisc) { for(ulong i = previousTrackEnd + 1; i < inputFormat.GetSectors(); i++) { @@ -204,10 +194,8 @@ namespace DiscImageChef.Commands } catch(Exception ex) { - if(options.Debug) - DicConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message); - else - DicConsole.WriteLine("Unable to get separate tracks, not checksumming them"); + if(options.Debug) DicConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message); + else DicConsole.WriteLine("Unable to get separate tracks, not checksumming them"); } } else @@ -231,7 +219,8 @@ namespace DiscImageChef.Commands else { sector = inputFormat.ReadSectors(doneSectors, (uint)(sectors - doneSectors)); - DicConsole.Write("\rHashings sectors {0} to {1}", doneSectors, doneSectors + (sectors - doneSectors)); + DicConsole.Write("\rHashings sectors {0} to {1}", doneSectors, + doneSectors + (sectors - doneSectors)); doneSectors += (sectors - doneSectors); } diff --git a/DiscImageChef/Commands/Commands.cs b/DiscImageChef/Commands/Commands.cs index ae552e87..b400d183 100644 --- a/DiscImageChef/Commands/Commands.cs +++ b/DiscImageChef/Commands/Commands.cs @@ -32,8 +32,5 @@ namespace DiscImageChef.Commands { - public class Commands - { - } -} - + public class Commands { } +} \ No newline at end of file diff --git a/DiscImageChef/Commands/Compare.cs b/DiscImageChef/Commands/Compare.cs index f51cc7d8..f5c21680 100644 --- a/DiscImageChef/Commands/Compare.cs +++ b/DiscImageChef/Commands/Compare.cs @@ -77,9 +77,9 @@ namespace DiscImageChef.Commands else { if(options.Verbose) - DicConsole.VerboseWriteLine("Input file 1 format identified by {0} ({1}).", input1Format.Name, input1Format.PluginUUID); - else - DicConsole.WriteLine("Input file 1 format identified by {0}.", input1Format.Name); + DicConsole.VerboseWriteLine("Input file 1 format identified by {0} ({1}).", input1Format.Name, + input1Format.PluginUUID); + else DicConsole.WriteLine("Input file 1 format identified by {0}.", input1Format.Name); } if(input2Format == null) @@ -90,9 +90,9 @@ namespace DiscImageChef.Commands else { if(options.Verbose) - DicConsole.VerboseWriteLine("Input file 2 format identified by {0} ({1}).", input2Format.Name, input2Format.PluginUUID); - else - DicConsole.WriteLine("Input file 2 format identified by {0}.", input2Format.Name); + DicConsole.VerboseWriteLine("Input file 2 format identified by {0} ({1}).", input2Format.Name, + input2Format.PluginUUID); + else DicConsole.WriteLine("Input file 2 format identified by {0}.", input2Format.Name); } input1Format.OpenImage(inputFilter1); @@ -131,7 +131,8 @@ namespace DiscImageChef.Commands image1Info.imageHasPartitions = input1Format.ImageHasPartitions(); #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - try { image1Sessions = input1Format.GetSessions(); } catch { } + try { image1Sessions = input1Format.GetSessions(); } + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body image1Info.imageHasSessions |= image1Sessions.Count > 0; image1Info.imageSize = input1Format.GetImageSize(); @@ -140,23 +141,40 @@ namespace DiscImageChef.Commands image1Info.imageCreationTime = input1Format.GetImageCreationTime(); image1Info.imageLastModificationTime = input1Format.GetImageLastModificationTime(); image1Info.mediaType = input1Format.GetMediaType(); - try { image1Info.imageVersion = input1Format.GetImageVersion(); } catch { image1Info.imageVersion = null; } - try { image1Info.imageApplication = input1Format.GetImageApplication(); } catch { image1Info.imageApplication = null; } - try { image1Info.imageApplicationVersion = input1Format.GetImageApplicationVersion(); } catch { image1Info.imageApplicationVersion = null; } - try { image1Info.imageCreator = input1Format.GetImageCreator(); } catch { image1Info.imageCreator = null; } - try { image1Info.imageName = input1Format.GetImageName(); } catch { image1Info.imageName = null; } - try { image1Info.imageComments = input1Format.GetImageComments(); } catch { image1Info.imageComments = null; } - try { image1Info.mediaManufacturer = input1Format.GetMediaManufacturer(); } catch { image1Info.mediaManufacturer = null; } - try { image1Info.mediaModel = input1Format.GetMediaModel(); } catch { image1Info.mediaModel = null; } - try { image1Info.mediaSerialNumber = input1Format.GetMediaSerialNumber(); } catch { image1Info.mediaSerialNumber = null; } - try { image1Info.mediaBarcode = input1Format.GetMediaBarcode(); } catch { image1Info.mediaBarcode = null; } - try { image1Info.mediaPartNumber = input1Format.GetMediaPartNumber(); } catch { image1Info.mediaPartNumber = null; } - try { image1Info.mediaSequence = input1Format.GetMediaSequence(); } catch { image1Info.mediaSequence = 0; } - try { image1Info.lastMediaSequence = input1Format.GetLastDiskSequence(); } catch { image1Info.lastMediaSequence = 0; } - try { image1Info.driveManufacturer = input1Format.GetDriveManufacturer(); } catch { image1Info.driveManufacturer = null; } - try { image1Info.driveModel = input1Format.GetDriveModel(); } catch { image1Info.driveModel = null; } - try { image1Info.driveSerialNumber = input1Format.GetDriveSerialNumber(); } catch { image1Info.driveSerialNumber = null; } - try { image1Info.driveFirmwareRevision = input1Format.ImageInfo.driveFirmwareRevision; } catch { image1Info.driveFirmwareRevision = null; } + try { image1Info.imageVersion = input1Format.GetImageVersion(); } + catch { image1Info.imageVersion = null; } + try { image1Info.imageApplication = input1Format.GetImageApplication(); } + catch { image1Info.imageApplication = null; } + try { image1Info.imageApplicationVersion = input1Format.GetImageApplicationVersion(); } + catch { image1Info.imageApplicationVersion = null; } + try { image1Info.imageCreator = input1Format.GetImageCreator(); } + catch { image1Info.imageCreator = null; } + try { image1Info.imageName = input1Format.GetImageName(); } + catch { image1Info.imageName = null; } + try { image1Info.imageComments = input1Format.GetImageComments(); } + catch { image1Info.imageComments = null; } + try { image1Info.mediaManufacturer = input1Format.GetMediaManufacturer(); } + catch { image1Info.mediaManufacturer = null; } + try { image1Info.mediaModel = input1Format.GetMediaModel(); } + catch { image1Info.mediaModel = null; } + try { image1Info.mediaSerialNumber = input1Format.GetMediaSerialNumber(); } + catch { image1Info.mediaSerialNumber = null; } + try { image1Info.mediaBarcode = input1Format.GetMediaBarcode(); } + catch { image1Info.mediaBarcode = null; } + try { image1Info.mediaPartNumber = input1Format.GetMediaPartNumber(); } + catch { image1Info.mediaPartNumber = null; } + try { image1Info.mediaSequence = input1Format.GetMediaSequence(); } + catch { image1Info.mediaSequence = 0; } + try { image1Info.lastMediaSequence = input1Format.GetLastDiskSequence(); } + catch { image1Info.lastMediaSequence = 0; } + try { image1Info.driveManufacturer = input1Format.GetDriveManufacturer(); } + catch { image1Info.driveManufacturer = null; } + try { image1Info.driveModel = input1Format.GetDriveModel(); } + catch { image1Info.driveModel = null; } + try { image1Info.driveSerialNumber = input1Format.GetDriveSerialNumber(); } + catch { image1Info.driveSerialNumber = null; } + try { image1Info.driveFirmwareRevision = input1Format.ImageInfo.driveFirmwareRevision; } + catch { image1Info.driveFirmwareRevision = null; } foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType))) { try @@ -165,15 +183,14 @@ namespace DiscImageChef.Commands image1DiskTags.Add(disktag, temparray); } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - catch + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body - { - } } image2Info.imageHasPartitions = input2Format.ImageHasPartitions(); #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - try { image2Sessions = input2Format.GetSessions(); } catch { } + try { image2Sessions = input2Format.GetSessions(); } + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body image2Info.imageHasSessions |= image2Sessions.Count > 0; image2Info.imageSize = input2Format.GetImageSize(); @@ -182,23 +199,40 @@ namespace DiscImageChef.Commands image2Info.imageCreationTime = input2Format.GetImageCreationTime(); image2Info.imageLastModificationTime = input2Format.GetImageLastModificationTime(); image2Info.mediaType = input2Format.GetMediaType(); - try { image2Info.imageVersion = input2Format.GetImageVersion(); } catch { image2Info.imageVersion = null; } - try { image2Info.imageApplication = input2Format.GetImageApplication(); } catch { image2Info.imageApplication = null; } - try { image2Info.imageApplicationVersion = input2Format.GetImageApplicationVersion(); } catch { image2Info.imageApplicationVersion = null; } - try { image2Info.imageCreator = input2Format.GetImageCreator(); } catch { image2Info.imageCreator = null; } - try { image2Info.imageName = input2Format.GetImageName(); } catch { image2Info.imageName = null; } - try { image2Info.imageComments = input2Format.GetImageComments(); } catch { image2Info.imageComments = null; } - try { image2Info.mediaManufacturer = input2Format.GetMediaManufacturer(); } catch { image2Info.mediaManufacturer = null; } - try { image2Info.mediaModel = input2Format.GetMediaModel(); } catch { image2Info.mediaModel = null; } - try { image2Info.mediaSerialNumber = input2Format.GetMediaSerialNumber(); } catch { image2Info.mediaSerialNumber = null; } - try { image2Info.mediaBarcode = input2Format.GetMediaBarcode(); } catch { image2Info.mediaBarcode = null; } - try { image2Info.mediaPartNumber = input2Format.GetMediaPartNumber(); } catch { image2Info.mediaPartNumber = null; } - try { image2Info.mediaSequence = input2Format.GetMediaSequence(); } catch { image2Info.mediaSequence = 0; } - try { image2Info.lastMediaSequence = input2Format.GetLastDiskSequence(); } catch { image2Info.lastMediaSequence = 0; } - try { image2Info.driveManufacturer = input2Format.GetDriveManufacturer(); } catch { image2Info.driveManufacturer = null; } - try { image2Info.driveModel = input2Format.GetDriveModel(); } catch { image2Info.driveModel = null; } - try { image2Info.driveSerialNumber = input2Format.GetDriveSerialNumber(); } catch { image2Info.driveSerialNumber = null; } - try { image2Info.driveFirmwareRevision = input2Format.ImageInfo.driveFirmwareRevision; } catch { image2Info.driveFirmwareRevision = null; } + try { image2Info.imageVersion = input2Format.GetImageVersion(); } + catch { image2Info.imageVersion = null; } + try { image2Info.imageApplication = input2Format.GetImageApplication(); } + catch { image2Info.imageApplication = null; } + try { image2Info.imageApplicationVersion = input2Format.GetImageApplicationVersion(); } + catch { image2Info.imageApplicationVersion = null; } + try { image2Info.imageCreator = input2Format.GetImageCreator(); } + catch { image2Info.imageCreator = null; } + try { image2Info.imageName = input2Format.GetImageName(); } + catch { image2Info.imageName = null; } + try { image2Info.imageComments = input2Format.GetImageComments(); } + catch { image2Info.imageComments = null; } + try { image2Info.mediaManufacturer = input2Format.GetMediaManufacturer(); } + catch { image2Info.mediaManufacturer = null; } + try { image2Info.mediaModel = input2Format.GetMediaModel(); } + catch { image2Info.mediaModel = null; } + try { image2Info.mediaSerialNumber = input2Format.GetMediaSerialNumber(); } + catch { image2Info.mediaSerialNumber = null; } + try { image2Info.mediaBarcode = input2Format.GetMediaBarcode(); } + catch { image2Info.mediaBarcode = null; } + try { image2Info.mediaPartNumber = input2Format.GetMediaPartNumber(); } + catch { image2Info.mediaPartNumber = null; } + try { image2Info.mediaSequence = input2Format.GetMediaSequence(); } + catch { image2Info.mediaSequence = 0; } + try { image2Info.lastMediaSequence = input2Format.GetLastDiskSequence(); } + catch { image2Info.lastMediaSequence = 0; } + try { image2Info.driveManufacturer = input2Format.GetDriveManufacturer(); } + catch { image2Info.driveManufacturer = null; } + try { image2Info.driveModel = input2Format.GetDriveModel(); } + catch { image2Info.driveModel = null; } + try { image2Info.driveSerialNumber = input2Format.GetDriveSerialNumber(); } + catch { image2Info.driveSerialNumber = null; } + try { image2Info.driveFirmwareRevision = input2Format.ImageInfo.driveFirmwareRevision; } + catch { image2Info.driveFirmwareRevision = null; } foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType))) { try @@ -207,42 +241,59 @@ namespace DiscImageChef.Commands image2DiskTags.Add(disktag, temparray); } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - catch + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body - { - } } if(options.Verbose) { - sb.AppendFormat("Has partitions?\t{0}\t{1}", image1Info.imageHasPartitions, image2Info.imageHasPartitions).AppendLine(); - sb.AppendFormat("Has sessions?\t{0}\t{1}", image1Info.imageHasSessions, image2Info.imageHasSessions).AppendLine(); + sb.AppendFormat("Has partitions?\t{0}\t{1}", image1Info.imageHasPartitions, + image2Info.imageHasPartitions).AppendLine(); + sb.AppendFormat("Has sessions?\t{0}\t{1}", image1Info.imageHasSessions, image2Info.imageHasSessions) + .AppendLine(); sb.AppendFormat("Image size\t{0}\t{1}", image1Info.imageSize, image2Info.imageSize).AppendLine(); sb.AppendFormat("Sectors\t{0}\t{1}", image1Info.sectors, image2Info.sectors).AppendLine(); sb.AppendFormat("Sector size\t{0}\t{1}", image1Info.sectorSize, image2Info.sectorSize).AppendLine(); - sb.AppendFormat("Creation time\t{0}\t{1}", image1Info.imageCreationTime, image2Info.imageCreationTime).AppendLine(); - sb.AppendFormat("Last modification time\t{0}\t{1}", image1Info.imageLastModificationTime, image2Info.imageLastModificationTime).AppendLine(); + sb.AppendFormat("Creation time\t{0}\t{1}", image1Info.imageCreationTime, image2Info.imageCreationTime) + .AppendLine(); + sb.AppendFormat("Last modification time\t{0}\t{1}", image1Info.imageLastModificationTime, + image2Info.imageLastModificationTime).AppendLine(); sb.AppendFormat("Disk type\t{0}\t{1}", image1Info.mediaType, image2Info.mediaType).AppendLine(); - sb.AppendFormat("Image version\t{0}\t{1}", image1Info.imageVersion, image2Info.imageVersion).AppendLine(); - sb.AppendFormat("Image application\t{0}\t{1}", image1Info.imageApplication, image2Info.imageApplication).AppendLine(); - sb.AppendFormat("Image application version\t{0}\t{1}", image1Info.imageApplicationVersion, image2Info.imageApplicationVersion).AppendLine(); - sb.AppendFormat("Image creator\t{0}\t{1}", image1Info.imageCreator, image2Info.imageCreator).AppendLine(); + sb.AppendFormat("Image version\t{0}\t{1}", image1Info.imageVersion, image2Info.imageVersion) + .AppendLine(); + sb.AppendFormat("Image application\t{0}\t{1}", image1Info.imageApplication, image2Info.imageApplication) + .AppendLine(); + sb.AppendFormat("Image application version\t{0}\t{1}", image1Info.imageApplicationVersion, + image2Info.imageApplicationVersion).AppendLine(); + sb.AppendFormat("Image creator\t{0}\t{1}", image1Info.imageCreator, image2Info.imageCreator) + .AppendLine(); sb.AppendFormat("Image name\t{0}\t{1}", image1Info.imageName, image2Info.imageName).AppendLine(); - sb.AppendFormat("Image comments\t{0}\t{1}", image1Info.imageComments, image2Info.imageComments).AppendLine(); - sb.AppendFormat("Disk manufacturer\t{0}\t{1}", image1Info.mediaManufacturer, image2Info.mediaManufacturer).AppendLine(); + sb.AppendFormat("Image comments\t{0}\t{1}", image1Info.imageComments, image2Info.imageComments) + .AppendLine(); + sb.AppendFormat("Disk manufacturer\t{0}\t{1}", image1Info.mediaManufacturer, + image2Info.mediaManufacturer).AppendLine(); sb.AppendFormat("Disk model\t{0}\t{1}", image1Info.mediaModel, image2Info.mediaModel).AppendLine(); - sb.AppendFormat("Disk serial number\t{0}\t{1}", image1Info.mediaSerialNumber, image2Info.mediaSerialNumber).AppendLine(); - sb.AppendFormat("Disk barcode\t{0}\t{1}", image1Info.mediaBarcode, image2Info.mediaBarcode).AppendLine(); - sb.AppendFormat("Disk part no.\t{0}\t{1}", image1Info.mediaPartNumber, image2Info.mediaPartNumber).AppendLine(); - sb.AppendFormat("Disk sequence\t{0}\t{1}", image1Info.mediaSequence, image2Info.mediaSequence).AppendLine(); - sb.AppendFormat("Last disk on sequence\t{0}\t{1}", image1Info.lastMediaSequence, image2Info.lastMediaSequence).AppendLine(); - sb.AppendFormat("Drive manufacturer\t{0}\t{1}", image1Info.driveManufacturer, image2Info.driveManufacturer).AppendLine(); - sb.AppendFormat("Drive firmware revision\t{0}\t{1}", image1Info.driveFirmwareRevision, image2Info.driveFirmwareRevision).AppendLine(); + sb.AppendFormat("Disk serial number\t{0}\t{1}", image1Info.mediaSerialNumber, + image2Info.mediaSerialNumber).AppendLine(); + sb.AppendFormat("Disk barcode\t{0}\t{1}", image1Info.mediaBarcode, image2Info.mediaBarcode) + .AppendLine(); + sb.AppendFormat("Disk part no.\t{0}\t{1}", image1Info.mediaPartNumber, image2Info.mediaPartNumber) + .AppendLine(); + sb.AppendFormat("Disk sequence\t{0}\t{1}", image1Info.mediaSequence, image2Info.mediaSequence) + .AppendLine(); + sb.AppendFormat("Last disk on sequence\t{0}\t{1}", image1Info.lastMediaSequence, + image2Info.lastMediaSequence).AppendLine(); + sb.AppendFormat("Drive manufacturer\t{0}\t{1}", image1Info.driveManufacturer, + image2Info.driveManufacturer).AppendLine(); + sb.AppendFormat("Drive firmware revision\t{0}\t{1}", image1Info.driveFirmwareRevision, + image2Info.driveFirmwareRevision).AppendLine(); sb.AppendFormat("Drive model\t{0}\t{1}", image1Info.driveModel, image2Info.driveModel).AppendLine(); - sb.AppendFormat("Drive serial number\t{0}\t{1}", image1Info.driveSerialNumber, image2Info.driveSerialNumber).AppendLine(); + sb.AppendFormat("Drive serial number\t{0}\t{1}", image1Info.driveSerialNumber, + image2Info.driveSerialNumber).AppendLine(); foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType))) { - sb.AppendFormat("Has {0}?\t{1}\t{2}", disktag, image1DiskTags.ContainsKey(disktag), image2DiskTags.ContainsKey(disktag)).AppendLine(); + sb.AppendFormat("Has {0}?\t{1}\t{2}", disktag, image1DiskTags.ContainsKey(disktag), + image2DiskTags.ContainsKey(disktag)).AppendLine(); } } @@ -251,152 +302,127 @@ namespace DiscImageChef.Commands if(image1Info.imageHasPartitions != image2Info.imageHasPartitions) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Image partitioned status differ"); + if(!options.Verbose) sb.AppendLine("Image partitioned status differ"); } if(image1Info.imageHasSessions != image2Info.imageHasSessions) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Image session status differ"); + if(!options.Verbose) sb.AppendLine("Image session status differ"); } if(image1Info.imageSize != image2Info.imageSize) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Image size differ"); + if(!options.Verbose) sb.AppendLine("Image size differ"); } if(image1Info.sectors != image2Info.sectors) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Image sectors differ"); + if(!options.Verbose) sb.AppendLine("Image sectors differ"); } if(image1Info.sectorSize != image2Info.sectorSize) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Image sector size differ"); + if(!options.Verbose) sb.AppendLine("Image sector size differ"); } if(image1Info.imageCreationTime != image2Info.imageCreationTime) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Image creation time differ"); + if(!options.Verbose) sb.AppendLine("Image creation time differ"); } if(image1Info.imageLastModificationTime != image2Info.imageLastModificationTime) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Image last modification time differ"); + if(!options.Verbose) sb.AppendLine("Image last modification time differ"); } if(image1Info.mediaType != image2Info.mediaType) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Disk type differ"); + if(!options.Verbose) sb.AppendLine("Disk type differ"); } if(image1Info.imageVersion != image2Info.imageVersion) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Image version differ"); + if(!options.Verbose) sb.AppendLine("Image version differ"); } if(image1Info.imageApplication != image2Info.imageApplication) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Image application differ"); + if(!options.Verbose) sb.AppendLine("Image application differ"); } if(image1Info.imageApplicationVersion != image2Info.imageApplicationVersion) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Image application version differ"); + if(!options.Verbose) sb.AppendLine("Image application version differ"); } if(image1Info.imageCreator != image2Info.imageCreator) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Image creator differ"); + if(!options.Verbose) sb.AppendLine("Image creator differ"); } if(image1Info.imageName != image2Info.imageName) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Image name differ"); + if(!options.Verbose) sb.AppendLine("Image name differ"); } if(image1Info.imageComments != image2Info.imageComments) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Image comments differ"); + if(!options.Verbose) sb.AppendLine("Image comments differ"); } if(image1Info.mediaManufacturer != image2Info.mediaManufacturer) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Disk manufacturer differ"); + if(!options.Verbose) sb.AppendLine("Disk manufacturer differ"); } if(image1Info.mediaModel != image2Info.mediaModel) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Disk model differ"); + if(!options.Verbose) sb.AppendLine("Disk model differ"); } if(image1Info.mediaSerialNumber != image2Info.mediaSerialNumber) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Disk serial number differ"); + if(!options.Verbose) sb.AppendLine("Disk serial number differ"); } if(image1Info.mediaBarcode != image2Info.mediaBarcode) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Disk barcode differ"); + if(!options.Verbose) sb.AppendLine("Disk barcode differ"); } if(image1Info.mediaPartNumber != image2Info.mediaPartNumber) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Disk part number differ"); + if(!options.Verbose) sb.AppendLine("Disk part number differ"); } if(image1Info.mediaSequence != image2Info.mediaSequence) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Disk sequence differ"); + if(!options.Verbose) sb.AppendLine("Disk sequence differ"); } if(image1Info.lastMediaSequence != image2Info.lastMediaSequence) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Last disk in sequence differ"); + if(!options.Verbose) sb.AppendLine("Last disk in sequence differ"); } if(image1Info.driveManufacturer != image2Info.driveManufacturer) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Drive manufacturer differ"); + if(!options.Verbose) sb.AppendLine("Drive manufacturer differ"); } if(image1Info.driveModel != image2Info.driveModel) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Drive model differ"); + if(!options.Verbose) sb.AppendLine("Drive model differ"); } if(image1Info.driveSerialNumber != image2Info.driveSerialNumber) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Drive serial number differ"); + if(!options.Verbose) sb.AppendLine("Drive serial number differ"); } if(image1Info.driveFirmwareRevision != image2Info.driveFirmwareRevision) { imagesDiffer = true; - if(!options.Verbose) - sb.AppendLine("Drive firmware revision differ"); + if(!options.Verbose) sb.AppendLine("Drive firmware revision differ"); } ulong leastSectors; @@ -404,18 +430,15 @@ namespace DiscImageChef.Commands { imagesDiffer = true; leastSectors = image1Info.sectors; - if(!options.Verbose) - sb.AppendLine("Image 2 has more sectors"); + if(!options.Verbose) sb.AppendLine("Image 2 has more sectors"); } else if(image1Info.sectors > image2Info.sectors) { imagesDiffer = true; leastSectors = image2Info.sectors; - if(!options.Verbose) - sb.AppendLine("Image 1 has more sectors"); + if(!options.Verbose) sb.AppendLine("Image 1 has more sectors"); } - else - leastSectors = image1Info.sectors; + else leastSectors = image1Info.sectors; DicConsole.WriteLine("Comparing sectors..."); @@ -436,25 +459,24 @@ namespace DiscImageChef.Commands else if(!sameSize) { imagesDiffer = true; - sb.AppendFormat("Sector {0} has different sizes ({1} bytes in image 1, {2} in image 2) but are otherwise identical", - sector, image1Sector.LongLength, image2Sector.LongLength).AppendLine(); + sb + .AppendFormat("Sector {0} has different sizes ({1} bytes in image 1, {2} in image 2) but are otherwise identical", + sector, image1Sector.LongLength, image2Sector.LongLength).AppendLine(); } } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body } + DicConsole.WriteLine(); - if(imagesDiffer) - sb.AppendLine("Images differ"); - else - sb.AppendLine("Images do not differ"); + if(imagesDiffer) sb.AppendLine("Images differ"); + else sb.AppendLine("Images do not differ"); DicConsole.WriteLine(sb.ToString()); Core.Statistics.AddCommand("compare"); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/Configure.cs b/DiscImageChef/Commands/Configure.cs index bad481f8..ac0141ed 100644 --- a/DiscImageChef/Commands/Configure.cs +++ b/DiscImageChef/Commands/Configure.cs @@ -71,6 +71,7 @@ namespace DiscImageChef.Commands pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } + Settings.Settings.Current.Stats.ShareStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); @@ -80,6 +81,7 @@ namespace DiscImageChef.Commands pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } + Settings.Settings.Current.Stats.BenchmarkStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); @@ -89,6 +91,7 @@ namespace DiscImageChef.Commands pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } + Settings.Settings.Current.Stats.CommandStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); @@ -98,6 +101,7 @@ namespace DiscImageChef.Commands pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } + Settings.Settings.Current.Stats.DeviceStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); @@ -107,6 +111,7 @@ namespace DiscImageChef.Commands pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } + Settings.Settings.Current.Stats.FilesystemStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); @@ -116,6 +121,7 @@ namespace DiscImageChef.Commands pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } + Settings.Settings.Current.Stats.FilterStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); @@ -125,6 +131,7 @@ namespace DiscImageChef.Commands pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } + Settings.Settings.Current.Stats.MediaImageStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); @@ -134,6 +141,7 @@ namespace DiscImageChef.Commands pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } + Settings.Settings.Current.Stats.MediaScanStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); @@ -143,6 +151,7 @@ namespace DiscImageChef.Commands pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } + Settings.Settings.Current.Stats.PartitionStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); @@ -152,6 +161,7 @@ namespace DiscImageChef.Commands pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } + Settings.Settings.Current.Stats.MediaStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); @@ -161,13 +171,12 @@ namespace DiscImageChef.Commands pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } + Settings.Settings.Current.Stats.VerifyStats = pressedKey.Key == ConsoleKey.Y; } - else - Settings.Settings.Current.Stats = null; + else Settings.Settings.Current.Stats = null; Settings.Settings.SaveSettings(); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/CreateSidecar.cs b/DiscImageChef/Commands/CreateSidecar.cs index 407dd92c..7a9e4c25 100644 --- a/DiscImageChef/Commands/CreateSidecar.cs +++ b/DiscImageChef/Commands/CreateSidecar.cs @@ -54,7 +54,6 @@ namespace DiscImageChef.Commands Sidecar.EndProgressEvent2 += Progress.EndProgress2; Sidecar.UpdateStatusEvent += Progress.UpdateStatus; - Encoding encoding = null; if(options.EncodingName != null) @@ -62,8 +61,7 @@ namespace DiscImageChef.Commands try { encoding = Claunia.Encoding.Encoding.GetEncoding(options.EncodingName); - if(options.Verbose) - DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName); + if(options.Verbose) DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName); } catch(ArgumentException) { @@ -104,9 +102,9 @@ namespace DiscImageChef.Commands else { if(options.Verbose) - DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", _imageFormat.Name, _imageFormat.PluginUUID); - else - DicConsole.WriteLine("Image format identified by {0}.", _imageFormat.Name); + DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", _imageFormat.Name, + _imageFormat.PluginUUID); + else DicConsole.WriteLine("Image format identified by {0}.", _imageFormat.Name); } try @@ -130,15 +128,18 @@ namespace DiscImageChef.Commands Core.Statistics.AddMediaFormat(_imageFormat.GetImageFormat()); Core.Statistics.AddFilter(inputFilter.Name); - CICMMetadataType sidecar = Sidecar.Create(_imageFormat, options.InputFile, inputFilter.UUID, encoding); + CICMMetadataType sidecar = + Sidecar.Create(_imageFormat, options.InputFile, inputFilter.UUID, encoding); DicConsole.WriteLine("Writing metadata sidecar"); - FileStream xmlFs = new FileStream(Path.Combine(Path.GetDirectoryName(options.InputFile), - Path.GetFileNameWithoutExtension(options.InputFile) + ".cicm.xml"), - FileMode.CreateNew); + FileStream xmlFs = + new + FileStream(Path.Combine(Path.GetDirectoryName(options.InputFile), Path.GetFileNameWithoutExtension(options.InputFile) + ".cicm.xml"), + FileMode.CreateNew); - System.Xml.Serialization.XmlSerializer xmlSer = new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); + System.Xml.Serialization.XmlSerializer xmlSer = + new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); xmlSer.Serialize(xmlFs, sidecar); xmlFs.Close(); @@ -163,21 +164,23 @@ namespace DiscImageChef.Commands foreach(string file in contents) { - if(new FileInfo(file).Length % options.BlockSize == 0) - files.Add(file); + if(new FileInfo(file).Length % options.BlockSize == 0) files.Add(file); } files.Sort(StringComparer.CurrentCultureIgnoreCase); - CICMMetadataType sidecar = Sidecar.Create(Path.GetFileName(options.InputFile), files, options.BlockSize); + CICMMetadataType sidecar = + Sidecar.Create(Path.GetFileName(options.InputFile), files, options.BlockSize); DicConsole.WriteLine("Writing metadata sidecar"); - FileStream xmlFs = new FileStream(Path.Combine(Path.GetDirectoryName(options.InputFile), - Path.GetFileNameWithoutExtension(options.InputFile) + ".cicm.xml"), - FileMode.CreateNew); + FileStream xmlFs = + new + FileStream(Path.Combine(Path.GetDirectoryName(options.InputFile), Path.GetFileNameWithoutExtension(options.InputFile) + ".cicm.xml"), + FileMode.CreateNew); - System.Xml.Serialization.XmlSerializer xmlSer = new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); + System.Xml.Serialization.XmlSerializer xmlSer = + new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType)); xmlSer.Serialize(xmlFs, sidecar); xmlFs.Close(); @@ -190,5 +193,4 @@ namespace DiscImageChef.Commands } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/Decode.cs b/DiscImageChef/Commands/Decode.cs index 1c03e220..b5d90962 100644 --- a/DiscImageChef/Commands/Decode.cs +++ b/DiscImageChef/Commands/Decode.cs @@ -82,133 +82,148 @@ namespace DiscImageChef.Commands switch(tag) { case MediaTagType.SCSI_INQUIRY: + { + byte[] inquiry = inputFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY); + if(inquiry == null) + DicConsole.WriteLine("Error reading SCSI INQUIRY response from disc image"); + else { - byte[] inquiry = inputFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY); - if(inquiry == null) - DicConsole.WriteLine("Error reading SCSI INQUIRY response from disc image"); - else - { - DicConsole.WriteLine("SCSI INQUIRY command response:"); - DicConsole.WriteLine("================================================================================"); - DicConsole.WriteLine(Decoders.SCSI.Inquiry.Prettify(inquiry)); - DicConsole.WriteLine("================================================================================"); - } - break; + DicConsole.WriteLine("SCSI INQUIRY command response:"); + DicConsole + .WriteLine("================================================================================"); + DicConsole.WriteLine(Decoders.SCSI.Inquiry.Prettify(inquiry)); + DicConsole + .WriteLine("================================================================================"); } + break; + } case MediaTagType.ATA_IDENTIFY: + { + byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY); + if(identify == null) + DicConsole.WriteLine("Error reading ATA IDENTIFY DEVICE response from disc image"); + else { - byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY); - if(identify == null) - DicConsole.WriteLine("Error reading ATA IDENTIFY DEVICE response from disc image"); - else - { - DicConsole.WriteLine("ATA IDENTIFY DEVICE command response:"); - DicConsole.WriteLine("================================================================================"); - DicConsole.WriteLine(Decoders.ATA.Identify.Prettify(identify)); - DicConsole.WriteLine("================================================================================"); - } - break; + DicConsole.WriteLine("ATA IDENTIFY DEVICE command response:"); + DicConsole + .WriteLine("================================================================================"); + DicConsole.WriteLine(Decoders.ATA.Identify.Prettify(identify)); + DicConsole + .WriteLine("================================================================================"); } + break; + } case MediaTagType.ATAPI_IDENTIFY: + { + byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY); + if(identify == null) + DicConsole + .WriteLine("Error reading ATA IDENTIFY PACKET DEVICE response from disc image"); + else { - byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY); - if(identify == null) - DicConsole.WriteLine("Error reading ATA IDENTIFY PACKET DEVICE response from disc image"); - else - { - DicConsole.WriteLine("ATA IDENTIFY PACKET DEVICE command response:"); - DicConsole.WriteLine("================================================================================"); - DicConsole.WriteLine(Decoders.ATA.Identify.Prettify(identify)); - DicConsole.WriteLine("================================================================================"); - } - break; + DicConsole.WriteLine("ATA IDENTIFY PACKET DEVICE command response:"); + DicConsole + .WriteLine("================================================================================"); + DicConsole.WriteLine(Decoders.ATA.Identify.Prettify(identify)); + DicConsole + .WriteLine("================================================================================"); } + break; + } case MediaTagType.CD_ATIP: + { + byte[] atip = inputFormat.ReadDiskTag(MediaTagType.CD_ATIP); + if(atip == null) DicConsole.WriteLine("Error reading CD ATIP from disc image"); + else { - byte[] atip = inputFormat.ReadDiskTag(MediaTagType.CD_ATIP); - if(atip == null) - DicConsole.WriteLine("Error reading CD ATIP from disc image"); - else - { - DicConsole.WriteLine("CD ATIP:"); - DicConsole.WriteLine("================================================================================"); - DicConsole.WriteLine(Decoders.CD.ATIP.Prettify(atip)); - DicConsole.WriteLine("================================================================================"); - } - break; + DicConsole.WriteLine("CD ATIP:"); + DicConsole + .WriteLine("================================================================================"); + DicConsole.WriteLine(Decoders.CD.ATIP.Prettify(atip)); + DicConsole + .WriteLine("================================================================================"); } + break; + } case MediaTagType.CD_FullTOC: + { + byte[] fulltoc = inputFormat.ReadDiskTag(MediaTagType.CD_FullTOC); + if(fulltoc == null) DicConsole.WriteLine("Error reading CD full TOC from disc image"); + else { - byte[] fulltoc = inputFormat.ReadDiskTag(MediaTagType.CD_FullTOC); - if(fulltoc == null) - DicConsole.WriteLine("Error reading CD full TOC from disc image"); - else - { - DicConsole.WriteLine("CD full TOC:"); - DicConsole.WriteLine("================================================================================"); - DicConsole.WriteLine(Decoders.CD.FullTOC.Prettify(fulltoc)); - DicConsole.WriteLine("================================================================================"); - } - break; + DicConsole.WriteLine("CD full TOC:"); + DicConsole + .WriteLine("================================================================================"); + DicConsole.WriteLine(Decoders.CD.FullTOC.Prettify(fulltoc)); + DicConsole + .WriteLine("================================================================================"); } + break; + } case MediaTagType.CD_PMA: + { + byte[] pma = inputFormat.ReadDiskTag(MediaTagType.CD_PMA); + if(pma == null) DicConsole.WriteLine("Error reading CD PMA from disc image"); + else { - byte[] pma = inputFormat.ReadDiskTag(MediaTagType.CD_PMA); - if(pma == null) - DicConsole.WriteLine("Error reading CD PMA from disc image"); - else - { - DicConsole.WriteLine("CD PMA:"); - DicConsole.WriteLine("================================================================================"); - DicConsole.WriteLine(Decoders.CD.PMA.Prettify(pma)); - DicConsole.WriteLine("================================================================================"); - } - break; + DicConsole.WriteLine("CD PMA:"); + DicConsole + .WriteLine("================================================================================"); + DicConsole.WriteLine(Decoders.CD.PMA.Prettify(pma)); + DicConsole + .WriteLine("================================================================================"); } + break; + } case MediaTagType.CD_SessionInfo: + { + byte[] sessioninfo = inputFormat.ReadDiskTag(MediaTagType.CD_SessionInfo); + if(sessioninfo == null) + DicConsole.WriteLine("Error reading CD session information from disc image"); + else { - byte[] sessioninfo = inputFormat.ReadDiskTag(MediaTagType.CD_SessionInfo); - if(sessioninfo == null) - DicConsole.WriteLine("Error reading CD session information from disc image"); - else - { - DicConsole.WriteLine("CD session information:"); - DicConsole.WriteLine("================================================================================"); - DicConsole.WriteLine(Decoders.CD.Session.Prettify(sessioninfo)); - DicConsole.WriteLine("================================================================================"); - } - break; + DicConsole.WriteLine("CD session information:"); + DicConsole + .WriteLine("================================================================================"); + DicConsole.WriteLine(Decoders.CD.Session.Prettify(sessioninfo)); + DicConsole + .WriteLine("================================================================================"); } + break; + } case MediaTagType.CD_TEXT: + { + byte[] cdtext = inputFormat.ReadDiskTag(MediaTagType.CD_TEXT); + if(cdtext == null) DicConsole.WriteLine("Error reading CD-TEXT from disc image"); + else { - byte[] cdtext = inputFormat.ReadDiskTag(MediaTagType.CD_TEXT); - if(cdtext == null) - DicConsole.WriteLine("Error reading CD-TEXT from disc image"); - else - { - DicConsole.WriteLine("CD-TEXT:"); - DicConsole.WriteLine("================================================================================"); - DicConsole.WriteLine(Decoders.CD.CDTextOnLeadIn.Prettify(cdtext)); - DicConsole.WriteLine("================================================================================"); - } - break; + DicConsole.WriteLine("CD-TEXT:"); + DicConsole + .WriteLine("================================================================================"); + DicConsole.WriteLine(Decoders.CD.CDTextOnLeadIn.Prettify(cdtext)); + DicConsole + .WriteLine("================================================================================"); } + break; + } case MediaTagType.CD_TOC: + { + byte[] toc = inputFormat.ReadDiskTag(MediaTagType.CD_TOC); + if(toc == null) DicConsole.WriteLine("Error reading CD TOC from disc image"); + else { - byte[] toc = inputFormat.ReadDiskTag(MediaTagType.CD_TOC); - if(toc == null) - DicConsole.WriteLine("Error reading CD TOC from disc image"); - else - { - DicConsole.WriteLine("CD TOC:"); - DicConsole.WriteLine("================================================================================"); - DicConsole.WriteLine(Decoders.CD.TOC.Prettify(toc)); - DicConsole.WriteLine("================================================================================"); - } - break; + DicConsole.WriteLine("CD TOC:"); + DicConsole + .WriteLine("================================================================================"); + DicConsole.WriteLine(Decoders.CD.TOC.Prettify(toc)); + DicConsole + .WriteLine("================================================================================"); } + break; + } default: - DicConsole.WriteLine("Decoder for disk tag type \"{0}\" not yet implemented, sorry.", tag); + DicConsole.WriteLine("Decoder for disk tag type \"{0}\" not yet implemented, sorry.", + tag); break; } } @@ -219,8 +234,7 @@ namespace DiscImageChef.Commands { ulong length; - if(options.Length.ToLowerInvariant() == "all") - length = inputFormat.GetSectors() - 1; + if(options.Length.ToLowerInvariant() == "all") length = inputFormat.GetSectors() - 1; else { if(!ulong.TryParse(options.Length, out length)) @@ -240,7 +254,8 @@ namespace DiscImageChef.Commands switch(tag) { default: - DicConsole.WriteLine("Decoder for disk tag type \"{0}\" not yet implemented, sorry.", tag); + DicConsole.WriteLine("Decoder for disk tag type \"{0}\" not yet implemented, sorry.", + tag); break; } } @@ -250,5 +265,4 @@ namespace DiscImageChef.Commands Core.Statistics.AddCommand("decode"); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/DeviceInfo.cs b/DiscImageChef/Commands/DeviceInfo.cs index 5d0a0d18..87305e90 100644 --- a/DiscImageChef/Commands/DeviceInfo.cs +++ b/DiscImageChef/Commands/DeviceInfo.cs @@ -47,8 +47,8 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Device-Info command", "--device={0}", options.DevicePath); DicConsole.DebugWriteLine("Device-Info command", "--output-prefix={0}", options.OutputPrefix); - if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && - options.DevicePath[0] != '/' && char.IsLetter(options.DevicePath[0])) + if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && + char.IsLetter(options.DevicePath[0])) { options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':'; } @@ -99,14 +99,15 @@ namespace DiscImageChef.Commands switch(tuple.Code) { case Decoders.PCMCIA.TupleCodes.CISTPL_NULL: - case Decoders.PCMCIA.TupleCodes.CISTPL_END: - break; + case Decoders.PCMCIA.TupleCodes.CISTPL_END: break; case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICEGEO: case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICEGEO_A: DicConsole.WriteLine("{0}", Decoders.PCMCIA.CIS.PrettifyDeviceGeometryTuple(tuple)); break; case Decoders.PCMCIA.TupleCodes.CISTPL_MANFID: - DicConsole.WriteLine("{0}", Decoders.PCMCIA.CIS.PrettifyManufacturerIdentificationTuple(tuple)); + DicConsole.WriteLine("{0}", + Decoders.PCMCIA.CIS + .PrettifyManufacturerIdentificationTuple(tuple)); break; case Decoders.PCMCIA.TupleCodes.CISTPL_VERS_1: DicConsole.WriteLine("{0}", Decoders.PCMCIA.CIS.PrettifyLevel1VersionTuple(tuple)); @@ -145,1330 +146,1484 @@ namespace DiscImageChef.Commands case Decoders.PCMCIA.TupleCodes.CISTPL_SPCL: case Decoders.PCMCIA.TupleCodes.CISTPL_SWIL: case Decoders.PCMCIA.TupleCodes.CISTPL_VERS_2: - DicConsole.DebugWriteLine("Device-Info command", "Found undecoded tuple ID {0}", tuple.Code); + DicConsole.DebugWriteLine("Device-Info command", "Found undecoded tuple ID {0}", + tuple.Code); break; default: - DicConsole.DebugWriteLine("Device-Info command", "Found unknown tuple ID 0x{0:X2}", (byte)tuple.Code); + DicConsole.DebugWriteLine("Device-Info command", "Found unknown tuple ID 0x{0:X2}", + (byte)tuple.Code); break; } } } - else - DicConsole.DebugWriteLine("Device-Info command", "Could not get tuples"); + else DicConsole.DebugWriteLine("Device-Info command", "Could not get tuples"); } switch(dev.Type) { case DeviceType.ATA: + { + AtaErrorRegistersCHS errorRegisters; + + byte[] ataBuf; + bool sense = dev.AtaIdentify(out ataBuf, out errorRegisters); + + if(sense) { - AtaErrorRegistersCHS errorRegisters; + DicConsole.DebugWriteLine("Device-Info command", "STATUS = 0x{0:X2}", errorRegisters.status); + DicConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.error); + DicConsole.DebugWriteLine("Device-Info command", "NSECTOR = 0x{0:X2}", + errorRegisters.sectorCount); + DicConsole.DebugWriteLine("Device-Info command", "SECTOR = 0x{0:X2}", errorRegisters.sector); + DicConsole.DebugWriteLine("Device-Info command", "CYLHIGH = 0x{0:X2}", + errorRegisters.cylinderHigh); + DicConsole.DebugWriteLine("Device-Info command", "CYLLOW = 0x{0:X2}", + errorRegisters.cylinderLow); + DicConsole.DebugWriteLine("Device-Info command", "DEVICE = 0x{0:X2}", + errorRegisters.deviceHead); + DicConsole.DebugWriteLine("Device-Info command", "COMMAND = 0x{0:X2}", errorRegisters.command); + DicConsole.DebugWriteLine("Device-Info command", "Error code = {0}", dev.LastError); + break; + } - byte[] ataBuf; - bool sense = dev.AtaIdentify(out ataBuf, out errorRegisters); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_ata_identify.bin", "ATA IDENTIFY", + ataBuf); - if(sense) + DicConsole.WriteLine(Identify.Prettify(ataBuf)); + + double duration; + dev.EnableMediaCardPassThrough(out errorRegisters, dev.Timeout, out duration); + + if(errorRegisters.sector == 0xAA && errorRegisters.sectorCount == 0x55) + { + DicConsole.WriteLine("Device supports the Media Card Pass Through Command Set"); + switch(errorRegisters.deviceHead & 0x7) { - DicConsole.DebugWriteLine("Device-Info command", "STATUS = 0x{0:X2}", errorRegisters.status); - DicConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.error); - DicConsole.DebugWriteLine("Device-Info command", "NSECTOR = 0x{0:X2}", errorRegisters.sectorCount); - DicConsole.DebugWriteLine("Device-Info command", "SECTOR = 0x{0:X2}", errorRegisters.sector); - DicConsole.DebugWriteLine("Device-Info command", "CYLHIGH = 0x{0:X2}", errorRegisters.cylinderHigh); - DicConsole.DebugWriteLine("Device-Info command", "CYLLOW = 0x{0:X2}", errorRegisters.cylinderLow); - DicConsole.DebugWriteLine("Device-Info command", "DEVICE = 0x{0:X2}", errorRegisters.deviceHead); - DicConsole.DebugWriteLine("Device-Info command", "COMMAND = 0x{0:X2}", errorRegisters.command); - DicConsole.DebugWriteLine("Device-Info command", "Error code = {0}", dev.LastError); - break; + case 0: + DicConsole.WriteLine("Device reports incorrect media card type"); + break; + case 1: + DicConsole.WriteLine("Device contains a Secure Digital card"); + break; + case 2: + DicConsole.WriteLine("Device contains a MultiMediaCard "); + break; + case 3: + DicConsole.WriteLine("Device contains a Secure Digital I/O card"); + break; + case 4: + DicConsole.WriteLine("Device contains a Smart Media card"); + break; + default: + DicConsole.WriteLine("Device contains unknown media card type {0}", + errorRegisters.deviceHead & 0x07); + break; } - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_ata_identify.bin", "ATA IDENTIFY", ataBuf); + if((errorRegisters.deviceHead & 0x08) == 0x08) + DicConsole.WriteLine("Media card is write protected"); - DicConsole.WriteLine(Identify.Prettify(ataBuf)); + ushort specificData = + (ushort)((errorRegisters.cylinderHigh * 0x100) + errorRegisters.cylinderLow); + if(specificData != 0) DicConsole.WriteLine("Card specific data: 0x{0:X4}", specificData); + } - double duration; - dev.EnableMediaCardPassThrough(out errorRegisters, dev.Timeout, out duration); + break; + } + case DeviceType.ATAPI: + { + AtaErrorRegistersCHS errorRegisters; - if(errorRegisters.sector == 0xAA && errorRegisters.sectorCount == 0x55) - { - DicConsole.WriteLine("Device supports the Media Card Pass Through Command Set"); - switch(errorRegisters.deviceHead & 0x7) - { - case 0: - DicConsole.WriteLine("Device reports incorrect media card type"); - break; - case 1: - DicConsole.WriteLine("Device contains a Secure Digital card"); - break; - case 2: - DicConsole.WriteLine("Device contains a MultiMediaCard "); - break; - case 3: - DicConsole.WriteLine("Device contains a Secure Digital I/O card"); - break; - case 4: - DicConsole.WriteLine("Device contains a Smart Media card"); - break; - default: - DicConsole.WriteLine("Device contains unknown media card type {0}", errorRegisters.deviceHead & 0x07); - break; - } + byte[] ataBuf; + bool sense = dev.AtapiIdentify(out ataBuf, out errorRegisters); - if((errorRegisters.deviceHead & 0x08) == 0x08) - DicConsole.WriteLine("Media card is write protected"); + if(sense) + { + DicConsole.DebugWriteLine("Device-Info command", "STATUS = 0x{0:X2}", errorRegisters.status); + DicConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.error); + DicConsole.DebugWriteLine("Device-Info command", "NSECTOR = 0x{0:X2}", + errorRegisters.sectorCount); + DicConsole.DebugWriteLine("Device-Info command", "SECTOR = 0x{0:X2}", errorRegisters.sector); + DicConsole.DebugWriteLine("Device-Info command", "CYLHIGH = 0x{0:X2}", + errorRegisters.cylinderHigh); + DicConsole.DebugWriteLine("Device-Info command", "CYLLOW = 0x{0:X2}", + errorRegisters.cylinderLow); + DicConsole.DebugWriteLine("Device-Info command", "DEVICE = 0x{0:X2}", + errorRegisters.deviceHead); + DicConsole.DebugWriteLine("Device-Info command", "COMMAND = 0x{0:X2}", errorRegisters.command); + DicConsole.DebugWriteLine("Device-Info command", "Error code = {0}", dev.LastError); + break; + } - ushort specificData = (ushort)((errorRegisters.cylinderHigh * 0x100) + errorRegisters.cylinderLow); - if(specificData != 0) - DicConsole.WriteLine("Card specific data: 0x{0:X4}", specificData); - } + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_atapi_identify.bin", + "ATAPI IDENTIFY", ataBuf); + + DicConsole.WriteLine(Identify.Prettify(ataBuf)); + + // ATAPI devices are also SCSI devices + goto case DeviceType.SCSI; + } + case DeviceType.SCSI: + { + byte[] senseBuf; + byte[] inqBuf; + + bool sense = dev.ScsiInquiry(out inqBuf, out senseBuf); + + if(sense) + { + DicConsole.ErrorWriteLine("SCSI error:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); break; } - case DeviceType.ATAPI: + + if(dev.Type != DeviceType.ATAPI) DicConsole.WriteLine("SCSI device"); + + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_scsi_inquiry.bin", "SCSI INQUIRY", + inqBuf); + + Decoders.SCSI.Inquiry.SCSIInquiry? inq = Decoders.SCSI.Inquiry.Decode(inqBuf); + DicConsole.WriteLine(Decoders.SCSI.Inquiry.Prettify(inq)); + + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, 0x00); + + if(!sense) { - AtaErrorRegistersCHS errorRegisters; + byte[] pages = Decoders.SCSI.EVPD.DecodePage00(inqBuf); - byte[] ataBuf; - bool sense = dev.AtapiIdentify(out ataBuf, out errorRegisters); - - if(sense) + if(pages != null) { - DicConsole.DebugWriteLine("Device-Info command", "STATUS = 0x{0:X2}", errorRegisters.status); - DicConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.error); - DicConsole.DebugWriteLine("Device-Info command", "NSECTOR = 0x{0:X2}", errorRegisters.sectorCount); - DicConsole.DebugWriteLine("Device-Info command", "SECTOR = 0x{0:X2}", errorRegisters.sector); - DicConsole.DebugWriteLine("Device-Info command", "CYLHIGH = 0x{0:X2}", errorRegisters.cylinderHigh); - DicConsole.DebugWriteLine("Device-Info command", "CYLLOW = 0x{0:X2}", errorRegisters.cylinderLow); - DicConsole.DebugWriteLine("Device-Info command", "DEVICE = 0x{0:X2}", errorRegisters.deviceHead); - DicConsole.DebugWriteLine("Device-Info command", "COMMAND = 0x{0:X2}", errorRegisters.command); - DicConsole.DebugWriteLine("Device-Info command", "Error code = {0}", dev.LastError); - break; - } - - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_atapi_identify.bin", "ATAPI IDENTIFY", ataBuf); - - DicConsole.WriteLine(Identify.Prettify(ataBuf)); - - // ATAPI devices are also SCSI devices - goto case DeviceType.SCSI; - } - case DeviceType.SCSI: - { - byte[] senseBuf; - byte[] inqBuf; - - bool sense = dev.ScsiInquiry(out inqBuf, out senseBuf); - - if(sense) - { - DicConsole.ErrorWriteLine("SCSI error:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); - - break; - } - - if(dev.Type != DeviceType.ATAPI) - DicConsole.WriteLine("SCSI device"); - - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_scsi_inquiry.bin", "SCSI INQUIRY", inqBuf); - - Decoders.SCSI.Inquiry.SCSIInquiry? inq = Decoders.SCSI.Inquiry.Decode(inqBuf); - DicConsole.WriteLine(Decoders.SCSI.Inquiry.Prettify(inq)); - - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, 0x00); - - if(!sense) - { - byte[] pages = Decoders.SCSI.EVPD.DecodePage00(inqBuf); - - if(pages != null) + foreach(byte page in pages) { - foreach(byte page in pages) + if(page >= 0x01 && page <= 0x7F) { - if(page >= 0x01 && page <= 0x7F) + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("ASCII Page {0:X2}h: {1}", page, Decoders.SCSI.EVPD.DecodeASCIIPage(inqBuf)); + DicConsole.WriteLine("ASCII Page {0:X2}h: {1}", page, + Decoders.SCSI.EVPD.DecodeASCIIPage(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0x80) - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("Unit Serial Number: {0}", Decoders.SCSI.EVPD.DecodePage80(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0x81) - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_81(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0x82) - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("ASCII implemented operating definitions: {0}", Decoders.SCSI.EVPD.DecodePage82(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0x83) - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_83(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0x84) - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_84(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0x85) - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_85(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0x86) - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_86(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0x89) - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_89(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0xB0) - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_B0(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0xB1) - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("Manufacturer-assigned Serial Number: {0}", Decoders.SCSI.EVPD.DecodePageB1(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0xB2) - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("TapeAlert Supported Flags Bitmap: 0x{0:X16}", Decoders.SCSI.EVPD.DecodePageB2(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0xB3) - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("Automation Device Serial Number: {0}", Decoders.SCSI.EVPD.DecodePageB3(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0xB4) - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("Data Transfer Device Element Address: 0x{0}", Decoders.SCSI.EVPD.DecodePageB4(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0xC0 && StringHandlers.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == "quantum") - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_C0_Quantum(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0xC0 && StringHandlers.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == "seagate") - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_C0_Seagate(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0xC0 && StringHandlers.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == "ibm") - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_C0_IBM(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0xC1 && StringHandlers.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == "ibm") - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_C1_IBM(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if((page == 0xC0 || page == 0xC1) && StringHandlers.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == "certance") - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_C0_C1_Certance(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if((page == 0xC2 || page == 0xC3 || page == 0xC4 || page == 0xC5 || page == 0xC6) && - StringHandlers.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == "certance") - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if((page == 0xC0 || page == 0xC1 || page == 0xC2 || page == 0xC3 || page == 0xC4 || page == 0xC5) && - StringHandlers.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == "hp") - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_C0_to_C5_HP(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else if(page == 0xDF && StringHandlers.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == "certance") - { - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_DF_Certance(inqBuf)); - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } - else - { - if(page != 0x00) - { - DicConsole.DebugWriteLine("Device-Info command", "Found undecoded SCSI VPD page 0x{0:X2}", page); - - sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if(!sense) - { - DataFile.WriteTo("Device-Info command", options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); - } - } + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); } } - } - } - - byte[] modeBuf; - double duration; - Decoders.SCSI.Modes.DecodedMode? decMode = null; - Decoders.SCSI.PeripheralDeviceTypes devType = (Decoders.SCSI.PeripheralDeviceTypes)inq.Value.PeripheralDeviceType; - - sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration); - if(sense || dev.Error) - sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); - - if(!sense && !dev.Error) - decMode = Decoders.SCSI.Modes.DecodeMode10(modeBuf, devType); - - if(sense || dev.Error || !decMode.HasValue) - { - sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration); - if(sense || dev.Error) - sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); - if(sense || dev.Error) - sense = dev.ModeSense(out modeBuf, out senseBuf, 5, out duration); - - if(!sense && !dev.Error) - decMode = Decoders.SCSI.Modes.DecodeMode6(modeBuf, devType); - } - - if(!sense) - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_scsi_modesense.bin", "SCSI MODE SENSE", modeBuf); - - if(decMode.HasValue) - { - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModeHeader(decMode.Value.Header, devType)); - - if(decMode.Value.Pages != null) - { - foreach(Decoders.SCSI.Modes.ModePage page in decMode.Value.Pages) + else if(page == 0x80) { - //DicConsole.WriteLine("Page {0:X2}h subpage {1:X2}h is {2} bytes long", page.Page, page.Subpage, page.PageResponse.Length); - switch(page.Page) + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) { - case 0x00: - { - if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice && page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_00_SFF(page.PageResponse)); - else - { - if(page.Subpage != 0) - DicConsole.WriteLine("Found unknown vendor mode page {0:X2}h subpage {1:X2}h", page.Page, page.Subpage); - else - DicConsole.WriteLine("Found unknown vendor mode page {0:X2}h", page.Page); - } - break; - } - case 0x01: - { - if(page.Subpage == 0) - { - if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_01_MMC(page.PageResponse)); - else - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_01(page.PageResponse)); - } - else - goto default; - - break; - } - case 0x02: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_02(page.PageResponse)); - else - goto default; - - break; - } - case 0x03: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_03(page.PageResponse)); - else - goto default; - - break; - } - case 0x04: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_04(page.PageResponse)); - else - goto default; - - break; - } - case 0x05: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_05(page.PageResponse)); - else - goto default; - - break; - } - case 0x06: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_06(page.PageResponse)); - else - goto default; - - break; - } - case 0x07: - { - if(page.Subpage == 0) - { - if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_07_MMC(page.PageResponse)); - else - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_07(page.PageResponse)); - } - else - goto default; - - break; - } - case 0x08: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_08(page.PageResponse)); - else - goto default; - - break; - } - case 0x0A: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0A(page.PageResponse)); - else if(page.Subpage == 1) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0A_S01(page.PageResponse)); - else - goto default; - - break; - } - case 0x0B: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0B(page.PageResponse)); - else - goto default; - - break; - } - case 0x0D: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0D(page.PageResponse)); - else - goto default; - - break; - } - case 0x0E: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0E(page.PageResponse)); - else - goto default; - - break; - } - case 0x0F: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0F(page.PageResponse)); - else - goto default; - - break; - } - case 0x10: - { - if(page.Subpage == 0) - { - if(devType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_10_SSC(page.PageResponse)); - else - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_10(page.PageResponse)); - } - else - goto default; - - break; - } - case 0x11: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_11(page.PageResponse)); - else - goto default; - - break; - } - case 0x12: - case 0x13: - case 0x14: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_12_13_14(page.PageResponse)); - else - goto default; - - break; - } - case 0x1A: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1A(page.PageResponse)); - else if(page.Subpage == 1) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1A_S01(page.PageResponse)); - else - goto default; - - break; - } - case 0x1B: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1B(page.PageResponse)); - else - goto default; - - break; - } - case 0x1C: - { - if(page.Subpage == 0) - { - if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1C_SFF(page.PageResponse)); - else - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1C(page.PageResponse)); - } - else if(page.Subpage == 1) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1C_S01(page.PageResponse)); - else - goto default; - - break; - } - case 0x1D: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1D(page.PageResponse)); - else - goto default; - - break; - } - case 0x21: - { - if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "CERTANCE") - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyCertanceModePage_21(page.PageResponse)); - else - goto default; - - break; - } - case 0x22: - { - if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "CERTANCE") - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyCertanceModePage_22(page.PageResponse)); - else - goto default; - - break; - } - case 0x24: - { - if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM") - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyIBMModePage_24(page.PageResponse)); - else - goto default; - - break; - } - case 0x2A: - { - if(page.Subpage == 0) - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_2A(page.PageResponse)); - else - goto default; - - break; - } - case 0x2F: - { - if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM") - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyIBMModePage_2F(page.PageResponse)); - else - goto default; - - break; - } - case 0x30: - { - if(Decoders.SCSI.Modes.IsAppleModePage_30(page.PageResponse)) - DicConsole.WriteLine("Drive identifies as Apple OEM drive"); - else - goto default; - - break; - } - case 0x3B: - { - if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP") - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyHPModePage_3B(page.PageResponse)); - else - goto default; - - break; - } - case 0x3C: - { - if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP") - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyHPModePage_3C(page.PageResponse)); - else - goto default; - - break; - } - case 0x3D: - { - if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM") - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyIBMModePage_3D(page.PageResponse)); - else if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP") - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyHPModePage_3D(page.PageResponse)); - else - goto default; - - break; - } - case 0x3E: - { - if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "FUJITSU") - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyFujitsuModePage_3E(page.PageResponse)); - else if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP") - DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyHPModePage_3E(page.PageResponse)); - else - goto default; - - break; - } - default: - { - if(page.Subpage != 0) - DicConsole.WriteLine("Found unknown mode page {0:X2}h subpage {1:X2}h", page.Page, page.Subpage); - else - DicConsole.WriteLine("Found unknown mode page {0:X2}h", page.Page); - break; - } + DicConsole.WriteLine("Unit Serial Number: {0}", + Decoders.SCSI.EVPD.DecodePage80(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); } } - } - } - - if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) - { - - byte[] confBuf; - sense = dev.GetConfiguration(out confBuf, out senseBuf, dev.Timeout, out duration); - - if(!sense) - { - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_mmc_getconfiguration.bin", "MMC GET CONFIGURATION", confBuf); - - Decoders.SCSI.MMC.Features.SeparatedFeatures ftr = Decoders.SCSI.MMC.Features.Separate(confBuf); - - DicConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION length is {0} bytes", ftr.DataLength); - DicConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION current profile is {0:X4}h", ftr.CurrentProfile); - if(ftr.Descriptors != null) + else if(page == 0x81) { - DicConsole.WriteLine("SCSI MMC GET CONFIGURATION Features:"); - foreach(Decoders.SCSI.MMC.Features.FeatureDescriptor desc in ftr.Descriptors) + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) { - DicConsole.DebugWriteLine("Device-Info command", "Feature {0:X4}h", desc.Code); - - switch(desc.Code) - { - case 0x0000: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0000(desc.Data)); - break; - case 0x0001: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0001(desc.Data)); - break; - case 0x0002: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0002(desc.Data)); - break; - case 0x0003: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0003(desc.Data)); - break; - case 0x0004: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0004(desc.Data)); - break; - case 0x0010: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0010(desc.Data)); - break; - case 0x001D: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_001D(desc.Data)); - break; - case 0x001E: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_001E(desc.Data)); - break; - case 0x001F: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_001F(desc.Data)); - break; - case 0x0020: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0020(desc.Data)); - break; - case 0x0021: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0021(desc.Data)); - break; - case 0x0022: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0022(desc.Data)); - break; - case 0x0023: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0023(desc.Data)); - break; - case 0x0024: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0024(desc.Data)); - break; - case 0x0025: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0025(desc.Data)); - break; - case 0x0026: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0026(desc.Data)); - break; - case 0x0027: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0027(desc.Data)); - break; - case 0x0028: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0028(desc.Data)); - break; - case 0x0029: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0029(desc.Data)); - break; - case 0x002A: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_002A(desc.Data)); - break; - case 0x002B: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_002B(desc.Data)); - break; - case 0x002C: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_002C(desc.Data)); - break; - case 0x002D: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_002D(desc.Data)); - break; - case 0x002E: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_002E(desc.Data)); - break; - case 0x002F: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_002F(desc.Data)); - break; - case 0x0030: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0030(desc.Data)); - break; - case 0x0031: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0031(desc.Data)); - break; - case 0x0032: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0032(desc.Data)); - break; - case 0x0033: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0033(desc.Data)); - break; - case 0x0035: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0035(desc.Data)); - break; - case 0x0037: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0037(desc.Data)); - break; - case 0x0038: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0038(desc.Data)); - break; - case 0x003A: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_003A(desc.Data)); - break; - case 0x003B: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_003B(desc.Data)); - break; - case 0x0040: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0040(desc.Data)); - break; - case 0x0041: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0041(desc.Data)); - break; - case 0x0042: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0042(desc.Data)); - break; - case 0x0050: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0050(desc.Data)); - break; - case 0x0051: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0051(desc.Data)); - break; - case 0x0080: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0080(desc.Data)); - break; - case 0x0100: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0100(desc.Data)); - break; - case 0x0101: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0101(desc.Data)); - break; - case 0x0102: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0102(desc.Data)); - break; - case 0x0103: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0103(desc.Data)); - break; - case 0x0104: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0104(desc.Data)); - break; - case 0x0105: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0105(desc.Data)); - break; - case 0x0106: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0106(desc.Data)); - break; - case 0x0107: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0107(desc.Data)); - break; - case 0x0108: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0108(desc.Data)); - break; - case 0x0109: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0109(desc.Data)); - break; - case 0x010A: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_010A(desc.Data)); - break; - case 0x010B: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_010B(desc.Data)); - break; - case 0x010C: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_010C(desc.Data)); - break; - case 0x010D: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_010D(desc.Data)); - break; - case 0x010E: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_010E(desc.Data)); - break; - case 0x0110: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0110(desc.Data)); - break; - case 0x0113: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0113(desc.Data)); - break; - case 0x0142: - DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0142(desc.Data)); - break; - default: - DicConsole.WriteLine("Found unknown feature code {0:X4}h", desc.Code); - break; - } + DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_81(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0x82) + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("ASCII implemented operating definitions: {0}", + Decoders.SCSI.EVPD.DecodePage82(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0x83) + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_83(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0x84) + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_84(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0x85) + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_85(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0x86) + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_86(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0x89) + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_89(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0xB0) + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_B0(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0xB1) + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("Manufacturer-assigned Serial Number: {0}", + Decoders.SCSI.EVPD.DecodePageB1(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0xB2) + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("TapeAlert Supported Flags Bitmap: 0x{0:X16}", + Decoders.SCSI.EVPD.DecodePageB2(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0xB3) + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("Automation Device Serial Number: {0}", + Decoders.SCSI.EVPD.DecodePageB3(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0xB4) + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("Data Transfer Device Element Address: 0x{0}", + Decoders.SCSI.EVPD.DecodePageB4(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0xC0 && + StringHandlers + .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == + "quantum") + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_C0_Quantum(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0xC0 && + StringHandlers + .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == + "seagate") + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_C0_Seagate(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0xC0 && + StringHandlers + .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == + "ibm") + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_C0_IBM(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0xC1 && + StringHandlers + .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == + "ibm") + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", Decoders.SCSI.EVPD.PrettifyPage_C1_IBM(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if((page == 0xC0 || page == 0xC1) && + StringHandlers + .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == + "certance") + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", + Decoders.SCSI.EVPD.PrettifyPage_C0_C1_Certance(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if( + (page == 0xC2 || page == 0xC3 || page == 0xC4 || page == 0xC5 || page == 0xC6) && + StringHandlers.CToString(inq.Value.VendorIdentification).ToLowerInvariant() + .Trim() == "certance") + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", + Decoders + .SCSI.EVPD + .PrettifyPage_C2_C3_C4_C5_C6_Certance(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if((page == 0xC0 || page == 0xC1 || page == 0xC2 || page == 0xC3 || page == 0xC4 || + page == 0xC5) && + StringHandlers + .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == + "hp") + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", + Decoders.SCSI.EVPD.PrettifyPage_C0_to_C5_HP(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } + } + else if(page == 0xDF && + StringHandlers + .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == + "certance") + { + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DicConsole.WriteLine("{0}", + Decoders.SCSI.EVPD.PrettifyPage_DF_Certance(inqBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); } } else - DicConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION returned no feature descriptors"); - } - - // TODO: DVD drives respond correctly to BD status. - // While specification says if no medium is present - // it should inform all possible capabilities, - // testing drives show only supported media capabilities. - /* - byte[] strBuf; - sense = dev.ReadDiscStructure(out strBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.CapabilityList, 0, dev.Timeout, out duration); - - if (!sense) - { - Decoders.SCSI.DiscStructureCapabilities.Capability[] caps = Decoders.SCSI.DiscStructureCapabilities.Decode(strBuf); - if (caps != null) { - foreach (Decoders.SCSI.DiscStructureCapabilities.Capability cap in caps) + if(page != 0x00) { - if (cap.SDS && cap.RDS) - DicConsole.WriteLine("Drive can READ/SEND DISC STRUCTURE format {0:X2}h", cap.FormatCode); - else if (cap.SDS) - DicConsole.WriteLine("Drive can SEND DISC STRUCTURE format {0:X2}h", cap.FormatCode); - else if (cap.RDS) - DicConsole.WriteLine("Drive can READ DISC STRUCTURE format {0:X2}h", cap.FormatCode); + DicConsole.DebugWriteLine("Device-Info command", + "Found undecoded SCSI VPD page 0x{0:X2}", page); + + sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); + if(!sense) + { + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + string.Format("_scsi_evpd_{0:X2}h.bin", page), + string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + } } } } + } + } - sense = dev.ReadDiscStructure(out strBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.CapabilityList, 0, dev.Timeout, out duration); + byte[] modeBuf; + double duration; + Decoders.SCSI.Modes.DecodedMode? decMode = null; + Decoders.SCSI.PeripheralDeviceTypes devType = + (Decoders.SCSI.PeripheralDeviceTypes)inq.Value.PeripheralDeviceType; - if (!sense) + sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, + 0x3F, 0xFF, 5, out duration); + if(sense || dev.Error) + sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, + ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); + + if(!sense && !dev.Error) decMode = Decoders.SCSI.Modes.DecodeMode10(modeBuf, devType); + + if(sense || dev.Error || !decMode.HasValue) + { + sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, + 0xFF, 5, out duration); + if(sense || dev.Error) + sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, + 0x3F, 0x00, 5, out duration); + if(sense || dev.Error) sense = dev.ModeSense(out modeBuf, out senseBuf, 5, out duration); + + if(!sense && !dev.Error) decMode = Decoders.SCSI.Modes.DecodeMode6(modeBuf, devType); + } + + if(!sense) + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_scsi_modesense.bin", + "SCSI MODE SENSE", modeBuf); + + if(decMode.HasValue) + { + DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModeHeader(decMode.Value.Header, devType)); + + if(decMode.Value.Pages != null) + { + foreach(Decoders.SCSI.Modes.ModePage page in decMode.Value.Pages) { - Decoders.SCSI.DiscStructureCapabilities.Capability[] caps = Decoders.SCSI.DiscStructureCapabilities.Decode(strBuf); - if (caps != null) + //DicConsole.WriteLine("Page {0:X2}h subpage {1:X2}h is {2} bytes long", page.Page, page.Subpage, page.PageResponse.Length); + switch(page.Page) { - foreach (Decoders.SCSI.DiscStructureCapabilities.Capability cap in caps) + case 0x00: { - if (cap.SDS && cap.RDS) - DicConsole.WriteLine("Drive can READ/SEND DISC STRUCTURE format {0:X2}h", cap.FormatCode); - else if (cap.SDS) - DicConsole.WriteLine("Drive can SEND DISC STRUCTURE format {0:X2}h", cap.FormatCode); - else if (cap.RDS) - DicConsole.WriteLine("Drive can READ DISC STRUCTURE format {0:X2}h", cap.FormatCode); - } - } - } - */ - - #region Plextor - if(dev.Manufacturer == "PLEXTOR") - { - bool plxtSense = true; - bool plxtDvd = false; - byte[] plxtBuf = null; - - switch(dev.Model) - { - case "DVDR PX-708A": - case "DVDR PX-708A2": - case "DVDR PX-712A": - plxtDvd = true; - plxtSense = dev.PlextorReadEeprom(out plxtBuf, out senseBuf, dev.Timeout, out duration); + if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice && + page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_00_SFF(page.PageResponse)); + else + { + if(page.Subpage != 0) + DicConsole + .WriteLine("Found unknown vendor mode page {0:X2}h subpage {1:X2}h", + page.Page, page.Subpage); + else + DicConsole.WriteLine("Found unknown vendor mode page {0:X2}h", + page.Page); + } break; - case "DVDR PX-714A": - case "DVDR PX-716A": - case "DVDR PX-716AL": - case "DVDR PX-755A": - case "DVDR PX-760A": + } + case 0x01: + { + if(page.Subpage == 0) { - byte[] plxtBufSmall; - plxtBuf = new byte[256 * 4]; - for(byte i = 0; i < 4; i++) - { - plxtSense = dev.PlextorReadEepromBlock(out plxtBufSmall, out senseBuf, i, 256, dev.Timeout, out duration); - if(plxtSense) - break; - Array.Copy(plxtBufSmall, 0, plxtBuf, i * 256, 256); - } - plxtDvd = true; - break; + if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_01_MMC(page + .PageResponse)); + else + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_01(page.PageResponse)); } + else goto default; + + break; + } + case 0x02: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_02(page.PageResponse)); + else goto default; + + break; + } + case 0x03: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_03(page.PageResponse)); + else goto default; + + break; + } + case 0x04: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_04(page.PageResponse)); + else goto default; + + break; + } + case 0x05: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_05(page.PageResponse)); + else goto default; + + break; + } + case 0x06: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_06(page.PageResponse)); + else goto default; + + break; + } + case 0x07: + { + if(page.Subpage == 0) + { + if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_07_MMC(page + .PageResponse)); + else + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_07(page.PageResponse)); + } + else goto default; + + break; + } + case 0x08: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_08(page.PageResponse)); + else goto default; + + break; + } + case 0x0A: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_0A(page.PageResponse)); + else if(page.Subpage == 1) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_0A_S01(page.PageResponse)); + else goto default; + + break; + } + case 0x0B: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_0B(page.PageResponse)); + else goto default; + + break; + } + case 0x0D: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_0D(page.PageResponse)); + else goto default; + + break; + } + case 0x0E: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_0E(page.PageResponse)); + else goto default; + + break; + } + case 0x0F: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_0F(page.PageResponse)); + else goto default; + + break; + } + case 0x10: + { + if(page.Subpage == 0) + { + if(devType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_10_SSC(page + .PageResponse)); + else + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_10(page.PageResponse)); + } + else goto default; + + break; + } + case 0x11: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_11(page.PageResponse)); + else goto default; + + break; + } + case 0x12: + case 0x13: + case 0x14: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_12_13_14(page + .PageResponse)); + else goto default; + + break; + } + case 0x1A: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_1A(page.PageResponse)); + else if(page.Subpage == 1) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_1A_S01(page.PageResponse)); + else goto default; + + break; + } + case 0x1B: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_1B(page.PageResponse)); + else goto default; + + break; + } + case 0x1C: + { + if(page.Subpage == 0) + { + if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_1C_SFF(page + .PageResponse)); + else + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_1C(page.PageResponse)); + } + else if(page.Subpage == 1) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_1C_S01(page.PageResponse)); + else goto default; + + break; + } + case 0x1D: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_1D(page.PageResponse)); + else goto default; + + break; + } + case 0x21: + { + if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "CERTANCE" + ) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyCertanceModePage_21(page + .PageResponse)); + else goto default; + + break; + } + case 0x22: + { + if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "CERTANCE" + ) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyCertanceModePage_22(page + .PageResponse)); + else goto default; + + break; + } + case 0x24: + { + if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM") + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyIBMModePage_24(page.PageResponse)); + else goto default; + + break; + } + case 0x2A: + { + if(page.Subpage == 0) + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyModePage_2A(page.PageResponse)); + else goto default; + + break; + } + case 0x2F: + { + if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM") + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyIBMModePage_2F(page.PageResponse)); + else goto default; + + break; + } + case 0x30: + { + if(Decoders.SCSI.Modes.IsAppleModePage_30(page.PageResponse)) + DicConsole.WriteLine("Drive identifies as Apple OEM drive"); + else goto default; + + break; + } + case 0x3B: + { + if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP") + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyHPModePage_3B(page.PageResponse)); + else goto default; + + break; + } + case 0x3C: + { + if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP") + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyHPModePage_3C(page.PageResponse)); + else goto default; + + break; + } + case 0x3D: + { + if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM") + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyIBMModePage_3D(page.PageResponse)); + else if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP") + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyHPModePage_3D(page.PageResponse)); + else goto default; + + break; + } + case 0x3E: + { + if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "FUJITSU") + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyFujitsuModePage_3E(page + .PageResponse)); + else if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP") + DicConsole.WriteLine(Decoders.SCSI.Modes + .PrettifyHPModePage_3E(page.PageResponse)); + else goto default; + + break; + } default: - { - if(dev.Model.StartsWith("CD-R ", StringComparison.Ordinal)) - { - plxtSense = dev.PlextorReadEepromCDR(out plxtBuf, out senseBuf, dev.Timeout, out duration); - } + { + if(page.Subpage != 0) + DicConsole.WriteLine("Found unknown mode page {0:X2}h subpage {1:X2}h", + page.Page, page.Subpage); + else DicConsole.WriteLine("Found unknown mode page {0:X2}h", page.Page); + break; + } + } + } + } + } + + if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + { + byte[] confBuf; + sense = dev.GetConfiguration(out confBuf, out senseBuf, dev.Timeout, out duration); + + if(!sense) + { + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_mmc_getconfiguration.bin", + "MMC GET CONFIGURATION", confBuf); + + Decoders.SCSI.MMC.Features.SeparatedFeatures ftr = + Decoders.SCSI.MMC.Features.Separate(confBuf); + + DicConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION length is {0} bytes", + ftr.DataLength); + DicConsole.DebugWriteLine("Device-Info command", + "GET CONFIGURATION current profile is {0:X4}h", + ftr.CurrentProfile); + if(ftr.Descriptors != null) + { + DicConsole.WriteLine("SCSI MMC GET CONFIGURATION Features:"); + foreach(Decoders.SCSI.MMC.Features.FeatureDescriptor desc in ftr.Descriptors) + { + DicConsole.DebugWriteLine("Device-Info command", "Feature {0:X4}h", desc.Code); + + switch(desc.Code) + { + case 0x0000: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0000(desc.Data)); + break; + case 0x0001: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0001(desc.Data)); + break; + case 0x0002: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0002(desc.Data)); + break; + case 0x0003: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0003(desc.Data)); + break; + case 0x0004: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0004(desc.Data)); + break; + case 0x0010: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0010(desc.Data)); + break; + case 0x001D: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_001D(desc.Data)); + break; + case 0x001E: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_001E(desc.Data)); + break; + case 0x001F: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_001F(desc.Data)); + break; + case 0x0020: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0020(desc.Data)); + break; + case 0x0021: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0021(desc.Data)); + break; + case 0x0022: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0022(desc.Data)); + break; + case 0x0023: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0023(desc.Data)); + break; + case 0x0024: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0024(desc.Data)); + break; + case 0x0025: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0025(desc.Data)); + break; + case 0x0026: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0026(desc.Data)); + break; + case 0x0027: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0027(desc.Data)); + break; + case 0x0028: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0028(desc.Data)); + break; + case 0x0029: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0029(desc.Data)); + break; + case 0x002A: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_002A(desc.Data)); + break; + case 0x002B: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_002B(desc.Data)); + break; + case 0x002C: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_002C(desc.Data)); + break; + case 0x002D: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_002D(desc.Data)); + break; + case 0x002E: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_002E(desc.Data)); + break; + case 0x002F: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_002F(desc.Data)); + break; + case 0x0030: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0030(desc.Data)); + break; + case 0x0031: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0031(desc.Data)); + break; + case 0x0032: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0032(desc.Data)); + break; + case 0x0033: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0033(desc.Data)); + break; + case 0x0035: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0035(desc.Data)); + break; + case 0x0037: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0037(desc.Data)); + break; + case 0x0038: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0038(desc.Data)); + break; + case 0x003A: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_003A(desc.Data)); + break; + case 0x003B: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_003B(desc.Data)); + break; + case 0x0040: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0040(desc.Data)); + break; + case 0x0041: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0041(desc.Data)); + break; + case 0x0042: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0042(desc.Data)); + break; + case 0x0050: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0050(desc.Data)); + break; + case 0x0051: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0051(desc.Data)); + break; + case 0x0080: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0080(desc.Data)); + break; + case 0x0100: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0100(desc.Data)); + break; + case 0x0101: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0101(desc.Data)); + break; + case 0x0102: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0102(desc.Data)); + break; + case 0x0103: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0103(desc.Data)); + break; + case 0x0104: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0104(desc.Data)); + break; + case 0x0105: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0105(desc.Data)); + break; + case 0x0106: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0106(desc.Data)); + break; + case 0x0107: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0107(desc.Data)); + break; + case 0x0108: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0108(desc.Data)); + break; + case 0x0109: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0109(desc.Data)); + break; + case 0x010A: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_010A(desc.Data)); + break; + case 0x010B: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_010B(desc.Data)); + break; + case 0x010C: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_010C(desc.Data)); + break; + case 0x010D: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_010D(desc.Data)); + break; + case 0x010E: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_010E(desc.Data)); + break; + case 0x0110: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0110(desc.Data)); + break; + case 0x0113: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0113(desc.Data)); + break; + case 0x0142: + DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0142(desc.Data)); + break; + default: + DicConsole.WriteLine("Found unknown feature code {0:X4}h", desc.Code); break; - } - } - - if(!plxtSense) - { - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_plextor_eeprom.bin", "PLEXTOR READ EEPROM", plxtBuf); - - ushort discs; - uint cdReadTime, cdWriteTime, dvdReadTime = 0, dvdWriteTime = 0; - - BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - if(plxtDvd) - { - discs = BigEndianBitConverter.ToUInt16(plxtBuf, 0x0120); - cdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x0122); - cdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x0126); - dvdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x012A); - dvdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x012E); - } - else - { - discs = BigEndianBitConverter.ToUInt16(plxtBuf, 0x0078); - cdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x006C); - cdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x007A); - } - - DicConsole.WriteLine("Drive has loaded a total of {0} discs", discs); - DicConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading CDs", - cdReadTime / 3600, (cdReadTime / 60) % 60, cdReadTime % 60); - DicConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing CDs", - cdWriteTime / 3600, (cdWriteTime / 60) % 60, cdWriteTime % 60); - if(plxtDvd) - { - DicConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading DVDs", - dvdReadTime / 3600, (dvdReadTime / 60) % 60, dvdReadTime % 60); - DicConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing DVDs", - dvdWriteTime / 3600, (dvdWriteTime / 60) % 60, dvdWriteTime % 60); } } + } + else + DicConsole.DebugWriteLine("Device-Info command", + "GET CONFIGURATION returned no feature descriptors"); + } - bool plxtPwrRecEnabled; - ushort plxtPwrRecSpeed; - plxtSense = dev.PlextorGetPoweRec(out senseBuf, out plxtPwrRecEnabled, out plxtPwrRecSpeed, dev.Timeout, out duration); - if(!plxtSense) + // TODO: DVD drives respond correctly to BD status. + // While specification says if no medium is present + // it should inform all possible capabilities, + // testing drives show only supported media capabilities. + /* + byte[] strBuf; + sense = dev.ReadDiscStructure(out strBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.CapabilityList, 0, dev.Timeout, out duration); + + if (!sense) + { + Decoders.SCSI.DiscStructureCapabilities.Capability[] caps = Decoders.SCSI.DiscStructureCapabilities.Decode(strBuf); + if (caps != null) + { + foreach (Decoders.SCSI.DiscStructureCapabilities.Capability cap in caps) { - DicConsole.Write("Drive supports PoweRec"); - if(plxtPwrRecEnabled) + if (cap.SDS && cap.RDS) + DicConsole.WriteLine("Drive can READ/SEND DISC STRUCTURE format {0:X2}h", cap.FormatCode); + else if (cap.SDS) + DicConsole.WriteLine("Drive can SEND DISC STRUCTURE format {0:X2}h", cap.FormatCode); + else if (cap.RDS) + DicConsole.WriteLine("Drive can READ DISC STRUCTURE format {0:X2}h", cap.FormatCode); + } + } + } + + sense = dev.ReadDiscStructure(out strBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.CapabilityList, 0, dev.Timeout, out duration); + + if (!sense) + { + Decoders.SCSI.DiscStructureCapabilities.Capability[] caps = Decoders.SCSI.DiscStructureCapabilities.Decode(strBuf); + if (caps != null) + { + foreach (Decoders.SCSI.DiscStructureCapabilities.Capability cap in caps) + { + if (cap.SDS && cap.RDS) + DicConsole.WriteLine("Drive can READ/SEND DISC STRUCTURE format {0:X2}h", cap.FormatCode); + else if (cap.SDS) + DicConsole.WriteLine("Drive can SEND DISC STRUCTURE format {0:X2}h", cap.FormatCode); + else if (cap.RDS) + DicConsole.WriteLine("Drive can READ DISC STRUCTURE format {0:X2}h", cap.FormatCode); + } + } + } + */ + + #region Plextor + if(dev.Manufacturer == "PLEXTOR") + { + bool plxtSense = true; + bool plxtDvd = false; + byte[] plxtBuf = null; + + switch(dev.Model) + { + case "DVDR PX-708A": + case "DVDR PX-708A2": + case "DVDR PX-712A": + plxtDvd = true; + plxtSense = dev.PlextorReadEeprom(out plxtBuf, out senseBuf, dev.Timeout, + out duration); + break; + case "DVDR PX-714A": + case "DVDR PX-716A": + case "DVDR PX-716AL": + case "DVDR PX-755A": + case "DVDR PX-760A": + { + byte[] plxtBufSmall; + plxtBuf = new byte[256 * 4]; + for(byte i = 0; i < 4; i++) { - DicConsole.Write(", has it enabled"); + plxtSense = dev.PlextorReadEepromBlock(out plxtBufSmall, out senseBuf, i, 256, + dev.Timeout, out duration); + if(plxtSense) break; - if(plxtPwrRecSpeed > 0) - DicConsole.WriteLine(" and recommends {0} Kb/sec.", plxtPwrRecSpeed); - else - DicConsole.WriteLine("."); - - ushort plxtPwrRecSelected, plxtPwrRecMax, plxtPwrRecLast; - plxtSense = dev.PlextorGetSpeeds(out senseBuf, out plxtPwrRecSelected, out plxtPwrRecMax, out plxtPwrRecLast, dev.Timeout, out duration); - - if(!plxtSense) - { - if(plxtPwrRecSelected > 0) - DicConsole.WriteLine("Selected PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", plxtPwrRecSelected, plxtPwrRecSelected / 177); - if(plxtPwrRecMax > 0) - DicConsole.WriteLine("Maximum PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", plxtPwrRecMax, plxtPwrRecMax / 177); - if(plxtPwrRecLast > 0) - DicConsole.WriteLine("Last used PoweRec was {0} Kb/sec ({1}x)", plxtPwrRecLast, plxtPwrRecLast / 177); - } + Array.Copy(plxtBufSmall, 0, plxtBuf, i * 256, 256); } - else - DicConsole.WriteLine("PoweRec is disabled"); - } - // TODO: Check it with a drive - plxtSense = dev.PlextorGetSilentMode(out plxtBuf, out senseBuf, dev.Timeout, out duration); - if(!plxtSense) + plxtDvd = true; + break; + } + default: { - DicConsole.WriteLine("Drive supports Plextor SilentMode"); - if(plxtBuf[0] == 1) + if(dev.Model.StartsWith("CD-R ", StringComparison.Ordinal)) { - DicConsole.WriteLine("Plextor SilentMode is enabled:"); - if(plxtBuf[1] == 2) - DicConsole.WriteLine("\tAccess time is slow"); - else - DicConsole.WriteLine("\tAccess time is fast"); - - if(plxtBuf[2] > 0) - DicConsole.WriteLine("\tCD read speed limited to {0}x", plxtBuf[2]); - if(plxtBuf[3] > 0 && plxtDvd) - DicConsole.WriteLine("\tDVD read speed limited to {0}x", plxtBuf[3]); - if(plxtBuf[4] > 0) - DicConsole.WriteLine("\tCD write speed limited to {0}x", plxtBuf[4]); - if(plxtBuf[6] > 0) - DicConsole.WriteLine("\tTray eject speed limited to {0}", -(plxtBuf[6] + 48)); - if(plxtBuf[7] > 0) - DicConsole.WriteLine("\tTray eject speed limited to {0}", plxtBuf[7] - 47); + plxtSense = dev.PlextorReadEepromCDR(out plxtBuf, out senseBuf, dev.Timeout, + out duration); } + break; } + } - plxtSense = dev.PlextorGetGigaRec(out plxtBuf, out senseBuf, dev.Timeout, out duration); - if(!plxtSense) - { - DicConsole.WriteLine("Drive supports Plextor GigaRec"); - // TODO: Pretty print it - } + if(!plxtSense) + { + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_plextor_eeprom.bin", + "PLEXTOR READ EEPROM", plxtBuf); - plxtSense = dev.PlextorGetSecuRec(out plxtBuf, out senseBuf, dev.Timeout, out duration); - if(!plxtSense) - { - DicConsole.WriteLine("Drive supports Plextor SecuRec"); - // TODO: Pretty print it - } - - plxtSense = dev.PlextorGetSpeedRead(out plxtBuf, out senseBuf, dev.Timeout, out duration); - if(!plxtSense) - { - DicConsole.Write("Drive supports Plextor SpeedRead"); - if((plxtBuf[2] & 0x01) == 0x01) - DicConsole.WriteLine("and has it enabled"); - else - DicConsole.WriteLine(); - } - - plxtSense = dev.PlextorGetHiding(out plxtBuf, out senseBuf, dev.Timeout, out duration); - if(!plxtSense) - { - DicConsole.WriteLine("Drive supports hiding CD-Rs and forcing single session"); - - if((plxtBuf[2] & 0x02) == 0x02) - DicConsole.WriteLine("Drive currently hides CD-Rs"); - if((plxtBuf[2] & 0x01) == 0x01) - DicConsole.WriteLine("Drive currently forces single session"); - } - - plxtSense = dev.PlextorGetVariRec(out plxtBuf, out senseBuf, false, dev.Timeout, out duration); - if(!plxtSense) - { - DicConsole.WriteLine("Drive supports Plextor VariRec"); - // TODO: Pretty print it - } + ushort discs; + uint cdReadTime, cdWriteTime, dvdReadTime = 0, dvdWriteTime = 0; + BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; if(plxtDvd) { - plxtSense = dev.PlextorGetVariRec(out plxtBuf, out senseBuf, true, dev.Timeout, out duration); + discs = BigEndianBitConverter.ToUInt16(plxtBuf, 0x0120); + cdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x0122); + cdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x0126); + dvdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x012A); + dvdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x012E); + } + else + { + discs = BigEndianBitConverter.ToUInt16(plxtBuf, 0x0078); + cdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x006C); + cdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x007A); + } + + DicConsole.WriteLine("Drive has loaded a total of {0} discs", discs); + DicConsole + .WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading CDs", + cdReadTime / 3600, (cdReadTime / 60) % 60, cdReadTime % 60); + DicConsole + .WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing CDs", + cdWriteTime / 3600, (cdWriteTime / 60) % 60, cdWriteTime % 60); + if(plxtDvd) + { + DicConsole + .WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading DVDs", + dvdReadTime / 3600, (dvdReadTime / 60) % 60, dvdReadTime % 60); + DicConsole + .WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing DVDs", + dvdWriteTime / 3600, (dvdWriteTime / 60) % 60, dvdWriteTime % 60); + } + } + + bool plxtPwrRecEnabled; + ushort plxtPwrRecSpeed; + plxtSense = dev.PlextorGetPoweRec(out senseBuf, out plxtPwrRecEnabled, out plxtPwrRecSpeed, + dev.Timeout, out duration); + if(!plxtSense) + { + DicConsole.Write("Drive supports PoweRec"); + if(plxtPwrRecEnabled) + { + DicConsole.Write(", has it enabled"); + + if(plxtPwrRecSpeed > 0) + DicConsole.WriteLine(" and recommends {0} Kb/sec.", plxtPwrRecSpeed); + else DicConsole.WriteLine("."); + + ushort plxtPwrRecSelected, plxtPwrRecMax, plxtPwrRecLast; + plxtSense = dev.PlextorGetSpeeds(out senseBuf, out plxtPwrRecSelected, + out plxtPwrRecMax, out plxtPwrRecLast, dev.Timeout, + out duration); + if(!plxtSense) { - DicConsole.WriteLine("Drive supports Plextor VariRec for DVDs"); - // TODO: Pretty print it + if(plxtPwrRecSelected > 0) + DicConsole + .WriteLine("Selected PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", + plxtPwrRecSelected, plxtPwrRecSelected / 177); + if(plxtPwrRecMax > 0) + DicConsole + .WriteLine("Maximum PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", + plxtPwrRecMax, plxtPwrRecMax / 177); + if(plxtPwrRecLast > 0) + DicConsole.WriteLine("Last used PoweRec was {0} Kb/sec ({1}x)", + plxtPwrRecLast, plxtPwrRecLast / 177); } + } + else DicConsole.WriteLine("PoweRec is disabled"); + } - plxtSense = dev.PlextorGetBitsetting(out plxtBuf, out senseBuf, false, dev.Timeout, out duration); - if(!plxtSense) - DicConsole.WriteLine("Drive supports bitsetting DVD+R book type"); - plxtSense = dev.PlextorGetBitsetting(out plxtBuf, out senseBuf, true, dev.Timeout, out duration); - if(!plxtSense) - DicConsole.WriteLine("Drive supports bitsetting DVD+R DL book type"); - plxtSense = dev.PlextorGetTestWriteDvdPlus(out plxtBuf, out senseBuf, dev.Timeout, out duration); - if(!plxtSense) - DicConsole.WriteLine("Drive supports test writing DVD+"); + // TODO: Check it with a drive + plxtSense = dev.PlextorGetSilentMode(out plxtBuf, out senseBuf, dev.Timeout, out duration); + if(!plxtSense) + { + DicConsole.WriteLine("Drive supports Plextor SilentMode"); + if(plxtBuf[0] == 1) + { + DicConsole.WriteLine("Plextor SilentMode is enabled:"); + if(plxtBuf[1] == 2) DicConsole.WriteLine("\tAccess time is slow"); + else DicConsole.WriteLine("\tAccess time is fast"); + + if(plxtBuf[2] > 0) + DicConsole.WriteLine("\tCD read speed limited to {0}x", plxtBuf[2]); + if(plxtBuf[3] > 0 && plxtDvd) + DicConsole.WriteLine("\tDVD read speed limited to {0}x", plxtBuf[3]); + if(plxtBuf[4] > 0) + DicConsole.WriteLine("\tCD write speed limited to {0}x", plxtBuf[4]); + if(plxtBuf[6] > 0) + DicConsole.WriteLine("\tTray eject speed limited to {0}", -(plxtBuf[6] + 48)); + if(plxtBuf[7] > 0) + DicConsole.WriteLine("\tTray eject speed limited to {0}", plxtBuf[7] - 47); } } - #endregion Plextor - if(inq.Value.KreonPresent) + plxtSense = dev.PlextorGetGigaRec(out plxtBuf, out senseBuf, dev.Timeout, out duration); + if(!plxtSense) { - KreonFeatures krFeatures; - if(!dev.KreonGetFeatureList(out senseBuf, out krFeatures, dev.Timeout, out duration)) + DicConsole.WriteLine("Drive supports Plextor GigaRec"); + // TODO: Pretty print it + } + + plxtSense = dev.PlextorGetSecuRec(out plxtBuf, out senseBuf, dev.Timeout, out duration); + if(!plxtSense) + { + DicConsole.WriteLine("Drive supports Plextor SecuRec"); + // TODO: Pretty print it + } + + plxtSense = dev.PlextorGetSpeedRead(out plxtBuf, out senseBuf, dev.Timeout, out duration); + if(!plxtSense) + { + DicConsole.Write("Drive supports Plextor SpeedRead"); + if((plxtBuf[2] & 0x01) == 0x01) DicConsole.WriteLine("and has it enabled"); + else DicConsole.WriteLine(); + } + + plxtSense = dev.PlextorGetHiding(out plxtBuf, out senseBuf, dev.Timeout, out duration); + if(!plxtSense) + { + DicConsole.WriteLine("Drive supports hiding CD-Rs and forcing single session"); + + if((plxtBuf[2] & 0x02) == 0x02) DicConsole.WriteLine("Drive currently hides CD-Rs"); + if((plxtBuf[2] & 0x01) == 0x01) + DicConsole.WriteLine("Drive currently forces single session"); + } + + plxtSense = dev.PlextorGetVariRec(out plxtBuf, out senseBuf, false, dev.Timeout, + out duration); + if(!plxtSense) + { + DicConsole.WriteLine("Drive supports Plextor VariRec"); + // TODO: Pretty print it + } + + if(plxtDvd) + { + plxtSense = dev.PlextorGetVariRec(out plxtBuf, out senseBuf, true, dev.Timeout, + out duration); + if(!plxtSense) { - DicConsole.WriteLine("Drive has kreon firmware:"); - if(krFeatures.HasFlag(KreonFeatures.ChallengeResponse)) - DicConsole.WriteLine("\tCan do challenge/response with Xbox discs"); - if(krFeatures.HasFlag(KreonFeatures.DecryptSS)) - DicConsole.WriteLine("\tCan read and descrypt SS from Xbox discs"); - if(krFeatures.HasFlag(KreonFeatures.XtremeUnlock)) - DicConsole.WriteLine("\tCan set xtreme unlock state with Xbox discs"); - if(krFeatures.HasFlag(KreonFeatures.WxripperUnlock)) - DicConsole.WriteLine("\tCan set wxripper unlock state with Xbox discs"); - if(krFeatures.HasFlag(KreonFeatures.ChallengeResponse360)) - DicConsole.WriteLine("\tCan do challenge/response with Xbox 360 discs"); - if(krFeatures.HasFlag(KreonFeatures.DecryptSS360)) - DicConsole.WriteLine("\tCan read and descrypt SS from Xbox 360 discs"); - if(krFeatures.HasFlag(KreonFeatures.XtremeUnlock360)) - DicConsole.WriteLine("\tCan set xtreme unlock state with Xbox 360 discs"); - if(krFeatures.HasFlag(KreonFeatures.WxripperUnlock360)) - DicConsole.WriteLine("\tCan set wxripper unlock state with Xbox 360 discs"); - if(krFeatures.HasFlag(KreonFeatures.Lock)) - DicConsole.WriteLine("\tCan set locked state"); - if(krFeatures.HasFlag(KreonFeatures.ErrorSkipping)) - DicConsole.WriteLine("\tCan skip read errors"); + DicConsole.WriteLine("Drive supports Plextor VariRec for DVDs"); + // TODO: Pretty print it } + + plxtSense = dev.PlextorGetBitsetting(out plxtBuf, out senseBuf, false, dev.Timeout, + out duration); + if(!plxtSense) DicConsole.WriteLine("Drive supports bitsetting DVD+R book type"); + plxtSense = dev.PlextorGetBitsetting(out plxtBuf, out senseBuf, true, dev.Timeout, + out duration); + if(!plxtSense) DicConsole.WriteLine("Drive supports bitsetting DVD+R DL book type"); + plxtSense = dev.PlextorGetTestWriteDvdPlus(out plxtBuf, out senseBuf, dev.Timeout, + out duration); + if(!plxtSense) DicConsole.WriteLine("Drive supports test writing DVD+"); } } + #endregion Plextor - if(devType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) + if(inq.Value.KreonPresent) { - byte[] seqBuf; - - sense = dev.ReadBlockLimits(out seqBuf, out senseBuf, dev.Timeout, out duration); - if(sense) - DicConsole.ErrorWriteLine("READ BLOCK LIMITS:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); - else + KreonFeatures krFeatures; + if(!dev.KreonGetFeatureList(out senseBuf, out krFeatures, dev.Timeout, out duration)) { - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_ssc_readblocklimits.bin", "SSC READ BLOCK LIMITS", seqBuf); - DicConsole.WriteLine("Block limits for device:"); - DicConsole.WriteLine(Decoders.SCSI.SSC.BlockLimits.Prettify(seqBuf)); - } - - sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, dev.Timeout, out duration); - if(sense) - DicConsole.ErrorWriteLine("REPORT DENSITY SUPPORT:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); - else - { - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_ssc_reportdensitysupport.bin", "SSC REPORT DENSITY SUPPORT", seqBuf); - Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dens = Decoders.SCSI.SSC.DensitySupport.DecodeDensity(seqBuf); - if(dens.HasValue) - { - DicConsole.WriteLine("Densities supported by device:"); - DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyDensity(dens)); - } - } - - sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, true, false, dev.Timeout, out duration); - if(sense) - DicConsole.ErrorWriteLine("REPORT DENSITY SUPPORT (MEDIUM):\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); - else - { - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_ssc_reportdensitysupport_medium.bin", "SSC REPORT DENSITY SUPPORT (MEDIUM)", seqBuf); - Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? meds = Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(seqBuf); - if(meds.HasValue) - { - DicConsole.WriteLine("Medium types supported by device:"); - DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyMediumType(meds)); - } - DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyMediumType(seqBuf)); + DicConsole.WriteLine("Drive has kreon firmware:"); + if(krFeatures.HasFlag(KreonFeatures.ChallengeResponse)) + DicConsole.WriteLine("\tCan do challenge/response with Xbox discs"); + if(krFeatures.HasFlag(KreonFeatures.DecryptSS)) + DicConsole.WriteLine("\tCan read and descrypt SS from Xbox discs"); + if(krFeatures.HasFlag(KreonFeatures.XtremeUnlock)) + DicConsole.WriteLine("\tCan set xtreme unlock state with Xbox discs"); + if(krFeatures.HasFlag(KreonFeatures.WxripperUnlock)) + DicConsole.WriteLine("\tCan set wxripper unlock state with Xbox discs"); + if(krFeatures.HasFlag(KreonFeatures.ChallengeResponse360)) + DicConsole.WriteLine("\tCan do challenge/response with Xbox 360 discs"); + if(krFeatures.HasFlag(KreonFeatures.DecryptSS360)) + DicConsole.WriteLine("\tCan read and descrypt SS from Xbox 360 discs"); + if(krFeatures.HasFlag(KreonFeatures.XtremeUnlock360)) + DicConsole.WriteLine("\tCan set xtreme unlock state with Xbox 360 discs"); + if(krFeatures.HasFlag(KreonFeatures.WxripperUnlock360)) + DicConsole.WriteLine("\tCan set wxripper unlock state with Xbox 360 discs"); + if(krFeatures.HasFlag(KreonFeatures.Lock)) + DicConsole.WriteLine("\tCan set locked state"); + if(krFeatures.HasFlag(KreonFeatures.ErrorSkipping)) + DicConsole.WriteLine("\tCan skip read errors"); } } - - break; } - case DeviceType.MMC: + + if(devType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) { - bool noInfo = true; + byte[] seqBuf; - bool sense = dev.ReadCID(out byte[] mmcBuf, out uint[] response, dev.Timeout, out double duration); - if(!sense) + sense = dev.ReadBlockLimits(out seqBuf, out senseBuf, dev.Timeout, out duration); + if(sense) + DicConsole.ErrorWriteLine("READ BLOCK LIMITS:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); + else { - noInfo = false; - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_mmc_cid.bin", "MMC CID", mmcBuf); - DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCID(mmcBuf)); - } - sense = dev.ReadCSD(out mmcBuf, out response, dev.Timeout, out duration); - if(!sense) - { - noInfo = false; - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_mmc_csd.bin", "MMC CSD", mmcBuf); - DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCSD(mmcBuf)); - } - sense = dev.ReadOCR(out mmcBuf, out response, dev.Timeout, out duration); - if(!sense) - { - noInfo = false; - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_mmc_ocr.bin", "MMC OCR", mmcBuf); - DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyOCR(mmcBuf)); - } - sense = dev.ReadExtendedCSD(out mmcBuf, out response, dev.Timeout, out duration); - if(!sense) - { - noInfo = false; - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_mmc_ecsd.bin", "MMC Extended CSD", mmcBuf); - DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyExtendedCSD(mmcBuf)); + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_ssc_readblocklimits.bin", + "SSC READ BLOCK LIMITS", seqBuf); + DicConsole.WriteLine("Block limits for device:"); + DicConsole.WriteLine(Decoders.SCSI.SSC.BlockLimits.Prettify(seqBuf)); } - if(noInfo) - DicConsole.WriteLine("Could not get any kind of information from the device !!!"); + sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, dev.Timeout, out duration); + if(sense) + DicConsole.ErrorWriteLine("REPORT DENSITY SUPPORT:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); + else + { + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + "_ssc_reportdensitysupport.bin", "SSC REPORT DENSITY SUPPORT", seqBuf); + Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dens = + Decoders.SCSI.SSC.DensitySupport.DecodeDensity(seqBuf); + if(dens.HasValue) + { + DicConsole.WriteLine("Densities supported by device:"); + DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyDensity(dens)); + } + } + + sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, true, false, dev.Timeout, + out duration); + if(sense) + DicConsole.ErrorWriteLine("REPORT DENSITY SUPPORT (MEDIUM):\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); + else + { + DataFile.WriteTo("Device-Info command", options.OutputPrefix, + "_ssc_reportdensitysupport_medium.bin", + "SSC REPORT DENSITY SUPPORT (MEDIUM)", seqBuf); + Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? meds = + Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(seqBuf); + if(meds.HasValue) + { + DicConsole.WriteLine("Medium types supported by device:"); + DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyMediumType(meds)); + } + DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyMediumType(seqBuf)); + } } + + break; + } + case DeviceType.MMC: + { + bool noInfo = true; + + bool sense = dev.ReadCID(out byte[] mmcBuf, out uint[] response, dev.Timeout, out double duration); + if(!sense) + { + noInfo = false; + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_mmc_cid.bin", "MMC CID", + mmcBuf); + DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCID(mmcBuf)); + } + sense = dev.ReadCSD(out mmcBuf, out response, dev.Timeout, out duration); + if(!sense) + { + noInfo = false; + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_mmc_csd.bin", "MMC CSD", + mmcBuf); + DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCSD(mmcBuf)); + } + sense = dev.ReadOCR(out mmcBuf, out response, dev.Timeout, out duration); + if(!sense) + { + noInfo = false; + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_mmc_ocr.bin", "MMC OCR", + mmcBuf); + DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyOCR(mmcBuf)); + } + sense = dev.ReadExtendedCSD(out mmcBuf, out response, dev.Timeout, out duration); + if(!sense) + { + noInfo = false; + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_mmc_ecsd.bin", + "MMC Extended CSD", mmcBuf); + DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyExtendedCSD(mmcBuf)); + } + + if(noInfo) DicConsole.WriteLine("Could not get any kind of information from the device !!!"); + } break; case DeviceType.SecureDigital: + { + bool noInfo = true; + + bool sense = dev.ReadCID(out byte[] sdBuf, out uint[] response, dev.Timeout, out double duration); + if(!sense) { - bool noInfo = true; - - bool sense = dev.ReadCID(out byte[] sdBuf, out uint[] response, dev.Timeout, out double duration); - if(!sense) - { - noInfo = false; - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_sd_cid.bin", "SecureDigital CID", sdBuf); - DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCID(sdBuf)); - } - sense = dev.ReadCSD(out sdBuf, out response, dev.Timeout, out duration); - if(!sense) - { - noInfo = false; - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_sd_csd.bin", "SecureDigital CSD", sdBuf); - DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCSD(sdBuf)); - } - sense = dev.ReadSDOCR(out sdBuf, out response, dev.Timeout, out duration); - if(!sense) - { - noInfo = false; - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_sd_ocr.bin", "SecureDigital OCR", sdBuf); - DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyOCR(sdBuf)); - } - sense = dev.ReadSCR(out sdBuf, out response, dev.Timeout, out duration); - if(!sense) - { - noInfo = false; - DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_sd_scr.bin", "SecureDigital SCR", sdBuf); - DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifySCR(sdBuf)); - } - - if(noInfo) - DicConsole.WriteLine("Could not get any kind of information from the device !!!"); + noInfo = false; + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_sd_cid.bin", + "SecureDigital CID", sdBuf); + DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCID(sdBuf)); } + sense = dev.ReadCSD(out sdBuf, out response, dev.Timeout, out duration); + if(!sense) + { + noInfo = false; + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_sd_csd.bin", + "SecureDigital CSD", sdBuf); + DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCSD(sdBuf)); + } + sense = dev.ReadSDOCR(out sdBuf, out response, dev.Timeout, out duration); + if(!sense) + { + noInfo = false; + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_sd_ocr.bin", + "SecureDigital OCR", sdBuf); + DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyOCR(sdBuf)); + } + sense = dev.ReadSCR(out sdBuf, out response, dev.Timeout, out duration); + if(!sense) + { + noInfo = false; + DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_sd_scr.bin", + "SecureDigital SCR", sdBuf); + DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifySCR(sdBuf)); + } + + if(noInfo) DicConsole.WriteLine("Could not get any kind of information from the device !!!"); + } break; default: DicConsole.ErrorWriteLine("Unknown device type {0}, cannot get information.", dev.Type); @@ -1478,5 +1633,4 @@ namespace DiscImageChef.Commands Core.Statistics.AddCommand("device-info"); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/DeviceReport.cs b/DiscImageChef/Commands/DeviceReport.cs index dbb59c55..29c6e4cc 100644 --- a/DiscImageChef/Commands/DeviceReport.cs +++ b/DiscImageChef/Commands/DeviceReport.cs @@ -46,8 +46,8 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Device-Report command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Device-Report command", "--device={0}", options.DevicePath); - if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && - options.DevicePath[0] != '/' && char.IsLetter(options.DevicePath[0])) + if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && + char.IsLetter(options.DevicePath[0])) { options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':'; } @@ -67,12 +67,9 @@ namespace DiscImageChef.Commands string xmlFile; if(!string.IsNullOrWhiteSpace(dev.Manufacturer) && !string.IsNullOrWhiteSpace(dev.Revision)) xmlFile = dev.Manufacturer + "_" + dev.Model + "_" + dev.Revision + ".xml"; - else if(!string.IsNullOrWhiteSpace(dev.Manufacturer)) - xmlFile = dev.Manufacturer + "_" + dev.Model + ".xml"; - else if(!string.IsNullOrWhiteSpace(dev.Revision)) - xmlFile = dev.Model + "_" + dev.Revision + ".xml"; - else - xmlFile = dev.Model + ".xml"; + else if(!string.IsNullOrWhiteSpace(dev.Manufacturer)) xmlFile = dev.Manufacturer + "_" + dev.Model + ".xml"; + else if(!string.IsNullOrWhiteSpace(dev.Revision)) xmlFile = dev.Model + "_" + dev.Revision + ".xml"; + else xmlFile = dev.Model + ".xml"; xmlFile = xmlFile.Replace('\\', '_').Replace('/', '_').Replace('?', '_'); @@ -92,22 +89,18 @@ namespace DiscImageChef.Commands case DeviceType.SCSI: Core.Devices.Report.SCSI.General.Report(dev, ref report, options.Debug, ref removable); break; - default: - throw new NotSupportedException("Unknown device type."); + default: throw new NotSupportedException("Unknown device type."); } FileStream xmlFs = new FileStream(xmlFile, FileMode.Create); - System.Xml.Serialization.XmlSerializer xmlSer = new System.Xml.Serialization.XmlSerializer(typeof(Metadata.DeviceReport)); + System.Xml.Serialization.XmlSerializer xmlSer = + new System.Xml.Serialization.XmlSerializer(typeof(Metadata.DeviceReport)); xmlSer.Serialize(xmlFs, report); xmlFs.Close(); Core.Statistics.AddCommand("device-report"); - if(Settings.Settings.Current.ShareReports) - { - Remote.SubmitReport(report); - } + if(Settings.Settings.Current.ShareReports) { Remote.SubmitReport(report); } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/DumpMedia.cs b/DiscImageChef/Commands/DumpMedia.cs index e7191dd1..779cb48d 100644 --- a/DiscImageChef/Commands/DumpMedia.cs +++ b/DiscImageChef/Commands/DumpMedia.cs @@ -67,8 +67,7 @@ namespace DiscImageChef.Commands try { encoding = Claunia.Encoding.Encoding.GetEncoding(options.EncodingName); - if(options.Verbose) - DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName); + if(options.Verbose) DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName); } catch(ArgumentException) { @@ -78,8 +77,8 @@ namespace DiscImageChef.Commands } } - if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && - options.DevicePath[0] != '/' && char.IsLetter(options.DevicePath[0])) + if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && + char.IsLetter(options.DevicePath[0])) { options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':'; } @@ -122,18 +121,24 @@ namespace DiscImageChef.Commands switch(dev.Type) { case DeviceType.ATA: - ATA.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, options.Raw, options.Persistent, options.StopOnError, ref resume, ref dumpLog, encoding); + ATA.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, + options.Raw, options.Persistent, options.StopOnError, ref resume, ref dumpLog, encoding); break; case DeviceType.MMC: case DeviceType.SecureDigital: - SecureDigital.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, options.Raw, options.Persistent, options.StopOnError, ref resume, ref dumpLog, encoding); + SecureDigital.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, + options.Force, options.Raw, options.Persistent, options.StopOnError, ref resume, + ref dumpLog, encoding); break; case DeviceType.NVMe: - NVMe.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, options.Raw, options.Persistent, options.StopOnError, ref resume, ref dumpLog, encoding); + NVMe.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, + options.Raw, options.Persistent, options.StopOnError, ref resume, ref dumpLog, encoding); break; case DeviceType.ATAPI: case DeviceType.SCSI: - SCSI.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, options.Raw, options.Persistent, options.StopOnError, options.SeparateSubchannel, ref resume, ref dumpLog, options.LeadIn, encoding); + SCSI.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, + options.Raw, options.Persistent, options.StopOnError, options.SeparateSubchannel, + ref resume, ref dumpLog, options.LeadIn, encoding); break; default: dumpLog.WriteLine("Unknown device type."); @@ -146,10 +151,10 @@ namespace DiscImageChef.Commands resume.LastWriteDate = DateTime.UtcNow; resume.BadBlocks.Sort(); - if(File.Exists(options.OutputPrefix + ".resume.xml")) - File.Delete(options.OutputPrefix + ".resume.xml"); + if(File.Exists(options.OutputPrefix + ".resume.xml")) File.Delete(options.OutputPrefix + ".resume.xml"); - FileStream fs = new FileStream(options.OutputPrefix + ".resume.xml", FileMode.Create, FileAccess.ReadWrite); + FileStream fs = new FileStream(options.OutputPrefix + ".resume.xml", FileMode.Create, + FileAccess.ReadWrite); xs = new XmlSerializer(resume.GetType()); xs.Serialize(fs, resume); fs.Close(); diff --git a/DiscImageChef/Commands/Entropy.cs b/DiscImageChef/Commands/Entropy.cs index b24debb3..6504dbec 100644 --- a/DiscImageChef/Commands/Entropy.cs +++ b/DiscImageChef/Commands/Entropy.cs @@ -98,12 +98,10 @@ namespace DiscImageChef.Commands { byte[] garbage; string sectorHash = sha1ctxTrack.Data(sector, out garbage); - if(!uniqueSectorsPerTrack.Contains(sectorHash)) - uniqueSectorsPerTrack.Add(sectorHash); + if(!uniqueSectorsPerTrack.Contains(sectorHash)) uniqueSectorsPerTrack.Add(sectorHash); } - foreach(byte b in sector) - entTable[b]++; + foreach(byte b in sector) entTable[b]++; trackSize += (ulong)sector.LongLength; } @@ -121,7 +119,9 @@ namespace DiscImageChef.Commands #pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created if(options.DuplicatedSectors) - DicConsole.WriteLine("Track {0} has {1} unique sectors ({1:P3})", currentTrack.TrackSequence, uniqueSectorsPerTrack.Count, (double)uniqueSectorsPerTrack.Count / (double)sectors); + DicConsole.WriteLine("Track {0} has {1} unique sectors ({1:P3})", + currentTrack.TrackSequence, uniqueSectorsPerTrack.Count, + (double)uniqueSectorsPerTrack.Count / (double)sectors); #pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created DicConsole.WriteLine(); @@ -129,14 +129,11 @@ namespace DiscImageChef.Commands } catch(Exception ex) { - if(options.Debug) - DicConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message); - else - DicConsole.ErrorWriteLine("Unable to get separate tracks, not calculating their entropy"); + if(options.Debug) DicConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message); + else DicConsole.ErrorWriteLine("Unable to get separate tracks, not calculating their entropy"); } } - if(options.WholeDisc) { SHA1Context sha1Ctx = new SHA1Context(); @@ -158,15 +155,12 @@ namespace DiscImageChef.Commands { byte[] garbage; string sectorHash = sha1Ctx.Data(sector, out garbage); - if(!uniqueSectors.Contains(sectorHash)) - uniqueSectors.Add(sectorHash); + if(!uniqueSectors.Contains(sectorHash)) uniqueSectors.Add(sectorHash); } - foreach(byte b in sector) - entTable[b]++; + foreach(byte b in sector) entTable[b]++; diskSize += (ulong)sector.LongLength; - } double entropy = 0; @@ -184,12 +178,12 @@ namespace DiscImageChef.Commands if(options.DuplicatedSectors) #pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created - DicConsole.WriteLine("Disk has {0} unique sectors ({1:P3})", uniqueSectors.Count, (double)uniqueSectors.Count / (double)sectors); + DicConsole.WriteLine("Disk has {0} unique sectors ({1:P3})", uniqueSectors.Count, + (double)uniqueSectors.Count / (double)sectors); #pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created Core.Statistics.AddCommand("entropy"); } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/ExtractFiles.cs b/DiscImageChef/Commands/ExtractFiles.cs index e5d2bcac..0dbde8ea 100644 --- a/DiscImageChef/Commands/ExtractFiles.cs +++ b/DiscImageChef/Commands/ExtractFiles.cs @@ -70,8 +70,7 @@ namespace DiscImageChef.Commands try { encoding = Claunia.Encoding.Encoding.GetEncoding(options.EncodingName); - if(options.Verbose) - DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName); + if(options.Verbose) DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName); } catch(ArgumentException) { @@ -101,9 +100,9 @@ namespace DiscImageChef.Commands else { if(options.Verbose) - DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", _imageFormat.Name, _imageFormat.PluginUUID); - else - DicConsole.WriteLine("Image format identified by {0}.", _imageFormat.Name); + DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", _imageFormat.Name, + _imageFormat.PluginUUID); + else DicConsole.WriteLine("Image format identified by {0}.", _imageFormat.Name); } if(Directory.Exists(options.OutputDir) || File.Exists(options.OutputDir)) @@ -124,9 +123,12 @@ namespace DiscImageChef.Commands } DicConsole.DebugWriteLine("Extract-Files command", "Correctly opened image file."); - DicConsole.DebugWriteLine("Extract-Files command", "Image without headers is {0} bytes.", _imageFormat.GetImageSize()); - DicConsole.DebugWriteLine("Extract-Files command", "Image has {0} sectors.", _imageFormat.GetSectors()); - DicConsole.DebugWriteLine("Extract-Files command", "Image identifies disk type as {0}.", _imageFormat.GetMediaType()); + DicConsole.DebugWriteLine("Extract-Files command", "Image without headers is {0} bytes.", + _imageFormat.GetImageSize()); + DicConsole.DebugWriteLine("Extract-Files command", "Image has {0} sectors.", + _imageFormat.GetSectors()); + DicConsole.DebugWriteLine("Extract-Files command", "Image identifies disk type as {0}.", + _imageFormat.GetMediaType()); Core.Statistics.AddMediaFormat(_imageFormat.GetImageFormat()); Core.Statistics.AddMedia(_imageFormat.ImageInfo.mediaType, false); @@ -142,8 +144,7 @@ namespace DiscImageChef.Commands List partitions = Partitions.GetAll(_imageFormat); Partitions.AddSchemesToStats(partitions); - if(partitions.Count == 0) - DicConsole.DebugWriteLine("Extract-Files command", "No partitions found"); + if(partitions.Count == 0) DicConsole.DebugWriteLine("Extract-Files command", "No partitions found"); else { DicConsole.WriteLine("{0} partitions found.", partitions.Count); @@ -156,8 +157,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Identifying filesystem on partition"); Core.Filesystems.Identify(_imageFormat, out id_plugins, partitions[i]); - if(id_plugins.Count == 0) - DicConsole.WriteLine("Filesystem not identified"); + if(id_plugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(id_plugins.Count > 1) { DicConsole.WriteLine(string.Format("Identified by {0} plugins", id_plugins.Count)); @@ -167,7 +167,11 @@ namespace DiscImageChef.Commands if(plugins.PluginsList.TryGetValue(plugin_name, out _plugin)) { DicConsole.WriteLine(string.Format("As identified by {0}.", _plugin.Name)); - Filesystem fs = (Filesystem)_plugin.GetType().GetConstructor(new Type[] { typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) }).Invoke(new object[] { _imageFormat, partitions[i], null }); + Filesystem fs = (Filesystem)_plugin + .GetType().GetConstructor(new Type[] + { + typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) + }).Invoke(new object[] {_imageFormat, partitions[i], null}); error = fs.Mount(options.Debug); if(error == Errno.NoError) @@ -185,8 +189,7 @@ namespace DiscImageChef.Commands string volumeName; if(string.IsNullOrEmpty(fs.XmlFSType.VolumeName)) volumeName = "NO NAME"; - else - volumeName = fs.XmlFSType.VolumeName; + else volumeName = fs.XmlFSType.VolumeName; error = fs.Stat(entry, ref stat); if(error == Errno.NoError) @@ -204,25 +207,25 @@ namespace DiscImageChef.Commands error = fs.GetXattr(entry, xattr, ref xattrBuf); if(error == Errno.NoError) { - Directory.CreateDirectory(Path.Combine( - options.OutputDir, - fs.XmlFSType.Type, - volumeName, - ".xattrs", - xattr)); + Directory + .CreateDirectory(Path.Combine(options.OutputDir, + fs.XmlFSType.Type, + volumeName, + ".xattrs", + xattr)); - outputPath = Path.Combine(options.OutputDir, - fs.XmlFSType.Type, - volumeName, - ".xattrs", - xattr, - entry); + outputPath = + Path.Combine(options.OutputDir, + fs.XmlFSType.Type, volumeName, + ".xattrs", xattr, entry); if(!File.Exists(outputPath)) { - outputFile = new FileStream(outputPath, - FileMode.CreateNew, FileAccess.ReadWrite, - FileShare.None); + outputFile = + new FileStream(outputPath, + FileMode.CreateNew, + FileAccess.ReadWrite, + FileShare.None); outputFile.Write(xattrBuf, 0, xattrBuf.Length); outputFile.Close(); FileInfo fi = new FileInfo(outputPath); @@ -231,46 +234,39 @@ namespace DiscImageChef.Commands { fi.CreationTimeUtc = stat.CreationTimeUtc; } - catch - { - } + catch { } try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } - catch - { - } + catch { } try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } - catch - { - } + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body - DicConsole.WriteLine( - "Written {0} bytes of xattr {1} from file {2} to {3}", - xattrBuf.Length, xattr, entry, outputPath); + DicConsole + .WriteLine("Written {0} bytes of xattr {1} from file {2} to {3}", + xattrBuf.Length, xattr, entry, + outputPath); } else - DicConsole.ErrorWriteLine( - "Cannot write xattr {0} for {1}, output exists", - xattr, entry); - + DicConsole + .ErrorWriteLine("Cannot write xattr {0} for {1}, output exists", + xattr, entry); } } } } Directory.CreateDirectory(Path.Combine(options.OutputDir, - fs.XmlFSType.Type, - volumeName)); + fs.XmlFSType.Type, + volumeName)); - outputPath = Path.Combine(options.OutputDir, - fs.XmlFSType.Type, - volumeName, - entry); + outputPath = + Path.Combine(options.OutputDir, fs.XmlFSType.Type, volumeName, + entry); if(!File.Exists(outputPath)) { @@ -280,57 +276,44 @@ namespace DiscImageChef.Commands if(error == Errno.NoError) { - outputFile = new FileStream(outputPath, FileMode.CreateNew, - FileAccess.ReadWrite, - FileShare.None); + outputFile = + new FileStream(outputPath, FileMode.CreateNew, + FileAccess.ReadWrite, FileShare.None); outputFile.Write(outBuf, 0, outBuf.Length); outputFile.Close(); FileInfo fi = new FileInfo(outputPath); #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - try - { - fi.CreationTimeUtc = stat.CreationTimeUtc; - } - catch - { - } - try - { - fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; - } - catch - { - } - try - { - fi.LastAccessTimeUtc = stat.AccessTimeUtc; - } - catch - { - } + try { fi.CreationTimeUtc = stat.CreationTimeUtc; } + catch { } + try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } + catch { } + try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body DicConsole.WriteLine("Written {0} bytes of file {1} to {2}", - outBuf.Length, entry, outputPath); + outBuf.Length, entry, outputPath); } else DicConsole.ErrorWriteLine("Error {0} reading file {1}", - error, entry); + error, entry); } else - DicConsole.ErrorWriteLine( - "Cannot write file {0}, output exists", entry); + DicConsole + .ErrorWriteLine("Cannot write file {0}, output exists", + entry); } - else - DicConsole.ErrorWriteLine("Error reading file {0}", entry); + else DicConsole.ErrorWriteLine("Error reading file {0}", entry); } } else - DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString()); + DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", + error.ToString()); Core.Statistics.AddFilesystem(fs.XmlFSType.Type); } else - DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); + DicConsole.ErrorWriteLine("Unable to mount device, error {0}", + error.ToString()); } } } @@ -338,7 +321,11 @@ namespace DiscImageChef.Commands { plugins.PluginsList.TryGetValue(id_plugins[0], out _plugin); DicConsole.WriteLine(string.Format("Identified by {0}.", _plugin.Name)); - Filesystem fs = (Filesystem)_plugin.GetType().GetConstructor(new Type[] { typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) }).Invoke(new object[] { _imageFormat, partitions[i], null }); + Filesystem fs = (Filesystem)_plugin + .GetType().GetConstructor(new Type[] + { + typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) + }).Invoke(new object[] {_imageFormat, partitions[i], null}); error = fs.Mount(options.Debug); if(error == Errno.NoError) { @@ -353,10 +340,8 @@ namespace DiscImageChef.Commands FileStream outputFile; string volumeName; - if(string.IsNullOrEmpty(fs.XmlFSType.VolumeName)) - volumeName = "NO NAME"; - else - volumeName = fs.XmlFSType.VolumeName; + if(string.IsNullOrEmpty(fs.XmlFSType.VolumeName)) volumeName = "NO NAME"; + else volumeName = fs.XmlFSType.VolumeName; error = fs.Stat(entry, ref stat); if(error == Errno.NoError) @@ -375,71 +360,50 @@ namespace DiscImageChef.Commands if(error == Errno.NoError) { Directory.CreateDirectory(Path.Combine(options.OutputDir, - fs.XmlFSType.Type, - volumeName, - ".xattrs", - xattr)); + fs.XmlFSType.Type, + volumeName, + ".xattrs", xattr)); - outputPath = Path.Combine(options.OutputDir, - fs.XmlFSType.Type, - volumeName, - ".xattrs", - xattr, - entry); + outputPath = + Path.Combine(options.OutputDir, fs.XmlFSType.Type, + volumeName, ".xattrs", xattr, entry); if(!File.Exists(outputPath)) { - outputFile = new FileStream(outputPath, - FileMode.CreateNew, FileAccess.ReadWrite, - FileShare.None); + outputFile = + new FileStream(outputPath, FileMode.CreateNew, + FileAccess.ReadWrite, + FileShare.None); outputFile.Write(xattrBuf, 0, xattrBuf.Length); outputFile.Close(); FileInfo fi = new FileInfo(outputPath); #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - try - { - fi.CreationTimeUtc = stat.CreationTimeUtc; - } - catch - { - } - try - { - fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; - } - catch - { - } - try - { - fi.LastAccessTimeUtc = stat.AccessTimeUtc; - } - catch - { - } + try { fi.CreationTimeUtc = stat.CreationTimeUtc; } + catch { } + try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } + catch { } + try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body - DicConsole.WriteLine( - "Written {0} bytes of xattr {1} from file {2} to {3}", - xattrBuf.Length, xattr, entry, outputPath); + DicConsole + .WriteLine("Written {0} bytes of xattr {1} from file {2} to {3}", + xattrBuf.Length, xattr, entry, + outputPath); } else - DicConsole.ErrorWriteLine( - "Cannot write xattr {0} for {1}, output exists", - xattr, entry); - + DicConsole + .ErrorWriteLine("Cannot write xattr {0} for {1}, output exists", + xattr, entry); } } } } - Directory.CreateDirectory(Path.Combine(options.OutputDir, - fs.XmlFSType.Type, - volumeName)); + Directory.CreateDirectory(Path.Combine(options.OutputDir, fs.XmlFSType.Type, + volumeName)); - outputPath = Path.Combine(options.OutputDir, - fs.XmlFSType.Type, - volumeName, - entry); + outputPath = + Path.Combine(options.OutputDir, fs.XmlFSType.Type, volumeName, entry); if(!File.Exists(outputPath)) { @@ -449,48 +413,32 @@ namespace DiscImageChef.Commands if(error == Errno.NoError) { - outputFile = new FileStream(outputPath, FileMode.CreateNew, - FileAccess.ReadWrite, - FileShare.None); + outputFile = + new FileStream(outputPath, FileMode.CreateNew, + FileAccess.ReadWrite, FileShare.None); outputFile.Write(outBuf, 0, outBuf.Length); outputFile.Close(); FileInfo fi = new FileInfo(outputPath); #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - try - { - fi.CreationTimeUtc = stat.CreationTimeUtc; - } - catch - { - } - try - { - fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; - } - catch - { - } - try - { - fi.LastAccessTimeUtc = stat.AccessTimeUtc; - } - catch - { - } + try { fi.CreationTimeUtc = stat.CreationTimeUtc; } + catch { } + try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } + catch { } + try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body DicConsole.WriteLine("Written {0} bytes of file {1} to {2}", - outBuf.Length, entry, outputPath); + outBuf.Length, entry, outputPath); } else DicConsole.ErrorWriteLine("Error {0} reading file {1}", error, - entry); + entry); } else DicConsole.ErrorWriteLine("Cannot write file {0}, output exists", - entry); + entry); } - else - DicConsole.ErrorWriteLine("Error reading file {0}", entry); + else DicConsole.ErrorWriteLine("Error reading file {0}", entry); } } else @@ -498,8 +446,7 @@ namespace DiscImageChef.Commands Core.Statistics.AddFilesystem(fs.XmlFSType.Type); } - else - DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); + else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); } } } @@ -512,8 +459,7 @@ namespace DiscImageChef.Commands }; Core.Filesystems.Identify(_imageFormat, out id_plugins, wholePart); - if(id_plugins.Count == 0) - DicConsole.WriteLine("Filesystem not identified"); + if(id_plugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(id_plugins.Count > 1) { DicConsole.WriteLine(string.Format("Identified by {0} plugins", id_plugins.Count)); @@ -523,7 +469,11 @@ namespace DiscImageChef.Commands if(plugins.PluginsList.TryGetValue(plugin_name, out _plugin)) { DicConsole.WriteLine(string.Format("As identified by {0}.", _plugin.Name)); - Filesystem fs = (Filesystem)_plugin.GetType().GetConstructor(new Type[] { typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) }).Invoke(new object[] { _imageFormat, wholePart, null }); + Filesystem fs = (Filesystem)_plugin + .GetType().GetConstructor(new Type[] + { + typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) + }).Invoke(new object[] {_imageFormat, wholePart, null}); error = fs.Mount(options.Debug); if(error == Errno.NoError) { @@ -538,10 +488,8 @@ namespace DiscImageChef.Commands FileStream outputFile; string volumeName; - if(string.IsNullOrEmpty(fs.XmlFSType.VolumeName)) - volumeName = "NO NAME"; - else - volumeName = fs.XmlFSType.VolumeName; + if(string.IsNullOrEmpty(fs.XmlFSType.VolumeName)) volumeName = "NO NAME"; + else volumeName = fs.XmlFSType.VolumeName; error = fs.Stat(entry, ref stat); if(error == Errno.NoError) @@ -560,71 +508,50 @@ namespace DiscImageChef.Commands if(error == Errno.NoError) { Directory.CreateDirectory(Path.Combine(options.OutputDir, - fs.XmlFSType.Type, - volumeName, - ".xattrs", - xattr)); + fs.XmlFSType.Type, + volumeName, + ".xattrs", xattr)); - outputPath = Path.Combine(options.OutputDir, - fs.XmlFSType.Type, - volumeName, - ".xattrs", - xattr, - entry); + outputPath = + Path.Combine(options.OutputDir, fs.XmlFSType.Type, + volumeName, ".xattrs", xattr, entry); if(!File.Exists(outputPath)) { - outputFile = new FileStream(outputPath, - FileMode.CreateNew, FileAccess.ReadWrite, - FileShare.None); + outputFile = + new FileStream(outputPath, FileMode.CreateNew, + FileAccess.ReadWrite, + FileShare.None); outputFile.Write(xattrBuf, 0, xattrBuf.Length); outputFile.Close(); FileInfo fi = new FileInfo(outputPath); #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - try - { - fi.CreationTimeUtc = stat.CreationTimeUtc; - } - catch - { - } - try - { - fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; - } - catch - { - } - try - { - fi.LastAccessTimeUtc = stat.AccessTimeUtc; - } - catch - { - } + try { fi.CreationTimeUtc = stat.CreationTimeUtc; } + catch { } + try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } + catch { } + try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body - DicConsole.WriteLine( - "Written {0} bytes of xattr {1} from file {2} to {3}", - xattrBuf.Length, xattr, entry, outputPath); + DicConsole + .WriteLine("Written {0} bytes of xattr {1} from file {2} to {3}", + xattrBuf.Length, xattr, entry, + outputPath); } else - DicConsole.ErrorWriteLine( - "Cannot write xattr {0} for {1}, output exists", - xattr, entry); - + DicConsole + .ErrorWriteLine("Cannot write xattr {0} for {1}, output exists", + xattr, entry); } } } } - Directory.CreateDirectory(Path.Combine(options.OutputDir, - fs.XmlFSType.Type, - volumeName)); + Directory.CreateDirectory(Path.Combine(options.OutputDir, fs.XmlFSType.Type, + volumeName)); - outputPath = Path.Combine(options.OutputDir, - fs.XmlFSType.Type, - volumeName, - entry); + outputPath = + Path.Combine(options.OutputDir, fs.XmlFSType.Type, volumeName, entry); if(!File.Exists(outputPath)) { @@ -634,48 +561,32 @@ namespace DiscImageChef.Commands if(error == Errno.NoError) { - outputFile = new FileStream(outputPath, FileMode.CreateNew, - FileAccess.ReadWrite, - FileShare.None); + outputFile = + new FileStream(outputPath, FileMode.CreateNew, + FileAccess.ReadWrite, FileShare.None); outputFile.Write(outBuf, 0, outBuf.Length); outputFile.Close(); FileInfo fi = new FileInfo(outputPath); #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - try - { - fi.CreationTimeUtc = stat.CreationTimeUtc; - } - catch - { - } - try - { - fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; - } - catch - { - } - try - { - fi.LastAccessTimeUtc = stat.AccessTimeUtc; - } - catch - { - } + try { fi.CreationTimeUtc = stat.CreationTimeUtc; } + catch { } + try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } + catch { } + try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body DicConsole.WriteLine("Written {0} bytes of file {1} to {2}", - outBuf.Length, entry, outputPath); + outBuf.Length, entry, outputPath); } else DicConsole.ErrorWriteLine("Error {0} reading file {1}", error, - entry); + entry); } else DicConsole.ErrorWriteLine("Cannot write file {0}, output exists", - entry); + entry); } - else - DicConsole.ErrorWriteLine("Error reading file {0}", entry); + else DicConsole.ErrorWriteLine("Error reading file {0}", entry); } } else @@ -683,8 +594,7 @@ namespace DiscImageChef.Commands Core.Statistics.AddFilesystem(fs.XmlFSType.Type); } - else - DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); + else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); } } } @@ -692,7 +602,11 @@ namespace DiscImageChef.Commands { plugins.PluginsList.TryGetValue(id_plugins[0], out _plugin); DicConsole.WriteLine(string.Format("Identified by {0}.", _plugin.Name)); - Filesystem fs = (Filesystem)_plugin.GetType().GetConstructor(new Type[] { typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) }).Invoke(new object[] { _imageFormat, wholePart, null }); + Filesystem fs = (Filesystem)_plugin + .GetType().GetConstructor(new Type[] + { + typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) + }).Invoke(new object[] {_imageFormat, wholePart, null}); error = fs.Mount(options.Debug); if(error == Errno.NoError) { @@ -707,10 +621,8 @@ namespace DiscImageChef.Commands FileStream outputFile; string volumeName; - if(string.IsNullOrEmpty(fs.XmlFSType.VolumeName)) - volumeName = "NO NAME"; - else - volumeName = fs.XmlFSType.VolumeName; + if(string.IsNullOrEmpty(fs.XmlFSType.VolumeName)) volumeName = "NO NAME"; + else volumeName = fs.XmlFSType.VolumeName; error = fs.Stat(entry, ref stat); if(error == Errno.NoError) @@ -730,49 +642,46 @@ namespace DiscImageChef.Commands { Directory.CreateDirectory(Path.Combine(options.OutputDir, fs.XmlFSType.Type, - volumeName, - ".xattrs", + volumeName, ".xattrs", xattr)); - outputPath = Path.Combine(options.OutputDir, - fs.XmlFSType.Type, - volumeName, - ".xattrs", - xattr, - entry); + outputPath = + Path.Combine(options.OutputDir, fs.XmlFSType.Type, volumeName, + ".xattrs", xattr, entry); if(!File.Exists(outputPath)) { - outputFile = new FileStream(outputPath, FileMode.CreateNew, FileAccess.ReadWrite, - FileShare.None); + outputFile = + new FileStream(outputPath, FileMode.CreateNew, + FileAccess.ReadWrite, FileShare.None); outputFile.Write(xattrBuf, 0, xattrBuf.Length); outputFile.Close(); FileInfo fi = new FileInfo(outputPath); #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - try { fi.CreationTimeUtc = stat.CreationTimeUtc; } catch { } - try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } catch { } - try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } catch { } + try { fi.CreationTimeUtc = stat.CreationTimeUtc; } + catch { } + try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } + catch { } + try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body - DicConsole.WriteLine("Written {0} bytes of xattr {1} from file {2} to {3}", - xattrBuf.Length, xattr, entry, outputPath); + DicConsole + .WriteLine("Written {0} bytes of xattr {1} from file {2} to {3}", + xattrBuf.Length, xattr, entry, outputPath); } else - DicConsole.ErrorWriteLine("Cannot write xattr {0} for {1}, output exists", - xattr, entry); - + DicConsole + .ErrorWriteLine("Cannot write xattr {0} for {1}, output exists", + xattr, entry); } } } } - Directory.CreateDirectory(Path.Combine(options.OutputDir, - fs.XmlFSType.Type, + Directory.CreateDirectory(Path.Combine(options.OutputDir, fs.XmlFSType.Type, volumeName)); - outputPath = Path.Combine(options.OutputDir, - fs.XmlFSType.Type, - volumeName, - entry); + outputPath = Path.Combine(options.OutputDir, fs.XmlFSType.Type, volumeName, entry); if(!File.Exists(outputPath)) { @@ -782,36 +691,34 @@ namespace DiscImageChef.Commands if(error == Errno.NoError) { - outputFile = new FileStream(outputPath, FileMode.CreateNew, FileAccess.ReadWrite, - FileShare.None); + outputFile = new FileStream(outputPath, FileMode.CreateNew, + FileAccess.ReadWrite, FileShare.None); outputFile.Write(outBuf, 0, outBuf.Length); outputFile.Close(); FileInfo fi = new FileInfo(outputPath); #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body - try { fi.CreationTimeUtc = stat.CreationTimeUtc; } catch { } - try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } catch { } - try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } catch { } + try { fi.CreationTimeUtc = stat.CreationTimeUtc; } + catch { } + try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } + catch { } + try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } + catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body - DicConsole.WriteLine("Written {0} bytes of file {1} to {2}", - outBuf.Length, entry, outputPath); + DicConsole.WriteLine("Written {0} bytes of file {1} to {2}", outBuf.Length, + entry, outputPath); } - else - DicConsole.ErrorWriteLine("Error {0} reading file {1}", error, entry); + else DicConsole.ErrorWriteLine("Error {0} reading file {1}", error, entry); } - else - DicConsole.ErrorWriteLine("Cannot write file {0}, output exists", entry); + else DicConsole.ErrorWriteLine("Cannot write file {0}, output exists", entry); } - else - DicConsole.ErrorWriteLine("Error reading file {0}", entry); + else DicConsole.ErrorWriteLine("Error reading file {0}", entry); } } - else - DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString()); + else DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString()); Core.Statistics.AddFilesystem(fs.XmlFSType.Type); } - else - DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); + else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); } } catch(Exception ex) @@ -823,5 +730,4 @@ namespace DiscImageChef.Commands Core.Statistics.AddCommand("extract-files"); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/Formats.cs b/DiscImageChef/Commands/Formats.cs index 80b6d5ba..f3bbcd6a 100644 --- a/DiscImageChef/Commands/Formats.cs +++ b/DiscImageChef/Commands/Formats.cs @@ -49,51 +49,44 @@ namespace DiscImageChef.Commands FiltersList filtersList = new FiltersList(); DicConsole.WriteLine("Supported filters:"); - if(FormatsOptions.Verbose) - DicConsole.VerboseWriteLine("GUID\t\t\t\t\tFilter"); + if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("GUID\t\t\t\t\tFilter"); foreach(KeyValuePair kvp in filtersList.filtersList) { - if(FormatsOptions.Verbose) - DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.UUID, kvp.Value.Name); - else - DicConsole.WriteLine(kvp.Value.Name); + if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.UUID, kvp.Value.Name); + else DicConsole.WriteLine(kvp.Value.Name); } + DicConsole.WriteLine(); DicConsole.WriteLine("Supported disc image formats:"); - if(FormatsOptions.Verbose) - DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin"); + if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin"); foreach(KeyValuePair kvp in plugins.ImagePluginsList) { if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.PluginUUID, kvp.Value.Name); - else - DicConsole.WriteLine(kvp.Value.Name); + else DicConsole.WriteLine(kvp.Value.Name); } + DicConsole.WriteLine(); DicConsole.WriteLine("Supported filesystems:"); - if(FormatsOptions.Verbose) - DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin"); + if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin"); foreach(KeyValuePair kvp in plugins.PluginsList) { if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.PluginUUID, kvp.Value.Name); - else - DicConsole.WriteLine(kvp.Value.Name); + else DicConsole.WriteLine(kvp.Value.Name); } + DicConsole.WriteLine(); DicConsole.WriteLine("Supported partitioning schemes:"); - if(FormatsOptions.Verbose) - DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin"); + if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin"); foreach(KeyValuePair kvp in plugins.PartPluginsList) { if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.PluginUUID, kvp.Value.Name); - else - DicConsole.WriteLine(kvp.Value.Name); + else DicConsole.WriteLine(kvp.Value.Name); } Core.Statistics.AddCommand("formats"); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/ListDevices.cs b/DiscImageChef/Commands/ListDevices.cs index 74f444f2..7fa42ebb 100644 --- a/DiscImageChef/Commands/ListDevices.cs +++ b/DiscImageChef/Commands/ListDevices.cs @@ -45,23 +45,22 @@ namespace DiscImageChef.Commands Devices.DeviceInfo[] devices = Device.ListDevices(); - if(devices == null || devices.Length == 0) - DicConsole.WriteLine("No known devices attached."); + if(devices == null || devices.Length == 0) DicConsole.WriteLine("No known devices attached."); else { devices = devices.OrderBy(d => d.path).ToArray(); - DicConsole.WriteLine("{0,-22}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", - "Path", "Vendor", "Model", "Serial", "Bus", "Supported?"); - DicConsole.WriteLine("{0,-22}+{1,-16}+{2,-24}+{3,-24}+{4,-10}+{5,-10}", - "----------------------", "----------------", "------------------------", - "------------------------", "----------", "----------"); + DicConsole.WriteLine("{0,-22}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", "Path", "Vendor", "Model", + "Serial", "Bus", "Supported?"); + DicConsole.WriteLine("{0,-22}+{1,-16}+{2,-24}+{3,-24}+{4,-10}+{5,-10}", "----------------------", + "----------------", "------------------------", "------------------------", + "----------", "----------"); foreach(Devices.DeviceInfo dev in devices) - DicConsole.WriteLine("{0,-22}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", dev.path, dev.vendor, dev.model, dev.serial, dev.bus, dev.supported); + DicConsole.WriteLine("{0,-22}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", dev.path, dev.vendor, + dev.model, dev.serial, dev.bus, dev.supported); } Core.Statistics.AddCommand("list-devices"); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/ListEncodings.cs b/DiscImageChef/Commands/ListEncodings.cs index cef366f0..670ffa0b 100644 --- a/DiscImageChef/Commands/ListEncodings.cs +++ b/DiscImageChef/Commands/ListEncodings.cs @@ -49,17 +49,16 @@ namespace DiscImageChef.Commands List encodings = new List(); foreach(System.Text.EncodingInfo info in System.Text.Encoding.GetEncodings()) - encodings.Add(new CommonEncodingInfo { Name = info.Name, DisplayName = info.GetEncoding().EncodingName }); + encodings.Add(new CommonEncodingInfo {Name = info.Name, DisplayName = info.GetEncoding().EncodingName}); foreach(Claunia.Encoding.EncodingInfo info in Claunia.Encoding.Encoding.GetEncodings()) - encodings.Add(new CommonEncodingInfo { Name = info.Name, DisplayName = info.DisplayName }); + encodings.Add(new CommonEncodingInfo {Name = info.Name, DisplayName = info.DisplayName}); DicConsole.WriteLine("{0,-16} {1,-8}", "Name", "Description"); foreach(CommonEncodingInfo info in encodings.OrderBy(t => t.DisplayName)) - DicConsole.WriteLine("{0,-16} {1,-8}", info.Name, info.DisplayName); + DicConsole.WriteLine("{0,-16} {1,-8}", info.Name, info.DisplayName); Core.Statistics.AddCommand("list-encodings"); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/Ls.cs b/DiscImageChef/Commands/Ls.cs index a05bb570..eabb61b1 100644 --- a/DiscImageChef/Commands/Ls.cs +++ b/DiscImageChef/Commands/Ls.cs @@ -66,8 +66,7 @@ namespace DiscImageChef.Commands try { encoding = Claunia.Encoding.Encoding.GetEncoding(options.EncodingName); - if(options.Verbose) - DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName); + if(options.Verbose) DicConsole.VerboseWriteLine("Using encoding for {0}.", encoding.EncodingName); } catch(ArgumentException) { @@ -97,9 +96,9 @@ namespace DiscImageChef.Commands else { if(options.Verbose) - DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", _imageFormat.Name, _imageFormat.PluginUUID); - else - DicConsole.WriteLine("Image format identified by {0}.", _imageFormat.Name); + DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", _imageFormat.Name, + _imageFormat.PluginUUID); + else DicConsole.WriteLine("Image format identified by {0}.", _imageFormat.Name); } try @@ -112,9 +111,11 @@ namespace DiscImageChef.Commands } DicConsole.DebugWriteLine("Ls command", "Correctly opened image file."); - DicConsole.DebugWriteLine("Ls command", "Image without headers is {0} bytes.", _imageFormat.GetImageSize()); + DicConsole.DebugWriteLine("Ls command", "Image without headers is {0} bytes.", + _imageFormat.GetImageSize()); DicConsole.DebugWriteLine("Ls command", "Image has {0} sectors.", _imageFormat.GetSectors()); - DicConsole.DebugWriteLine("Ls command", "Image identifies disk type as {0}.", _imageFormat.GetMediaType()); + DicConsole.DebugWriteLine("Ls command", "Image identifies disk type as {0}.", + _imageFormat.GetMediaType()); Core.Statistics.AddMediaFormat(_imageFormat.GetImageFormat()); Core.Statistics.AddMedia(_imageFormat.ImageInfo.mediaType, false); @@ -130,8 +131,7 @@ namespace DiscImageChef.Commands List partitions = Partitions.GetAll(_imageFormat); Partitions.AddSchemesToStats(partitions); - if(partitions.Count == 0) - DicConsole.DebugWriteLine("Ls command", "No partitions found"); + if(partitions.Count == 0) DicConsole.DebugWriteLine("Ls command", "No partitions found"); else { DicConsole.WriteLine("{0} partitions found.", partitions.Count); @@ -144,8 +144,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Identifying filesystem on partition"); Core.Filesystems.Identify(_imageFormat, out id_plugins, partitions[i]); - if(id_plugins.Count == 0) - DicConsole.WriteLine("Filesystem not identified"); + if(id_plugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(id_plugins.Count > 1) { DicConsole.WriteLine(string.Format("Identified by {0} plugins", id_plugins.Count)); @@ -155,7 +154,11 @@ namespace DiscImageChef.Commands if(plugins.PluginsList.TryGetValue(plugin_name, out _plugin)) { DicConsole.WriteLine(string.Format("As identified by {0}.", _plugin.Name)); - Filesystem fs = (Filesystem)_plugin.GetType().GetConstructor(new Type[] { typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) }).Invoke(new object[] { _imageFormat, partitions[i], null }); + Filesystem fs = (Filesystem)_plugin + .GetType().GetConstructor(new Type[] + { + typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) + }).Invoke(new object[] {_imageFormat, partitions[i], null}); error = fs.Mount(options.Debug); if(error == Errno.NoError) @@ -164,16 +167,17 @@ namespace DiscImageChef.Commands error = fs.ReadDir("/", ref rootDir); if(error == Errno.NoError) { - foreach(string entry in rootDir) - DicConsole.WriteLine("{0}", entry); + foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry); } else - DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString()); + DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", + error.ToString()); Core.Statistics.AddFilesystem(fs.XmlFSType.Type); } else - DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); + DicConsole.ErrorWriteLine("Unable to mount device, error {0}", + error.ToString()); } } } @@ -181,7 +185,11 @@ namespace DiscImageChef.Commands { plugins.PluginsList.TryGetValue(id_plugins[0], out _plugin); DicConsole.WriteLine(string.Format("Identified by {0}.", _plugin.Name)); - Filesystem fs = (Filesystem)_plugin.GetType().GetConstructor(new Type[] { typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) }).Invoke(new object[] { _imageFormat, partitions[i], null }); + Filesystem fs = (Filesystem)_plugin + .GetType().GetConstructor(new Type[] + { + typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) + }).Invoke(new object[] {_imageFormat, partitions[i], null}); error = fs.Mount(options.Debug); if(error == Errno.NoError) { @@ -189,16 +197,14 @@ namespace DiscImageChef.Commands error = fs.ReadDir("/", ref rootDir); if(error == Errno.NoError) { - foreach(string entry in rootDir) - DicConsole.WriteLine("{0}", entry); + foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry); } else DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString()); Core.Statistics.AddFilesystem(fs.XmlFSType.Type); } - else - DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); + else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); } } } @@ -211,8 +217,7 @@ namespace DiscImageChef.Commands }; Core.Filesystems.Identify(_imageFormat, out id_plugins, wholePart); - if(id_plugins.Count == 0) - DicConsole.WriteLine("Filesystem not identified"); + if(id_plugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(id_plugins.Count > 1) { DicConsole.WriteLine(string.Format("Identified by {0} plugins", id_plugins.Count)); @@ -222,7 +227,11 @@ namespace DiscImageChef.Commands if(plugins.PluginsList.TryGetValue(plugin_name, out _plugin)) { DicConsole.WriteLine(string.Format("As identified by {0}.", _plugin.Name)); - Filesystem fs = (Filesystem)_plugin.GetType().GetConstructor(new Type[] { typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) }).Invoke(new object[] { _imageFormat, wholePart, null }); + Filesystem fs = (Filesystem)_plugin + .GetType().GetConstructor(new Type[] + { + typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) + }).Invoke(new object[] {_imageFormat, wholePart, null}); error = fs.Mount(options.Debug); if(error == Errno.NoError) { @@ -230,16 +239,14 @@ namespace DiscImageChef.Commands error = fs.ReadDir("/", ref rootDir); if(error == Errno.NoError) { - foreach(string entry in rootDir) - DicConsole.WriteLine("{0}", entry); + foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry); } else DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString()); Core.Statistics.AddFilesystem(fs.XmlFSType.Type); } - else - DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); + else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); } } } @@ -247,7 +254,11 @@ namespace DiscImageChef.Commands { plugins.PluginsList.TryGetValue(id_plugins[0], out _plugin); DicConsole.WriteLine(string.Format("Identified by {0}.", _plugin.Name)); - Filesystem fs = (Filesystem)_plugin.GetType().GetConstructor(new Type[] { typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) }).Invoke(new object[] { _imageFormat, wholePart, null }); + Filesystem fs = (Filesystem)_plugin + .GetType().GetConstructor(new Type[] + { + typeof(ImagePlugin), typeof(Partition), typeof(System.Text.Encoding) + }).Invoke(new object[] {_imageFormat, wholePart, null}); error = fs.Mount(options.Debug); if(error == Errno.NoError) { @@ -265,11 +276,8 @@ namespace DiscImageChef.Commands error = fs.Stat(entry, ref stat); if(error == Errno.NoError) { - DicConsole.WriteLine("{0}\t{1}\t{2} bytes\t{3}", - stat.CreationTimeUtc, - stat.Inode, - stat.Length, - entry); + DicConsole.WriteLine("{0}\t{1}\t{2} bytes\t{3}", stat.CreationTimeUtc, + stat.Inode, stat.Length, entry); error = fs.ListXAttr(entry, ref xattrs); if(error == Errno.NoError) @@ -280,26 +288,21 @@ namespace DiscImageChef.Commands error = fs.GetXattr(entry, xattr, ref xattrBuf); if(error == Errno.NoError) { - DicConsole.WriteLine("\t\t{0}\t{1} bytes", - xattr, xattrBuf.Length); + DicConsole.WriteLine("\t\t{0}\t{1} bytes", xattr, xattrBuf.Length); } } } } - else - DicConsole.WriteLine("{0}", entry); + else DicConsole.WriteLine("{0}", entry); } - else - DicConsole.WriteLine("{0}", entry); + else DicConsole.WriteLine("{0}", entry); } } - else - DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString()); + else DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString()); Core.Statistics.AddFilesystem(fs.XmlFSType.Type); } - else - DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); + else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); } } catch(Exception ex) @@ -311,5 +314,4 @@ namespace DiscImageChef.Commands Core.Statistics.AddCommand("ls"); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/MediaInfo.cs b/DiscImageChef/Commands/MediaInfo.cs index 74a79124..c79de91c 100644 --- a/DiscImageChef/Commands/MediaInfo.cs +++ b/DiscImageChef/Commands/MediaInfo.cs @@ -48,8 +48,8 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Media-Info command", "--device={0}", options.DevicePath); DicConsole.DebugWriteLine("Media-Info command", "--output-prefix={0}", options.OutputPrefix); - if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && - options.DevicePath[0] != '/' && char.IsLetter(options.DevicePath[0])) + if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && + char.IsLetter(options.DevicePath[0])) { options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':'; } @@ -80,8 +80,7 @@ namespace DiscImageChef.Commands case DeviceType.SCSI: doSCSIMediaInfo(options.OutputPrefix, dev); break; - default: - throw new NotSupportedException("Unknown device type."); + default: throw new NotSupportedException("Unknown device type."); } Core.Statistics.AddCommand("media-info"); @@ -126,8 +125,7 @@ namespace DiscImageChef.Commands if(decSense.Value.ASC == 0x29) { resets++; - if(resets < 5) - goto deviceGotReset; + if(resets < 5) goto deviceGotReset; } if(decSense.Value.ASC == 0x3A) @@ -138,8 +136,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if(!sense) - break; + if(!sense) break; leftRetries--; } @@ -158,21 +155,22 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if(!sense) - break; + if(!sense) break; leftRetries--; } if(sense) { - DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); return; } } else { - DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); return; } } @@ -188,27 +186,26 @@ namespace DiscImageChef.Commands Decoders.SCSI.Modes.DecodedMode? decMode = null; Decoders.SCSI.PeripheralDeviceTypes devType = dev.SCSIType; - sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration); + sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, + 0xFF, 5, out duration); if(sense || dev.Error) { - sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); + sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, + 0x00, 5, out duration); } - if(!sense && !dev.Error) - { - decMode = Decoders.SCSI.Modes.DecodeMode10(modeBuf, devType); - } + if(!sense && !dev.Error) { decMode = Decoders.SCSI.Modes.DecodeMode10(modeBuf, devType); } if(sense || dev.Error || !decMode.HasValue) { - sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); + sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, + 5, out duration); if(sense || dev.Error) - sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); - if(sense || dev.Error) - sense = dev.ModeSense(out modeBuf, out senseBuf, 5, out duration); + sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, + 0x00, 5, out duration); + if(sense || dev.Error) sense = dev.ModeSense(out modeBuf, out senseBuf, 5, out duration); - if(!sense && !dev.Error) - decMode = Decoders.SCSI.Modes.DecodeMode6(modeBuf, devType); + if(!sense && !dev.Error) decMode = Decoders.SCSI.Modes.DecodeMode6(modeBuf, devType); } if(!sense) @@ -229,16 +226,17 @@ namespace DiscImageChef.Commands } if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.DirectAccess || - dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice || - dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.OCRWDevice || - dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.OpticalDevice || - dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.SimplifiedDevice || - dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.WriteOnceDevice) + dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice || + dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.OCRWDevice || + dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.OpticalDevice || + dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.SimplifiedDevice || + dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.WriteOnceDevice) { sense = dev.ReadCapacity(out cmdBuf, out senseBuf, dev.Timeout, out duration); if(!sense) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity.bin", "SCSI READ CAPACITY", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity.bin", "SCSI READ CAPACITY", + cmdBuf); blocks = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + (cmdBuf[3])); blockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + (cmdBuf[7])); } @@ -259,7 +257,8 @@ namespace DiscImageChef.Commands if(!sense) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity16.bin", "SCSI READ CAPACITY(16)", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity16.bin", + "SCSI READ CAPACITY(16)", cmdBuf); byte[] temp = new byte[8]; Array.Copy(cmdBuf, 0, temp, 0, 8); @@ -272,8 +271,8 @@ namespace DiscImageChef.Commands if(blocks != 0 && blockSize != 0) { blocks++; - DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", - blocks, blockSize, blocks * blockSize); + DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", blocks, + blockSize, blocks * blockSize); } } @@ -289,8 +288,10 @@ namespace DiscImageChef.Commands if(!sense && !seqBuf.SequenceEqual(medBuf)) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIA)", seqBuf); - Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dens = Decoders.SCSI.SSC.DensitySupport.DecodeDensity(seqBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_media.bin", + "SSC REPORT DENSITY SUPPORT (MEDIA)", seqBuf); + Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dens = + Decoders.SCSI.SSC.DensitySupport.DecodeDensity(seqBuf); if(dens.HasValue) { DicConsole.WriteLine("Densities supported by currently inserted media:"); @@ -306,8 +307,11 @@ namespace DiscImageChef.Commands if(!sense && !seqBuf.SequenceEqual(medBuf)) { - DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_medium_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIUM & MEDIA)", seqBuf); - Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? meds = Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(seqBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, + "_ssc_reportdensitysupport_medium_media.bin", + "SSC REPORT DENSITY SUPPORT (MEDIUM & MEDIA)", seqBuf); + Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? meds = + Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(seqBuf); if(meds.HasValue) { DicConsole.WriteLine("Medium types currently inserted in device:"); @@ -331,16 +335,20 @@ namespace DiscImageChef.Commands if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) { - sense = dev.GetConfiguration(out cmdBuf, out senseBuf, 0, MmcGetConfigurationRt.Current, dev.Timeout, out duration); + sense = dev.GetConfiguration(out cmdBuf, out senseBuf, 0, MmcGetConfigurationRt.Current, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ GET CONFIGURATION:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ GET CONFIGURATION:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_getconfiguration_current.bin", "SCSI GET CONFIGURATION", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_getconfiguration_current.bin", + "SCSI GET CONFIGURATION", cmdBuf); Decoders.SCSI.MMC.Features.SeparatedFeatures ftr = Decoders.SCSI.MMC.Features.Separate(cmdBuf); - DicConsole.DebugWriteLine("Media-Info command", "GET CONFIGURATION current profile is {0:X4}h", ftr.CurrentProfile); + DicConsole.DebugWriteLine("Media-Info command", "GET CONFIGURATION current profile is {0:X4}h", + ftr.CurrentProfile); switch(ftr.CurrentProfile) { @@ -434,16 +442,25 @@ namespace DiscImageChef.Commands } } - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.RecognizedFormatLayers, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.RecognizedFormatLayers, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Recognized Format Layers\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", + "READ DISC STRUCTURE: Recognized Format Layers\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_formatlayers.bin", "SCSI READ DISC STRUCTURE", cmdBuf); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.WriteProtectionStatus, 0, dev.Timeout, out duration); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_formatlayers.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.WriteProtectionStatus, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Write Protection Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Write Protection Status\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_writeprotection.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_writeprotection.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); // More like a drive information /* @@ -455,23 +472,23 @@ namespace DiscImageChef.Commands */ #region All DVD and HD DVD types - if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDPR || - dskType == MediaType.DVDPRDL || dskType == MediaType.DVDPRW || - dskType == MediaType.DVDPRWDL || dskType == MediaType.DVDR || - dskType == MediaType.DVDRAM || dskType == MediaType.DVDRDL || - dskType == MediaType.DVDROM || dskType == MediaType.DVDRW || - dskType == MediaType.DVDRWDL || dskType == MediaType.HDDVDR || - dskType == MediaType.HDDVDRAM || dskType == MediaType.HDDVDRDL || - dskType == MediaType.HDDVDROM || dskType == MediaType.HDDVDRW || - dskType == MediaType.HDDVDRWDL) + if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDPR || dskType == MediaType.DVDPRDL || + dskType == MediaType.DVDPRW || dskType == MediaType.DVDPRWDL || dskType == MediaType.DVDR || + dskType == MediaType.DVDRAM || dskType == MediaType.DVDRDL || dskType == MediaType.DVDROM || + dskType == MediaType.DVDRW || dskType == MediaType.DVDRWDL || dskType == MediaType.HDDVDR || + dskType == MediaType.HDDVDRAM || dskType == MediaType.HDDVDRDL || dskType == MediaType.HDDVDROM || + dskType == MediaType.HDDVDRW || dskType == MediaType.HDDVDRWDL) { - - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pfi.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pfi.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); Decoders.DVD.PFI.PhysicalFormatInformation? decPfi = Decoders.DVD.PFI.Decode(cmdBuf); if(decPfi.HasValue) { @@ -495,10 +512,8 @@ namespace DiscImageChef.Commands dskType = MediaType.DVDPRWDL; break; case Decoders.DVD.DiskCategory.DVDR: - if(decPfi.Value.PartVersion == 6) - dskType = MediaType.DVDRDL; - else - dskType = MediaType.DVDR; + if(decPfi.Value.PartVersion == 6) dskType = MediaType.DVDRDL; + else dskType = MediaType.DVDR; break; case Decoders.DVD.DiskCategory.DVDRAM: dskType = MediaType.DVDRAM; @@ -507,10 +522,8 @@ namespace DiscImageChef.Commands dskType = MediaType.DVDROM; break; case Decoders.DVD.DiskCategory.DVDRW: - if(decPfi.Value.PartVersion == 3) - dskType = MediaType.DVDRWDL; - else - dskType = MediaType.DVDRW; + if(decPfi.Value.PartVersion == 3) dskType = MediaType.DVDRWDL; + else dskType = MediaType.DVDRW; break; case Decoders.DVD.DiskCategory.HDDVDR: dskType = MediaType.HDDVDR; @@ -527,8 +540,7 @@ namespace DiscImageChef.Commands case Decoders.DVD.DiskCategory.Nintendo: if(decPfi.Value.DiscSize == Decoders.DVD.DVDSize.Eighty) dskType = MediaType.GOD; - else - dskType = MediaType.WOD; + else dskType = MediaType.WOD; break; case Decoders.DVD.DiskCategory.UMD: dskType = MediaType.UMD; @@ -537,12 +549,17 @@ namespace DiscImageChef.Commands } } } - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout, out duration); + + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_dmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_dmi.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); if(Decoders.Xbox.DMI.IsXbox(cmdBuf)) { dskType = MediaType.XGD; @@ -566,31 +583,42 @@ namespace DiscImageChef.Commands #region DVD-ROM if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: CMI\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_cmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf); - DicConsole.WriteLine("Lead-In CMI:\n{0}", Decoders.DVD.CSS_CPRM.PrettifyLeadInCopyright(cmdBuf)); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_cmi.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); + DicConsole.WriteLine("Lead-In CMI:\n{0}", + Decoders.DVD.CSS_CPRM.PrettifyLeadInCopyright(cmdBuf)); } } #endregion DVD-ROM #region DVD-ROM and HD DVD-ROM - if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM || - dskType == MediaType.HDDVDROM) + if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM || dskType == MediaType.HDDVDROM) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_bca.bin", "SCSI READ DISC STRUCTURE", cmdBuf); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVD_AACS, 0, dev.Timeout, out duration); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_bca.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVD_AACS, 0, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD AACS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD AACS\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_aacs.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_aacs.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); } #endregion DVD-ROM and HD DVD-ROM @@ -657,28 +685,39 @@ namespace DiscImageChef.Commands #region DVD-RAM and HD DVD-RAM if(dskType == MediaType.DVDRAM || dskType == MediaType.HDDVDRAM) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_DDS, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDRAM_DDS, 0, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_dds.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_dds.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); DicConsole.WriteLine("Disc Definition Structure:\n{0}", Decoders.DVD.DDS.Prettify(cmdBuf)); } - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_MediumStatus, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDRAM_MediumStatus, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Medium Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Medium Status\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_status.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_status.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); DicConsole.WriteLine("Medium Status:\n{0}", Decoders.DVD.Cartridge.Prettify(cmdBuf)); } - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: SAI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: SAI\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_spare.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_spare.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); DicConsole.WriteLine("Spare Area Information:\n{0}", Decoders.DVD.Spare.Prettify(cmdBuf)); } } @@ -687,242 +726,331 @@ namespace DiscImageChef.Commands #region DVD-R and HD DVD-R if(dskType == MediaType.DVDR || dskType == MediaType.HDDVDR) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.LastBorderOutRMD, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.LastBorderOutRMD, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last-Out Border RMD\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last-Out Border RMD\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_lastrmd.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_lastrmd.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); } #endregion DVD-R and HD DVD-R #region DVD-R and DVD-RW if(dskType == MediaType.DVDR || dskType == MediaType.DVDRW) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PreRecordedInfo, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.PreRecordedInfo, 0, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Pre-Recorded Info\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Pre-Recorded Info\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pri.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pri.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); } #endregion DVD-R and DVD-RW #region DVD-R, DVD-RW and HD DVD-R if(dskType == MediaType.DVDR || dskType == MediaType.DVDRW || dskType == MediaType.HDDVDR) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_MediaIdentifier, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDR_MediaIdentifier, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R Media ID\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R Media ID\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_mediaid.bin", "SCSI READ DISC STRUCTURE", cmdBuf); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_PhysicalInformation, 0, dev.Timeout, out duration); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_mediaid.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDR_PhysicalInformation, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R PFI\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_pfi.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_pfi.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); } #endregion DVD-R, DVD-RW and HD DVD-R #region All DVD+ - if(dskType == MediaType.DVDPR || dskType == MediaType.DVDPRDL || - dskType == MediaType.DVDPRW || dskType == MediaType.DVDPRWDL) + if(dskType == MediaType.DVDPR || dskType == MediaType.DVDPRDL || dskType == MediaType.DVDPRW || + dskType == MediaType.DVDPRWDL) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.ADIP, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.ADIP, 0, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: ADIP\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: ADIP\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_adip.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_adip.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DCB, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DCB, 0, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DCB\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DCB\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_dcb.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_dcb.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); } #endregion All DVD+ #region HD DVD-ROM if(dskType == MediaType.HDDVDROM) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVD_CopyrightInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.HDDVD_CopyrightInformation, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: HDDVD CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: HDDVD CMI\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvd_cmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvd_cmi.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); } #endregion HD DVD-ROM #region HD DVD-R if(dskType == MediaType.HDDVDR) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVDR_MediumStatus, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.HDDVDR_MediumStatus, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: HDDVD-R Medium Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", + "READ DISC STRUCTURE: HDDVD-R Medium Status\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_status.bin", "SCSI READ DISC STRUCTURE", cmdBuf); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVDR_LastRMD, 0, dev.Timeout, out duration); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_status.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.HDDVDR_LastRMD, 0, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last RMD\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last RMD\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_lastrmd.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_lastrmd.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); } #endregion HD DVD-R #region DVD-R DL, DVD-RW DL, DVD+R DL, DVD+RW DL - if(dskType == MediaType.DVDPRDL || dskType == MediaType.DVDRDL || - dskType == MediaType.DVDRWDL || dskType == MediaType.DVDPRWDL) + if(dskType == MediaType.DVDPRDL || dskType == MediaType.DVDRDL || dskType == MediaType.DVDRWDL || + dskType == MediaType.DVDPRWDL) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_LayerCapacity, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DVDR_LayerCapacity, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Layer Capacity\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Layer Capacity\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_layercap.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_layercap.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); } #endregion DVD-R DL, DVD-RW DL, DVD+R DL, DVD+RW DL #region DVD-R DL if(dskType == MediaType.DVDRDL) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.MiddleZoneStart, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.MiddleZoneStart, 0, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Middle Zone Start\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Middle Zone Start\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_mzs.bin", "SCSI READ DISC STRUCTURE", cmdBuf); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.JumpIntervalSize, 0, dev.Timeout, out duration); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_mzs.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.JumpIntervalSize, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Jump Interval Size\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Jump Interval Size\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_jis.bin", "SCSI READ DISC STRUCTURE", cmdBuf); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.ManualLayerJumpStartLBA, 0, dev.Timeout, out duration); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_jis.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.ManualLayerJumpStartLBA, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Manual Layer Jump Start LBA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", + "READ DISC STRUCTURE: Manual Layer Jump Start LBA\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_manuallj.bin", "SCSI READ DISC STRUCTURE", cmdBuf); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.RemapAnchorPoint, 0, dev.Timeout, out duration); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_manuallj.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.RemapAnchorPoint, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Remap Anchor Point\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Remap Anchor Point\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_remapanchor.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_remapanchor.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); } #endregion DVD-R DL #region All Blu-ray if(dskType == MediaType.BDR || dskType == MediaType.BDRE || dskType == MediaType.BDROM || - dskType == MediaType.BDRXL || dskType == MediaType.BDREXL) + dskType == MediaType.BDRXL || dskType == MediaType.BDREXL) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.DiscInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.DiscInformation, 0, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DI\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_di.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_di.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); DicConsole.WriteLine("Blu-ray Disc Information:\n{0}", Decoders.Bluray.DI.Prettify(cmdBuf)); } - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.PAC, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.PAC, 0, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PAC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PAC\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_pac.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_pac.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); } #endregion All Blu-ray #region BD-ROM only if(dskType == MediaType.BDROM) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_BurstCuttingArea, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.BD_BurstCuttingArea, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_bca.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_bca.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); DicConsole.WriteLine("Blu-ray Burst Cutting Area:\n{0}", Decoders.Bluray.BCA.Prettify(cmdBuf)); } } #endregion BD-ROM only #region Writable Blu-ray only - if(dskType == MediaType.BDR || dskType == MediaType.BDRE || - dskType == MediaType.BDRXL || dskType == MediaType.BDREXL) + if(dskType == MediaType.BDR || dskType == MediaType.BDRE || dskType == MediaType.BDRXL || + dskType == MediaType.BDREXL) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_DDS, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.BD_DDS, 0, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dds.bin", "SCSI READ DISC STRUCTURE", cmdBuf); - DicConsole.WriteLine("Blu-ray Disc Definition Structure:\n{0}", Decoders.Bluray.DDS.Prettify(cmdBuf)); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dds.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); + DicConsole.WriteLine("Blu-ray Disc Definition Structure:\n{0}", + Decoders.Bluray.DDS.Prettify(cmdBuf)); } - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.CartridgeStatus, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.CartridgeStatus, 0, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Cartridge Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Cartridge Status\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_cartstatus.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_cartstatus.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); DicConsole.WriteLine("Blu-ray Cartridge Status:\n{0}", Decoders.Bluray.DI.Prettify(cmdBuf)); } - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_SpareAreaInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.BD_SpareAreaInformation, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Spare Area Information\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", + "READ DISC STRUCTURE: Spare Area Information\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_spare.bin", "SCSI READ DISC STRUCTURE", cmdBuf); - DicConsole.WriteLine("Blu-ray Spare Area Information:\n{0}", Decoders.Bluray.DI.Prettify(cmdBuf)); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_spare.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); + DicConsole.WriteLine("Blu-ray Spare Area Information:\n{0}", + Decoders.Bluray.DI.Prettify(cmdBuf)); } - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.RawDFL, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, + MmcDiscStructureFormat.RawDFL, 0, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Raw DFL\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Raw DFL\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dfl.bin", "SCSI READ DISC STRUCTURE", cmdBuf); - sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.TrackResources, dev.Timeout, out duration); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dfl.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); + sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, + MmcDiscInformationDataTypes.TrackResources, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 001b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 001b\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DicConsole.WriteLine("Track Resources Information:\n{0}", Decoders.SCSI.MMC.DiscInformation.Prettify(cmdBuf)); - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_001b.bin", "SCSI READ DISC INFORMATION", cmdBuf); + DicConsole.WriteLine("Track Resources Information:\n{0}", + Decoders.SCSI.MMC.DiscInformation.Prettify(cmdBuf)); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_001b.bin", + "SCSI READ DISC INFORMATION", cmdBuf); } - sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.POWResources, dev.Timeout, out duration); + sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.POWResources, + dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 010b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 010b\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DicConsole.WriteLine("POW Resources Information:\n{0}", Decoders.SCSI.MMC.DiscInformation.Prettify(cmdBuf)); - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_010b.bin", "SCSI READ DISC INFORMATION", cmdBuf); + DicConsole.WriteLine("POW Resources Information:\n{0}", + Decoders.SCSI.MMC.DiscInformation.Prettify(cmdBuf)); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_010b.bin", + "SCSI READ DISC INFORMATION", cmdBuf); } } #endregion Writable Blu-ray only #region CDs - if(dskType == MediaType.CD || - dskType == MediaType.CDR || - dskType == MediaType.CDROM || - dskType == MediaType.CDRW || - dskType == MediaType.Unknown) + if(dskType == MediaType.CD || dskType == MediaType.CDR || dskType == MediaType.CDROM || + dskType == MediaType.CDRW || dskType == MediaType.Unknown) { Decoders.CD.TOC.CDTOC? toc = null; // We discarded all discs that falsify a TOC before requesting a real TOC // No TOC, no CD (or an empty one) - bool tocSense = dev.ReadTocPmaAtip(out cmdBuf, out senseBuf, false, 0, 0, dev.Timeout, out duration); + bool tocSense = + dev.ReadTocPmaAtip(out cmdBuf, out senseBuf, false, 0, 0, dev.Timeout, out duration); if(tocSense) - DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: TOC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: TOC\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { toc = Decoders.CD.TOC.Decode(cmdBuf); DicConsole.WriteLine("TOC:\n{0}", Decoders.CD.TOC.Prettify(toc)); - DataFile.WriteTo("Media-Info command", outputPrefix, "_toc.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_toc.bin", "SCSI READ TOC/PMA/ATIP", + cmdBuf); // As we have a TOC we know it is a CD - if(dskType == MediaType.Unknown) - dskType = MediaType.CD; + if(dskType == MediaType.Unknown) dskType = MediaType.CD; } // ATIP exists on blank CDs sense = dev.ReadAtip(out cmdBuf, out senseBuf, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: ATIP\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: ATIP\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_atip.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_atip.bin", "SCSI READ TOC/PMA/ATIP", + cmdBuf); Decoders.CD.ATIP.CDATIP? atip = Decoders.CD.ATIP.Decode(cmdBuf); if(atip.HasValue) { @@ -935,16 +1063,22 @@ namespace DiscImageChef.Commands // We got a TOC, get information about a recorded/mastered CD if(!tocSense) { - sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.DiscInformation, dev.Timeout, out duration); + sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, + MmcDiscInformationDataTypes.DiscInformation, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 000b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 000b\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - Decoders.SCSI.MMC.DiscInformation.StandardDiscInformation? discInfo = Decoders.SCSI.MMC.DiscInformation.Decode000b(cmdBuf); + Decoders.SCSI.MMC.DiscInformation.StandardDiscInformation? discInfo = + Decoders.SCSI.MMC.DiscInformation.Decode000b(cmdBuf); if(discInfo.HasValue) { - DicConsole.WriteLine("Standard Disc Information:\n{0}", Decoders.SCSI.MMC.DiscInformation.Prettify000b(discInfo)); - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_000b.bin", "SCSI READ DISC INFORMATION", cmdBuf); + DicConsole.WriteLine("Standard Disc Information:\n{0}", + Decoders.SCSI.MMC.DiscInformation.Prettify000b(discInfo)); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_000b.bin", + "SCSI READ DISC INFORMATION", cmdBuf); // If it is a read-only CD, check CD type if available if(dskType == MediaType.CD) @@ -967,10 +1101,12 @@ namespace DiscImageChef.Commands sense = dev.ReadSessionInfo(out cmdBuf, out senseBuf, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Session info\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Session info\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_session.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_session.bin", + "SCSI READ TOC/PMA/ATIP", cmdBuf); Decoders.CD.Session.CDSessionInfo? session = Decoders.CD.Session.Decode(cmdBuf); DicConsole.WriteLine("Session information:\n{0}", Decoders.CD.Session.Prettify(session)); if(session.HasValue) @@ -992,20 +1128,23 @@ namespace DiscImageChef.Commands foreach(Decoders.CD.TOC.CDTOCTrackDataDescriptor track in toc.Value.TrackDescriptors) { if(track.TrackNumber == 1 && - ((Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrack || - (Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrackIncremental)) + ((Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == + Decoders.CD.TOC_CONTROL.DataTrack || + (Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == + Decoders.CD.TOC_CONTROL.DataTrackIncremental)) { allFirstSessionTracksAreAudio &= firstTrackLastSession != 1; } - if((Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrack || - (Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrackIncremental) + if((Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == + Decoders.CD.TOC_CONTROL.DataTrack || + (Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == + Decoders.CD.TOC_CONTROL.DataTrackIncremental) { hasDataTrack = true; allFirstSessionTracksAreAudio &= track.TrackNumber >= firstTrackLastSession; } - else - hasAudioTrack = true; + else hasAudioTrack = true; hasVideoTrack |= track.ADR == 4; } @@ -1013,39 +1152,43 @@ namespace DiscImageChef.Commands if(hasDataTrack && hasAudioTrack && allFirstSessionTracksAreAudio && sessions == 2) dskType = MediaType.CDPLUS; - if(!hasDataTrack && hasAudioTrack && sessions == 1) - dskType = MediaType.CDDA; - if(hasDataTrack && !hasAudioTrack && sessions == 1) - dskType = MediaType.CDROM; - if(hasVideoTrack && !hasDataTrack && sessions == 1) - dskType = MediaType.CDV; + if(!hasDataTrack && hasAudioTrack && sessions == 1) dskType = MediaType.CDDA; + if(hasDataTrack && !hasAudioTrack && sessions == 1) dskType = MediaType.CDROM; + if(hasVideoTrack && !hasDataTrack && sessions == 1) dskType = MediaType.CDV; } sense = dev.ReadRawToc(out cmdBuf, out senseBuf, 1, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Raw TOC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Raw TOC\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_rawtoc.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_rawtoc.bin", + "SCSI READ TOC/PMA/ATIP", cmdBuf); DicConsole.WriteLine("Raw TOC:\n{0}", Decoders.CD.FullTOC.Prettify(cmdBuf)); } sense = dev.ReadPma(out cmdBuf, out senseBuf, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: PMA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: PMA\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_pma.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_pma.bin", "SCSI READ TOC/PMA/ATIP", + cmdBuf); DicConsole.WriteLine("PMA:\n{0}", Decoders.CD.PMA.Prettify(cmdBuf)); } sense = dev.ReadCdText(out cmdBuf, out senseBuf, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: CD-TEXT\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: CD-TEXT\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_cdtext.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_cdtext.bin", + "SCSI READ TOC/PMA/ATIP", cmdBuf); if(Decoders.CD.CDTextOnLeadIn.Decode(cmdBuf).HasValue) - DicConsole.WriteLine("CD-TEXT on Lead-In:\n{0}", Decoders.CD.CDTextOnLeadIn.Prettify(cmdBuf)); + DicConsole.WriteLine("CD-TEXT on Lead-In:\n{0}", + Decoders.CD.CDTextOnLeadIn.Prettify(cmdBuf)); } } } @@ -1054,12 +1197,16 @@ namespace DiscImageChef.Commands #region Nintendo if(dskType == MediaType.Unknown && blocks > 0) { - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pfi.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pfi.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); Decoders.DVD.PFI.PhysicalFormatInformation? nintendoPfi = Decoders.DVD.PFI.Decode(cmdBuf); if(nintendoPfi != null) { @@ -1067,18 +1214,21 @@ namespace DiscImageChef.Commands if(nintendoPfi.Value.DiskCategory == Decoders.DVD.DiskCategory.Nintendo && nintendoPfi.Value.PartVersion == 15) { - if(nintendoPfi.Value.DiscSize == Decoders.DVD.DVDSize.Eighty) - dskType = MediaType.GOD; + if(nintendoPfi.Value.DiscSize == Decoders.DVD.DVDSize.Eighty) dskType = MediaType.GOD; else if(nintendoPfi.Value.DiscSize == Decoders.DVD.DVDSize.OneTwenty) dskType = MediaType.WOD; } } } - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout, + out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_dmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_dmi.bin", + "SCSI READ DISC STRUCTURE", cmdBuf); } #endregion Nintendo } @@ -1098,9 +1248,11 @@ namespace DiscImageChef.Commands { sense = dev.KreonExtractSS(out cmdBuf, out senseBuf, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "KREON EXTRACT SS:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "KREON EXTRACT SS:\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else - DataFile.WriteTo("Media-Info command", outputPrefix, "_xbox_ss.bin", "KREON EXTRACT SS", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_xbox_ss.bin", "KREON EXTRACT SS", + cmdBuf); if(Decoders.Xbox.SS.Decode(cmdBuf).HasValue) DicConsole.WriteLine("Xbox Security Sector:\n{0}", Decoders.Xbox.SS.Prettify(cmdBuf)); @@ -1115,21 +1267,27 @@ namespace DiscImageChef.Commands DicConsole.ErrorWriteLine("Cannot lock drive, not continuing."); return; } + sense = dev.ReadCapacity(out cmdBuf, out senseBuf, dev.Timeout, out duration); if(sense) { DicConsole.ErrorWriteLine("Cannot get disc capacity."); return; } + totalSize = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + (cmdBuf[3])); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, 0, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.PhysicalInformation, 0, 0, out duration); if(sense) { DicConsole.ErrorWriteLine("Cannot get PFI."); return; } - DicConsole.DebugWriteLine("Dump-media command", "Video partition total size: {0} sectors", totalSize); - l0Video = Decoders.DVD.PFI.Decode(cmdBuf).Value.Layer0EndPSN - Decoders.DVD.PFI.Decode(cmdBuf).Value.DataAreaStartPSN + 1; + + DicConsole.DebugWriteLine("Dump-media command", "Video partition total size: {0} sectors", + totalSize); + l0Video = Decoders.DVD.PFI.Decode(cmdBuf).Value.Layer0EndPSN - + Decoders.DVD.PFI.Decode(cmdBuf).Value.DataAreaStartPSN + 1; l1Video = totalSize - l0Video + 1; // Get game partition size @@ -1140,14 +1298,17 @@ namespace DiscImageChef.Commands DicConsole.ErrorWriteLine("Cannot unlock drive, not continuing."); return; } + sense = dev.ReadCapacity(out cmdBuf, out senseBuf, dev.Timeout, out duration); if(sense) { DicConsole.ErrorWriteLine("Cannot get disc capacity."); return; } + gameSize = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + (cmdBuf[3])) + 1; - DicConsole.DebugWriteLine("Dump-media command", "Game partition total size: {0} sectors", gameSize); + DicConsole.DebugWriteLine("Dump-media command", "Game partition total size: {0} sectors", + gameSize); // Get middle zone size DicConsole.DebugWriteLine("Dump-media command", "Getting middle zone size"); @@ -1157,21 +1318,27 @@ namespace DiscImageChef.Commands DicConsole.ErrorWriteLine("Cannot unlock drive, not continuing."); return; } + sense = dev.ReadCapacity(out cmdBuf, out senseBuf, dev.Timeout, out duration); if(sense) { DicConsole.ErrorWriteLine("Cannot get disc capacity."); return; } + totalSize = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + (cmdBuf[3])); - sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, 0, out duration); + sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, + MmcDiscStructureFormat.PhysicalInformation, 0, 0, out duration); if(sense) { DicConsole.ErrorWriteLine("Cannot get PFI."); return; } + DicConsole.DebugWriteLine("Dump-media command", "Unlocked total size: {0} sectors", totalSize); - middleZone = totalSize - (Decoders.DVD.PFI.Decode(cmdBuf).Value.Layer0EndPSN - Decoders.DVD.PFI.Decode(cmdBuf).Value.DataAreaStartPSN + 1) - gameSize + 1; + middleZone = + totalSize - (Decoders.DVD.PFI.Decode(cmdBuf).Value.Layer0EndPSN - + Decoders.DVD.PFI.Decode(cmdBuf).Value.DataAreaStartPSN + 1) - gameSize + 1; totalSize = l0Video + l1Video + middleZone * 2 + gameSize; layerBreak = l0Video + middleZone + gameSize / 2; @@ -1189,29 +1356,30 @@ namespace DiscImageChef.Commands #endregion Xbox if(dskType == MediaType.Unknown) - dskType = MediaTypeFromSCSI.Get((byte)dev.SCSIType, dev.Manufacturer, dev.Model, scsiMediumType, scsiDensityCode, blocks, blockSize); + dskType = MediaTypeFromSCSI.Get((byte)dev.SCSIType, dev.Manufacturer, dev.Model, scsiMediumType, + scsiDensityCode, blocks, blockSize); - if(dskType == MediaType.Unknown && dev.IsUSB && containsFloppyPage) - dskType = MediaType.FlashDrive; + if(dskType == MediaType.Unknown && dev.IsUSB && containsFloppyPage) dskType = MediaType.FlashDrive; DicConsole.WriteLine("Media identified as {0}", dskType); Core.Statistics.AddMedia(dskType, true); sense = dev.ReadMediaSerialNumber(out cmdBuf, out senseBuf, dev.Timeout, out duration); if(sense) - DicConsole.DebugWriteLine("Media-Info command", "READ MEDIA SERIAL NUMBER\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); + DicConsole.DebugWriteLine("Media-Info command", "READ MEDIA SERIAL NUMBER\n{0}", + Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { - DataFile.WriteTo("Media-Info command", outputPrefix, "_mediaserialnumber.bin", "SCSI READ MEDIA SERIAL NUMBER", cmdBuf); + DataFile.WriteTo("Media-Info command", outputPrefix, "_mediaserialnumber.bin", + "SCSI READ MEDIA SERIAL NUMBER", cmdBuf); if(cmdBuf.Length >= 4) { DicConsole.Write("Media Serial Number: "); - for(int i = 4; i < cmdBuf.Length; i++) - DicConsole.Write("{0:X2}", cmdBuf[i]); + for(int i = 4; i < cmdBuf.Length; i++) DicConsole.Write("{0:X2}", cmdBuf[i]); + DicConsole.WriteLine(); } } } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/MediaScan.cs b/DiscImageChef/Commands/MediaScan.cs index 0d6669a0..41e41162 100644 --- a/DiscImageChef/Commands/MediaScan.cs +++ b/DiscImageChef/Commands/MediaScan.cs @@ -47,8 +47,8 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Media-Scan command", "--mhdd-log={0}", options.MHDDLogPath); DicConsole.DebugWriteLine("Media-Scan command", "--ibg-log={0}", options.IBGLogPath); - if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && - options.DevicePath[0] != '/' && char.IsLetter(options.DevicePath[0])) + if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && + char.IsLetter(options.DevicePath[0])) { options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':'; } @@ -81,11 +81,11 @@ namespace DiscImageChef.Commands case DeviceType.SCSI: results = SCSI.Scan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev); break; - default: - throw new NotSupportedException("Unknown device type."); + default: throw new NotSupportedException("Unknown device type."); } - DicConsole.WriteLine("Took a total of {0} seconds ({1} processing commands).", results.totalTime, results.processingTime); + DicConsole.WriteLine("Took a total of {0} seconds ({1} processing commands).", results.totalTime, + results.processingTime); DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.", results.avgSpeed); DicConsole.WriteLine("Fastest speed burst: {0:F3} MiB/sec.", results.maxSpeed); DicConsole.WriteLine("Slowest speed burst: {0:F3} MiB/sec.", results.minSpeed); @@ -102,17 +102,19 @@ namespace DiscImageChef.Commands foreach(ulong bad in results.unreadableSectors) DicConsole.WriteLine("Sector {0} could not be read", bad); } + DicConsole.WriteLine(); #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(results.seekTotal != 0 || results.seekMin != double.MaxValue || results.seekMax != double.MinValue) #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator DicConsole.WriteLine("Testing {0} seeks, longest seek took {1:F3} ms, fastest one took {2:F3} ms. ({3:F3} ms average)", - results.seekTimes, results.seekMax, results.seekMin, results.seekTotal / 1000); + results.seekTimes, results.seekMax, results.seekMin, results.seekTotal / 1000); - Core.Statistics.AddMediaScan((long)results.A, (long)results.B, (long)results.C, (long)results.D, (long)results.E, (long)results.F, (long)results.blocks, (long)results.errored, (long)(results.blocks - results.errored)); + Core.Statistics.AddMediaScan((long)results.A, (long)results.B, (long)results.C, (long)results.D, + (long)results.E, (long)results.F, (long)results.blocks, (long)results.errored, + (long)(results.blocks - results.errored)); Core.Statistics.AddCommand("media-scan"); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/PrintHex.cs b/DiscImageChef/Commands/PrintHex.cs index 9c446307..a351d2a8 100644 --- a/DiscImageChef/Commands/PrintHex.cs +++ b/DiscImageChef/Commands/PrintHex.cs @@ -75,22 +75,22 @@ namespace DiscImageChef.Commands if(inputFormat.ImageInfo.readableSectorTags == null) { - DicConsole.WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data."); + DicConsole + .WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data."); options.LongSectors = false; } else { if(inputFormat.ImageInfo.readableSectorTags.Count == 0) { - DicConsole.WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data."); + DicConsole + .WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data."); options.LongSectors = false; } } - if(options.LongSectors) - sector = inputFormat.ReadSectorLong(options.StartSector + i); - else - sector = inputFormat.ReadSector(options.StartSector + i); + if(options.LongSectors) sector = inputFormat.ReadSectorLong(options.StartSector + i); + else sector = inputFormat.ReadSector(options.StartSector + i); DiscImageChef.PrintHex.PrintHexArray(sector, options.WidthBytes); } @@ -98,5 +98,4 @@ namespace DiscImageChef.Commands Core.Statistics.AddCommand("print-hex"); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/Statistics.cs b/DiscImageChef/Commands/Statistics.cs index 2e28205c..625939cc 100644 --- a/DiscImageChef/Commands/Statistics.cs +++ b/DiscImageChef/Commands/Statistics.cs @@ -52,35 +52,50 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Commands statistics"); DicConsole.WriteLine("==================="); if(Core.Statistics.AllStats.Commands.Analyze > 0) - DicConsole.WriteLine("You have called the Analyze command {0} times", Core.Statistics.AllStats.Commands.Analyze); + DicConsole.WriteLine("You have called the Analyze command {0} times", + Core.Statistics.AllStats.Commands.Analyze); if(Core.Statistics.AllStats.Commands.Benchmark > 0) - DicConsole.WriteLine("You have called the Benchmark command {0} times", Core.Statistics.AllStats.Commands.Benchmark); + DicConsole.WriteLine("You have called the Benchmark command {0} times", + Core.Statistics.AllStats.Commands.Benchmark); if(Core.Statistics.AllStats.Commands.Checksum > 0) - DicConsole.WriteLine("You have called the Checksum command {0} times", Core.Statistics.AllStats.Commands.Checksum); + DicConsole.WriteLine("You have called the Checksum command {0} times", + Core.Statistics.AllStats.Commands.Checksum); if(Core.Statistics.AllStats.Commands.Compare > 0) - DicConsole.WriteLine("You have called the Compare command {0} times", Core.Statistics.AllStats.Commands.Compare); + DicConsole.WriteLine("You have called the Compare command {0} times", + Core.Statistics.AllStats.Commands.Compare); if(Core.Statistics.AllStats.Commands.CreateSidecar > 0) - DicConsole.WriteLine("You have called the Create-Sidecar command {0} times", Core.Statistics.AllStats.Commands.CreateSidecar); + DicConsole.WriteLine("You have called the Create-Sidecar command {0} times", + Core.Statistics.AllStats.Commands.CreateSidecar); if(Core.Statistics.AllStats.Commands.Decode > 0) - DicConsole.WriteLine("You have called the Decode command {0} times", Core.Statistics.AllStats.Commands.Decode); + DicConsole.WriteLine("You have called the Decode command {0} times", + Core.Statistics.AllStats.Commands.Decode); if(Core.Statistics.AllStats.Commands.DeviceInfo > 0) - DicConsole.WriteLine("You have called the Device-Info command {0} times", Core.Statistics.AllStats.Commands.DeviceInfo); + DicConsole.WriteLine("You have called the Device-Info command {0} times", + Core.Statistics.AllStats.Commands.DeviceInfo); if(Core.Statistics.AllStats.Commands.DeviceReport > 0) - DicConsole.WriteLine("You have called the Device-Report command {0} times", Core.Statistics.AllStats.Commands.DeviceReport); + DicConsole.WriteLine("You have called the Device-Report command {0} times", + Core.Statistics.AllStats.Commands.DeviceReport); if(Core.Statistics.AllStats.Commands.DumpMedia > 0) - DicConsole.WriteLine("You have called the Dump-Media command {0} times", Core.Statistics.AllStats.Commands.DumpMedia); + DicConsole.WriteLine("You have called the Dump-Media command {0} times", + Core.Statistics.AllStats.Commands.DumpMedia); if(Core.Statistics.AllStats.Commands.Entropy > 0) - DicConsole.WriteLine("You have called the Entropy command {0} times", Core.Statistics.AllStats.Commands.Entropy); + DicConsole.WriteLine("You have called the Entropy command {0} times", + Core.Statistics.AllStats.Commands.Entropy); if(Core.Statistics.AllStats.Commands.Formats > 0) - DicConsole.WriteLine("You have called the Formats command {0} times", Core.Statistics.AllStats.Commands.Formats); + DicConsole.WriteLine("You have called the Formats command {0} times", + Core.Statistics.AllStats.Commands.Formats); if(Core.Statistics.AllStats.Commands.MediaInfo > 0) - DicConsole.WriteLine("You have called the Media-Info command {0} times", Core.Statistics.AllStats.Commands.MediaInfo); + DicConsole.WriteLine("You have called the Media-Info command {0} times", + Core.Statistics.AllStats.Commands.MediaInfo); if(Core.Statistics.AllStats.Commands.MediaScan > 0) - DicConsole.WriteLine("You have called the Media-Scan command {0} times", Core.Statistics.AllStats.Commands.MediaScan); + DicConsole.WriteLine("You have called the Media-Scan command {0} times", + Core.Statistics.AllStats.Commands.MediaScan); if(Core.Statistics.AllStats.Commands.PrintHex > 0) - DicConsole.WriteLine("You have called the Print-Hex command {0} times", Core.Statistics.AllStats.Commands.PrintHex); + DicConsole.WriteLine("You have called the Print-Hex command {0} times", + Core.Statistics.AllStats.Commands.PrintHex); if(Core.Statistics.AllStats.Commands.Verify > 0) - DicConsole.WriteLine("You have called the Verify command {0} times", Core.Statistics.AllStats.Commands.Verify); + DicConsole.WriteLine("You have called the Verify command {0} times", + Core.Statistics.AllStats.Commands.Verify); DicConsole.WriteLine(); thereAreStats = true; } @@ -93,11 +108,17 @@ namespace DiscImageChef.Commands { DicConsole.WriteLine("Took {0} seconds to calculate {1} algorithm", chk.Value, chk.algorithm); } - DicConsole.WriteLine("Took {0} seconds to calculate all algorithms sequentially", Core.Statistics.AllStats.Benchmark.Sequential); - DicConsole.WriteLine("Took {0} seconds to calculate all algorithms at the same time", Core.Statistics.AllStats.Benchmark.All); - DicConsole.WriteLine("Took {0} seconds to calculate entropy", Core.Statistics.AllStats.Benchmark.Entropy); - DicConsole.WriteLine("Used a maximum of {0} bytes of memory", Core.Statistics.AllStats.Benchmark.MaxMemory); - DicConsole.WriteLine("Used a minimum of {0} bytes of memory", Core.Statistics.AllStats.Benchmark.MinMemory); + + DicConsole.WriteLine("Took {0} seconds to calculate all algorithms sequentially", + Core.Statistics.AllStats.Benchmark.Sequential); + DicConsole.WriteLine("Took {0} seconds to calculate all algorithms at the same time", + Core.Statistics.AllStats.Benchmark.All); + DicConsole.WriteLine("Took {0} seconds to calculate entropy", + Core.Statistics.AllStats.Benchmark.Entropy); + DicConsole.WriteLine("Used a maximum of {0} bytes of memory", + Core.Statistics.AllStats.Benchmark.MaxMemory); + DicConsole.WriteLine("Used a minimum of {0} bytes of memory", + Core.Statistics.AllStats.Benchmark.MinMemory); DicConsole.WriteLine(); thereAreStats = true; } @@ -108,6 +129,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("=================="); foreach(NameValueStats nvs in Core.Statistics.AllStats.Filters) DicConsole.WriteLine("Filter {0} has been found {1} times.", nvs.name, nvs.Value); + DicConsole.WriteLine(); thereAreStats = true; } @@ -118,6 +140,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("======================"); foreach(NameValueStats nvs in Core.Statistics.AllStats.MediaImages) DicConsole.WriteLine("Format {0} has been found {1} times.", nvs.name, nvs.Value); + DicConsole.WriteLine(); thereAreStats = true; } @@ -128,6 +151,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("===================="); foreach(NameValueStats nvs in Core.Statistics.AllStats.Partitions) DicConsole.WriteLine("Partitioning scheme {0} has been found {1} times.", nvs.name, nvs.Value); + DicConsole.WriteLine(); thereAreStats = true; } @@ -138,6 +162,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("====================="); foreach(NameValueStats nvs in Core.Statistics.AllStats.Filesystems) DicConsole.WriteLine("Filesystem {0} has been found {1} times.", nvs.name, nvs.Value); + DicConsole.WriteLine(); thereAreStats = true; } @@ -147,7 +172,10 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Device statistics"); DicConsole.WriteLine("================="); foreach(DeviceStats ds in Core.Statistics.AllStats.Devices) - DicConsole.WriteLine("Device model {0}, manufactured by {1}, with revision {2} and attached via {3}.", ds.Model, ds.Manufacturer, ds.Revision, ds.Bus); + DicConsole + .WriteLine("Device model {0}, manufactured by {1}, with revision {2} and attached via {3}.", + ds.Model, ds.Manufacturer, ds.Revision, ds.Bus); + DicConsole.WriteLine(); thereAreStats = true; } @@ -159,10 +187,13 @@ namespace DiscImageChef.Commands foreach(MediaStats ms in Core.Statistics.AllStats.Medias) { if(ms.real) - DicConsole.WriteLine("Media type {0} has been found {1} times in a real device.", ms.type, ms.Value); + DicConsole.WriteLine("Media type {0} has been found {1} times in a real device.", ms.type, + ms.Value); else - DicConsole.WriteLine("Media type {0} has been found {1} times in a media image.", ms.type, ms.Value); + DicConsole.WriteLine("Media type {0} has been found {1} times in a media image.", ms.type, + ms.Value); } + DicConsole.WriteLine(); thereAreStats = true; } @@ -171,15 +202,22 @@ namespace DiscImageChef.Commands { DicConsole.WriteLine("Media scan statistics"); DicConsole.WriteLine("====================="); - DicConsole.WriteLine("Scanned a total of {0} sectors", Core.Statistics.AllStats.MediaScan.Sectors.Total); + DicConsole.WriteLine("Scanned a total of {0} sectors", + Core.Statistics.AllStats.MediaScan.Sectors.Total); DicConsole.WriteLine("{0} of them correctly", Core.Statistics.AllStats.MediaScan.Sectors.Correct); DicConsole.WriteLine("{0} of them had errors", Core.Statistics.AllStats.MediaScan.Sectors.Error); - DicConsole.WriteLine("{0} of them took less than 3 ms", Core.Statistics.AllStats.MediaScan.Times.LessThan3ms); - DicConsole.WriteLine("{0} of them took less than 10 ms but more than 3 ms", Core.Statistics.AllStats.MediaScan.Times.LessThan10ms); - DicConsole.WriteLine("{0} of them took less than 50 ms but more than 10 ms", Core.Statistics.AllStats.MediaScan.Times.LessThan50ms); - DicConsole.WriteLine("{0} of them took less than 150 ms but more than 50 ms", Core.Statistics.AllStats.MediaScan.Times.LessThan150ms); - DicConsole.WriteLine("{0} of them took less than 500 ms but more than 150 ms", Core.Statistics.AllStats.MediaScan.Times.LessThan500ms); - DicConsole.WriteLine("{0} of them took less than more than 500 ms", Core.Statistics.AllStats.MediaScan.Times.MoreThan500ms); + DicConsole.WriteLine("{0} of them took less than 3 ms", + Core.Statistics.AllStats.MediaScan.Times.LessThan3ms); + DicConsole.WriteLine("{0} of them took less than 10 ms but more than 3 ms", + Core.Statistics.AllStats.MediaScan.Times.LessThan10ms); + DicConsole.WriteLine("{0} of them took less than 50 ms but more than 10 ms", + Core.Statistics.AllStats.MediaScan.Times.LessThan50ms); + DicConsole.WriteLine("{0} of them took less than 150 ms but more than 50 ms", + Core.Statistics.AllStats.MediaScan.Times.LessThan150ms); + DicConsole.WriteLine("{0} of them took less than 500 ms but more than 150 ms", + Core.Statistics.AllStats.MediaScan.Times.LessThan500ms); + DicConsole.WriteLine("{0} of them took less than more than 500 ms", + Core.Statistics.AllStats.MediaScan.Times.MoreThan500ms); thereAreStats = true; } @@ -187,18 +225,21 @@ namespace DiscImageChef.Commands { DicConsole.WriteLine("Verification statistics"); DicConsole.WriteLine("======================="); - DicConsole.WriteLine("{0} media images has been correctly verified", Core.Statistics.AllStats.Verify.MediaImages.Correct); - DicConsole.WriteLine("{0} media images has been determined as containing errors", Core.Statistics.AllStats.Verify.MediaImages.Failed); + DicConsole.WriteLine("{0} media images has been correctly verified", + Core.Statistics.AllStats.Verify.MediaImages.Correct); + DicConsole.WriteLine("{0} media images has been determined as containing errors", + Core.Statistics.AllStats.Verify.MediaImages.Failed); DicConsole.WriteLine("{0} sectors has been verified", Core.Statistics.AllStats.Verify.Sectors.Total); - DicConsole.WriteLine("{0} sectors has been determined correct", Core.Statistics.AllStats.Verify.Sectors.Correct); - DicConsole.WriteLine("{0} sectors has been determined to contain errors", Core.Statistics.AllStats.Verify.Sectors.Error); - DicConsole.WriteLine("{0} sectors could not be determined as correct or not", Core.Statistics.AllStats.Verify.Sectors.Unverifiable); + DicConsole.WriteLine("{0} sectors has been determined correct", + Core.Statistics.AllStats.Verify.Sectors.Correct); + DicConsole.WriteLine("{0} sectors has been determined to contain errors", + Core.Statistics.AllStats.Verify.Sectors.Error); + DicConsole.WriteLine("{0} sectors could not be determined as correct or not", + Core.Statistics.AllStats.Verify.Sectors.Unverifiable); thereAreStats = true; } - if(!thereAreStats) - DicConsole.WriteLine("There are no statistics."); + if(!thereAreStats) DicConsole.WriteLine("There are no statistics."); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Commands/Verify.cs b/DiscImageChef/Commands/Verify.cs index ff49f6cc..d4e97436 100644 --- a/DiscImageChef/Commands/Verify.cs +++ b/DiscImageChef/Commands/Verify.cs @@ -108,15 +108,10 @@ namespace DiscImageChef.Commands try { List inputTracks = inputFormat.GetTracks(); - if(inputTracks.Count > 0) - formatHasTracks = true; - else - formatHasTracks = false; - } - catch - { - formatHasTracks = false; + if(inputTracks.Count > 0) formatHasTracks = true; + else formatHasTracks = false; } + catch { formatHasTracks = false; } DateTime StartCheck; DateTime EndCheck; @@ -137,31 +132,29 @@ namespace DiscImageChef.Commands while(remainingSectors > 0) { - DicConsole.Write("\rChecking sector {0} of {1}, on track {2}", currentSectorAll, inputFormat.GetSectors(), currentTrack.TrackSequence); + DicConsole.Write("\rChecking sector {0} of {1}, on track {2}", currentSectorAll, + inputFormat.GetSectors(), currentTrack.TrackSequence); List tempFailingLBAs; List tempUnknownLBAs; bool? tempStatus; if(remainingSectors < 512) - tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors, currentTrack.TrackSequence, out tempFailingLBAs, out tempUnknownLBAs); + tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors, + currentTrack.TrackSequence, out tempFailingLBAs, + out tempUnknownLBAs); else - tempStatus = inputFormat.VerifySectors(currentSector, 512, currentTrack.TrackSequence, out tempFailingLBAs, out tempUnknownLBAs); + tempStatus = inputFormat.VerifySectors(currentSector, 512, currentTrack.TrackSequence, + out tempFailingLBAs, out tempUnknownLBAs); - if(checkStatus == null || tempStatus == null) - checkStatus = null; - else if(checkStatus == false || tempStatus == false) - checkStatus = false; - else if(checkStatus == true && tempStatus == true) - checkStatus = true; - else - checkStatus = null; + if(checkStatus == null || tempStatus == null) checkStatus = null; + else if(checkStatus == false || tempStatus == false) checkStatus = false; + else if(checkStatus == true && tempStatus == true) checkStatus = true; + else checkStatus = null; - foreach(ulong failLBA in tempFailingLBAs) - FailingLBAs.Add(failLBA); + foreach(ulong failLBA in tempFailingLBAs) FailingLBAs.Add(failLBA); - foreach(ulong unknownLBA in tempUnknownLBAs) - UnknownLBAs.Add(unknownLBA); + foreach(ulong unknownLBA in tempUnknownLBAs) UnknownLBAs.Add(unknownLBA); if(remainingSectors < 512) { @@ -175,9 +168,9 @@ namespace DiscImageChef.Commands currentSectorAll += 512; remainingSectors -= 512; } - } } + EndCheck = DateTime.UtcNow; } else @@ -195,24 +188,20 @@ namespace DiscImageChef.Commands bool? tempStatus; if(remainingSectors < 512) - tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors, out tempFailingLBAs, out tempUnknownLBAs); + tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors, + out tempFailingLBAs, out tempUnknownLBAs); else - tempStatus = inputFormat.VerifySectors(currentSector, 512, out tempFailingLBAs, out tempUnknownLBAs); + tempStatus = + inputFormat.VerifySectors(currentSector, 512, out tempFailingLBAs, out tempUnknownLBAs); - if(checkStatus == null || tempStatus == null) - checkStatus = null; - else if(checkStatus == false || tempStatus == false) - checkStatus = false; - else if(checkStatus == true && tempStatus == true) - checkStatus = true; - else - checkStatus = null; + if(checkStatus == null || tempStatus == null) checkStatus = null; + else if(checkStatus == false || tempStatus == false) checkStatus = false; + else if(checkStatus == true && tempStatus == true) checkStatus = true; + else checkStatus = null; - foreach(ulong failLBA in tempFailingLBAs) - FailingLBAs.Add(failLBA); + foreach(ulong failLBA in tempFailingLBAs) FailingLBAs.Add(failLBA); - foreach(ulong unknownLBA in tempUnknownLBAs) - UnknownLBAs.Add(unknownLBA); + foreach(ulong unknownLBA in tempUnknownLBAs) UnknownLBAs.Add(unknownLBA); if(remainingSectors < 512) { @@ -224,8 +213,8 @@ namespace DiscImageChef.Commands currentSector += 512; remainingSectors -= 512; } - } + EndCheck = DateTime.UtcNow; } @@ -254,15 +243,13 @@ namespace DiscImageChef.Commands if(FailingLBAs.Count == (int)inputFormat.GetSectors()) DicConsole.VerboseWriteLine("\tall sectors."); else - for(int i = 0; i < FailingLBAs.Count; i++) - DicConsole.VerboseWriteLine("\t{0}", FailingLBAs[i]); + for(int i = 0; i < FailingLBAs.Count; i++) DicConsole.VerboseWriteLine("\t{0}", FailingLBAs[i]); DicConsole.WriteLine("LBAs without checksum:"); if(UnknownLBAs.Count == (int)inputFormat.GetSectors()) DicConsole.VerboseWriteLine("\tall sectors."); else - for(int i = 0; i < UnknownLBAs.Count; i++) - DicConsole.VerboseWriteLine("\t{0}", UnknownLBAs[i]); + for(int i = 0; i < UnknownLBAs.Count; i++) DicConsole.VerboseWriteLine("\t{0}", UnknownLBAs[i]); } DicConsole.WriteLine("Total sectors........... {0}", inputFormat.GetSectors()); @@ -280,5 +267,4 @@ namespace DiscImageChef.Commands Core.Statistics.AddVerify(correctDisc, correctSectors, errorSectors, unknownSectors, totalSectors); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Main.cs b/DiscImageChef/Main.cs index 87ac6456..1508cb56 100644 --- a/DiscImageChef/Main.cs +++ b/DiscImageChef/Main.cs @@ -47,208 +47,143 @@ namespace DiscImageChef Settings.Settings.LoadSettings(); Core.Statistics.LoadStats(); - if(Settings.Settings.Current.Stats.ShareStats) - Core.Statistics.SubmitStats(); + if(Settings.Settings.Current.Stats.ShareStats) Core.Statistics.SubmitStats(); - Parser.Default.ParseArguments(args, new[] {typeof(AnalyzeOptions), typeof(CompareOptions), typeof(ChecksumOptions), - typeof(EntropyOptions), typeof(VerifyOptions), typeof(PrintHexOptions), - typeof(DecodeOptions), typeof(DeviceInfoOptions), typeof(MediaInfoOptions), - typeof(MediaScanOptions), typeof(FormatsOptions), typeof(BenchmarkOptions), - typeof(CreateSidecarOptions), - typeof(DumpMediaOptions), typeof(DeviceReportOptions), - typeof(ConfigureOptions), typeof(StatsOptions), typeof(LsOptions), - typeof(ExtractFilesOptions), typeof(ListDevicesOptions), typeof(ListEncodingsOptions)}) - .WithParsed(opts => + Parser.Default + .ParseArguments(args, + new[] + { + typeof(AnalyzeOptions), typeof(CompareOptions), typeof(ChecksumOptions), + typeof(EntropyOptions), typeof(VerifyOptions), typeof(PrintHexOptions), + typeof(DecodeOptions), typeof(DeviceInfoOptions), typeof(MediaInfoOptions), + typeof(MediaScanOptions), typeof(FormatsOptions), typeof(BenchmarkOptions), + typeof(CreateSidecarOptions), typeof(DumpMediaOptions), + typeof(DeviceReportOptions), typeof(ConfigureOptions), typeof(StatsOptions), + typeof(LsOptions), typeof(ExtractFilesOptions), typeof(ListDevicesOptions), + typeof(ListEncodingsOptions) + }).WithParsed(opts => { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; PrintCopyright(); Commands.Analyze.doAnalyze(opts); - }) - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.Compare.doCompare(opts); - }) - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.Checksum.doChecksum(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.Entropy.doEntropy(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.Verify.doVerify(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.PrintHex.doPrintHex(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.Decode.doDecode(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.DeviceInfo.doDeviceInfo(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.MediaInfo.doMediaInfo(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.MediaScan.doMediaScan(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.Formats.ListFormats(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.Benchmark.doBenchmark(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.CreateSidecar.doSidecar(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.DumpMedia.doDumpMedia(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.DeviceReport.doDeviceReport(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.Ls.doLs(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.ExtractFiles.doExtractFiles(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.ListDevices.doListDevices(opts); - }) - - .WithParsed(opts => - { - if(opts.Debug) - DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; - if(opts.Verbose) - DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; - PrintCopyright(); - Commands.ListEncodings.DoList(opts); - }) - - .WithParsed(opts => { PrintCopyright(); Commands.Configure.doConfigure(); }) - .WithParsed(opts => { PrintCopyright(); Commands.Statistics.showStats(); }) - .WithNotParsed(errs => Environment.Exit(1)); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.Compare.doCompare(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.Checksum.doChecksum(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.Entropy.doEntropy(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.Verify.doVerify(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.PrintHex.doPrintHex(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.Decode.doDecode(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.DeviceInfo.doDeviceInfo(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.MediaInfo.doMediaInfo(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.MediaScan.doMediaScan(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.Formats.ListFormats(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.Benchmark.doBenchmark(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.CreateSidecar.doSidecar(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.DumpMedia.doDumpMedia(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.DeviceReport.doDeviceReport(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.Ls.doLs(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.ExtractFiles.doExtractFiles(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.ListDevices.doListDevices(opts); + }).WithParsed(opts => + { + if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; + if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; + PrintCopyright(); + Commands.ListEncodings.DoList(opts); + }).WithParsed(opts => + { + PrintCopyright(); + Commands.Configure.doConfigure(); + }).WithParsed(opts => + { + PrintCopyright(); + Commands.Statistics.showStats(); + }).WithNotParsed(errs => Environment.Exit(1)); Core.Statistics.SaveStats(); } @@ -266,5 +201,4 @@ namespace DiscImageChef DicConsole.WriteLine(); } } -} - +} \ No newline at end of file diff --git a/DiscImageChef/Options.cs b/DiscImageChef/Options.cs index bb95df01..c195b1d2 100644 --- a/DiscImageChef/Options.cs +++ b/DiscImageChef/Options.cs @@ -46,12 +46,10 @@ namespace DiscImageChef [Verb("analyze", HelpText = "Analyzes a disc image and searches for partitions and/or filesystems.")] public class AnalyzeOptions : CommonOptions { - [Option('p', "partitions", Default = true, - HelpText = "Searches and interprets partitions.")] + [Option('p', "partitions", Default = true, HelpText = "Searches and interprets partitions.")] public bool SearchForPartitions { get; set; } - [Option('f', "filesystems", Default = true, - HelpText = "Searches and interprets partitions.")] + [Option('f', "filesystems", Default = true, HelpText = "Searches and interprets partitions.")] public bool SearchForFilesystems { get; set; } [Option('i', "input", Required = true, HelpText = "Disc image.")] @@ -74,28 +72,22 @@ namespace DiscImageChef [Verb("checksum", HelpText = "Checksums an image.")] public class ChecksumOptions : CommonOptions { - [Option('t', "separated-tracks", Default = true, - HelpText = "Checksums each track separately.")] + [Option('t', "separated-tracks", Default = true, HelpText = "Checksums each track separately.")] public bool SeparatedTracks { get; set; } - [Option('w', "whole-disc", Default = true, - HelpText = "Checksums the whole disc.")] + [Option('w', "whole-disc", Default = true, HelpText = "Checksums the whole disc.")] public bool WholeDisc { get; set; } - [Option('a', "adler32", Default = true, - HelpText = "Calculates Adler-32.")] + [Option('a', "adler32", Default = true, HelpText = "Calculates Adler-32.")] public bool DoAdler32 { get; set; } - [Option("crc16", Default = true, - HelpText = "Calculates CRC16.")] + [Option("crc16", Default = true, HelpText = "Calculates CRC16.")] public bool DoCRC16 { get; set; } - [Option('c', "crc32", Default = true, - HelpText = "Calculates CRC32.")] + [Option('c', "crc32", Default = true, HelpText = "Calculates CRC32.")] public bool DoCRC32 { get; set; } - [Option("crc64", Default = false, - HelpText = "Calculates CRC64 (ECMA).")] + [Option("crc64", Default = false, HelpText = "Calculates CRC64 (ECMA).")] public bool DoCRC64 { get; set; } /*[Option("fletcher16", Default = false, @@ -106,32 +98,25 @@ namespace DiscImageChef HelpText = "Calculates Fletcher-32.")] public bool DoFletcher32 { get; set; }*/ - [Option('m', "md5", Default = true, - HelpText = "Calculates MD5.")] + [Option('m', "md5", Default = true, HelpText = "Calculates MD5.")] public bool DoMD5 { get; set; } - [Option("ripemd160", Default = false, - HelpText = "Calculates RIPEMD160.")] + [Option("ripemd160", Default = false, HelpText = "Calculates RIPEMD160.")] public bool DoRIPEMD160 { get; set; } - [Option('s', "sha1", Default = true, - HelpText = "Calculates SHA1.")] + [Option('s', "sha1", Default = true, HelpText = "Calculates SHA1.")] public bool DoSHA1 { get; set; } - [Option("sha256", Default = false, - HelpText = "Calculates SHA256.")] + [Option("sha256", Default = false, HelpText = "Calculates SHA256.")] public bool DoSHA256 { get; set; } - [Option("sha384", Default = false, - HelpText = "Calculates SHA384.")] + [Option("sha384", Default = false, HelpText = "Calculates SHA384.")] public bool DoSHA384 { get; set; } - [Option("sha512", Default = false, - HelpText = "Calculates SHA512.")] + [Option("sha512", Default = false, HelpText = "Calculates SHA512.")] public bool DoSHA512 { get; set; } - [Option('f', "spamsum", Default = true, - HelpText = "Calculates SpamSum fuzzy hash.")] + [Option('f', "spamsum", Default = true, HelpText = "Calculates SpamSum fuzzy hash.")] public bool DoSpamSum { get; set; } [Option('i', "input", Required = true, HelpText = "Disc image.")] @@ -145,12 +130,10 @@ namespace DiscImageChef HelpText = "Calculates how many sectors are duplicated (have same exact data in user area).")] public bool DuplicatedSectors { get; set; } - [Option('t', "separated-tracks", Default = true, - HelpText = "Calculates entropy for each track separately.")] + [Option('t', "separated-tracks", Default = true, HelpText = "Calculates entropy for each track separately.")] public bool SeparatedTracks { get; set; } - [Option('w', "whole-disc", Default = true, - HelpText = "Calculates entropy for the whole disc.")] + [Option('w', "whole-disc", Default = true, HelpText = "Calculates entropy for the whole disc.")] public bool WholeDisc { get; set; } [Option('i', "input", Required = true, HelpText = "Disc image.")] @@ -160,12 +143,10 @@ namespace DiscImageChef [Verb("verify", HelpText = "Verifies a disc image integrity, and if supported, sector integrity.")] public class VerifyOptions : CommonOptions { - [Option('w', "verify-disc", Default = true, - HelpText = "Verify disc image if supported.")] + [Option('w', "verify-disc", Default = true, HelpText = "Verify disc image if supported.")] public bool VerifyDisc { get; set; } - [Option('s', "verify-sectors", Default = true, - HelpText = "Verify all sectors if supported.")] + [Option('s', "verify-sectors", Default = true, HelpText = "Verify all sectors if supported.")] public bool VerifySectors { get; set; } [Option('i', "input", Required = true, HelpText = "Disc image.")] @@ -175,20 +156,16 @@ namespace DiscImageChef [Verb("printhex", HelpText = "Prints a sector, in hexadecimal values, to the console.")] public class PrintHexOptions : CommonOptions { - [Option('s', "start", Required = true, - HelpText = "Start sector.")] + [Option('s', "start", Required = true, HelpText = "Start sector.")] public ulong StartSector { get; set; } - [Option('l', "length", Default = (ulong)1, - HelpText = "How many sectors to print.")] + [Option('l', "length", Default = (ulong)1, HelpText = "How many sectors to print.")] public ulong Length { get; set; } - [Option('r', "long-sectors", Default = false, - HelpText = "Print sectors with tags included.")] + [Option('r', "long-sectors", Default = false, HelpText = "Print sectors with tags included.")] public bool LongSectors { get; set; } - [Option('w', "width", Default = (ushort)32, - HelpText = "How many bytes to print per line.")] + [Option('w', "width", Default = (ushort)32, HelpText = "How many bytes to print per line.")] public ushort WidthBytes { get; set; } [Option('i', "input", Required = true, HelpText = "Disc image.")] @@ -198,20 +175,16 @@ namespace DiscImageChef [Verb("decode", HelpText = "Decodes and pretty prints disk and/or sector tags.")] public class DecodeOptions : CommonOptions { - [Option('s', "start", Default = (ulong)0, - HelpText = "Start sector.")] + [Option('s', "start", Default = (ulong)0, HelpText = "Start sector.")] public ulong StartSector { get; set; } - [Option('l', "length", Default = "all", - HelpText = "How many sectors to decode, or \"all\".")] + [Option('l', "length", Default = "all", HelpText = "How many sectors to decode, or \"all\".")] public string Length { get; set; } - [Option('k', "disk-tags", Default = true, - HelpText = "Decode disk tags.")] + [Option('k', "disk-tags", Default = true, HelpText = "Decode disk tags.")] public bool DiskTags { get; set; } - [Option('t', "sector-tags", Default = true, - HelpText = "Decode sector tags.")] + [Option('t', "sector-tags", Default = true, HelpText = "Decode sector tags.")] public bool SectorTags { get; set; } [Option('i', "input", Required = true, HelpText = "Disc image.")] @@ -224,7 +197,8 @@ namespace DiscImageChef [Option('i', "device", Required = true, HelpText = "Device path.")] public string DevicePath { get; set; } - [Option('w', "output-prefix", Required = false, Default = "", HelpText = "Write binary responses from device with that prefix.")] + [Option('w', "output-prefix", Required = false, Default = "", + HelpText = "Write binary responses from device with that prefix.")] public string OutputPrefix { get; set; } } @@ -234,7 +208,8 @@ namespace DiscImageChef [Option('i', "device", Required = true, HelpText = "Device path.")] public string DevicePath { get; set; } - [Option('w', "output-prefix", Required = false, Default = "", HelpText = "Write binary responses from device with that prefix.")] + [Option('w', "output-prefix", Required = false, Default = "", + HelpText = "Write binary responses from device with that prefix.")] public string OutputPrefix { get; set; } } @@ -244,17 +219,17 @@ namespace DiscImageChef [Option('i', "device", Required = true, HelpText = "Device path.")] public string DevicePath { get; set; } - [Option('m', "mhdd-log", Required = false, Default = "", HelpText = "Write a log of the scan in the format used by MHDD.")] + [Option('m', "mhdd-log", Required = false, Default = "", + HelpText = "Write a log of the scan in the format used by MHDD.")] public string MHDDLogPath { get; set; } - [Option('b', "ibg-log", Required = false, Default = "", HelpText = "Write a log of the scan in the format used by ImgBurn.")] + [Option('b', "ibg-log", Required = false, Default = "", + HelpText = "Write a log of the scan in the format used by ImgBurn.")] public string IBGLogPath { get; set; } } [Verb("formats", HelpText = "Lists all supported disc images, partition schemes and file systems.")] - public class FormatsOptions : CommonOptions - { - } + public class FormatsOptions : CommonOptions { } [Verb("benchmark", HelpText = "Benchmarks hashing and entropy calculation.")] public class BenchmarkOptions : CommonOptions @@ -271,9 +246,13 @@ namespace DiscImageChef { [Option('i', "input", Required = true, HelpText = "Disc image.")] public string InputFile { get; set; } - [Option('t', "tape", Required = false, Default = false, HelpText = "When used indicates that input is a folder containing alphabetically sorted files extracted from a linear block-based tape with fixed block size (e.g. a SCSI tape device).")] + [Option('t', "tape", Required = false, Default = false, + HelpText = + "When used indicates that input is a folder containing alphabetically sorted files extracted from a linear block-based tape with fixed block size (e.g. a SCSI tape device).")] public bool Tape { get; set; } - [Option('b', "block-size", Required = false, Default = 512, HelpText = "Only used for tapes, indicates block size. Files in the folder whose size is not a multiple of this value will simply be ignored.")] + [Option('b', "block-size", Required = false, Default = 512, + HelpText = + "Only used for tapes, indicates block size. Files in the folder whose size is not a multiple of this value will simply be ignored.")] public int BlockSize { get; set; } [Option('e', "encoding", Default = null, HelpText = "Name of character encoding to use.")] @@ -293,28 +272,23 @@ namespace DiscImageChef HelpText = "Dump sectors with tags included. For optical media, dump scrambled sectors")] public bool Raw { get; set; } - [Option('s', "stop-on-error", Default = false, - HelpText = "Stop media dump on first error.")] + [Option('s', "stop-on-error", Default = false, HelpText = "Stop media dump on first error.")] public bool StopOnError { get; set; } - [Option('f', "force", Default = false, - HelpText = "Continue dump whatever happens.")] + [Option('f', "force", Default = false, HelpText = "Continue dump whatever happens.")] public bool Force { get; set; } - [Option('p', "retry-passes", Default = (ushort)5, - HelpText = "How many retry passes to do.")] + [Option('p', "retry-passes", Default = (ushort)5, HelpText = "How many retry passes to do.")] public ushort RetryPasses { get; set; } - [Option("persistent", Default = false, - HelpText = "Try to recover partial or incorrect data.")] + [Option("persistent", Default = false, HelpText = "Try to recover partial or incorrect data.")] public bool Persistent { get; set; } [Option("separate-subchannel", Default = false, - HelpText = "Save subchannel in a separate file. Only applicable to CD/DDCD/GD.")] + HelpText = "Save subchannel in a separate file. Only applicable to CD/DDCD/GD.")] public bool SeparateSubchannel { get; set; } - [Option('m', "resume", Default = true, - HelpText = "Create/use resume mapfile.")] + [Option('m', "resume", Default = true, HelpText = "Create/use resume mapfile.")] public bool Resume { get; set; } [Option("lead-in", Default = false, HelpText = "Try to read lead-in. Only applicable to CD/DDCD/GD.")] @@ -332,14 +306,10 @@ namespace DiscImageChef } [Verb("configure", HelpText = "Configures user settings and statistics.")] - public class ConfigureOptions - { - } + public class ConfigureOptions { } [Verb("stats", HelpText = "Shows statistics.")] - public class StatsOptions - { - } + public class StatsOptions { } [Verb("ls", HelpText = "Lists files in disc image.")] public class LsOptions : CommonOptions @@ -360,7 +330,8 @@ namespace DiscImageChef [Option('i', "input", Required = true, HelpText = "Disc image.")] public string InputFile { get; set; } - [Option('o', "output", Required = true, HelpText = "Directory where extracted files will be created. Will abort if it exists.")] + [Option('o', "output", Required = true, + HelpText = "Directory where extracted files will be created. Will abort if it exists.")] public string OutputDir { get; set; } [Option('x', "xattrs", Default = false, HelpText = "Extract extended attributes if present.")] @@ -371,13 +342,8 @@ namespace DiscImageChef } [Verb("list-devices", HelpText = "Lists all connected devices.")] - public class ListDevicesOptions : CommonOptions - { - } + public class ListDevicesOptions : CommonOptions { } [Verb("list-encodings", HelpText = "Lists all supported text encodings and code pages.")] - public class ListEncodingsOptions : CommonOptions - { - } -} - + public class ListEncodingsOptions : CommonOptions { } +} \ No newline at end of file diff --git a/DiscImageChef/Progress.cs b/DiscImageChef/Progress.cs index 5deb8f0b..e2e00bbb 100644 --- a/DiscImageChef/Progress.cs +++ b/DiscImageChef/Progress.cs @@ -36,9 +36,7 @@ namespace DiscImageChef { public static class Progress { - public static void InitProgress() - { - } + public static void InitProgress() { } public static void EndProgress() { @@ -50,9 +48,7 @@ namespace DiscImageChef DicConsole.Write("\r" + text); } - public static void InitProgress2() - { - } + public static void InitProgress2() { } public static void EndProgress2() { @@ -64,16 +60,15 @@ namespace DiscImageChef DicConsole.Write("\r" + text); } - public static void InitTwoProgress() - { - } + public static void InitTwoProgress() { } public static void EndTwoProgress() { DicConsole.WriteLine(); } - public static void UpdateTwoProgress(string text, long current, long maximum, string text2, long current2, long maximum2) + public static void UpdateTwoProgress(string text, long current, long maximum, string text2, long current2, + long maximum2) { DicConsole.Write("\r" + text + ": " + text2); } @@ -83,4 +78,4 @@ namespace DiscImageChef DicConsole.WriteLine(text); } } -} +} \ No newline at end of file diff --git a/DiscImageChef/packages.config b/DiscImageChef/packages.config index 0a9df8b8..3cb0221d 100644 --- a/DiscImageChef/packages.config +++ b/DiscImageChef/packages.config @@ -1,6 +1,7 @@  + - - - + + + \ No newline at end of file